diff options
author | monty@hundin.mysql.fi <> | 2002-10-16 13:11:25 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-10-16 13:11:25 +0300 |
commit | 67d3cd643b00d78e7236200f31efa9ec57a2083a (patch) | |
tree | d165b4baadac24102545d94c8f9fe180537a64f5 /heap | |
parent | 3712931cc6afb555146f668c63a8cba3bed33274 (diff) | |
parent | 87351da2040a11613d9f7b9aef05cab945b5ee2f (diff) | |
download | mariadb-git-67d3cd643b00d78e7236200f31efa9ec57a2083a.tar.gz |
Merge with 3.23.54
Diffstat (limited to 'heap')
-rw-r--r-- | heap/heapdef.h | 11 | ||||
-rw-r--r-- | heap/hp_open.c | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/heap/heapdef.h b/heap/heapdef.h index bdd7de45370..ef55cf5efd2 100644 --- a/heap/heapdef.h +++ b/heap/heapdef.h @@ -22,6 +22,17 @@ #endif #include "heap.h" /* Structs & some defines */ +/* + When allocating keys /rows in the internal block structure, do it + within the following boundaries. + + The challenge is to find the balance between allocate as few blocks + as possible and keep memory consumption down. +*/ + +#define HP_MIN_RECORDS_IN_BLOCK 16 +#define HP_MAX_RECORDS_IN_BLOCK 8192 + /* Some extern variables */ extern LIST *heap_open_list,*heap_share_list; diff --git a/heap/hp_open.c b/heap/hp_open.c index 938ab8c4f78..1bb28e5ffdf 100644 --- a/heap/hp_open.c +++ b/heap/hp_open.c @@ -162,8 +162,14 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records, max_records=1000; /* As good as quess as anything */ recbuffer=(uint) (reclength+sizeof(byte**)-1) & ~(sizeof(byte**)-1); records_in_block=max_records/10; - if (records_in_block < 10 && max_records) - records_in_block=10; + if (records_in_block < HP_MIN_RECORDS_IN_BLOCK && max_records) + records_in_block= HP_MIN_RECORDS_IN_BLOCK; + /* + Don't allocate too many rows at one time too keep memory consumption + done when we don't need it. + */ + if (records_in_block > HP_MAX_RECORDS_IN_BLOCK) + records_in_block= HP_MAX_RECORDS_IN_BLOCK; if (!records_in_block || records_in_block*recbuffer > (my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS)) records_in_block=(my_default_record_cache_size-sizeof(HP_PTRS)* |