mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
MDEV-15826 Purge attempts to free BLOB page after BEGIN;INSERT;UPDATE;ROLLBACK
- During rollback, redo segments priorities over no-redo rollback segments and it leads to failure of redo rollback segment undo logs truncation.
This commit is contained in:
parent
1d98333ad9
commit
341edddc3d
3 changed files with 46 additions and 10 deletions
|
@ -140,3 +140,16 @@ CHECK TABLE test_tab;
|
|||
Table Op Msg_type Msg_text
|
||||
test.test_tab check status OK
|
||||
DROP TABLE test_tab;
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
CREATE TEMPORARY TABLE t2(i INT)ENGINE=InnoDB;
|
||||
CREATE TABLE t1(i TEXT NOT NULL) ENGINE=INNODB;
|
||||
BEGIN;
|
||||
INSERT t1 SET i=REPEAT('1234567890',840);
|
||||
UPDATE t1 SET i='';
|
||||
INSERT INTO t2 VALUES(2);
|
||||
ROLLBACK;
|
||||
InnoDB 0 transactions not purged
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
|
|
|
@ -137,3 +137,17 @@ ROLLBACK;
|
|||
SELECT COUNT(*) FROM test_tab;
|
||||
CHECK TABLE test_tab;
|
||||
DROP TABLE test_tab;
|
||||
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
CREATE TEMPORARY TABLE t2(i INT)ENGINE=InnoDB;
|
||||
CREATE TABLE t1(i TEXT NOT NULL) ENGINE=INNODB;
|
||||
BEGIN;
|
||||
INSERT t1 SET i=REPEAT('1234567890',840);
|
||||
UPDATE t1 SET i='';
|
||||
INSERT INTO t2 VALUES(2);
|
||||
ROLLBACK;
|
||||
--source include/wait_all_purged.inc
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
|
|
|
@ -1003,7 +1003,7 @@ trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap)
|
|||
trx_roll_try_truncate(trx);
|
||||
}
|
||||
|
||||
trx_undo_t* undo;
|
||||
trx_undo_t* undo = NULL;
|
||||
trx_undo_t* insert = trx->rsegs.m_redo.insert_undo;
|
||||
trx_undo_t* update = trx->rsegs.m_redo.update_undo;
|
||||
trx_undo_t* temp = trx->rsegs.m_noredo.undo;
|
||||
|
@ -1017,17 +1017,26 @@ trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap)
|
|||
|| update->top_undo_no != temp->top_undo_no);
|
||||
|
||||
if (insert && !insert->empty && limit <= insert->top_undo_no) {
|
||||
if (update && !update->empty
|
||||
&& update->top_undo_no > insert->top_undo_no) {
|
||||
undo = insert;
|
||||
}
|
||||
|
||||
if (update && !update->empty && update->top_undo_no >= limit) {
|
||||
if (!undo) {
|
||||
undo = update;
|
||||
} else if (undo->top_undo_no < update->top_undo_no) {
|
||||
undo = update;
|
||||
} else {
|
||||
undo = insert;
|
||||
}
|
||||
} else if (update && !update->empty && limit <= update->top_undo_no) {
|
||||
undo = update;
|
||||
} else if (temp && !temp->empty && limit <= temp->top_undo_no) {
|
||||
undo = temp;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (temp && !temp->empty && temp->top_undo_no >= limit) {
|
||||
if (!undo) {
|
||||
undo = temp;
|
||||
} else if (undo->top_undo_no < temp->top_undo_no) {
|
||||
undo = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (undo == NULL) {
|
||||
trx_roll_try_truncate(trx);
|
||||
/* Mark any ROLLBACK TO SAVEPOINT completed, so that
|
||||
if the transaction object is committed and reused
|
||||
|
|
Loading…
Reference in a new issue