summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-06-27 10:14:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-06-27 10:14:37 +0300
commit01d757036f5753fbbb54c6fef4bd7b312981ed88 (patch)
tree046889d0bec8d3202b7553584c7e9b5583c9e6b0 /storage
parentaf929146ed5d10f7cafe1091346e50a873eed3f1 (diff)
parentc86b1389de5fe44fbd659bb50d95017bc19324a5 (diff)
downloadmariadb-git-01d757036f5753fbbb54c6fef4bd7b312981ed88.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/mysql-test/connect/r/mysql.result12
-rw-r--r--storage/connect/mysql-test/connect/t/mysql.test16
-rw-r--r--storage/connect/tabmysql.cpp16
-rw-r--r--storage/connect/tabmysql.h2
-rw-r--r--storage/innobase/buf/buf0buf.cc177
-rw-r--r--storage/innobase/dict/dict0dict.cc55
-rw-r--r--storage/innobase/handler/i_s.cc7
-rw-r--r--storage/innobase/include/dict0dict.h12
-rw-r--r--storage/spider/ha_spider.cc8
-rw-r--r--storage/spider/ha_spider.h1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result32
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test36
-rw-r--r--storage/spider/spd_db_conn.h3
-rw-r--r--storage/spider/spd_db_mysql.cc16
-rw-r--r--storage/spider/spd_include.h1
-rw-r--r--storage/spider/spd_table.cc6
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result7
18 files changed, 158 insertions, 252 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 c65e2924ada..eab1d3ec669 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
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index b42964b8315..940e6d5d8ab 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -66,6 +66,7 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0dump.h"
#include <map>
#include <sstream>
+#include "log.h"
#ifdef UNIV_LINUX
#include <stdlib.h>
@@ -1241,171 +1242,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] zip_size compressed page size, or 0 */
-void buf_page_print(const byte* read_buf, ulint zip_size)
+ATTRIBUTE_COLD
+void buf_page_print(const byte *read_buf, ulint zip_size)
{
- dict_index_t* index;
-
#ifndef UNIV_DEBUG
- const ulint size = zip_size ? zip_size : srv_page_size;
- ib::info() << "Page dump in ascii and hex ("
- << size << " bytes):";
+ const size_t size = zip_size ? zip_size : srv_page_size;
+ const byte * const end= read_buf + size;
+ sql_print_information("InnoDB: Page dump (%zu bytes):", size);
- ut_print_buf(stderr, read_buf, size);
- fputs("\nInnoDB: End of page dump\n", stderr);
-#endif
+ do
+ {
+ byte row[64];
- if (zip_size) {
- /* 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, zip_size,
- SRV_CHECKSUM_ALGORITHM_CRC32)
- << ", "
- << buf_checksum_algorithm_name(
- SRV_CHECKSUM_ALGORITHM_INNODB)
- << " "
- << page_zip_calc_checksum(
- read_buf, zip_size,
- SRV_CHECKSUM_ALGORITHM_INNODB)
- << ", "
- << buf_checksum_algorithm_name(
- SRV_CHECKSUM_ALGORITHM_NONE)
- << " "
- << page_zip_calc_checksum(
- read_buf, zip_size,
- 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);
+ 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);
- } else {
- const uint32_t crc32 = buf_calc_page_crc32(read_buf);
- 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
- << ", "
- << 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 + srv_page_size
- - FIL_PAGE_END_LSN_OLD_CHKSUM)
- << ", calculated checksums for field2: "
- << buf_checksum_algorithm_name(
- SRV_CHECKSUM_ALGORITHM_CRC32) << " "
- << crc32
- << ", "
- << 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 + srv_page_size
- - 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;
+ sql_print_information("InnoDB: %.*s", 64, row);
+ }
+ while (read_buf != end);
- 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;
- }
+ sql_print_information("InnoDB: End of page dump");
+#endif
}
# ifdef PFS_GROUP_BUFFER_SYNC
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 8357732e73b..29ab3c7fe70 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
@@ -1226,45 +1226,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 */
-{
- if (!dict_sys.is_initialised()) return NULL;
-
- dict_table_t* table;
-
- 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
@@ -4754,9 +4715,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));
+
+ 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(dict_index_find_on_id_low(index_id));
+ return nullptr;
}
#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 d21c0cefec0..57e69926264 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 2326f00599b..f70297121fd 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
@@ -934,16 +934,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.
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index eb4052abdf5..559b315118f 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1111,9 +1111,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;
@@ -1223,7 +1220,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;
@@ -1805,7 +1801,6 @@ int ha_spider::reset()
insert_with_update = FALSE;
low_priority = FALSE;
high_priority = FALSE;
- insert_delayed = FALSE;
use_pre_call = FALSE;
use_pre_action = FALSE;
pre_bitmap_checked = FALSE;
@@ -9716,7 +9711,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 |
@@ -14121,7 +14115,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);
@@ -14163,7 +14156,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 cb0a2abcc06..543b92629da 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -169,7 +169,6 @@ public:
bool insert_with_update;
bool low_priority;
bool high_priority;
- bool insert_delayed;
bool use_pre_call;
bool use_pre_action;
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 e820851d257..2abe62fc001 100644
--- a/storage/spider/spd_db_conn.h
+++ b/storage/spider/spd_db_conn.h
@@ -34,7 +34,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)
@@ -76,8 +75,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 85f910aa661..782e7efac9d 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -9550,7 +9550,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");
direct_insert_kind = SPIDER_SQL_DIRECT_INSERT_KIND_INSERT;
if (
@@ -9577,15 +9576,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 &&
@@ -16270,12 +16260,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 95064fa4c72..81d812280d7 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -942,7 +942,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 9d3846cb43b..7a00061e3a2 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -2043,7 +2043,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;
@@ -2266,7 +2265,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);
@@ -2492,8 +2490,6 @@ int spider_parse_connect_info(
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(
"use_pushdown_udf", use_pushdown_udf, 0, 1);
@@ -3817,8 +3813,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)
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;