diff options
author | Michael Widenius <monty@askmonty.org> | 2014-02-11 19:40:33 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2014-02-11 19:40:33 +0200 |
commit | 94d23e2413d61f9f14b230c6f73b8bdc99cd158b (patch) | |
tree | 536caabc02a45e5179433ef4bbcd22b42aac1cf1 /storage/maria | |
parent | 34bd0d02ba32997f7ffe08267422c6be4721a931 (diff) | |
download | mariadb-git-94d23e2413d61f9f14b230c6f73b8bdc99cd158b.tar.gz |
Fixed MDEV-3815: Aria engine return "The table is full" (ERROR 1114) inserting record, while MyISAM and InnoDB doesn't
Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS
mysql-test/suite/maria/icp.result:
Updated result
mysql-test/suite/maria/maria-preload.result:
More pages are needed with longer pointer length
mysql-test/suite/maria/maria.result:
Added more tests
mysql-test/suite/maria/maria.test:
Added more tests
storage/maria/ma_create.c:
Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS
storage/maria/ma_range.c:
Optimize records_in_range() to be more exact
storage/maria/ma_static.c:
Increase default pointer size
storage/maria/ma_test2.c:
Allow a bit larger errors in records_in_range
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ma_create.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_range.c | 31 | ||||
-rw-r--r-- | storage/maria/ma_static.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_test2.c | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 232f4a330eb..023dbd5bb49 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -371,7 +371,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, after the row pointer */ pointer= maria_get_pointer_length((ci->data_file_length / - maria_block_size) * 2, 3) + 1; + maria_block_size) * 2, 4) + 1; set_if_smaller(pointer, BLOCK_RECORD_POINTER_SIZE); if (!max_rows) diff --git a/storage/maria/ma_range.c b/storage/maria/ma_range.c index 2a01359f1a1..475665e17c3 100644 --- a/storage/maria/ma_range.c +++ b/storage/maria/ma_range.c @@ -177,7 +177,7 @@ static ha_rows _ma_record_pos(MARIA_HA *info, const uchar *key_data, This is the reason that we add the SEARCH_UPDATE flag here. It makes the key estimation compare in the same way like key write operations - do. Olny so we will find the keys where they have been inserted. + do. Only so we will find the keys where they have been inserted. Adding the flag unconditionally does not hurt as it is used in the above mentioned condition only. So it can safely be used together @@ -219,7 +219,7 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key, LINT_INIT(max_keynr); if (pos == HA_OFFSET_ERROR) - DBUG_RETURN(0.5); + DBUG_RETURN(0.0); if (_ma_fetch_keypage(&page, info, keyinfo, pos, PAGECACHE_LOCK_LEFT_UNLOCKED, DFLT_INIT_HITS, @@ -238,8 +238,8 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key, Try to find a smaller, better matching key. Matches keynr + [0-1] */ - if (flag > 0 && ! page.node) - offset= 1.0; + if (! page.node) + offset= 0.0; else if ((offset= _ma_search_pos(info, key, nextflag, _ma_kpos(page.node,keypos))) < 0) DBUG_RETURN(offset); @@ -247,10 +247,19 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key, else { /* - Found match. Keypos points at the start of the found key - Matches keynr+1 + Found match. Keypos points at the start of the found key. + + For node pages, we are counting underlying trees and for key + pages we are counting keys. + + If this is a node then we have to search backwards to find the + first occurence of the key. The row position in a node tree + is keynr (starting from 0) + offset for sub tree. If there is + no sub tree to search, then we are at start of next sub tree. + + If this is not a node, then the current key position is correct. */ - offset=1.0; /* Matches keynr+1 */ + offset= (page.node) ? 1.0 : 0.0; if ((nextflag & SEARCH_FIND) && page.node && ((keyinfo->flag & (HA_NOSAME | HA_NULL_PART)) != HA_NOSAME || (nextflag & (SEARCH_PREFIX | SEARCH_NO_FIND | SEARCH_LAST | @@ -267,14 +276,18 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key, } DBUG_PRINT("info",("keynr: %d offset: %g max_keynr: %d nod: %d flag: %d", keynr,offset,max_keynr,page.node,flag)); - DBUG_RETURN((keynr+offset)/(max_keynr+1)); + DBUG_RETURN((keynr+offset)/(max_keynr+test(page.node))); err: DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1.0); } -/* Get keynummer of current key and max number of keys in nod */ +/* + Get keynummer of current key and max number of keys in nod + + keynr >= 0 && key_nr <= max_key +*/ static uint _ma_keynr(MARIA_PAGE *page, uchar *keypos, uint *ret_max_key) { diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c index 8c6bf85b39e..35ad7d5a96a 100644 --- a/storage/maria/ma_static.c +++ b/storage/maria/ma_static.c @@ -51,7 +51,7 @@ ulong maria_concurrent_insert= 2; my_off_t maria_max_temp_length= MAX_FILE_SIZE; ulong maria_bulk_insert_tree_size=8192*1024; -ulong maria_data_pointer_size= 4; +ulong maria_data_pointer_size= 6; PAGECACHE maria_pagecache_var; PAGECACHE *maria_pagecache= &maria_pagecache_var; diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c index 7b4f29cf972..52c0839cff6 100644 --- a/storage/maria/ma_test2.c +++ b/storage/maria/ma_test2.c @@ -763,7 +763,7 @@ int main(int argc, char *argv[]) records=0; for (j++ ; j < k ; j++) records+=key1[j]; - if ((long) range_records < (long) records*7/10-2 || + if ((long) range_records < (long) records*6/10-2 || (long) range_records > (long) records*14/10+2) { printf("maria_records_range for key: %d returned %lu; Should be about %lu\n", |