diff options
author | Igor Babaev <igor@askmonty.org> | 2017-08-10 16:23:26 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-08-10 16:23:26 -0700 |
commit | 5a71e6bd5a61dff6d549d2c4f5927bbbd7ebcfee (patch) | |
tree | 98ca05164f4a2bf2fce6e1644bc6335193e69bbd /mysql-test | |
parent | 1710dd2bf286f9a240f380925a0067c57c1b29f9 (diff) | |
parent | bf75dcac89d1496032015526dc6ce78d327e329f (diff) | |
download | mariadb-git-bb-10-ext-mdev-13369.tar.gz |
Merge branch 'bb-10.2-ext' into bb-10-ext-mdev-13369bb-10-ext-mdev-13369
# Conflicts:
# mysql-test/r/derived_cond_pushdown.result
# mysql-test/t/derived_cond_pushdown.test
# sql/sql_derived.cc
# sql/sql_select.cc
# sql/sql_select.h
Diffstat (limited to 'mysql-test')
52 files changed, 778 insertions, 327 deletions
diff --git a/mysql-test/include/wait_innodb_all_purged.inc b/mysql-test/include/wait_innodb_all_purged.inc deleted file mode 100644 index a77e6ec1573..00000000000 --- a/mysql-test/include/wait_innodb_all_purged.inc +++ /dev/null @@ -1,60 +0,0 @@ -# include/wait_innodb_all_purged.inc -# -# SUMMARY -# -# Waits until purged all undo records of innodb, or operation times out. -# -# USAGE -# -# --source include/wait_innodb_all_purged.inc -# ---source include/have_innodb.inc - -if (`select version() like '%debug%'`) { ---disable_query_log - -let $wait_counter_init= 300; -if ($wait_timeout) -{ - let $wait_counter_init= `SELECT $wait_timeout * 10`; -} -# Reset $wait_timeout so that its value won't be used on subsequent -# calls, and default will be used instead. -let $wait_timeout= 0; - -let $wait_counter= $wait_counter_init; - -# Keep track of how many times the wait condition is tested -let $wait_condition_reps= 0; -let $prev_trx_age= 0; -while ($wait_counter) -{ - let $trx_age = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';`; - - if ($trx_age != $prev_trx_age) - { - let $wait_counter= $wait_counter_init; - let $prev_trx_age= $trx_age; - } - - let $success= `SELECT $trx_age < 1`; - inc $wait_condition_reps; - if ($success) - { - let $wait_counter= 0; - } - if (!$success) - { - set global innodb_purge_run_now=ON; - real_sleep 0.1; - dec $wait_counter; - } -} -if (!$success) -{ - echo Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = $trx_age; -} - ---enable_query_log -} diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index 61274fa9049..258926e8c4b 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -230,7 +230,7 @@ insert into t2 (a) values (1023); do (f2(23)); Warnings: Error 1062 Duplicate entry '23' for key 'a' -Note 4070 At line 4 in test.f2 +Note 4091 At line 4 in test.f2 select * from t2; a 1023 diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result index dc9c1da2c14..82133cd8e1d 100644 --- a/mysql-test/r/create_drop_binlog.result +++ b/mysql-test/r/create_drop_binlog.result @@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info # # Format_desc 1 # VER diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result index 117f7b851c6..c7185cff7d0 100644 --- a/mysql-test/r/create_drop_view.result +++ b/mysql-test/r/create_drop_view.result @@ -55,5 +55,5 @@ id DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' DROP TABLE t1; diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result index 51fc63371e8..028a1120419 100644 --- a/mysql-test/r/derived_cond_pushdown.result +++ b/mysql-test/r/derived_cond_pushdown.result @@ -8785,6 +8785,8 @@ DROP TABLE t1,t2; # # MDEV-13369: Optimization for equi-joins of grouping derived tables # (Splitting derived tables / views with GROUP BY) +# MDEV-13389: Optimization for equi-joins of derived tables with WF +# (Splitting derived tables / views with window functions) # create table t1 (a int); insert into t1 values @@ -9105,49 +9107,27 @@ drop index idx on t2; create index idx on t2(b); create index idx on t3(a); create index idx2 on t4(c); -insert into t3 select * from t3; -insert into t3 select * from t3; -insert into t4 select * from t4; +insert into t3 select a+1, concat(c,'f') from t3; +insert into t3 select a+1, concat(c,'h') from t3; +insert into t4 select a+1, b+10, concat(c,'h') from t4; set statement optimizer_switch='split_grouping_derived=off' for select t2.a,t2.b,t3.c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b > 50 and t2.a=t3.a and t3.c=t.c; a b c max min 7 82 aa 77 15 7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 2 90 aa 77 15 2 90 aa 77 15 +2 90 bbh 92 22 select t2.a,t2.b,t3.c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b > 50 and t2.a=t3.a and t3.c=t.c; a b c max min 7 82 aa 77 15 7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -7 82 aa 77 15 -7 82 bb 82 12 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 -2 90 aa 77 15 2 90 aa 77 15 2 90 aa 77 15 +2 90 bbh 92 22 explain extended select t2.a,t2.b,t3.c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b > 50 and t2.a=t3.a and t3.c=t.c; @@ -9219,4 +9199,146 @@ EXPLAIN } } } +set statement optimizer_switch='split_grouping_derived=off' for select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b > 50 and t2.a=t3.a and t3.c=t.c; +a b a c c b sum(b) over (partition by c) +7 82 7 aa aa 77 177 +7 82 7 aa aa 50 177 +7 82 7 aa aa 15 177 +7 82 7 aa aa 15 177 +7 82 7 aa aa 20 177 +7 82 7 bb bb 40 219 +7 82 7 bb bb 32 219 +7 82 7 bb bb 12 219 +7 82 7 bb bb 82 219 +7 82 7 bb bb 30 219 +7 82 7 bb bb 23 219 +2 90 2 aa aa 77 177 +2 90 2 aa aa 50 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 20 177 +2 90 2 aa aa 77 177 +2 90 2 aa aa 50 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 20 177 +2 90 2 bbh bbh 50 279 +2 90 2 bbh bbh 42 279 +2 90 2 bbh bbh 22 279 +2 90 2 bbh bbh 92 279 +2 90 2 bbh bbh 40 279 +2 90 2 bbh bbh 33 279 +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b > 50 and t2.a=t3.a and t3.c=t.c; +a b a c c b sum(b) over (partition by c) +7 82 7 aa aa 77 177 +7 82 7 aa aa 50 177 +7 82 7 aa aa 15 177 +7 82 7 aa aa 15 177 +7 82 7 aa aa 20 177 +7 82 7 bb bb 40 219 +7 82 7 bb bb 32 219 +7 82 7 bb bb 12 219 +7 82 7 bb bb 82 219 +7 82 7 bb bb 30 219 +7 82 7 bb bb 23 219 +2 90 2 aa aa 77 177 +2 90 2 aa aa 50 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 20 177 +2 90 2 aa aa 77 177 +2 90 2 aa aa 50 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 15 177 +2 90 2 aa aa 20 177 +2 90 2 bbh bbh 50 279 +2 90 2 bbh bbh 42 279 +2 90 2 bbh bbh 22 279 +2 90 2 bbh bbh 92 279 +2 90 2 bbh bbh 40 279 +2 90 2 bbh bbh 33 279 +explain extended select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b > 50 and t2.a=t3.a and t3.c=t.c; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 range idx idx 5 NULL 5 100.00 Using index condition; Using where +1 PRIMARY t3 ref idx idx 5 test.t2.a 3 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 19 test.t3.c 4 100.00 +2 LATERAL DERIVED t4 ref idx2 idx2 19 test.t3.c 5 100.00 Using temporary +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` > 50 +explain format=json select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b > 50 and t2.a=t3.a and t3.c=t.c; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "range", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "5", + "used_key_parts": ["b"], + "rows": 5, + "filtered": 100, + "index_condition": "t2.b > 50", + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "19", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 4, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t3.c is not null", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t4.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["idx2"], + "key": "idx2", + "key_length": "19", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } +} drop table t1,t2,t3,t4; diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index f33a482dc0b..08e6a19a9a3 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1' Note 1051 Unknown table 'test.table2' DROP VIEW IF EXISTS view1,view2,view3,view4; Warnings: -Note 4068 Unknown VIEW: 'test.view1' -Note 4068 Unknown VIEW: 'test.view2' -Note 4068 Unknown VIEW: 'test.view3' -Note 4068 Unknown VIEW: 'test.view4' +Note 4089 Unknown VIEW: 'test.view1' +Note 4089 Unknown VIEW: 'test.view2' +Note 4089 Unknown VIEW: 'test.view3' +Note 4089 Unknown VIEW: 'test.view4' # Test error message when trigger does not find table CREATE TABLE table1(a int); diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 03e4c48a3e1..10da7cd95c8 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -356,6 +356,12 @@ json_keys('foo') NULL Warnings: Warning 4038 Syntax error in JSON text in argument 1 to function 'json_keys' at position 1 +select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}'); +json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}') +["a", "b", "c"] +select json_keys('{"c1": "value 1", "c1": "value 2"}'); +json_keys('{"c1": "value 1", "c1": "value 2"}') +["c1"] SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]'; select json_search(@j, 'one', 'abc'); json_search(@j, 'one', 'abc') @@ -642,6 +648,33 @@ SELECT JSON_KEYS(f) FROM t1 ORDER BY 1; JSON_KEYS(f) NULL DROP TABLE t1; +SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' ); +JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' ) +NULL +SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' ); +JSON_EXTRACT( '{"foo":"bar"}', '$[*]' ) +NULL +select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'; +JSON_EXTRACT('{"name":"value"}', '$.name') = 'value' +1 +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true; +JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'true' +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false; +JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'true' +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1; +JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1 +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'true' +select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"'); +JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"') +"\u00f6" # # Start of 10.3 tests # diff --git a/mysql-test/r/get_diagnostics.result b/mysql-test/r/get_diagnostics.result index abd2fdd4da9..01fed8c846b 100644 --- a/mysql-test/r/get_diagnostics.result +++ b/mysql-test/r/get_diagnostics.result @@ -590,7 +590,7 @@ DROP PROCEDURE p1; SHOW WARNINGS; Level Code Message Error 54321 MESSAGE_TEXT text -Note 4070 At line 16 in test.p1 +Note 4091 At line 16 in test.p1 CREATE PROCEDURE p1() BEGIN DECLARE var INT; diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result index 8625a5bfb74..d888b08351d 100644 --- a/mysql-test/r/gis-json.result +++ b/mysql-test/r/gis-json.result @@ -61,6 +61,34 @@ POINT(102 0.5) SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')); st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) GEOMETRYCOLLECTION(POINT(102 0.5)) +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5)); +ERROR HY000: Incorrect option value: '5' for function ST_GeometryFromJSON +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)); +ERROR 22023: Invalid GIS data provided to function ST_GeometryFromJSON. +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)); +ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) +POINT(5.3 15) +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)); +ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)) +POINT(5.3 15) +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)); +ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)) +POINT(5.3 15) +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2); +ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2) +{"type": "Point", "coordinates": [5.36, 7.27]} +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1); +ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1) +{"type": "Point", "coordinates": [5.4, 7.3]} +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10); +ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10) +{"type": "Point", "coordinates": [5.363, 7.266]} +SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1); +ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1) +{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]} +SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); +ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5) +{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]} # # End of 10.2 tests # diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 9e16cf370d8..258b8e84eb4 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1428,7 +1428,7 @@ Warnings: Note 1305 FUNCTION test.test_function does not exist drop view if exists v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' create table test (col1 varchar(30)); create function test_function() returns varchar(30) begin diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index 32e7e0ddc9d..f7568c1b0f7 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -415,7 +415,7 @@ select @@profiling; drop table if exists t1, t2, t3; drop view if exists v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' drop function if exists f1; set session profiling = OFF; set global profiling_history_size= @start_value; diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 8b447f85013..79b46183b60 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -141,7 +141,7 @@ order by s_suppkey; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort +3 LATERAL DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 268 75.00 Using where 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 268 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort Warnings: @@ -162,7 +162,7 @@ order by s_suppkey; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort +3 LATERAL DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 268 100.00 Using where 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 268 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort Warnings: diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 8128edb2901..71657288c66 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -144,7 +144,7 @@ order by s_suppkey; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort +3 LATERAL DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 75.11 Using where 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 229 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort Warnings: @@ -165,7 +165,7 @@ order by s_suppkey; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort +3 LATERAL DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 100.00 Using where 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 228 100.00 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort Warnings: diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result index 4c2dda51a2f..9b140b5b33b 100644 --- a/mysql-test/r/signal.result +++ b/mysql-test/r/signal.result @@ -1715,7 +1715,7 @@ show warnings $$ Level Code Message Warning 1012 Raising a warning Error 5555 RESIGNAL to not found -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1740,7 +1740,7 @@ show warnings $$ Level Code Message Warning 1012 Raising a warning Error 5555 RESIGNAL to error -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1789,7 +1789,7 @@ show warnings $$ Level Code Message Error 1012 Raising a not found Error 5555 RESIGNAL to not found -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1814,7 +1814,7 @@ show warnings $$ Level Code Message Error 1012 Raising a not found Error 5555 RESIGNAL to error -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1863,7 +1863,7 @@ show warnings $$ Level Code Message Error 1012 Raising an error Error 5555 RESIGNAL to not found -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1888,7 +1888,7 @@ show warnings $$ Level Code Message Error 1012 Raising an error Error 5555 RESIGNAL to error -Note 4070 At line 9 in test.test_resignal +Note 4091 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1931,7 +1931,7 @@ show warnings $$ Level Code Message Warning 1264 Out of range value for column 'a' at row 1 Error 5555 RESIGNAL to a not found -Note 4070 At line 8 in test.test_resignal +Note 4091 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1953,7 +1953,7 @@ show warnings $$ Level Code Message Warning 1264 Out of range value for column 'a' at row 1 Error 5555 RESIGNAL to an error -Note 4070 At line 8 in test.test_resignal +Note 4091 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2004,7 +2004,7 @@ show warnings $$ Level Code Message Error 1329 No data - zero rows fetched, selected, or processed Error 5555 RESIGNAL to a not found -Note 4070 At line 10 in test.test_resignal +Note 4091 At line 10 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2030,7 +2030,7 @@ show warnings $$ Level Code Message Error 1329 No data - zero rows fetched, selected, or processed Error 5555 RESIGNAL to an error -Note 4070 At line 10 in test.test_resignal +Note 4091 At line 10 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2073,7 +2073,7 @@ show warnings $$ Level Code Message Error 1051 Unknown table 'test.no_such_table' Error 5555 RESIGNAL to a not found -Note 4070 At line 8 in test.test_resignal +Note 4091 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2095,7 +2095,7 @@ show warnings $$ Level Code Message Error 1051 Unknown table 'test.no_such_table' Error 5555 RESIGNAL to an error -Note 4070 At line 8 in test.test_resignal +Note 4091 At line 8 in test.test_resignal drop procedure test_resignal $$ # # More complex cases @@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message show warnings $$ Level Code Message Error 9999 Hi, I am a useless error message -Note 4070 At line 7 in test.peter_p2 +Note 4091 At line 7 in test.peter_p2 drop procedure peter_p1 $$ drop procedure peter_p2 $$ CREATE PROCEDURE peter_p1 () @@ -2198,16 +2198,16 @@ Level Code Message Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL' Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL' -Note 4070 At line 8 in test.peter_p1 +Note 4091 At line 8 in test.peter_p1 ERROR 42000: Hi, I am a useless error message show warnings $$ Level Code Message Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL' Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL' -Note 4070 At line 8 in test.peter_p1 +Note 4091 At line 8 in test.peter_p1 Error 9999 Hi, I am a useless error message -Note 4070 At line 10 in test.peter_p2 +Note 4091 At line 10 in test.peter_p2 drop procedure peter_p1 $$ drop procedure peter_p2 $$ drop procedure if exists peter_p3 $$ @@ -2225,7 +2225,7 @@ show warnings $$ Level Code Message Error 1 Original Error 2 Original -Note 4070 At line 4 in test.peter_p3 +Note 4091 At line 4 in test.peter_p3 drop procedure peter_p3 $$ drop table t_warn; drop table t_cursor; diff --git a/mysql-test/r/signal_demo3.result b/mysql-test/r/signal_demo3.result index 122a2178035..2e1943b546e 100644 --- a/mysql-test/r/signal_demo3.result +++ b/mysql-test/r/signal_demo3.result @@ -79,23 +79,23 @@ show warnings; Level Code Message Error 1051 Unknown table 'demo.oops_it_is_not_here' Error 1644 Oops in proc_9 -Note 4070 At line 4 in demo.proc_9 +Note 4091 At line 4 in demo.proc_9 Error 1644 Oops in proc_8 -Note 4070 At line 4 in demo.proc_8 +Note 4091 At line 4 in demo.proc_8 Error 1644 Oops in proc_7 -Note 4070 At line 4 in demo.proc_7 +Note 4091 At line 4 in demo.proc_7 Error 1644 Oops in proc_6 -Note 4070 At line 4 in demo.proc_6 +Note 4091 At line 4 in demo.proc_6 Error 1644 Oops in proc_5 -Note 4070 At line 4 in demo.proc_5 +Note 4091 At line 4 in demo.proc_5 Error 1644 Oops in proc_4 -Note 4070 At line 4 in demo.proc_4 +Note 4091 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4070 At line 4 in demo.proc_3 +Note 4091 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4070 At line 4 in demo.proc_2 +Note 4091 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4070 At line 4 in demo.proc_1 +Note 4091 At line 4 in demo.proc_1 SET @@session.max_error_count = 5; SELECT @@session.max_error_count; @@session.max_error_count @@ -104,11 +104,11 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4070 At line 4 in demo.proc_3 +Note 4091 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4070 At line 4 in demo.proc_2 +Note 4091 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4070 At line 4 in demo.proc_1 +Note 4091 At line 4 in demo.proc_1 SET @@session.max_error_count = 7; SELECT @@session.max_error_count; @@session.max_error_count @@ -117,13 +117,13 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4070 At line 4 in demo.proc_4 +Note 4091 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4070 At line 4 in demo.proc_3 +Note 4091 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4070 At line 4 in demo.proc_2 +Note 4091 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4070 At line 4 in demo.proc_1 +Note 4091 At line 4 in demo.proc_1 SET @@session.max_error_count = 9; SELECT @@session.max_error_count; @@session.max_error_count @@ -132,15 +132,15 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4070 At line 4 in demo.proc_5 +Note 4091 At line 4 in demo.proc_5 Error 1644 Oops in proc_4 -Note 4070 At line 4 in demo.proc_4 +Note 4091 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4070 At line 4 in demo.proc_3 +Note 4091 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4070 At line 4 in demo.proc_2 +Note 4091 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4070 At line 4 in demo.proc_1 +Note 4091 At line 4 in demo.proc_1 drop database demo; SET @@global.max_error_count = @start_global_value; SELECT @@global.max_error_count; diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index f8dd2737e8e..e3a02503ad0 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1990,8 +1990,8 @@ Warning 1264 Out of range value for column 'a' at row 1 Note 1292 Truncated incorrect INTEGER value: '222222 ' Warning 1264 Out of range value for column 'b' at row 1 Error 1048 Column 'c' cannot be null -Note 4070 At line 6 in test.t1_bi -Note 4070 At line 2 in test.p1 +Note 4091 At line 6 in test.t1_bi +Note 4091 At line 2 in test.p1 DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result index 0fc8d45c5b1..3ed3f812267 100644 --- a/mysql-test/r/sp-group.result +++ b/mysql-test/r/sp-group.result @@ -3,7 +3,7 @@ Warnings: Note 1051 Unknown table 'test.t1' drop view if exists view_t1; Warnings: -Note 4068 Unknown VIEW: 'test.view_t1' +Note 4089 Unknown VIEW: 'test.view_t1' SET sql_mode=ONLY_FULL_GROUP_BY; CREATE TABLE t1 ( pk INT, diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 71ca5de2990..53626d8013e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -3211,7 +3211,7 @@ drop procedure bug10961| DROP PROCEDURE IF EXISTS bug6866| DROP VIEW IF EXISTS tv| Warnings: -Note 4068 Unknown VIEW: 'test.tv' +Note 4089 Unknown VIEW: 'test.tv' DROP TABLE IF EXISTS tt1,tt2,tt3| Warnings: Note 1051 Unknown table 'test.tt1' @@ -7823,7 +7823,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show warnings; Level Code Message Error 1062 Duplicate entry '2' for key 'PRIMARY' -Note 4070 At line 5 in test.p1 +Note 4091 At line 5 in test.p1 select * from t1; id 1 diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index ef2e0935592..a09856c77a4 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5236,7 +5236,7 @@ CREATE TABLE t4 (i4 INT); INSERT INTO t4 VALUES (1),(2); DROP VIEW IF EXISTS v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 ); CREATE VIEW v2 AS select v1_field1 from t4 join v1; prepare my_stmt from "select v1_field1 from v2"; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 5001f707f5a..400256f2ab7 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -353,7 +353,7 @@ ERROR 23000: Duplicate entry '11' for key 'a' SHOW WARNINGS; Level Code Message -Note 4070 At line 4 in test.f1 +Note 4091 At line 4 in test.f1 Error 1062 Duplicate entry '11' for key 'a' DROP TABLE t1; diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index d5b79c106b0..743513092e2 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3174,6 +3174,18 @@ Nth_value(i,1) OVER() 1 DROP TABLE t1; # +# A regression after MDEV-13351: +# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type +# upon UNION with aggregate function +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1; +fld +1 +2 +DROP TABLE t1; +# # Start of 10.3 tests # # diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index 2896706d407..233dda00075 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -176,4 +176,14 @@ ERROR 23000: Duplicate entry '4' for key 'PRIMARY' # There must be no UPDATE query event; include/show_binlog_events.inc drop table t1, t2; +*** MDEV-11937: InnoDB flushes redo log too often *** +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SET @old_flush = @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +SELECT IF(@num_sync < 100*1.5, "OK", +CONCAT("ERROR: More than 1 fsync per commit (saw ", @num_sync/100, ")")) AS status; +status +OK +DROP TABLE t1; +SET GLOBAL innodb_flush_log_at_trx_commit=@old_flush; End of tests diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test index 8191b72d5a9..153dcdd155a 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_innodb.test @@ -172,4 +172,33 @@ source include/show_binlog_events.inc; # cleanup bug#27716 drop table t1, t2; +--echo *** MDEV-11937: InnoDB flushes redo log too often *** + +# Count number of log fsyncs reported by InnoDB per commit. +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; + +SET @old_flush = @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit=1; + +--let $syncs1 = query_get_value(SHOW STATUS LIKE 'Innodb_os_log_fsyncs', Value, 1) +--let $ROWS = 100 +--disable_query_log +let $count = $ROWS; +while ($count) { + eval INSERT INTO t1 VALUES ($count); + dec $count; +} +--let $syncs2 = query_get_value(SHOW STATUS LIKE 'Innodb_os_log_fsyncs', Value, 1) +eval SET @num_sync = $syncs2 - $syncs1; +--enable_query_log + +# Allow a bit of slack, in case some background process or something +# is introducing a few more syncs. +eval SELECT IF(@num_sync < $ROWS*1.5, "OK", + CONCAT("ERROR: More than 1 fsync per commit (saw ", @num_sync/$ROWS, ")")) AS status; + +DROP TABLE t1; +SET GLOBAL innodb_flush_log_at_trx_commit=@old_flush; + + --echo End of tests diff --git a/mysql-test/suite/encryption/r/innochecksum.result b/mysql-test/suite/encryption/r/innochecksum.result index 7cd7af7b93b..6ea54f3d053 100644 --- a/mysql-test/suite/encryption/r/innochecksum.result +++ b/mysql-test/suite/encryption/r/innochecksum.result @@ -1,3 +1,5 @@ +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate a tables CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; @@ -5,6 +7,7 @@ CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FOR CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO; CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1; CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; +CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; # Write file to make mysql-test-run.pl expect the "crash", but don't # start it until it's told to # We give 30 seconds to do a clean shutdown because we do not want @@ -16,6 +19,27 @@ CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_CO # Run innochecksum on t3 # Run innochecksum on t4 # Run innochecksum on t4 +# Run innochecksum on t5 +# Run innochecksum on t6 +# Backup tables before corrupting +# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION +# Run innochecksum on t2 +# Run innochecksum on t3 +# no encryption corrupting the field should not have effect +# Run innochecksum on t6 +# no encryption corrupting the field should not have effect +# Restore the original tables +# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum) +# Run innochecksum on t2 +# Run innochecksum on t3 +# Run innochecksum on t6 +# no encryption corrupting the field should not have effect +# Restore the original tables +# Corrupt FIL_DATA+10 (data) +# Run innochecksum on t2 +# Run innochecksum on t3 +# Run innochecksum on t6 +# Restore the original tables # Write file to make mysql-test-run.pl start up the server again # Cleanup -DROP TABLE t1, t2, t3, t4, t5; +DROP TABLE t1, t2, t3, t4, t5, t6; diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result index f8f933be831..14df0012a9c 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result +++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result @@ -25,6 +25,7 @@ CREATE TEMPORARY TABLE t LIKE t0; INSERT INTO t VALUES (NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'), (NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament'); +SET GLOBAL innodb_change_buffering=none; SET GLOBAL innodb_flush_log_at_trx_commit=1; INSERT INTO t0 SELECT NULL, t1.col_int, t1.col_int_key, t1.col_char, t1.col_char_key diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test index cb1b97ebfb3..6e3962c462f 100644 --- a/mysql-test/suite/encryption/t/innochecksum.test +++ b/mysql-test/suite/encryption/t/innochecksum.test @@ -2,21 +2,25 @@ # MDEV-8773: InnoDB innochecksum does not work with encrypted or page compressed tables # -# Don't test under embedded +--source include/innodb_page_size_small.inc +# Don't test under embedded as we restart server -- source include/not_embedded.inc # Require InnoDB -- source include/have_innodb.inc -- source include/have_file_key_management_plugin.inc +-- source include/innodb_page_size_small.inc if (!$INNOCHECKSUM) { --echo Need innochecksum binary --die Need innochecksum binary } -let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; - +--disable_warnings +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; # zlib set global innodb_compression_algorithm = 1; +--enable_warnings --echo # Create and populate a tables CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; @@ -24,9 +28,11 @@ CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FOR CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO; CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1; CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; +CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; --disable_query_log --let $i = 1000 +begin; while ($i) { INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100)); @@ -36,6 +42,8 @@ INSERT INTO t2 SELECT * FROM t1; INSERT INTO t3 SELECT * FROM t1; INSERT INTO t4 SELECT * FROM t1; INSERT INTO t5 SELECT * FROM t1; +INSERT INTO t6 SELECT * FROM t1; +commit; --enable_query_log let $MYSQLD_DATADIR=`select @@datadir`; @@ -44,6 +52,10 @@ let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd; let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd; let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd; let t5_IBD = $MYSQLD_DATADIR/test/t5.ibd; +let t6_IBD = $MYSQLD_DATADIR/test/t6.ibd; + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; --echo # Write file to make mysql-test-run.pl expect the "crash", but don't --echo # start it until it's told to @@ -77,17 +89,198 @@ shutdown_server 30; --exec $INNOCHECKSUM $t4_IBD +--echo # Run innochecksum on t5 + +--exec $INNOCHECKSUM $t5_IBD + +--echo # Run innochecksum on t6 + +--exec $INNOCHECKSUM $t6_IBD + +--enable_result_log + +--echo # Backup tables before corrupting +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd.backup +--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd.backup +--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t3.ibd.backup +--copy_file $MYSQLD_DATADIR/test/t4.ibd $MYSQLD_DATADIR/test/t4.ibd.backup +--copy_file $MYSQLD_DATADIR/test/t5.ibd $MYSQLD_DATADIR/test/t5.ibd.backup +--copy_file $MYSQLD_DATADIR/test/t6.ibd $MYSQLD_DATADIR/test/t6.ibd.backup + +# +# MDEV-11939: innochecksum mistakes a file for an encrypted one +# + +--echo # Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + +perl; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t6.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +EOF + +-- disable_result_log +--error 1 +--exec $INNOCHECKSUM $t1_IBD + +--echo # Run innochecksum on t2 + +--error 1 +--exec $INNOCHECKSUM $t2_IBD + +--echo # Run innochecksum on t3 +--echo # no encryption corrupting the field should not have effect +--exec $INNOCHECKSUM $t3_IBD + +--echo # Run innochecksum on t6 +--echo # no encryption corrupting the field should not have effect +--exec $INNOCHECKSUM $t6_IBD + --enable_result_log +--echo # Restore the original tables +--remove_file $MYSQLD_DATADIR/test/t1.ibd +--remove_file $MYSQLD_DATADIR/test/t2.ibd +--remove_file $MYSQLD_DATADIR/test/t3.ibd +--remove_file $MYSQLD_DATADIR/test/t4.ibd +--remove_file $MYSQLD_DATADIR/test/t5.ibd +--remove_file $MYSQLD_DATADIR/test/t6.ibd +--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd +--copy_file $MYSQLD_DATADIR/test/t2.ibd.backup $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t3.ibd.backup $MYSQLD_DATADIR/test/t3.ibd +--copy_file $MYSQLD_DATADIR/test/t4.ibd.backup $MYSQLD_DATADIR/test/t4.ibd +--copy_file $MYSQLD_DATADIR/test/t5.ibd.backup $MYSQLD_DATADIR/test/t5.ibd +--copy_file $MYSQLD_DATADIR/test/t6.ibd.backup $MYSQLD_DATADIR/test/t6.ibd + +--echo # Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum) + +perl; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 30, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 30, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 30, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t6.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 30, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +EOF + +-- disable_result_log +--error 1 +--exec $INNOCHECKSUM $t1_IBD + +--echo # Run innochecksum on t2 +--error 1 +--exec $INNOCHECKSUM $t2_IBD + +--echo # Run innochecksum on t3 +--error 1 +--exec $INNOCHECKSUM $t3_IBD + +--echo # Run innochecksum on t6 +--echo # no encryption corrupting the field should not have effect +--exec $INNOCHECKSUM $t6_IBD + +--enable_result_log + +--echo # Restore the original tables +--remove_file $MYSQLD_DATADIR/test/t1.ibd +--remove_file $MYSQLD_DATADIR/test/t2.ibd +--remove_file $MYSQLD_DATADIR/test/t3.ibd +--remove_file $MYSQLD_DATADIR/test/t4.ibd +--remove_file $MYSQLD_DATADIR/test/t5.ibd +--remove_file $MYSQLD_DATADIR/test/t6.ibd +--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd +--copy_file $MYSQLD_DATADIR/test/t2.ibd.backup $MYSQLD_DATADIR/test/t2.ibd +--copy_file $MYSQLD_DATADIR/test/t3.ibd.backup $MYSQLD_DATADIR/test/t3.ibd +--copy_file $MYSQLD_DATADIR/test/t4.ibd.backup $MYSQLD_DATADIR/test/t4.ibd +--copy_file $MYSQLD_DATADIR/test/t5.ibd.backup $MYSQLD_DATADIR/test/t5.ibd +--copy_file $MYSQLD_DATADIR/test/t6.ibd.backup $MYSQLD_DATADIR/test/t6.ibd + +--echo # Corrupt FIL_DATA+10 (data) + +perl; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 48, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 48, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 48, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t6.ibd") or die "open"; +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 48, SEEK_SET) or die "seek"; +print FILE pack("H*", "c00lcafedeadb017"); +close FILE or die "close"; +EOF + +-- disable_result_log +--error 1 +--exec $INNOCHECKSUM $t1_IBD + +--echo # Run innochecksum on t2 +--error 1 +--exec $INNOCHECKSUM $t2_IBD + +--echo # Run innochecksum on t3 +--error 1 +--exec $INNOCHECKSUM $t3_IBD + +--echo # Run innochecksum on t6 +--error 1 +--exec $INNOCHECKSUM $t6_IBD + +--enable_result_log + +--echo # Restore the original tables +--move_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd +--move_file $MYSQLD_DATADIR/test/t2.ibd.backup $MYSQLD_DATADIR/test/t2.ibd +--move_file $MYSQLD_DATADIR/test/t3.ibd.backup $MYSQLD_DATADIR/test/t3.ibd +--move_file $MYSQLD_DATADIR/test/t4.ibd.backup $MYSQLD_DATADIR/test/t4.ibd +--move_file $MYSQLD_DATADIR/test/t5.ibd.backup $MYSQLD_DATADIR/test/t5.ibd +--move_file $MYSQLD_DATADIR/test/t6.ibd.backup $MYSQLD_DATADIR/test/t6.ibd + --echo # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --echo # Cleanup -DROP TABLE t1, t2, t3, t4, t5; - -# reset system ---disable_query_log -EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; ---enable_query_log +DROP TABLE t1, t2, t3, t4, t5, t6; diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_log.test b/mysql-test/suite/encryption/t/innodb_encrypt_log.test index 5f60889600a..82293cc032e 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_log.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_log.test @@ -32,6 +32,11 @@ INSERT INTO t VALUES (NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'), (NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament'); +# Prevent change buffering of key(col_char_key), so that +# after the restart, the data ('secret','success','secure','sacrament') +# cannot be emitted to the unencrypted redo log by change buffer merge. +SET GLOBAL innodb_change_buffering=none; + # Force a redo log flush at the next commit. SET GLOBAL innodb_flush_log_at_trx_commit=1; INSERT INTO t0 diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index d81d09353e1..8b861011dd3 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1; ERROR 42S02: Table 'test.v1' doesn't exist DROP VIEW IF EXISTS v2; Warnings: -Note 4068 Unknown VIEW: 'test.v2' +Note 4089 Unknown VIEW: 'test.v2' Testcase 3.3.1.25 -------------------------------------------------------------------------------- @@ -7566,7 +7566,7 @@ Call sp1() ; ERROR 42000: PROCEDURE test.sp1 does not exist Drop view if exists test.v1 ; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' Drop procedure sp1 ; ERROR 42000: PROCEDURE test.sp1 does not exist @@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1; DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' Testcase 3.3.1.68 -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index ca24c73d933..082c8aeb5f3 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1; ERROR 42S02: Table 'test.v1' doesn't exist DROP VIEW IF EXISTS v2; Warnings: -Note 4068 Unknown VIEW: 'test.v2' +Note 4089 Unknown VIEW: 'test.v2' Testcase 3.3.1.25 -------------------------------------------------------------------------------- @@ -7567,7 +7567,7 @@ Call sp1() ; ERROR 42000: PROCEDURE test.sp1 does not exist Drop view if exists test.v1 ; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' Drop procedure sp1 ; ERROR 42000: PROCEDURE test.sp1 does not exist @@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1; DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4068 Unknown VIEW: 'test.v1' +Note 4089 Unknown VIEW: 'test.v1' Testcase 3.3.1.68 -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result index e2d9be445da..7d1d1d30198 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -1,5 +1,7 @@ set default_storage_engine=innodb; set @old_dbug=@@global.debug_dbug; +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE `t` ( `a` BLOB, `b` BLOB, @@ -12,9 +14,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; -select sleep(3); -sleep(3) -0 +InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; DROP TABLE t; CREATE TABLE t ( @@ -29,9 +29,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; -select sleep(3); -sleep(3) -0 +InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; DROP TABLE t; CREATE TABLE t1 ( @@ -52,9 +50,7 @@ insert into t1 values(4, 18, default); CREATE INDEX idx ON t1(x); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t1 SET id = 10 WHERE id = 1; -select sleep(3); -sleep(3) -0 +InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; DROP TABLE t1; connect con1,localhost,root,,; @@ -80,7 +76,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; # enable purge COMMIT; # wait for purge to process the deleted records. -Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = 4 +InnoDB 0 transactions not purged SET DEBUG_SYNC= 'now SIGNAL purged'; connection default; /* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; @@ -119,6 +115,7 @@ INSERT INTO t1(a, b) VALUES (8, 8); # enable purge COMMIT; # wait for purge to process the deleted/updated records. +InnoDB 1 transactions not purged SET DEBUG_SYNC= 'now SIGNAL purged'; disconnect con1; connection default; @@ -141,20 +138,26 @@ DROP TABLE t0, t1; create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); -set global innodb_purge_stop_now = 1; set global debug_dbug="+d,ib_purge_virtual_index_callback"; +connect prevent_purge, localhost, root; +start transaction with consistent snapshot; +connection default; update t set a = repeat('m', 16000) where a like "aaa%"; connect con1, localhost, root; lock table t write; +disconnect prevent_purge; connection default; -set global innodb_purge_run_now=1; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; variable_value>1 1 disconnect con1; +start transaction with consistent snapshot; +commit; +InnoDB 0 transactions not purged select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; variable_value>1 0 set global debug_dbug=@old_dbug; drop table t; set debug_sync=reset; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result index 658f49b4b31..308b01ded25 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result @@ -1,3 +1,5 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; # # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION # ON INDEXED VIRTUAL COLUMNS @@ -21,6 +23,7 @@ connection con1; COMMIT; UPDATE t1 SET a=1; connection default; +InnoDB 0 transactions not purged CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -119,6 +122,7 @@ connection con1; COMMIT; disconnect con1; connection default; +InnoDB 0 transactions not purged CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -138,3 +142,4 @@ CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VI CREATE INDEX idx ON t1(a2(10), b, a2(20)); ERROR 42S21: Duplicate column name 'a2' DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 1e6cd44d0aa..2668e26c976 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -5,6 +5,9 @@ set default_storage_engine=innodb; set @old_dbug=@@global.debug_dbug; +# Ensure that the history list length will actually be decremented by purge. +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE `t` ( `a` BLOB, @@ -21,11 +24,10 @@ CREATE INDEX idx ON t(c(100)); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; -select sleep(3); +--source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; DROP TABLE t; - CREATE TABLE t ( a TINYBLOB, b TINYBLOB, @@ -41,7 +43,7 @@ CREATE INDEX idx ON t(c(100)); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; -select sleep(3); +--source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; DROP TABLE t; @@ -68,7 +70,7 @@ CREATE INDEX idx ON t1(x); SET global debug_dbug="+d,ib_purge_virtual_index_callback"; UPDATE t1 SET id = 10 WHERE id = 1; -select sleep(3); +--source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; DROP TABLE t1; @@ -109,7 +111,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; COMMIT; --echo # wait for purge to process the deleted records. ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc SET DEBUG_SYNC= 'now SIGNAL purged'; @@ -154,7 +156,7 @@ INSERT INTO t1(a, b) VALUES (8, 8); COMMIT; --echo # wait for purge to process the deleted/updated records. ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc SET DEBUG_SYNC= 'now SIGNAL purged'; @@ -175,20 +177,24 @@ DROP TABLE t0, t1; create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); -set global innodb_purge_stop_now = 1; set global debug_dbug="+d,ib_purge_virtual_index_callback"; +connect(prevent_purge, localhost, root); +start transaction with consistent snapshot; +connection default; update t set a = repeat('m', 16000) where a like "aaa%"; connect(con1, localhost, root); lock table t write; +disconnect prevent_purge; connection default; -set global innodb_purge_run_now=1; -sleep 3; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; disconnect con1; -sleep 3; +start transaction with consistent snapshot; +commit; +--source ../../innodb/include/wait_all_purged.inc select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; set global debug_dbug=@old_dbug; drop table t; --source include/wait_until_count_sessions.inc set debug_sync=reset; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test index ab6ba52c2c3..4eb5d8c65b8 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +# Ensure that the history list length will actually be decremented by purge. +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + --echo # --echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION --echo # ON INDEXED VIRTUAL COLUMNS @@ -32,8 +36,7 @@ COMMIT; UPDATE t1 SET a=1; connection default; -# wait for purge to process the update_undo record (in debug builds) ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc CHECK TABLE t1; SELECT b1 FROM t1; @@ -118,8 +121,7 @@ COMMIT; disconnect con1; connection default; -# wait for purge to process the update_undo record (in debug builds) ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc CHECK TABLE t1; SELECT b1 FROM t1; @@ -136,3 +138,4 @@ CREATE INDEX idx ON t1(a2(10), b, a2(20)); DROP TABLE t1; --source include/wait_until_count_sessions.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc index 6aad7afa878..8c60cd6e230 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc @@ -6,7 +6,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags @@ -47,17 +46,17 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc # not merged yet # | 1,2,3,4 | 8,9,10,11 | @@ -72,34 +71,27 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; - -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc index 72242ea2e1b..8e821365e3f 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc @@ -7,7 +7,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags @@ -79,7 +78,7 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -100,10 +99,10 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc # secondary index is not merged yet # | 1,..,11 | 22,..,32 | @@ -119,33 +118,27 @@ where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc index ff34cafd24a..61e961ac6ae 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc @@ -6,7 +6,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags diff --git a/mysql-test/suite/innodb/r/index_merge_threshold.result b/mysql-test/suite/innodb/r/index_merge_threshold.result index 092bb69aa65..35cb82e6f1e 100644 --- a/mysql-test/suite/innodb/r/index_merge_threshold.result +++ b/mysql-test/suite/innodb/r/index_merge_threshold.result @@ -1,3 +1,5 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB; CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51'; @@ -205,14 +207,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -228,27 +231,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -288,14 +288,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -311,27 +312,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -371,14 +369,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -394,27 +393,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -459,14 +455,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -483,27 +480,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -872,7 +866,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -893,7 +887,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -910,27 +905,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1000,7 +992,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1021,7 +1013,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1038,27 +1031,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1128,7 +1118,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1149,7 +1139,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1166,27 +1157,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1257,7 +1245,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1278,7 +1266,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1295,27 +1284,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1323,3 +1309,4 @@ name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 DROP TABLE tab1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result index e1e616a7e6f..5809542db8a 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result +++ b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result @@ -1,5 +1,3 @@ -DROP TABLE if exists t1; -DROP TABLE if exists t2; Testing tables with large records CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; INSERT INTO t1 VALUES (1, REPEAT('A', 256), REPEAT('B', 256)); @@ -13,6 +11,7 @@ INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; +SET GLOBAL innodb_fast_shutdown = 0; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK @@ -57,6 +56,7 @@ insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256)); DROP TABLE t1; Testing table with small records CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(16), c VARCHAR(32), KEY SECOND(a,b,c)) ENGINE=INNODB; +SET GLOBAL innodb_fast_shutdown = 0; optimize table t2; Table Op Msg_type Msg_text test.t2 optimize status OK diff --git a/mysql-test/suite/innodb/t/index_merge_threshold.test b/mysql-test/suite/innodb/t/index_merge_threshold.test index 7cbde0acf03..a587e10db6c 100644 --- a/mysql-test/suite/innodb/t/index_merge_threshold.test +++ b/mysql-test/suite/innodb/t/index_merge_threshold.test @@ -11,9 +11,11 @@ # Check actual behavior for table, partitioned table and temporary table # ############################################################# --source include/have_innodb_16k.inc ---source include/have_debug.inc --source include/have_partition.inc +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + # Check index merge threshold by create index on all datatypes CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, @@ -187,3 +189,4 @@ CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45'; --source suite/innodb/include/innodb_merge_threshold_secondary.inc DROP TABLE tab1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test index 2edc8a45c02..3a5897b9911 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test +++ b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test @@ -4,11 +4,6 @@ --source include/not_embedded.inc --source include/have_innodb_16k.inc ---disable_warnings -DROP TABLE if exists t1; -DROP TABLE if exists t2; ---enable_warnings - --echo Testing tables with large records # Create table. CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; @@ -36,7 +31,7 @@ while ($size) } --enable_query_log ---source include/wait_innodb_all_purged.inc +SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc optimize table t1; @@ -135,7 +130,7 @@ while ($size) } --enable_query_log ---source include/wait_innodb_all_purged.inc +SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc optimize table t2; @@ -206,5 +201,3 @@ if ($second_before == $second_after) { } DROP TABLE t2; - ---source include/wait_innodb_all_purged.inc diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result index 78d8a1cbf90..582bb42f0cb 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result @@ -31,6 +31,7 @@ allow-mismatches 0 write crc32 page-type-summary FALSE page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt +per-page-details FALSE log (No default value) leaf FALSE merge 0 @@ -41,7 +42,7 @@ innochecksum Ver #.#.# Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others. InnoDB offline file checksum utility. -Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-e] <filename or [-]> +Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]> -?, --help Displays this help and exits. -I, --info Synonym for --help. -V, --version Displays version information and exits. @@ -62,8 +63,10 @@ Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-a Display a count of each page type in a tablespace. -D, --page-type-dump=name Dump the page type info for each page in a tablespace. + -i, --per-page-details + Print out per-page detail information. -l, --log=name log output. - -e, --leaf Examine leaf index pages + -f, --leaf Examine leaf index pages -m, --merge=# leaf page count if merge given number of consecutive pages @@ -81,6 +84,7 @@ allow-mismatches 0 write crc32 page-type-summary FALSE page-type-dump (No default value) +per-page-details FALSE log (No default value) leaf FALSE merge 0 diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_3.result b/mysql-test/suite/innodb_zip/r/innochecksum_3.result index 800556c4ff3..aaab68b3df9 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_3.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_3.result @@ -1,5 +1,6 @@ # Set the environmental variables call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"); +call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*"); [1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server. CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY, linestring_key GEOMETRY NOT NULL, @@ -105,6 +106,7 @@ File::tab#.ibd # Page compressed page # Page compressed encrypted page # Other type of page + =============================================== Additional information: Undo page type: # insert, # update, # other @@ -139,6 +141,7 @@ File::tab#.ibd # Page compressed page # Page compressed encrypted page # Other type of page + =============================================== Additional information: Undo page type: # insert, # update, # other @@ -160,14 +163,14 @@ Filename::tab#.ibd ============================================================================== PAGE_NO | PAGE_TYPE | EXTRA INFO ============================================================================== -#:: # | File Space Header | - -#:: # | Insert Buffer Bitmap | - -#:: # | Inode page | - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Freshly allocated page | - +#::# | File Space Header | - +#::# | Insert Buffer Bitmap | - +#::# | Inode page | - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Freshly allocated page | - # Variables used by page type dump for ibdata1 Variables (--variable-name=value) @@ -184,6 +187,7 @@ allow-mismatches 0 write crc32 page-type-summary FALSE page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt +per-page-details FALSE log (No default value) leaf FALSE merge 0 @@ -194,14 +198,14 @@ Filename::tab#.ibd ============================================================================== PAGE_NO | PAGE_TYPE | EXTRA INFO ============================================================================== -#:: # | File Space Header | - -#:: # | Insert Buffer Bitmap | - -#:: # | Inode page | - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Index page | index id=#, page level=# leaf #, No. of records=#, garbage=#, n_recs=#, - -#:: # | Freshly allocated page | - +#::# | File Space Header | - +#::# | Insert Buffer Bitmap | - +#::# | Inode page | - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - +#::# | Freshly allocated page | - [6]: check the valid lower bound values for option # allow-mismatches,page,start-page,end-page [9]: check the both short and long options "page" and "start-page" when diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_3.test b/mysql-test/suite/innodb_zip/t/innochecksum_3.test index 54c67ff1a9b..dab10dcc997 100644 --- a/mysql-test/suite/innodb_zip/t/innochecksum_3.test +++ b/mysql-test/suite/innodb_zip/t/innochecksum_3.test @@ -15,7 +15,9 @@ let MYSQLD_BASEDIR= `SELECT @@basedir`; let MYSQLD_DATADIR= `SELECT @@datadir`; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err; + call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"); +call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*"); --echo [1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server. diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result index 881f91e0ac5..106bf22923c 100644 --- a/mysql-test/suite/plugins/r/locales.result +++ b/mysql-test/suite/plugins/r/locales.result @@ -25,7 +25,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU 22 gl_ES Galician - Galician 8 8 , english 23 gu_IN Gujarati - India 10 8 . , english 24 he_IL Hebrew - Israel 7 5 . , english -25 hi_IN Hindi - India 7 9 . , english +25 hi_IN Hindi - India 7 9 . , hindi 26 hr_HR Croatian - Croatia 8 11 , english 27 hu_HU Hungarian - Hungary 10 9 , . hungarian 28 id_ID Indonesian - Indonesia 9 6 , . english @@ -138,7 +138,7 @@ Id Name Description Error_Message_Language 22 gl_ES Galician - Galician english 23 gu_IN Gujarati - India english 24 he_IL Hebrew - Israel english -25 hi_IN Hindi - India english +25 hi_IN Hindi - India hindi 26 hr_HR Croatian - Croatia english 27 hu_HU Hungarian - Hungary hungarian 28 id_ID Indonesian - Indonesia english diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result index 0c18249ca08..34f27faf98a 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_view.result @@ -99,7 +99,7 @@ DROP VIEW v1; ERROR 42S02: Unknown VIEW: 'test.v1' DROP VIEW IF EXISTS v2; Warnings: -Note 4068 Unknown VIEW: 'test.v2' +Note 4089 Unknown VIEW: 'test.v2' # Syncing slave with master connection slave; SELECT * FROM v1; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 3ea69a1e391..25287b70cf6 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -128,7 +128,7 @@ show warnings; Level Code Message Error 1062 Duplicate entry '20' for key 'a' Warning 1196 Some non-transactional changed tables couldn't be rolled back -Note 4070 At line 4 in mysqltest1.foo4 +Note 4091 At line 4 in mysqltest1.foo4 select * from t2; a 20 @@ -291,7 +291,7 @@ end| do fn1(100); Warnings: Error 1062 Duplicate entry '100' for key 'a' -Note 4070 At line 3 in mysqltest1.fn1 +Note 4091 At line 3 in mysqltest1.fn1 Warning 1196 Some non-transactional changed tables couldn't be rolled back select fn1(20); ERROR 23000: Duplicate entry '20' for key 'a' diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 76ebdeda0f7..1d734100d74 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -212,7 +212,7 @@ ERROR 42S02: 'test.t1' is not a SEQUENCE drop table t1; alter sequence if exists t1 minvalue=100; Warnings: -Note 4067 Unknown SEQUENCE: 'test.t1' +Note 4088 Unknown SEQUENCE: 'test.t1' alter sequence t1 minvalue=100; ERROR 42S02: Table 'test.t1' doesn't exist create sequence t1; diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result index d7492f9a22b..2697da1d8ff 100644 --- a/mysql-test/suite/sql_sequence/create.result +++ b/mysql-test/suite/sql_sequence/create.result @@ -165,7 +165,7 @@ drop sequence t1; ERROR 42S02: 'test.t1' is not a SEQUENCE drop sequence if exists t1; Warnings: -Note 4067 Unknown SEQUENCE: 'test.t1' +Note 4088 Unknown SEQUENCE: 'test.t1' create sequence t1 start with 10 maxvalue=9; ERROR HY000: Sequence 'test.t1' values are conflicting create sequence t1 minvalue= 100 maxvalue=10; @@ -377,7 +377,7 @@ key key1 (next_not_cached_value) ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys) drop sequence if exists t1; Warnings: -Note 4067 Unknown SEQUENCE: 'test.t1' +Note 4088 Unknown SEQUENCE: 'test.t1' create sequence t1; create sequence t2; create table t3 (a int) engine=myisam; @@ -387,8 +387,8 @@ CREATE SEQUENCE s1; drop sequence s1; drop sequence if exists t1,t2,t3,t4; Warnings: -Note 4067 Unknown SEQUENCE: 'test.t3' -Note 4067 Unknown SEQUENCE: 'test.t4' +Note 4088 Unknown SEQUENCE: 'test.t3' +Note 4088 Unknown SEQUENCE: 'test.t4' drop table if exists t1,t2,t3; Warnings: Note 1051 Unknown table 'test.t1' @@ -414,9 +414,9 @@ CREATE TABLE t2 (a int); CREATE SEQUENCE s1; drop sequence if exists t1,t2,s1,s2; Warnings: -Note 4067 Unknown SEQUENCE: 'test.t1' -Note 4067 Unknown SEQUENCE: 'test.t2' -Note 4067 Unknown SEQUENCE: 'test.s2' +Note 4088 Unknown SEQUENCE: 'test.t1' +Note 4088 Unknown SEQUENCE: 'test.t2' +Note 4088 Unknown SEQUENCE: 'test.s2' drop table if exists t1,t2; CREATE TEMPORARY SEQUENCE s1; DROP SEQUENCE s1; diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test index 1ecc566602e..552044823bc 100644 --- a/mysql-test/t/derived_cond_pushdown.test +++ b/mysql-test/t/derived_cond_pushdown.test @@ -1552,6 +1552,8 @@ DROP TABLE t1,t2; --echo # --echo # MDEV-13369: Optimization for equi-joins of grouping derived tables --echo # (Splitting derived tables / views with GROUP BY) +--echo # MDEV-13389: Optimization for equi-joins of derived tables with WF +--echo # (Splitting derived tables / views with window functions) --echo # let @@ -1629,9 +1631,9 @@ drop index idx on t2; create index idx on t2(b); create index idx on t3(a); create index idx2 on t4(c); -insert into t3 select * from t3; -insert into t3 select * from t3; -insert into t4 select * from t4; +insert into t3 select a+1, concat(c,'f') from t3; +insert into t3 select a+1, concat(c,'h') from t3; +insert into t4 select a+1, b+10, concat(c,'h') from t4; let $q5= select t2.a,t2.b,t3.c,t.max,t.min @@ -1643,5 +1645,14 @@ eval $q5; eval explain extended $q5; eval explain format=json $q5; -drop table t1,t2,t3,t4; +let $q6= +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b > 50 and t2.a=t3.a and t3.c=t.c; +eval $no_splitting $q6; +eval $q6; +eval explain extended $q6; +eval explain format=json $q6; + +drop table t1,t2,t3,t4; diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index ee7e51241d4..823421520c8 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -138,6 +138,11 @@ select json_keys('{"a":{"c":1, "d":2}, "b":2}'); select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b"); select json_keys('foo'); +# +# mdev-12789 JSON_KEYS returns duplicate keys twice +# +select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}'); +select json_keys('{"c1": "value 1", "c1": "value 2"}'); SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]'; select json_search(@j, 'one', 'abc'); @@ -296,6 +301,22 @@ INSERT INTO t1 VALUES (0); SELECT JSON_KEYS(f) FROM t1 ORDER BY 1; DROP TABLE t1; +# +# MDEV-12324 Wrong result (phantom array value) on JSON_EXTRACT. +# +SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' ); +SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' ); + +# +# MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql. +# + +select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'; +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true; +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false; +select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1; +select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"'); + --echo # --echo # Start of 10.3 tests --echo # diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test index 645c21bf011..5e695fbca9c 100644 --- a/mysql-test/t/gis-json.test +++ b/mysql-test/t/gis-json.test @@ -23,6 +23,23 @@ SELECT st_astext(st_geomfromgeojson('{"type""point"}')); SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')); SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')); +--error ER_WRONG_VALUE_FOR_TYPE +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5)); + +--error ER_GIS_INVALID_DATA +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)); + +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)); +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)); +SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)); + +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2); +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1); +SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10); + +SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1); +SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index cf6d88d7c44..c2022499acf 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1955,6 +1955,17 @@ UNION ALL DROP TABLE t1; --echo # +--echo # A regression after MDEV-13351: +--echo # MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type +--echo # upon UNION with aggregate function +--echo # + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1; +DROP TABLE t1; + +--echo # --echo # Start of 10.3 tests --echo # |