Commit 77b2f55f authored by Marko Mäkelä's avatar Marko Mäkelä

Follow-up fixes for MDEV-10139 Support for InnoDB SEQUENCE objects

row_search_mvcc(): Relax debug assertions. For NO_ROLLBACK tables,
a transaction or a read view will not be started at the start of
a statement.

row_upd_clust_step(): Support CREATE TEMPORARY SEQUENCE or
CREATE TEMPORARY TABLE…NO_ROLLBACK.
parent e1f81822
...@@ -4472,13 +4472,17 @@ row_search_mvcc( ...@@ -4472,13 +4472,17 @@ row_search_mvcc(
thread that is currently serving the transaction. Because we thread that is currently serving the transaction. Because we
are that thread, we can read trx->state without holding any are that thread, we can read trx->state without holding any
mutex. */ mutex. */
ut_ad(prebuilt->sql_stat_start || trx->state == TRX_STATE_ACTIVE); ut_ad(prebuilt->sql_stat_start
|| trx->state == TRX_STATE_ACTIVE
|| (prebuilt->table->no_rollback()
&& trx->state == TRX_STATE_NOT_STARTED));
ut_ad(!trx_is_started(trx) || trx->state == TRX_STATE_ACTIVE); ut_ad(!trx_is_started(trx) || trx->state == TRX_STATE_ACTIVE);
ut_ad(prebuilt->sql_stat_start ut_ad(prebuilt->sql_stat_start
|| prebuilt->select_lock_type != LOCK_NONE || prebuilt->select_lock_type != LOCK_NONE
|| MVCC::is_view_active(trx->read_view) || MVCC::is_view_active(trx->read_view)
|| prebuilt->table->no_rollback()
|| srv_read_only_mode); || srv_read_only_mode);
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
...@@ -4517,7 +4521,11 @@ row_search_mvcc( ...@@ -4517,7 +4521,11 @@ row_search_mvcc(
/* Do some start-of-statement preparations */ /* Do some start-of-statement preparations */
if (!prebuilt->sql_stat_start) { if (prebuilt->table->no_rollback()) {
/* NO_ROLLBACK tables do not support MVCC or locking. */
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->sql_stat_start = FALSE;
} else if (!prebuilt->sql_stat_start) {
/* No need to set an intention lock or assign a read view */ /* No need to set an intention lock or assign a read view */
if (!MVCC::is_view_active(trx->read_view) if (!MVCC::is_view_active(trx->read_view)
...@@ -4531,10 +4539,6 @@ row_search_mvcc( ...@@ -4531,10 +4539,6 @@ row_search_mvcc(
fputc('\n', stderr); fputc('\n', stderr);
ut_error; ut_error;
} }
} else if (prebuilt->table->no_rollback()) {
/* NO_ROLLBACK tables do not support MVCC or locking. */
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->sql_stat_start = FALSE;
} else if (prebuilt->select_lock_type == LOCK_NONE) { } else if (prebuilt->select_lock_type == LOCK_NONE) {
/* This is a consistent read */ /* This is a consistent read */
/* Assign a read view for the query */ /* Assign a read view for the query */
......
...@@ -3042,12 +3042,13 @@ row_upd_clust_step( ...@@ -3042,12 +3042,13 @@ row_upd_clust_step(
mtr_start_trx(&mtr, thr_get_trx(thr)); mtr_start_trx(&mtr, thr_get_trx(thr));
mtr.set_named_space(index->space); mtr.set_named_space(index->space);
/* Disable REDO logging as lifetime of temp-tables is limited to
server or connection lifetime and so REDO information is not needed
on restart for recovery.
Disable locking as temp-tables are not shared across connection. */
if (dict_table_is_temporary(node->table)) { if (dict_table_is_temporary(node->table)) {
flags = BTR_NO_LOCKING_FLAG; /* Disable locking, because temporary tables are
private to the connection (no concurrent access). */
flags = node->table->no_rollback()
? BTR_NO_ROLLBACK
: BTR_NO_LOCKING_FLAG;
/* Redo logging only matters for persistent tables. */
mtr.set_log_mode(MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO);
} else { } else {
flags = node->table->no_rollback() ? BTR_NO_ROLLBACK : 0; flags = node->table->no_rollback() ? BTR_NO_ROLLBACK : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment