Commit 2fea626c authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2298], do backoff when trying to prelock ranges

git-svn-id: file:///svn/mysql/tokudb-engine/src@17076 c7de825b-a66e-492c-adef-691d508d4ae1
parent df89480b
...@@ -3667,12 +3667,15 @@ void ha_tokudb::column_bitmaps_signal() { ...@@ -3667,12 +3667,15 @@ void ha_tokudb::column_bitmaps_signal() {
int ha_tokudb::prepare_index_scan() { int ha_tokudb::prepare_index_scan() {
int error; int error;
DB* db = share->key_file[active_index]; DB* db = share->key_file[active_index];
error = db->pre_acquire_read_lock( lockretry {
db, error = db->pre_acquire_read_lock(
transaction, db,
db->dbt_neg_infty(), db->dbt_neg_infty(), transaction,
db->dbt_pos_infty(), db->dbt_pos_infty() db->dbt_neg_infty(), db->dbt_neg_infty(),
); db->dbt_pos_infty(), db->dbt_pos_infty()
);
lockretry_wait;
}
if (error) { last_cursor_error = error; goto cleanup; } if (error) { last_cursor_error = error; goto cleanup; }
range_lock_grabbed = true; range_lock_grabbed = true;
...@@ -3695,14 +3698,17 @@ int ha_tokudb::prepare_index_key_scan( const uchar * key, uint key_len ) { ...@@ -3695,14 +3698,17 @@ int ha_tokudb::prepare_index_key_scan( const uchar * key, uint key_len ) {
pack_key(&start_key, active_index, key_buff, key, key_len, COL_NEG_INF); pack_key(&start_key, active_index, key_buff, key, key_len, COL_NEG_INF);
pack_key(&end_key, active_index, key_buff2, key, key_len, COL_POS_INF); pack_key(&end_key, active_index, key_buff2, key, key_len, COL_POS_INF);
error = share->key_file[active_index]->pre_acquire_read_lock( lockretry {
share->key_file[active_index], error = share->key_file[active_index]->pre_acquire_read_lock(
transaction, share->key_file[active_index],
&start_key, transaction,
share->key_file[active_index]->dbt_neg_infty(), &start_key,
&end_key, share->key_file[active_index]->dbt_neg_infty(),
share->key_file[active_index]->dbt_pos_infty() &end_key,
); share->key_file[active_index]->dbt_pos_infty()
);
lockretry_wait;
}
if (error){ if (error){
goto cleanup; goto cleanup;
} }
...@@ -4327,7 +4333,10 @@ int ha_tokudb::rnd_init(bool scan) { ...@@ -4327,7 +4333,10 @@ int ha_tokudb::rnd_init(bool scan) {
range_lock_grabbed = false; range_lock_grabbed = false;
if (scan) { if (scan) {
DB* db = share->key_file[primary_key]; DB* db = share->key_file[primary_key];
error = db->pre_acquire_read_lock(db, transaction, db->dbt_neg_infty(), NULL, db->dbt_pos_infty(), NULL); lockretry {
error = db->pre_acquire_read_lock(db, transaction, db->dbt_neg_infty(), NULL, db->dbt_pos_infty(), NULL);
lockretry_wait;
}
if (error) { last_cursor_error = error; goto cleanup; } if (error) { last_cursor_error = error; goto cleanup; }
} }
error = index_init(primary_key, 0); error = index_init(primary_key, 0);
...@@ -4529,14 +4538,17 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k ...@@ -4529,14 +4538,17 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
end_dbt_data = share->key_file[active_index]->dbt_pos_infty(); end_dbt_data = share->key_file[active_index]->dbt_pos_infty();
} }
error = share->key_file[active_index]->pre_acquire_read_lock( lockretry {
share->key_file[active_index], error = share->key_file[active_index]->pre_acquire_read_lock(
transaction, share->key_file[active_index],
start_key ? &start_dbt_key : share->key_file[active_index]->dbt_neg_infty(), transaction,
start_dbt_data, start_key ? &start_dbt_key : share->key_file[active_index]->dbt_neg_infty(),
end_key ? &end_dbt_key : share->key_file[active_index]->dbt_pos_infty(), start_dbt_data,
end_dbt_data end_key ? &end_dbt_key : share->key_file[active_index]->dbt_pos_infty(),
); end_dbt_data
);
lockretry_wait;
}
if (error){ if (error){
last_cursor_error = error; last_cursor_error = error;
// //
...@@ -6050,14 +6062,17 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { ...@@ -6050,14 +6062,17 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
// first a global read lock on the main DB, because // first a global read lock on the main DB, because
// we intend to scan the entire thing // we intend to scan the entire thing
// //
error = share->file->pre_acquire_read_lock( lockretry {
share->file, error = share->file->pre_acquire_read_lock(
txn, share->file,
share->file->dbt_neg_infty(), txn,
NULL, share->file->dbt_neg_infty(),
share->file->dbt_pos_infty(), NULL,
NULL share->file->dbt_pos_infty(),
); NULL
);
lockretry_wait;
}
if (error) { goto cleanup; } if (error) { goto cleanup; }
// //
......
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