Commit db7bed1b 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 e8b3ca12
......@@ -3667,12 +3667,15 @@ void ha_tokudb::column_bitmaps_signal() {
int ha_tokudb::prepare_index_scan() {
int error;
DB* db = share->key_file[active_index];
lockretry {
error = db->pre_acquire_read_lock(
db,
transaction,
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; }
range_lock_grabbed = true;
......@@ -3695,6 +3698,7 @@ 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(&end_key, active_index, key_buff2, key, key_len, COL_POS_INF);
lockretry {
error = share->key_file[active_index]->pre_acquire_read_lock(
share->key_file[active_index],
transaction,
......@@ -3703,6 +3707,8 @@ int ha_tokudb::prepare_index_key_scan( const uchar * key, uint key_len ) {
&end_key,
share->key_file[active_index]->dbt_pos_infty()
);
lockretry_wait;
}
if (error){
goto cleanup;
}
......@@ -4327,7 +4333,10 @@ int ha_tokudb::rnd_init(bool scan) {
range_lock_grabbed = false;
if (scan) {
DB* db = share->key_file[primary_key];
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; }
}
error = index_init(primary_key, 0);
......@@ -4529,6 +4538,7 @@ 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();
}
lockretry {
error = share->key_file[active_index]->pre_acquire_read_lock(
share->key_file[active_index],
transaction,
......@@ -4537,6 +4547,8 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
end_key ? &end_dbt_key : share->key_file[active_index]->dbt_pos_infty(),
end_dbt_data
);
lockretry_wait;
}
if (error){
last_cursor_error = error;
//
......@@ -6050,6 +6062,7 @@ 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
// we intend to scan the entire thing
//
lockretry {
error = share->file->pre_acquire_read_lock(
share->file,
txn,
......@@ -6058,6 +6071,8 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
share->file->dbt_pos_infty(),
NULL
);
lockretry_wait;
}
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