MDEV-14824 Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view
In CREATE SEQUENCE or CREATE TEMPORARY SEQUENCE, we should not start an InnoDB transaction for inserting the sequence status record into the underlying no-rollback table. Because we did this, a debug assertion failure would fail in START TRANSACTION WITH CONSISTENT SNAPSHOT after CREATE TEMPORARY SEQUENCE was executed. row_ins_step(): Do not start the transaction. Let the caller do that. que_thr_step(): Start the transaction before calling row_ins_step(). row_ins_clust_index_entry(): Skip locking and undo logging for no-rollback tables, even for temporary no-rollback tables. row_ins_index_entry(): Allow trx->id==0 for no-rollback tables. row_insert_for_mysql(): Do not start a transaction for no-rollback tables.
This commit is contained in:
parent
919169e1f9
commit
773c3ceb57
@ -482,6 +482,7 @@ select previous value for t1;
|
||||
previous value for t1
|
||||
1
|
||||
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10 engine=innodb;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
select previous value for t1;
|
||||
previous value for t1
|
||||
NULL
|
||||
|
@ -362,6 +362,7 @@ CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 e
|
||||
select next value for t1;
|
||||
select previous value for t1;
|
||||
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10 engine=innodb;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
select previous value for t1;
|
||||
select next value for t1;
|
||||
select previous value for t1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -1030,6 +1030,7 @@ que_thr_step(
|
||||
} else if (type == QUE_NODE_SELECT) {
|
||||
thr = row_sel_step(thr);
|
||||
} else if (type == QUE_NODE_INSERT) {
|
||||
trx_start_if_not_started_xa(thr_get_trx(thr), true);
|
||||
thr = row_ins_step(thr);
|
||||
} else if (type == QUE_NODE_UPDATE) {
|
||||
trx_start_if_not_started_xa(thr_get_trx(thr), true);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, MariaDB Corporation.
|
||||
Copyright (c) 2016, 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -3193,9 +3193,9 @@ row_ins_clust_index_entry(
|
||||
|
||||
/* Try first optimistic descent to the B-tree */
|
||||
log_free_check();
|
||||
const ulint flags = dict_table_is_temporary(index->table)
|
||||
? BTR_NO_LOCKING_FLAG
|
||||
: index->table->no_rollback() ? BTR_NO_ROLLBACK : 0;
|
||||
const ulint flags = index->table->no_rollback() ? BTR_NO_ROLLBACK
|
||||
: dict_table_is_temporary(index->table)
|
||||
? BTR_NO_LOCKING_FLAG : 0;
|
||||
|
||||
err = row_ins_clust_index_entry_low(
|
||||
flags, BTR_MODIFY_LEAF, index, n_uniq, entry,
|
||||
@ -3304,7 +3304,7 @@ row_ins_index_entry(
|
||||
dtuple_t* entry, /*!< in/out: index entry to insert */
|
||||
que_thr_t* thr) /*!< in: query thread */
|
||||
{
|
||||
ut_ad(thr_get_trx(thr)->id != 0);
|
||||
ut_ad(thr_get_trx(thr)->id || index->table->no_rollback());
|
||||
|
||||
DBUG_EXECUTE_IF("row_ins_index_entry_timeout", {
|
||||
DBUG_SET("-d,row_ins_index_entry_timeout");
|
||||
@ -3764,8 +3764,6 @@ row_ins_step(
|
||||
|
||||
trx = thr_get_trx(thr);
|
||||
|
||||
trx_start_if_not_started_xa(trx, true);
|
||||
|
||||
node = static_cast<ins_node_t*>(thr->run_node);
|
||||
|
||||
ut_ad(que_node_get_type(node) == QUE_NODE_INSERT);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2017, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -1453,7 +1453,9 @@ row_insert_for_mysql(
|
||||
|
||||
row_mysql_delay_if_needed();
|
||||
|
||||
trx_start_if_not_started_xa(trx, true);
|
||||
if (!table->no_rollback()) {
|
||||
trx_start_if_not_started_xa(trx, true);
|
||||
}
|
||||
|
||||
row_get_prebuilt_insert_row(prebuilt);
|
||||
node = prebuilt->ins_node;
|
||||
|
Loading…
x
Reference in New Issue
Block a user