设为首页 收藏本站
查看: 1112|回复: 0

[经验分享] [mysql bug]Failed to read auto-increment value from storage engine

[复制链接]

尚未签到

发表于 2016-10-22 07:25:37 | 显示全部楼层 |阅读模式
  
  [mysql bug]Failed to read auto-increment value from storage engine
  
  mysql版本:5.5.19
  
  据说这是mysql很早的一个bug,看来到目前这个版本还是没能彻底解决掉。
  
  bug讨论地址:http://bugs.mysql.com/bug.php?id=52193
  引用:
  [18 Mar 2010 19:56] Louis Breda van
  Description:
  Hello,
  
  The bug "Failed to read auto-increment value from storage engine" as reported earlier, is not / not completely fixed.
  It is causing me a serieus problem. Need to work arround it, do not yet know how.
  Below a futher explanation.
  
  Sincerely,
  Louis
  
  How to repeat:
  Envirement:
  VISTA64, ODBC 5.1.6, STUDIO2010 RC with patches, 6.x (latest) .NET driver, Server 5.5.2. Using VB.NET with ADODB
  
  Error Message
  "[MySQL][ODBC 5.1 Driver][mysqld-5.5.2-m2-community]Failed to read auto-increment value from storage engine"
  
  Occurs(1):
  1) insert a record having an autonumber as PK (.AddNew ..... .Update)
  - no explicit commits
  - recordset is opend dynamic
  - server or client site does not seems to matter (using serverside now)
  - lock pessimistic or optimistic does not seem te matter (using optimistic now)
  - having an unique index (in my case a string) "Unique Second Key" next to the PK
  - error handler in place, on error goto xyz
  
  2) try to add an record causing an "Unique Second Key" violation
  - the code jumps to the error handler
  - in a lot of cases the mentioned error will occur and not the expected duplicate key error
  
  Occurs(2) I think I also noticed the following situation
  3) insert a new record (no key violation) is OK
  
  4) perform a requery (to make sure the new record is in the actual set)
  
  5) try to fetch the generated autonumber PK
  (By the way, I would love to get the generated autonumber PK back in case of an auto number)
  I noticed that the problem temporarely disapears after truncating the related table. But that is hardly a solution :>
  
  Louis
  
  
  
  
  解决方案
  在进行数据的插入时,系统提示Failed to read auto-increment value from storage engine(从存储引擎读取自增字段失败)错误,经查阅资料,解决方法如下:
  1)把涉及数据表的自增字段的自增选项去掉,保存一下
  2)重新将这个字段设置为自增字段
  参考:http://blog.csdn.net/lhjtianji/article/details/6836451
  
  
  
  
  解决:“Failed to read auto-increment value from storage engine”
  今天遇到个问题,从其它平台上注册过来的用户经常出现“Failed to read auto-increment value from storage engine”错误。
  
  自己尝试了下,重现了这个错误,查了下日志:
  2008-11-26 13:45:12,815 ERROR [TP-Processor3] GoGoAction.createUser(368) | User 'lefteye123' already exists! Hibernate operation: could not insert: [game.joycube.common.model.User]; uncategorized SQLException for SQL [insert into user (address, city, country, postal_code, province, comment, createDate, account_enabled, joycube, joycube2, password, platform, registerDate, totalJoycube, totalJoycube2, usedJoycube, usedJoycube2, username, version) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [HY000]; error code [1467]; Failed to read auto-increment value from storage engine; nested exception is java.sql.SQLException: Failed to read auto-increment value from storage engine
  game.joycube.common.service.UserExistsException: User 'lefteye123' already exists! Hibernate operation: could not insert: [game.joycube.common.model.User]; uncategorized SQLException for SQL [insert into user (address, city, country, postal_code, province, comment, createDate, account_enabled, joycube, joycube2, password, platform, registerDate, totalJoycube, totalJoycube2, usedJoycube, usedJoycube2, username, version) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [HY000]; error code [1467]; Failed to read auto-increment value from storage engine; nested exception is java.sql.SQLException: Failed to read auto-increment value from storage engine
  
  从日志上来看,可能是mysql的BUG,不太可能是程序上的问题。
  
  搜索找到一篇文件:
  Bug #35602 "Failed to read auto-increment value from storage engine" with Innodb http://bugs.mysql.com/bug.php?id=35602
  
  其中有以下几句:
  [21 Aug 20:00] Bugs SystemPushed into 5.1.28 (revid:timothy.smith@sun.com-20080820004056-g05a56h7y8n0zczb) (version
  source revid:azundris@mysql.com-20080821081500-f2d61fh4u61owz3p) (pib:3)[25 Aug 22:19] Paul DuBoisNoted in 5.1.28 changelog.大意是这个BUG已经在5.1.28修改了,并加入到了changelog.
  
  然后查了下现在系统运行的mysql版本:5.1.28-rc。
  
  呵呵,看来是由msyql的BUG引起的,更新到最新版本就可以解决
  参考:http://hi.baidu.com/zhukunqian_/item/84bd01342d27995e81f1a719
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-289567-1-1.html 上篇帖子: mysql用户变量类型的问题想要1 得到1.0 下篇帖子: Yii框架操作数据库的几种方式与mysql_escape_string
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表