Commit 09aa4602 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2274], unpack only necessary blobs in range queries. Saves some mem copies

git-svn-id: file:///svn/mysql/tokudb-engine/src@16954 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3ff52f40
...@@ -2024,7 +2024,8 @@ cleanup: ...@@ -2024,7 +2024,8 @@ cleanup:
int ha_tokudb::unpack_blobs( int ha_tokudb::unpack_blobs(
uchar* record, uchar* record,
const uchar* from_tokudb_blob, const uchar* from_tokudb_blob,
u_int32_t num_bytes u_int32_t num_bytes,
bool check_bitmap
) )
{ {
uint error = 0; uint error = 0;
...@@ -2047,13 +2048,18 @@ int ha_tokudb::unpack_blobs( ...@@ -2047,13 +2048,18 @@ int ha_tokudb::unpack_blobs(
memcpy(blob_buff, from_tokudb_blob, num_bytes); memcpy(blob_buff, from_tokudb_blob, num_bytes);
buff= blob_buff; buff= blob_buff;
for (uint i = 0; i < share->kc_info.num_blobs; i++) { for (uint i = 0; i < share->kc_info.num_blobs; i++) {
Field* field = table->field[share->kc_info.blob_fields[i]]; u_int32_t curr_field_index = share->kc_info.blob_fields[i];
bool skip = check_bitmap ?
!(bitmap_is_set(table->read_set,curr_field_index) ||
bitmap_is_set(table->write_set,curr_field_index)) :
false;
Field* field = table->field[curr_field_index];
u_int32_t len_bytes = field->row_pack_length(); u_int32_t len_bytes = field->row_pack_length();
buff = unpack_toku_field_blob( buff = unpack_toku_field_blob(
record + field_offset(field, table), record + field_offset(field, table),
buff, buff,
len_bytes, len_bytes,
false skip
); );
} }
...@@ -2081,7 +2087,6 @@ int ha_tokudb::unpack_row( ...@@ -2081,7 +2087,6 @@ int ha_tokudb::unpack_row(
// //
/* Copy null bits */ /* Copy null bits */
int error = 0; int error = 0;
my_bitmap_map *old_map = dbug_tmp_use_all_columns(table, table->write_set);
const uchar* fixed_field_ptr = (const uchar *) row->data; const uchar* fixed_field_ptr = (const uchar *) row->data;
const uchar* var_field_offset_ptr = NULL; const uchar* var_field_offset_ptr = NULL;
const uchar* var_field_data_ptr = NULL; const uchar* var_field_data_ptr = NULL;
...@@ -2152,7 +2157,8 @@ int ha_tokudb::unpack_row( ...@@ -2152,7 +2157,8 @@ int ha_tokudb::unpack_row(
error = unpack_blobs( error = unpack_blobs(
record, record,
var_field_data_ptr, var_field_data_ptr,
row->size - (u_int32_t)(var_field_data_ptr - (const uchar *)row->data) row->size - (u_int32_t)(var_field_data_ptr - (const uchar *)row->data),
false
); );
if (error) { if (error) {
goto exit; goto exit;
...@@ -2218,7 +2224,8 @@ int ha_tokudb::unpack_row( ...@@ -2218,7 +2224,8 @@ int ha_tokudb::unpack_row(
error = unpack_blobs( error = unpack_blobs(
record, record,
var_field_data_ptr, var_field_data_ptr,
row->size - (u_int32_t)(var_field_data_ptr - (const uchar *)row->data) row->size - (u_int32_t)(var_field_data_ptr - (const uchar *)row->data),
true
); );
if (error) { if (error) {
goto exit; goto exit;
...@@ -2227,7 +2234,6 @@ int ha_tokudb::unpack_row( ...@@ -2227,7 +2234,6 @@ int ha_tokudb::unpack_row(
} }
error = 0; error = 0;
exit: exit:
dbug_tmp_restore_column_map(table->write_set, old_map);
return error; return error;
} }
...@@ -4523,8 +4529,6 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k ...@@ -4523,8 +4529,6 @@ 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( error = share->key_file[active_index]->pre_acquire_read_lock(
share->key_file[active_index], share->key_file[active_index],
transaction, transaction,
......
...@@ -439,7 +439,8 @@ public: ...@@ -439,7 +439,8 @@ public:
int unpack_blobs( int unpack_blobs(
uchar* record, uchar* record,
const uchar* from_tokudb_blob, const uchar* from_tokudb_blob,
u_int32_t num_blob_bytes u_int32_t num_blob_bytes,
bool check_bitmap
); );
int unpack_row( int unpack_row(
uchar* record, uchar* record,
......
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