summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-01-06 17:14:23 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-04-13 14:34:38 +0530
commit1019f902ccd59784f2f6d12b8df2935155d0763e (patch)
tree70ea2f15206edfe7c0009d35d404d67f8fd114f5
parentddcdb1a4fc41f11e5b73ce00a2ac5c40c2985a73 (diff)
downloadmariadb-git-bb-10.11-MDEV-16232.tar.gz
MDEV-16232 Use fewer mini-transactionsbb-10.11-MDEV-16232
- Fail to change the latch operation in row_search_mvcc. - Disable batch mtr for long unique blob queries, versioned tables - Disabled few test case which need changes
-rw-r--r--mysql-test/main/disabled.def2
-rw-r--r--mysql-test/suite/innodb/disabled.def14
-rw-r--r--sql/sql_update.cc5
-rw-r--r--storage/innobase/include/row0mysql.h8
-rw-r--r--storage/innobase/row/row0sel.cc14
5 files changed, 38 insertions, 5 deletions
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index 02104f6a680..473b7f03a1f 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -18,3 +18,5 @@ file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
partition_open_files_limit : open_files_limit check broken by MDEV-18360
partition_innodb : Waiting for fix MDEV-20169
+main.concurrent_innodb_safelog : MDEV-16232 requires test case change
+main.mysqldump-max : MDEV-16232 requires test case change
diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
new file mode 100644
index 00000000000..5270e09aef1
--- /dev/null
+++ b/mysql-test/suite/innodb/disabled.def
@@ -0,0 +1,14 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+innodb.deadlock_victim_race : MDEV-16232 Rewrite the test case
+innodb.deadlock_wait_thr_race : MDEV-16232 Rewrite the test case
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 21989634113..332a3b3cb60 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -348,7 +348,10 @@ bool can_use_mini_transaction(const TABLE_LIST *query_tables,
!(query_tables->next_global != nullptr /* more than one table involved */
|| has_triggers || is_referenced_by_foreign_keys ||
(select && select->quick &&
- !select->quick->are_mini_transactions_applicable()));
+ !select->quick->are_mini_transactions_applicable())
+ || query_tables->table->s->long_unique_table
+ || query_tables->table->s->period.unique_keys
+ || query_tables->table->s->versioned);
}
/*
Process usual UPDATE
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index bcecf9c8504..12197317937 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -460,6 +460,8 @@ private:
ulint m_last_clust_savepoint= 0;
/* whether the batch mini-transaction is active */
bool m_batch_mtr_active= false;
+ /* Whether mtr held lock on the index */
+ bool m_batch_has_lock= false;
public:
/** Start the batch mtr operation */
void start()
@@ -489,6 +491,9 @@ public:
/** @return whether cursor stored */
bool cursor_stored() { return m_batch_cursor_stored; }
+ /** @return whether it holds any lock */
+ bool has_lock() { return m_batch_has_lock; }
+
/** Finish the read part of the batch mtr operation.
In case of read operation, InnoDB rollbacks to savepoint
when secondary index is being used
@@ -507,6 +512,7 @@ public:
}
}
+ m_batch_has_lock= true;
m_last_clust_savepoint= mtr_extra_clust_savepoint;
m_batch_cursor_stored= false;
}
@@ -519,6 +525,7 @@ public:
/* Copy secondary and clustered index position */
m_batch_mtr->commit();
m_batch_cursor_stored= true;
+ m_batch_has_lock= false;
m_batch_mtr->start();
m_last_clust_savepoint= 0;
}
@@ -542,6 +549,7 @@ public:
{
m_batch_mtr->commit();
m_batch_mtr_active= false;
+ m_batch_has_lock= false;
}
};
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 30075eab9a6..3a8364f2a65 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -3384,8 +3384,8 @@ Row_sel_get_clust_rec_for_mysql::operator()(
trx_t* trx;
btr_latch_mode batch_latch_mode = BTR_SEARCH_LEAF;
- if (row_batch_mtr_t *batch_mtr= prebuilt->batch_mtr) {
- ut_ad(batch_mtr->get_mtr() == mtr);
+ if (prebuilt->batch_mtr) {
+ ut_ad(prebuilt->batch_mtr->get_mtr() == mtr);
if (prebuilt->select_lock_type == LOCK_X) {
batch_latch_mode = BTR_MODIFY_LEAF;
}
@@ -4806,6 +4806,12 @@ wait_table_again:
}
} else if (dtuple_get_n_fields(search_tuple) > 0) {
+
+ if (batch_mtr && batch_mtr->has_lock()) {
+ batch_mtr->commit();
+ batch_mtr->start();
+ }
+
pcur->btr_cur.thr = thr;
pcur->old_rec = nullptr;
@@ -4829,7 +4835,7 @@ wait_table_again:
err = rtr_search_leaf(pcur, search_tuple, mode, mtr);
} else {
err = btr_pcur_open_with_no_init(search_tuple, mode,
- BTR_SEARCH_LEAF,
+ batch_latch_mode,
pcur, mtr);
}
@@ -4877,7 +4883,7 @@ page_corrupted:
}
} else if (mode == PAGE_CUR_G || mode == PAGE_CUR_L) {
err = pcur->open_leaf(mode == PAGE_CUR_G, index,
- BTR_SEARCH_LEAF, mtr);
+ batch_latch_mode, mtr);
if (err != DB_SUCCESS) {
if (err == DB_DECRYPTION_FAILED) {