diff options
author | unknown <sergefp@mysql.com> | 2004-10-12 18:21:25 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-10-12 18:21:25 +0400 |
commit | 612c83b845822e13a6653af3985c4e3395cb8259 (patch) | |
tree | 9fbb4447b3d2c377cbca04976cb29c19bdea3683 /sql/ha_heap.cc | |
parent | 99e1b8179eb88ad64e8cae7a6acd7822b94dda1f (diff) | |
download | mariadb-git-612c83b845822e13a6653af3985c4e3395cb8259.tar.gz |
Fix for bug#5138 continued: added comments, removed extra debug printf calls, changed ha_heap::records_in_range to use table->rec_per_key.
heap/hp_block.c:
Fix for bug#5138 continued: Added comments.
heap/hp_delete.c:
Fix for bug#5138 continued: Added comments.
heap/hp_write.c:
Fix for bug#5138 continued: Added comments, removed unneeded printf
include/heap.h:
Fix for bug#5138 continued: Added comments.
mysql-test/r/heap_hash.result:
Fix for bug#5138 continued: added FLUSH TABLES and rec_per_key estimates tests, updated test results
mysql-test/t/heap_hash.test:
Fix for bug#5138 continued: added FLUSH TABLES and rec_per_key estimates tests, updated test results
sql/ha_heap.cc:
Fix for bug#5138 continued:
fixed comments to be correct
removed unneded printf
use TABLE::rec_per_key for records_in_range statistics
Diffstat (limited to 'sql/ha_heap.cc')
-rw-r--r-- | sql/ha_heap.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 7643037e24f..5e79ee02745 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -32,8 +32,14 @@ const char **ha_heap::bas_ext() const /* Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to - rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD records have been inserted/ - updated/deleted. delete_all_rows() and table flush cause immediate update. + rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD fraction of table records + have been inserted/updated/deleted. delete_all_rows() and table flush cause + immediate update. + + NOTE + hash index statistics must be updated when number of table records changes + from 0 to non-zero value and vice versa. Otherwise records_in_range may + erroneously return 0 and 'range' may miss records. */ #define HEAP_STATS_UPDATE_THRESHOLD 10 @@ -94,7 +100,6 @@ void ha_heap::set_keys_for_scanning(void) void ha_heap::update_key_stats() { - printf("update_key_stats\n"); for (uint i= 0; i < table->keys; i++) { KEY *key=table->key_info+i; @@ -425,13 +430,7 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key, max_key->flag != HA_READ_AFTER_KEY) return HA_POS_ERROR; // Can only use exact keys else - { - ha_rows records= file->s->records; - if (!records) - return 0; - ha_rows res= records / file->s->keydef[inx].hash_buckets; - return res ? res : 1; - } + return key->rec_per_key[key->key_parts-1]; } |