diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-02-20 00:33:16 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-02-20 00:33:16 +0400 |
commit | 5367d17cd4cb2d9235099d9b8a603ee5361ea54e (patch) | |
tree | e41acd79f185b6c97daf918fc209e42d084943be /heap | |
parent | 4443e76696dff869b22a5705bd9dcbae66d09458 (diff) | |
download | mariadb-git-5367d17cd4cb2d9235099d9b8a603ee5361ea54e.tar.gz |
fixed for BUG #2719 "Heap tables status shows wrong or missing data"
heap/hp_delete.c:
added code for right calculation
of Index_length in HEAP tables with BTREE indexes
heap/hp_write.c:
added code for right calculation
of Index_length in HEAP tables with BTREE indexes
mysql-test/r/show_check.result:
added test for BUG #2719 "Heap tables status shows wrong or missing data"
mysql-test/t/show_check.test:
added test for BUG #2719 "Heap tables status shows wrong or missing data"
Diffstat (limited to 'heap')
-rw-r--r-- | heap/hp_delete.c | 7 | ||||
-rw-r--r-- | heap/hp_write.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/heap/hp_delete.c b/heap/hp_delete.c index 73e431e6e66..89d685b7d0b 100644 --- a/heap/hp_delete.c +++ b/heap/hp_delete.c @@ -67,6 +67,8 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, const byte *record, byte *recpos, int flag) { heap_rb_param custom_arg; + uint old_allocated; + int res; if (flag) info->last_pos= NULL; /* For heap_rnext/heap_rprev */ @@ -74,7 +76,10 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, custom_arg.keyseg= keyinfo->seg; custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos); custom_arg.search_flag= SEARCH_SAME; - return tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg); + old_allocated= keyinfo->rb_tree.allocated; + res= tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg); + info->s->index_length+= (keyinfo->rb_tree.allocated-old_allocated); + return res; } /* Remove one key from hash-table */ diff --git a/heap/hp_write.c b/heap/hp_write.c index f92d8caa633..3b0ec76d616 100644 --- a/heap/hp_write.c +++ b/heap/hp_write.c @@ -99,6 +99,7 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, byte *recpos) { heap_rb_param custom_arg; + uint old_allocated; info->last_pos= NULL; /* For heap_rnext/heap_rprev */ custom_arg.keyseg= keyinfo->seg; @@ -113,12 +114,14 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, custom_arg.search_flag= SEARCH_SAME; keyinfo->rb_tree.flag= 0; } + old_allocated= keyinfo->rb_tree.allocated; if (!tree_insert(&keyinfo->rb_tree, (void*)info->recbuf, custom_arg.key_length, &custom_arg)) { my_errno= HA_ERR_FOUND_DUPP_KEY; return 1; } + info->s->index_length+= (keyinfo->rb_tree.allocated-old_allocated); return 0; } |