mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03: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:
@ -140,3 +140,16 @@ CHECK TABLE test_tab;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.test_tab check status OK
|
test.test_tab check status OK
|
||||||
DROP 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;
|
||||||
|
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;
|
SELECT COUNT(*) FROM test_tab;
|
||||||
CHECK TABLE test_tab;
|
CHECK TABLE test_tab;
|
||||||
DROP 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_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* insert = trx->rsegs.m_redo.insert_undo;
|
||||||
trx_undo_t* update = trx->rsegs.m_redo.update_undo;
|
trx_undo_t* update = trx->rsegs.m_redo.update_undo;
|
||||||
trx_undo_t* temp = trx->rsegs.m_noredo.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);
|
|| update->top_undo_no != temp->top_undo_no);
|
||||||
|
|
||||||
if (insert && !insert->empty && limit <= insert->top_undo_no) {
|
if (insert && !insert->empty && limit <= insert->top_undo_no) {
|
||||||
if (update && !update->empty
|
undo = insert;
|
||||||
&& update->top_undo_no > insert->top_undo_no) {
|
}
|
||||||
|
|
||||||
|
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;
|
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) {
|
if (temp && !temp->empty && temp->top_undo_no >= limit) {
|
||||||
undo = temp;
|
if (!undo) {
|
||||||
} else {
|
undo = temp;
|
||||||
|
} else if (undo->top_undo_no < temp->top_undo_no) {
|
||||||
|
undo = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (undo == NULL) {
|
||||||
trx_roll_try_truncate(trx);
|
trx_roll_try_truncate(trx);
|
||||||
/* Mark any ROLLBACK TO SAVEPOINT completed, so that
|
/* Mark any ROLLBACK TO SAVEPOINT completed, so that
|
||||||
if the transaction object is committed and reused
|
if the transaction object is committed and reused
|
||||||
|
Reference in New Issue
Block a user