diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-07-01 14:42:02 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-07-01 14:42:02 +0300 |
commit | f09687094cbfbfd2b4373ba6a09fc40a1644bd85 (patch) | |
tree | 54426145657611ff0acb10ea0beb02d6eb467e89 | |
parent | a1267724cb1d1837026a3a5f49e55931038e43e7 (diff) | |
parent | 392ee571c175e160869a2ee0510f818e81510a03 (diff) | |
download | mariadb-git-f09687094cbfbfd2b4373ba6a09fc40a1644bd85.tar.gz |
Merge 10.4 into 10.5
41 files changed, 524 insertions, 265 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8a72a86f798..a991f88335f 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3599,7 +3599,6 @@ print_table_data(MYSQL_RES *result) { String separator(256); MYSQL_ROW cur; - MYSQL_FIELD *field; bool *num_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); @@ -3611,7 +3610,7 @@ print_table_data(MYSQL_RES *result) mysql_field_seek(result,0); } separator.copy("+",1,charset_info); - while ((field = mysql_fetch_field(result))) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { uint length= column_names ? field->name_length : 0; if (quick) @@ -3633,7 +3632,7 @@ print_table_data(MYSQL_RES *result) { mysql_field_seek(result,0); (void) tee_fputs("|", PAGER); - for (uint off=0; (field = mysql_fetch_field(result)) ; off++) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { size_t name_length= (uint) strlen(field->name); size_t numcells= charset_info->numcells(field->name, @@ -3675,7 +3674,7 @@ print_table_data(MYSQL_RES *result) data_length= (uint) lengths[off]; } - field= mysql_fetch_field(result); + MYSQL_FIELD *field= mysql_fetch_field(result); field_max_length= field->max_length; /* diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index fb3103a318d..7335ff83ff1 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2012, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1006,7 +1006,6 @@ static void print_result() char prev[(NAME_LEN+9)*3+2]; char prev_alter[MAX_ALTER_STR_SIZE]; size_t length_of_db= strlen(sock->db); - uint i; my_bool found_error=0, table_rebuild=0; DYNAMIC_ARRAY *array4repair= &tables4repair; DBUG_ENTER("print_result"); @@ -1015,7 +1014,7 @@ static void print_result() prev[0] = '\0'; prev_alter[0]= 0; - for (i = 0; (row = mysql_fetch_row(res)); i++) + while ((row = mysql_fetch_row(res))) { int changed = strcmp(prev, row[0]); my_bool status = !strcmp(row[2], "status"); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 1109ffbf3c8..757ebae415f 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1835,12 +1835,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) pthread_handler_t run_task(void *p) { - ulonglong counter= 0, queries; + ulonglong queries; ulonglong detach_counter; unsigned int commit_counter; MYSQL *mysql; MYSQL_RES *result; - MYSQL_ROW row; statement *ptr; thread_context *con= (thread_context *)p; @@ -1961,8 +1960,7 @@ limit_not_met: my_progname, mysql_errno(mysql), mysql_error(mysql)); else { - while ((row= mysql_fetch_row(result))) - counter++; + while (mysql_fetch_row(result)) {} mysql_free_result(result); } } @@ -1972,7 +1970,7 @@ limit_not_met: if (commit_rate && (++commit_counter == commit_rate)) { commit_counter= 0; - run_query(mysql, "COMMIT", strlen("COMMIT")); + run_query(mysql, C_STRING_WITH_LEN("COMMIT")); } if (con->limit && queries == con->limit) @@ -1984,7 +1982,7 @@ limit_not_met: end: if (commit_rate) - run_query(mysql, "COMMIT", strlen("COMMIT")); + run_query(mysql, C_STRING_WITH_LEN("COMMIT")); mysql_close(mysql); diff --git a/dbug/my_main.c b/dbug/my_main.c index 2b3e92b53cc..80db4d82e06 100644 --- a/dbug/my_main.c +++ b/dbug/my_main.c @@ -7,9 +7,7 @@ #include <my_sys.h> #include <my_pthread.h> -int main (argc, argv) -int argc; -char *argv[]; +int main (int argc, char **argv) { register int result, ix; extern int factorial(int); diff --git a/extra/replace.c b/extra/replace.c index 7e94bfc36c3..8b20f812be0 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -148,9 +148,7 @@ int main(int argc, char *argv[]) /* reads options */ /* Initiates DEBUG - but no debugging here ! */ -static int static_get_options(argc,argv) -register int *argc; -register char **argv[]; +static int static_get_options(int *argc, char***argv) { int help,version; char *pos; @@ -218,10 +216,9 @@ register char **argv[]; } /* static_get_options */ -static int get_replace_strings(argc,argv,from_array,to_array) -register int *argc; -register char **argv[]; -POINTER_ARRAY *from_array,*to_array; +static int get_replace_strings(int *argc, char ***argv, + POINTER_ARRAY *from_array, + POINTER_ARRAY *to_array) { char *pos; @@ -974,9 +971,7 @@ static void free_buffer() bytes read from disk. */ -static int fill_buffer_retaining(fd,n) -File fd; -int n; +static int fill_buffer_retaining(File fd, int n) { int i; @@ -1019,9 +1014,7 @@ int n; /* Return 0 if convert is ok */ /* Global variable update is set if something was changed */ -static int convert_pipe(rep,in,out) -REPLACE *rep; -FILE *in,*out; +static int convert_pipe(REPLACE *rep, FILE *in, FILE *out) { int retain,error; uint length; diff --git a/libmariadb b/libmariadb -Subproject ab7a81e79e4be4324a2d09d19d4f5249801ef66 +Subproject d12fd88b6c0fafbf25f59e7fecd639cb2b38f15 diff --git a/mysql-test/main/information_schema_tables.test b/mysql-test/main/information_schema_tables.test index bc4f269a3fb..ee277276b52 100644 --- a/mysql-test/main/information_schema_tables.test +++ b/mysql-test/main/information_schema_tables.test @@ -37,7 +37,9 @@ SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1; --eval KILL $conid --disconnect con1 --connection default +--disable_warnings DROP VIEW IF EXISTS vv; +--enable_warnings DROP VIEW v; DROP FUNCTION f; DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/instant_alter_import.result b/mysql-test/suite/innodb/r/instant_alter_import.result index fad2fd99685..9b14930b12d 100644 --- a/mysql-test/suite/innodb/r/instant_alter_import.result +++ b/mysql-test/suite/innodb/r/instant_alter_import.result @@ -127,3 +127,32 @@ UNLOCK TABLES; ALTER TABLE t2 IMPORT TABLESPACE; ERROR HY000: Index for table 't2' is corrupt; try to repair it DROP TABLE t1, t2; +# +# MDEV-28919 Assertion `(((core_null) + 7) >> 3) == +# oindex.n_core_null_bytes || !not_redundant()' failed +# +call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded"); +CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL, +c INTEGER)engine=innodb; +ALTER TABLE t DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t DROP COLUMN b, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +ALTER TABLE t DROP COLUMN c, algorithm=instant; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +CREATE TABLE t1(a INTEGER)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +unlock tables; +ALTER TABLE t IMPORT tablespace; +Warnings: +Warning 1814 Tablespace has been discarded for table `t` +check table t; +Table Op Msg_type Msg_text +test.t check status OK +select * from t; +a +1 +DROP TABLE t, t1; diff --git a/mysql-test/suite/innodb/t/instant_alter_import.test b/mysql-test/suite/innodb/t/instant_alter_import.test index fdf9f8e6cd9..3fa623d60d5 100644 --- a/mysql-test/suite/innodb/t/instant_alter_import.test +++ b/mysql-test/suite/innodb/t/instant_alter_import.test @@ -203,3 +203,28 @@ UNLOCK TABLES; ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-28919 Assertion `(((core_null) + 7) >> 3) == +--echo # oindex.n_core_null_bytes || !not_redundant()' failed +--echo # +call mtr.add_suppression(" InnoDB: Tablespace for table `test`.`t` is set as discarded"); +CREATE TABLE t (a INTEGER, b INTEGER as (a) VIRTUAL, + c INTEGER)engine=innodb; +ALTER TABLE t DISCARD TABLESPACE; +FLUSH TABLES; +# Table does reload +ALTER TABLE t DROP COLUMN b, algorithm=instant; +ALTER TABLE t DROP COLUMN c, algorithm=instant; + +CREATE TABLE t1(a INTEGER)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +--let $MYSQLD_DATADIR= `select @@datadir` +--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t.cfg +--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t.ibd +unlock tables; +ALTER TABLE t IMPORT tablespace; +check table t; +select * from t; +DROP TABLE t, t1; diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result index 37c0ff27046..fd00e3e8457 100644 --- a/mysql-test/suite/innodb_fts/r/crash_recovery.result +++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result @@ -137,3 +137,16 @@ id title body 1 MySQL Tutorial DBMS stands for Database... 2 MariaDB Tutorial DB means Database ... DROP TABLE mdev19073, mdev19073_2; +# +# MDEV-28706 Redundant InnoDB table fails during alter +# +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_text_1 TEXT +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +INSERT INTO t1 VALUES ( 1255, "mariadb", "InnoDB"); +# restart +ALTER TABLE t1 ADD FULLTEXT(col_text_1); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext2.result b/mysql-test/suite/innodb_fts/r/fulltext2.result index b210b3bd874..7ec2df8ee46 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext2.result +++ b/mysql-test/suite/innodb_fts/r/fulltext2.result @@ -272,3 +272,10 @@ fts_doc_id first_name last_name score 6 Ned Flanders 0 7 Nelson Muntz 0 DROP TABLE t1; +CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL; +ALTER TABLE t1 ADD d INT NULL; +ALTER TABLE t1 ADD FULLTEXT(b); +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test index 1b321af236a..0e32608a81a 100644 --- a/mysql-test/suite/innodb_fts/t/crash_recovery.test +++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test @@ -193,3 +193,18 @@ AGAINST ('Database' IN NATURAL LANGUAGE MODE); SELECT * FROM mdev19073_2 WHERE MATCH (title, body) AGAINST ('Database' IN NATURAL LANGUAGE MODE); DROP TABLE mdev19073, mdev19073_2; + +--echo # +--echo # MDEV-28706 Redundant InnoDB table fails during alter +--echo # + +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( + col_int INTEGER, col_text TEXT, + col_text_1 TEXT +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +INSERT INTO t1 VALUES ( 1255, "mariadb", "InnoDB"); +--source include/restart_mysqld.inc +ALTER TABLE t1 ADD FULLTEXT(col_text_1); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext2.test b/mysql-test/suite/innodb_fts/t/fulltext2.test index 4dd2c78827f..1e3894644a0 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext2.test +++ b/mysql-test/suite/innodb_fts/t/fulltext2.test @@ -257,3 +257,14 @@ INSERT INTO t1 (id, first_name, last_name) VALUES analyze table t1; SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1; DROP TABLE t1; + +# +# MDEV-28912 NON-UNIQUE FTS_DOC_ID mistaken as FTS_DOC_ID_INDEX +# +CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, + KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL; +ALTER TABLE t1 ADD d INT NULL; +--error ER_INNODB_FT_WRONG_DOCID_INDEX +ALTER TABLE t1 ADD FULLTEXT(b); +DROP TABLE t1; diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc index 2997dd9de4f..fcfd5bce746 100644 --- a/mysql-test/suite/parts/inc/partition_auto_increment.inc +++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc @@ -860,6 +860,8 @@ SELECT LAST_INSERT_ID(); SELECT * FROM t1; DROP TABLE t1; } +--echo ############################################################################## +} if (!$skip_update) { @@ -867,13 +869,13 @@ if (!$skip_update) --echo # MDEV-19622 Assertion failures in --echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table --echo # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +eval CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=$engine PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; } -if (!$skip_update) +if (!$skip_delete) { --echo # --echo # MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' @@ -884,5 +886,14 @@ REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; } ---echo ############################################################################## +if (!$skip_truncate) +{ +--echo # +--echo # MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +--echo # Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +--echo # +eval CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE=$engine PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; } diff --git a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result index 0276385dc29..c017aadcbab 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result @@ -695,3 +695,26 @@ PARTITIONS 2 SELECT * FROM t1 ORDER BY c1; c1 DROP TABLE t1; +# +# MDEV-19622 Assertion failures in +# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table +# +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Blackhole' PARTITION BY HASH(a); +INSERT INTO t1 VALUES (1,1),(2,2); +UPDATE t1 SET pk = 0; +DROP TABLE t1; +# +# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +# ha_partition::set_auto_increment_if_higher +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Blackhole' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Blackhole' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index e5414c81616..1b558b619d9 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -1101,11 +1101,12 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='InnoDB' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; @@ -1116,4 +1117,11 @@ DROP TABLE t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='InnoDB' PARTITION BY HASH (a) PARTITIONS 3; REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; -############################################################################## +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='InnoDB' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_maria.result b/mysql-test/suite/parts/r/partition_auto_increment_maria.result index ad041735ebb..8c063958b27 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result @@ -1148,11 +1148,12 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Aria' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; @@ -1163,4 +1164,11 @@ DROP TABLE t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Aria' PARTITION BY HASH (a) PARTITIONS 3; REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; -############################################################################## +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Aria' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result index d2d1fb6831c..3461f8b13c5 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -1129,11 +1129,12 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='Memory' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; @@ -1144,4 +1145,11 @@ DROP TABLE t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Memory' PARTITION BY HASH (a) PARTITIONS 3; REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; -############################################################################## +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='Memory' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result index f92a6ed18c6..525f47bdbd7 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -1148,11 +1148,12 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='MyISAM' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; @@ -1163,4 +1164,11 @@ DROP TABLE t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='MyISAM' PARTITION BY HASH (a) PARTITIONS 3; REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; -############################################################################## +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='MyISAM' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index 5cd5642c9d0..56023613157 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004, 2010, Oracle and/or its affiliates. - Copyright (c) 2012, 2014, Monty Program Ab + Copyright (c) 2012, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ static void print_query(FILE *out, const char *query) fprintf(out, "\""); while (*ptr) { - if(column >= MAX_COLUMN) + if (column >= MAX_COLUMN) { /* Wrap to the next line, tabulated. */ fprintf(out, "\"\n \""); diff --git a/sql/field.cc b/sql/field.cc index 437553525a3..8ec093f3dcf 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB + Copyright (c) 2008, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -9953,7 +9953,7 @@ int Field_bit::cmp_prefix(const uchar *a, const uchar *b, } -int Field_bit::key_cmp(const uchar *str, uint length) const +int Field_bit::key_cmp(const uchar *str, uint) const { if (bit_len) { @@ -9962,7 +9962,6 @@ int Field_bit::key_cmp(const uchar *str, uint length) const if ((flag= (int) (bits - *str))) return flag; str++; - length--; } return memcmp(ptr, str, bytes_in_rec); } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7df93820346..226dde79e54 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2434,7 +2434,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to) char *name_buffer_ptr; const char *from_path; const char *to_path= NULL; - uint i; handler **file, **abort_file; THD *thd= ha_thd(); DBUG_ENTER("ha_partition::del_ren_table"); @@ -2474,7 +2473,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to) from_path= get_canonical_filename(*file, from, from_lc_buff); if (to != NULL) to_path= get_canonical_filename(*file, to, to_lc_buff); - i= 0; do { if (unlikely((error= create_partition_name(from_buff, sizeof(from_buff), @@ -2499,7 +2497,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to) name_buffer_ptr= strend(name_buffer_ptr) + 1; if (unlikely(error)) save_error= error; - i++; } while (*(++file)); if (to != NULL) { diff --git a/sql/ha_partition.h b/sql/ha_partition.h index cc244193510..754a56cffcb 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1412,7 +1412,8 @@ private: unless we already did it. */ if (!part_share->auto_inc_initialized && - (ha_thd()->lex->sql_command == SQLCOM_INSERT || + (ha_thd()->lex->sql_command == SQLCOM_INSERT || + ha_thd()->lex->sql_command == SQLCOM_INSERT_SELECT || ha_thd()->lex->sql_command == SQLCOM_REPLACE) && table->found_next_number_field) bitmap_set_all(&m_part_info->read_partitions); diff --git a/sql/mdl.cc b/sql/mdl.cc index 2c0334b14ae..a43c7c99a05 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2012, Oracle and/or its affiliates. - Copyright (c) 2020, MariaDB + Copyright (c) 2020, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -247,25 +247,32 @@ private: Print a list of all locks to DBUG trace to help with debugging */ +const char *dbug_print_mdl(MDL_ticket *mdl_ticket) +{ + thread_local char buffer[256]; + MDL_key *mdl_key= mdl_ticket->get_key(); + my_snprintf(buffer, sizeof(buffer) - 1, "%.*s/%.*s (%s)", + (int) mdl_key->db_name_length(), mdl_key->db_name(), + (int) mdl_key->name_length(), mdl_key->name(), + mdl_ticket->get_type_name()->str); + return buffer; +} + + static int mdl_dbug_print_lock(MDL_ticket *mdl_ticket, void *arg, bool granted) { String *tmp= (String*) arg; - char buffer[128]; - MDL_key *mdl_key= mdl_ticket->get_key(); - size_t length; - length= my_snprintf(buffer, sizeof(buffer)-1, - "\nname: %s db: %.*s key_name: %.*s (%s)", - mdl_ticket->get_type_name()->str, - (int) mdl_key->db_name_length(), mdl_key->db_name(), - (int) mdl_key->name_length(), mdl_key->name(), - granted ? "granted" : "waiting"); + char buffer[256]; + size_t length= my_snprintf(buffer, sizeof(buffer) - 1, + "\n %s (%s)", dbug_print_mdl(mdl_ticket), + granted ? "granted" : "waiting"); tmp->append(buffer, length); return 0; } const char *mdl_dbug_print_locks() { - static String tmp; + thread_local String tmp; mdl_iterate(mdl_dbug_print_lock, (void*) &tmp); return tmp.c_ptr(); } @@ -2269,13 +2276,19 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) MDL_ticket *ticket; MDL_wait::enum_wait_status wait_status; DBUG_ENTER("MDL_context::acquire_lock"); +#ifndef DBUG_OFF + const char *mdl_lock_name= get_mdl_lock_name( + mdl_request->key.mdl_namespace(), mdl_request->type)->str; +#endif DBUG_PRINT("enter", ("lock_type: %s timeout: %f", - get_mdl_lock_name(mdl_request->key.mdl_namespace(), - mdl_request->type)->str, + mdl_lock_name, lock_wait_timeout)); if (try_acquire_lock_impl(mdl_request, &ticket)) + { + DBUG_PRINT("mdl", ("OOM: %s", mdl_lock_name)); DBUG_RETURN(TRUE); + } if (mdl_request->ticket) { @@ -2285,9 +2298,14 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) accordingly, so we can simply return success. */ DBUG_PRINT("info", ("Got lock without waiting")); + DBUG_PRINT("mdl", ("Seized: %s", dbug_print_mdl(mdl_request->ticket))); DBUG_RETURN(FALSE); } +#ifndef DBUG_OFF + const char *ticket_msg= dbug_print_mdl(ticket); +#endif + /* Our attempt to acquire lock without waiting has failed. As a result of this attempt we got MDL_ticket with m_lock @@ -2298,6 +2316,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) if (lock_wait_timeout == 0) { + DBUG_PRINT("mdl", ("Nowait: %s", ticket_msg)); mysql_prlock_unlock(&lock->m_rwlock); MDL_ticket::destroy(ticket); my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); @@ -2344,6 +2363,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) locker= PSI_CALL_start_metadata_wait(&state, ticket->m_psi, __FILE__, __LINE__); #endif + DBUG_PRINT("mdl", ("Waiting: %s", ticket_msg)); will_wait_for(ticket); /* There is a shared or exclusive lock on the object. */ @@ -2401,15 +2421,16 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) switch (wait_status) { case MDL_wait::VICTIM: - DBUG_LOCK_FILE; - DBUG_PRINT("mdl_locks", ("%s", mdl_dbug_print_locks())); - DBUG_UNLOCK_FILE; + DBUG_PRINT("mdl", ("Deadlock: %s", ticket_msg)); + DBUG_PRINT("mdl_locks", ("Existing locks:%s", mdl_dbug_print_locks())); my_error(ER_LOCK_DEADLOCK, MYF(0)); break; case MDL_wait::TIMEOUT: + DBUG_PRINT("mdl", ("Timeout: %s", ticket_msg)); my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); break; case MDL_wait::KILLED: + DBUG_PRINT("mdl", ("Killed: %s", ticket_msg)); get_thd()->send_kill_message(); break; default: @@ -2433,6 +2454,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) mysql_mdl_set_status(ticket->m_psi, MDL_ticket::GRANTED); + DBUG_PRINT("mdl", ("Acquired: %s", ticket_msg)); DBUG_RETURN(FALSE); } @@ -2854,6 +2876,7 @@ void MDL_context::release_lock(enum_mdl_duration duration, MDL_ticket *ticket) lock->key.db_name(), lock->key.name())); DBUG_ASSERT(this == ticket->get_ctx()); + DBUG_PRINT("mdl", ("Released: %s", dbug_print_mdl(ticket))); lock->remove_ticket(m_pins, &MDL_lock::m_granted, ticket); diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 959dd674101..154b4b53ce4 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2006, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. + Copyright (c) 2010, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1523,7 +1523,6 @@ bool partition_info::set_up_charset_field_preps(THD *thd) uchar **char_ptrs; unsigned i; size_t size; - uint tot_fields= 0; uint tot_part_fields= 0; uint tot_subpart_fields= 0; DBUG_ENTER("set_up_charset_field_preps"); @@ -1535,13 +1534,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd) ptr= part_field_array; /* Set up arrays and buffers for those fields */ while ((field= *(ptr++))) - { if (field_is_partition_charset(field)) - { tot_part_fields++; - tot_fields++; - } - } size= tot_part_fields * sizeof(char*); if (!(char_ptrs= (uchar**)thd->calloc(size))) goto error; @@ -1575,13 +1569,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd) /* Set up arrays and buffers for those fields */ ptr= subpart_field_array; while ((field= *(ptr++))) - { if (field_is_partition_charset(field)) - { tot_subpart_fields++; - tot_fields++; - } - } size= tot_subpart_fields * sizeof(char*); if (!(char_ptrs= (uchar**) thd->calloc(size))) goto error; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ae34b293944..d9e2661fa3c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2804,7 +2804,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd, uchar quote_char) { CHARSET_INFO *const cs= thd->charset(); - uint double_quotes= 0; uchar c; DBUG_ASSERT(m_ptr == m_tok_start + 1); @@ -2829,7 +2828,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd, if (yyPeek() != quote_char) break; c= yyGet(); - double_quotes++; continue; } } diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 821448740e7..51619795eac 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2009 MySQL AB - Copyright (c) 2019, 2020, MariaDB Corporation. + Copyright (c) 2019, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2516,7 +2516,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index) { int rc= 0; KEY *key_info= &table->key_info[index]; - ha_rows rows= 0; DBUG_ENTER("collect_statistics_for_index"); @@ -2551,7 +2550,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index) if (rc) break; - rows++; index_prefix_calc.add(); rc= table->file->ha_index_next(table->record[0]); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1e5f4be2dbd..2fbb6544b09 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2235,7 +2235,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, char path[FN_REFLEN + 1]; LEX_CSTRING alias= null_clex_str; StringBuffer<160> unknown_tables(system_charset_info); - uint not_found_errors= 0; int error= 0; int non_temp_tables_count= 0; bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0; @@ -2355,7 +2354,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, unknown_tables.append(&table_name); unknown_tables.append(','); error= ENOENT; - not_found_errors++; continue; } @@ -2437,7 +2435,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, unknown_tables.append(&table_name); unknown_tables.append(','); error= ENOENT; - not_found_errors++; continue; } @@ -2635,7 +2632,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, } else { - not_found_errors++; if (unknown_tables.append(tbl_name) || unknown_tables.append(',')) { error= 1; @@ -3791,7 +3787,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, List_iterator<Key> key_iterator(alter_info->key_list); List_iterator<Key> key_iterator2(alter_info->key_list); - uint key_parts=0, fk_key_count=0; + uint key_parts=0; bool primary_key=0,unique_key=0; Key *key, *key2; uint tmp, key_number; @@ -3807,7 +3803,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, "(none)" , key->type)); if (key->type == Key::FOREIGN_KEY) { - fk_key_count++; Foreign_key *fk_key= (Foreign_key*) key; if (fk_key->validate(alter_info->create_list)) DBUG_RETURN(TRUE); diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 4e5d41477e5..124e9b033a6 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -362,7 +362,6 @@ inline void PageBulk::finishPage() ut_ad((fmt != REDUNDANT) == m_is_comp); ulint count= 0; - ulint n_recs= 0; byte *slot= my_assume_aligned<2>(m_page + srv_page_size - (PAGE_DIR + PAGE_DIR_SLOT_SIZE)); const page_dir_slot_t *const slot0 = slot; @@ -378,7 +377,6 @@ inline void PageBulk::finishPage() ut_ad(offset >= PAGE_NEW_SUPREMUM); ut_ad(offset < page_offset(slot)); count++; - n_recs++; if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) { @@ -432,7 +430,6 @@ inline void PageBulk::finishPage() while (insert_rec != m_page + PAGE_OLD_SUPREMUM) { count++; - n_recs++; if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) { diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 72f7e795bc9..035b43fad4c 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1004,7 +1004,10 @@ void buf_page_print(const byte *read_buf, ulint zip_size) byte row[64]; for (byte *r= row; r != &row[64]; r+= 2, read_buf++) - r[0]= hex_to_ascii(*read_buf >> 4), r[1]= hex_to_ascii(*read_buf & 15); + { + r[0]= hex_to_ascii(byte(*read_buf >> 4)); + r[1]= hex_to_ascii(*read_buf & 15); + } sql_print_information("InnoDB: %.*s", 64, row); } diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 2faa7b23ced..ad168016dc3 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1844,6 +1844,7 @@ dict_load_columns( if (table->fts == NULL) { table->fts = fts_create(table); table->fts->cache = fts_cache_create(table); + DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME); } ut_a(table->fts->doc_col == ULINT_UNDEFINED); @@ -2593,8 +2594,11 @@ next_rec: ut_ad(table->fts_doc_id_index == NULL); if (table->fts != NULL) { - table->fts_doc_id_index = dict_table_get_index_on_name( + dict_index_t *idx = dict_table_get_index_on_name( table, FTS_DOC_ID_INDEX_NAME); + if (idx && dict_index_is_unique(idx)) { + table->fts_doc_id_index = idx; + } } /* If the table contains FTS indexes, populate table->fts->indexes */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 30a116a6cc5..f4b20caa5eb 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -227,7 +227,7 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old, If that is the case, the instant ALTER TABLE would keep the InnoDB table in its current format. */ - const dict_index_t& oindex = *old.indexes.start; + dict_index_t& oindex = *old.indexes.start; dict_index_t& index = *indexes.start; first_alter_pos = 0; @@ -373,6 +373,15 @@ found_j: goto found_nullable; } } + + /* In case of discarded tablespace, InnoDB can't + read the root page. So assign the null bytes based + on nullabled fields */ + if (!oindex.table->space) { + oindex.n_core_null_bytes = static_cast<uint8_t>( + UT_BITS_IN_BYTES(unsigned(oindex.n_nullable))); + } + /* The n_core_null_bytes only matters for ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */ ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes @@ -9208,16 +9217,14 @@ innobase_rename_columns_try( const char* table_name) { uint i = 0; - ulint num_v = 0; DBUG_ASSERT(ctx->need_rebuild()); DBUG_ASSERT(ha_alter_info->handler_flags & ALTER_COLUMN_NAME); for (Field** fp = table->field; *fp; fp++, i++) { - const bool is_virtual = !(*fp)->stored_in_db(); if (!((*fp)->flags & FIELD_IS_RENAMED)) { - goto processed_field; + continue; } for (const Create_field& cf : @@ -9235,10 +9242,6 @@ innobase_rename_columns_try( ut_error; processed_field: - if (is_virtual) { - num_v++; - } - continue; } diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 639dcd7eaae..266792b2fce 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -59,6 +59,7 @@ Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits) #include "fil0crypt.h" #include "dict0crea.h" #include "fts0vlc.h" +#include "log.h" /** The latest successfully looked up innodb_fts_aux_table */ UNIV_INTERN table_id_t innodb_ft_aux_table_id; @@ -186,19 +187,37 @@ sync_arr_fill_sys_semphore_waits_table( TABLE_LIST* tables, /*!< in/out: tables to fill */ Item* ); /*!< in: condition (not used) */ -/*******************************************************************//** +/** Common function to fill any of the dynamic tables: INFORMATION_SCHEMA.innodb_trx INFORMATION_SCHEMA.innodb_locks INFORMATION_SCHEMA.innodb_lock_waits -@return 0 on success */ -static -int -trx_i_s_common_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - Item* ); /*!< in: condition (not used) */ +@retval false if access to the table is blocked +@retval true if something should be filled in */ +static bool trx_i_s_common_fill_table(THD *thd, TABLE_LIST *tables) +{ + DBUG_ENTER("trx_i_s_common_fill_table"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) + DBUG_RETURN(false); + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); + + /* update the cache */ + trx_i_s_cache_start_write(trx_i_s_cache); + trx_i_s_possibly_fetch_data_into_cache(trx_i_s_cache); + trx_i_s_cache_end_write(trx_i_s_cache); + + if (trx_i_s_cache_is_truncated(trx_i_s_cache)) + sql_print_warning("InnoDB: Data in %.*s truncated due to memory limit" + " of %u bytes", + int(tables->schema_table_name.length), + tables->schema_table_name.str, + TRX_I_S_MEM_LIMIT); + + DBUG_RETURN(true); +} /*******************************************************************//** Unbind a dynamic INFORMATION_SCHEMA table. @@ -360,26 +379,29 @@ static ST_FIELD_INFO innodb_trx_fields_info[]= /*******************************************************************//** Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx table with it. -@return 0 on success */ -static -int -fill_innodb_trx_from_cache( -/*=======================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ - THD* thd, /*!< in: used to call - schema_table_store_record() */ - TABLE* table) /*!< in/out: fill this table */ +@retval 0 on success +@retval 1 on failure */ +static int fill_innodb_trx_from_cache(THD *thd, TABLE_LIST *tables, Item*) { - Field** fields; ulint rows_num; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; ulint i; DBUG_ENTER("fill_innodb_trx_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } - rows_num = trx_i_s_cache_get_rows_used(cache, + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; + + Field** fields = tables->table->field; + + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_TRX); for (i = 0; i < rows_num; i++) { @@ -388,7 +410,7 @@ fill_innodb_trx_from_cache( row = (i_s_trx_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_TRX, i); + trx_i_s_cache, I_S_INNODB_TRX, i); /* trx_id */ OK(fields[IDX_TRX_ID]->store(row->trx_id, true)); @@ -497,7 +519,7 @@ fill_innodb_trx_from_cache( OK(fields[IDX_TRX_AUTOCOMMIT_NON_LOCKING]->store( row->trx_is_autocommit_non_locking, true)); - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -519,7 +541,7 @@ innodb_trx_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_trx_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_trx_from_cache; DBUG_RETURN(0); } @@ -646,20 +668,29 @@ static int fill_innodb_locks_from_cache( /*=========================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ THD* thd, /*!< in: MySQL client connection */ - TABLE* table) /*!< in/out: fill this table */ + TABLE_LIST* tables, /*!< in/out: fill this table */ + Item*) { - Field** fields; ulint rows_num; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; ulint i; DBUG_ENTER("fill_innodb_locks_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } + + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; - rows_num = trx_i_s_cache_get_rows_used(cache, + Field** fields = tables->table->field; + + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_LOCKS); for (i = 0; i < rows_num; i++) { @@ -670,7 +701,7 @@ fill_innodb_locks_from_cache( row = (i_s_locks_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_LOCKS, i); + trx_i_s_cache, I_S_INNODB_LOCKS, i); /* lock_id */ trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id)); @@ -717,7 +748,7 @@ fill_innodb_locks_from_cache( fields[IDX_LOCK_DATA]->set_null(); } - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -739,7 +770,7 @@ innodb_locks_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_locks_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_locks_from_cache; DBUG_RETURN(0); } @@ -821,12 +852,11 @@ static int fill_innodb_lock_waits_from_cache( /*==============================*/ - trx_i_s_cache_t* cache, /*!< in: cache to read from */ THD* thd, /*!< in: used to call schema_table_store_record() */ - TABLE* table) /*!< in/out: fill this table */ + TABLE_LIST* tables, /*!< in/out: fill this table */ + Item*) { - Field** fields; ulint rows_num; char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; char blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; @@ -834,9 +864,19 @@ fill_innodb_lock_waits_from_cache( DBUG_ENTER("fill_innodb_lock_waits_from_cache"); - fields = table->field; + if (!trx_i_s_common_fill_table(thd, tables)) { + DBUG_RETURN(0); + } + + struct cache + { + cache() { trx_i_s_cache_start_read(trx_i_s_cache); } + ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); } + } c; + + Field** fields = tables->table->field; - rows_num = trx_i_s_cache_get_rows_used(cache, + rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache, I_S_INNODB_LOCK_WAITS); for (i = 0; i < rows_num; i++) { @@ -845,7 +885,7 @@ fill_innodb_lock_waits_from_cache( row = (i_s_lock_waits_row_t*) trx_i_s_cache_get_nth_row( - cache, I_S_INNODB_LOCK_WAITS, i); + trx_i_s_cache, I_S_INNODB_LOCK_WAITS, i); /* requesting_trx_id */ OK(fields[IDX_REQUESTING_TRX_ID]->store( @@ -871,7 +911,7 @@ fill_innodb_lock_waits_from_cache( blocking_lock_id, sizeof(blocking_lock_id)))); - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -893,7 +933,7 @@ innodb_lock_waits_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = Show::innodb_lock_waits_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_lock_waits_from_cache; DBUG_RETURN(0); } @@ -947,105 +987,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = MariaDB_PLUGIN_MATURITY_STABLE, }; -/*******************************************************************//** -Common function to fill any of the dynamic tables: -INFORMATION_SCHEMA.innodb_trx -INFORMATION_SCHEMA.innodb_locks -INFORMATION_SCHEMA.innodb_lock_waits -@return 0 on success */ -static -int -trx_i_s_common_fill_table( -/*======================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - Item* ) /*!< in: condition (not used) */ -{ - LEX_CSTRING table_name; - int ret; - trx_i_s_cache_t* cache; - - DBUG_ENTER("trx_i_s_common_fill_table"); - - /* deny access to non-superusers */ - if (check_global_access(thd, PROCESS_ACL)) { - - DBUG_RETURN(0); - } - - /* minimize the number of places where global variables are - referenced */ - cache = trx_i_s_cache; - - /* which table we have to fill? */ - table_name = tables->schema_table_name; - /* or table_name = tables->schema_table->table_name; */ - - RETURN_IF_INNODB_NOT_STARTED(table_name.str); - - /* update the cache */ - trx_i_s_cache_start_write(cache); - trx_i_s_possibly_fetch_data_into_cache(cache); - trx_i_s_cache_end_write(cache); - - if (trx_i_s_cache_is_truncated(cache)) { - - ib::warn() << "Data in " << table_name.str << " truncated due to" - " memory limit of " << TRX_I_S_MEM_LIMIT << " bytes"; - } - - ret = 0; - - trx_i_s_cache_start_read(cache); - - if (innobase_strcasecmp(table_name.str, "innodb_trx") == 0) { - - if (fill_innodb_trx_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else if (innobase_strcasecmp(table_name.str, "innodb_locks") == 0) { - - if (fill_innodb_locks_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else if (innobase_strcasecmp(table_name.str, "innodb_lock_waits") == 0) { - - if (fill_innodb_lock_waits_from_cache( - cache, thd, tables->table) != 0) { - - ret = 1; - } - - } else { - ib::error() << "trx_i_s_common_fill_table() was" - " called to fill unknown table: " << table_name.str << "." - " This function only knows how to fill" - " innodb_trx, innodb_locks and" - " innodb_lock_waits tables."; - - ret = 1; - } - - trx_i_s_cache_end_read(cache); - -#if 0 - DBUG_RETURN(ret); -#else - /* if this function returns something else than 0 then a - deadlock occurs between the mysqld server and mysql client, - see http://bugs.mysql.com/29900 ; when that bug is resolved - we can enable the DBUG_RETURN(ret) above */ - ret++; // silence a gcc46 warning - DBUG_RETURN(0); -#endif -} - namespace Show { /* Fields of the dynamic table information_schema.innodb_cmp. */ static ST_FIELD_INFO i_s_cmp_fields_info[] = diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 41a4a0b82d3..6f3c61ac850 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -120,7 +120,6 @@ public: rec_offs* ins_offsets = NULL; dberr_t error = DB_SUCCESS; dtuple_t* dtuple; - ulint count = 0; const ulint flag = BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG; @@ -228,7 +227,6 @@ public: mtr_commit(&mtr); rtr_clean_rtr_info(&rtr_info, true); - count++; } m_dtuple_vec->clear(); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result new file mode 100644 index 00000000000..1d154daa8ec --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result @@ -0,0 +1,75 @@ +# +# MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause' +# +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +CREATE TABLE tbl_a ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`first_name` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN'); +CREATE TABLE `tbl_b` ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`last_name` varchar(255) DEFAULT NULL, +PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI'); +CREATE TABLE `tbl_c` ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`surname` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2'); +SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; +id last_name id surname id first_name +1 DEMONGEOT 1 CON 1 RICHARD +2 VAROQUI 2 MOYEN 2 STEPHANE +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`first_name` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' +PARTITION BY LIST COLUMNS(`id`) ( +PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); +CREATE TABLE `tbl_b` ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`last_name` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b"' +PARTITION BY LIST COLUMNS(`id`) ( +PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); +CREATE TABLE `tbl_c` ( +`id` int(10) unsigned NOT NULL AUTO_INCREMENT, +`surname` varchar(255) DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c"' +PARTITION BY LIST COLUMNS(`id`) ( +PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); +SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; +id last_name id surname id first_name +1 DEMONGEOT 1 CON 1 RICHARD +2 VAROQUI 2 MOYEN 2 STEPHANE +connection master_1; +DROP DATABASE auto_test_local; +connection child2_1; +DROP DATABASE auto_test_remote; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test new file mode 100644 index 00000000000..5756cbac993 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test @@ -0,0 +1,84 @@ +--echo # +--echo # MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause' +--echo # + +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +eval CREATE TABLE tbl_a ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `first_name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN'); + +eval CREATE TABLE `tbl_b` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `last_name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`ID`) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI'); + +eval CREATE TABLE `tbl_c` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `surname` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2'); + +SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; + +eval CREATE TABLE tbl_a ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `first_name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' +PARTITION BY LIST COLUMNS(`id`) ( + PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); + +eval CREATE TABLE `tbl_b` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `last_name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b"' +PARTITION BY LIST COLUMNS(`id`) ( + PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); + +eval CREATE TABLE `tbl_c` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `surname` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c"' +PARTITION BY LIST COLUMNS(`id`) ( + PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' +); + +SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; + +--connection master_1 +DROP DATABASE auto_test_local; + +--connection child2_1 +DROP DATABASE auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/r/direct_join.result b/storage/spider/mysql-test/spider/r/direct_join.result index a1018c35fbf..36728ad5d45 100644 --- a/storage/spider/mysql-test/spider/r/direct_join.result +++ b/storage/spider/mysql-test/spider/r/direct_join.result @@ -76,7 +76,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc limit 1,2 +select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc limit 1,2 SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/mysql-test/spider/r/direct_join_using.result b/storage/spider/mysql-test/spider/r/direct_join_using.result index 66ae1503f9f..93df7b8cd3f 100644 --- a/storage/spider/mysql-test/spider/r/direct_join_using.result +++ b/storage/spider/mysql-test/spider/r/direct_join_using.result @@ -79,7 +79,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc +select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index d82ed564809..42163e3555c 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -7228,25 +7228,13 @@ int spider_db_mbase_util::append_table( } else if (*current_pos > 0 && !first) { DBUG_PRINT("info",("spider no condition")); - if (top_down) + if (str) { - if (str) + if (str->reserve(SPIDER_SQL_JOIN_LEN)) { - if (str->reserve(SPIDER_SQL_JOIN_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN); - } - } else { - if (str) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); } + str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN); } } diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result index 9b79cc21875..249a27ce274 100644 --- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result +++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result @@ -1115,11 +1115,12 @@ SELECT * FROM t1; a 0 DROP TABLE t1; +############################################################################## # # MDEV-19622 Assertion failures in # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # -CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a); +CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE='TokuDB' PARTITION BY HASH(a); INSERT INTO t1 VALUES (1,1),(2,2); UPDATE t1 SET pk = 0; DROP TABLE t1; @@ -1130,5 +1131,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='TokuDB' PARTITION BY HASH (a) PARTITIONS 3; REPLACE INTO t1 PARTITION (p0) VALUES (3); DROP TABLE t1; -############################################################################## +# +# MDEV-21310 AUTO_INCREMENT column throws range error on INSERT in partitioned table | +# Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed. +# +CREATE TABLE t1 (c INT AUTO_INCREMENT KEY) ENGINE='TokuDB' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +ALTER TABLE t1 TRUNCATE PARTITION p1; +INSERT INTO t1 PARTITION (p1) (c) SELECT 1; +DROP TABLE t1; SET GLOBAL tokudb_prelock_empty = @tokudb_prelock_empty_saved; |