資料庫在宕機時(磁盤滿了造成的)有一個大事務(洗掉操作,洗掉7000萬行資料)在運行,所以當釋放磁盤空間后,重啟資料庫時,有看到資料庫在回滾,也重啟成功了,可是這張表執行單行delete時卻一直報:
[SQL] DELETE FROM gsid_and_ua WHERE id =4000000;
[Err] 1205 - Lock wait timeout exceeded; try restarting transaction
宕機后資料庫重啟日志如下:
2018-05-07 13:56:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-07 13:56:46 26864 [Note] Plugin 'FEDERATED' is disabled.
2018-05-07 13:56:46 26864 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-05-07 13:56:46 26864 [Note] InnoDB: The InnoDB memory heap is disabled
2018-05-07 13:56:46 26864 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-05-07 13:56:46 26864 [Note] InnoDB: Memory barrier is not used
2018-05-07 13:56:46 26864 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-05-07 13:56:46 26864 [Note] InnoDB: Using Linux native AIO
2018-05-07 13:56:46 26864 [Note] InnoDB: Using CPU crc32 instructions
2018-05-07 13:56:46 26864 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2018-05-07 13:56:46 26864 [Note] InnoDB: Completed initialization of buffer pool
2018-05-07 13:56:46 26864 [Note] InnoDB: Highest supported file format is Barracuda.
2018-05-07 13:56:46 26864 [Note] InnoDB: Log scan progressed past the checkpoint lsn 1501772147583
2018-05-07 13:56:46 26864 [Note] InnoDB: Database was not shutdown normally!
2018-05-07 13:56:46 26864 [Note] InnoDB: Starting crash recovery.
2018-05-07 13:56:46 26864 [Note] InnoDB: Reading tablespace information from the .ibd files...
2018-05-07 13:56:46 26864 [Note] InnoDB: Restoring possible half-written data pages
2018-05-07 13:56:46 26864 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1501777390080
InnoDB: Doing recovery: scanned up to log sequence number 1501782632960
InnoDB: Doing recovery: scanned up to log sequence number 1501783011554
InnoDB: 2 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 77912583 row operations to undo
InnoDB: Trx id counter is 2524048896
2018-05-07 14:00:09 26864 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2018-05-07 14:03:31 26864 [Note] InnoDB: 128 rollback segment(s) are active.
InnoDB: Starting in background the rollback of uncommitted transactions
2018-05-07 14:03:31 26864 [Note] InnoDB: Waiting for purge to start
2018-05-07 14:03:31 7f2662db6700 InnoDB: Rolling back trx with id 2524047944, 350 rows to undo
2018-05-07 14:03:31 26864 [Note] InnoDB: Rollback of trx with id 2524047944 completed
2018-05-07 14:03:31 7f2662db6700 InnoDB: Rolling back trx with id 2523159364, 77912233 rows to undo
InnoDB: Progress in percents: 12018-05-07 14:03:31 26864 [Note] InnoDB: 5.6.22 started; log sequence number 1501783011554
2018-05-07 14:03:31 26864 [Note] Server hostname (bind-address): '*'; port: 3306
2018-05-07 14:03:31 26864 [Note] IPv6 is available.
2018-05-07 14:03:31 26864 [Note] - '::' resolves to '::';
2018-05-07 14:03:31 26864 [Note] Server socket created on IP: '::'.
2018-05-07 14:03:32 26864 [Note] Event Scheduler: Loaded 0 events
2018-05-07 14:03:32 26864 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.22' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
uj5u.com熱心網友回復:
在查詢事務表中看到如了回滾操作:select * from information_schema.innodb_trx;

在我drop table 目標表之后,上面的事務表中欄位trx_weight就從7000萬慢慢降下來了,有人知道原因么?
uj5u.com熱心網友回復:
TRX_WEIGHTThe weight of a transaction, reflecting (but not necessarily the exact count of) the number of rows altered and the number of rows locked by the transaction.
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/89502.html
標籤:MySQL
上一篇:workbench報錯
下一篇:Mysql,啟動tomcat,登錄專案都沒問題,但是只要我一點擊專案中的模塊,需要從資料庫拉資料,mysql服務就報錯自動停止了
