diff options
32 files changed, 252 insertions, 224 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index bcc8ac850c8..c3a8d8b76b8 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 @@ -3589,7 +3589,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)); @@ -3601,7 +3600,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) @@ -3623,7 +3622,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->cset->numcells(charset_info, @@ -3666,7 +3665,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 c1859440446..f1d95509b50 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 @@ -1001,7 +1001,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"); @@ -1010,7 +1009,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 c44bf8446f9..249dc6e073f 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 @@ -1830,12 +1830,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; @@ -1956,8 +1955,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); } } @@ -1967,7 +1965,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) @@ -1979,7 +1977,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 717bc92d0c4..a5c470b0b68 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; @@ -965,9 +962,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; @@ -1010,9 +1005,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_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 b5f7e468d46..297acbcdc43 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 @@ -10127,7 +10127,7 @@ int Field_bit::cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) } -int Field_bit::key_cmp(const uchar *str, uint length) +int Field_bit::key_cmp(const uchar *str, uint) { if (bit_len) { @@ -10136,7 +10136,6 @@ int Field_bit::key_cmp(const uchar *str, uint length) 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 8dc5a508343..1833b4ab682 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2353,7 +2353,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; DBUG_ENTER("ha_partition::del_ren_table"); @@ -2382,7 +2381,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), @@ -2407,7 +2405,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 00ef8e34ead..0b7462913f8 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1409,7 +1409,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/partition_info.cc b/sql/partition_info.cc index cf2536f3969..17a65ad8cd4 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, 2018, 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 @@ -1583,7 +1583,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"); @@ -1595,13 +1594,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; @@ -1635,13 +1629,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 601de324a40..9555c4d7a28 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2267,7 +2267,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); @@ -2292,7 +2291,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 042e86fbd86..e3b461167bb 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 @@ -2525,7 +2525,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"); @@ -2560,7 +2559,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 9414735fa4e..2e581134507 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3635,7 +3635,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; @@ -3651,7 +3651,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 65cb6e83783..5e0df4597f9 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -301,7 +301,6 @@ PageBulk::finish() #endif ulint count = 0; - ulint n_recs = 0; ulint slot_index = 0; rec_t* insert_rec = page_rec_get_next(page_get_infimum_rec(m_page)); page_dir_slot_t* slot = NULL; @@ -309,7 +308,6 @@ PageBulk::finish() /* Set owner & dir. */ while (!page_rec_is_supremum(insert_rec)) { 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 64715851ce1..09aa75f4b41 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1266,7 +1266,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 a8972bab234..619a824d861 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1849,6 +1849,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); fts_optimize_add_table(table); } @@ -2599,8 +2600,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 5492d6e7c4c..480ca99c538 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -9268,16 +9268,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 : @@ -9295,10 +9293,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 57e69926264..c0951ab7e01 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; @@ -190,19 +191,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. @@ -394,26 +413,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++) { @@ -423,7 +445,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 */ snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id); @@ -535,7 +557,7 @@ fill_innodb_trx_from_cache( (longlong) 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); @@ -557,7 +579,7 @@ innodb_trx_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = innodb_trx_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_trx_from_cache; DBUG_RETURN(0); } @@ -672,20 +694,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++) { @@ -698,7 +729,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)); @@ -746,7 +777,7 @@ fill_innodb_locks_from_cache( OK(field_store_string(fields[IDX_LOCK_DATA], row->lock_data)); - OK(schema_table_store_record(thd, table)); + OK(schema_table_store_record(thd, tables->table)); } DBUG_RETURN(0); @@ -768,7 +799,7 @@ innodb_locks_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = innodb_locks_fields_info; - schema->fill_table = trx_i_s_common_fill_table; + schema->fill_table = fill_innodb_locks_from_cache; DBUG_RETURN(0); } @@ -852,12 +883,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]; @@ -865,9 +895,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; - 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_LOCK_WAITS); for (i = 0; i < rows_num; i++) { @@ -879,7 +919,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 */ snprintf(requesting_trx_id, sizeof(requesting_trx_id), @@ -909,7 +949,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); @@ -931,7 +971,7 @@ innodb_lock_waits_init( schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = 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); } @@ -985,105 +1025,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 -} - /* 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 47e30bea6a5..cb2acddb007 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -126,7 +126,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; @@ -234,7 +233,6 @@ public: mtr_commit(&mtr); rtr_clean_rtr_info(&rtr_info, true); - count++; } m_dtuple_vec->clear(); 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; |