Commit cb559799 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #5775, fix deadlock by moving mo lock acquisition higher up in stack for hot indexing

git-svn-id: file:///svn/toku/tokudb@50990 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7a174bc3
...@@ -490,9 +490,7 @@ indexer_ft_delete_provisional(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS ...@@ -490,9 +490,7 @@ indexer_ft_delete_provisional(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS
// it is safe to do this // it is safe to do this
// this question apples to delete_committed, insert_provisional // this question apples to delete_committed, insert_provisional
// and insert_committed // and insert_committed
toku_multi_operation_client_lock();
toku_ft_maybe_delete (hotdb->i->ft_handle, hotkey, txn, false, ZERO_LSN, true); toku_ft_maybe_delete (hotdb->i->ft_handle, hotkey, txn, false, ZERO_LSN, true);
toku_multi_operation_client_unlock();
} }
} }
return result; return result;
...@@ -508,9 +506,7 @@ indexer_ft_delete_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS xi ...@@ -508,9 +506,7 @@ indexer_ft_delete_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS xi
} else { } else {
result = toku_ydb_check_avail_fs_space(indexer->i->env); result = toku_ydb_check_avail_fs_space(indexer->i->env);
if (result == 0) { if (result == 0) {
toku_multi_operation_client_lock();
toku_ft_send_delete(db_struct_i(hotdb)->ft_handle, hotkey, xids, TXNID_NONE); toku_ft_send_delete(db_struct_i(hotdb)->ft_handle, hotkey, xids, TXNID_NONE);
toku_multi_operation_client_unlock();
} }
} }
return result; return result;
...@@ -529,9 +525,7 @@ indexer_ft_insert_provisional(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT * ...@@ -529,9 +525,7 @@ indexer_ft_insert_provisional(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT *
if (result == 0) { if (result == 0) {
assert(txn != NULL); assert(txn != NULL);
// comment/question in indexer_ft_delete_provisional applies // comment/question in indexer_ft_delete_provisional applies
toku_multi_operation_client_lock();
toku_ft_maybe_insert (hotdb->i->ft_handle, hotkey, hotval, txn, false, ZERO_LSN, true, FT_INSERT); toku_ft_maybe_insert (hotdb->i->ft_handle, hotkey, hotval, txn, false, ZERO_LSN, true, FT_INSERT);
toku_multi_operation_client_unlock();
} }
} }
return result; return result;
...@@ -548,9 +542,7 @@ indexer_ft_insert_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT *ho ...@@ -548,9 +542,7 @@ indexer_ft_insert_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT *ho
} else { } else {
result = toku_ydb_check_avail_fs_space(indexer->i->env); result = toku_ydb_check_avail_fs_space(indexer->i->env);
if (result == 0) { if (result == 0) {
toku_multi_operation_client_lock();
toku_ft_send_insert(db_struct_i(hotdb)->ft_handle, hotkey, hotval, xids, FT_INSERT, TXNID_NONE); toku_ft_send_insert(db_struct_i(hotdb)->ft_handle, hotkey, hotval, xids, FT_INSERT, TXNID_NONE);
toku_multi_operation_client_unlock();
} }
} }
return result; return result;
......
...@@ -416,6 +416,10 @@ build_index(DB_INDEXER *indexer) { ...@@ -416,6 +416,10 @@ build_index(DB_INDEXER *indexer) {
for (uint64_t loop_count = 0; !done; loop_count++) { for (uint64_t loop_count = 0; !done; loop_count++) {
toku_indexer_lock(indexer); toku_indexer_lock(indexer);
// grab the multi operation lock because we will be injecting messages
// grab it here because we must hold it before
// trying to pin any live transactions, as discovered by #5775
toku_multi_operation_client_lock();
// grab the next leaf entry and get its provisional info. we'll // grab the next leaf entry and get its provisional info. we'll
// need the provisional info for the undo-do algorithm, and we get // need the provisional info for the undo-do algorithm, and we get
...@@ -457,6 +461,7 @@ build_index(DB_INDEXER *indexer) { ...@@ -457,6 +461,7 @@ build_index(DB_INDEXER *indexer) {
toku_ule_free(prov_info.ule); toku_ule_free(prov_info.ule);
} }
toku_multi_operation_client_unlock();
toku_indexer_unlock(indexer); toku_indexer_unlock(indexer);
ule_prov_info_destroy(&prov_info); ule_prov_info_destroy(&prov_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment