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 /include | |
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 'include')
-rw-r--r-- | include/heap.h | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/include/heap.h b/include/heap.h index e3e7f228421..5e83a6e2cb5 100644 --- a/include/heap.h +++ b/include/heap.h @@ -63,18 +63,48 @@ typedef struct st_heap_ptrs struct st_level_info { - uint free_ptrs_in_block,records_under_level; - HP_PTRS *last_blocks; /* pointers to HP_PTRS or records */ + /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */ + uint free_ptrs_in_block; + + /* + Maximum number of records that can be 'contained' inside of each element + of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for + level 2 - HP_PTRS_IN_NOD^2 and so forth. + */ + uint records_under_level; + + /* + Ptr to last allocated HP_PTRS (or records buffer for level 0) on this + level. + */ + HP_PTRS *last_blocks; }; -typedef struct st_heap_block /* The data is saved in blocks */ + +/* + Heap table records and hash index entries are stored in HP_BLOCKs. + HP_BLOCK is used as a 'growable array' of fixed-size records. Size of record + is recbuffer bytes. + The internal representation is as follows: + HP_BLOCK is a hierarchical structure of 'blocks'. + A block at level 0 is an array records_in_block records. + A block at higher level is an HP_PTRS structure with pointers to blocks at + lower levels. + At the highest level there is one top block. It is stored in HP_BLOCK::root. + + See hp_find_block for a description of how record pointer is obtained from + its index. + See hp_get_new_block +*/ + +typedef struct st_heap_block { - HP_PTRS *root; + HP_PTRS *root; /* Top-level block */ struct st_level_info level_info[HP_MAX_LEVELS+1]; - uint levels; - uint records_in_block; /* Records in a heap-block */ + uint levels; /* number of used levels */ + uint records_in_block; /* Records in one heap-block */ uint recbuffer; /* Length of one saved record */ - ulong last_allocated; /* Blocks allocated, used by keys */ + ulong last_allocated; /* number of records there is allocated space for */ } HP_BLOCK; struct st_heap_info; /* For referense */ |