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

addresses #893

implement read_range_first to grab range read lock

git-svn-id: file:///svn/mysql/tokudb-engine/src@4405 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7a4c1582
...@@ -2738,7 +2738,66 @@ int ha_tokudb::read_range_first( ...@@ -2738,7 +2738,66 @@ int ha_tokudb::read_range_first(
bool eq_range, bool eq_range,
bool sorted) bool sorted)
{ {
return handler::read_range_first(start_key, end_key, eq_range, sorted); TOKUDB_DBUG_ENTER("ha_tokudb::read_range_first");
int error;
DBT start_dbt_key;
const DBT* start_dbt_data = NULL;
DBT end_dbt_key;
const DBT* end_dbt_data = NULL;
uchar start_key_buff [table_share->max_key_length + MAX_REF_PARTS * 3];
uchar end_key_buff [table_share->max_key_length + MAX_REF_PARTS * 3];
bzero((void *) &start_dbt_key, sizeof(start_dbt_key));
bzero((void *) &end_dbt_key, sizeof(end_dbt_key));
if (start_key) {
pack_key(&start_dbt_key, active_index, start_key_buff, start_key->key, start_key->length);
switch (start_key->flag) {
case HA_READ_AFTER_KEY:
start_dbt_data = share->key_file[active_index]->dbt_pos_infty();
break;
default:
start_dbt_data = share->key_file[active_index]->dbt_neg_infty();
break;
}
}
else {
start_dbt_data = share->key_file[active_index]->dbt_neg_infty();
}
if (end_key) {
pack_key(&end_dbt_key, active_index, end_key_buff, end_key->key, end_key->length);
switch (end_key->flag) {
case HA_READ_BEFORE_KEY:
end_dbt_data = share->key_file[active_index]->dbt_neg_infty();
break;
default:
end_dbt_data = share->key_file[active_index]->dbt_pos_infty();
break;
}
}
else {
end_dbt_data = share->key_file[active_index]->dbt_pos_infty();
}
error = share->key_file[active_index]->pre_acquire_read_lock(
share->key_file[active_index],
transaction,
start_key ? &start_dbt_key : share->key_file[active_index]->dbt_neg_infty(),
start_dbt_data,
end_key ? &end_dbt_key : share->key_file[active_index]->dbt_pos_infty(),
end_dbt_data
);
if (error){ goto cleanup; }
error = handler::read_range_first(start_key, end_key, eq_range, sorted);
cleanup:
TOKUDB_DBUG_RETURN(error);
} }
int ha_tokudb::read_range_next() int ha_tokudb::read_range_next()
{ {
......
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