From ace2e0301e5d0f8c5acf02e671b6a1f3dd7fb374 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Thu, 9 Jun 2022 10:43:44 +0300 Subject: [PATCH 01/32] MDEV-28666: Add correct 'Breaks' to make sure upgrade from 10.2 succeeds File '/usr/bin/mariadb_config' has been moved from Debian package libmariadbd-dev to libmariadb-dev since MariaDB version 10.2 this leads to situation where upgrade will no succeed but fail with this kind of error message * trying to overwrite '/usr/bin/mariadb_config', which is also in package libmariadbd-dev 1:10.2.44+maria~bionic Add libmariadbd-dev to libmariadb-dev Debian control files 'Breaks' solve situation and upgrading won't error anymore --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index dece7de2bd3..aed073e5c8c 100644 --- a/debian/control +++ b/debian/control @@ -179,7 +179,8 @@ Depends: libmariadb-dev (= ${binary:Version}), libmariadbd19 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} -Breaks: libmysqld-dev +Breaks: libmysqld-dev, + libmariadbd-dev (<= 10.2) Replaces: libmysqld-dev Description: MariaDB embedded database, development files MariaDB is a fast, stable and true multi-user, multi-threaded SQL database From b59bc629c8cef1e3e07529007dca2948b812e8fb Mon Sep 17 00:00:00 2001 From: Mathew Heard Date: Tue, 8 Feb 2022 08:57:24 +1100 Subject: [PATCH 02/32] MDEV-27766: connect engine; INSERT ignore option, was ignored Test prior to this change: CURRENT_TEST: connect.mysql mysqltest: At line 485: query 'INSERT IGNORE INTO t3 VALUES (5),(10),(30)' failed: ER_GET_ERRMSG (1296): Got error 122 '(1062) Duplicate entry '10' for key 'PRIMARY' [INSERT INTO `t1` (`a`) VALUES (10)]' from CONNECT So the ignore table option wasn't getting passed to the remove server. Closes #2008 --- .../connect/mysql-test/connect/r/mysql.result | 12 ++++++++++++ storage/connect/mysql-test/connect/t/mysql.test | 16 ++++++++++++++++ storage/connect/tabmysql.cpp | 16 ++++++++++++---- storage/connect/tabmysql.h | 2 ++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 3ac23394cbc..4377d2ad014 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -294,3 +294,15 @@ a 30 DROP TABLE t2; DROP TABLE t1; +# +# MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type +# +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (10),(20),(30); +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1"; +INSERT INTO t2 VALUES (10),(20),(30),(40); +DROP TABLE t2; +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test index 7585c202b8b..451de29c0b0 100644 --- a/storage/connect/mysql-test/connect/t/mysql.test +++ b/storage/connect/mysql-test/connect/t/mysql.test @@ -470,3 +470,19 @@ SELECT * FROM t2; DROP TABLE t2; DROP TABLE t1; + +--echo # +--echo # MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (10),(20),(30); +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1" +INSERT INTO t2 VALUES (10),(20),(30),(40); +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 0d7cb6d50c4..975dc35d419 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -94,6 +94,7 @@ MYSQLDEF::MYSQLDEF(void) Isview = false; Bind = false; Delayed = false; + Ignored = false; //Xsrc = false; Huge = false; } // end of MYSQLDEF constructor @@ -321,6 +322,9 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) Desc = "MySQL Table"; + Delayed = !!GetIntCatInfo("Delayed", 0); + Ignored = !!GetIntCatInfo("Ignored", 0); + if (stricmp(am, "MYPRX")) { // Normal case of specific MYSQL table url = GetStringCatInfo(g, "Connect", NULL); @@ -339,7 +343,6 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) return true; Bind = !!GetIntCatInfo("Bind", 0); - Delayed = !!GetIntCatInfo("Delayed", 0); } else { // MYSQL access from a PROXY table TABLE_SHARE* s; @@ -425,6 +428,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp) Isview = tdp->Isview; Prep = tdp->Bind; Delayed = tdp->Delayed; + Ignored = tdp->Ignored; Myc.m_Use = tdp->Huge; } else { Host = NULL; @@ -440,6 +444,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp) Isview = false; Prep = false; Delayed = false; + Ignored = false; } // endif tdp Bind = NULL; @@ -466,6 +471,7 @@ TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBEXT(tdbp) Isview = tdbp->Isview; Prep = tdbp->Prep; Delayed = tdbp->Delayed; + Ignored = tdbp->Ignored; Bind = NULL; //Query = tdbp->Query; Fetched = tdbp->Fetched; @@ -623,11 +629,13 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g) len += (strlen(TableName) + 40); Query = new(g) STRING(g, len); + Query->Set("INSERT "); if (Delayed) - Query->Set("INSERT DELAYED INTO "); - else - Query->Set("INSERT INTO "); + Query->Append("DELAYED "); + if (Ignored) + Query->Append("IGNORE "); + Query->Append("INTO "); Query->Append(tk); Query->Append(TableName); Query->Append("` ("); diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index 4b61c7eb762..b5af77de50b 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -60,6 +60,7 @@ class MYSQLDEF : public EXTDEF {/* Logical table description */ bool Isview; /* true if this table is a MySQL view */ bool Bind; /* Use prepared statement on insert */ bool Delayed; /* Delayed insert */ + bool Ignored; /* Use insert IGNORE */ //bool Xsrc; /* Execution type */ bool Huge; /* True for big table */ }; // end of MYSQLDEF @@ -132,6 +133,7 @@ class TDBMYSQL : public TDBEXT { bool Isview; // True if this table is a MySQL view bool Prep; // Use prepared statement on insert bool Delayed; // Use delayed insert + bool Ignored; // Use insert IGNORE int m_Rc; // Return code from command //int AftRows; // The number of affected rows int N; // The current table index From e077ce2a68a418d0f4cbe32f9311cf235ee1578c Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Fri, 29 Oct 2021 19:04:53 +0900 Subject: [PATCH 03/32] MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION During rebuild of partition, the partitioning engine calls alter_close_table(), which does not unlock and close some table instances of the target table. Then, the engine fails to rename partitions because there are table instances that are still locked. Closing all the table instance of the target table fixes the bug. --- .../suite/parts/inc/part_alter_values.inc | 8 +++++ .../parts/r/partition_alter_innodb.result | 7 +++++ .../parts/r/partition_alter_maria.result | 7 +++++ .../parts/r/partition_alter_myisam.result | 7 +++++ sql/sql_partition.cc | 29 ++++++++++++++----- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/parts/inc/part_alter_values.inc b/mysql-test/suite/parts/inc/part_alter_values.inc index ca18faa5758..d3b63a4610f 100644 --- a/mysql-test/suite/parts/inc/part_alter_values.inc +++ b/mysql-test/suite/parts/inc/part_alter_values.inc @@ -78,3 +78,11 @@ if (`SELECT IF('$engine' != 'InnoDB', 1, 0)`) --remove_files_wildcard $MYSQLTEST_VARDIR/tmp/mdev_27065 * --rmdir $MYSQLTEST_VARDIR/tmp/mdev_27065 + +--echo # +--echo # MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +--echo # +--eval CREATE TABLE t1 (c INT) ENGINE=$engine PARTITION BY KEY(c) PARTITIONS 4; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_innodb.result b/mysql-test/suite/parts/r/partition_alter_innodb.result index ae3caaa4981..6afa133f989 100644 --- a/mysql-test/suite/parts/r/partition_alter_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter_innodb.result @@ -61,3 +61,10 @@ PARTITION p1 VALUES LESS THAN MAXVALUE Warnings: Warning 1618 table option of old schema is ignored DROP TABLE t1; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result index 358ffbdfbe7..eca8378430f 100644 --- a/mysql-test/suite/parts/r/partition_alter_maria.result +++ b/mysql-test/suite/parts/r/partition_alter_maria.result @@ -95,3 +95,10 @@ PARTITION p1 VALUES LESS THAN MAXVALUE Warnings: Warning 1618 table option of old schema is ignored DROP TABLE t2; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=Aria PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result index 9d76881fdfa..ba1a0fe05c4 100644 --- a/mysql-test/suite/parts/r/partition_alter_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -68,6 +68,13 @@ PARTITION p1 VALUES LESS THAN MAXVALUE Warnings: Warning 1618 table option of old schema is ignored DROP TABLE t2; +# +# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION +# +CREATE TABLE t1 (c INT) ENGINE=MyISAM PARTITION BY KEY(c) PARTITIONS 4;; +LOCK TABLES t1 WRITE, t1 AS a READ; +ALTER TABLE t1 REBUILD PARTITION p0; +DROP TABLE t1; create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 partition by key(c1) ( partition p01 data directory = 'MYSQL_TMP_DIR' diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 778a3177360..4a0a55f8178 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2005, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2009, 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 @@ -6929,14 +6929,29 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt) { + THD *thd= lpt->thd; + TABLE_SHARE *share= lpt->table->s; DBUG_ENTER("alter_close_table"); - if (lpt->table->db_stat) - { - mysql_lock_remove(lpt->thd, lpt->thd->lock, lpt->table); - lpt->table->file->ha_close(); - lpt->table->db_stat= 0; // Mark file closed - } + TABLE *table= thd->open_tables; + do { + table= find_locked_table(table, share->db.str, share->table_name.str); + if (!table) + { + DBUG_RETURN(0); + } + + if (table->db_stat) + { + mysql_lock_remove(thd, thd->lock, table); + if (int error= table->file->ha_close()) + { + DBUG_RETURN(error); + } + table->db_stat= 0; // Mark file closed + } + } while ((table= table->next)); + DBUG_RETURN(0); } From c168e16782fc449f61412e5afc1c01d59b77c675 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Mon, 23 May 2022 10:39:31 +0300 Subject: [PATCH 04/32] MDEV-28628: Change current Debian package revision scheme Current Debian package revision scheme when using debian/autobake-deb.sh script is: '1:VERSION+maria~LSBNAME' For example if VERSION can be like 10.6.8 and LSBNAME is buster then version and revision is: '1:10.6.8+maria~buster' Which can lead to problem as distro code names can be lexical unordered. For example Debian LSBNAME's can be: Codename Buster is Debian version 10 Codename Bookworm is Debian version 11 This happens because in ASCII table Buster first two digits are 'Bu' and they are in hex 0x42 and 0x75 and Bookworm first digits 'Bo' are they are in hex 0x42 and 0x6F When apt is upgrading it means that: 1:10.6.8+maria~buster is bigger than 1:10.6.8+maria~bookworm and that leads to problems in dist-upgrade process To solve problem revision format is changed to: '1:VERSION+maria~(deb|ubu)LSBVERSION' Example for Debian 11 is now: 1:10.6.8+maria~deb11 and for Ubuntu 22.04 is now: 1:10.6.8+maria~ubu2204 There are new Variables * VERSION which contains whole version string * LSBVERSION which contains LSB version of distro * LSBID which contains LSB ID (Debian or Ubuntu) added to debian/autobake-deb.sh. Also CODENAME is change to LSBNAME as it's more declaritive --- debian/autobake-deb.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index c0026a1b2dd..1714c1a5868 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -17,8 +17,15 @@ export DEB_BUILD_OPTIONS="nocheck" # Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh # tests for backwards compatibility and strip away parts on older builders. -CODENAME="$(lsb_release -sc)" -case "${CODENAME}" in +LSBID="$(lsb_release -si | tr '[:upper:]' '[:lower:]')" +LSBVERSION="$(lsb_release -sr | sed -e "s#\.##g")" +LSBNAME="$(lsb_release -sc)" + +if [ -z "${LSBID}" ] +then + LSBID="unknown" +fi +case "${LSBNAME}" in stretch) # MDEV-28022 libzstd-dev-1.1.3 minimum version sed -i -e '/libzstd-dev/d' debian/control @@ -55,10 +62,11 @@ UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${ PATCHLEVEL="+maria" LOGSTRING="MariaDB build" EPOCH="1:" +VERSION="${EPOCH}${UPSTREAM}${PATCHLEVEL}~${LSBID:0:3}${LSBVERSION}" -dch -b -D ${CODENAME} -v "${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}." +dch -b -D ${LSBNAME} -v "${VERSION}" "Automatic build with ${LOGSTRING}." -echo "Creating package version ${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... " +echo "Creating package version ${VERSION} ... " # Build the package # Pass -I so that .git and other unnecessary temporary and source control files From 124326d8108623e36f8e0a4a7c15774beed18015 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 8 Jun 2022 15:36:28 +0200 Subject: [PATCH 05/32] MDEV-28656: Inability to roll upgrade without stopping the Galera cluster --- scripts/wsrep_sst_backup.sh | 3 +- scripts/wsrep_sst_common.sh | 13 +- scripts/wsrep_sst_mariabackup.sh | 221 +++++++++++++++++++++---------- scripts/wsrep_sst_rsync.sh | 56 ++++---- sql/wsrep_sst.cc | 10 +- sql/wsrep_sst.h | 1 + 6 files changed, 196 insertions(+), 108 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index 301739905b6..4f98ad41dd5 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -72,7 +72,7 @@ then # (c) ERROR file, in case flush tables operation failed. while [ ! -r "$FLUSHED" ] && \ - ! grep -q -F ':' -- "$FLUSHED" >/dev/null 2>&1 + ! grep -q -F ':' -- "$FLUSHED" do # Check whether ERROR file exists. if [ -f "$ERROR" ]; then @@ -105,4 +105,5 @@ else # joiner fi +wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE" exit 0 diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 3d0a132f3fc..35021ace8b6 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -80,6 +80,7 @@ to_minuses() } WSREP_SST_OPT_BYPASS=0 +WSREP_SST_OPT_PROGRESS=0 WSREP_SST_OPT_BINLOG="" WSREP_SST_OPT_BINLOG_INDEX="" WSREP_SST_OPT_LOG_BASENAME="" @@ -187,6 +188,10 @@ case "$1" in '--bypass') readonly WSREP_SST_OPT_BYPASS=1 ;; + '--progress') + readonly WSREP_SST_OPT_PROGRESS=$(( $2 )) + shift + ;; '--datadir') # Let's remove the trailing slash: readonly WSREP_SST_OPT_DATA=$(trim_dir "$2") @@ -246,11 +251,11 @@ case "$1" in shift ;; '--local-port') - readonly WSREP_SST_OPT_LPORT="$2" + readonly WSREP_SST_OPT_LPORT=$(( $2 )) shift ;; '--parent') - readonly WSREP_SST_OPT_PARENT="$2" + readonly WSREP_SST_OPT_PARENT=$(( $2 )) shift ;; '--password') @@ -258,7 +263,7 @@ case "$1" in shift ;; '--port') - readonly WSREP_SST_OPT_PORT="$2" + readonly WSREP_SST_OPT_PORT=$(( $2 )) shift ;; '--role') @@ -531,6 +536,8 @@ else readonly WSREP_SST_OPT_ROLE='donor' fi +readonly WSREP_SST_OPT_PROGRESS + # The same argument can be present on the command line several # times, in this case we must take its last value: if [ -n "${MYSQLD_OPT_INNODB_DATA_HOME_DIR:-}" -a \ diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index a66a792b5ea..8e025f94a3e 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -86,15 +86,12 @@ encrypt_threads="" encrypt_chunk="" readonly SECRET_TAG='secret' +readonly TOTAL_TAG='total' # Required for backup locks # For backup locks it is 1 sent by joiner sst_ver=1 -if [ -n "$(commandex pv)" ] && pv --help | grep -qw -F -- '-F'; then - pvopts="$pvopts $pvformat" -fi -pcmd="pv $pvopts" declare -a RC BACKUP_BIN=$(commandex 'mariabackup') @@ -121,18 +118,19 @@ timeit() if [ $ttime -eq 1 ]; then x1=$(date +%s) - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? + fi + + wsrep_log_info "Evaluating $cmd" + eval $cmd + extcode=$? + + if [ $ttime -eq 1 ]; then x2=$(date +%s) took=$(( x2-x1 )) wsrep_log_info "NOTE: $stage took $took seconds" totime=$(( totime+took )) - else - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? fi + return $extcode } @@ -419,44 +417,90 @@ get_transfer() get_footprint() { cd "$DATA_DIR" - payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ - -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ - awk 'END { print $1 }') + local payload_data=$(find . \ + -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ + -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ + awk 'END { print $1 }') + + local payload_undo=0 + if [ -n "$ib_undo_dir" -a -d "$ib_undo_dir" ]; then + cd "$ib_undo_dir" + payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ + du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') + fi + cd "$OLD_PWD" + + wsrep_log_info \ + "SST footprint estimate: data: $payload_data, undo: $payload_undo" + + payload=$(( payload_data + payload_undo )) + if [ "$compress" != 'none' ]; then # QuickLZ has around 50% compression ratio # When compression/compaction used, the progress is only an approximate. payload=$(( payload*1/2 )) fi - cd "$OLD_PWD" - pcmd="$pcmd -s $payload" + + if [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then + # report to parent the total footprint of the SST + echo "$TOTAL_TAG $payload" + fi + adjust_progress } adjust_progress() { - if [ -z "$(commandex pv)" ]; then - wsrep_log_error "pv not found in path: $PATH" - wsrep_log_error "Disabling all progress/rate-limiting" - pcmd="" - rlimit="" - progress="" - return - fi + pcmd="" + rcmd="" - if [ -n "$progress" -a "$progress" != '1' ]; then - if [ -e "$progress" ]; then - pcmd="$pcmd 2>>'$progress'" - else - pcmd="$pcmd 2>'$progress'" - fi - elif [ -z "$progress" -a -n "$rlimit" ]; then - # When rlimit is non-zero - pcmd='pv -q' - fi + [ "$progress" = 'none' ] && return + rlimitopts="" if [ -n "$rlimit" -a "$WSREP_SST_OPT_ROLE" = 'donor' ]; then wsrep_log_info "Rate-limiting SST to $rlimit" - pcmd="$pcmd -L \$rlimit" + rlimitopts=" -L $rlimit" + fi + + if [ -n "$progress" ]; then + + # Backward compatibility: user-configured progress output + pcmd="pv $pvopts$rlimitopts" + + if [ -z "${PV_FORMAT+x}" ]; then + PV_FORMAT=0 + pv --help | grep -qw -F -- '-F' && PV_FORMAT=1 + fi + if [ $PV_FORMAT -eq 1 ]; then + pcmd="$pcmd $pvformat" + fi + + if [ $payload -ne 0 ]; then + pcmd="$pcmd -s $payload" + fi + + if [ "$progress" != '1' ]; then + if [ -e "$progress" ]; then + pcmd="$pcmd 2>>'$progress'" + else + pcmd="$pcmd 2>'$progress'" + fi + fi + + elif [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then + + # Default progress output parseable by parent + pcmd="pv -f -i 1 -n -b$rlimitopts" + + # read progress data, add tag and post to stdout + # for the parent + rcmd="stdbuf -oL tr '\r' '\n' | xargs -n1 echo complete" + + elif [ -n "$rlimitopts" ]; then + + # Rate-limiting only, when rlimit is non-zero + pcmd="pv -q$rlimitopts" + fi } @@ -765,18 +809,28 @@ recv_joiner() wsrep_log_info $(ls -l "$dir/"*) exit 32 fi - # Select the "secret" tag whose value does not start - # with a slash symbol. All new tags must to start with - # the space and the slash symbol after the word "secret" - - # to be removed by older versions of the SST scripts: - SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]+[^/]" \ - -- "$MAGIC_FILE" || :) - # Check donor supplied secret: - SECRET=$(trim_string "${SECRET#$SECRET_TAG}") - if [ "$SECRET" != "$MY_SECRET" ]; then - wsrep_log_error "Donor does not know my secret!" - wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'" - exit 32 + + if [ -n "$MY_SECRET" ]; then + # Check donor supplied secret: + SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]" "$MAGIC_FILE" || :) + SECRET=$(trim_string "${SECRET#$SECRET_TAG}") + if [ "$SECRET" != "$MY_SECRET" ]; then + wsrep_log_error "Donor does not know my secret!" + wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'" + exit 32 + fi + fi + + if [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then + # check total SST footprint + payload=$(grep -m1 -E "^$TOTAL_TAG[[:space:]]" "$MAGIC_FILE" || :) + if [ -n "$payload" ]; then + payload=$(trim_string "${payload#$TOTAL_TAG}") + if [ $payload -ge 0 ]; then + # report to parent + echo "$TOTAL_TAG $payload" + fi + fi fi fi } @@ -825,6 +879,14 @@ monitor_process() read_cnf setup_ports +if [ "$progress" = 'none' ]; then + wsrep_log_info "All progress/rate-limiting disabled by configuration" +elif [ -z "$(commandex pv)" ]; then + wsrep_log_info "Progress reporting tool pv not found in path: $PATH" + wsrep_log_info "Disabling all progress/rate-limiting" + progress='none' +fi + if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -F -- '--version-check'; then disver=' --no-version-check' fi @@ -980,6 +1042,14 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then check_extra + if [ -n "$progress" -o $WSREP_SST_OPT_PROGRESS -eq 1 ]; then + wsrep_log_info "Estimating total transfer size" + get_footprint + wsrep_log_info "To transfer: $payload" + else + adjust_progress + fi + wsrep_log_info "Streaming GTID file before SST" # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id @@ -991,6 +1061,11 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE" fi + if [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then + # Tell joiner what to expect: + echo "$TOTAL_TAG $payload" >> "$MAGIC_FILE" + fi + ttcmd="$tcmd" if [ -n "$scomp" ]; then @@ -1007,12 +1082,14 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then # Restore the transport commmand to its original state tcmd="$ttcmd" - if [ -n "$progress" ]; then - get_footprint - tcmd="$pcmd | $tcmd" - elif [ -n "$rlimit" ]; then - adjust_progress - tcmd="$pcmd | $tcmd" + if [ -n "$pcmd" ]; then + if [ -n "$rcmd" ]; then + # redirect pv stderr to rcmd for tagging and output to parent + tcmd="{ $pcmd 2>&3 | $tcmd; } 3>&1 | $rcmd" + else + # use user-configured pv output + tcmd="$pcmd | $tcmd" + fi fi wsrep_log_info "Sleeping before data transfer for SST" @@ -1214,13 +1291,6 @@ else # joiner MY_SECRET="" # for check down in recv_joiner() fi - trap cleanup_at_exit EXIT - - if [ -n "$progress" ]; then - adjust_progress - tcmd="$tcmd | $pcmd" - fi - get_keys if [ $encrypt -eq 1 ]; then strmcmd="$ecmd | $strmcmd" @@ -1232,6 +1302,8 @@ else # joiner check_sockets_utils + trap cleanup_at_exit EXIT + STATDIR="$(mktemp -d)" MAGIC_FILE="$STATDIR/$INFO_FILE" @@ -1245,6 +1317,17 @@ else # joiner if [ ! -r "$STATDIR/$IST_FILE" ]; then + adjust_progress + if [ -n "$pcmd" ]; then + if [ -n "$rcmd" ]; then + # redirect pv stderr to rcmd for tagging and output to parent + strmcmd="{ $pcmd 2>&3 | $strmcmd; } 3>&1 | $rcmd" + else + # use user-configured pv output + strmcmd="$pcmd | $strmcmd" + fi + fi + if [ -d "$DATA/.sst" ]; then wsrep_log_info \ "WARNING: Stale temporary SST directory:" \ @@ -1265,13 +1348,13 @@ else # joiner cd "$DATA" wsrep_log_info "Cleaning the old binary logs" # If there is a file with binlogs state, delete it: - [ -f "$binlog_base.state" ] && rm -f "$binlog_base.state" >&2 + [ -f "$binlog_base.state" ] && rm "$binlog_base.state" >&2 # Clean up the old binlog files and index: if [ -f "$binlog_index" ]; then while read bin_file || [ -n "$bin_file" ]; do rm -f "$bin_file" >&2 || : done < "$binlog_index" - rm -f "$binlog_index" >&2 + rm "$binlog_index" >&2 fi if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ -d "$binlog_dir" ] @@ -1335,16 +1418,14 @@ else # joiner dcmd="xargs -n 2 qpress -dT$nproc" - if [ -n "$progress" ] && \ + if [ -n "$progress" -a "$progress" != 'none' ] && \ pv --help | grep -qw -F -- '--line-mode' then - count=$(find "$DATA" -type f -name '*.qp' | wc -l) + count=$(find "$DATA" -maxdepth 1 -type f -name '*.qp' | wc -l) count=$(( count*2 )) - pvopts="-f -s $count -l -N Decompression" - if pv --help | grep -qw -F -- '-F'; then - pvopts="$pvopts -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" - fi - pcmd="pv $pvopts" + pvopts='-f -l -N Decompression' + pvformat="-F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" + payload=$count adjust_progress dcmd="$pcmd | $dcmd" fi @@ -1442,7 +1523,7 @@ else # joiner fi # Remove special tags from the magic file, and from the output: - coords=$(grep -v -E "^$SECRET_TAG[[:space:]]" -- "$MAGIC_FILE") + coords=$(head -n1 "$MAGIC_FILE") wsrep_log_info "Galera co-ords from recovery: $coords" echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 994347d6f73..7096bb4b330 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -65,21 +65,21 @@ cleanup_joiner() if [ $failure -eq 0 ]; then if cleanup_pid $RSYNC_REAL_PID "$RSYNC_PID" "$RSYNC_CONF"; then - [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" - [ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" + [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || : + [ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" || : else wsrep_log_warning "rsync cleanup failed." fi fi - wsrep_log_info "Joiner cleanup done." - if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then wsrep_cleanup_progress_file fi [ -f "$SST_PID" ] && rm -f "$SST_PID" || : + wsrep_log_info "Joiner cleanup done." + exit $estatus } @@ -318,7 +318,7 @@ if [ -n "$SSLMODE" -a "$SSLMODE" != 'DISABLED' ]; then fi readonly SECRET_TAG='secret' -readonly BYPASS_TAG='secret /bypass' +readonly BYPASS_TAG='bypass' SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid" @@ -371,10 +371,11 @@ done [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" [ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" +RC=0 + if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then - if [ -n "$STUNNEL" ] - then + if [ -n "$STUNNEL" ]; then cat << EOF > "$STUNNEL_CONF" key = $SSTKEY cert = $SSTCERT @@ -392,8 +393,6 @@ ${CHECK_OPT_LOCAL} EOF fi - RC=0 - if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" @@ -410,19 +409,19 @@ EOF # (c) ERROR file, in case flush tables operation failed. while [ ! -r "$FLUSHED" ] && \ - ! grep -q -F ':' -- "$FLUSHED" 2>/dev/null + ! grep -q -F ':' -- "$FLUSHED" do # Check whether ERROR file exists. if [ -f "$ERROR" ]; then # Flush tables operation failed. - rm -f "$ERROR" + rm "$ERROR" exit 255 fi sleep 0.2 done STATE=$(cat "$FLUSHED") - rm -f "$FLUSHED" + rm "$FLUSHED" sync @@ -629,6 +628,8 @@ FILTER="-f '- /lost+found' wsrep_log_info "Transfer of data done" + [ -f "$BINLOG_TAR_FILE" ] && rm "$BINLOG_TAR_FILE" + else # BYPASS wsrep_log_info "Bypassing state dump." @@ -657,6 +658,8 @@ FILTER="-f '- /lost+found' --archive --quiet --checksum "$MAGIC_FILE" \ "rsync://$WSREP_SST_OPT_ADDR" >&2 || RC=$? + rm "$MAGIC_FILE" + if [ $RC -ne 0 ]; then wsrep_log_error "rsync $MAGIC_FILE returned code $RC:" exit 255 # unknown error @@ -665,8 +668,8 @@ FILTER="-f '- /lost+found' echo "done $STATE" if [ -n "$STUNNEL" ]; then - [ -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF" - [ -f "$STUNNEL_PID" ] && rm -f "$STUNNEL_PID" + rm "$STUNNEL_CONF" + [ -f "$STUNNEL_PID" ] && rm "$STUNNEL_PID" fi else # joiner @@ -704,8 +707,7 @@ $SILENT EOF # If the IP is local, listen only on it: - if is_local_ip "$RSYNC_ADDR_UNESCAPED" - then + if is_local_ip "$RSYNC_ADDR_UNESCAPED"; then RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR_UNESCAPED" STUNNEL_ACCEPT="$RSYNC_ADDR_UNESCAPED:$RSYNC_PORT" else @@ -826,13 +828,8 @@ EOF fi if [ -n "$MY_SECRET" ]; then - # Select the "secret" tag whose value does not start - # with a slash symbol. All new tags must to start with - # the space and the slash symbol after the word "secret" - - # to be removed by older versions of the SST scripts: - SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]+[^/]" \ - -- "$MAGIC_FILE" || :) # Check donor supplied secret: + SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]" "$MAGIC_FILE" || :) SECRET=$(trim_string "${SECRET#$SECRET_TAG}") if [ "$SECRET" != "$MY_SECRET" ]; then wsrep_log_error "Donor does not know my secret!" @@ -842,7 +839,7 @@ EOF fi if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then - if grep -m1 -qE "^$BYPASS_TAG([[:space:]]+.*)?\$" -- "$MAGIC_FILE"; then + if grep -m1 -qE "^$BYPASS_TAG([[:space:]]+.*)?\$" "$MAGIC_FILE"; then readonly WSREP_SST_OPT_BYPASS=1 readonly WSREP_TRANSFER_TYPE='IST' fi @@ -850,10 +847,10 @@ EOF binlog_tar_present=0 if [ -f "$BINLOG_TAR_FILE" ]; then + binlog_tar_present=1 if [ $WSREP_SST_OPT_BYPASS -ne 0 ]; then wsrep_log_warning "tar with binlogs transferred in the IST mode" fi - binlog_tar_present=1 fi if [ $WSREP_SST_OPT_BYPASS -eq 0 -a -n "$WSREP_SST_OPT_BINLOG" ]; then @@ -867,7 +864,7 @@ EOF while read bin_file || [ -n "$bin_file" ]; do rm -f "$bin_file" || : done < "$binlog_index" - rm -f "$binlog_index" + rm "$binlog_index" fi binlog_cd=0 # Change the directory to binlog base (if possible): @@ -902,7 +899,6 @@ EOF fi # Extracting binlog files: wsrep_log_info "Extracting binlog files:" - RC=0 if tar --version | grep -qw -E '^bsdtar'; then tar -tf "$BINLOG_TAR_FILE" > "$tmpfile" && \ tar -xvf "$BINLOG_TAR_FILE" > /dev/null || RC=$? @@ -912,7 +908,7 @@ EOF fi if [ $RC -ne 0 ]; then wsrep_log_error "Error unpacking tar file with binlog files" - rm -f "$tmpfile" + rm "$tmpfile" exit 32 fi # Rebuild binlog index: @@ -920,18 +916,16 @@ EOF while read bin_file || [ -n "$bin_file" ]; do echo "$binlog_dir${binlog_dir:+/}$bin_file" >> "$binlog_index" done < "$tmpfile" - rm -f "$tmpfile" + rm "$tmpfile" cd "$OLD_PWD" fi fi # Remove special tags from the magic file, and from the output: - coords=$(grep -v -E "^$SECRET_TAG[[:space:]]" -- "$MAGIC_FILE") + coords=$(head -n1 "$MAGIC_FILE") wsrep_log_info "Galera co-ords from recovery: $coords" echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id fi -[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" - wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE" exit 0 diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 7b9ce65264b..504b5741c0f 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -998,12 +998,14 @@ static ssize_t sst_prepare_other (const char* method, WSREP_SST_OPT_ADDR " '%s' " WSREP_SST_OPT_DATA " '%s' " "%s" - WSREP_SST_OPT_PARENT " '%d'" + WSREP_SST_OPT_PARENT " %d " + WSREP_SST_OPT_PROGRESS " %d" "%s" "%s", method, addr_in, mysql_real_data_home, wsrep_defaults_file, (int)getpid(), + 0, binlog_opt_val, binlog_index_opt_val); my_free(binlog_opt_val); @@ -1724,16 +1726,18 @@ static int sst_donate_other (const char* method, "wsrep_sst_%s " WSREP_SST_OPT_ROLE " 'donor' " WSREP_SST_OPT_ADDR " '%s' " - WSREP_SST_OPT_LPORT " '%u' " + WSREP_SST_OPT_LPORT " %u " WSREP_SST_OPT_SOCKET " '%s' " + WSREP_SST_OPT_PROGRESS " %d " WSREP_SST_OPT_DATA " '%s' " "%s" WSREP_SST_OPT_GTID " '%s:%lld' " - WSREP_SST_OPT_GTID_DOMAIN_ID " '%d'" + WSREP_SST_OPT_GTID_DOMAIN_ID " %d" "%s" "%s" "%s", method, addr, mysqld_port, mysqld_unix_port, + 0, mysql_real_data_home, wsrep_defaults_file, uuid, (long long) seqno, wsrep_gtid_domain_id, diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index 38706fa4671..f2957e1db7a 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -32,6 +32,7 @@ #define WSREP_SST_OPT_PARENT "--parent" #define WSREP_SST_OPT_BINLOG "--binlog" #define WSREP_SST_OPT_BINLOG_INDEX "--binlog-index" +#define WSREP_SST_OPT_PROGRESS "--progress" #define WSREP_SST_OPT_MYSQLD "--mysqld-args" // mysqldump-specific options From 2e7e89d6c94db51d473ddfb9e023d4f19925e524 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 8 Jun 2022 15:20:36 +0200 Subject: [PATCH 06/32] cleanup: move the check out of the loop --- sql/sql_show.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1316dcd9c94..a019c3c9dbd 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6990,19 +6990,18 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables, #ifndef NO_EMBEDDED_ACCESS_CHECKS TABLE_LIST table_acl_check; bzero((char*) &table_acl_check, sizeof(table_acl_check)); + + if (!(thd->col_access & TABLE_ACLS)) + { + table_acl_check.db= *db_name; + table_acl_check.table_name= *table_name; + table_acl_check.grant.privilege= thd->col_access; + if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE)) + DBUG_RETURN(res); + } #endif for (uint i= 0; i < tables->table->s->table_check_constraints; i++) { -#ifndef NO_EMBEDDED_ACCESS_CHECKS - if (!(thd->col_access & TABLE_ACLS)) - { - table_acl_check.db= *db_name; - table_acl_check.table_name= *table_name; - table_acl_check.grant.privilege= thd->col_access; - if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE)) - continue; - } -#endif Virtual_column_info *check= tables->table->check_constraints[i]; table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info); table->field[3]->store(check->name.str, check->name.length, From f31e935c3e0649d36008ab440cd87cb7ff474bb3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 15 Jun 2022 14:53:51 +0200 Subject: [PATCH 07/32] mtr: fix a race condition if a test can run in cond1,cond2 and cond1,cond3 then they can happen to run in parallel and both wanting to create test,cond1.result~ --- mysql-test/mysql-test-run.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a01de00e0c2..a5f576de0b3 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3359,17 +3359,21 @@ sub do_before_run_mysqltest($) if ($^O eq "MSWin32") { push @cmd, '--binary'; } - push @cmd, (qw/-r - -f -s -o/, $dest, $base_result, $resfile); + push @cmd, (qw/-r - -f -s -o/, $dest . $$, $base_result, $resfile); if (-w $resdir) { # don't rebuild a file if it's up to date unless (-e $dest and -M $dest < -M $resfile and -M $dest < -M $base_result) { run_system(@cmd); + rename $cmd[-3], $dest or unlink $cmd[-3]; } } else { - $cmd[-3] = $dest = $opt_tmpdir . '/' . basename($dest); + $dest = $opt_tmpdir . '/' . basename($dest); + $cmd[-3] = $dest . $$; run_system(@cmd); + rename $cmd[-3], $dest or unlink $cmd[-3]; } + $tinfo->{result_file} = $dest; } From c4f65d8fed16370deae85115490fc0c06da2ce84 Mon Sep 17 00:00:00 2001 From: Shunsuke Tokunaga Date: Thu, 16 Jun 2022 13:28:24 +0900 Subject: [PATCH 08/32] MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher ha_partition::set_auto_increment_if_higher expects part_share->auto_inc_initialized is true or can_use_for_auto_inc_init() is false (but as the comment of this method says, it returns false only if we use Spider engine with DROP TABLE or ALTER TABLE query). However, part_share->auto_inc_initialized becomes true only after all partitions are opened (since 6dce6aecebe6ef78a14cb5c5c5daa8a355551e40). Therefore, I added a conditional expression in order to read all partitions when we execute REPLACE on a table that has an AUTO_INCREMENT column. Reviewed by: Nayuta Yanagisawa Reviewed by: Alexey Botchkov --- .../suite/parts/inc/partition_auto_increment.inc | 11 +++++++++++ .../parts/r/partition_auto_increment_innodb.result | 7 +++++++ .../parts/r/partition_auto_increment_maria.result | 7 +++++++ .../parts/r/partition_auto_increment_memory.result | 7 +++++++ .../parts/r/partition_auto_increment_myisam.result | 7 +++++++ sql/ha_partition.cc | 4 ++-- sql/ha_partition.h | 7 ++++--- .../r/partition_auto_increment_tokudb.result | 7 +++++++ 8 files changed, 52 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc index 4392d04db8a..2997dd9de4f 100644 --- a/mysql-test/suite/parts/inc/partition_auto_increment.inc +++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc @@ -873,5 +873,16 @@ UPDATE t1 SET pk = 0; DROP TABLE t1; } +if (!$skip_update) +{ +--echo # +--echo # MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' +--echo # ha_partition::set_auto_increment_if_higher +--echo # +eval CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; +} + --echo ############################################################################## } 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 76f1ddfceae..e5414c81616 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -1109,4 +1109,11 @@ CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam 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='InnoDB' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +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 5a3902475a9..ad041735ebb 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result @@ -1156,4 +1156,11 @@ CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam 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='Aria' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +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 c395f8ed0c9..d2d1fb6831c 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result @@ -1137,4 +1137,11 @@ CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam 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='Memory' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +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 792423096b5..f92a6ed18c6 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result @@ -1156,4 +1156,11 @@ CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam 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='MyISAM' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; ############################################################################## diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 48c479070a5..5c08c934dde 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3661,7 +3661,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) } else { - check_insert_autoincrement(); + check_insert_or_replace_autoincrement(); if (unlikely((error= open_read_partitions(name_buff, sizeof(name_buff))))) goto err_handler; m_num_locks= m_file_sample->lock_count(); @@ -8666,7 +8666,7 @@ int ha_partition::change_partitions_to_open(List *partition_names) return 0; } - check_insert_autoincrement(); + check_insert_or_replace_autoincrement(); if (bitmap_cmp(&m_opened_partitions, &m_part_info->read_partitions) != 0) return 0; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index e85c61b839d..6c0e4ef6cf2 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1400,15 +1400,16 @@ private: unlock_auto_increment(); } - void check_insert_autoincrement() + void check_insert_or_replace_autoincrement() { /* - If we INSERT into the table having the AUTO_INCREMENT column, + If we INSERT or REPLACE into the table having the AUTO_INCREMENT column, we have to read all partitions for the next autoincrement value 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_REPLACE) && table->found_next_number_field) bitmap_set_all(&m_part_info->read_partitions); } 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 14b6052a7d3..9b79cc21875 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 @@ -1123,5 +1123,12 @@ CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam 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='TokuDB' PARTITION BY HASH (a) PARTITIONS 3; +REPLACE INTO t1 PARTITION (p0) VALUES (3); +DROP TABLE t1; ############################################################################## SET GLOBAL tokudb_prelock_empty = @tokudb_prelock_empty_saved; From be99d0ddb603bf972201a6b188819ed099b3bd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jun 2022 08:40:51 +0300 Subject: [PATCH 09/32] Fix intermittent failures of innodb.stats_persistent We do not really care about the exact result; we only care that the statistics will be accessed. The result could change depending on when some statistics were updated in the background or when some committed delete-marked rows were purged from other tables on which persistent statistics are enabled. --- mysql-test/suite/innodb/r/stats_persistent.result | 6 +++--- mysql-test/suite/innodb/t/stats_persistent.test | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/stats_persistent.result b/mysql-test/suite/innodb/r/stats_persistent.result index f72ae874c40..231ce321ce2 100644 --- a/mysql-test/suite/innodb/r/stats_persistent.result +++ b/mysql-test/suite/innodb/r/stats_persistent.result @@ -6,9 +6,9 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; ANALYZE TABLE t1; connect con1, localhost, root; SET DEBUG_SYNC='now WAIT_FOR stop'; -SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; -ENGINE SUM(DATA_LENGTH+INDEX_LENGTH) COUNT(ENGINE) SUM(DATA_LENGTH) SUM(INDEX_LENGTH) -InnoDB 114688 4 65536 49152 +SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +SUM(DATA_LENGTH+INDEX_LENGTH) +SUM SET DEBUG_SYNC='now SIGNAL go'; disconnect con1; connection default; diff --git a/mysql-test/suite/innodb/t/stats_persistent.test b/mysql-test/suite/innodb/t/stats_persistent.test index ac412d56d0d..8561298c4d3 100644 --- a/mysql-test/suite/innodb/t/stats_persistent.test +++ b/mysql-test/suite/innodb/t/stats_persistent.test @@ -14,7 +14,8 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; --connect(con1, localhost, root) SET DEBUG_SYNC='now WAIT_FOR stop'; -SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +--replace_column 1 SUM +SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; SET DEBUG_SYNC='now SIGNAL go'; --disconnect con1 From 0565dfe490fc706ac47e480e41e0af508d5ad886 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Jun 2022 19:38:40 +0300 Subject: [PATCH 10/32] MDEV-17390: re-neable rpl_semi_sync_after_sync test The reasons sited for disabling this test in MDEV-16172 where disputed. --- mysql-test/suite/rpl/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def index 548cff54834..57907210693 100644 --- a/mysql-test/suite/rpl/disabled.def +++ b/mysql-test/suite/rpl/disabled.def @@ -13,6 +13,5 @@ rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table rpl_row_binlog_max_cache_size : MDEV-11092 rpl_row_index_choice : MDEV-11666 -rpl_semi_sync_after_sync : fails after MDEV-16172 rpl_auto_increment_update_failure : disabled for now rpl_current_user : waits for MDEV-22374 fix From f299351e1c2aa00dcce3c6f58c58bb5e28469c61 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 18 Jun 2022 15:10:34 +0200 Subject: [PATCH 11/32] remove invalid test it starts an EXPLAIN of a multi-table join and tries to KILL it. no sync points. depending on how fast the hareware is and optimizer development it might kill EXPLAIN at some random point in time (generally unrelated to the Bug#28598 it was supposed to test) or EXPLAIN might finish before the KILL and the test will fail. --- mysql-test/main/kill.result | 14 -------- mysql-test/main/kill.test | 68 ------------------------------------- 2 files changed, 82 deletions(-) diff --git a/mysql-test/main/kill.result b/mysql-test/main/kill.result index 170aea26e9b..8f9adafada2 100644 --- a/mysql-test/main/kill.result +++ b/mysql-test/main/kill.result @@ -197,20 +197,6 @@ f2 connection default; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1, t2; -connection con1; -connection con2; -connection con1; -SET SESSION optimizer_search_depth=0; -SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync'; -PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 '; -EXECUTE stmt; -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; -ERROR 70100: Query execution was interrupted -connection default; -SET DEBUG_SYNC = 'RESET'; # # Bug#19723: kill of active connection yields different error code # depending on platform. diff --git a/mysql-test/main/kill.test b/mysql-test/main/kill.test index ebf68ea9ad0..6554ab7f2c9 100644 --- a/mysql-test/main/kill.test +++ b/mysql-test/main/kill.test @@ -272,74 +272,6 @@ connection default; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1, t2; -# -# Bug#28598: mysqld crash when killing a long-running explain query. -# -connection con1; -let $ID= `SELECT @id := CONNECTION_ID()`; -connection con2; -let $ignore= `SELECT @id := $ID`; -connection con1; ---disable_query_log -let $tab_count= 40; - ---disable_query_log -begin; -let $i= $tab_count; -while ($i) -{ - eval CREATE TABLE t$i (a$i INT, KEY(a$i)); - eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7); - dec $i ; -} - -commit; ---enable_query_log - -SET SESSION optimizer_search_depth=0; - -let $i=$tab_count; -while ($i) -{ - let $a= a$i; - let $t= t$i; - dec $i; - if ($i) - { - let $comma=,; - let $from=$comma$t$from; - let $where=a$i=$a $and $where; - } - if (!$i) - { - let $from=FROM $t$from; - let $where=WHERE $where; - } - let $and=AND; -} - ---enable_query_log -SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync'; -eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where'; -send EXECUTE stmt; - -connection con2; -SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; -KILL QUERY @id; -connection con1; ---error 1317 -reap; ---disable_query_log -let $i= $tab_count; -while ($i) -{ - eval DROP TABLE t$i; - dec $i ; -} ---enable_query_log -connection default; -SET DEBUG_SYNC = 'RESET'; - --echo # --echo # Bug#19723: kill of active connection yields different error code --echo # depending on platform. From d4539426bc23628efc69819130e4cb4a88d124ad Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 18 Jun 2022 17:42:29 +0300 Subject: [PATCH 12/32] MDEV-28884: include kernel information in crashing signal handler Recent adventures in liburing and btrfs have shown up some kernel version dependent bugs. Having a bug report of accurace kernel version can start to correlate these errors sooner. On Linux, /proc/version contains the kernel version. FreeBSD has kern.version (per man 8 sysctl), so include that too. Example output: Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h Kernel version: Linux version 5.19.0-0.rc2.21.fc37.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1), GNU ld version 2.38-14.fc37) #1 SMP PREEMPT_DYNAMIC Mon Jun 13 15:27:24 UTC 2022 Segmentation fault (core dumped) --- sql/signal_handler.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index c0f31077e4d..915291185d5 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -81,6 +81,12 @@ static inline void output_core_info() my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); my_close(fd, MYF(0)); } + if ((fd= my_open("/proc/version", O_RDONLY, MYF(0))) >= 0) + { + len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0)); + my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff); + my_close(fd, MYF(0)); + } #endif #elif defined(__APPLE__) || defined(__FreeBSD__) char buff[PATH_MAX]; @@ -89,6 +95,10 @@ static inline void output_core_info() { my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); } + if (sysctlbyname("kern.version", buff, &len, NULL, 0) == 0) + { + my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff); + } #else char buff[80]; my_getwd(buff, sizeof(buff), 0); From 01c0345d44675a4dd820ff118ea7a6b2272b19ce Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 20 Jun 2022 16:17:14 +0200 Subject: [PATCH 13/32] MDEV-28819 Statically compiled encryption plugins do not work in mariadb-backup Disable static build for encryption plugin file_key_management --- plugin/file_key_management/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/file_key_management/CMakeLists.txt b/plugin/file_key_management/CMakeLists.txt index c2f13fb9f63..9b09da9bf20 100644 --- a/plugin/file_key_management/CMakeLists.txt +++ b/plugin/file_key_management/CMakeLists.txt @@ -1,4 +1,4 @@ SET(FILE_KEY_MANAGEMENT_PLUGIN_SOURCES file_key_management_plugin.cc parser.cc) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) -MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES}) +MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES} MODULE_ONLY) From af929146ed5d10f7cafe1091346e50a873eed3f1 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 17 Jun 2022 13:56:03 +0200 Subject: [PATCH 14/32] MDEV-28583 postfix: fixing .result files after automatic merge --- .../r/galera_ist_MDEV-28423,debug.rdiff | 200 +++++-- .../galera/r/galera_ist_MDEV-28423.result | 558 +++++++++++++----- .../r/galera_ist_MDEV-28583,debug.rdiff | 200 +++++-- .../galera/r/galera_ist_MDEV-28583.result | 558 +++++++++++++----- 4 files changed, 1066 insertions(+), 450 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff index f9f81ea3b40..96e5def88ff 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28423.result +++ r/galera_ist_MDEV-28423.reject -@@ -286,3 +286,111 @@ +@@ -517,3 +517,187 @@ + 1 DROP TABLE t1; COMMIT; - SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,56 +59,132 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; -+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+COUNT(*) = 2 -+1 -+SELECT COUNT(*) = 35 FROM t1; -+COUNT(*) = 35 -+1 ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+SET AUTOCOMMIT=ON; +connection node_1; -+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+COUNT(*) = 2 -+1 -+SELECT COUNT(*) = 35 FROM t1; -+COUNT(*) = 35 -+1 ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; -+SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result index 80a28d349ba..5a71b490a80 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result @@ -1,287 +1,519 @@ +connection node_2; +connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff index ce78050538d..9e6530aa9f7 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28583.result +++ r/galera_ist_MDEV-28583.reject -@@ -285,3 +285,111 @@ +@@ -517,3 +517,187 @@ + 1 DROP TABLE t1; COMMIT; - SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); -+INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); -+INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,56 +59,132 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -+INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; -+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+COUNT(*) = 2 -+1 -+SELECT COUNT(*) = 35 FROM t1; -+COUNT(*) = 35 -+1 ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+SET AUTOCOMMIT=ON; +connection node_1; -+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+COUNT(*) = 2 -+1 -+SELECT COUNT(*) = 35 FROM t1; -+COUNT(*) = 35 -+1 ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; -+SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result index 80a28d349ba..5a71b490a80 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result @@ -1,287 +1,519 @@ +connection node_2; +connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); -INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); -INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); -INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); ROLLBACK; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -SET AUTOCOMMIT=ON; connection node_1; -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; -SET AUTOCOMMIT=ON; From 3e09c6199dc4c74ee628cf01486927e4d3261887 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 21 Jun 2022 13:29:45 +0200 Subject: [PATCH 15/32] MDEV-26562: galera-sst-mariabackup is failing due to missing xtrabackup_checkpoints This commit contains workaround for a bug known as 'Red Hat issue 1870279' (connection reset by peer issue in socat versions 1.7.3.3 to 1.7.4.0) which further causes crashes during SST using mariabackup (when openssl is used). Also fixed broken logic of automatic generation of the Diffie-Hellman parameters for socat version less than 1.7.3 (which defaults to 512-bit values instead of 2048-bit ones). --- scripts/wsrep_sst_common.sh | 61 ++++++++++++++++++-------------- scripts/wsrep_sst_mariabackup.sh | 48 ++++++++++++++++++------- 2 files changed, 70 insertions(+), 39 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 35021ace8b6..44c6a7b4476 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1187,28 +1187,27 @@ check_port() check_for_dhparams() { ssl_dhparams="$DATA/dhparams.pem" - if [ ! -r "$ssl_dhparams" ]; then - get_openssl - if [ -n "$OPENSSL_BINARY" ]; then - wsrep_log_info \ - "Could not find dhparams file, creating $ssl_dhparams" - local bug=0 - local errmsg - errmsg=$("$OPENSSL_BINARY" \ - dhparam -out "$ssl_dhparams" 2048 2>&1) || bug=1 - if [ $bug -ne 0 ]; then - wsrep_log_info "run: \"$OPENSSL_BINARY\" dhparam -out \"$ssl_dhparams\" 2048" - wsrep_log_info "output: $errmsg" - wsrep_log_error "******** ERROR *****************************************" - wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. *" - wsrep_log_error "********************************************************" - ssl_dhparams="" - fi - else - # Rollback: if openssl is not installed, then use - # the default parameters: + get_openssl + if [ -n "$OPENSSL_BINARY" ]; then + wsrep_log_info \ + "Could not find dhparams file, creating $ssl_dhparams" + local bug=0 + local errmsg + errmsg=$("$OPENSSL_BINARY" \ + dhparam -out "$ssl_dhparams" -dsaparam 2048 2>&1) || bug=1 + if [ $bug -ne 0 ]; then + wsrep_log_info "run: \"$OPENSSL_BINARY\" dhparam"\ + "-out \"$ssl_dhparams\" -dsaparam 2048" + wsrep_log_info "output: $errmsg" + wsrep_log_error "******** ERROR *****************************************" + wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. *" + wsrep_log_error "********************************************************" ssl_dhparams="" fi + else + # Rollback: if openssl is not installed, then use + # the default parameters: + ssl_dhparams="" fi } @@ -1310,29 +1309,39 @@ verify_cert_matches_key() # check_for_version() { - y1="${1#*.}" + local y1="${1#*.}" [ "$y1" = "$1" ] && y1="" - z1=${y1#*.} + local z1="${y1#*.}" [ "$z1" = "$y1" ] && z1="" - x1="${1%%.*}" + local w1="${z1#*.}" + [ "$w1" = "$z1" ] && w1="" + local x1="${1%%.*}" y1="${y1%%.*}" z1="${z1%%.*}" + w1="${w1%%.*}" [ -z "$y1" ] && y1=0 [ -z "$z1" ] && z1=0 - y2="${2#*.}" + [ -z "$w1" ] && w1=0 + local y2="${2#*.}" [ "$y2" = "$2" ] && y2="" - z2="${y2#*.}" + local z2="${y2#*.}" [ "$z2" = "$y2" ] && z2="" - x2="${2%%.*}" + local w2="${z2#*.}" + [ "$w2" = "$z2" ] && w2="" + local x2="${2%%.*}" y2="${y2%%.*}" z2="${z2%%.*}" + w2="${w2%%.*}" [ -z "$y2" ] && y2=0 [ -z "$z2" ] && z2=0 + [ -z "$w2" ] && w2=0 [ $x1 -lt $x2 ] && return 1 [ $x1 -gt $x2 ] && return 0 [ $y1 -lt $y2 ] && return 1 [ $y1 -gt $y2 ] && return 0 [ $z1 -lt $z2 ] && return 1 + [ $z1 -gt $z2 ] && return 0 + [ $w1 -lt $w2 ] && return 1 return 0 } diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 8e025f94a3e..5521dd51098 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -218,6 +218,21 @@ get_keys() stagemsg="$stagemsg-XB-Encrypted" } +get_socat_ver() +{ + [ -n "${SOCAT_VERSION+x}" ] && return + # Determine the socat version + SOCAT_VERSION=$(socat -V 2>&1 | \ + grep -m1 -owE '[0-9]+(\.[0-9]+)+' | \ + head -n1 || :) + if [ -z "$SOCAT_VERSION" ]; then + wsrep_log_error "******** FATAL ERROR ******************" + wsrep_log_error "* Cannot determine the socat version. *" + wsrep_log_error "***************************************" + exit 2 + fi +} + get_transfer() { if [ "$tfmt" = 'nc' ]; then @@ -283,7 +298,7 @@ get_transfer() # If sockopt contains 'pf=ip6' somewhere in the middle, # this will not interfere with socat, but exclude the trivial # cases when sockopt contains 'pf=ip6' as prefix or suffix: - if [ "$sockopt" = "${sockopt#,pf=ip6}" -a \ + if [ "$sockopt" = "${sockopt#,pf=ip6,}" -a \ "$sockopt" = "${sockopt%,pf=ip6}" ] then sockopt=",pf=ip6$sockopt" @@ -310,22 +325,25 @@ get_transfer() if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then tcmd="socat -u openssl-listen:$SST_PORT,reuseaddr" else - tcmd="socat -u stdio openssl-connect:$REMOTEIP:$SST_PORT" + local addr="$REMOTEIP:$SST_PORT" + tcmd="socat -u stdio openssl-connect:$addr" action='Encrypting' + get_socat_ver + if ! check_for_version "$SOCAT_VERSION" '1.7.4.1'; then + if check_for_version "$SOCAT_VERSION" '1.7.3.3'; then + # Workaround for a bug known as 'Red Hat issue 1870279' + # (connection reset by peer) in socat versions 1.7.3.3 + # to 1.7.4.0: + tcmd="socat stdio openssl-connect:$addr,linger=10" + wsrep_log_info \ + "Use workaround for socat $SOCAT_VERSION bug" + fi + fi fi - if [ "${sockopt#*,dhparam=}" != "$sockopt" ]; then + if [ "${sockopt#*,dhparam=}" = "$sockopt" ]; then if [ -z "$ssl_dhparams" ]; then - # Determine the socat version - SOCAT_VERSION=$(socat -V 2>&1 | \ - grep -m1 -owE '[0-9]+(\.[0-9]+)+' | \ - head -n1 || :) - if [ -z "$SOCAT_VERSION" ]; then - wsrep_log_error "******** FATAL ERROR ******************" - wsrep_log_error "* Cannot determine the socat version. *" - wsrep_log_error "***************************************" - exit 2 - fi + get_socat_ver if ! check_for_version "$SOCAT_VERSION" '1.7.3'; then # socat versions < 1.7.3 will have 512-bit dhparams (too small) # so create 2048-bit dhparams and send that as a parameter: @@ -556,6 +574,10 @@ read_cnf() "CERT='$tpem', KEY='$tkey', MODE='$tmode'," \ "encrypt='$encrypt'" + if [ $encrypt -ge 2 ]; then + ssl_dhparams=$(parse_cnf "$encgroups" 'ssl-dhparams') + fi + sockopt=$(parse_cnf sst sockopt "") progress=$(parse_cnf sst progress "") ttime=$(parse_cnf sst time 0) From d96436c99905ed30494c6a52841ca17a558f44c6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 23 Jun 2022 15:37:11 +0200 Subject: [PATCH 16/32] MDEV-28935 crash in io_slots::release Revert "TSAN: data race on vptr (ctor/dtor vs virtual call)" This reverts commit 78084fa747f373f2b404c3cb543d19f439100d9e. This commit was done to please TSAN, which falsely reported an error where there was none. Yet as consequence, it could cause a real error, a crash in os_aio_free on shutdown --- storage/innobase/os/os0file.cc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 5155f6d0de0..5502ee9024c 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -79,7 +79,6 @@ Created 10/21/1995 Heikki Tuuri #include #include -#include /* Per-IO operation environment*/ class io_slots @@ -133,8 +132,8 @@ public: } }; -static std::unique_ptr read_slots; -static std::unique_ptr write_slots; +static io_slots *read_slots; +static io_slots *write_slots; /** Number of retries for partial I/O's */ constexpr ulint NUM_RETRIES_ON_PARTIAL_IO = 10; @@ -3675,10 +3674,6 @@ int os_aio_init() int max_read_events= int(srv_n_read_io_threads * OS_AIO_N_PENDING_IOS_PER_THREAD); int max_events= max_read_events + max_write_events; - - read_slots.reset(new io_slots(max_read_events, srv_n_read_io_threads)); - write_slots.reset(new io_slots(max_write_events, srv_n_write_io_threads)); - int ret; #if LINUX_NATIVE_AIO if (srv_use_native_aio && !is_linux_native_aio_supported()) @@ -3709,12 +3704,11 @@ disable: } #endif - if (ret) + if (!ret) { - read_slots.reset(); - write_slots.reset(); + read_slots= new io_slots(max_read_events, srv_n_read_io_threads); + write_slots= new io_slots(max_write_events, srv_n_write_io_threads); } - return ret; } @@ -3722,8 +3716,10 @@ disable: void os_aio_free() { srv_thread_pool->disable_aio(); - read_slots.reset(); - write_slots.reset(); + delete read_slots; + delete write_slots; + read_slots= nullptr; + write_slots= nullptr; } /** Wait until there are no pending asynchronous writes. */ @@ -3812,7 +3808,7 @@ func_exit: } compile_time_assert(sizeof(IORequest) <= tpool::MAX_AIO_USERDATA_LEN); - io_slots* slots= type.is_read() ? read_slots.get() : write_slots.get(); + io_slots* slots= type.is_read() ? read_slots : write_slots; tpool::aiocb* cb = slots->acquire(); cb->m_buffer = buf; From 2c83fc87c2a14c57e9c279ef1dc8ec678db54011 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 15 Feb 2022 13:37:59 +0400 Subject: [PATCH 17/32] MDEV-27832 disable binary logging for SQL SERVICE. Binary logging is now disabled for the queries run by SQL SERVICE. The binlogging can be turned on with the 'SET SQL_LOG_BIN=On' query. --- .../suite/plugins/r/test_sql_service.result | 29 +++++++++++++++++++ .../suite/plugins/t/test_sql_service.test | 21 ++++++++++++++ sql/sql_class.cc | 5 +--- sql/sql_class.h | 7 +++++ sql/sql_prepare.cc | 23 ++++++++++++++- sql/sys_vars.cc | 5 +--- 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/mysql-test/suite/plugins/r/test_sql_service.result b/mysql-test/suite/plugins/r/test_sql_service.result index 00f0411b665..ca7326de51c 100644 --- a/mysql-test/suite/plugins/r/test_sql_service.result +++ b/mysql-test/suite/plugins/r/test_sql_service.result @@ -2,6 +2,26 @@ install plugin test_sql_service soname 'test_sql_service'; show status like 'test_sql_service_passed'; Variable_name Value Test_sql_service_passed 1 +set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null'; +select * from t1 order by a; +a @@SQL_LOG_BIN +1 0 +2 0 +3 1 +4 0 +5 1 +6 0 +drop table t1; +SET SQL_LOG_BIN=0; set global test_sql_service_run_test= 1; show status like 'test_sql_service_passed'; Variable_name Value @@ -68,3 +88,12 @@ drop table t1; uninstall plugin test_sql_service; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into test.t1 select 3 as a, @@SQL_LOG_BIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test index b80d78fe6e5..3f2aaa81c4c 100644 --- a/mysql-test/suite/plugins/t/test_sql_service.test +++ b/mysql-test/suite/plugins/t/test_sql_service.test @@ -1,4 +1,5 @@ --source include/not_embedded.inc +--source include/have_log_bin.inc if (!$TEST_SQL_SERVICE_SO) { skip No TEST_SQL_SERVICE plugin; @@ -11,6 +12,20 @@ source include/wait_until_count_sessions.inc; install plugin test_sql_service soname 'test_sql_service'; show status like 'test_sql_service_passed'; +set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null'; +set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0'; +set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null'; +select * from t1 order by a; +drop table t1; +SET SQL_LOG_BIN=0; + set global test_sql_service_run_test= 1; show status like 'test_sql_service_passed'; @@ -58,3 +73,9 @@ drop table t1; uninstall plugin test_sql_service; +# Check that statements were executed/binlogged in correct order. +source include/show_binlog_events.inc; +# --replace_column 2 # 5 # +# --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +# SHOW BINLOG EVENTS LIMIT 3,100; + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 40afe0182b7..23a1566e573 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1298,10 +1298,7 @@ void THD::init() wsrep_desynced_backup_stage= false; #endif /* WITH_WSREP */ - if (variables.sql_log_bin) - variables.option_bits|= OPTION_BIN_LOG; - else - variables.option_bits&= ~OPTION_BIN_LOG; + set_binlog_bit(); select_commands= update_commands= other_commands= 0; /* Set to handle counting of aborted connections */ diff --git a/sql/sql_class.h b/sql/sql_class.h index a6f51d4b28f..76f713d0aac 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3256,6 +3256,13 @@ public: auto_inc_intervals_forced.empty(); // in case of multiple SET INSERT_ID auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0); } + inline void set_binlog_bit() + { + if (variables.sql_log_bin) + variables.option_bits |= OPTION_BIN_LOG; + else + variables.option_bits &= ~OPTION_BIN_LOG; + } ulonglong limit_found_rows; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 83c064c63c6..e3979867285 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -5627,12 +5627,26 @@ public: THD *new_thd; Security_context empty_ctx; + my_bool do_log_bin; + Protocol_local(THD *thd_arg, THD *new_thd_arg, ulong prealloc) : Protocol_text(thd_arg, prealloc), cur_data(0), first_data(0), data_tail(&first_data), alloc(0), - new_thd(new_thd_arg) + new_thd(new_thd_arg), do_log_bin(FALSE) {} + void set_binlog_vars(my_bool *sav_log_bin) + { + *sav_log_bin= thd->variables.sql_log_bin; + thd->variables.sql_log_bin= do_log_bin; + thd->set_binlog_bit(); + } + void restore_binlog_vars(my_bool sav_log_bin) + { + do_log_bin= thd->variables.sql_log_bin; + thd->variables.sql_log_bin= sav_log_bin; + thd->set_binlog_bit(); + } protected: bool net_store_data(const uchar *from, size_t length); bool net_store_data_cs(const uchar *from, size_t length, @@ -6240,12 +6254,16 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command, Ed_connection con(p->thd); Security_context *ctx_orig= p->thd->security_ctx; MYSQL_LEX_STRING sql_text; + my_bool log_bin_orig; + p->set_binlog_vars(&log_bin_orig); + DBUG_ASSERT(current_thd == p->thd); sql_text.str= (char *) arg; sql_text.length= arg_length; p->thd->security_ctx= &p->empty_ctx; result= con.execute_direct(p, sql_text); p->thd->security_ctx= ctx_orig; + p->restore_binlog_vars(log_bin_orig); } if (skip_check) result= 0; @@ -6401,6 +6419,9 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) new_thd->security_ctx->skip_grants(); new_thd->query_cache_is_applicable= 0; new_thd->variables.wsrep_on= 0; + new_thd->variables.sql_log_bin= 0; + new_thd->set_binlog_bit(); + /* TOSO: decide if we should turn the auditing off for such threads. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index f2a498a95d0..8a5f01cbc07 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4484,10 +4484,7 @@ static bool fix_sql_log_bin_after_update(sys_var *self, THD *thd, { DBUG_ASSERT(type == OPT_SESSION); - if (thd->variables.sql_log_bin) - thd->variables.option_bits |= OPTION_BIN_LOG; - else - thd->variables.option_bits &= ~OPTION_BIN_LOG; + thd->set_binlog_bit(); return FALSE; } From 5feb60ce186a41ba97f4c9dc4ab23bab4e87296e Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 23 Jun 2022 14:48:29 +0200 Subject: [PATCH 18/32] MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it. Reviewer: IgorBabaev --- mysql-test/main/key_cache.result | 22 ++++++++++++++++++++++ mysql-test/main/key_cache.test | 21 +++++++++++++++++++++ mysys/mf_keycache.c | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/key_cache.result b/mysql-test/main/key_cache.result index 1146ae8bbfa..3c5ed7679f9 100644 --- a/mysql-test/main/key_cache.result +++ b/mysql-test/main/key_cache.result @@ -834,3 +834,25 @@ set global keycache2.key_buffer_size=0; set global key_buffer_size=@save_key_buffer_size; set global key_cache_segments=@save_key_cache_segments; set global key_cache_file_hash_size=@save_key_cache_file_hash_size; +# +# SIGSEGV in flush_all_key_blocks when changing +# key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks +# +SET GLOBAL keycache1.key_cache_segments=7; +SET GLOBAL keycache1.key_buffer_size=1*1024*1024; +SET GLOBAL keycache1.key_buffer_size=0; +SET GLOBAL keycache1.key_buffer_size=128*1024; +create table t1 (p int primary key, a char(10)) delay_key_write=1; +cache index t1 key (`primary`) in keycache1; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +insert into t1 values (1, 'qqqq'), (11, 'yyyy'); +select * from t1; +p a +1 qqqq +11 yyyy +drop table t1; +SET GLOBAL keycache1.key_buffer_size=0; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/key_cache.test b/mysql-test/main/key_cache.test index fb6ae497e74..a99bb4ea04c 100644 --- a/mysql-test/main/key_cache.test +++ b/mysql-test/main/key_cache.test @@ -538,3 +538,24 @@ set global key_cache_segments=@save_key_cache_segments; set global key_cache_file_hash_size=@save_key_cache_file_hash_size; # End of 5.2 tests + +--echo # +--echo # SIGSEGV in flush_all_key_blocks when changing +--echo # key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks +--echo # + +SET GLOBAL keycache1.key_cache_segments=7; +SET GLOBAL keycache1.key_buffer_size=1*1024*1024; +SET GLOBAL keycache1.key_buffer_size=0; +SET GLOBAL keycache1.key_buffer_size=128*1024; +create table t1 (p int primary key, a char(10)) delay_key_write=1; +cache index t1 key (`primary`) in keycache1; +insert into t1 values (1, 'qqqq'), (11, 'yyyy'); +select * from t1; +drop table t1; +SET GLOBAL keycache1.key_buffer_size=0; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 8f62869b57e..8aa60064e06 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -701,7 +701,7 @@ int prepare_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, keycache->in_resize= 1; /* Need to flush only if keycache is enabled. */ - if (keycache->can_be_used) + if (keycache->can_be_used && keycache->disk_blocks != -1) { /* Start the flush phase. */ keycache->resize_in_flush= 1; From 8e6c8967a12ce19f52fbd43e5da97951ea819d2b Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Mon, 20 Jun 2022 16:12:16 +0900 Subject: [PATCH 19/32] MDEV-28479 Deprecate Spider's high availability feature Deprecate the high availability feature of Spider as the feature is beyond the scope of the federated storage engine and it complicates the implementation of Spider. --- storage/spider/mysql-test/spider/r/ha.result | 20 +++++++ .../spider/mysql-test/spider/r/ha_part.result | 25 ++++++++ .../mysql-test/spider/r/spider_fixes.result | 6 ++ storage/spider/spd_table.cc | 59 +++++++++++-------- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/storage/spider/mysql-test/spider/r/ha.result b/storage/spider/mysql-test/spider/r/ha.result index f8833c229ef..3c37c2d51f0 100644 --- a/storage/spider/mysql-test/spider/r/ha.result +++ b/storage/spider/mysql-test/spider/r/ha.result @@ -62,6 +62,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -117,6 +121,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 2"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -130,6 +138,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 1"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -162,6 +174,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -213,6 +229,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", alc "1", database "auto_test_remote auto_test_remote2", lst "1 0"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/r/ha_part.result b/storage/spider/mysql-test/spider/r/ha_part.result index d70d62404c0..d191cab37cd 100644 --- a/storage/spider/mysql-test/spider/r/ha_part.result +++ b/storage/spider/mysql-test/spider/r/ha_part.result @@ -62,6 +62,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -171,6 +186,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result index 6ece4b6255e..3b9d939393a 100644 --- a/storage/spider/mysql-test/spider/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/r/spider_fixes.result @@ -297,10 +297,16 @@ CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 8a0c264bb12..a1ed48e3374 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1833,30 +1833,41 @@ int st_spider_param_string_parse::print_param_error() } #define SPIDER_PARAM_STR_LENS(name) name ## _lengths #define SPIDER_PARAM_STR_CHARLEN(name) name ## _charlen -#define SPIDER_PARAM_STR_LIST(title_name, param_name) \ - if (!strncasecmp(tmp_ptr, title_name, title_length)) \ - { \ - DBUG_PRINT("info",("spider " title_name " start")); \ - if (!share->param_name) \ - { \ - if ((tmp_ptr2 = spider_get_string_between_quote( \ - start_ptr, FALSE))) \ - { \ - share->SPIDER_PARAM_STR_CHARLEN(param_name) = strlen(tmp_ptr2); \ - if ((error_num = spider_create_string_list( \ - &share->param_name, \ - &share->SPIDER_PARAM_STR_LENS(param_name), \ - &share->SPIDER_PARAM_STR_LEN(param_name), \ - tmp_ptr2, \ - share->SPIDER_PARAM_STR_CHARLEN(param_name), \ - &connect_string_parse))) \ - goto error; \ - } else { \ - error_num = connect_string_parse.print_param_error(); \ - goto error; \ - } \ - } \ - break; \ +#define SPIDER_PARAM_STR_LIST(title_name, param_name) \ + if (!strncasecmp(tmp_ptr, title_name, title_length)) \ + { \ + DBUG_PRINT("info", ("spider " title_name " start")); \ + if (!share->param_name) \ + { \ + if ((tmp_ptr2= spider_get_string_between_quote(start_ptr, FALSE))) \ + { \ + share->SPIDER_PARAM_STR_CHARLEN(param_name)= strlen(tmp_ptr2); \ + if ((error_num= spider_create_string_list( \ + &share->param_name, \ + &share->SPIDER_PARAM_STR_LENS(param_name), \ + &share->SPIDER_PARAM_STR_LEN(param_name), tmp_ptr2, \ + share->SPIDER_PARAM_STR_CHARLEN(param_name), \ + &connect_string_parse))) \ + { \ + goto error; \ + } \ + THD *thd= current_thd; \ + if (share->SPIDER_PARAM_STR_LEN(param_name) > 1 && create_table) \ + { \ + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \ + HA_ERR_UNSUPPORTED, \ + "The high availability feature of Spider " \ + "has been deprecated " \ + "and will be removed in a future release"); \ + } \ + } \ + else \ + { \ + error_num= connect_string_parse.print_param_error(); \ + goto error; \ + } \ + } \ + break; \ } #define SPIDER_PARAM_HINT(title_name, param_name, check_length, max_size, append_method) \ if (!strncasecmp(tmp_ptr, title_name, check_length)) \ From 925999bb97a495d0af02840270938b76cc7471c3 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Tue, 21 Jun 2022 17:02:04 +0900 Subject: [PATCH 20/32] MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection When the variable, spider_semi_table_lock, is 1, Spider sends LOCK TABLES before each SQL execution. The feature is for non-transactional remote tables and adds some overhead to query executions. We change the default value of the plugin variable to 0 and then deprecate the variable because it is rare to use non-transactional engines these days and the variable complicates the code. The variable, spider_semi_table_lock_connection, should be too deprecated because it is for tweaking the semi-table locking. --- .../spider/r/variable_deprecation.result | 29 +++++++++++++++++++ .../spider/t/variable_deprecation.test | 17 +++++++++++ storage/spider/spd_param.cc | 6 ++-- storage/spider/spd_table.cc | 4 +++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result index ddd32bf5e4b..bd3f0426b0b 100644 --- a/storage/spider/mysql-test/spider/r/variable_deprecation.result +++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result @@ -211,6 +211,35 @@ Warnings: Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release DROP TABLE tbl_a; DROP TABLE tbl_b; +# MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection +SET spider_semi_table_lock = 1; +Warnings: +Warning 1287 '@@spider_semi_table_lock' is deprecated and will be removed in a future release +SHOW VARIABLES LIKE "spider_semi_table_lock"; +Variable_name Value +spider_semi_table_lock 1 +CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stl "1"'; +Warnings: +Warning 1287 The table parameter 'stl' is deprecated and will be removed in a future release +CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock "1"'; +Warnings: +Warning 1287 The table parameter 'semi_table_lock' is deprecated and will be removed in a future release +DROP TABLE tbl_a; +DROP TABLE tbl_b; +SET spider_semi_table_lock_connection = 0; +Warnings: +Warning 1287 '@@spider_semi_table_lock_connection' is deprecated and will be removed in a future release +SHOW VARIABLES LIKE "spider_semi_table_lock_connection"; +Variable_name Value +spider_semi_table_lock_connection 0 +CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stc "0"'; +Warnings: +Warning 1287 The table parameter 'stc' is deprecated and will be removed in a future release +CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock_connection "0"'; +Warnings: +Warning 1287 The table parameter 'semi_table_lock_connection' is deprecated and will be removed in a future release +DROP TABLE tbl_a; +DROP TABLE tbl_b; DROP DATABASE auto_test_local; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test index 6c59deba5d0..8cb1a74f0ef 100644 --- a/storage/spider/mysql-test/spider/t/variable_deprecation.test +++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test @@ -126,6 +126,23 @@ eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1 DROP TABLE tbl_a; DROP TABLE tbl_b; +--echo # MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection +SET spider_semi_table_lock = 1; +SHOW VARIABLES LIKE "spider_semi_table_lock"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stl "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +SET spider_semi_table_lock_connection = 0; +SHOW VARIABLES LIKE "spider_semi_table_lock_connection"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stc "0"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock_connection "0"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + DROP DATABASE auto_test_local; --disable_query_log diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index e193b92f78a..158cd3c7a55 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -805,11 +805,11 @@ static int spider_param_semi_table_lock_check( */ static MYSQL_THDVAR_INT( semi_table_lock, /* name */ - PLUGIN_VAR_RQCMDARG, /* opt */ + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Table lock during execute a sql", /* comment */ &spider_param_semi_table_lock_check, /* check */ NULL, /* update */ - 1, /* def */ + 0, /* def */ 0, /* min */ 1, /* max */ 0 /* blk */ @@ -870,7 +870,7 @@ static int spider_param_semi_table_lock_connection_check( */ static MYSQL_THDVAR_INT( semi_table_lock_connection, /* name */ - PLUGIN_VAR_RQCMDARG, /* opt */ + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Use different connection if semi_table_lock is enabled", /* comment */ &spider_param_semi_table_lock_connection_check, /* check */ spider_var_deprecated_int, /* update */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index a1ed48e3374..2926329ebf9 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -2460,7 +2460,9 @@ int spider_parse_connect_info( #ifdef WITH_PARTITION_STORAGE_ENGINE SPIDER_PARAM_INT_WITH_MAX("ssy", sts_sync, 0, 2); #endif + SPIDER_PARAM_DEPRECATED_WARNING("stc"); SPIDER_PARAM_INT_WITH_MAX("stc", semi_table_lock_conn, 0, 1); + SPIDER_PARAM_DEPRECATED_WARNING("stl"); SPIDER_PARAM_INT_WITH_MAX("stl", semi_table_lock, 0, 1); SPIDER_PARAM_LONGLONG("srs", static_records_for_status, 0); SPIDER_PARAM_LONG_LIST_WITH_MAX("svc", tgt_ssl_vscs, 0, 1); @@ -2608,6 +2610,7 @@ int spider_parse_connect_info( SPIDER_PARAM_DEPRECATED_WARNING("internal_offset"); SPIDER_PARAM_LONGLONG("internal_offset", internal_offset, 0); SPIDER_PARAM_INT_WITH_MAX("reset_sql_alloc", reset_sql_alloc, 0, 1); + SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock"); SPIDER_PARAM_INT_WITH_MAX("semi_table_lock", semi_table_lock, 0, 1); SPIDER_PARAM_LONGLONG("quick_page_byte", quick_page_byte, 0); SPIDER_PARAM_LONGLONG("quick_page_size", quick_page_size, 0); @@ -2749,6 +2752,7 @@ int spider_parse_connect_info( error_num = connect_string_parse.print_param_error(); goto error; case 26: + SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock_connection"); SPIDER_PARAM_INT_WITH_MAX( "semi_table_lock_connection", semi_table_lock_conn, 0, 1); error_num = connect_string_parse.print_param_error(); From 2c1aaa666401140633c26fc0fb7757bda4e8bf88 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Mon, 27 Jun 2022 14:58:18 +0900 Subject: [PATCH 21/32] MDEV-28854 Disallow INSERT DELAYED on Spider table Spider supports (or at least allows) INSERT DELAYED but the documentation does not specify spider as a storage engine that supports "INSERT DELAYED". Also, although not mentioned in the documentation, "INSERT DELAYED" is not intended to be executed inside a transaction, as can be seen from the list of supported storage engines. The current implementation allows executing a delayed insert on a remote transactional table and this breaks the consistency ensured by the transaction. We too remove "internal_delayed", one of the Spider table parameters. Documentation says, > Whether to transmit existence of delay to remote servers when > executing an INSERT DELAYED statement on local server. This table parameter is only used for "INSERT DELAYED". Reviewed by: Nayuta Yanagisawa --- storage/spider/ha_spider.cc | 8 ----- storage/spider/ha_spider.h | 1 - .../spider/bugfix/r/mdev_28854.result | 32 +++++++++++++++++ .../mysql-test/spider/bugfix/t/mdev_28854.cnf | 3 ++ .../spider/bugfix/t/mdev_28854.test | 36 +++++++++++++++++++ storage/spider/spd_db_conn.h | 3 -- storage/spider/spd_db_mysql.cc | 16 --------- storage/spider/spd_include.h | 1 - storage/spider/spd_table.cc | 6 ---- 9 files changed, 71 insertions(+), 35 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 7f6b4ea1958..6559e28c970 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1110,9 +1110,6 @@ THR_LOCK_DATA **ha_spider::store_lock( case TL_READ_HIGH_PRIORITY: high_priority = TRUE; break; - case TL_WRITE_DELAYED: - insert_delayed = TRUE; - break; case TL_WRITE_LOW_PRIORITY: low_priority = TRUE; break; @@ -1222,7 +1219,6 @@ THR_LOCK_DATA **ha_spider::store_lock( lock_type = TL_READ; if ( lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE && - lock_type != TL_WRITE_DELAYED && !thd->in_lock_tables && !thd_tablespace_op(thd) ) lock_type = TL_WRITE_ALLOW_WRITE; @@ -1804,7 +1800,6 @@ int ha_spider::reset() insert_with_update = FALSE; low_priority = FALSE; high_priority = FALSE; - insert_delayed = FALSE; use_pre_call = FALSE; use_pre_records = FALSE; pre_bitmap_checked = FALSE; @@ -9556,7 +9551,6 @@ ulonglong ha_spider::table_flags() const HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_FILE_BASED | - HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_NO_COPY_ON_ALTER | HA_BINLOG_ROW_CAPABLE | @@ -13955,7 +13949,6 @@ int ha_spider::sync_from_clone_source( update_request = spider->update_request; lock_mode = spider->lock_mode; high_priority = spider->high_priority; - insert_delayed = spider->insert_delayed; low_priority = spider->low_priority; memcpy(conns, spider->conns, sizeof(SPIDER_CONN *) * share->link_count); @@ -13997,7 +13990,6 @@ int ha_spider::sync_from_clone_source( update_request = spider->update_request; lock_mode = spider->lock_mode; high_priority = spider->high_priority; - insert_delayed = spider->insert_delayed; low_priority = spider->low_priority; if ((error_num = spider_check_trx_and_get_conn(spider->trx->thd, diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 9ffe49754e8..811da1f00d3 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -168,7 +168,6 @@ public: bool insert_with_update; bool low_priority; bool high_priority; - bool insert_delayed; bool use_pre_call; bool use_pre_records; bool pre_bitmap_checked; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result new file mode 100644 index 00000000000..e5cee8d4ee2 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result @@ -0,0 +1,32 @@ +# +# MDEV-28854 Spider: Disallow INSERT DELAYED on Spider table +# +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); +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a ( +id INT +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +connection master_1; +INSERT DELAYED INTO tbl_a VALUES (1); +ERROR HY000: DELAYED option not supported for table 'tbl_a' +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test new file mode 100644 index 00000000000..47f4e57d4fc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test @@ -0,0 +1,36 @@ +--echo # +--echo # MDEV-28854 Spider: Disallow INSERT DELAYED on Spider table +--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; +CREATE TABLE tbl_a (id INT); + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; +eval CREATE TABLE tbl_a ( + id INT +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; + +--connection master_1 +--error ER_DELAYED_NOT_SUPPORTED +INSERT DELAYED INTO tbl_a VALUES (1); + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_query_log +--enable_result_log diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index fe58586c7f6..8fbca8ff0aa 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -33,7 +33,6 @@ #define SPIDER_DB_INSERT_IGNORE (1 << 1) #define SPIDER_DB_INSERT_LOW_PRIORITY (1 << 2) #define SPIDER_DB_INSERT_HIGH_PRIORITY (1 << 3) -#define SPIDER_DB_INSERT_DELAYED (1 << 4) #define SPIDER_SQL_OPEN_PAREN_STR "(" #define SPIDER_SQL_OPEN_PAREN_LEN (sizeof(SPIDER_SQL_OPEN_PAREN_STR) - 1) @@ -75,8 +74,6 @@ #define SPIDER_SQL_HIGH_PRIORITY_LEN (sizeof(SPIDER_SQL_HIGH_PRIORITY_STR) - 1) #define SPIDER_SQL_LOW_PRIORITY_STR "low_priority " #define SPIDER_SQL_LOW_PRIORITY_LEN (sizeof(SPIDER_SQL_LOW_PRIORITY_STR) - 1) -#define SPIDER_SQL_SQL_DELAYED_STR "delayed " -#define SPIDER_SQL_SQL_DELAYED_LEN (sizeof(SPIDER_SQL_SQL_DELAYED_STR) - 1) #define SPIDER_SQL_SQL_IGNORE_STR "ignore " #define SPIDER_SQL_SQL_IGNORE_LEN (sizeof(SPIDER_SQL_SQL_IGNORE_STR) - 1) #define SPIDER_SQL_FROM_STR " from " diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index c665aa62100..996c62a2f91 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -8044,7 +8044,6 @@ int spider_mbase_handler::append_insert( spider_string *str, int link_idx ) { - SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_mbase_handler::append_insert"); if ( ( @@ -8069,15 +8068,6 @@ int spider_mbase_handler::append_insert( DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_LOW_PRIORITY_STR, SPIDER_SQL_LOW_PRIORITY_LEN); } - else if (spider->insert_delayed) - { - if (share->internal_delayed) - { - if (str->reserve(SPIDER_SQL_SQL_DELAYED_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_DELAYED_STR, SPIDER_SQL_SQL_DELAYED_LEN); - } - } else if ( spider->lock_type >= TL_WRITE && !spider->write_can_replace && @@ -14667,12 +14657,6 @@ int spider_mbase_copy_table::append_insert_str( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_LOW_PRIORITY_STR, SPIDER_SQL_LOW_PRIORITY_LEN); } - else if (insert_flg & SPIDER_DB_INSERT_DELAYED) - { - if (sql.reserve(SPIDER_SQL_SQL_DELAYED_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_SQL_DELAYED_STR, SPIDER_SQL_SQL_DELAYED_LEN); - } else if (insert_flg & SPIDER_DB_INSERT_HIGH_PRIORITY) { if (sql.reserve(SPIDER_SQL_HIGH_PRIORITY_LEN)) diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index b0a3dae72ba..6f1c8f853d0 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -951,7 +951,6 @@ typedef struct st_spider_share int selupd_lock_mode; int query_cache; int query_cache_sync; - int internal_delayed; int bulk_size; int bulk_update_mode; int bulk_update_size; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 20347c4ebad..b7538677339 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -2035,7 +2035,6 @@ int spider_parse_connect_info( share->selupd_lock_mode = -1; share->query_cache = -1; share->query_cache_sync = -1; - share->internal_delayed = -1; share->bulk_size = -1; share->bulk_update_mode = -1; share->bulk_update_size = -1; @@ -2259,7 +2258,6 @@ int spider_parse_connect_info( SPIDER_PARAM_STR_LIST("hws", hs_write_socks); #endif SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0); - SPIDER_PARAM_INT_WITH_MAX("idl", internal_delayed, 0, 1); SPIDER_PARAM_LONGLONG("ilm", internal_limit, 0); SPIDER_PARAM_LONGLONG("ios", internal_offset, 0); SPIDER_PARAM_INT_WITH_MAX("iom", internal_optimize, 0, 1); @@ -2484,8 +2482,6 @@ int spider_parse_connect_info( "multi_split_read", multi_split_read, 0, 2147483647); SPIDER_PARAM_INT_WITH_MAX( "selupd_lock_mode", selupd_lock_mode, 0, 2); - SPIDER_PARAM_INT_WITH_MAX( - "internal_delayed", internal_delayed, 0, 1); SPIDER_PARAM_INT_WITH_MAX( "table_count_mode", table_count_mode, 0, 3); SPIDER_PARAM_INT_WITH_MAX( @@ -3809,8 +3805,6 @@ int spider_set_connect_info_default( share->query_cache = 0; if (share->query_cache_sync == -1) share->query_cache_sync = 0; - if (share->internal_delayed == -1) - share->internal_delayed = 0; if (share->bulk_size == -1) share->bulk_size = 16000; if (share->bulk_update_mode == -1) From c86b1389de5fe44fbd659bb50d95017bc19324a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 09:49:49 +0300 Subject: [PATCH 22/32] MDEV-28389: Simplify the InnoDB corrupted page output buf_page_print(): Dump the buffer page 32 bytes (64 hexadecimal digits) per line. In this way, the limitation in mtr ("Data too long for column 'line'") will not be triggered. Also, do not bother decoding the page contents, because everything is present in the hexadecimal output. dict_index_find_on_id_low(): Merge to dict_index_get_if_in_cache_low(). The direct call in buf_page_print() was prone to crashing, in case the table definition was concurrently evicted or dropped from the data dictionary cache. --- storage/innobase/buf/buf0buf.cc | 200 ++++----------------------- storage/innobase/dict/dict0dict.cc | 58 ++------ storage/innobase/handler/i_s.cc | 7 +- storage/innobase/include/dict0dict.h | 12 +- 4 files changed, 41 insertions(+), 236 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index aa6a6169db5..70ee0f58dc2 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2021, Oracle and/or its affiliates. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -68,6 +68,7 @@ Created 11/5/1995 Heikki Tuuri #include #include #include +#include "log.h" #ifndef UNIV_INNOCHECKSUM #include "fil0pagecompress.h" #include "fsp0pagecompress.h" @@ -1222,188 +1223,35 @@ buf_madvise_do_dump() } #endif +static inline byte hex_to_ascii(byte hex_digit) +{ + return hex_digit <= 9 ? '0' + hex_digit : ('a' - 10) + hex_digit; +} + /** Dump a page to stderr. @param[in] read_buf database page @param[in] page_size page size */ -UNIV_INTERN -void -buf_page_print(const byte* read_buf, const page_size_t& page_size) +ATTRIBUTE_COLD +void buf_page_print(const byte *read_buf, const page_size_t &page_size) { - dict_index_t* index; - #ifndef UNIV_DEBUG - ib::info() << "Page dump in ascii and hex (" - << page_size.physical() << " bytes):"; + const size_t size= page_size.physical(); + const byte * const end= read_buf + size; + sql_print_information("InnoDB: Page dump (%zu bytes):", size); - ut_print_buf(stderr, read_buf, page_size.physical()); - fputs("\nInnoDB: End of page dump\n", stderr); + do + { + 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); + + sql_print_information("InnoDB: %.*s", 64, row); + } + while (read_buf != end); + + sql_print_information("InnoDB: End of page dump"); #endif - - if (page_size.is_compressed()) { - /* Print compressed page. */ - ib::info() << "Compressed page type (" - << fil_page_get_type(read_buf) - << "); stored checksum in field1 " - << mach_read_from_4( - read_buf + FIL_PAGE_SPACE_OR_CHKSUM) - << "; calculated checksums for field1: " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_CRC32) - << " " - << page_zip_calc_checksum( - read_buf, page_size.physical(), - SRV_CHECKSUM_ALGORITHM_CRC32) -#ifdef INNODB_BUG_ENDIAN_CRC32 - << "/" - << page_zip_calc_checksum( - read_buf, page_size.physical(), - SRV_CHECKSUM_ALGORITHM_CRC32, true) -#endif - << ", " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_INNODB) - << " " - << page_zip_calc_checksum( - read_buf, page_size.physical(), - SRV_CHECKSUM_ALGORITHM_INNODB) - << ", " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_NONE) - << " " - << page_zip_calc_checksum( - read_buf, page_size.physical(), - SRV_CHECKSUM_ALGORITHM_NONE) - << "; page LSN " - << mach_read_from_8(read_buf + FIL_PAGE_LSN) - << "; page number (if stored to page" - << " already) " - << mach_read_from_4(read_buf + FIL_PAGE_OFFSET) - << "; space id (if stored to page already) " - << mach_read_from_4( - read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - - } else { - const uint32_t crc32 = buf_calc_page_crc32(read_buf); -#ifdef INNODB_BUG_ENDIAN_CRC32 - const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf, - true); -#endif /* INNODB_BUG_ENDIAN_CRC32 */ - ulint page_type = fil_page_get_type(read_buf); - - ib::info() << "Uncompressed page, stored checksum in field1 " - << mach_read_from_4( - read_buf + FIL_PAGE_SPACE_OR_CHKSUM) - << ", calculated checksums for field1: " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_CRC32) << " " - << crc32 -#ifdef INNODB_BUG_ENDIAN_CRC32 - << "/" << crc32_legacy -#endif - << ", " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_INNODB) << " " - << buf_calc_page_new_checksum(read_buf) - << ", " - << " page type " << page_type << " == " - << fil_get_page_type_name(page_type) << "." - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_NONE) << " " - << BUF_NO_CHECKSUM_MAGIC - << ", stored checksum in field2 " - << mach_read_from_4(read_buf + page_size.logical() - - FIL_PAGE_END_LSN_OLD_CHKSUM) - << ", calculated checksums for field2: " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_CRC32) << " " - << crc32 -#ifdef INNODB_BUG_ENDIAN_CRC32 - << "/" << crc32_legacy -#endif - << ", " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_INNODB) << " " - << buf_calc_page_old_checksum(read_buf) - << ", " - << buf_checksum_algorithm_name( - SRV_CHECKSUM_ALGORITHM_NONE) << " " - << BUF_NO_CHECKSUM_MAGIC - << ", page LSN " - << mach_read_from_4(read_buf + FIL_PAGE_LSN) - << " " - << mach_read_from_4(read_buf + FIL_PAGE_LSN + 4) - << ", low 4 bytes of LSN at page end " - << mach_read_from_4(read_buf + page_size.logical() - - FIL_PAGE_END_LSN_OLD_CHKSUM + 4) - << ", page number (if stored to page already) " - << mach_read_from_4(read_buf + FIL_PAGE_OFFSET) - << ", space id (if created with >= MySQL-4.1.1" - " and stored already) " - << mach_read_from_4( - read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - } - - switch (fil_page_get_type(read_buf)) { - index_id_t index_id; - case FIL_PAGE_INDEX: - case FIL_PAGE_TYPE_INSTANT: - case FIL_PAGE_RTREE: - index_id = btr_page_get_index_id(read_buf); - ib::info() << "Page may be an index page where" - " index id is " << index_id; - - index = dict_index_find_on_id_low(index_id); - if (index) { - ib::info() - << "Index " << index_id - << " is " << index->name - << " in table " << index->table->name; - } - break; - case FIL_PAGE_UNDO_LOG: - fputs("InnoDB: Page may be an undo log page\n", stderr); - break; - case FIL_PAGE_INODE: - fputs("InnoDB: Page may be an 'inode' page\n", stderr); - break; - case FIL_PAGE_IBUF_FREE_LIST: - fputs("InnoDB: Page may be an insert buffer free list page\n", - stderr); - break; - case FIL_PAGE_TYPE_ALLOCATED: - fputs("InnoDB: Page may be a freshly allocated page\n", - stderr); - break; - case FIL_PAGE_IBUF_BITMAP: - fputs("InnoDB: Page may be an insert buffer bitmap page\n", - stderr); - break; - case FIL_PAGE_TYPE_SYS: - fputs("InnoDB: Page may be a system page\n", - stderr); - break; - case FIL_PAGE_TYPE_TRX_SYS: - fputs("InnoDB: Page may be a transaction system page\n", - stderr); - break; - case FIL_PAGE_TYPE_FSP_HDR: - fputs("InnoDB: Page may be a file space header page\n", - stderr); - break; - case FIL_PAGE_TYPE_XDES: - fputs("InnoDB: Page may be an extent descriptor page\n", - stderr); - break; - case FIL_PAGE_TYPE_BLOB: - fputs("InnoDB: Page may be a BLOB page\n", - stderr); - break; - case FIL_PAGE_TYPE_ZBLOB: - case FIL_PAGE_TYPE_ZBLOB2: - fputs("InnoDB: Page may be a compressed BLOB page\n", - stderr); - break; - } } # ifdef PFS_GROUP_BUFFER_SYNC diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index f8c276fe75c..9f99a88982e 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1352,48 +1352,6 @@ dict_table_find_index_on_id( return(NULL); } -/**********************************************************************//** -Looks for an index with the given id. NOTE that we do not reserve -the dictionary mutex: this function is for emergency purposes like -printing info of a corrupt database page! -@return index or NULL if not found in cache */ -dict_index_t* -dict_index_find_on_id_low( -/*======================*/ - index_id_t id) /*!< in: index id */ -{ - dict_table_t* table; - - /* This can happen if the system tablespace is the wrong page size */ - if (dict_sys == NULL) { - return(NULL); - } - - for (table = UT_LIST_GET_FIRST(dict_sys->table_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - - dict_index_t* index = dict_table_find_index_on_id(table, id); - - if (index != NULL) { - return(index); - } - } - - for (table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - - dict_index_t* index = dict_table_find_index_on_id(table, id); - - if (index != NULL) { - return(index); - } - } - - return(NULL); -} - /** Function object to remove a foreign key constraint from the referenced_set of the referenced table. The foreign key object is also removed from the dictionary cache. The foreign key constraint @@ -4939,9 +4897,19 @@ dict_index_get_if_in_cache_low( /*===========================*/ index_id_t index_id) /*!< in: index id */ { - ut_ad(mutex_own(&dict_sys->mutex)); + ut_ad(mutex_own(&dict_sys->mutex)); - return(dict_index_find_on_id_low(index_id)); + for (dict_table_t *table= UT_LIST_GET_FIRST(dict_sys->table_LRU); + table; table= UT_LIST_GET_NEXT(table_LRU, table)) + if (dict_index_t *index= dict_table_find_index_on_id(table, index_id)) + return index; + + for (dict_table_t *table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU); + table; table= UT_LIST_GET_NEXT(table_LRU, table)) + if (dict_index_t *index= dict_table_find_index_on_id(table, index_id)) + return index; + + return NULL; } #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 8fc40aa2856..ff0bb9b9129 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2021, MariaDB Corporation. +Copyright (c) 2014, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1405,9 +1405,8 @@ i_s_cmp_per_index_fill_low( for (iter = snap.begin(), i = 0; iter != snap.end(); iter++, i++) { - dict_index_t* index = dict_index_find_on_id_low(iter->first); - - if (index != NULL) { + if (dict_index_t* index + = dict_index_get_if_in_cache_low(iter->first)) { char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 6f0479a6e77..93fcfc75ff5 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1033,16 +1033,6 @@ dict_table_copy_types( const dict_table_t* table) /*!< in: table */ MY_ATTRIBUTE((nonnull)); /**********************************************************************//** -Looks for an index with the given id. NOTE that we do not reserve -the dictionary mutex: this function is for emergency purposes like -printing info of a corrupt database page! -@return index or NULL if not found from cache */ -dict_index_t* -dict_index_find_on_id_low( -/*======================*/ - index_id_t id) /*!< in: index id */ - MY_ATTRIBUTE((warn_unused_result)); -/**********************************************************************//** Make room in the table cache by evicting an unused table. The unused table should not be part of FK relationship and currently not used in any user transaction. There is no guarantee that it will remove a table. From dd7e9fb38a71064992a12ca58b5366f48b21e0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 10:47:05 +0300 Subject: [PATCH 23/32] MDEV-28854 after-merge fix: Remove a test for MDEV-26583 --- .../spider/bugfix/r/mdev_26583.result | 34 -------------- .../mysql-test/spider/bugfix/t/mdev_26583.cnf | 3 -- .../spider/bugfix/t/mdev_26583.test | 44 ------------------- 3 files changed, 81 deletions(-) delete mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_26583.result delete mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_26583.cnf delete mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_26583.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26583.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26583.result deleted file mode 100644 index 0ce268af7e3..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_26583.result +++ /dev/null @@ -1,34 +0,0 @@ -# -# MDEV-26583 SIGSEGV's in spider_get_select_limit_from_select_lex when DELAYED INSERT is used -# -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 ( -a INT AUTO_INCREMENT KEY, -b INT,INDEX i (b) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -connection master_1; -CREATE DATABASE auto_test_local; -USE auto_test_local; -CREATE TABLE tbl_a ( -a INT AUTO_INCREMENT KEY, -b INT,INDEX i (b) -) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "tbl_a"'; -INSERT DELAYED INTO tbl_a VALUES (0,0),(0,0),(0,0); -connection master_1; -DROP DATABASE auto_test_local; -connection child2_1; -DROP DATABASE auto_test_remote; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.cnf deleted file mode 100644 index 05dfd8a0bce..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.cnf +++ /dev/null @@ -1,3 +0,0 @@ -!include include/default_mysqld.cnf -!include ../my_1_1.cnf -!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.test deleted file mode 100644 index e4a2d64ba6d..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26583.test +++ /dev/null @@ -1,44 +0,0 @@ ---echo # ---echo # MDEV-26583 SIGSEGV's in spider_get_select_limit_from_select_lex when DELAYED INSERT is used ---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 ( - a INT AUTO_INCREMENT KEY, - b INT,INDEX i (b) -) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; - ---connection master_1 -CREATE DATABASE auto_test_local; -USE auto_test_local; - -eval CREATE TABLE tbl_a ( - a INT AUTO_INCREMENT KEY, - b INT,INDEX i (b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='srv "s_2_1", table "tbl_a"'; - -INSERT DELAYED INTO tbl_a VALUES (0,0),(0,0),(0,0); - -let $wait_condition=select count(*)=3 from tbl_a -source include/wait_condition.inc; - ---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 From 03174cabd71e0e72746736a3abf24af3931292d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 10:49:15 +0300 Subject: [PATCH 24/32] Fix GCC -Og -Wmaybe-uninitialized --- storage/spider/spd_sys_table.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index a467c2c00fa..20405757873 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -2982,14 +2982,17 @@ int spider_get_sys_link_mon_key( DBUG_RETURN(ER_SPIDER_SYS_TABLE_VERSION_NUM); } - if ( - !(db_name = get_field(mem_root, - table->field[SPIDER_LINK_MON_SERVERS_DB_NAME_POS])) || - !(table_name = get_field(mem_root, - table->field[SPIDER_LINK_MON_SERVERS_TABLE_NAME_POS])) || - !(link_id = get_field(mem_root, - table->field[SPIDER_LINK_MON_SERVERS_LINK_ID_POS])) - ) + if (!(db_name= + get_field(mem_root, + table->field[SPIDER_LINK_MON_SERVERS_DB_NAME_POS]))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if (!(table_name= + get_field(mem_root, + table->field[SPIDER_LINK_MON_SERVERS_TABLE_NAME_POS]))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if (!(link_id= + get_field(mem_root, + table->field[SPIDER_LINK_MON_SERVERS_LINK_ID_POS]))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); db_name_length = strlen(db_name); From 7d92c9d212162287b52721fcea1217115853b4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 11:03:52 +0300 Subject: [PATCH 25/32] Suppress a message that may be emitted on slow systems On FreeBSD, tests run on persistent storage, and no asynchronous I/O has been implemented. Warnings about 205-second waits on dict_sys.latch may occur. --- mysql-test/suite/innodb/t/corrupted_during_recovery.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test index 345c86badb2..fd3ddaa8204 100644 --- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test @@ -8,6 +8,7 @@ call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed r call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted."); call mtr.add_suppression("InnoDB: Table `test`.`t1` is corrupted. Please drop the table and recreate."); call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted"); +call mtr.add_suppression("InnoDB: A long wait .* was observed for dict_sys"); --enable_query_log let INNODB_PAGE_SIZE=`select @@innodb_page_size`; From 0bed4d72c03184ceaafb82a0a4b7d8deea55bd61 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 24 Jun 2022 17:21:31 +0400 Subject: [PATCH 26/32] MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER Now INSERT, UPDATE, ALTER statements involving incompatible data type pairs, e.g.: UPDATE TABLE t1 SET col_inet6=col_int; INSERT INTO t1 (col_inet6) SELECT col_in FROM t2; ALTER TABLE t1 MODIFY col_inet6 INT; consistently return an error at the statement preparation time: ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' and abort the statement before starting interating rows. This error is the same with what is raised for queries like: SELECT col_inet6 FROM t1 UNION SELECT col_int FROM t2; SELECT COALESCE(col_inet6, col_int) FROM t1; Before this change the error was caught only during the execution time, when a Field_xxx::store_xxx() was called for the very firts row. The behavior was not consistent between various statements and could do different things: - abort the statement - set a column to the data type default value (e.g. '::' for INET6) - set a column to NULL A typical old error was: ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1 EXCEPTION: Note, there is an exception: a multi-row INSERT..VALUES, e.g.: INSERT INTO t1 (col_a,col_b) VALUES (a1,b1),(a2,b2); checks assignment compability at the preparation time for the very first row only: (col_a,col_b) vs (a1,b1) Other rows are still checked at the execution time and return the old warnings or errors in case of a failure. This is done because catching all rows at the preparation time would change behavior significantly. So it still works according to the STRICT_XXX_TABLES sql_mode flags and the table transaction ability. This is too late to change this behavior in 10.7. There is no a firm decision yet if a multi-row INSERT..VALUES behavior will change in later versions. --- mysql-test/include/gis_generic.inc | 4 +- mysql-test/include/type_mix_incompatible.inc | 137 ++++++++++++ mysql-test/main/get_diagnostics.result | 8 +- mysql-test/main/get_diagnostics.test | 4 +- mysql-test/main/gis.result | 4 +- mysql-test/main/gis.test | 4 +- mysql-test/main/type_geometry_mix_int.result | 192 +++++++++++++++++ mysql-test/main/type_geometry_mix_int.test | 19 ++ mysql-test/suite/archive/archive_gis.result | 4 +- mysql-test/suite/innodb/r/innodb_gis.result | 4 +- mysql-test/suite/innodb_gis/r/0.result | 4 +- mysql-test/suite/innodb_gis/r/1.result | 4 +- mysql-test/suite/innodb_gis/r/gis.result | 4 +- mysql-test/suite/innodb_gis/t/1.test | 4 +- mysql-test/suite/innodb_gis/t/gis.test | 4 +- .../mysql-test/type_inet/type_inet6.result | 48 ++--- .../mysql-test/type_inet/type_inet6.test | 49 +++-- .../type_inet/type_inet6_mix_decimal.result | 195 ++++++++++++++++++ .../type_inet/type_inet6_mix_decimal.test | 19 ++ .../type_inet/type_inet6_mix_double.result | 195 ++++++++++++++++++ .../type_inet/type_inet6_mix_double.test | 19 ++ .../type_inet/type_inet6_mix_int.result | 195 ++++++++++++++++++ .../type_inet/type_inet6_mix_int.test | 19 ++ .../type_inet/type_inet6_mix_time.result | 195 ++++++++++++++++++ .../type_inet/type_inet6_mix_time.test | 19 ++ .../type_inet/type_inet6_mix_uint.result | 195 ++++++++++++++++++ .../type_inet/type_inet6_mix_uint.test | 19 ++ plugin/type_mysql_json/type.cc | 12 ++ .../mysql-test/type_uuid/type_uuid.result | 42 ++-- .../mysql-test/type_uuid/type_uuid.test | 42 ++-- .../type_uuid/type_uuid_mix_decimal.result | 195 ++++++++++++++++++ .../type_uuid/type_uuid_mix_decimal.test | 19 ++ .../type_uuid/type_uuid_mix_double.result | 195 ++++++++++++++++++ .../type_uuid/type_uuid_mix_double.test | 19 ++ .../type_uuid/type_uuid_mix_int.result | 195 ++++++++++++++++++ .../type_uuid/type_uuid_mix_int.test | 19 ++ .../type_uuid/type_uuid_mix_time.result | 195 ++++++++++++++++++ .../type_uuid/type_uuid_mix_time.test | 19 ++ .../type_uuid/type_uuid_mix_uint.result | 195 ++++++++++++++++++ .../type_uuid/type_uuid_mix_uint.test | 19 ++ sql/field.cc | 26 +++ sql/field.h | 6 + sql/item.cc | 16 ++ sql/item.h | 19 ++ sql/sql_insert.cc | 42 +++- sql/sql_table.cc | 2 + sql/sql_update.cc | 6 +- sql/table.cc | 54 +++++ sql/table.h | 21 ++ 49 files changed, 2805 insertions(+), 120 deletions(-) create mode 100644 mysql-test/include/type_mix_incompatible.inc create mode 100644 mysql-test/main/type_geometry_mix_int.result create mode 100644 mysql-test/main/type_geometry_mix_int.test create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result create mode 100644 plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result create mode 100644 plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc index 8209240614e..c693b86b896 100644 --- a/mysql-test/include/gis_generic.inc +++ b/mysql-test/include/gis_generic.inc @@ -180,9 +180,9 @@ insert IGNORE into t1 (a) values ('Garbage'); drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 (fl) values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 (fl) values (1.11); --error 1416 insert into t1 (fl) values ("qwerty"); diff --git a/mysql-test/include/type_mix_incompatible.inc b/mysql-test/include/type_mix_incompatible.inc new file mode 100644 index 00000000000..8f0eb4fb70c --- /dev/null +++ b/mysql-test/include/type_mix_incompatible.inc @@ -0,0 +1,137 @@ +--echo # Start of type_store_assignment_incompatible.inc + +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); + +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); + +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; + +# +# Single row INSERT..VALUES +# + +CREATE TABLE t3 LIKE t2; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 VALUES + (1, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +DROP TABLE t3; + +# +# Multi-row INSERT..VALUES +# + +# INSERT .. VALUES checks assignment compatibility for the first row only. +# Here the first row is compatible, so no error happens. +# The second row is not compatible. It works according to the +# current sql_mode and the table transaction ability, so it can: +# (a) either raise a warning +# (b) or escalate a warning to an error and abort on the current row +# (c) or escalate a warning to an error and rollback +# Here we test (a) and (b). + +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE + CONCAT('CREATE VIEW v3 AS SELECT id,', + IF(@target_type='geometry','AsText(target)','target'), ' AS target,', + IF(@source_type='geometry','AsText(source)','source'), ' AS source ', + ' FROM t3'); + +--error 0,ER_CANT_CREATE_GEOMETRY_OBJECT +INSERT INTO t3 VALUES + (1, + (SELECT target FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)), + (2, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +SELECT * FROM v3; +TRUNCATE TABLE t3; + +SET sql_mode=STRICT_ALL_TABLES; +--error ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, WARN_DATA_TRUNCATED, ER_CANT_CREATE_GEOMETRY_OBJECT +INSERT INTO t3 VALUES + (1, + (SELECT target FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)), + (2, + (SELECT source FROM t2 ORDER BY id LIMIT 1), + (SELECT source FROM t2 ORDER BY id LIMIT 1)); +SELECT * FROM v3; +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; + +# +# INSERT .. SELECT +# + +CREATE TABLE t3 LIKE t2; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 SELECT id,source,source FROM t2; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; + +# +# INSERT .. VALUES .. ON DUPLICATE KEY UPDATE target=source +# + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; + +# +# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE target=source +# + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; + + +# +# UPDATE +# +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t3 SET target=source; + + +# +# UPDATE, multi-table +# + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; + + +# +# ALTER +# + +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +EXECUTE IMMEDIATE @alter; + + +DROP TABLE t3; +DROP TABLE t2; +--echo # End of type_store_assignment_incompatible.inc diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result index 47fd30f0dc7..697b3a589d7 100644 --- a/mysql-test/main/get_diagnostics.result +++ b/mysql-test/main/get_diagnostics.result @@ -1152,11 +1152,11 @@ SELECT @var62, @var63; @var62 @var63 1 NULL INSERT INTO t1 SELECT id2, val2, p2 from t2; -ERROR 22007: Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +ERROR HY000: Illegal parameter data types double and point for operation 'SET' GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER; Warnings: -Error 1366 Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +Error 4078 Illegal parameter data types double and point for operation 'SET' Error 1758 Invalid condition number SELECT @var64, @var65; @var64 @var65 @@ -1396,11 +1396,11 @@ SELECT @var103, @var104; @var103 @var104 1 NULL INSERT INTO t1 SELECT id2, val2, p2 from t2; -ERROR 22007: Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +ERROR HY000: Illegal parameter data types double and point for operation 'SET' GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER; Warnings: -Error 1366 Incorrect double value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x004@\x00\x00\x00\x00\x00\x00$@' for column `test`.`t1`.`d1` at row 1 +Error 4078 Illegal parameter data types double and point for operation 'SET' Error 1758 Invalid condition number SELECT @var105, @var106; @var105 @var106 diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index 8576d2ed8c1..01063551b9b 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -1091,7 +1091,7 @@ GET DIAGNOSTICS CONDITION 1 @var62= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var63= ROW_NUMBER; SELECT @var62, @var63; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 SELECT id2, val2, p2 from t2; GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER; @@ -1277,7 +1277,7 @@ GET DIAGNOSTICS CONDITION 1 @var103= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var104= ROW_NUMBER; SELECT @var103, @var104; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 SELECT id2, val2, p2 from t2; GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER; GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER; diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index f941447a677..88cd55c0251 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -688,9 +688,9 @@ object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (pointfromtext('point(1,1)')); diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 17a93291b77..f1fed747d51 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -366,9 +366,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result new file mode 100644 index 00000000000..6511a0fcea6 --- /dev/null +++ b/mysql-test/main/type_geometry_mix_int.result @@ -0,0 +1,192 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` geometry DEFAULT point(1,1), + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +SELECT * FROM v3; +id target source +1 POINT(1 1) 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 POINT(1 1) 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1)); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` geometry DEFAULT point(1,1), + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect integer value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 POINT(1 1) +2 0 POINT(1 1) +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 POINT(1 1) +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target geometry +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/mysql-test/main/type_geometry_mix_int.test b/mysql-test/main/type_geometry_mix_int.test new file mode 100644 index 00000000000..1c64a13e1e8 --- /dev/null +++ b/mysql-test/main/type_geometry_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1)); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/mysql-test/suite/archive/archive_gis.result b/mysql-test/suite/archive/archive_gis.result index e24cad80702..25854db1feb 100644 --- a/mysql-test/suite/archive/archive_gis.result +++ b/mysql-test/suite/archive/archive_gis.result @@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 (fl) values (pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index 90fc5be1e73..c222e7d053a 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 (fl) values (pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result index 6dd2cd16437..3f72baadd12 100644 --- a/mysql-test/suite/innodb_gis/r/0.result +++ b/mysql-test/suite/innodb_gis/r/0.result @@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; create table t1 (pk integer primary key auto_increment, fl geometry not null); insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 (fl) values (pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index f8db53a4ca9..53750015716 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -660,9 +660,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (ST_pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index f41fcab5bbb..5f7ca9e03fe 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -661,9 +661,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo)) drop table t1; create table t1 (fl geometry not null); insert into t1 values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' insert into t1 values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +ERROR HY000: Illegal parameter data types geometry and decimal for operation 'SET' insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (ST_pointfromtext('point(1,1)')); diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index 950db360794..99651842795 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -387,9 +387,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index 966aea7bc77..b27e1852d6e 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -380,9 +380,9 @@ t1 where object_id=85984; drop table t1; create table t1 (fl geometry not null); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1); ---error 1416 +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index 9f3b8a9715e..932f3a68625 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -192,9 +192,9 @@ CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('x'); ERROR 22007: Incorrect inet6 value: 'x' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (1); -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' INSERT INTO t1 VALUES (TIME'10:20:30'); -ERROR 22007: Incorrect inet6 value: '10:20:30' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' INSERT INTO t1 VALUES (0x00); ERROR 22007: Incorrect inet6 value: '\x00' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; @@ -820,15 +820,15 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect double value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); INSERT INTO t1 VALUES (CAST('::' AS INET6)); -ERROR 22007: Incorrect decimal value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(64)); INSERT INTO t1 VALUES (CAST('::' AS INET6)); @@ -1606,7 +1606,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1614,7 +1614,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DOUBLE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect double value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1622,7 +1622,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect decimal value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1630,7 +1630,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b YEAR); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types year and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1641,7 +1641,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' SELECT b FROM t1; b NULL @@ -1649,7 +1649,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' SELECT b FROM t1; b NULL @@ -1657,7 +1657,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' SELECT b FROM t1; b NULL @@ -1665,7 +1665,7 @@ DROP TABLE t1; CREATE TABLE t1 (a YEAR, b INET6); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and year for operation 'SET' SELECT b FROM t1; b NULL @@ -1676,7 +1676,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect time value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1684,7 +1684,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect date value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types date and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1692,7 +1692,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATETIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types datetime and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1700,7 +1700,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffff::ffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffff::ffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types timestamp and inet6 for operation 'SET' SELECT b FROM t1; b NULL @@ -1711,7 +1711,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b INET6); INSERT INTO t1 VALUES ('00:00:00', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '00:00:00' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' SELECT b FROM t1; b NULL @@ -1719,7 +1719,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE, b INET6); INSERT INTO t1 VALUES ('2001-01:01', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and date for operation 'SET' SELECT b FROM t1; b NULL @@ -1727,7 +1727,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and datetime for operation 'SET' SELECT b FROM t1; b NULL @@ -1735,7 +1735,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect inet6 value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types inet6 and timestamp for operation 'SET' SELECT b FROM t1; b NULL @@ -1922,7 +1922,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 (a) VALUES ('::'); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: '::' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' SELECT * FROM t1; a b :: NULL @@ -1931,7 +1931,7 @@ SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a INET6, b TIMESTAMP); INSERT INTO t1 (a) VALUES ('::'); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: '::' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types timestamp and inet6 for operation 'SET' SELECT * FROM t1; a b :: 2001-01-01 10:20:30 @@ -1940,7 +1940,7 @@ SET timestamp=DEFAULT; CREATE OR REPLACE TABLE t1 (a INET6); INSERT INTO t1 (a) VALUES ('::'); ALTER TABLE t1 MODIFY a DATE; -ERROR 22007: Incorrect date value: '::' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types date and inet6 for operation 'SET' DROP TABLE t1; # # MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index ef8399d981f..72059bd060c 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1,4 +1,3 @@ - --echo # --echo # Basic CREATE functionality, defaults, metadata --echo # @@ -48,9 +47,9 @@ CREATE TABLE t1 (c1 INET6 DEFAULT ''); CREATE TABLE t1 (a INET6); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('x'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (1); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (TIME'10:20:30'); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES (0x00); @@ -447,17 +446,17 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INT); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('::' AS INET6)); DROP TABLE t1; @@ -1095,28 +1094,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DOUBLE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b YEAR); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1128,28 +1127,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a YEAR, b INET6); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1161,28 +1160,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATE); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b DATETIME); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a INET6, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffff::ffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1194,28 +1193,28 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b INET6); INSERT INTO t1 VALUES ('00:00:00', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATE, b INET6); INSERT INTO t1 VALUES ('2001-01:01', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b INET6); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1406,7 +1405,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6, b INT); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT * FROM t1; DROP TABLE t1; @@ -1414,7 +1413,7 @@ DROP TABLE t1; SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); CREATE TABLE t1 (a INET6, b TIMESTAMP); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT * FROM t1; DROP TABLE t1; @@ -1422,7 +1421,7 @@ SET timestamp=DEFAULT; CREATE OR REPLACE TABLE t1 (a INET6); INSERT INTO t1 (a) VALUES ('::'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION ALTER TABLE t1 MODIFY a DATE; DROP TABLE t1; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result new file mode 100644 index 00000000000..c045bbe7769 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` decimal(38,0) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target decimal(38,0) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` decimal(38,0) DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test new file mode 100644 index 00000000000..9696d313790 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result new file mode 100644 index 00000000000..cd658dbab1a --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test new file mode 100644 index 00000000000..8fc0e24d177 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result new file mode 100644 index 00000000000..67052350187 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test new file mode 100644 index 00000000000..21a47e39f90 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result new file mode 100644 index 00000000000..042a9203fd6 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source TIME DEFAULT '00:00:00'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` time DEFAULT '00:00:00', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 00:00:00 +2 :: 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 :: 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target time +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` time DEFAULT '00:00:00', + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 :: +2 00:00:00 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00:00:00 :: +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test new file mode 100644 index 00000000000..7ffb3133d0c --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source TIME DEFAULT '00:00:00'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result new file mode 100644 index 00000000000..579aee6e3fd --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT UNSIGNED DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` inet6 DEFAULT '::', + `source` int(10) unsigned DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 :: 0 +2 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 :: 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(10) unsigned +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source INET6 DEFAULT '::0'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(10) unsigned DEFAULT 0, + `source` inet6 DEFAULT '::', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1366 Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 0 :: +2 0 :: +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 :: +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target inet6 +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test new file mode 100644 index 00000000000..7506b56742f --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT UNSIGNED DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source INET6 DEFAULT '::0'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc index 7e6576e5df4..ef8c97cfc1c 100644 --- a/plugin/type_mysql_json/type.cc +++ b/plugin/type_mysql_json/type.cc @@ -40,6 +40,18 @@ public: void Column_definition_reuse_fix_attributes(THD *thd, Column_definition *def, const Field *field) const override; + const Type_handler *type_handler_base() const override + { + /* + Override this method in the same way with what Type_handler_blob_json + does, to tell the server that MySQL JSON inherits aggregation behaviour + from the LONGBLOB data type. + This makes MariaDB JSON column and a MySQL JSON column compatible for + assignment, so "ALTER TABLE table_with_mysql_json FORCE" can run without + raising ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION. + */ + return &type_handler_long_blob; + } }; Type_handler_mysql_json type_handler_mysql_json; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result index 7ce3b878a1a..adcafc51ece 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -195,9 +195,9 @@ CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('x'); ERROR 22007: Incorrect uuid value: 'x' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (1); -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' INSERT INTO t1 VALUES (TIME'10:20:30'); -ERROR 22007: Incorrect uuid value: '10:20:30' for column `test`.`t1`.`a` at row 1 +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' INSERT INTO t1 VALUES (0x00); ERROR 22007: Incorrect uuid value: '\x00' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; @@ -1931,15 +1931,15 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); -ERROR 01000: Data truncated for column 'a' at row 1 +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(64)); INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); @@ -2762,7 +2762,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b INT); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2770,7 +2770,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DOUBLE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect double value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2778,7 +2778,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect decimal value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2786,7 +2786,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b YEAR); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect integer value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types year and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2797,7 +2797,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' SELECT b FROM t1; b NULL @@ -2805,7 +2805,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' SELECT b FROM t1; b NULL @@ -2813,7 +2813,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '1' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' SELECT b FROM t1; b NULL @@ -2821,7 +2821,7 @@ DROP TABLE t1; CREATE TABLE t1 (a YEAR, b UUID); INSERT INTO t1 VALUES (1, NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and year for operation 'SET' SELECT b FROM t1; b NULL @@ -2832,7 +2832,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect time value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2840,7 +2840,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect date value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types date and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2848,7 +2848,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATETIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types datetime and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2856,7 +2856,7 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect datetime value: 'ffffffff-ffff-ffff-ffff-ffffffffffff' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types timestamp and uuid for operation 'SET' SELECT b FROM t1; b NULL @@ -2867,7 +2867,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b UUID); INSERT INTO t1 VALUES ('00:00:00', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '00:00:00' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' SELECT b FROM t1; b NULL @@ -2875,7 +2875,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE, b UUID); INSERT INTO t1 VALUES ('2001-01:01', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and date for operation 'SET' SELECT b FROM t1; b NULL @@ -2883,7 +2883,7 @@ DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and datetime for operation 'SET' SELECT b FROM t1; b NULL @@ -2891,7 +2891,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); UPDATE t1 SET b=a; -ERROR 22007: Incorrect uuid value: '2001-01-01 10:20:30' for column `test`.`t1`.`b` at row 1 +ERROR HY000: Illegal parameter data types uuid and timestamp for operation 'SET' SELECT b FROM t1; b NULL diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index 4a3525a783c..91f8f82125b 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -51,9 +51,9 @@ CREATE TABLE t1 (c1 UUID DEFAULT ''); CREATE TABLE t1 (a UUID); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('x'); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (1); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (TIME'10:20:30'); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES (0x00); @@ -542,17 +542,17 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INT); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0)); ---error WARN_DATA_TRUNCATED +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); DROP TABLE t1; @@ -1250,28 +1250,28 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b INT); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DOUBLE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b YEAR); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1283,28 +1283,28 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DOUBLE, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(32,0), b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a YEAR, b UUID); INSERT INTO t1 VALUES (1, NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1316,28 +1316,28 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATE); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b DATETIME); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; @@ -1349,28 +1349,28 @@ DROP TABLE t1; CREATE TABLE t1 (a TIME, b UUID); INSERT INTO t1 VALUES ('00:00:00', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATE, b UUID); INSERT INTO t1 VALUES ('2001-01:01', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP, b UUID); INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); ---error ER_TRUNCATED_WRONG_VALUE +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION UPDATE t1 SET b=a; SELECT b FROM t1; DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result new file mode 100644 index 00000000000..7fc9d0a9d38 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` decimal(38,0) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target decimal(38,0) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` decimal(38,0) DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test new file mode 100644 index 00000000000..234e31b6565 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result new file mode 100644 index 00000000000..87b3b1ecfb3 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` double DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test new file mode 100644 index 00000000000..8e8529aeed3 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result new file mode 100644 index 00000000000..404581ee519 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(11) DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test new file mode 100644 index 00000000000..79a55566258 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result new file mode 100644 index 00000000000..99efe1b579c --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` time DEFAULT '00:00:00', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +2 00000000-0000-0000-0000-000000000000 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target time +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` time DEFAULT '00:00:00', + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +2 00:00:00 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test new file mode 100644 index 00000000000..5182d0ceebd --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result new file mode 100644 index 00000000000..8f7236dab20 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result @@ -0,0 +1,195 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(10) unsigned DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(10) unsigned +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='source' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS +WHERE COLUMN_NAME='target' + AND TABLE_NAME='t1' + AND TABLE_SCHEMA='test'); +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; +INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `target` int(10) unsigned DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 VALUES +(1, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP TABLE t3; +SET sql_mode=''; +CREATE TABLE t3 LIKE t2; +ALTER TABLE t3 ENGINE=MyISAM; +EXECUTE IMMEDIATE +CONCAT('CREATE VIEW v3 AS SELECT id,', +IF(@target_type='geometry','AsText(target)','target'), ' AS target,', +IF(@source_type='geometry','AsText(source)','source'), ' AS source ', +' FROM t3'); +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Warnings: +Warning 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=STRICT_ALL_TABLES; +INSERT INTO t3 VALUES +(1, +(SELECT target FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)), +(2, +(SELECT source FROM t2 ORDER BY id LIMIT 1), +(SELECT source FROM t2 ORDER BY id LIMIT 1)); +Got one of the listed errors +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=DEFAULT; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +UPDATE t3 SET target=source; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP TABLE t3; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test new file mode 100644 index 00000000000..94de2dce2d8 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/sql/field.cc b/sql/field.cc index 348947329f7..5abf05fed2e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -964,6 +964,32 @@ Type_handler::aggregate_for_result_traditional(const Type_handler *a, } +bool Field::check_assignability_from(const Type_handler *from) const +{ + /* + Using type_handler_for_item_field() here to get the data type handler + on both sides. This is needed to make sure aggregation for Field + works the same way with how Item_field aggregates for UNION or CASE, + so these statements: + SELECT a FROM t1 UNION SELECT b FROM t1; // Item_field vs Item_field + UPDATE t1 SET a=b; // Field vs Item_field + either both return "Illegal parameter data types" or both pass + the data type compatibility test. + For MariaDB standard data types, using type_handler_for_item_field() + turns ENUM/SET into just CHAR. + */ + Type_handler_hybrid_field_type th(type_handler()-> + type_handler_for_item_field()); + if (th.aggregate_for_result(from->type_handler_for_item_field())) + { + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + type_handler()->name().ptr(), from->name().ptr(), "SET"); + return true; + } + return false; +} + + /* Test if the given string contains important data: not spaces for character string, diff --git a/sql/field.h b/sql/field.h index 81e10307c89..2198066d962 100644 --- a/sql/field.h +++ b/sql/field.h @@ -905,6 +905,12 @@ public: bool is_unsigned() const { return flags & UNSIGNED_FLAG; } + bool check_assignability_from(const Type_handler *from) const; + bool check_assignability_from(const Field *from) const + { + return check_assignability_from(from->type_handler()); + } + /** Convenience definition of a copy function returned by Field::get_copy_func() diff --git a/sql/item.cc b/sql/item.cc index 1f6d585efd7..ecc9f8e6bfe 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4509,6 +4509,22 @@ bool Item_param::is_evaluable_expression() const } +bool Item_param::check_assignability_to(const Field *to) const +{ + switch (state) { + case SHORT_DATA_VALUE: + case LONG_DATA_VALUE: + case NULL_VALUE: + return to->check_assignability_from(type_handler()); + case NO_VALUE: + case IGNORE_VALUE: + case DEFAULT_VALUE: + break; + } + return false; +} + + bool Item_param::can_return_value() const { // There's no "default". See comments in Item_param::save_in_field(). diff --git a/sql/item.h b/sql/item.h index c3251259b43..117a252c025 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1838,6 +1838,16 @@ public: */ virtual bool is_evaluable_expression() const { return true; } + virtual bool check_assignability_to(const Field *to) const + { + /* + "this" must be neither DEFAULT/IGNORE, + nor Item_param bound to DEFAULT/IGNORE. + */ + DBUG_ASSERT(is_evaluable_expression()); + return to->check_assignability_from(type_handler()); + } + /** * Check whether the item is a parameter ('?') of stored routine. * Default implementation returns false. Method is overridden in the class @@ -4091,6 +4101,7 @@ class Item_param :public Item_basic_value, const String *value_query_val_str(THD *thd, String* str) const; Item *value_clone_item(THD *thd); bool is_evaluable_expression() const override; + bool check_assignability_to(const Field *field) const override; bool can_return_value() const; public: @@ -6771,6 +6782,10 @@ public: { str->append(STRING_WITH_LEN("default")); } + bool check_assignability_to(const Field *to) const override + { + return false; + } int save_in_field(Field *field_arg, bool) override { return field_arg->save_in_field_default_value(false); @@ -6804,6 +6819,10 @@ public: { str->append(STRING_WITH_LEN("ignore")); } + bool check_assignability_to(const Field *to) const override + { + return false; + } int save_in_field(Field *field_arg, bool) override { return field_arg->save_in_field_ignore_value(false); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d22a5670495..73bc914746d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -829,6 +829,19 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, context->resolve_in_table_list_only(table_list); switch_to_nullable_trigger_fields(*values, table); + /* + Check assignability for the leftmost () in VALUES: + INSERT INTO t1 (a,b) VALUES (1,2), (3,4); + This checks if the values (1,2) can be assigned to fields (a,b). + The further values, e.g. (3,4) are not checked - they will be + checked during the execution time (when processing actual rows). + This is to preserve the "insert until the very first error"-style + behaviour for non-transactional tables. + */ + if (values->elements && + table_list->table->check_assignability_opt_fields(fields, *values)) + goto abort; + while ((values= its++)) { thd->get_stmt_da()->inc_current_row_for_warning(); @@ -1688,7 +1701,15 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, { select_lex->no_wrap_view_item= TRUE; res= check_update_fields(thd, context->table_list, update_fields, - update_values, false, &map); + update_values, false, &map) || + /* + Check that all col=expr pairs are compatible for assignment in + INSERT INTO t1 VALUES (...) + ON DUPLICATE KEY UPDATE col=expr [, col=expr]; + */ + TABLE::check_assignability_explicit_fields(update_fields, + update_values); + select_lex->no_wrap_view_item= FALSE; } @@ -3883,6 +3904,16 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) check_insert_fields(thd, table_list, *fields, values, !insert_into_view, 1, &map)); + if (!res) + { + /* + Check that all colN=exprN pairs are compatible for assignment, e.g.: + INSERT INTO t1 (col1, col2) VALUES (expr1, expr2); + INSERT INTO t1 SET col1=expr1, col2=expr2; + */ + res= table_list->table->check_assignability_opt_fields(*fields, values); + } + if (!res && fields->elements) { Abort_on_warning_instant_set aws(thd, @@ -3936,7 +3967,14 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) } res= res || setup_fields(thd, Ref_ptr_array(), *info.update_values, - MARK_COLUMNS_READ, 0, NULL, 0); + MARK_COLUMNS_READ, 0, NULL, 0) || + /* + Check that all col=expr pairs are compatible for assignment in + INSERT INTO t1 SELECT ... FROM t2 + ON DUPLICATE KEY UPDATE col=expr [, col=expr] + */ + TABLE::check_assignability_explicit_fields(*info.update_fields, + *info.update_values); if (!res) { /* diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 929335f973e..e99aefcdf1f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11088,6 +11088,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, if (!(*ptr)->vcol_info) { bitmap_set_bit(from->read_set, def->field->field_index); + if ((*ptr)->check_assignability_from(def->field)) + goto err; (copy_end++)->set(*ptr,def->field,0); } } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4da967bb115..d5b5ac5eef4 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -523,6 +523,9 @@ int mysql_update(THD *thd, DBUG_RETURN(1); /* purecov: inspected */ } + if (table_list->table->check_assignability_explicit_fields(fields, values)) + DBUG_RETURN(true); + if (check_unique_table(thd, table_list)) DBUG_RETURN(TRUE); @@ -2082,7 +2085,8 @@ int multi_update::prepare(List ¬_used_values, */ int error= setup_fields(thd, Ref_ptr_array(), - *values, MARK_COLUMNS_READ, 0, NULL, 0); + *values, MARK_COLUMNS_READ, 0, NULL, 0) || + TABLE::check_assignability_explicit_fields(*fields, *values); ti.rewind(); while ((table_ref= ti++)) diff --git a/sql/table.cc b/sql/table.cc index f6f293290cd..98b487ba991 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -9242,6 +9242,60 @@ bool TABLE::validate_default_values_of_unset_fields(THD *thd) const } +/* + Check assignment compatibility of a value list against an explicitly + specified field list, e.g. + INSERT INTO t1 (a,b) VALUES (1,2); +*/ +bool TABLE::check_assignability_explicit_fields(List fields, + List values) +{ + DBUG_ENTER("TABLE::check_assignability_explicit_fields"); + DBUG_ASSERT(fields.elements == values.elements); + + List_iterator fi(fields); + List_iterator vi(values); + Item *f, *value; + while ((f= fi++) && (value= vi++)) + { + Item_field *item_field= f->field_for_view_update(); + if (!item_field) + { + /* + A non-updatable field of a view found. + This scenario is caught later and an error is raised. + We could eventually move error reporting here. For now just continue. + */ + continue; + } + if (value->check_assignability_to(item_field->field)) + DBUG_RETURN(true); + } + DBUG_RETURN(false); +} + + +/* + Check assignment compatibility for a value list against + all visible fields of the table, e.g. + INSERT INTO t1 VALUES (1,2); +*/ +bool TABLE::check_assignability_all_visible_fields(List &values) const +{ + DBUG_ENTER("TABLE::check_assignability_all_visible_fields"); + DBUG_ASSERT(s->visible_fields == values.elements); + + List_iterator vi(values); + for (uint i= 0; i < s->fields; i++) + { + if (!field[i]->invisible && + (vi++)->check_assignability_to(field[i])) + DBUG_RETURN(true); + } + DBUG_RETURN(false); +} + + bool TABLE::insert_all_rows_into_tmp_table(THD *thd, TABLE *tmp_table, TMP_TABLE_PARAM *tmp_table_param, diff --git a/sql/table.h b/sql/table.h index 1c09f463d9e..ddb0b183cf2 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1686,6 +1686,27 @@ public: Field **field_to_fill(); bool validate_default_values_of_unset_fields(THD *thd) const; + // Check if the value list is assignable to the explicit field list + static bool check_assignability_explicit_fields(List fields, + List values); + // Check if the value list is assignable to all visible fields + bool check_assignability_all_visible_fields(List &values) const; + /* + Check if the value list is assignable to: + - The explicit field list if fields.elements > 0, e.g. + INSERT INTO t1 (a,b) VALUES (1,2); + - All visible fields, if fields.elements==0, e.g. + INSERT INTO t1 VALUES (1,2); + */ + bool check_assignability_opt_fields(List fields, + List values) const + { + DBUG_ASSERT(values.elements); + return fields.elements ? + check_assignability_explicit_fields(fields, values) : + check_assignability_all_visible_fields(values); + } + bool insert_all_rows_into_tmp_table(THD *thd, TABLE *tmp_table, TMP_TABLE_PARAM *tmp_table_param, From 39f45f6f89ce2fc2db54bb8ab0f6076f923beeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 12:32:03 +0300 Subject: [PATCH 27/32] MDEV-28950 Assertion `*err == DB_SUCCESS' failed in btr_page_split_and_insert btr_root_raise_and_insert(), btr_lift_page_up(), rtr_page_split_and_insert(): Reset DB_FAIL from a failure to copy records on a ROW_FORMAT=COMPRESSED page to DB_SUCCESS before retrying. This fixes a regression that was introduced by commit 0b47c126e31cddda1e94588799599e138400bcf8 (MDEV-13542). btr_root_raise_and_insert(): Remove a redundant condition. btr_page_split_and_insert() will invoke btr_page_split_and_insert() if needed. --- storage/innobase/btr/btr0btr.cc | 26 ++++++++++++++++---------- storage/innobase/gis/gis0rtree.cc | 2 ++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index fc7aad3f84f..41864ee3b04 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1829,7 +1829,13 @@ btr_root_raise_and_insert( || !page_copy_rec_list_end(new_block, root, page_get_infimum_rec(root->page.frame), index, mtr, err)) { - if (*err != DB_SUCCESS && *err != DB_FAIL) { + switch (*err) { + case DB_SUCCESS: + break; + case DB_FAIL: + *err = DB_SUCCESS; + break; + default: return nullptr; } @@ -1964,14 +1970,8 @@ btr_root_raise_and_insert( } /* Split the child and insert tuple */ - if (dict_index_is_spatial(index)) { - /* Split rtree page and insert tuple */ - return(rtr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr, err)); - } else { - return(btr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr, err)); - } + return btr_page_split_and_insert(flags, cursor, offsets, heap, + tuple, n_ext, mtr, err); } /** Decide if the page should be split at the convergence point of inserts @@ -3348,7 +3348,13 @@ btr_lift_page_up( || !page_copy_rec_list_end(father_block, block, page_get_infimum_rec(page), index, mtr, err)) { - if (*err != DB_SUCCESS && *err != DB_FAIL) { + switch (*err) { + case DB_SUCCESS: + break; + case DB_FAIL: + *err = DB_SUCCESS; + break; + default: return nullptr; } diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index df5d6aa1156..3dd7fade872 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -986,6 +986,8 @@ func_start: return nullptr; } + *err = DB_SUCCESS; + ulint n = 0; rec_t* rec; ulint moved = 0; From a75ad73545cbf3f02355af4193fb4e199290c48f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 14:50:00 +0300 Subject: [PATCH 28/32] MDEV-28389 fixup: Fix compiler warnings hex_to_ascii(): Add #if around the definition to avoid clang -Wunused-function. Avoid GCC 5 -Wconversion with a cast. --- storage/innobase/buf/buf0buf.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 70ee0f58dc2..6a859f3293a 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1223,10 +1223,13 @@ buf_madvise_do_dump() } #endif +#ifndef UNIV_DEBUG static inline byte hex_to_ascii(byte hex_digit) { - return hex_digit <= 9 ? '0' + hex_digit : ('a' - 10) + hex_digit; + const int offset= hex_digit <= 9 ? '0' : 'a' - 10; + return byte(hex_digit + offset); } +#endif /** Dump a page to stderr. @param[in] read_buf database page From f339ef3f9793d5de8f825f1ec6489550b98e7e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 16:00:34 +0300 Subject: [PATCH 29/32] MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) during ADD COLUMN prepare_inplace_alter_table_dict(): If the table will not be rebuilt, preserve all of the original ROW_FORMAT, including the compressed page size flags related to ROW_FORMAT=COMPRESSED. --- .../suite/innodb/r/instant_alter_upgrade.result | 9 +++++++++ .../suite/innodb/t/instant_alter_upgrade.test | 16 ++++++++++++++++ storage/innobase/handler/handler0alter.cc | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 mysql-test/suite/innodb/r/instant_alter_upgrade.result create mode 100644 mysql-test/suite/innodb/t/instant_alter_upgrade.test diff --git a/mysql-test/suite/innodb/r/instant_alter_upgrade.result b/mysql-test/suite/innodb/r/instant_alter_upgrade.result new file mode 100644 index 00000000000..fc7d28963ca --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_upgrade.result @@ -0,0 +1,9 @@ +# +# MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) +# during ADD COLUMN +# +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLES; +ALTER TABLE t2 ADD COLUMN b INT; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/t/instant_alter_upgrade.test b/mysql-test/suite/innodb/t/instant_alter_upgrade.test new file mode 100644 index 00000000000..d73fe187a72 --- /dev/null +++ b/mysql-test/suite/innodb/t/instant_alter_upgrade.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc +--source include/innodb_row_format.inc + +--echo # +--echo # MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) +--echo # during ADD COLUMN +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB; +FLUSH TABLES; +--let $datadir=`select @@datadir` +--remove_file $datadir/test/t2.frm +--copy_file $datadir/test/t1.frm $datadir/test/t2.frm +ALTER TABLE t2 ADD COLUMN b INT; +DROP TABLE t1,t2; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 22af1f91f61..0cba7d953d1 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -5012,8 +5012,10 @@ prepare_inplace_alter_table_dict( /* If we promised ALGORITHM=NOCOPY or ALGORITHM=INSTANT, we must retain the original ROW_FORMAT of the table. */ flags = (user_table->flags & (DICT_TF_MASK_COMPACT + | DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS)) | (flags & ~(DICT_TF_MASK_COMPACT + | DICT_TF_MASK_ZIP_SSIZE | DICT_TF_MASK_ATOMIC_BLOBS)); } From 1ae8160710744d7e6322cac1cad7b33092872e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Jun 2022 16:51:53 +0300 Subject: [PATCH 30/32] MDEV-26979 heap-use-after-free or SIGSEGV when accessing INNODB_SYS_TABLESTATS during DDL i_s_dict_fill_sys_tablestats(): Read all fields of dict_table_t while holding dict_sys.latch. dict_sys_t::allow_eviction(): Remove. --- storage/innobase/handler/i_s.cc | 105 +++++++++++---------------- storage/innobase/include/dict0dict.h | 18 +---- 2 files changed, 46 insertions(+), 77 deletions(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index bdf3a587e56..d4115f7be16 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -5010,71 +5010,61 @@ static ST_FIELD_INFO innodb_sys_tablestats_fields_info[]= }; } // namespace Show -/** Populate information_schema.innodb_sys_tablestats table with information -from SYS_TABLES. -@param[in] thd thread ID -@param[in,out] table table -@param[in] ref_count table reference count -@param[in,out] table_to_fill fill this table +/** Populate information_schema.innodb_sys_tablestats table with a table, +and release exclusive dict_sys.latch. +@param[in] thd connection +@param[in,out] table InnoDB table metadata +@param[in,out] table_to_fill INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS @return 0 on success */ static int -i_s_dict_fill_sys_tablestats( - THD* thd, - dict_table_t* table, - ulint ref_count, - TABLE* table_to_fill) +i_s_dict_fill_sys_tablestats(THD* thd, dict_table_t *table, + TABLE* table_to_fill) { - Field** fields; + DBUG_ENTER("i_s_dict_fill_sys_tablestats"); - DBUG_ENTER("i_s_dict_fill_sys_tablestats"); + Field **fields= table_to_fill->field; - fields = table_to_fill->field; + { + table->stats_mutex_lock(); + auto _ = make_scope_exit([table]() { + table->stats_mutex_unlock(); dict_sys.unlock(); }); - OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); + OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->id), TRUE)); - OK(field_store_string(fields[SYS_TABLESTATS_NAME], - table->name.m_name)); + OK(field_store_string(fields[SYS_TABLESTATS_NAME], + table->name.m_name)); + OK(fields[SYS_TABLESTATS_INIT]->store(table->stat_initialized, true)); - { - table->stats_mutex_lock(); - auto _ = make_scope_exit([table]() { - table->stats_mutex_unlock(); }); + if (table->stat_initialized) + { + OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows, true)); - OK(fields[SYS_TABLESTATS_INIT]->store(table->stat_initialized, - true)); + OK(fields[SYS_TABLESTATS_CLUST_SIZE]-> + store(table->stat_clustered_index_size, true)); - if (table->stat_initialized) { - OK(fields[SYS_TABLESTATS_NROW]->store( - table->stat_n_rows, true)); + OK(fields[SYS_TABLESTATS_INDEX_SIZE]-> + store(table->stat_sum_of_other_index_sizes, true)); - OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store( - table->stat_clustered_index_size, true)); + OK(fields[SYS_TABLESTATS_MODIFIED]-> + store(table->stat_modified_counter, true)); + } + else + { + OK(fields[SYS_TABLESTATS_NROW]->store(0, true)); + OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true)); + OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true)); + OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true)); + } - OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store( - table->stat_sum_of_other_index_sizes, - true)); + OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, true)); - OK(fields[SYS_TABLESTATS_MODIFIED]->store( - table->stat_modified_counter, true)); - } else { - OK(fields[SYS_TABLESTATS_NROW]->store(0, true)); + OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]-> + store(table->get_ref_count(), true)); + } - OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true)); - - OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true)); - - OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true)); - } - } - - OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, true)); - - OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]->store(ref_count, true)); - - OK(schema_table_store_record(thd, table_to_fill)); - - DBUG_RETURN(0); + OK(schema_table_store_record(thd, table_to_fill)); + DBUG_RETURN(0); } /*******************************************************************//** @@ -5109,23 +5099,17 @@ i_s_sys_tables_fill_table_stats( while (rec) { const char* err_msg; - dict_table_t* table_rec= 0; + dict_table_t* table_rec = nullptr; mtr.commit(); /* Fetch the dict_table_t structure corresponding to this SYS_TABLES record */ err_msg = i_s_sys_tables_rec(pcur, nullptr, nullptr, - &table_rec); + &table_rec); if (UNIV_LIKELY(!err_msg)) { - bool evictable = dict_sys.prevent_eviction(table_rec); - ulint ref_count = table_rec->get_ref_count(); - dict_sys.unlock(); - i_s_dict_fill_sys_tablestats(thd, table_rec, ref_count, + i_s_dict_fill_sys_tablestats(thd, table_rec, tables->table); - if (!evictable) { - table_rec = nullptr; - } } else { ut_ad(!table_rec); dict_sys.unlock(); @@ -5137,9 +5121,6 @@ i_s_sys_tables_fill_table_stats( /* Get the next record */ mtr.start(); dict_sys.lock(SRW_LOCK_CALL); - if (table_rec) { - dict_sys.allow_eviction(table_rec); - } rec = dict_getnext_system(&pcur, &mtr); } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index e051cb38c1d..29673f5bc95 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1487,28 +1487,16 @@ public: } #endif - /** Move a table to the non-LRU list from the LRU list. - @return whether the table was evictable */ - bool prevent_eviction(dict_table_t *table) + /** Move a table to the non-LRU list from the LRU list. */ + void prevent_eviction(dict_table_t *table) { ut_d(locked()); ut_ad(find(table)); if (!table->can_be_evicted) - return false; + return; table->can_be_evicted= false; UT_LIST_REMOVE(table_LRU, table); UT_LIST_ADD_LAST(table_non_LRU, table); - return true; - } - /** Move a table from the non-LRU list to the LRU list. */ - void allow_eviction(dict_table_t *table) - { - ut_d(locked()); - ut_ad(find(table)); - ut_ad(!table->can_be_evicted); - table->can_be_evicted= true; - UT_LIST_REMOVE(table_non_LRU, table); - UT_LIST_ADD_FIRST(table_LRU, table); } #ifdef UNIV_DEBUG From c4bfb61803640e9e0c4b7fff441ac71b1996779d Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Mon, 27 Jun 2022 22:51:37 +0900 Subject: [PATCH 31/32] MDEV-28479 fixup: Update spider/bg and spider/handler suites --- .../spider/mysql-test/spider/bg/r/ha.result | 20 +++++++++++++++ .../mysql-test/spider/bg/r/ha_part.result | 25 +++++++++++++++++++ .../spider/bg/r/spider_fixes.result | 6 +++++ .../mysql-test/spider/handler/r/ha.result | 20 +++++++++++++++ .../spider/handler/r/ha_part.result | 25 +++++++++++++++++++ .../spider/handler/r/spider_fixes.result | 6 +++++ 6 files changed, 102 insertions(+) diff --git a/storage/spider/mysql-test/spider/bg/r/ha.result b/storage/spider/mysql-test/spider/bg/r/ha.result index f8833c229ef..3c37c2d51f0 100644 --- a/storage/spider/mysql-test/spider/bg/r/ha.result +++ b/storage/spider/mysql-test/spider/bg/r/ha.result @@ -62,6 +62,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -117,6 +121,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 2"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -130,6 +138,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 1"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -162,6 +174,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -213,6 +229,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", alc "1", database "auto_test_remote auto_test_remote2", lst "1 0"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/bg/r/ha_part.result b/storage/spider/mysql-test/spider/bg/r/ha_part.result index 315f37298bc..39fa2655892 100644 --- a/storage/spider/mysql-test/spider/bg/r/ha_part.result +++ b/storage/spider/mysql-test/spider/bg/r/ha_part.result @@ -62,6 +62,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -171,6 +186,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result index 0b0514a9346..a6a7588b014 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result @@ -297,10 +297,16 @@ CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; diff --git a/storage/spider/mysql-test/spider/handler/r/ha.result b/storage/spider/mysql-test/spider/handler/r/ha.result index f8833c229ef..3c37c2d51f0 100644 --- a/storage/spider/mysql-test/spider/handler/r/ha.result +++ b/storage/spider/mysql-test/spider/handler/r/ha.result @@ -62,6 +62,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -117,6 +121,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 2"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -130,6 +138,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", database "auto_test_remote auto_test_remote2", lst "0 1"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -162,6 +174,10 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -213,6 +229,10 @@ ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", alc "1", database "auto_test_remote auto_test_remote2", lst "1 0"'; +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/handler/r/ha_part.result b/storage/spider/mysql-test/spider/handler/r/ha_part.result index 315f37298bc..39fa2655892 100644 --- a/storage/spider/mysql-test/spider/handler/r/ha_part.result +++ b/storage/spider/mysql-test/spider/handler/r/ha_part.result @@ -62,6 +62,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status @@ -171,6 +186,11 @@ b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; db_name table_name link_id link_status diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result index f11b1d9b32c..aa7d2ea40c1 100644 --- a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result @@ -297,10 +297,16 @@ CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 +Warnings: +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release +Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; From 4a7e337e5f85e488849e5cb2f780659a3d7b1266 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 27 Jun 2022 18:01:16 +0400 Subject: [PATCH 32/32] MDEV-28963 Incompatible data type assignment through SP vars is not consistent with columns --- mysql-test/include/type_mix_incompatible.inc | 121 ++++++++++++++ .../main/alter_table_combinations.result | 2 +- mysql-test/main/sp-row.result | 6 +- mysql-test/main/sp-row.test | 6 +- mysql-test/main/sp-vars.result | 6 +- mysql-test/main/sp-vars.test | 6 +- mysql-test/main/sp.result | 2 +- mysql-test/main/sp.test | 2 +- mysql-test/main/type_geometry_mix_int.result | 148 ++++++++++++++++++ .../suite/compat/oracle/r/sp-row.result | 8 +- mysql-test/suite/compat/oracle/t/sp-row.test | 8 +- .../type_inet/type_inet6_mix_decimal.result | 148 ++++++++++++++++++ .../type_inet/type_inet6_mix_double.result | 148 ++++++++++++++++++ .../type_inet/type_inet6_mix_int.result | 148 ++++++++++++++++++ .../type_inet/type_inet6_mix_time.result | 148 ++++++++++++++++++ .../type_inet/type_inet6_mix_uint.result | 148 ++++++++++++++++++ .../type_uuid/type_uuid_mix_decimal.result | 148 ++++++++++++++++++ .../type_uuid/type_uuid_mix_double.result | 148 ++++++++++++++++++ .../type_uuid/type_uuid_mix_int.result | 148 ++++++++++++++++++ .../type_uuid/type_uuid_mix_time.result | 148 ++++++++++++++++++ .../type_uuid/type_uuid_mix_uint.result | 148 ++++++++++++++++++ sql/field.cc | 2 +- sql/item.cc | 6 +- sql/sp_head.cc | 22 ++- sql/sp_rcontext.cc | 2 +- sql/sql_class.h | 3 +- 26 files changed, 1801 insertions(+), 29 deletions(-) diff --git a/mysql-test/include/type_mix_incompatible.inc b/mysql-test/include/type_mix_incompatible.inc index 8f0eb4fb70c..750dc7bcac6 100644 --- a/mysql-test/include/type_mix_incompatible.inc +++ b/mysql-test/include/type_mix_incompatible.inc @@ -10,6 +10,9 @@ SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS AND TABLE_NAME='t1' AND TABLE_SCHEMA='test'); +let $source_type= `(SELECT @source_type)`; +let $target_type= `(SELECT @target_type)`; + CREATE TABLE t2 LIKE t1; ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST; INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT); @@ -134,4 +137,122 @@ EXECUTE IMMEDIATE @alter; DROP TABLE t3; DROP TABLE t2; + +# +# MDEV-28963 Incompatible data type assignment through SP vars is not consistent with columns +# + +# +# SP local variables +# +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE src $source_type DEFAULT NULL; + DECLARE dst $target_type DEFAULT NULL; + SET dst=src; +END; +$$ +DELIMITER ;$$ +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CALL p1; +DROP PROCEDURE p1; + +# +# SP IN parameters +# + +--eval CREATE FUNCTION f1(a $target_type) RETURNS INT RETURN NULL; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +DROP FUNCTION f1; + +--eval CREATE PROCEDURE p1(a $target_type) BEGIN END; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +DROP PROCEDURE p1; + +# +# SP OUT parameters +# + +DELIMITER $$; +eval CREATE PROCEDURE p1(OUT dst $target_type) +BEGIN + DECLARE src $source_type DEFAULT NULL; + SET dst=src; +END; +$$ +eval CREATE PROCEDURE p2() +BEGIN + DECLARE dst $target_type DEFAULT NULL; + CALL p1(dst); +END; +$$ +DELIMITER ;$$ +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CALL p2(); +SHOW WARNINGS; +DROP PROCEDURE p2; +DROP PROCEDURE p1; + + +# +# SF RETURN +# + +DELIMITER $$; +eval CREATE FUNCTION f1() RETURNS $target_type +BEGIN + DECLARE rc $source_type DEFAULT NULL; + RETURN rc; +END; +$$ +DELIMITER ;$$ +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT f1(); +DROP FUNCTION f1; + +# +# Cursor IN parameters +# + +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE src $source_type DEFAULT NULL; + DECLARE cur1 CURSOR(t $target_type) FOR SELECT * FROM t1 WHERE target=t; + OPEN cur1(src); + CLOSE cur1; +END; +$$ +DELIMITER ;$$ +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CALL p1(); +DROP PROCEDURE p1; + +# +# FETCH +# + +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); + +DELIMITER $$; +eval CREATE PROCEDURE p1() +BEGIN + DECLARE dst $target_type DEFAULT NULL; + DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; + OPEN cur2; + FETCH cur2 INTO dst; + CLOSE cur2; +END; +$$ +DELIMITER ;$$ +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CALL p1(); +DROP PROCEDURE p1; + +DROP TABLE t2; + --echo # End of type_store_assignment_incompatible.inc diff --git a/mysql-test/main/alter_table_combinations.result b/mysql-test/main/alter_table_combinations.result index 459447f343e..b2690555016 100644 --- a/mysql-test/main/alter_table_combinations.result +++ b/mysql-test/main/alter_table_combinations.result @@ -226,7 +226,7 @@ Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function SELECT * FROM v1; ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them UPDATE t2 SET f = f + 10; -ERROR 42S22: Unknown column 'd' in 'OLD' +ERROR 42S22: Unknown column 'd' in 'NEW' CALL sp1(); ERROR 42S22: Unknown column 'd' in 'field list' DROP TRIGGER trg1; diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 2764b4cd999..1cbfa8c639f 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -20,7 +20,7 @@ RETURN a; END; $$ SELECT f1(ROW(10,20)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP FUNCTION f1; # # ROW as an SP parameter @@ -236,7 +236,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP PROCEDURE p1; DROP FUNCTION f1; # @@ -286,7 +286,7 @@ RETURN rec; END; $$ SELECT f1(10); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP FUNCTION f1; # # Using the entire ROW in SELECT..CREATE diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test index 527ff9455bd..c49ea293bfe 100644 --- a/mysql-test/main/sp-row.test +++ b/mysql-test/main/sp-row.test @@ -27,7 +27,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(ROW(10,20)); DROP FUNCTION f1; @@ -307,7 +307,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -393,7 +393,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(10); DROP FUNCTION f1; diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result index de30156c602..4ffc05fa257 100644 --- a/mysql-test/main/sp-vars.result +++ b/mysql-test/main/sp-vars.result @@ -1026,11 +1026,11 @@ BEGIN SELECT arg; END| CALL p1((1, 2)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types tinyint and row for operation 'SET' CALL p1((SELECT * FROM t1 LIMIT 1)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types tinyint and row for operation 'SET' CALL p1((SELECT col1, col2 FROM t1 LIMIT 1)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types tinyint and row for operation 'SET' DROP PROCEDURE p1; DROP TABLE t1; diff --git a/mysql-test/main/sp-vars.test b/mysql-test/main/sp-vars.test index 9edf245acbe..5e1e07888ca 100644 --- a/mysql-test/main/sp-vars.test +++ b/mysql-test/main/sp-vars.test @@ -1221,13 +1221,13 @@ BEGIN END| delimiter ;| ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((1, 2)); ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((SELECT * FROM t1 LIMIT 1)); ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1((SELECT col1, col2 FROM t1 LIMIT 1)); # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index bddb41c0730..bb73622106f 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -255,7 +255,7 @@ return i+1| call sub1("sub1a", (select 7))| call sub1("sub1b", (select max(i) from t2))| call sub1("sub1c", (select i,d from t2 limit 1))| -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' call sub1("sub1d", (select 1 from (select 1) a))| call sub2("sub2")| select * from t1 order by id| diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 9d0e05e4d1d..512f149e4b8 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -386,7 +386,7 @@ create function sub3(i int) returns int deterministic call sub1("sub1a", (select 7))| call sub1("sub1b", (select max(i) from t2))| ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION call sub1("sub1c", (select i,d from t2 limit 1))| call sub1("sub1d", (select 1 from (select 1) a))| call sub2("sub2")| diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result index 6511a0fcea6..e5d00c63727 100644 --- a/mysql-test/main/type_geometry_mix_int.result +++ b/mysql-test/main/type_geometry_mix_int.result @@ -92,6 +92,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst geometry DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a geometry) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a geometry) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst geometry) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst geometry DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types geometry and int for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS geometry +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t geometry) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst geometry DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1)); @@ -185,6 +259,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types geometry and int for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src geometry DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src geometry DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types int and geometry for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc geometry DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src geometry DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and geometry for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result index 7fd986a71c8..a15fe30d8af 100644 --- a/mysql-test/suite/compat/oracle/r/sp-row.result +++ b/mysql-test/suite/compat/oracle/r/sp-row.result @@ -24,7 +24,7 @@ RETURN a; END; $$ SELECT f1(ROW(10,20)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP FUNCTION f1; # # ROW as an SP parameter @@ -261,7 +261,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP PROCEDURE p1; DROP FUNCTION f1; CREATE FUNCTION f1(a INT) RETURN INT @@ -278,7 +278,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP PROCEDURE p1; DROP FUNCTION f1; # @@ -332,7 +332,7 @@ RETURN rec; END; $$ SELECT f1(10); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Illegal parameter data types int and row for operation 'SET' DROP FUNCTION f1; # # Using the entire ROW in SELECT..CREATE diff --git a/mysql-test/suite/compat/oracle/t/sp-row.test b/mysql-test/suite/compat/oracle/t/sp-row.test index ebd0a2a2137..c7658c76838 100644 --- a/mysql-test/suite/compat/oracle/t/sp-row.test +++ b/mysql-test/suite/compat/oracle/t/sp-row.test @@ -35,7 +35,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(ROW(10,20)); DROP FUNCTION f1; @@ -334,7 +334,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -355,7 +355,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -427,7 +427,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(10); DROP FUNCTION f1; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result index c045bbe7769..024b9d012be 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types inet6 and decimal for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc decimal(38,0) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst decimal(38,0)) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types decimal and inet6 for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS decimal(38,0) +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result index cd658dbab1a..41baf7b8ca3 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types inet6 and double for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types inet6 and double for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types double and inet6 for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types double and inet6 for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result index 67052350187..80a2e70cd7a 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types inet6 and int for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types int and inet6 for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and inet6 for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result index 042a9203fd6..ffca3fb441f 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src time DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types inet6 and time for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc time DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source INET6 DEFAULT '::0'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types inet6 and time for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst time DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a time) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst time) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst time DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types time and inet6 for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS time +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst time DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types time and inet6 for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result index 579aee6e3fd..7fa4df73dab 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE dst inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a inet6) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst inet6) +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types inet6 and int unsigned for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS inet6 +BEGIN +DECLARE rc int(10) unsigned DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst inet6 DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source INET6 DEFAULT '::0'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types inet6 and int unsigned for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE dst int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(10) unsigned) +BEGIN +DECLARE src inet6 DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types int unsigned and inet6 for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(10) unsigned +BEGIN +DECLARE rc inet6 DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src inet6 DEFAULT NULL; +DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int unsigned and inet6 for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result index 7fc9d0a9d38..91519b1e677 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types uuid and decimal for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc decimal(38,0) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types uuid and decimal for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst decimal(38,0)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types decimal and uuid for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS decimal(38,0) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types decimal and uuid for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result index 87b3b1ecfb3..2f045078eb7 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types uuid and double for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types uuid and double for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types double and uuid for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types double and uuid for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result index 404581ee519..4eb2b803a98 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types uuid and int for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types uuid and int for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types int and uuid for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int and uuid for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result index 99efe1b579c..bb41af1ebf0 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src time DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types uuid and time for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc time DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types uuid and time for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst time DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a time) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst time) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst time DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types time and uuid for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS time +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst time DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types time and uuid for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result index 8f7236dab20..9c61cfb1171 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result @@ -95,6 +95,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types uuid and int unsigned for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(10) unsigned DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); @@ -188,6 +262,80 @@ EXECUTE IMMEDIATE @alter; ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET' DROP TABLE t3; DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(10) unsigned) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +SHOW WARNINGS; +Level Code Message +Error 4078 Illegal parameter data types int unsigned and uuid for operation 'SET' +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(10) unsigned +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET' +DROP PROCEDURE p1; +DROP TABLE t2; # End of type_store_assignment_incompatible.inc DROP TABLE t1; # diff --git a/sql/field.cc b/sql/field.cc index 5abf05fed2e..491db8ddbc8 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1453,7 +1453,7 @@ bool Field::sp_prepare_and_store_item(THD *thd, Item **value) Item *expr_item; - if (!(expr_item= thd->sp_prepare_func_item(value, 1))) + if (!(expr_item= thd->sp_fix_func_item_for_assignment(this, value))) goto error; /* diff --git a/sql/item.cc b/sql/item.cc index ecc9f8e6bfe..0d6f6cda544 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9892,9 +9892,11 @@ void Item_trigger_field::set_required_privilege(bool rw) bool Item_trigger_field::set_value(THD *thd, sp_rcontext * /*ctx*/, Item **it) { - Item *item= thd->sp_prepare_func_item(it); + if (fix_fields_if_needed(thd, NULL)) + return true; - if (!item || fix_fields_if_needed(thd, NULL)) + Item *item= thd->sp_fix_func_item_for_assignment(field, it); + if (!item) return true; // NOTE: field->table->copy_blobs should be false here, but let's diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 393f2016a87..3557e21d53b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -410,6 +410,26 @@ Item *THD::sp_fix_func_item(Item **it_addr) } +/** + Prepare an Item for evaluation as an assignment source, + for assignment to the given target. + + @param to - the assignment target + @param it_addr - a pointer on item refernce + + @retval - NULL on error + @retval - a prepared item pointer on success +*/ +Item *THD::sp_fix_func_item_for_assignment(const Field *to, Item **it_addr) +{ + DBUG_ENTER("THD::sp_fix_func_item_for_assignment"); + Item *res= sp_fix_func_item(it_addr); + if (res && (!res->check_assignability_to(to))) + DBUG_RETURN(res); + DBUG_RETURN(NULL); +} + + /** Evaluate an expression and store the result in the field. @@ -4071,7 +4091,7 @@ sp_instr_jump_if_not::exec_core(THD *thd, uint *nextp) Item *it; int res; - it= thd->sp_prepare_func_item(&m_expr); + it= thd->sp_prepare_func_item(&m_expr, 1); if (! it) { res= -1; diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 619218f3b68..d2fe53a2431 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -715,7 +715,7 @@ Item_cache *sp_rcontext::create_case_expr_holder(THD *thd, bool sp_rcontext::set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr) { - Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr); + Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr, 1); if (!case_expr_item) return true; diff --git a/sql/sql_class.h b/sql/sql_class.h index 76f713d0aac..f4116932ac8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5493,7 +5493,8 @@ public: bool restore_from_local_lex_to_old_lex(LEX *oldlex); Item *sp_fix_func_item(Item **it_addr); - Item *sp_prepare_func_item(Item **it_addr, uint cols= 1); + Item *sp_fix_func_item_for_assignment(const Field *to, Item **it_addr); + Item *sp_prepare_func_item(Item **it_addr, uint cols); bool sp_eval_expr(Field *result_field, Item **expr_item_ptr); bool sql_parser(LEX *old_lex, LEX *lex,