mysql數(shù)據(jù)庫開機報錯:
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100224 12:24:20 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Transaction 0 4497755 was in the XA prepared state.
InnoDB: Transaction 0 4468551 was in the XA prepared state.
InnoDB: Transaction 0 4468140 was in the XA prepared state.
InnoDB: 3 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 0 row operations to undo
InnoDB: Trx id counter is 0 5312768
InnoDB: Starting in background the rollback of uncommitted transactions
100224 12:24:20 InnoDB: Rollback of non-prepared transactions completed
100224 12:24:20 InnoDB: Started; log sequence number 0 3805002509
100224 12:24:20 InnoDB: Starting recovery for XA transactions...
100224 12:24:20 InnoDB: Transaction 0 4497755 in prepared state after recovery
100224 12:24:20 InnoDB: Transaction contains changes to 8 rows
100224 12:24:20 InnoDB: Transaction 0 4468551 in prepared state after recovery
100224 12:24:20 InnoDB: Transaction contains changes to 1 rows
100224 12:24:20 InnoDB: Transaction 0 4468140 in prepared state after recovery
100224 12:24:20 InnoDB: Transaction contains changes to 1 rows
100224 12:24:20 InnoDB: 3 transactions in prepared state after recovery
100224 12:24:20 [Note] Found 3 prepared transaction(s) in InnoDB
100224 12:24:20 [Warning] Found 3 prepared XA transactions
100224 12:24:20 [Note] Event Scheduler: Loaded 0 events
100224 12:24:20 [Note] /opt/mysql/bin/mysqld: ready for connections.
Version: '5.1.39' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
意味著有三個XA的事務(wù)沒有提交或回滾。
登錄到mysql
mysql> xa recover;
+----------+--------------+--------------+------------------------------------------------------------+
| formatID | gtrid_length | bqual_length | data |
+----------+--------------+--------------+------------------------------------------------------------+
| 131075 | 30 | 28 | 1-7f000001:bae5:4b6928eb:f06397f000001:bae5:4b6928eb:f0650 |
| 131075 | 30 | 28 | 1-7f000001:bae5:4b6928eb:fb5c37f000001:bae5:4b6928eb:fb5cd |
| 131075 | 30 | 28 | 1-7f000001:bae5:4b6928eb:f03ea7f000001:bae5:4b6928eb:f0400 |
+----------+--------------+--------------+------------------------------------------------------------+
數(shù)據(jù)表示信息如下:
formatIDis the formatIDpart of the transaction xid
gtrid_lengthis the length in bytes of the gtridpart of the xid
bqual_lengthis the length in bytes of the bqualpart of the xid
datais the concatenation of the gtridand bqualparts of the xid
這是三個XA事務(wù)的信息,準備直接回滾。
mysql> xa rollback '1-7f000001:bae5:4b6928eb:fb5c3','7f000001:bae5:4b6928eb:fb5cd',131075;
Query OK, 0 rows affected (0.41 sec)
再啟動就正常了。
MySQL XA
I.5. 對XA事務(wù)的限制
XA事務(wù)支持限于InnoDB存儲引擎。
MySQL XA實施是針對外部XA的,其中,MySQL服務(wù)器作為資源管理器,而客戶端程序作為事務(wù)管理器。未實施“內(nèi)部XA”。這樣,就允許MySQL服務(wù)器內(nèi)的單獨存儲引擎作為RM(資源管理器),而服務(wù)器本身作為TM(事務(wù)管理器)。處理包含1個以上存儲引擎的XA事務(wù)時,需要內(nèi)部XA。內(nèi)部XA的實施是不完整的,這是因為,它要求存儲引擎在表處理程序?qū)用嫔现С謨呻A段提交,目前僅對InnoDB實現(xiàn)了該特性。
對于XA START,不支持JOIN和RESUME子句。
對于XA END,不支持SUSPEND [FOR MIGRATE]子句。
在全局事務(wù)內(nèi),對于每個XA事務(wù),xid值的bqual部分應(yīng)是不同的,該要求是對當前MySQL XA實施的限制。它不是XA規(guī)范的組成部分。
如果XA事務(wù)達到PREPARED狀態(tài)而且MySQL服務(wù)器宕機,當服務(wù)器重啟后,能夠繼續(xù)處理事務(wù)。就像原本應(yīng)當?shù)哪菢印5牵绻蛻舳诉B接中止而服務(wù)器繼續(xù)運行,服務(wù)器將回滾任何未完成的XA事務(wù),即使該事務(wù)已達到PREPARED狀態(tài)也同樣。它應(yīng)能提交或回滾PREPARED XA事務(wù),但在不更改二進制日志機制的情況下不能這樣。
mysql的XA事務(wù)恢復過程詳解
2019-12-10 14:56MYSQL教程網(wǎng) Mysql
XA事務(wù)支持限于InnoDB存儲引擎,本文將詳細介紹mysql的XA事務(wù)恢復過程
延伸 · 閱讀
- 2022-03-11MySQL的索引你了解嗎
- 2022-03-10面試中老生常談的MySQL問答集錦夯實基礎(chǔ)
- 2022-03-10淺談如何保證Mysql主從一致
- 2022-03-10Ubuntu18.04(linux)安裝MySQL的方法步驟
- 2022-03-09MySQL讓人又愛又恨的多表查詢
- 2022-03-09MySQL Server 層和存儲引擎層是怎么交互數(shù)據(jù)的?
- Mysql
Centos7下使用yum安裝mysql數(shù)據(jù)庫的詳細教程(增強版)
這篇文章主要介紹了Centos7下使用yum安裝mysql數(shù)據(jù)庫的詳細教程(增強版),非常不錯,具有參考借鑒價值,需要的朋友可以參考下 ...
- Mysql
MySQL全文索引、聯(lián)合索引、like查詢、json查詢速度哪個快
這篇文章主要介紹了MySQL全文索引、聯(lián)合索引、like查詢、json查詢速度大比拼,通過實例代碼截圖的形式給大家介紹的非常詳細,具有一定的參考借鑒價值...
- Mysql
MySQL 查詢速度慢與性能差的原因與解決方法
隨著網(wǎng)站數(shù)據(jù)量與訪問量的增加,MySQL 查詢速度慢與性能差的問題就日漸明顯,這里為大家分享一下解決方法,需要的朋友可以參考下...
- Mysql
幾種MySQL中的聯(lián)接查詢操作方法總結(jié)
這篇文章主要介紹了幾種MySQL中的聯(lián)接查詢操作方法總結(jié),文中包括一些代碼舉例講解,需要的朋友可以參考下 ...
- Mysql
MySQL server has gone away錯誤提示解決方法
今天遇到類似的情景,MySQL只是冷冷的說:MySQL server has gone away。 ...
- Mysql
解決重置Mysql root用戶賬號密碼問題
這篇文章主要介紹了解決重置Mysql root用戶賬號密碼問題,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下...
- Mysql
MySQL之Field‘***’doesn’t have a default value錯誤解決辦法
這篇文章主要介紹了MySQL之Field‘***’doesn’t have a default value錯誤解決辦法,需要的朋友可以參考下 ...
- Mysql
MySQL鎖的知識點總結(jié)
在本篇文章里小編給大家整理了關(guān)于MySQL鎖的知識點總結(jié)以及實例內(nèi)容,需要的朋友們學習下。...