diff options
author | unknown <ram@gw.udmsearch.izhnet.ru> | 2002-05-28 20:46:35 +0500 |
---|---|---|
committer | unknown <ram@gw.udmsearch.izhnet.ru> | 2002-05-28 20:46:35 +0500 |
commit | c78685e0c27fd15933a1aaf2733c4035aadf4e0d (patch) | |
tree | aab3730731dbe350743bccbc64d54ce36728f718 /heap/hp_write.c | |
parent | c1f3be5bb5f70e5d0376f258b79ccffa5b2d9c2b (diff) | |
download | mariadb-git-c78685e0c27fd15933a1aaf2733c4035aadf4e0d.tar.gz |
Removed unnecessary key search in the hp_rb_write_key() function
Diffstat (limited to 'heap/hp_write.c')
-rw-r--r-- | heap/hp_write.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/heap/hp_write.c b/heap/hp_write.c index fcfe922d9c0..3e74a98b23c 100644 --- a/heap/hp_write.c +++ b/heap/hp_write.c @@ -96,22 +96,23 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, info->last_pos= NULL; /* For heap_rnext/heap_rprev */ custom_arg.keyseg= keyinfo->seg; custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos); - if ((keyinfo->flag & HA_NOSAME) && - (!(keyinfo->flag & HA_NULL_PART_KEY) || - !hp_if_null_in_key(keyinfo, record))) + if (keyinfo->flag & HA_NOSAME) { custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME; - if (tree_search_key(&keyinfo->rb_tree, info->recbuf, info->parents, - &info->last_pos, 0, &custom_arg)) - { - my_errno= HA_ERR_FOUND_DUPP_KEY; - return 1; - } + keyinfo->rb_tree.flag= TREE_NO_DUPS; + } + else + { + custom_arg.search_flag= SEARCH_SAME; + keyinfo->rb_tree.flag= 0; + } + if (!tree_insert(&keyinfo->rb_tree, (void*)info->recbuf, + custom_arg.key_length, &custom_arg)) + { + my_errno= HA_ERR_FOUND_DUPP_KEY; + return 1; } - custom_arg.search_flag= SEARCH_SAME; - return tree_insert(&keyinfo->rb_tree, (void*)info->recbuf, - custom_arg.key_length + sizeof(byte*), - &custom_arg) ? 0 : 1; + return 0; } /* Find where to place new record */ |