summaryrefslogtreecommitdiff
path: root/heap
diff options
context:
space:
mode:
authorserg@serg.mylan <>2005-01-14 19:49:45 +0100
committerserg@serg.mylan <>2005-01-14 19:49:45 +0100
commit367bcf8c40202a884ba6b9dfc8f94b7bcf2a2adc (patch)
treefc8eed46069b12bdd227706a53e83c9c53c5633c /heap
parent78756fe7b116d3fad45bd756f800eec084961e67 (diff)
downloadmariadb-git-367bcf8c40202a884ba6b9dfc8f94b7bcf2a2adc.tar.gz
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);