diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-01-15 19:07:02 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-01-15 19:07:02 +0200 |
commit | e2e740030d4f027e25f9a322990af0fdb3e0ffc3 (patch) | |
tree | 2a9a2eaae0a91548f5f290d9cd178b1fdd7c6e69 | |
parent | abbce9ed560d16bd76a84b30d4f4f731f0b56dc0 (diff) | |
parent | 3fdd390791ac91ecdc545fd1686a7ed43e8f1945 (diff) | |
download | mariadb-git-e2e740030d4f027e25f9a322990af0fdb3e0ffc3.tar.gz |
Merge 10.2 into bb-10.2-ext
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 6acab881288..2830a38fa4a 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -3692,34 +3692,38 @@ btr_cur_update_in_place( || row_get_rec_trx_id(rec, index, offsets)); #ifdef BTR_CUR_HASH_ADAPT - if (block->index) { - /* TO DO: Can we skip this if none of the fields - index->search_info->curr_n_fields - are being updated? */ - - /* The function row_upd_changes_ord_field_binary works only - if the update vector was built for a clustered index, we must - NOT call it if index is secondary */ - - if (!dict_index_is_clust(index) - || row_upd_changes_ord_field_binary(index, update, thr, - NULL, NULL)) { - - /* Remove possible hash index pointer to this record */ - btr_search_update_hash_on_delete(cursor); + { + rw_lock_t* ahi_latch = block->index + ? btr_get_search_latch(block->index) : NULL; + if (ahi_latch) { + /* TO DO: Can we skip this if none of the fields + index->search_info->curr_n_fields + are being updated? */ + + /* The function row_upd_changes_ord_field_binary + does not work on a secondary index. */ + + if (!dict_index_is_clust(index) + || row_upd_changes_ord_field_binary( + index, update, thr, NULL, NULL)) { + + /* Remove possible hash index pointer + to this record */ + btr_search_update_hash_on_delete(cursor); + } } - btr_search_x_lock(index); - } + rw_lock_x_lock(ahi_latch); - assert_block_ahi_valid(block); + assert_block_ahi_valid(block); #endif /* BTR_CUR_HASH_ADAPT */ - row_upd_rec_in_place(rec, index, offsets, update, page_zip); + row_upd_rec_in_place(rec, index, offsets, update, page_zip); #ifdef BTR_CUR_HASH_ADAPT - if (block->index) { - btr_search_x_unlock(index); + if (ahi_latch) { + rw_lock_x_unlock(ahi_latch); + } } #endif /* BTR_CUR_HASH_ADAPT */ |