summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-02-28 13:39:02 +0200
committerMichael Widenius <monty@askmonty.org>2012-02-28 13:39:02 +0200
commitcf06b29f603334b7026bc88ad4bca714668411f8 (patch)
tree68b53a6cabe81a783ed287ef604ce3e28e6708c4 /storage/maria
parent0919edf32d29b9371288ce1a5f4e03f051bb8093 (diff)
downloadmariadb-git-cf06b29f603334b7026bc88ad4bca714668411f8.tar.gz
Fixed lp:905716 "Assertion `page->size <= share->max_index_block_size'"
The issue was that Aria allowed too long keys to be created (so that the internal buffer was not big enough to hold the whole key). Key lengths is now limited to HA_MAX_KEY_LENGTH (1000), as for MyISAM. Fixed failure in "_ma_apply_redo_index: Assertion `new_page_length == 0", as found by buildbot. mysql-test/suite/maria/r/maria.result: Updated results mysql-test/suite/maria/r/maria3.result: Updated results. Added test for bug fix mysql-test/suite/maria/t/maria3.test: Updated results. Added test for bug fix mysql-test/suite/maria/t/optimize.test: Updated test for new max key length storage/maria/ha_maria.cc: Limit key to HA_MAX_KEY_LENGTH. storage/maria/ma_key_recover.c: Limit used page length to max page size (this is in line with the code that writes the entry to the log). This fixes failure in "_ma_apply_redo_index: Assertion `new_page_length == 0", as found by buildbot. storage/maria/ma_search.c: Extra DBUG storage/maria/ma_write.c: Added test to detect errors earlier.
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ha_maria.cc11
-rw-r--r--storage/maria/ma_key_recover.c2
-rw-r--r--storage/maria/ma_search.c4
-rw-r--r--storage/maria/ma_write.c2
4 files changed, 14 insertions, 5 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 04a97da9d8d..1e8a03d3990 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -888,8 +888,11 @@ double ha_maria::scan_time()
splitting algorithms depends on this. (With only one key on a page
we also can't use any compression, which may make the index file much
larger)
- We use HA_MAX_KEY_BUFF as this is a stack restriction imposed by the
- handler interface.
+ We use HA_MAX_KEY_LENGTH as this is a stack restriction imposed by the
+ handler interface. If we want to increase this, we have also to
+ increase HA_MARIA_KEY_BUFF and MARIA_MAX_KEY_BUFF as the buffer needs
+ to take be able to store the extra lenght bytes that is part of the stored
+ key.
We also need to reserve place for a record pointer (8) and 3 bytes
per key segment to store the length of the segment + possible null bytes.
@@ -900,7 +903,7 @@ double ha_maria::scan_time()
uint ha_maria::max_supported_key_length() const
{
uint tmp= (maria_max_key_length() - 8 - HA_MAX_KEY_SEG*3);
- return min(HA_MAX_KEY_BUFF, tmp);
+ return min(HA_MAX_KEY_LENGTH, tmp);
}
@@ -2948,7 +2951,7 @@ void ha_maria::get_auto_increment(ulonglong offset, ulonglong increment,
{
ulonglong nr;
int error;
- uchar key[HA_MAX_KEY_LENGTH];
+ uchar key[MARIA_MAX_KEY_BUFF];
if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index c0d906117b6..16ecfa292a9 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -1107,7 +1107,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u",
uint2korr(header), uint2korr(header+2)));
DBUG_ASSERT(uint2korr(header) == page_length);
- new_page_length= uint2korr(header+2);
+ new_page_length= min(uint2korr(header+2), max_page_size);
header+= 4;
break;
case KEY_OP_MAX_PAGELENGTH:
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index d6270daacee..166de13831f 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -1383,6 +1383,10 @@ uint _ma_get_binary_pack_key(MARIA_KEY *int_key, uint page_flag, uint nod_flag,
memcpy(key, from, length + nod_flag);
*page_pos= from + length + nod_flag;
+#ifdef USEFUL_FOR_DEBUGGING
+ DBUG_DUMP("key", int_key->data,
+ (uint) (int_key->data_length + int_key->ref_length));
+#endif
DBUG_RETURN(int_key->data_length + int_key->ref_length);
}
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 322bc4fcf20..5db2de51625 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -715,6 +715,8 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
{
error= _ma_insert(info, key, &page, keypos, keybuff,
father_page, father_keypos, insert_last);
+ if (error < 0)
+ goto err;
page_mark_changed(info, &page);
if (_ma_write_keypage(&page, PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS))