Commit 7e9b23ce authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:1951], make new infinity byte value COL_ZERO

git-svn-id: file:///svn/mysql/tokudb-engine/src@14076 c7de825b-a66e-492c-adef-691d508d4ae1
parent 71acbd3d
...@@ -2002,11 +2002,11 @@ DBT* ha_tokudb::create_dbt_key_from_key( ...@@ -2002,11 +2002,11 @@ DBT* ha_tokudb::create_dbt_key_from_key(
// //
// first put the "infinity" byte at beginning. States if missing columns are implicitly // first put the "infinity" byte at beginning. States if missing columns are implicitly
// positive infinity or negative infinity. For this, because we are creating key // positive infinity or negative infinity or zero. For this, because we are creating key
// from a row, there is no way that columns can be missing, so in practice, // from a row, there is no way that columns can be missing, so in practice,
// this will be meaningless. Might as well put in a value // this will be meaningless. Might as well put in a value
// //
*tmp_buff++ = COL_NEG_INF; *tmp_buff++ = COL_ZERO;
size++; size++;
size += place_key_into_dbt_buff( size += place_key_into_dbt_buff(
key_info, key_info,
...@@ -2093,7 +2093,7 @@ DBT *ha_tokudb::pack_key( ...@@ -2093,7 +2093,7 @@ DBT *ha_tokudb::pack_key(
uchar * buff, uchar * buff,
const uchar * key_ptr, const uchar * key_ptr,
uint key_length, uint key_length,
uchar inf_byte int8_t inf_byte
) )
{ {
TOKUDB_DBUG_ENTER("ha_tokudb::pack_key"); TOKUDB_DBUG_ENTER("ha_tokudb::pack_key");
...@@ -2109,7 +2109,7 @@ DBT *ha_tokudb::pack_key( ...@@ -2109,7 +2109,7 @@ DBT *ha_tokudb::pack_key(
// first put the "infinity" byte at beginning. States if missing columns are implicitly // first put the "infinity" byte at beginning. States if missing columns are implicitly
// positive infinity or negative infinity // positive infinity or negative infinity
// //
*buff++ = inf_byte; *buff++ = (uchar)inf_byte;
for (; key_part != end && (int) key_length > 0; key_part++) { for (; key_part != end && (int) key_length > 0; key_part++) {
uint offset = 0; uint offset = 0;
...@@ -3566,7 +3566,7 @@ int ha_tokudb::index_next_same(uchar * buf, const uchar * key, uint keylen) { ...@@ -3566,7 +3566,7 @@ int ha_tokudb::index_next_same(uchar * buf, const uchar * key, uint keylen) {
info.buf = buf; info.buf = buf;
info.keynr = active_index; info.keynr = active_index;
pack_key(&curr_key, active_index, key_buff2, key, keylen, COL_NEG_INF); pack_key(&curr_key, active_index, key_buff2, key, keylen, COL_ZERO);
flags = SET_READ_FLAG(0); flags = SET_READ_FLAG(0);
error = handle_cursor_error(cursor->c_getf_next(cursor, flags, SMART_DBT_CALLBACK, &info),HA_ERR_END_OF_FILE,active_index); error = handle_cursor_error(cursor->c_getf_next(cursor, flags, SMART_DBT_CALLBACK, &info),HA_ERR_END_OF_FILE,active_index);
......
...@@ -253,7 +253,7 @@ class ha_tokudb : public handler { ...@@ -253,7 +253,7 @@ class ha_tokudb : public handler {
u_int32_t place_key_into_dbt_buff(KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length); u_int32_t place_key_into_dbt_buff(KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length);
DBT* create_dbt_key_from_key(DBT * key, KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH); DBT* create_dbt_key_from_key(DBT * key, KEY* key_info, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH);
DBT *create_dbt_key_from_table(DBT * key, uint keynr, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH); DBT *create_dbt_key_from_table(DBT * key, uint keynr, uchar * buff, const uchar * record, bool* has_null, int key_length = MAX_KEY_LENGTH);
DBT *pack_key(DBT * key, uint keynr, uchar * buff, const uchar * key_ptr, uint key_length, uchar inf_byte); DBT *pack_key(DBT * key, uint keynr, uchar * buff, const uchar * key_ptr, uint key_length, int8_t inf_byte);
int remove_key(DB_TXN * trans, uint keynr, const uchar * record, DBT * prim_key); int remove_key(DB_TXN * trans, uint keynr, const uchar * record, DBT * prim_key);
int remove_keys(DB_TXN * trans, const uchar * record, DBT * prim_key); int remove_keys(DB_TXN * trans, const uchar * record, DBT * prim_key);
int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row); int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row);
......
...@@ -1284,8 +1284,8 @@ int tokudb_compare_two_keys( ...@@ -1284,8 +1284,8 @@ int tokudb_compare_two_keys(
) )
{ {
int ret_val = 0; int ret_val = 0;
uchar new_key_inf_val = COL_NEG_INF; int8_t new_key_inf_val = COL_NEG_INF;
uchar saved_key_inf_val = COL_NEG_INF; int8_t saved_key_inf_val = COL_NEG_INF;
uchar* row_desc_ptr = (uchar *)row_desc; uchar* row_desc_ptr = (uchar *)row_desc;
uchar *new_key_ptr = (uchar *)new_key_data; uchar *new_key_ptr = (uchar *)new_key_data;
...@@ -1298,8 +1298,8 @@ int tokudb_compare_two_keys( ...@@ -1298,8 +1298,8 @@ int tokudb_compare_two_keys(
// if the keys have an infinity byte, set it // if the keys have an infinity byte, set it
// //
if (row_desc_ptr[0]) { if (row_desc_ptr[0]) {
new_key_inf_val = new_key_ptr[0]; new_key_inf_val = (int8_t)new_key_ptr[0];
saved_key_inf_val = saved_key_ptr[0]; saved_key_inf_val = (int8_t)saved_key_ptr[0];
new_key_ptr++; new_key_ptr++;
saved_key_ptr++; saved_key_ptr++;
} }
...@@ -1371,20 +1371,7 @@ int tokudb_compare_two_keys( ...@@ -1371,20 +1371,7 @@ int tokudb_compare_two_keys(
// in this case, read both keys to completion, now read infinity byte // in this case, read both keys to completion, now read infinity byte
// //
else if (new_key_bytes_left== 0 && saved_key_bytes_left== 0) { else if (new_key_bytes_left== 0 && saved_key_bytes_left== 0) {
if (new_key_inf_val == saved_key_inf_val) { ret_val = new_key_inf_val - saved_key_inf_val;
ret_val = 0;
}
//
// one inf byte is neg_inf and other is pos_inf
//
else {
//
// if new_key_inf_val is POS, then saved must be NEG,
// so return 1. Otherwise, new_key_inf_val is NEG, and
// saved is POS, so return -1
//
ret_val = (new_key_inf_val == COL_POS_INF ) ? 1 : -1;
}
} }
// //
// at this point, one SHOULD be 0 // at this point, one SHOULD be 0
......
...@@ -61,7 +61,8 @@ uchar* unpack_toku_key_field( ...@@ -61,7 +61,8 @@ uchar* unpack_toku_key_field(
// //
// for storing if rest of key is +/- infinity // for storing if rest of key is +/- infinity
// //
#define COL_NEG_INF 0 #define COL_NEG_INF -1
#define COL_ZERO 0
#define COL_POS_INF 1 #define COL_POS_INF 1
// //
......
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