Commit 6226257a authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:1717], set default environment comparison functions

git-svn-id: file:///svn/mysql/tokudb-engine/src@14094 c7de825b-a66e-492c-adef-691d508d4ae1
parent c437298c
......@@ -1408,7 +1408,19 @@ int tokudb_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) {
int tokudb_cmp_dbt_data(DB *file, const DBT *keya, const DBT *keyb) {
int row_desc_offset = *(u_int32_t *)file->descriptor->data;
int cmp = tokudb_compare_two_keys(
int cmp;
//
// for no_dup tables, file->descriptor->size == row_desc_offset
// so just use a default comparison function
//
if (file->descriptor->size - row_desc_offset == 0) {
return memcmp(
keya->data,
keyb->data,
(keya->size < keyb->size) ? keya->size : keyb->size
);
}
cmp = tokudb_compare_two_keys(
keya->data,
keya->size,
keyb->data,
......
......@@ -189,6 +189,21 @@ static int tokudb_init_func(void *p) {
db_env->set_errcall(db_env, tokudb_print_error);
db_env->set_errpfx(db_env, "TokuDB");
//
// set default comparison functions
//
r = db_env->set_default_bt_compare(db_env, tokudb_cmp_dbt_key);
if (r) {
DBUG_PRINT("info", ("set_default_bt_compare%d\n", r));
goto error;
}
r = db_env->set_default_dup_compare(db_env, tokudb_cmp_dbt_data);
if (r) {
DBUG_PRINT("info", ("set_default_dup_compare%d\n", r));
goto error;
}
// config directories
#if 0
DBUG_PRINT("info", ("tokudb_tmpdir: %s\n", tokudb_tmpdir));
......
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