summaryrefslogtreecommitdiff
path: root/heap
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-01-14 19:49:45 +0100
committerunknown <serg@serg.mylan>2005-01-14 19:49:45 +0100
commitb7efd8174a9e46ae89337b0364f132a574dc6c2f (patch)
treefc8eed46069b12bdd227706a53e83c9c53c5633c /heap
parent9edcc56cc8af12b5140fcb2ef973b44cb03d8f4c (diff)
downloadmariadb-git-b7efd8174a9e46ae89337b0364f132a574dc6c2f.tar.gz
limit HEAP table size with max_heap_table_size, better estimation for mem_per_row
heap/hp_create.c: limit HEAP table size with max_heap_table_size heap/hp_write.c: limit HEAP table size with max_heap_table_size include/heap.h: limit HEAP table size with max_heap_table_size sql/ha_heap.cc: limit HEAP table size with max_heap_table_size better estimation for mem_per_row
Diffstat (limited to 'heap')
-rw-r--r--heap/hp_create.c7
-rw-r--r--heap/hp_write.c3
2 files changed, 6 insertions, 4 deletions
diff --git a/heap/hp_create.c b/heap/hp_create.c
index fdfe78a1e09..af32fefea1b 100644
--- a/heap/hp_create.c
+++ b/heap/hp_create.c
@@ -123,15 +123,15 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
keyseg->flag= 0;
keyseg->null_bit= 0;
keyseg++;
-
- init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
+
+ init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
(qsort_cmp2)keys_compare, 1, NULL, NULL);
keyinfo->delete_key= hp_rb_delete_key;
keyinfo->write_key= hp_rb_write_key;
}
else
{
- init_block(&keyinfo->block, sizeof(HASH_INFO), min_records,
+ init_block(&keyinfo->block, sizeof(HASH_INFO), min_records,
max_records);
keyinfo->delete_key= hp_delete_key;
keyinfo->write_key= hp_write_key;
@@ -140,6 +140,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
}
share->min_records= min_records;
share->max_records= max_records;
+ share->max_table_size= create_info->max_table_size;
share->data_length= share->index_length= 0;
share->reclength= reclength;
share->blength= 1;
diff --git a/heap/hp_write.c b/heap/hp_write.c
index 43cee67b39c..808fe6608b1 100644
--- a/heap/hp_write.c
+++ b/heap/hp_write.c
@@ -143,7 +143,8 @@ static byte *next_free_record_pos(HP_SHARE *info)
}
if (!(block_pos=(info->records % info->block.records_in_block)))
{
- if (info->records > info->max_records && info->max_records)
+ if ((info->records > info->max_records && info->max_records) ||
+ (info->data_length + info->index_length >= info->max_table_size))
{
my_errno=HA_ERR_RECORD_FILE_FULL;
DBUG_RETURN(NULL);