Commit 380b42f2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1841, #1334

do prelocking in handler when we are going to do a range query that
gets all values with a key prefix

git-svn-id: file:///svn/mysql/tokudb-engine/src@13056 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6c1ec24d
......@@ -3027,6 +3027,49 @@ cleanup:
}
//
// Notification that a range query getting all elements that equal a key
// to take place. Will pre acquire read lock
// Returns:
// 0 on success
// error otherwise
//
int ha_tokudb::prepare_index_key_scan( const uchar * key, uint key_len ) {
int error = 0;
DBT start_key, end_key;
pack_key(&start_key, active_index, key_buff, key, key_len, COL_NEG_INF);
pack_key(&end_key, active_index, key_buff, key, key_len, COL_POS_INF);
error = share->key_file[active_index]->pre_acquire_read_lock(
share->key_file[active_index],
transaction,
&start_key,
share->key_file[active_index]->dbt_neg_infty(),
&end_key,
share->key_file[active_index]->dbt_pos_infty()
);
if (error){
goto cleanup;
}
range_lock_grabbed = true;
error = 0;
cleanup:
if (error) {
last_cursor_error = error;
//
// cursor should be initialized here, but in case it is not, we still check
//
if (cursor) {
cursor->c_close(cursor);
cursor = NULL;
}
}
return error;
}
//
// Initializes local cursor on DB with index keynr
// Parameters:
......
......@@ -335,6 +335,7 @@ public:
int delete_row(const uchar * buf);
int prepare_index_scan();
int prepare_index_key_scan( const uchar * key, uint key_len );
void column_bitmaps_signal();
int index_init(uint index, bool sorted);
int index_end();
......
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