Skip to content

Commit

Permalink
Fixed mutex deadlock found with innodb.innodb-defrag-concurrent
Browse files Browse the repository at this point in the history
test. We should not take X-lock for index in the begining, setting
tablespace as named space is enough.
  • Loading branch information
Jan Lindström authored and vuvova committed Sep 16, 2016
1 parent c8b3244 commit f5ef553
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions storage/innobase/btr/btr0defragment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,6 @@ btr_defragment_n_pages(
/* It doesn't make sense to call this function with n_pages = 1. */
ut_ad(n_pages > 1);

ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
space = dict_index_get_space(index);
if (space == 0) {
/* Ignore space 0. */
Expand Down Expand Up @@ -801,9 +799,8 @@ DECLARE_THREAD(btr_defragment_thread)(
cursor = btr_pcur_get_btr_cur(pcur);
index = btr_cur_get_index(cursor);
first_block = btr_cur_get_block(cursor);

mtr_x_lock(dict_index_get_lock(index), &mtr);
mtr.set_named_space(index->space);

last_block = btr_defragment_n_pages(first_block, index,
srv_defragment_n_pages,
&mtr);
Expand Down

0 comments on commit f5ef553

Please sign in to comment.