summaryrefslogtreecommitdiff
path: root/innobase/btr
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-09-11 14:49:38 +0300
committerunknown <monty@mashka.mysql.fi>2002-09-11 14:49:38 +0300
commit26bf87c9391edb1df27d1a1e42a98ccf9215f6b1 (patch)
tree780174860f876a082066a96b632c69be18d7282f /innobase/btr
parentd221f3ff172305e4576505180408e4ac2ba2a6c2 (diff)
parent6a06c4c534ac68f9d0469f31c869fe1d20b1e463 (diff)
downloadmariadb-git-26bf87c9391edb1df27d1a1e42a98ccf9215f6b1.tar.gz
Merge with 3.23.53
Build-tools/Do-compile: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/os/os0file.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/sync/sync0arr.c: Auto merged innobase/trx/trx0undo.c: Auto merged sql/ha_innodb.h: Auto merged Docs/manual.texi: merge sql/ha_innodb.cc: merge sql/mysqld.cc: merge
Diffstat (limited to 'innobase/btr')
-rw-r--r--innobase/btr/btr0cur.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index 25a7060883c..e35ff2ca69e 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -302,6 +302,9 @@ btr_cur_search_to_nth_level(
rw_lock_s_unlock(&btr_search_latch);
}
+ /* Store the position of the tree latch we push to mtr so that we
+ know how to release it when we have latched leaf node(s) */
+
savepoint = mtr_set_savepoint(mtr);
tree = index->tree;
@@ -506,12 +509,18 @@ btr_cur_open_at_index_side(
ulint root_height = 0; /* remove warning */
rec_t* node_ptr;
ulint estimate;
+ ulint savepoint;
estimate = latch_mode & BTR_ESTIMATE;
latch_mode = latch_mode & ~BTR_ESTIMATE;
tree = index->tree;
+ /* Store the position of the tree latch we push to mtr so that we
+ know how to release it when we have latched the leaf node */
+
+ savepoint = mtr_set_savepoint(mtr);
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
} else {
@@ -544,6 +553,22 @@ btr_cur_open_at_index_side(
if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no,
latch_mode, cursor, mtr);
+
+ /* In versions <= 3.23.52 we had forgotten to
+ release the tree latch here. If in an index scan
+ we had to scan far to find a record visible to the
+ current transaction, that could starve others
+ waiting for the tree latch. */
+
+ if ((latch_mode != BTR_MODIFY_TREE)
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+
+ /* Release the tree s-latch */
+
+ mtr_release_s_latch_at_savepoint(
+ mtr, savepoint,
+ dict_tree_get_lock(tree));
+ }
}
if (from_left) {