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

addresses #1662

merge necessary changes from 11131 into main

git-svn-id: file:///svn/mysql/tokudb-engine/src@11136 c7de825b-a66e-492c-adef-691d508d4ae1
parent 413e74e1
...@@ -578,8 +578,9 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) { ...@@ -578,8 +578,9 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
// No primary key // No primary key
primary_key = table_share->keys; primary_key = table_share->keys;
key_used_on_scan = MAX_KEY; key_used_on_scan = MAX_KEY;
ref_length = hidden_primary_key = TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH; hidden_primary_key = TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH;
} ref_length = TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH + sizeof(u_int32_t);
}
else { else {
key_used_on_scan = primary_key; key_used_on_scan = primary_key;
} }
...@@ -1674,7 +1675,7 @@ int ha_tokudb::cmp_ref(const uchar * ref1, const uchar * ref2) { ...@@ -1674,7 +1675,7 @@ int ha_tokudb::cmp_ref(const uchar * ref1, const uchar * ref2) {
ref2 + sizeof(u_int32_t), ref2 + sizeof(u_int32_t),
*(u_int32_t *)ref2, *(u_int32_t *)ref2,
(uchar *)share->file->descriptor.data + 4, (uchar *)share->file->descriptor.data + 4,
*(u_int32_t *)share->file->descriptor.data, *(u_int32_t *)share->file->descriptor.data - 4,
false false
); );
return ret_val; return ret_val;
...@@ -2982,14 +2983,8 @@ DBT *ha_tokudb::get_pos(DBT * to, uchar * pos) { ...@@ -2982,14 +2983,8 @@ DBT *ha_tokudb::get_pos(DBT * to, uchar * pos) {
TOKUDB_DBUG_ENTER("ha_tokudb::get_pos"); TOKUDB_DBUG_ENTER("ha_tokudb::get_pos");
/* We don't need to set app_data here */ /* We don't need to set app_data here */
bzero((void *) to, sizeof(*to)); bzero((void *) to, sizeof(*to));
if (hidden_primary_key) { to->data = pos + sizeof(u_int32_t);
to->data = pos; to->size = *(u_int32_t *)pos;
to->size = TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH;
}
else {
to->data = pos + sizeof(u_int32_t);
to->size = *(u_int32_t *)pos;
}
DBUG_DUMP("key", (const uchar *) to->data, to->size); DBUG_DUMP("key", (const uchar *) to->data, to->size);
DBUG_RETURN(to); DBUG_RETURN(to);
} }
...@@ -3153,8 +3148,9 @@ void ha_tokudb::position(const uchar * record) { ...@@ -3153,8 +3148,9 @@ void ha_tokudb::position(const uchar * record) {
TOKUDB_DBUG_ENTER("ha_tokudb::position"); TOKUDB_DBUG_ENTER("ha_tokudb::position");
DBT key; DBT key;
if (hidden_primary_key) { if (hidden_primary_key) {
DBUG_ASSERT(ref_length == TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH); DBUG_ASSERT(ref_length == (TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH + sizeof(u_int32_t)));
memcpy_fixed(ref, (char *) current_ident, TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH); memcpy_fixed(ref + sizeof(u_int32_t), current_ident, TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
*(u_int32_t *)ref = TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH;
} }
else { else {
bool has_null; bool has_null;
......
...@@ -1418,7 +1418,7 @@ int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) { ...@@ -1418,7 +1418,7 @@ int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) {
keyb->data, keyb->data,
keyb->size, keyb->size,
(uchar *)file->descriptor.data + 4, (uchar *)file->descriptor.data + 4,
*(u_int32_t *)file->descriptor.data, *(u_int32_t *)file->descriptor.data - 4,
true true
); );
return cmp; return cmp;
......
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