mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
|
||||
ORDER BY ts DESC
|
||||
LIMIT 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using where
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
|
@ -58,13 +58,13 @@ count(*)
|
||||
4181
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 9
|
||||
ARIA_PAGECACHE_READS 11
|
||||
select count(*) from t1 where b = 'test1';
|
||||
count(*)
|
||||
4181
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 9
|
||||
ARIA_PAGECACHE_READS 11
|
||||
flush tables;
|
||||
flush status;
|
||||
select @@preload_buffer_size;
|
||||
@ -75,18 +75,18 @@ Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys status OK
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 80
|
||||
ARIA_PAGECACHE_READS 107
|
||||
select count(*) from t1 where b = 'test1';
|
||||
count(*)
|
||||
4181
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 80
|
||||
ARIA_PAGECACHE_READS 107
|
||||
flush tables;
|
||||
flush status;
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 80
|
||||
ARIA_PAGECACHE_READS 107
|
||||
set session preload_buffer_size=256*1024;
|
||||
select @@preload_buffer_size;
|
||||
@@preload_buffer_size
|
||||
@ -96,18 +96,18 @@ Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys status OK
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 151
|
||||
ARIA_PAGECACHE_READS 203
|
||||
select count(*) from t1 where b = 'test1';
|
||||
count(*)
|
||||
4181
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 157
|
||||
ARIA_PAGECACHE_READS 211
|
||||
flush tables;
|
||||
flush status;
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 157
|
||||
ARIA_PAGECACHE_READS 211
|
||||
set session preload_buffer_size=1*1024;
|
||||
select @@preload_buffer_size;
|
||||
@@preload_buffer_size
|
||||
@ -118,7 +118,7 @@ test.t1 preload_keys status OK
|
||||
test.t2 preload_keys status OK
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 271
|
||||
ARIA_PAGECACHE_READS 364
|
||||
select count(*) from t1 where b = 'test1';
|
||||
count(*)
|
||||
4181
|
||||
@ -127,12 +127,12 @@ count(*)
|
||||
2584
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 274
|
||||
ARIA_PAGECACHE_READS 369
|
||||
flush tables;
|
||||
flush status;
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 274
|
||||
ARIA_PAGECACHE_READS 369
|
||||
load index into cache t3, t2 key (primary,b) ;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t3 preload_keys Error Table 'test.t3' doesn't exist
|
||||
@ -140,12 +140,12 @@ test.t3 preload_keys status Operation failed
|
||||
test.t2 preload_keys status OK
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 317
|
||||
ARIA_PAGECACHE_READS 426
|
||||
flush tables;
|
||||
flush status;
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 317
|
||||
ARIA_PAGECACHE_READS 426
|
||||
load index into cache t3 key (b), t2 key (c) ;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t3 preload_keys Error Table 'test.t3' doesn't exist
|
||||
@ -154,7 +154,7 @@ test.t2 preload_keys Error Key 'c' doesn't exist in table 't2'
|
||||
test.t2 preload_keys status Operation failed
|
||||
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Aria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
|
||||
variable_name g.variable_value-i.variable_value
|
||||
ARIA_PAGECACHE_READS 317
|
||||
ARIA_PAGECACHE_READS 426
|
||||
drop table t1, t2;
|
||||
drop temporary table initial;
|
||||
show status like "key_read%";
|
||||
|
@ -662,6 +662,13 @@ create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
|
||||
insert into t1 values (null,''), (null,'');
|
||||
explain select count(*) from t1 where a is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref idx idx 4 const 2 Using where
|
||||
insert into t1 values(1,'a');
|
||||
explain select count(*) from t1 where a is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref idx idx 4 const 2 Using where
|
||||
explain select count(*) from t1 where a = 'a';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref idx idx 4 const 1 Using where
|
||||
select count(*) from t1 where a is null;
|
||||
count(*)
|
||||
|
@ -632,6 +632,9 @@ drop table t1,t2;
|
||||
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
|
||||
insert into t1 values (null,''), (null,'');
|
||||
explain select count(*) from t1 where a is null;
|
||||
insert into t1 values(1,'a');
|
||||
explain select count(*) from t1 where a is null;
|
||||
explain select count(*) from t1 where a = 'a';
|
||||
select count(*) from t1 where a is null;
|
||||
drop table t1;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
Reference in New Issue
Block a user