diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-12-13 10:13:18 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-12-13 10:13:18 +0100 |
commit | 1e270d504d56cb015efe060b319e3a5b9bc6513f (patch) | |
tree | ef18e249732ce1a0ff98b342fa3edb8d2eceb46f /storage/xtradb/row/row0upd.cc | |
parent | 6a821d78a6a33aaf81909ab2858d13f95dbe2708 (diff) | |
download | mariadb-git-1e270d504d56cb015efe060b319e3a5b9bc6513f.tar.gz |
5.6.27-76.0
Diffstat (limited to 'storage/xtradb/row/row0upd.cc')
-rw-r--r-- | storage/xtradb/row/row0upd.cc | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc index 0f189a52789..b1002a1db03 100644 --- a/storage/xtradb/row/row0upd.cc +++ b/storage/xtradb/row/row0upd.cc @@ -2343,6 +2343,7 @@ row_upd_clust_step( ut_a(pcur->rel_pos == BTR_PCUR_ON); ulint mode; + ulint search_mode; #ifdef UNIV_DEBUG /* Work around Bug#14626800 ASSERTION FAILURE IN DEBUG_SYNC(). @@ -2354,17 +2355,29 @@ row_upd_clust_step( } #endif /* UNIV_DEBUG */ + /* If running with fake_changes mode on then switch from modify to + search so that code takes only s-latch and not x-latch. + For dry-run (fake-changes) s-latch is acceptable. Taking x-latch will + make it more restrictive and will block real changes/workflow. */ if (UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)) { - mode = BTR_SEARCH_LEAF; - } else if (dict_index_is_online_ddl(index)) { - ut_ad(node->table->id != DICT_INDEXES_ID); - mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; - mtr_s_lock(dict_index_get_lock(index), &mtr); + mode = BTR_MODIFY_LEAF; + search_mode = BTR_SEARCH_LEAF; } else { mode = BTR_MODIFY_LEAF; + search_mode = BTR_MODIFY_LEAF; + } + + if (dict_index_is_online_ddl(index)) { + + ut_ad(node->table->id != DICT_INDEXES_ID); + + mode |= BTR_ALREADY_S_LATCHED; + search_mode |= BTR_ALREADY_S_LATCHED; + + mtr_s_lock(dict_index_get_lock(index), &mtr); } - success = btr_pcur_restore_position(mode, pcur, &mtr); + success = btr_pcur_restore_position(search_mode, pcur, &mtr); if (!success) { err = DB_RECORD_NOT_FOUND; @@ -2382,6 +2395,10 @@ row_upd_clust_step( ut_ad(!dict_index_is_online_ddl(index)); + /* Action in fake change mode shouldn't cause changes + in system tables. */ + ut_ad(UNIV_LIKELY(!thr_get_trx(thr)->fake_changes)); + dict_drop_index_tree(btr_pcur_get_rec(pcur), &mtr); mtr_commit(&mtr); @@ -2413,6 +2430,8 @@ row_upd_clust_step( } } + /* This check passes as the function manipulates x-lock to s-lock + if operating in fake-change mode. */ ut_ad(lock_trx_has_rec_x_lock(thr_get_trx(thr), index->table, btr_pcur_get_block(pcur), page_rec_get_heap_no(rec))); |