#define HP_MAX_LEVELS 4/* 128^5 records is enough */ #define HP_PTRS_IN_NOD 128
/* struct used with heap_functions */
typedefstruct st_heapinfo /* Struct from heap_info */
{
ulong records; /* Records in database */
ulong deleted; /* Deleted records in database */
ulong max_records;
ulonglong data_length;
ulonglong index_length;
uint reclength; /* Length of one record */ int errkey;
ulonglong auto_increment;
time_t create_time;
} HEAPINFO;
/* Structs used by heap-database-handler */
typedefstruct st_heap_ptrs
{
uchar *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
} HP_PTRS;
struct st_level_info
{ /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */
uint free_ptrs_in_block;
typedefstruct st_heap_block
{
HP_PTRS *root; /* Top-level block */ struct st_level_info level_info[HP_MAX_LEVELS+1];
uint levels; /* number of used levels */
uint recbuffer; /* Length of one saved record */
ulong records_in_block; /* Records in one heap-block */
ulong last_allocated; /* number of records there is allocated space for */
size_t alloc_size; /* Allocate blocks of this size */
} HP_BLOCK;
struct st_heap_info; /* For reference */ struct st_HA_KEYSEG;
typedefstruct st_hp_keydef /* Key definition with open */
{
uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */
uint keysegs; /* Number of key-segment */
uint length; /* Length of key (automatic) */
uint8 algorithm; /* HASH / BTREE */ struct st_HA_KEYSEG *seg;
HP_BLOCK block; /* Where keys are saved */ /* Numberofbucketsusedinhashtable.Usedonlytoprovide #recordsestimatesforheapkeyscans.
*/
ha_rows hash_buckets;
TREE rb_tree; int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, const uchar *record, uchar *recpos); int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, const uchar *record, uchar *recpos, int flag);
uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
} HP_KEYDEF;
typedefstruct st_heap_share
{
HP_BLOCK block;
HP_KEYDEF *keydef;
ulonglong data_length,index_length,max_table_size;
ulonglong auto_increment;
ulong min_records,max_records; /* Params to open */
ulong records; /* records */
ulong blength; /* records rounded up to 2^n */
ulong deleted; /* Deleted records in database */
uint key_stat_version; /* version to indicate insert/delete */
uint key_version; /* Updated on key change */
uint file_version; /* Update on clear */
uint reclength; /* Length of one record */
uint visible; /* Offset to the visible/deleted mark */
uint changed;
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
uchar *del_link; /* Link to next block with del. rec */ char * name; /* Name of "memory-file" */
time_t create_time;
THR_LOCK lock;
my_bool delete_on_close;
my_bool internal; /* Internal temporary table */
LIST open_list;
uint auto_key;
uint auto_key_type; /* real type of the auto key segment */
} HP_SHARE;
struct st_hp_hash_info;
typedefstruct st_heap_info
{
HP_SHARE *s;
uchar *current_ptr; struct st_hp_hash_info *current_hash_ptr;
ulong current_record,next_block; int lastinx,errkey; int mode; /* Mode of file (READONLY..) */
uint opt_flag,update;
uchar *lastkey; /* Last used key with rkey */
uchar *recbuf; /* Record buffer for rb-tree keys */ enum ha_rkey_function last_find_flag;
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
TREE_ELEMENT **last_pos;
uint key_version; /* Version at last read */
uint file_version; /* Version at scan */
uint lastkey_len;
my_bool implicit_emptied;
THR_LOCK_DATA lock;
LIST open_list;
} HP_INFO;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.