Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2022-07-01 14:42:02 +03:00
commit f09687094c
41 changed files with 525 additions and 266 deletions

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2018, Oracle and/or its affiliates. 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 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 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); String separator(256);
MYSQL_ROW cur; MYSQL_ROW cur;
MYSQL_FIELD *field;
bool *num_flag; bool *num_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); 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); mysql_field_seek(result,0);
} }
separator.copy("+",1,charset_info); 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; uint length= column_names ? field->name_length : 0;
if (quick) if (quick)
@ -3633,7 +3632,7 @@ print_table_data(MYSQL_RES *result)
{ {
mysql_field_seek(result,0); mysql_field_seek(result,0);
(void) tee_fputs("|", PAGER); (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 name_length= (uint) strlen(field->name);
size_t numcells= charset_info->numcells(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]; data_length= (uint) lengths[off];
} }
field= mysql_fetch_field(result); MYSQL_FIELD *field= mysql_fetch_field(result);
field_max_length= field->max_length; field_max_length= field->max_length;
/* /*

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2001, 2013, Oracle and/or its affiliates. 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 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 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[(NAME_LEN+9)*3+2];
char prev_alter[MAX_ALTER_STR_SIZE]; char prev_alter[MAX_ALTER_STR_SIZE];
size_t length_of_db= strlen(sock->db); size_t length_of_db= strlen(sock->db);
uint i;
my_bool found_error=0, table_rebuild=0; my_bool found_error=0, table_rebuild=0;
DYNAMIC_ARRAY *array4repair= &tables4repair; DYNAMIC_ARRAY *array4repair= &tables4repair;
DBUG_ENTER("print_result"); DBUG_ENTER("print_result");
@ -1015,7 +1014,7 @@ static void print_result()
prev[0] = '\0'; prev[0] = '\0';
prev_alter[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]); int changed = strcmp(prev, row[0]);
my_bool status = !strcmp(row[2], "status"); my_bool status = !strcmp(row[2], "status");

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2005, 2015, Oracle and/or its affiliates. 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 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 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) pthread_handler_t run_task(void *p)
{ {
ulonglong counter= 0, queries; ulonglong queries;
ulonglong detach_counter; ulonglong detach_counter;
unsigned int commit_counter; unsigned int commit_counter;
MYSQL *mysql; MYSQL *mysql;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row;
statement *ptr; statement *ptr;
thread_context *con= (thread_context *)p; thread_context *con= (thread_context *)p;
@ -1961,8 +1960,7 @@ limit_not_met:
my_progname, mysql_errno(mysql), mysql_error(mysql)); my_progname, mysql_errno(mysql), mysql_error(mysql));
else else
{ {
while ((row= mysql_fetch_row(result))) while (mysql_fetch_row(result)) {}
counter++;
mysql_free_result(result); mysql_free_result(result);
} }
} }
@ -1972,7 +1970,7 @@ limit_not_met:
if (commit_rate && (++commit_counter == commit_rate)) if (commit_rate && (++commit_counter == commit_rate))
{ {
commit_counter= 0; commit_counter= 0;
run_query(mysql, "COMMIT", strlen("COMMIT")); run_query(mysql, C_STRING_WITH_LEN("COMMIT"));
} }
if (con->limit && queries == con->limit) if (con->limit && queries == con->limit)
@ -1984,7 +1982,7 @@ limit_not_met:
end: end:
if (commit_rate) if (commit_rate)
run_query(mysql, "COMMIT", strlen("COMMIT")); run_query(mysql, C_STRING_WITH_LEN("COMMIT"));
mysql_close(mysql); mysql_close(mysql);

View File

@ -7,9 +7,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <my_pthread.h> #include <my_pthread.h>
int main (argc, argv) int main (int argc, char **argv)
int argc;
char *argv[];
{ {
register int result, ix; register int result, ix;
extern int factorial(int); extern int factorial(int);

View File

@ -148,9 +148,7 @@ int main(int argc, char *argv[])
/* reads options */ /* reads options */
/* Initiates DEBUG - but no debugging here ! */ /* Initiates DEBUG - but no debugging here ! */
static int static_get_options(argc,argv) static int static_get_options(int *argc, char***argv)
register int *argc;
register char **argv[];
{ {
int help,version; int help,version;
char *pos; char *pos;
@ -218,10 +216,9 @@ register char **argv[];
} /* static_get_options */ } /* static_get_options */
static int get_replace_strings(argc,argv,from_array,to_array) static int get_replace_strings(int *argc, char ***argv,
register int *argc; POINTER_ARRAY *from_array,
register char **argv[]; POINTER_ARRAY *to_array)
POINTER_ARRAY *from_array,*to_array;
{ {
char *pos; char *pos;
@ -974,9 +971,7 @@ static void free_buffer()
bytes read from disk. bytes read from disk.
*/ */
static int fill_buffer_retaining(fd,n) static int fill_buffer_retaining(File fd, int n)
File fd;
int n;
{ {
int i; int i;
@ -1019,9 +1014,7 @@ int n;
/* Return 0 if convert is ok */ /* Return 0 if convert is ok */
/* Global variable update is set if something was changed */ /* Global variable update is set if something was changed */
static int convert_pipe(rep,in,out) static int convert_pipe(REPLACE *rep, FILE *in, FILE *out)
REPLACE *rep;
FILE *in,*out;
{ {
int retain,error; int retain,error;
uint length; uint length;

@ -1 +1 @@
Subproject commit ab7a81e79e4be4324a2d09d19d4f5249801ef665 Subproject commit d12fd88b6c0fafbf25f59e7fecd639cb2b38f157

View File

@ -37,7 +37,9 @@ SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
--eval KILL $conid --eval KILL $conid
--disconnect con1 --disconnect con1
--connection default --connection default
--disable_warnings
DROP VIEW IF EXISTS vv; DROP VIEW IF EXISTS vv;
--enable_warnings
DROP VIEW v; DROP VIEW v;
DROP FUNCTION f; DROP FUNCTION f;
DROP TABLE t; DROP TABLE t;

View File

@ -127,3 +127,32 @@ UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE; ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Index for table 't2' is corrupt; try to repair it ERROR HY000: Index for table 't2' is corrupt; try to repair it
DROP TABLE t1, t2; 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;

View File

@ -203,3 +203,28 @@ UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE; ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t1, t2; 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;

View File

@ -137,3 +137,16 @@ id title body
1 MySQL Tutorial DBMS stands for Database... 1 MySQL Tutorial DBMS stands for Database...
2 MariaDB Tutorial DB means Database ... 2 MariaDB Tutorial DB means Database ...
DROP TABLE mdev19073, mdev19073_2; 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;

View File

@ -272,3 +272,10 @@ fts_doc_id first_name last_name score
6 Ned Flanders 0 6 Ned Flanders 0
7 Nelson Muntz 0 7 Nelson Muntz 0
DROP TABLE t1; 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;

View File

@ -193,3 +193,18 @@ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
SELECT * FROM mdev19073_2 WHERE MATCH (title, body) SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
AGAINST ('Database' IN NATURAL LANGUAGE MODE); AGAINST ('Database' IN NATURAL LANGUAGE MODE);
DROP TABLE mdev19073, mdev19073_2; 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;

View File

@ -257,3 +257,14 @@ INSERT INTO t1 (id, first_name, last_name) VALUES
analyze table t1; analyze table t1;
SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1; SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
DROP TABLE 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;

View File

@ -860,6 +860,8 @@ SELECT LAST_INSERT_ID();
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
} }
--echo ##############################################################################
}
if (!$skip_update) if (!$skip_update)
{ {
@ -867,13 +869,13 @@ if (!$skip_update)
--echo # MDEV-19622 Assertion failures in --echo # MDEV-19622 Assertion failures in
--echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table --echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
--echo # --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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; DROP TABLE t1;
} }
if (!$skip_update) if (!$skip_delete)
{ {
--echo # --echo #
--echo # MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' --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; 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;
} }

View File

@ -695,3 +695,26 @@ PARTITIONS 2
SELECT * FROM t1 ORDER BY c1; SELECT * FROM t1 ORDER BY c1;
c1 c1
DROP TABLE t1; 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;

View File

@ -1101,11 +1101,12 @@ SELECT * FROM t1;
a a
0 0
DROP TABLE t1; DROP TABLE t1;
##############################################################################
# #
# MDEV-19622 Assertion failures in # MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # 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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; 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; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='InnoDB' PARTITION BY HASH (a) PARTITIONS 3;
REPLACE INTO t1 PARTITION (p0) VALUES (3); REPLACE INTO t1 PARTITION (p0) VALUES (3);
DROP TABLE t1; 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;

View File

@ -1148,11 +1148,12 @@ SELECT * FROM t1;
a a
0 0
DROP TABLE t1; DROP TABLE t1;
##############################################################################
# #
# MDEV-19622 Assertion failures in # MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # 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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; 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; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Aria' PARTITION BY HASH (a) PARTITIONS 3;
REPLACE INTO t1 PARTITION (p0) VALUES (3); REPLACE INTO t1 PARTITION (p0) VALUES (3);
DROP TABLE t1; 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;

View File

@ -1129,11 +1129,12 @@ SELECT * FROM t1;
a a
0 0
DROP TABLE t1; DROP TABLE t1;
##############################################################################
# #
# MDEV-19622 Assertion failures in # MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # 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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; 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; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Memory' PARTITION BY HASH (a) PARTITIONS 3;
REPLACE INTO t1 PARTITION (p0) VALUES (3); REPLACE INTO t1 PARTITION (p0) VALUES (3);
DROP TABLE t1; 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;

View File

@ -1148,11 +1148,12 @@ SELECT * FROM t1;
a a
0 0
DROP TABLE t1; DROP TABLE t1;
##############################################################################
# #
# MDEV-19622 Assertion failures in # MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # 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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; 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; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='MyISAM' PARTITION BY HASH (a) PARTITIONS 3;
REPLACE INTO t1 PARTITION (p0) VALUES (3); REPLACE INTO t1 PARTITION (p0) VALUES (3);
DROP TABLE t1; 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;

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. /* 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 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 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, "\""); fprintf(out, "\"");
while (*ptr) while (*ptr)
{ {
if(column >= MAX_COLUMN) if (column >= MAX_COLUMN)
{ {
/* Wrap to the next line, tabulated. */ /* Wrap to the next line, tabulated. */
fprintf(out, "\"\n \""); fprintf(out, "\"\n \"");

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2017, Oracle and/or its affiliates. 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 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 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) if (bit_len)
{ {
@ -9962,7 +9962,6 @@ int Field_bit::key_cmp(const uchar *str, uint length) const
if ((flag= (int) (bits - *str))) if ((flag= (int) (bits - *str)))
return flag; return flag;
str++; str++;
length--;
} }
return memcmp(ptr, str, bytes_in_rec); return memcmp(ptr, str, bytes_in_rec);
} }

View File

@ -2434,7 +2434,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to)
char *name_buffer_ptr; char *name_buffer_ptr;
const char *from_path; const char *from_path;
const char *to_path= NULL; const char *to_path= NULL;
uint i;
handler **file, **abort_file; handler **file, **abort_file;
THD *thd= ha_thd(); THD *thd= ha_thd();
DBUG_ENTER("ha_partition::del_ren_table"); 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); from_path= get_canonical_filename(*file, from, from_lc_buff);
if (to != NULL) if (to != NULL)
to_path= get_canonical_filename(*file, to, to_lc_buff); to_path= get_canonical_filename(*file, to, to_lc_buff);
i= 0;
do do
{ {
if (unlikely((error= create_partition_name(from_buff, sizeof(from_buff), 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; name_buffer_ptr= strend(name_buffer_ptr) + 1;
if (unlikely(error)) if (unlikely(error))
save_error= error; save_error= error;
i++;
} while (*(++file)); } while (*(++file));
if (to != NULL) if (to != NULL)
{ {

View File

@ -1412,7 +1412,8 @@ private:
unless we already did it. unless we already did it.
*/ */
if (!part_share->auto_inc_initialized && 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) && ha_thd()->lex->sql_command == SQLCOM_REPLACE) &&
table->found_next_number_field) table->found_next_number_field)
bitmap_set_all(&m_part_info->read_partitions); bitmap_set_all(&m_part_info->read_partitions);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2007, 2012, Oracle and/or its affiliates. /* 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 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 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 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) static int mdl_dbug_print_lock(MDL_ticket *mdl_ticket, void *arg, bool granted)
{ {
String *tmp= (String*) arg; String *tmp= (String*) arg;
char buffer[128]; char buffer[256];
MDL_key *mdl_key= mdl_ticket->get_key(); size_t length= my_snprintf(buffer, sizeof(buffer) - 1,
size_t length; "\n %s (%s)", dbug_print_mdl(mdl_ticket),
length= my_snprintf(buffer, sizeof(buffer)-1, granted ? "granted" : "waiting");
"\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");
tmp->append(buffer, length); tmp->append(buffer, length);
return 0; return 0;
} }
const char *mdl_dbug_print_locks() const char *mdl_dbug_print_locks()
{ {
static String tmp; thread_local String tmp;
mdl_iterate(mdl_dbug_print_lock, (void*) &tmp); mdl_iterate(mdl_dbug_print_lock, (void*) &tmp);
return tmp.c_ptr(); return tmp.c_ptr();
} }
@ -2269,13 +2276,19 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
MDL_ticket *ticket; MDL_ticket *ticket;
MDL_wait::enum_wait_status wait_status; MDL_wait::enum_wait_status wait_status;
DBUG_ENTER("MDL_context::acquire_lock"); 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", DBUG_PRINT("enter", ("lock_type: %s timeout: %f",
get_mdl_lock_name(mdl_request->key.mdl_namespace(), mdl_lock_name,
mdl_request->type)->str,
lock_wait_timeout)); lock_wait_timeout));
if (try_acquire_lock_impl(mdl_request, &ticket)) if (try_acquire_lock_impl(mdl_request, &ticket))
{
DBUG_PRINT("mdl", ("OOM: %s", mdl_lock_name));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
}
if (mdl_request->ticket) 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. accordingly, so we can simply return success.
*/ */
DBUG_PRINT("info", ("Got lock without waiting")); DBUG_PRINT("info", ("Got lock without waiting"));
DBUG_PRINT("mdl", ("Seized: %s", dbug_print_mdl(mdl_request->ticket)));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
#ifndef DBUG_OFF
const char *ticket_msg= dbug_print_mdl(ticket);
#endif
/* /*
Our attempt to acquire lock without waiting has failed. Our attempt to acquire lock without waiting has failed.
As a result of this attempt we got MDL_ticket with m_lock 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) if (lock_wait_timeout == 0)
{ {
DBUG_PRINT("mdl", ("Nowait: %s", ticket_msg));
mysql_prlock_unlock(&lock->m_rwlock); mysql_prlock_unlock(&lock->m_rwlock);
MDL_ticket::destroy(ticket); MDL_ticket::destroy(ticket);
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); 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__); locker= PSI_CALL_start_metadata_wait(&state, ticket->m_psi, __FILE__, __LINE__);
#endif #endif
DBUG_PRINT("mdl", ("Waiting: %s", ticket_msg));
will_wait_for(ticket); will_wait_for(ticket);
/* There is a shared or exclusive lock on the object. */ /* 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) switch (wait_status)
{ {
case MDL_wait::VICTIM: case MDL_wait::VICTIM:
DBUG_LOCK_FILE; DBUG_PRINT("mdl", ("Deadlock: %s", ticket_msg));
DBUG_PRINT("mdl_locks", ("%s", mdl_dbug_print_locks())); DBUG_PRINT("mdl_locks", ("Existing locks:%s", mdl_dbug_print_locks()));
DBUG_UNLOCK_FILE;
my_error(ER_LOCK_DEADLOCK, MYF(0)); my_error(ER_LOCK_DEADLOCK, MYF(0));
break; break;
case MDL_wait::TIMEOUT: case MDL_wait::TIMEOUT:
DBUG_PRINT("mdl", ("Timeout: %s", ticket_msg));
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
break; break;
case MDL_wait::KILLED: case MDL_wait::KILLED:
DBUG_PRINT("mdl", ("Killed: %s", ticket_msg));
get_thd()->send_kill_message(); get_thd()->send_kill_message();
break; break;
default: 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); mysql_mdl_set_status(ticket->m_psi, MDL_ticket::GRANTED);
DBUG_PRINT("mdl", ("Acquired: %s", ticket_msg));
DBUG_RETURN(FALSE); 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())); lock->key.db_name(), lock->key.name()));
DBUG_ASSERT(this == ticket->get_ctx()); 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); lock->remove_ticket(m_pins, &MDL_lock::m_granted, ticket);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. /* 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 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 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; uchar **char_ptrs;
unsigned i; unsigned i;
size_t size; size_t size;
uint tot_fields= 0;
uint tot_part_fields= 0; uint tot_part_fields= 0;
uint tot_subpart_fields= 0; uint tot_subpart_fields= 0;
DBUG_ENTER("set_up_charset_field_preps"); 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; ptr= part_field_array;
/* Set up arrays and buffers for those fields */ /* Set up arrays and buffers for those fields */
while ((field= *(ptr++))) while ((field= *(ptr++)))
{
if (field_is_partition_charset(field)) if (field_is_partition_charset(field))
{
tot_part_fields++; tot_part_fields++;
tot_fields++;
}
}
size= tot_part_fields * sizeof(char*); size= tot_part_fields * sizeof(char*);
if (!(char_ptrs= (uchar**)thd->calloc(size))) if (!(char_ptrs= (uchar**)thd->calloc(size)))
goto error; goto error;
@ -1575,13 +1569,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd)
/* Set up arrays and buffers for those fields */ /* Set up arrays and buffers for those fields */
ptr= subpart_field_array; ptr= subpart_field_array;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{
if (field_is_partition_charset(field)) if (field_is_partition_charset(field))
{
tot_subpart_fields++; tot_subpart_fields++;
tot_fields++;
}
}
size= tot_subpart_fields * sizeof(char*); size= tot_subpart_fields * sizeof(char*);
if (!(char_ptrs= (uchar**) thd->calloc(size))) if (!(char_ptrs= (uchar**) thd->calloc(size)))
goto error; goto error;

View File

@ -2804,7 +2804,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
uchar quote_char) uchar quote_char)
{ {
CHARSET_INFO *const cs= thd->charset(); CHARSET_INFO *const cs= thd->charset();
uint double_quotes= 0;
uchar c; uchar c;
DBUG_ASSERT(m_ptr == m_tok_start + 1); 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) if (yyPeek() != quote_char)
break; break;
c= yyGet(); c= yyGet();
double_quotes++;
continue; continue;
} }
} }

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2009 MySQL AB /* 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 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 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; int rc= 0;
KEY *key_info= &table->key_info[index]; KEY *key_info= &table->key_info[index];
ha_rows rows= 0;
DBUG_ENTER("collect_statistics_for_index"); DBUG_ENTER("collect_statistics_for_index");
@ -2551,7 +2550,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
if (rc) if (rc)
break; break;
rows++;
index_prefix_calc.add(); index_prefix_calc.add();
rc= table->file->ha_index_next(table->record[0]); rc= table->file->ha_index_next(table->record[0]);
} }

View File

@ -2235,7 +2235,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
char path[FN_REFLEN + 1]; char path[FN_REFLEN + 1];
LEX_CSTRING alias= null_clex_str; LEX_CSTRING alias= null_clex_str;
StringBuffer<160> unknown_tables(system_charset_info); StringBuffer<160> unknown_tables(system_charset_info);
uint not_found_errors= 0;
int error= 0; int error= 0;
int non_temp_tables_count= 0; int non_temp_tables_count= 0;
bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 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(&table_name);
unknown_tables.append(','); unknown_tables.append(',');
error= ENOENT; error= ENOENT;
not_found_errors++;
continue; 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(&table_name);
unknown_tables.append(','); unknown_tables.append(',');
error= ENOENT; error= ENOENT;
not_found_errors++;
continue; continue;
} }
@ -2635,7 +2632,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
} }
else else
{ {
not_found_errors++;
if (unknown_tables.append(tbl_name) || unknown_tables.append(',')) if (unknown_tables.append(tbl_name) || unknown_tables.append(','))
{ {
error= 1; 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_iterator(alter_info->key_list);
List_iterator<Key> key_iterator2(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; bool primary_key=0,unique_key=0;
Key *key, *key2; Key *key, *key2;
uint tmp, key_number; uint tmp, key_number;
@ -3807,7 +3803,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
"(none)" , key->type)); "(none)" , key->type));
if (key->type == Key::FOREIGN_KEY) if (key->type == Key::FOREIGN_KEY)
{ {
fk_key_count++;
Foreign_key *fk_key= (Foreign_key*) key; Foreign_key *fk_key= (Foreign_key*) key;
if (fk_key->validate(alter_info->create_list)) if (fk_key->validate(alter_info->create_list))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);

View File

@ -362,7 +362,6 @@ inline void PageBulk::finishPage()
ut_ad((fmt != REDUNDANT) == m_is_comp); ut_ad((fmt != REDUNDANT) == m_is_comp);
ulint count= 0; ulint count= 0;
ulint n_recs= 0;
byte *slot= my_assume_aligned<2>(m_page + srv_page_size - byte *slot= my_assume_aligned<2>(m_page + srv_page_size -
(PAGE_DIR + PAGE_DIR_SLOT_SIZE)); (PAGE_DIR + PAGE_DIR_SLOT_SIZE));
const page_dir_slot_t *const slot0 = slot; 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_NEW_SUPREMUM);
ut_ad(offset < page_offset(slot)); ut_ad(offset < page_offset(slot));
count++; count++;
n_recs++;
if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) 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) while (insert_rec != m_page + PAGE_OLD_SUPREMUM)
{ {
count++; count++;
n_recs++;
if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2)
{ {

View File

@ -1004,7 +1004,10 @@ void buf_page_print(const byte *read_buf, ulint zip_size)
byte row[64]; byte row[64];
for (byte *r= row; r != &row[64]; r+= 2, read_buf++) 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); sql_print_information("InnoDB: %.*s", 64, row);
} }

View File

@ -1844,6 +1844,7 @@ dict_load_columns(
if (table->fts == NULL) { if (table->fts == NULL) {
table->fts = fts_create(table); table->fts = fts_create(table);
table->fts->cache = fts_cache_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); ut_a(table->fts->doc_col == ULINT_UNDEFINED);
@ -2593,8 +2594,11 @@ next_rec:
ut_ad(table->fts_doc_id_index == NULL); ut_ad(table->fts_doc_id_index == NULL);
if (table->fts != 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); 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 */ /* If the table contains FTS indexes, populate table->fts->indexes */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved. 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 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 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 If that is the case, the instant ALTER TABLE would keep
the InnoDB table in its current format. */ 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; dict_index_t& index = *indexes.start;
first_alter_pos = 0; first_alter_pos = 0;
@ -373,6 +373,15 @@ found_j:
goto found_nullable; 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 /* The n_core_null_bytes only matters for
ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */ ROW_FORMAT=COMPACT and ROW_FORMAT=DYNAMIC tables. */
ut_ad(UT_BITS_IN_BYTES(core_null) == oindex.n_core_null_bytes 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) const char* table_name)
{ {
uint i = 0; uint i = 0;
ulint num_v = 0;
DBUG_ASSERT(ctx->need_rebuild()); DBUG_ASSERT(ctx->need_rebuild());
DBUG_ASSERT(ha_alter_info->handler_flags DBUG_ASSERT(ha_alter_info->handler_flags
& ALTER_COLUMN_NAME); & ALTER_COLUMN_NAME);
for (Field** fp = table->field; *fp; fp++, i++) { for (Field** fp = table->field; *fp; fp++, i++) {
const bool is_virtual = !(*fp)->stored_in_db();
if (!((*fp)->flags & FIELD_IS_RENAMED)) { if (!((*fp)->flags & FIELD_IS_RENAMED)) {
goto processed_field; continue;
} }
for (const Create_field& cf : for (const Create_field& cf :
@ -9235,10 +9242,6 @@ innobase_rename_columns_try(
ut_error; ut_error;
processed_field: processed_field:
if (is_virtual) {
num_v++;
}
continue; continue;
} }

View File

@ -59,6 +59,7 @@ Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits)
#include "fil0crypt.h" #include "fil0crypt.h"
#include "dict0crea.h" #include "dict0crea.h"
#include "fts0vlc.h" #include "fts0vlc.h"
#include "log.h"
/** The latest successfully looked up innodb_fts_aux_table */ /** The latest successfully looked up innodb_fts_aux_table */
UNIV_INTERN table_id_t innodb_ft_aux_table_id; 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 */ TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ); /*!< in: condition (not used) */ Item* ); /*!< in: condition (not used) */
/*******************************************************************//** /**
Common function to fill any of the dynamic tables: Common function to fill any of the dynamic tables:
INFORMATION_SCHEMA.innodb_trx INFORMATION_SCHEMA.innodb_trx
INFORMATION_SCHEMA.innodb_locks INFORMATION_SCHEMA.innodb_locks
INFORMATION_SCHEMA.innodb_lock_waits INFORMATION_SCHEMA.innodb_lock_waits
@return 0 on success */ @retval false if access to the table is blocked
static @retval true if something should be filled in */
int static bool trx_i_s_common_fill_table(THD *thd, TABLE_LIST *tables)
trx_i_s_common_fill_table( {
/*======================*/ DBUG_ENTER("trx_i_s_common_fill_table");
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */ /* deny access to non-superusers */
Item* ); /*!< in: condition (not used) */ 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. 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 Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
table with it. table with it.
@return 0 on success */ @retval 0 on success
static @retval 1 on failure */
int static int fill_innodb_trx_from_cache(THD *thd, TABLE_LIST *tables, Item*)
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 */
{ {
Field** fields;
ulint rows_num; ulint rows_num;
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
ulint i; ulint i;
DBUG_ENTER("fill_innodb_trx_from_cache"); 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); I_S_INNODB_TRX);
for (i = 0; i < rows_num; i++) { for (i = 0; i < rows_num; i++) {
@ -388,7 +410,7 @@ fill_innodb_trx_from_cache(
row = (i_s_trx_row_t*) row = (i_s_trx_row_t*)
trx_i_s_cache_get_nth_row( trx_i_s_cache_get_nth_row(
cache, I_S_INNODB_TRX, i); trx_i_s_cache, I_S_INNODB_TRX, i);
/* trx_id */ /* trx_id */
OK(fields[IDX_TRX_ID]->store(row->trx_id, true)); 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( OK(fields[IDX_TRX_AUTOCOMMIT_NON_LOCKING]->store(
row->trx_is_autocommit_non_locking, true)); 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); DBUG_RETURN(0);
@ -519,7 +541,7 @@ innodb_trx_init(
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = Show::innodb_trx_fields_info; 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); DBUG_RETURN(0);
} }
@ -646,20 +668,29 @@ static
int int
fill_innodb_locks_from_cache( fill_innodb_locks_from_cache(
/*=========================*/ /*=========================*/
trx_i_s_cache_t* cache, /*!< in: cache to read from */
THD* thd, /*!< in: MySQL client connection */ 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; ulint rows_num;
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
ulint i; ulint i;
DBUG_ENTER("fill_innodb_locks_from_cache"); DBUG_ENTER("fill_innodb_locks_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_LOCKS); I_S_INNODB_LOCKS);
for (i = 0; i < rows_num; i++) { for (i = 0; i < rows_num; i++) {
@ -670,7 +701,7 @@ fill_innodb_locks_from_cache(
row = (i_s_locks_row_t*) row = (i_s_locks_row_t*)
trx_i_s_cache_get_nth_row( trx_i_s_cache_get_nth_row(
cache, I_S_INNODB_LOCKS, i); trx_i_s_cache, I_S_INNODB_LOCKS, i);
/* lock_id */ /* lock_id */
trx_i_s_create_lock_id(row, lock_id, sizeof(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(); fields[IDX_LOCK_DATA]->set_null();
} }
OK(schema_table_store_record(thd, table)); OK(schema_table_store_record(thd, tables->table));
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@ -739,7 +770,7 @@ innodb_locks_init(
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = Show::innodb_locks_fields_info; 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); DBUG_RETURN(0);
} }
@ -821,12 +852,11 @@ static
int int
fill_innodb_lock_waits_from_cache( fill_innodb_lock_waits_from_cache(
/*==============================*/ /*==============================*/
trx_i_s_cache_t* cache, /*!< in: cache to read from */
THD* thd, /*!< in: used to call THD* thd, /*!< in: used to call
schema_table_store_record() */ 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; ulint rows_num;
char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1]; char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
char blocking_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"); DBUG_ENTER("fill_innodb_lock_waits_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_LOCK_WAITS); I_S_INNODB_LOCK_WAITS);
for (i = 0; i < rows_num; i++) { for (i = 0; i < rows_num; i++) {
@ -845,7 +885,7 @@ fill_innodb_lock_waits_from_cache(
row = (i_s_lock_waits_row_t*) row = (i_s_lock_waits_row_t*)
trx_i_s_cache_get_nth_row( 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 */ /* requesting_trx_id */
OK(fields[IDX_REQUESTING_TRX_ID]->store( OK(fields[IDX_REQUESTING_TRX_ID]->store(
@ -871,7 +911,7 @@ fill_innodb_lock_waits_from_cache(
blocking_lock_id, blocking_lock_id,
sizeof(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); DBUG_RETURN(0);
@ -893,7 +933,7 @@ innodb_lock_waits_init(
schema = (ST_SCHEMA_TABLE*) p; schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = Show::innodb_lock_waits_fields_info; 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); DBUG_RETURN(0);
} }
@ -947,105 +987,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits =
MariaDB_PLUGIN_MATURITY_STABLE, 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 { namespace Show {
/* Fields of the dynamic table information_schema.innodb_cmp. */ /* Fields of the dynamic table information_schema.innodb_cmp. */
static ST_FIELD_INFO i_s_cmp_fields_info[] = static ST_FIELD_INFO i_s_cmp_fields_info[] =

View File

@ -120,7 +120,6 @@ public:
rec_offs* ins_offsets = NULL; rec_offs* ins_offsets = NULL;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
dtuple_t* dtuple; dtuple_t* dtuple;
ulint count = 0;
const ulint flag = BTR_NO_UNDO_LOG_FLAG const ulint flag = BTR_NO_UNDO_LOG_FLAG
| BTR_NO_LOCKING_FLAG | BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG; | BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG;
@ -228,7 +227,6 @@ public:
mtr_commit(&mtr); mtr_commit(&mtr);
rtr_clean_rtr_info(&rtr_info, true); rtr_clean_rtr_info(&rtr_info, true);
count++;
} }
m_dtuple_vec->clear(); m_dtuple_vec->clear();

View File

@ -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

View File

@ -0,0 +1,3 @@
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf

View File

@ -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

View File

@ -76,7 +76,7 @@ a b c
connection child2_1; connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument 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 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; 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') a b date_format(c, '%Y-%m-%d %H:%i:%s')

View File

@ -79,7 +79,7 @@ a b c
connection child2_1; connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument 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 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; 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') a b date_format(c, '%Y-%m-%d %H:%i:%s')

View File

@ -7228,25 +7228,13 @@ int spider_db_mbase_util::append_table(
} else if (*current_pos > 0 && !first) } else if (*current_pos > 0 && !first)
{ {
DBUG_PRINT("info",("spider no condition")); 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);
{
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);
} }
str->q_append(SPIDER_SQL_JOIN_STR, SPIDER_SQL_JOIN_LEN);
} }
} }

View File

@ -1115,11 +1115,12 @@ SELECT * FROM t1;
a a
0 0
DROP TABLE t1; DROP TABLE t1;
##############################################################################
# #
# MDEV-19622 Assertion failures in # MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table # 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); INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0; UPDATE t1 SET pk = 0;
DROP TABLE t1; 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; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='TokuDB' PARTITION BY HASH (a) PARTITIONS 3;
REPLACE INTO t1 PARTITION (p0) VALUES (3); REPLACE INTO t1 PARTITION (p0) VALUES (3);
DROP TABLE t1; 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; SET GLOBAL tokudb_prelock_empty = @tokudb_prelock_empty_saved;