標籤:
今天項目遷移,重新換了一個資料庫版本,然後問題來了,原本運行正常的程式遷移過來之後就是不能正常運行,後台報錯如下:
update tbl_user_info set -- 強制下架 mv_count = mv_count-1, update_time=now() where user_id = ?; update tbl_user_info a,tbl_mv_like b set a.enjoy_num = a.enjoy_num -1, a.update_time = now() where b.mvlikeId = ? and b.userId =a.user_id and b.userId != ? and b.isLIke = 1 and b.state = 0
### Cause: java.sql.SQLException: Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.
; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1785]; Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.; nested exception is java.sql.SQLException: Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.
網上查了一下 Statement violates GTID consistency這個,然後看到這個網頁https://dev.mysql.com/doc/refman/5.6/en/replication-options-gtids.html,一開始還以為是資料庫模式的問題,後面看了下資料庫表,才知道原來是營運人員在新的資料庫上把我的資料庫表的模式設定成了MyISAM這個模式,然後去資料庫show engines了一下,
可以看到,這個模式是不支援事物的,將它修改為InnoDB,問題搞定
mysql Statement violates GTID consistency 的坑