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

addresses #1569

fix NULLs in keys

git-svn-id: file:///svn/mysql/tokudb-engine/src@10989 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4abaedf1
...@@ -593,6 +593,39 @@ inline int tokudb_compare_two_hidden_keys( ...@@ -593,6 +593,39 @@ inline int tokudb_compare_two_hidden_keys(
return a < b ? -1 : (a > b ? 1 : 0); return a < b ? -1 : (a > b ? 1 : 0);
} }
//
// returns number of bytes to jump over
//
u_int32_t skip_field_in_descriptor(uchar* row_desc) {
uchar* row_desc_pos = row_desc;
TOKU_TYPE toku_type = (TOKU_TYPE)row_desc_pos[0];
row_desc_pos++;
switch (toku_type) {
case (toku_type_hpk):
case (toku_type_double):
case (toku_type_float):
break;
case (toku_type_int):
row_desc_pos += 2;
break;
case (toku_type_fixbinary):
case (toku_type_varbinary):
row_desc_pos++;
break;
case (toku_type_fixstring):
case (toku_type_varstring):
case (toku_type_blob):
row_desc_pos++;
row_desc_pos += sizeof(u_int32_t);
break;
default:
assert(false);
break;
}
return (u_int32_t)(row_desc_pos - row_desc);
}
inline int compare_toku_field( inline int compare_toku_field(
uchar* a_buf, uchar* a_buf,
uchar* b_buf, uchar* b_buf,
...@@ -955,8 +988,22 @@ int tokudb_compare_two_keys( ...@@ -955,8 +988,22 @@ int tokudb_compare_two_keys(
ret_val = ((int) *new_key_ptr - (int) *saved_key_ptr); ret_val = ((int) *new_key_ptr - (int) *saved_key_ptr);
goto exit; goto exit;
} }
new_key_ptr++;
saved_key_ptr++; saved_key_ptr++;
//
// in case we just read the fact that new_key_ptr and saved_key_ptr
// have NULL as their next field
//
if (!*new_key_ptr++) {
//
// skip row_desc_ptr[0] read in if clause
//
row_desc_ptr++;
//
// skip data that describes rest of field
//
row_desc_ptr += skip_field_in_descriptor(row_desc_ptr);
continue;
}
} }
row_desc_ptr++; row_desc_ptr++;
......
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