0

考虑下面的代码,它尝试SerpKeyword在事务中创建一个新的并打印到控制台以显示它在哪里。

    if (!serpKeyword) {
        println "I DIDN'T FIND THE KEYWORD!"
        SerpKeyword.withNewTransaction {
            println "SO NOW I'M BEGINNING A TRANSACTION"
            serpKeyword = new SerpKeyword(
                    keyword: searchKeyword,
                    geoKeyword: geoKeyword,
                    concatenation: concatenation,
                    locale: locale
            )
            println "NOW I'LL SAVE THE KEYWORD"
            serpKeyword.save(failOnError: true, flush: true)
            println "AND NOW THE KEYWORD IS SAVED"
        }
    }

我马上看到的控制台输出是:

I DIDN'T FIND THE KEYWORD!
SO NOW I'M BEGINNING A TRANSACTION
NOW I'LL SAVE THE KEYWORD

我从来没有看到我的输出的最后一行,表明记录永远不会保存。我已经尝试过这个有和没有我传入的选项save。无论如何,它只是挂了一段时间,最终我得到了这个堆栈跟踪:

Got error -1 from storage engine. Stacktrace follows:
java.sql.SQLException: Got error -1 from storage engine
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at com.reachlocal.grails.sales.AdvertiserConnectionService$_findOrCreateSerpKeyword_closure9$$EO2A9QHA.doCall(AdvertiserConnectionService.groovy:624)
    at org.grails.datastore.gorm.GormStaticApi.withNewTransaction(GormStaticApi.groovy:696)
    at com.reachlocal.grails.sales.AdvertiserConnectionService$$EO2A9QHA.findOrCreateSerpKeyword(AdvertiserConnectionService.groovy:615)
    at com.reachlocal.grails.sales.AdvertiserConnectionService$$EO2A9QHA.createSerpEntryForKeyword(AdvertiserConnectionService.groovy:659)
    at com.reachlocal.grails.sales.AdvertiserConnectionService$$EO2A9QHA.addKeyword(AdvertiserConnectionService.groovy:51)
    at com.reachlocal.grails.serp.SerpController$_closure9.doCall(SerpController.groovy:77)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:65)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)

是什么赋予了?

4

2 回答 2

1

由于以下几个原因,您可能会收到“存储引擎出现错误 -1”:

  1. 您的数据库磁盘空间不足
  2. innodb_force_recovery您的 my.cnf 文件中有开关
  3. MySQL 表空间 ID 不匹配。

解决此问题的最佳方法是查看MySQL 错误日志

于 2013-04-05T19:57:04.123 回答
0

您是否将 id 生成策略设置为域类中的assigneda 以外的任何内容?sequence/autoserpKeyword

如果您也可以在帖子中添加域类,这将有助于调试。

于 2013-04-06T03:48:09.967 回答