|
3 | 3 | Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
4 | 4 | Copyright (c) 2008, Google Inc.
|
5 | 5 | Copyright (c) 2012, Facebook Inc.
|
6 |
| -Copyright (c) 2015, 2017, MariaDB Corporation. |
| 6 | +Copyright (c) 2015, 2018, MariaDB Corporation. |
7 | 7 |
|
8 | 8 | Portions of this file contain modifications contributed and copyrighted by
|
9 | 9 | Google, Inc. Those modifications are gratefully acknowledged and are described
|
@@ -3692,34 +3692,38 @@ btr_cur_update_in_place(
|
3692 | 3692 | || row_get_rec_trx_id(rec, index, offsets));
|
3693 | 3693 |
|
3694 | 3694 | #ifdef BTR_CUR_HASH_ADAPT
|
3695 |
| - if (block->index) { |
3696 |
| - /* TO DO: Can we skip this if none of the fields |
3697 |
| - index->search_info->curr_n_fields |
3698 |
| - are being updated? */ |
3699 |
| - |
3700 |
| - /* The function row_upd_changes_ord_field_binary works only |
3701 |
| - if the update vector was built for a clustered index, we must |
3702 |
| - NOT call it if index is secondary */ |
3703 |
| - |
3704 |
| - if (!dict_index_is_clust(index) |
3705 |
| - || row_upd_changes_ord_field_binary(index, update, thr, |
3706 |
| - NULL, NULL)) { |
3707 |
| - |
3708 |
| - /* Remove possible hash index pointer to this record */ |
3709 |
| - btr_search_update_hash_on_delete(cursor); |
| 3695 | + { |
| 3696 | + rw_lock_t* ahi_latch = block->index |
| 3697 | + ? btr_get_search_latch(block->index) : NULL; |
| 3698 | + if (ahi_latch) { |
| 3699 | + /* TO DO: Can we skip this if none of the fields |
| 3700 | + index->search_info->curr_n_fields |
| 3701 | + are being updated? */ |
| 3702 | + |
| 3703 | + /* The function row_upd_changes_ord_field_binary |
| 3704 | + does not work on a secondary index. */ |
| 3705 | + |
| 3706 | + if (!dict_index_is_clust(index) |
| 3707 | + || row_upd_changes_ord_field_binary( |
| 3708 | + index, update, thr, NULL, NULL)) { |
| 3709 | + |
| 3710 | + /* Remove possible hash index pointer |
| 3711 | + to this record */ |
| 3712 | + btr_search_update_hash_on_delete(cursor); |
| 3713 | + } |
3710 | 3714 | }
|
3711 | 3715 |
|
3712 |
| - btr_search_x_lock(index); |
3713 |
| - } |
| 3716 | + rw_lock_x_lock(ahi_latch); |
3714 | 3717 |
|
3715 |
| - assert_block_ahi_valid(block); |
| 3718 | + assert_block_ahi_valid(block); |
3716 | 3719 | #endif /* BTR_CUR_HASH_ADAPT */
|
3717 | 3720 |
|
3718 |
| - row_upd_rec_in_place(rec, index, offsets, update, page_zip); |
| 3721 | + row_upd_rec_in_place(rec, index, offsets, update, page_zip); |
3719 | 3722 |
|
3720 | 3723 | #ifdef BTR_CUR_HASH_ADAPT
|
3721 |
| - if (block->index) { |
3722 |
| - btr_search_x_unlock(index); |
| 3724 | + if (ahi_latch) { |
| 3725 | + rw_lock_x_unlock(ahi_latch); |
| 3726 | + } |
3723 | 3727 | }
|
3724 | 3728 | #endif /* BTR_CUR_HASH_ADAPT */
|
3725 | 3729 |
|
|
0 commit comments