summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_valgrind.h10
-rw-r--r--mysql-test/lib/mtr_cases.pm2
-rw-r--r--mysql-test/main/sql_safe_updates.result24
-rw-r--r--mysql-test/main/sql_safe_updates.test25
-rw-r--r--mysql-test/suite/binlog/r/binlog_xa_recover_using_new_server_id.result17
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_recover_using_new_server_id.test44
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_bugs.result9
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate.result2
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test9
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate.test2
-rw-r--r--mysys/my_lib.c20
-rw-r--r--mysys/my_symlink.c7
-rw-r--r--plugin/auth_pam/auth_pam.c2
-rw-r--r--sql/datadict.cc2
-rw-r--r--sql/ddl_log.cc8
-rw-r--r--sql/discover.cc3
-rw-r--r--sql/handler.cc19
-rw-r--r--sql/handler.h16
-rw-r--r--sql/parse_file.cc2
-rw-r--r--sql/sql_delete.cc7
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_update.cc7
-rw-r--r--storage/innobase/buf/buf0flu.cc102
-rw-r--r--storage/innobase/buf/buf0rea.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc7
-rw-r--r--storage/innobase/handler/handler0alter.cc7
-rw-r--r--storage/innobase/include/mtr0mtr.h14
-rw-r--r--storage/innobase/log/log0log.cc13
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc65
-rw-r--r--storage/innobase/os/os0file.cc24
-rw-r--r--storage/innobase/trx/trx0purge.cc4
-rw-r--r--storage/maria/s3_func.h1
-rw-r--r--storage/myisam/mi_info.c3
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider_fixes.result15
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result6
-rw-r--r--storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test7
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes.result20
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes.test12
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes.result15
-rw-r--r--storage/spider/mysql-test/spider/r/variable_deprecation.result38
-rw-r--r--storage/spider/mysql-test/spider/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/t/variable_deprecation.test27
-rw-r--r--storage/spider/spd_param.cc252
-rw-r--r--storage/spider/spd_table.cc27
-rw-r--r--strings/my_vsnprintf.c3
-rw-r--r--tpool/aio_liburing.cc2
-rw-r--r--tpool/aio_linux.cc2
-rw-r--r--tpool/aio_simulated.cc27
-rw-r--r--tpool/tpool.h6
-rw-r--r--tpool/tpool_generic.cc52
61 files changed, 789 insertions, 261 deletions
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 260521d4d4b..a24ad597d36 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, 2020, MariaDB Corporation.
+/* Copyright (C) 2010, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,11 @@
# define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len)
# define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len)
# define REDZONE_SIZE 8
+# ifdef __linux__
+# define MSAN_STAT_WORKAROUND(st) MEM_MAKE_DEFINED(st, sizeof(*st))
+# else
+# define MSAN_STAT_WORKAROUND(st) ((void) 0)
+# endif
#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
# include <valgrind/memcheck.h>
# define HAVE_MEM_CHECK
@@ -49,6 +54,7 @@
# define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len)
# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len)
# define REDZONE_SIZE 8
+# define MSAN_STAT_WORKAROUND(st) ((void) 0)
#elif defined(__SANITIZE_ADDRESS__) && (!defined(_MSC_VER) || defined (__clang__))
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
@@ -62,6 +68,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
# define MEM_GET_VBITS(a,b,len) ((void) 0)
# define MEM_SET_VBITS(a,b,len) ((void) 0)
+# define MSAN_STAT_WORKAROUND(st) ((void) 0)
# define REDZONE_SIZE 8
#else
# define MEM_UNDEFINED(a,len) ((void) 0)
@@ -73,6 +80,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_GET_VBITS(a,b,len) ((void) 0)
# define MEM_SET_VBITS(a,b,len) ((void) 0)
# define REDZONE_SIZE 0
+# define MSAN_STAT_WORKAROUND(st) ((void) 0)
#endif /* __has_feature(memory_sanitizer) */
#ifdef HAVE_valgrind
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index adc911ba937..de7041409f6 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -1037,7 +1037,7 @@ sub get_tags_from_file($$) {
}
# Check for a sourced include file.
- if ($line =~ /^(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/)
+ if ($line =~ /^[[:space:]]*(--)?[[:space:]]*source[[:space:]]+([^;[:space:]]+)/)
{
my $include= $2;
# The rules below must match open_file() function of mysqltest.cc
diff --git a/mysql-test/main/sql_safe_updates.result b/mysql-test/main/sql_safe_updates.result
index 356cd36bad9..f2944e60489 100644
--- a/mysql-test/main/sql_safe_updates.result
+++ b/mysql-test/main/sql_safe_updates.result
@@ -1,3 +1,27 @@
+#
+# MDEV-14429 sql_safe_updates in my.cnf not work
+#
select @@sql_safe_updates;
@@sql_safe_updates
1
+#
+# MDEV-18304 sql_safe_updates does not work with OR clauses
+#
+create table t1 (a int, b int, primary key (a), key (b));
+update t1 set b=2 where a=1 or b=2;
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+explain update t1 set b=2 where a=1 or b=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
+delete from t1 where a=1 or b=2;
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+explain delete from t1 where a=1 or b=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+update t1 set b=2 where a=1 or b=2;
+delete from t1 where a=1 or b=2;
+drop table t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/sql_safe_updates.test b/mysql-test/main/sql_safe_updates.test
index 18decd0ff2c..25fe4a15ca2 100644
--- a/mysql-test/main/sql_safe_updates.test
+++ b/mysql-test/main/sql_safe_updates.test
@@ -1,4 +1,23 @@
-#
-# MDEV-14429 sql_safe_updates in my.cnf not work
-#
+--echo #
+--echo # MDEV-14429 sql_safe_updates in my.cnf not work
+--echo #
select @@sql_safe_updates;
+
+--echo #
+--echo # MDEV-18304 sql_safe_updates does not work with OR clauses
+--echo #
+create table t1 (a int, b int, primary key (a), key (b));
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+update t1 set b=2 where a=1 or b=2;
+explain update t1 set b=2 where a=1 or b=2;
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+delete from t1 where a=1 or b=2;
+explain delete from t1 where a=1 or b=2;
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+update t1 set b=2 where a=1 or b=2;
+delete from t1 where a=1 or b=2;
+drop table t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover_using_new_server_id.result b/mysql-test/suite/binlog/r/binlog_xa_recover_using_new_server_id.result
new file mode 100644
index 00000000000..2495df1845f
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_xa_recover_using_new_server_id.result
@@ -0,0 +1,17 @@
+========= Set server_id to 99 and prepare test table.
+SET GLOBAL server_id= 99;
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+========= Crash the server.
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+INSERT INTO t1 VALUES (1, NULL);
+Got one of the listed errors
+========= Restart the server with default config file in which server_id= 1.
+========= Check that recover succeeds and server is up.
+connection default;
+========= Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+a
+1
+========= Cleanup.
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover_using_new_server_id.test b/mysql-test/suite/binlog/t/binlog_xa_recover_using_new_server_id.test
new file mode 100644
index 00000000000..a7f2a206bae
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_xa_recover_using_new_server_id.test
@@ -0,0 +1,44 @@
+# This test verifies attempt to xa recover using a new server id that
+# different from the transaction's original server_id.
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+# Valgrind does not work well with test that crashes the server
+--source include/not_valgrind.inc
+
+
+--echo ========= Set server_id to 99 and prepare test table.
+SET GLOBAL server_id= 99;
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+
+
+--echo ========= Crash the server.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover_using_new_server_id.test
+EOF
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+--error 2006,2013
+INSERT INTO t1 VALUES (1, NULL);
+
+
+--echo ========= Restart the server with default config file in which server_id= 1.
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-binlog_xa_recover_using_new_server_id.test
+EOF
+
+
+--echo ========= Check that recover succeeds and server is up.
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+
+--echo ========= Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+
+--echo ========= Cleanup.
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
index 79f1b0eb068..1f8351b87f0 100644
--- a/mysql-test/suite/innodb/r/instant_alter_bugs.result
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -451,4 +451,13 @@ ALTER TABLE t ADD d INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t;
+#
+# MDEV-28060 Online DDL fails while checking for instant
+# alter condition
+#
+CREATE TABLE t1(f1 CHAR(10) NOT NULL)ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN(f2 INT NOT NULL, f3 INT NOT NULL,
+f4 INT NOT NULL, f5 INT NOT NULL),
+CHANGE COLUMN f1 f1 CHAR(10) DEFAULT NULL;
+DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result
index fbfd061c9cc..5be1e5c3426 100644
--- a/mysql-test/suite/innodb/r/undo_truncate.result
+++ b/mysql-test/suite/innodb/r/undo_truncate.result
@@ -28,6 +28,8 @@ connection con2;
commit;
disconnect con2;
connection default;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+SET GLOBAL innodb_max_purge_lag_wait=0;
set global innodb_fast_shutdown=0;
# restart
drop table t1, t2;
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index 03465ee86ee..d72624347f7 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -473,4 +473,13 @@ ALTER TABLE t ADD d INT;
--disable_info
DROP TABLE t;
+--echo #
+--echo # MDEV-28060 Online DDL fails while checking for instant
+--echo # alter condition
+--echo #
+CREATE TABLE t1(f1 CHAR(10) NOT NULL)ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN(f2 INT NOT NULL, f3 INT NOT NULL,
+ f4 INT NOT NULL, f5 INT NOT NULL),
+ CHANGE COLUMN f1 f1 CHAR(10) DEFAULT NULL;
+DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test
index cf8c1a8d5e3..437103de787 100644
--- a/mysql-test/suite/innodb/t/undo_truncate.test
+++ b/mysql-test/suite/innodb/t/undo_truncate.test
@@ -46,6 +46,8 @@ connection default;
let $trx_before= `SHOW ENGINE INNODB STATUS`;
let $trx_before= `select substr('$trx_before',9)+2`;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+SET GLOBAL innodb_max_purge_lag_wait=0;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
--replace_regex /.*Trx id counter ([0-9]+).*/\1/
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index ca50699b4c3..fb03f0aa5c2 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2008, 2020, MariaDB Corporation.
+ Copyright (c) 2008, 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
@@ -332,6 +332,13 @@ int my_fstat(File Filedes, MY_STAT *stat_area,
DBUG_PRINT("my",("fd: %d MyFlags: %lu", Filedes, MyFlags));
#ifdef _WIN32
DBUG_RETURN(my_win_fstat(Filedes, stat_area));
+#elif defined HAVE_valgrind
+ {
+ int s= fstat(Filedes, stat_area);
+ if (!s)
+ MSAN_STAT_WORKAROUND(stat_area);
+ DBUG_RETURN(s);
+ }
#else
DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area));
#endif
@@ -350,11 +357,14 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
my_flags)))
goto error;
#ifndef _WIN32
- if (! stat((char *) path, (struct stat *) stat_area) )
- DBUG_RETURN(stat_area);
+ if (!stat((char *) path, (struct stat *) stat_area))
+ {
+ MSAN_STAT_WORKAROUND(stat_area);
+ DBUG_RETURN(stat_area);
+ }
#else
- if (! my_win_stat(path, stat_area) )
- DBUG_RETURN(stat_area);
+ if (!my_win_stat(path, stat_area))
+ DBUG_RETURN(stat_area);
#endif
DBUG_PRINT("error",("Got errno: %d from stat", errno));
my_errno= errno;
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 323ae69a39c..8238e501e7f 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates
- Copyright (c) 2010, 2017, MariaDB
+ Copyright (c) 2010, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -113,7 +113,10 @@ int my_is_symlink(const char *filename __attribute__((unused)))
{
#if defined (HAVE_LSTAT) && defined (S_ISLNK)
struct stat stat_buff;
- return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode);
+ if (lstat(filename, &stat_buff))
+ return 0;
+ MSAN_STAT_WORKAROUND(&stat_buff);
+ return !!S_ISLNK(stat_buff.st_mode);
#elif defined (_WIN32)
DWORD dwAttr = GetFileAttributes(filename);
return (dwAttr != INVALID_FILE_ATTRIBUTES) &&
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index 35272c6b7cd..12e958b706b 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -15,6 +15,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+#include <my_global.h>
#include <config_auth_pam.h>
#include <unistd.h>
#include <string.h>
@@ -22,7 +23,6 @@
#include <sys/wait.h>
#include <mysql/plugin_auth.h>
#include "auth_pam_tool.h"
-#include <my_global.h>
#ifndef DBUG_OFF
static char pam_debug = 0;
diff --git a/sql/datadict.cc b/sql/datadict.cc
index 783229a47a6..b2c4b615c4d 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -163,6 +163,8 @@ cont:
if (mysql_file_fstat(file, &state, MYF(MY_WME)))
goto err;
+ MSAN_STAT_WORKAROUND(&state);
+
if (mysql_file_seek(file, 0, SEEK_SET, MYF(MY_WME)))
goto err;
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc
index 418b5f3b5b0..2ac4e256112 100644
--- a/sql/ddl_log.cc
+++ b/sql/ddl_log.cc
@@ -2491,11 +2491,11 @@ bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
if (unlikely(write_ddl_log_file_entry((*active_entry)->entry_pos)))
{
+ sql_print_error("DDL_LOG: Failed to write entry %u",
+ (*active_entry)->entry_pos);
ddl_log_release_memory_entry(*active_entry);
*active_entry= 0;
error= TRUE;
- sql_print_error("DDL_LOG: Failed to write entry %u",
- (*active_entry)->entry_pos);
}
DBUG_RETURN(error);
}
@@ -2558,13 +2558,13 @@ bool ddl_log_write_execute_entry(uint first_entry,
(*active_entry)->entry_pos, first_entry));
if (write_ddl_log_file_entry((*active_entry)->entry_pos))
{
+ sql_print_error("DDL_LOG: Error writing execute entry %u",
+ (*active_entry)->entry_pos);
if (got_free_entry)
{
ddl_log_release_memory_entry(*active_entry);
*active_entry= 0;
}
- sql_print_error("DDL_LOG: Error writing execute entry %u",
- (*active_entry)->entry_pos);
DBUG_RETURN(TRUE);
}
(void) ddl_log_sync_no_lock();
diff --git a/sql/discover.cc b/sql/discover.cc
index 9b524760b63..201169357a2 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2009, 2020, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -72,6 +72,7 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
error= 2;
if (mysql_file_fstat(file, &state, MYF(0)))
goto err;
+ MSAN_STAT_WORKAROUND(&state);
read_len= (size_t)MY_MIN(FRM_MAX_SIZE, state.st_size); // safety
// Read whole frm file
diff --git a/sql/handler.cc b/sql/handler.cc
index f36dcb4d385..567f1229e5e 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2411,7 +2411,7 @@ struct xarecover_st
*/
static xid_recovery_member*
xid_member_insert(HASH *hash_arg, my_xid xid_arg, MEM_ROOT *ptr_mem_root,
- XID *full_xid_arg)
+ XID *full_xid_arg, decltype(::server_id) server_id_arg)
{
xid_recovery_member *member= (xid_recovery_member *)
alloc_root(ptr_mem_root, sizeof(xid_recovery_member));
@@ -2425,7 +2425,7 @@ xid_member_insert(HASH *hash_arg, my_xid xid_arg, MEM_ROOT *ptr_mem_root,
if (full_xid_arg)
*xid_full= *full_xid_arg;
- *member= xid_recovery_member(xid_arg, 1, false, xid_full);
+ *member= xid_recovery_member(xid_arg, 1, false, xid_full, server_id_arg);
return
my_hash_insert(hash_arg, (uchar*) member) ? NULL : member;
@@ -2440,14 +2440,15 @@ xid_member_insert(HASH *hash_arg, my_xid xid_arg, MEM_ROOT *ptr_mem_root,
*/
static bool xid_member_replace(HASH *hash_arg, my_xid xid_arg,
MEM_ROOT *ptr_mem_root,
- XID *full_xid_arg)
+ XID *full_xid_arg,
+ decltype(::server_id) server_id_arg)
{
xid_recovery_member* member;
if ((member= (xid_recovery_member *)
my_hash_search(hash_arg, (uchar *)& xid_arg, sizeof(xid_arg))))
member->in_engine_prepare++;
else
- member= xid_member_insert(hash_arg, xid_arg, ptr_mem_root, full_xid_arg);
+ member= xid_member_insert(hash_arg, xid_arg, ptr_mem_root, full_xid_arg, server_id_arg);
return member == NULL;
}
@@ -2499,7 +2500,8 @@ static void xarecover_do_commit_or_rollback(handlerton *hton,
Binlog_offset *ptr_commit_max= arg->binlog_coord;
if (!member->full_xid)
- x.set(member->xid);
+ // Populate xid using the server_id from original transaction
+ x.set(member->xid, member->server_id);
else
x= *member->full_xid;
@@ -2655,9 +2657,12 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
*/
if (info->mem_root)
{
- // remember "full" xid too when it's not in mysql format
+ // remember "full" xid too when it's not in mysql format.
+ // Also record the transaction's original server_id. It will be used for
+ // populating the input XID to be searched in hash.
if (xid_member_replace(info->commit_list, x, info->mem_root,
- is_server_xid? NULL : &info->list[i]))
+ is_server_xid? NULL : &info->list[i],
+ is_server_xid? info->list[i].get_trx_server_id() : server_id))
{
info->error= true;
sql_print_error("Error in memory allocation at xarecover_handlerton");
diff --git a/sql/handler.h b/sql/handler.h
index 052554d5747..56e828e5465 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -902,12 +902,13 @@ struct xid_t {
if ((bqual_length= bl))
memcpy(data+gl, b, bl);
}
- void set(ulonglong xid)
+ // Populate server_id if it's specified, otherwise use the current server_id
+ void set(ulonglong xid, decltype(::server_id) trx_server_id= server_id)
{
my_xid tmp;
formatID= 1;
set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
- memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
+ memcpy(data+MYSQL_XID_PREFIX_LEN, &trx_server_id, sizeof(trx_server_id));
tmp= xid;
memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));
gtrid_length=MYSQL_XID_GTRID_LEN;
@@ -933,6 +934,12 @@ struct xid_t {
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
quick_get_my_xid() : 0;
}
+ decltype(::server_id) get_trx_server_id()
+ {
+ decltype(::server_id) trx_server_id;
+ memcpy(&trx_server_id, data+MYSQL_XID_PREFIX_LEN, sizeof(trx_server_id));
+ return trx_server_id;
+ }
uint length()
{
return static_cast<uint>(sizeof(formatID)) + key_length();
@@ -974,11 +981,12 @@ struct xid_recovery_member
bool decided_to_commit;
Binlog_offset binlog_coord; // semisync recovery binlog offset
XID *full_xid; // needed by wsrep or past it recovery
+ decltype(::server_id) server_id; // server id of orginal server
xid_recovery_member(my_xid xid_arg, uint prepare_arg, bool decided_arg,
- XID *full_xid_arg)
+ XID *full_xid_arg, decltype(::server_id) server_id_arg)
: xid(xid_arg), in_engine_prepare(prepare_arg),
- decided_to_commit(decided_arg), full_xid(full_xid_arg) {};
+ decided_to_commit(decided_arg), full_xid(full_xid_arg) , server_id(server_id_arg) {};
};
/* for recover() handlerton call */
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index 8911c683901..57140019341 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -464,6 +464,8 @@ sql_parse_prepare(const LEX_CSTRING *file_name, MEM_ROOT *mem_root,
DBUG_RETURN(0);
}
+ MSAN_STAT_WORKAROUND(&stat_info);
+
if (stat_info.st_size > INT_MAX-1)
{
my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 0403d6e73c3..95adf17987c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2010, 2021, MariaDB
+ Copyright (c) 2010, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -417,7 +417,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item());
- safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES);
+ safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES) &&
+ !thd->lex->describe;
if (safe_update && const_cond)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
@@ -542,7 +543,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
}
/* If running in safe sql mode, don't allow updates without keys */
- if (table->opt_range_keys.is_clear_all())
+ if (!select || !select->quick)
{
thd->set_status_no_index_used();
if (safe_update && !using_limit)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 18629f4bd22..fe2307a2e91 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1188,7 +1188,7 @@ static enum enum_server_command fetch_command(THD *thd, char *packet)
DISPATCH_COMMAND_CLOSE_CONNECTION request of THD shutdown
(s. dispatch_command() description)
@retval
- DISPATCH_COMMAND_WOULDBLOCK - need to wait for asyncronous operations
+ DISPATCH_COMMAND_WOULDBLOCK - need to wait for asynchronous operations
to finish. Only returned if parameter
'blocking' is false.
*/
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 539bea958e8..6a5f1f39e6d 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2011, 2021, MariaDB
+ Copyright (c) 2011, 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
@@ -370,7 +370,8 @@ int mysql_update(THD *thd,
ha_rows *found_return, ha_rows *updated_return)
{
bool using_limit= limit != HA_POS_ERROR;
- bool safe_update= thd->variables.option_bits & OPTION_SAFE_UPDATES;
+ bool safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES)
+ && !thd->lex->describe;
bool used_key_is_modified= FALSE, transactional_table;
bool will_batch= FALSE;
bool can_compare_record;
@@ -597,7 +598,7 @@ int mysql_update(THD *thd,
}
/* If running in safe sql mode, don't allow updates without keys */
- if (table->opt_range_keys.is_clear_all())
+ if (!select || !select->quick)
{
thd->set_status_no_index_used();
if (safe_update && !using_limit)
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 090757ef7ce..29dceeb83b4 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -185,6 +185,7 @@ void buf_pool_t::insert_into_flush_list(buf_block_t *block, lsn_t lsn) noexcept
else
stat.flush_list_bytes+= block->physical_size();
ut_ad(stat.flush_list_bytes <= curr_pool_size);
+ ut_ad(lsn >= log_sys.last_checkpoint_lsn);
block->page.set_oldest_modification(lsn);
MEM_CHECK_DEFINED(block->page.zip.data
@@ -1029,42 +1030,52 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space,
return i;
}
-MY_ATTRIBUTE((nonnull))
+MY_ATTRIBUTE((nonnull, warn_unused_result))
/** Write punch-hole or zeroes of the freed ranges when
innodb_immediate_scrub_data_uncompressed from the freed ranges.
-@param space tablespace which may contain ranges of freed pages */
-static void buf_flush_freed_pages(fil_space_t *space)
+@param space tablespace which may contain ranges of freed pages
+@param writable whether the tablespace is writable
+@return number of pages written or hole-punched */
+static uint32_t buf_flush_freed_pages(fil_space_t *space, bool writable)
{
const bool punch_hole= space->chain.start->punch_hole == 1;
if (!punch_hole && !srv_immediate_scrub_data_uncompressed)
- return;
- lsn_t flush_to_disk_lsn= log_sys.get_flushed_lsn();
+ return 0;
+
+ mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex);
+ mysql_mutex_assert_not_owner(&buf_pool.mutex);
- std::unique_lock<std::mutex> freed_lock(space->freed_range_mutex);
- if (space->freed_ranges.empty()
- || flush_to_disk_lsn < space->get_last_freed_lsn())
+ space->freed_range_mutex.lock();
+ if (space->freed_ranges.empty() ||
+ log_sys.get_flushed_lsn() < space->get_last_freed_lsn())
{
- freed_lock.unlock();
- return;
+ space->freed_range_mutex.unlock();
+ return 0;
}
+ const unsigned physical_size{space->physical_size()};
+
range_set freed_ranges= std::move(space->freed_ranges);
- freed_lock.unlock();
+ uint32_t written= 0;
- for (const auto &range : freed_ranges)
+ if (!writable);
+ else if (punch_hole)
{
- const ulint physical_size= space->physical_size();
-
- if (punch_hole)
+ for (const auto &range : freed_ranges)
{
+ written+= range.last - range.first + 1;
space->reacquire();
space->io(IORequest(IORequest::PUNCH_RANGE),
os_offset_t{range.first} * physical_size,
(range.last - range.first + 1) * physical_size,
nullptr);
}
- else
+ }
+ else
+ {
+ for (const auto &range : freed_ranges)
{
+ written+= range.last - range.first + 1;
for (os_offset_t i= range.first; i <= range.last; i++)
{
space->reacquire();
@@ -1073,8 +1084,10 @@ static void buf_flush_freed_pages(fil_space_t *space)
const_cast<byte*>(field_ref_zero));
}
}
- buf_pool.stat.n_pages_written+= (range.last - range.first + 1);
}
+
+ space->freed_range_mutex.unlock();
+ return written;
}
/** Flushes to disk all flushable pages within the flush area
@@ -1197,14 +1210,12 @@ static ulint buf_free_from_unzip_LRU_list_batch(ulint max)
/** Start writing out pages for a tablespace.
@param id tablespace identifier
-@return tablespace
-@retval nullptr if the pages for this tablespace should be discarded */
-static fil_space_t *buf_flush_space(const uint32_t id)
+@return tablespace and number of pages written */
+static std::pair<fil_space_t*, uint32_t> buf_flush_space(const uint32_t id)
{
- fil_space_t *space= fil_space_t::get(id);
- if (space)
- buf_flush_freed_pages(space);
- return space;
+ if (fil_space_t *space= fil_space_t::get(id))
+ return {space, buf_flush_freed_pages(space, true)};
+ return {nullptr, 0};
}
struct flush_counters_t
@@ -1265,6 +1276,7 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n)
n->flushed + n->evicted < max) ||
recv_recovery_is_on()); ++scanned)
{
+ retry:
buf_page_t *prev= UT_LIST_GET_PREV(LRU, bpage);
const lsn_t oldest_modification= bpage->oldest_modification();
buf_pool.lru_hp.set(prev);
@@ -1290,10 +1302,18 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n)
{
if (last_space_id != space_id)
{
+ buf_pool.lru_hp.set(bpage);
+ mysql_mutex_unlock(&buf_pool.mutex);
if (space)
space->release();
- space= buf_flush_space(space_id);
+ auto p= buf_flush_space(space_id);
+ space= p.first;
last_space_id= space_id;
+ mysql_mutex_lock(&buf_pool.mutex);
+ if (p.second)
+ buf_pool.stat.n_pages_written+= p.second;
+ bpage= buf_pool.lru_hp.get();
+ goto retry;
}
else
ut_ad(!space);
@@ -1428,10 +1448,28 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn)
{
if (last_space_id != space_id)
{
+ mysql_mutex_lock(&buf_pool.flush_list_mutex);
+ buf_pool.flush_hp.set(bpage);
+ mysql_mutex_unlock(&buf_pool.flush_list_mutex);
+ mysql_mutex_unlock(&buf_pool.mutex);
if (space)
space->release();
- space= buf_flush_space(space_id);
+ auto p= buf_flush_space(space_id);
+ space= p.first;
last_space_id= space_id;
+ mysql_mutex_lock(&buf_pool.mutex);
+ if (p.second)
+ buf_pool.stat.n_pages_written+= p.second;
+ mysql_mutex_lock(&buf_pool.flush_list_mutex);
+ bpage= buf_pool.flush_hp.get();
+ if (!bpage)
+ break;
+ if (bpage->id() != page_id)
+ continue;
+ buf_pool.flush_hp.set(UT_LIST_GET_PREV(list, bpage));
+ if (bpage->oldest_modification() <= 1 || !bpage->ready_for_flush())
+ goto next;
+ mysql_mutex_unlock(&buf_pool.flush_list_mutex);
}
else
ut_ad(!space);
@@ -1459,6 +1497,7 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn)
}
mysql_mutex_lock(&buf_pool.flush_list_mutex);
+ next:
bpage= buf_pool.flush_hp.get();
}
@@ -1555,11 +1594,14 @@ bool buf_flush_list_space(fil_space_t *space, ulint *n_flushed)
bool may_have_skipped= false;
ulint max_n_flush= srv_io_capacity;
- mysql_mutex_lock(&buf_pool.mutex);
- mysql_mutex_lock(&buf_pool.flush_list_mutex);
-
bool acquired= space->acquire();
- buf_flush_freed_pages(space);
+ {
+ const uint32_t written{buf_flush_freed_pages(space, acquired)};
+ mysql_mutex_lock(&buf_pool.mutex);
+ if (written)
+ buf_pool.stat.n_pages_written+= written;
+ }
+ mysql_mutex_lock(&buf_pool.flush_list_mutex);
for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.flush_list); bpage; )
{
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 2dc779e81d0..f1cb34dd5f3 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -290,7 +290,7 @@ nothing_read:
/* Trx sys header is so low in the latching order that we play
safe and do not leave the i/o-completion to an asynchronous
i/o-thread. Change buffer pages must always be read with
- syncronous i/o, to make sure they do not get involved in
+ synchronous i/o, to make sure they do not get involved in
thread deadlocks. */
sync = true;
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 0273fcd9a03..329d2bdd179 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -83,7 +83,9 @@ bool fil_space_t::try_to_close(bool print_info)
of fil_system.space_list, so that they would be less likely to be
closed here. */
fil_node_t *node= UT_LIST_GET_FIRST(space.chain);
- ut_ad(node);
+ if (!node)
+ /* fil_ibd_create() did not invoke fil_space_t::add() yet */
+ continue;
ut_ad(!UT_LIST_GET_NEXT(chain, node));
if (!node->is_open())
@@ -444,6 +446,8 @@ static bool fil_node_open_file(fil_node_t *node)
/* Flush tablespaces so that we can close modified files. */
fil_flush_file_spaces();
mysql_mutex_lock(&fil_system.mutex);
+ if (node->is_open())
+ return true;
}
}
@@ -1481,6 +1485,7 @@ static void fil_name_commit_durable(mtr_t *mtr)
log_sys.latch.wr_lock(SRW_LOCK_CALL);
auto lsn= mtr->commit_files();
log_sys.latch.wr_unlock();
+ mtr->flag_wr_unlock();
log_write_up_to(lsn, true);
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 306600d9c2c..703e4379d8c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1760,8 +1760,13 @@ set_max_size:
Field** af = altered_table->field;
Field** const end = altered_table->field
+ altered_table->s->fields;
+ List_iterator_fast<Create_field> cf_it(
+ ha_alter_info->alter_info->create_list);
for (unsigned c = 0; af < end; af++) {
- if (!(*af)->stored_in_db()) {
+ const Create_field* cf = cf_it++;
+ if (!cf->field || !(*af)->stored_in_db()) {
+ /* Ignore virtual or newly created
+ column */
continue;
}
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index dce1b4e9378..3707a693648 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -587,6 +587,9 @@ public:
@return number of buffer count added by this mtr */
uint32_t get_fix_count(const buf_block_t *block) const;
+ /** Note that log_sys.latch is no longer being held exclusively. */
+ void flag_wr_unlock() noexcept { ut_ad(m_latch_ex); m_latch_ex= false; }
+
/** type of page flushing is needed during commit() */
enum page_flush_ahead
{
@@ -632,15 +635,13 @@ private:
ATTRIBUTE_NOINLINE void encrypt();
/** Append the redo log records to the redo log buffer.
- @param ex whether log_sys.latch is already exclusively locked
@return {start_lsn,flush_ahead} */
- std::pair<lsn_t,page_flush_ahead> do_write(bool ex);
+ std::pair<lsn_t,page_flush_ahead> do_write();
/** Append the redo log records to the redo log buffer.
@param len number of bytes to write
- @param ex whether log_sys.latch is exclusively locked
@return {start_lsn,flush_ahead} */
- std::pair<lsn_t,page_flush_ahead> finish_write(size_t len, bool ex);
+ std::pair<lsn_t,page_flush_ahead> finish_write(size_t len);
/** Release the resources */
inline void release_resources();
@@ -664,7 +665,7 @@ private:
/** whether freeing_tree() has been called */
bool m_freeing_tree= false;
#endif
-
+private:
/** The page of the most recent m_log record written, or NULL */
const buf_page_t* m_last;
/** The current byte offset in m_last, or 0 */
@@ -679,6 +680,9 @@ private:
/** whether at least one previously clean buffer pool page was written to */
uint16_t m_made_dirty:1;
+ /** whether log_sys.latch is locked exclusively */
+ uint16_t m_latch_ex:1;
+
/** whether change buffer is latched; only needed in non-debug builds
to suppress some read-ahead operations, @see ibuf_inside() */
uint16_t m_inside_ibuf:1;
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 83b78ebf385..f6fd75d93d0 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -183,11 +183,16 @@ static void *log_mmap(os_file_t file, os_offset_t size)
struct stat st;
if (!fstat(file, &st))
{
+ MSAN_STAT_WORKAROUND(&st);
const auto st_dev= st.st_dev;
- if (!stat("/dev/shm", &st) && st.st_dev == st_dev)
- ptr= my_mmap(0, size_t(size),
- srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE,
- MAP_SHARED, file, 0);
+ if (!stat("/dev/shm", &st))
+ {
+ MSAN_STAT_WORKAROUND(&st);
+ if (st.st_dev == st_dev)
+ ptr= my_mmap(0, size_t(size),
+ srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE,
+ MAP_SHARED, file, 0);
+ }
}
}
#endif /* __linux__ */
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 4e5809952cb..a2df7cde250 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -377,6 +377,7 @@ void mtr_t::start()
new(&m_log) mtr_buf_t();
m_made_dirty= false;
+ m_latch_ex= false;
m_inside_ibuf= false;
m_modifications= false;
m_log_mode= MTR_LOG_ALL;
@@ -405,6 +406,7 @@ void mtr_t::commit()
/* This is a dirty read, for debugging. */
ut_ad(!m_modifications || !recv_no_log_write);
ut_ad(!m_modifications || m_log_mode != MTR_LOG_NONE);
+ ut_ad(!m_latch_ex);
if (m_modifications && (m_log_mode == MTR_LOG_NO_REDO || !m_log.empty()))
{
@@ -414,8 +416,14 @@ void mtr_t::commit()
if (UNIV_LIKELY(m_log_mode == MTR_LOG_ALL))
{
- lsns= do_write(false);
- if (!m_made_dirty)
+ lsns= do_write();
+ if (m_made_dirty);
+ else if (m_latch_ex)
+ {
+ log_sys.latch.wr_unlock();
+ m_latch_ex= false;
+ }
+ else
log_sys.latch.rd_unlock();
}
else
@@ -452,7 +460,13 @@ void mtr_t::commit()
Iterate<ReleaseBlocks> rb{ReleaseBlocks{lsns.first, m_commit_lsn}};
m_memo.for_each_block_in_reverse(rb);
- if (m_made_dirty)
+ if (!m_made_dirty);
+ else if (m_latch_ex)
+ {
+ log_sys.latch.wr_unlock();
+ m_latch_ex= false;
+ }
+ else
log_sys.latch.rd_unlock();
m_memo.for_each_block_in_reverse(CIterate<ReleaseLatches>());
@@ -535,9 +549,10 @@ void mtr_t::commit_shrink(fil_space_t &space)
ut_ad(UT_LIST_GET_LEN(space.chain) == 1);
log_write_and_flush_prepare();
+ m_latch_ex= true;
log_sys.latch.wr_lock(SRW_LOCK_CALL);
- const lsn_t start_lsn= do_write(true).first;
+ const lsn_t start_lsn= do_write().first;
/* Durably write the reduced FSP_SIZE before truncating the data file. */
log_write_and_flush();
@@ -574,6 +589,7 @@ void mtr_t::commit_shrink(fil_space_t &space)
m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks>
(ReleaseBlocks{start_lsn, m_commit_lsn}));
log_sys.latch.wr_unlock();
+ m_latch_ex= false;
mysql_mutex_lock(&fil_system.mutex);
ut_ad(space.is_being_truncated);
@@ -608,6 +624,9 @@ lsn_t mtr_t::commit_files(lsn_t checkpoint_lsn)
ut_ad(!m_freed_space);
ut_ad(!m_freed_pages);
ut_ad(!m_user_space);
+ ut_ad(!m_latch_ex);
+
+ m_latch_ex= true;
if (checkpoint_lsn)
{
@@ -632,7 +651,7 @@ lsn_t mtr_t::commit_files(lsn_t checkpoint_lsn)
m_crc= 0;
m_log.for_each_block([this](const mtr_buf_t::block_t *b)
{ m_crc= my_crc32c(m_crc, b->begin(), b->used()); return true; });
- finish_write(size, true);
+ finish_write(size);
release_resources();
if (checkpoint_lsn)
@@ -883,12 +902,12 @@ static mtr_t::page_flush_ahead log_close(lsn_t lsn) noexcept
return mtr_t::PAGE_FLUSH_SYNC;
}
-std::pair<lsn_t,mtr_t::page_flush_ahead> mtr_t::do_write(bool ex)
+std::pair<lsn_t,mtr_t::page_flush_ahead> mtr_t::do_write()
{
ut_ad(!recv_no_log_write);
ut_ad(m_log_mode == MTR_LOG_ALL);
#ifndef SUX_LOCK_GENERIC
- ut_ad(!ex || log_sys.latch.is_write_locked());
+ ut_ad(!m_latch_ex || log_sys.latch.is_write_locked());
#endif
size_t len= m_log.size() + 5;
@@ -906,28 +925,24 @@ std::pair<lsn_t,mtr_t::page_flush_ahead> mtr_t::do_write(bool ex)
{ m_crc= my_crc32c(m_crc, b->begin(), b->used()); return true; });
}
- if (!ex)
+ if (!m_latch_ex)
log_sys.latch.rd_lock(SRW_LOCK_CALL);
if (UNIV_UNLIKELY(m_user_space && !m_user_space->max_lsn &&
!is_predefined_tablespace(m_user_space->id)))
{
- if (!ex)
+ if (!m_latch_ex)
{
+ m_latch_ex= true;
log_sys.latch.rd_unlock();
log_sys.latch.wr_lock(SRW_LOCK_CALL);
- if (UNIV_LIKELY(!m_user_space->max_lsn))
- name_write();
- std::pair<lsn_t,mtr_t::page_flush_ahead> p{finish_write(len, true)};
- log_sys.latch.wr_unlock();
- log_sys.latch.rd_lock(SRW_LOCK_CALL);
- return p;
+ if (UNIV_UNLIKELY(m_user_space->max_lsn))
+ goto func_exit;
}
- else
- name_write();
+ name_write();
}
-
- return finish_write(len, ex);
+func_exit:
+ return finish_write(len);
}
inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len,
@@ -1042,20 +1057,24 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len,
/** Write the mini-transaction log to the redo log buffer.
@param len number of bytes to write
-@param ex whether log_sys.latch is exclusively locked
@return {start_lsn,flush_ahead} */
std::pair<lsn_t,mtr_t::page_flush_ahead>
-mtr_t::finish_write(size_t len, bool ex)
+mtr_t::finish_write(size_t len)
{
ut_ad(!recv_no_log_write);
ut_ad(m_log_mode == MTR_LOG_ALL);
+#ifndef SUX_LOCK_GENERIC
+# ifndef _WIN32 // there is no accurate is_write_locked() on SRWLOCK
+ ut_ad(m_latch_ex == log_sys.latch.is_write_locked());
+# endif
+#endif
const size_t size{m_commit_lsn ? 5U + 8U : 5U};
std::pair<lsn_t, byte*> start;
if (!log_sys.is_pmem())
{
- start= log_sys.append_prepare<false>(len, ex);
+ start= log_sys.append_prepare<false>(len, m_latch_ex);
m_log.for_each_block([&start](const mtr_buf_t::block_t *b)
{ log_sys.append(start.second, b->begin(), b->used()); return true; });
@@ -1075,7 +1094,7 @@ mtr_t::finish_write(size_t len, bool ex)
#ifdef HAVE_PMEM
else
{
- start= log_sys.append_prepare<true>(len, ex);
+ start= log_sys.append_prepare<true>(len, m_latch_ex);
if (UNIV_LIKELY(start.second + len <= &log_sys.buf[log_sys.file_size]))
{
m_log.for_each_block([&start](const mtr_buf_t::block_t *b)
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index a077f5736da..f37e239fc8b 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -932,7 +932,7 @@ os_file_status_posix(
if (!ret) {
/* file exists, everything OK */
-
+ MSAN_STAT_WORKAROUND(&statinfo);
} else if (errno == ENOENT || errno == ENOTDIR || errno == ENAMETOOLONG) {
/* file does not exist */
return(true);
@@ -1309,7 +1309,11 @@ use_o_direct:
char b[20 + sizeof "/sys/dev/block/" ":"
"/../queue/physical_block_size"];
int f;
- if (fstat(file, &st) || st.st_size & 4095) {
+ if (fstat(file, &st)) {
+ goto skip_o_direct;
+ }
+ MSAN_STAT_WORKAROUND(&st);
+ if (st.st_size & 4095) {
goto skip_o_direct;
}
if (snprintf(b, sizeof b,
@@ -1588,8 +1592,10 @@ bool os_file_close_func(os_file_t file)
os_offset_t
os_file_get_size(os_file_t file)
{
- struct stat statbuf;
- return fstat(file, &statbuf) ? os_offset_t(-1) : statbuf.st_size;
+ struct stat statbuf;
+ if (fstat(file, &statbuf)) return os_offset_t(-1);
+ MSAN_STAT_WORKAROUND(&statbuf);
+ return statbuf.st_size;
}
/** Gets a file size.
@@ -1606,6 +1612,7 @@ os_file_get_size(
int ret = stat(filename, &s);
if (ret == 0) {
+ MSAN_STAT_WORKAROUND(&s);
file_size.m_total_size = s.st_size;
/* st_blocks is in 512 byte sized blocks */
file_size.m_alloc_size = s.st_blocks * 512;
@@ -1650,6 +1657,8 @@ os_file_get_status_posix(
return(DB_FAIL);
}
+ MSAN_STAT_WORKAROUND(statinfo);
+
switch (statinfo->st_mode & S_IFMT) {
case S_IFDIR:
stat_info->type = OS_FILE_TYPE_DIR;
@@ -2763,7 +2772,7 @@ os_file_set_eof(
#endif /* !_WIN32*/
-/** Does a syncronous read or write depending upon the type specified
+/** Does a synchronous read or write depending upon the type specified
In case of partial reads/writes the function tries
NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data.
@param[in] type, IO flags
@@ -3249,6 +3258,7 @@ fallback:
if (fstat(file, &statbuf)) {
err = errno;
} else {
+ MSAN_STAT_WORKAROUND(&statbuf);
os_offset_t current_size = statbuf.st_size;
if (current_size >= size) {
return true;
@@ -4126,7 +4136,10 @@ void fil_node_t::find_metadata(os_file_t file
#else
struct stat sbuf;
if (!statbuf && !fstat(file, &sbuf))
+ {
+ MSAN_STAT_WORKAROUND(&sbuf);
statbuf= &sbuf;
+ }
if (statbuf)
block_size= statbuf->st_blksize;
# ifdef UNIV_LINUX
@@ -4159,6 +4172,7 @@ bool fil_node_t::read_page0()
struct stat statbuf;
if (fstat(handle, &statbuf))
return false;
+ MSAN_STAT_WORKAROUND(&statbuf);
os_offset_t size_bytes= statbuf.st_size;
#else
os_offset_t size_bytes= os_file_get_size(handle);
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 2b7fc71d716..cc1ba3382af 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -119,7 +119,7 @@ TRANSACTIONAL_INLINE inline bool TrxUndoRsegsIterator::set_next()
trx_id_t last_trx_no, tail_trx_no;
{
#ifdef SUX_LOCK_GENERIC
- purge_sys.rseg->latch.rd_lock();
+ purge_sys.rseg->latch.rd_lock(SRW_LOCK_CALL);
#else
transactional_shared_lock_guard<srw_spin_lock> rg
{purge_sys.rseg->latch};
@@ -636,7 +636,7 @@ TRANSACTIONAL_TARGET static void trx_purge_truncate_history()
if (rseg.space != &space)
continue;
#ifdef SUX_LOCK_GENERIC
- rseg.latch.rd_lock();
+ rseg.latch.rd_lock(SRW_LOCK_CALL);
#else
transactional_shared_lock_guard<srw_spin_lock> g{rseg.latch};
#endif
diff --git a/storage/maria/s3_func.h b/storage/maria/s3_func.h
index a062131d5a5..f73a95dea24 100644
--- a/storage/maria/s3_func.h
+++ b/storage/maria/s3_func.h
@@ -141,7 +141,6 @@ C_MODE_END
C_MODE_START
/* Dummy structures and interfaces to be used when compiling without S3 */
struct s3_info;
-typedef struct s3_info S3_INFO;
struct ms3_st;
C_MODE_END
#endif /* WITH_S3_STORAGE_ENGINE */
diff --git a/storage/myisam/mi_info.c b/storage/myisam/mi_info.c
index 9e1a5e416de..b754dde2a7d 100644
--- a/storage/myisam/mi_info.c
+++ b/storage/myisam/mi_info.c
@@ -87,7 +87,10 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
x->index_file_name = share->index_file_name;
}
if ((flag & HA_STATUS_TIME) && !mysql_file_fstat(info->dfile, &state, MYF(0)))
+ {
+ MSAN_STAT_WORKAROUND(&state);
x->update_time=state.st_mtime;
+ }
else
x->update_time=0;
if (flag & HA_STATUS_AUTO)
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
index aa734573a1a..484ef1a00bd 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -190,6 +194,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
index b793346df4b..d4b05f75660 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -188,6 +192,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
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 1db31ca9f95..0b0514a9346 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
@@ -413,6 +413,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +445,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +479,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
index 9f7ada052ed..b222f494ba1 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result
index 2b63fb3ee53..c772ecf797a 100644
--- a/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result
+++ b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result
@@ -216,6 +216,12 @@ PARTITION BY HASH (a) PARTITIONS 2;
SELECT * FROM tbl_a;
ERROR HY000: Unable to connect to foreign data source: localhost
DROP TABLE tbl_a;
+# MDEV-27860 SIGSEGV in spider_parse_connect_info on CREATE TABLE
+CREATE TABLE tbl_a ENGINE=SPIDER COMMENT="TABLE 'unknown_table'"
+PARTITION BY LIST COLUMNS (c) (
+PARTITION p DEFAULT COMMENT="srv 'unknown_server'" ENGINE=SPIDER
+);
+ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error: unknown_server
connection child2_1;
DROP DATABASE auto_test_remote;
connection child2_2;
diff --git a/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test
index e3fef7cb6d6..c2ed2473002 100644
--- a/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test
+++ b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test
@@ -202,6 +202,13 @@ PARTITION BY HASH (a) PARTITIONS 2;
SELECT * FROM tbl_a;
DROP TABLE tbl_a;
+--echo # MDEV-27860 SIGSEGV in spider_parse_connect_info on CREATE TABLE
+--error ER_FOREIGN_SERVER_DOESNT_EXIST
+CREATE TABLE tbl_a ENGINE=SPIDER COMMENT="TABLE 'unknown_table'"
+PARTITION BY LIST COLUMNS (c) (
+ PARTITION p DEFAULT COMMENT="srv 'unknown_server'" ENGINE=SPIDER
+);
+
--connection child2_1
DROP DATABASE auto_test_remote;
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
index 9a8a59153f0..abe543fe193 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -206,6 +210,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
46
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
index f8747cff5ea..6c3a1802f1d 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -204,6 +208,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
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 c171167a1b7..f11b1d9b32c 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
@@ -306,6 +306,10 @@ UNLOCK TABLES;
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -399,6 +403,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
42
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
@@ -417,6 +422,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -445,10 +454,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -470,6 +488,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
index c99c02071b6..249f39520c2 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
@@ -109,6 +109,10 @@ a b c
2.26
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -202,6 +206,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
index 9f7ada052ed..5a3c1d1c893 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
@@ -1049,6 +1049,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1120,6 +1122,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1172,6 +1175,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1202,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1216,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1237,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
index e6c4456edcb..22ba6102405 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
@@ -485,6 +485,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -556,6 +558,7 @@ if ($HAVE_PARTITION)
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result
index b2a2fad5238..6ece4b6255e 100644
--- a/storage/spider/mysql-test/spider/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/r/spider_fixes.result
@@ -413,6 +413,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +445,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +479,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result
new file mode 100644
index 00000000000..354497573e9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result
@@ -0,0 +1,38 @@
+#
+# MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+# MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler= 3;
+Warnings:
+Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_use_handler";
+Variable_name Value
+spider_use_handler 3
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='uhd "3"';
+Warnings:
+Warning 1287 The table parameter 'uhd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='use_handler "3"';
+Warnings:
+Warning 1287 The table parameter 'use_handler' is deprecated and will be removed in a future release
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test
index 56e143060e6..47bc225d614 100644
--- a/storage/spider/mysql-test/spider/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test
new file mode 100644
index 00000000000..f2744b6497f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test
@@ -0,0 +1,27 @@
+--echo #
+--echo # MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--echo # MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler= 3;
+SHOW VARIABLES LIKE "spider_use_handler";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='uhd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='use_handler "3"';
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index 53c2370469e..9dd5a3b9113 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -138,6 +138,20 @@ static MYSQL_SYSVAR_BOOL(
TRUE
);
+static void spider_use_table_value_deprecated(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ int val= *static_cast<const int *>(save);
+ *static_cast<int *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
my_bool spider_param_support_xa()
{
DBUG_ENTER("spider_param_support_xa");
@@ -219,8 +233,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Use table charset for remote access",
NULL,
- NULL,
- -1,
+ spider_use_table_value_deprecated,
+ 1,
-1,
1,
0
@@ -422,8 +436,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Internal offset", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -447,8 +461,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Internal limit", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -472,8 +486,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of rows at a select", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -498,8 +512,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use offset and limit parameter in SQL for split_read parameter.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -523,8 +537,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limit value for semi_split_read", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -549,8 +563,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Initial sql string alloc size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1024, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -575,8 +589,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Reset sql string alloc after execute", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -601,8 +615,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Sprit read mode for multi range", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 100, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -626,8 +640,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Max columns for order by", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 32767, /* def */
-1, /* min */
32767, /* max */
0 /* blk */
@@ -772,8 +786,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use different connection if semi_table_lock is enabled", /* comment */
&spider_param_semi_table_lock_connection_check, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -821,8 +835,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Lock for select with update", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -910,8 +924,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk insert size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -939,8 +953,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of bulk updating and deleting", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -964,8 +978,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk update size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -989,8 +1003,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Buffer size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1015,8 +1029,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1041,8 +1055,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server with local", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1190,8 +1204,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of connecting to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 6, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1217,8 +1231,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of receiving data from remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1244,8 +1258,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of sending data to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1275,8 +1289,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The retrieval result from a remote server is acquired by acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 3, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1300,8 +1314,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of records in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1024, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1325,8 +1339,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limitation of memory size in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 10485760, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1351,8 +1365,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use low memory mode when SQL(SELECT) internally issued to a remote server is executed and get a result list", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1378,8 +1392,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of using columns at select clause", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1406,8 +1420,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of background search", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1432,8 +1446,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1458,8 +1472,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 100, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1484,8 +1498,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1510,8 +1524,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1536,8 +1550,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of cardinality confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 51, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1564,8 +1578,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of cardinality confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1593,8 +1607,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Cardinality synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1621,8 +1635,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Type of cardinality calculation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1646,8 +1660,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Weight coefficient to calculate effectiveness of index from cardinality of column.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1673,8 +1687,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of cardinality confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1699,8 +1713,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of table state confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 10, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1726,8 +1740,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of table state confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1755,8 +1769,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Table state synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1783,8 +1797,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of table state confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1833,8 +1847,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of auto increment.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1926,8 +1940,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute \"REPLACE\" and \"INSERT IGNORE\" on remote server and avoid duplicate check on local server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2255,8 +2269,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of BKA for Spider", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -2330,11 +2344,11 @@ longlong spider_param_udf_ct_bulk_insert_rows(
*/
static MYSQL_THDVAR_INT(
use_handler, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use handler for reading", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2359,8 +2373,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2385,8 +2399,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Write error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2411,8 +2425,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip generating internal default condition", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2439,8 +2453,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip parallel search by specific conditions", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2465,8 +2479,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Send 'ORDER BY' and 'LIMIT' to remote server directly", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -2491,8 +2505,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read only", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2709,8 +2723,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read casually if it is possible", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
63, /* max */
0 /* blk */
@@ -2752,8 +2766,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of delete_all_rows", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2778,8 +2792,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of temporary table name for bka", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2830,8 +2844,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG,
"Store last sts result into system table",
NULL,
- NULL,
- -1,
+ spider_use_table_value_deprecated,
+ 1,
-1,
1,
0
@@ -2857,8 +2871,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG,
"Store last crd result into system table",
NULL,
- NULL,
- -1,
+ spider_use_table_value_deprecated,
+ 1,
-1,
1,
0
@@ -2884,8 +2898,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG,
"Load sts from system table at startup",
NULL,
- NULL,
- -1,
+ spider_use_table_value_deprecated,
+ 1,
-1,
1,
0
@@ -2911,8 +2925,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG,
"Load crd from system table at startup",
NULL,
- NULL,
- -1,
+ spider_use_table_value_deprecated,
+ 1,
-1,
1,
0
@@ -3079,8 +3093,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use columns in select clause strictly for group by clause",
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_use_table_value_deprecated, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 571131411d7..332691efade 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1973,6 +1973,16 @@ int st_spider_param_string_parse::print_param_error()
} \
break; \
}
+#define SPIDER_PARAM_DEPRECATED_WARNING(title_name) \
+ if (!strncasecmp(tmp_ptr, title_name, title_length) && create_table) \
+ { \
+ THD *thd= current_thd; \
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX, \
+ "The table parameter '%s' is deprecated and will be " \
+ "removed in a future release", \
+ title_name); \
+ }
/*
Set a given engine-defined option, which holds a string list, to the
@@ -2334,7 +2344,8 @@ int spider_parse_connect_info(
SPIDER_PARAM_LONGLONG("srd", second_read, 0);
SPIDER_PARAM_DOUBLE("srt", scan_rate, 0);
SPIDER_PARAM_STR_LIST_CHECK("srv", server_names,
- option_struct->remote_server);
+ option_struct &&
+ option_struct->remote_server);
SPIDER_PARAM_DOUBLE("ssr", semi_split_read, 0);
SPIDER_PARAM_LONGLONG("ssl", semi_split_read_limit, 0);
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -2345,8 +2356,10 @@ int spider_parse_connect_info(
SPIDER_PARAM_LONGLONG("srs", static_records_for_status, 0);
SPIDER_PARAM_LONG_LIST_WITH_MAX("svc", tgt_ssl_vscs, 0, 1);
SPIDER_PARAM_STR_LIST_CHECK("tbl", tgt_table_names,
- option_struct->remote_table);
+ option_struct &&
+ option_struct->remote_table);
SPIDER_PARAM_INT_WITH_MAX("tcm", table_count_mode, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("uhd");
SPIDER_PARAM_LONG_LIST_WITH_MAX("uhd", use_handlers, 0, 3);
SPIDER_PARAM_INT_WITH_MAX("upu", use_pushdown_udf, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("utc", use_table_charset, 0, 1);
@@ -2360,13 +2373,15 @@ int spider_parse_connect_info(
goto error;
case 5:
SPIDER_PARAM_STR_LIST_CHECK("table", tgt_table_names,
- option_struct->remote_table);
+ option_struct &&
+ option_struct->remote_table);
error_num = connect_string_parse.print_param_error();
goto error;
case 6:
SPIDER_PARAM_STR_LIST("driver", tgt_drivers);
SPIDER_PARAM_STR_LIST_CHECK("server", server_names,
- option_struct->remote_server);
+ option_struct &&
+ option_struct->remote_server);
SPIDER_PARAM_STR_LIST("socket", tgt_sockets);
SPIDER_PARAM_HINT("idx", key_hint, 3, (int) table_share->keys,
spider_db_append_key_hint);
@@ -2384,7 +2399,8 @@ int spider_parse_connect_info(
goto error;
case 8:
SPIDER_PARAM_STR_LIST_CHECK("database", tgt_dbs,
- option_struct->remote_database);
+ option_struct &&
+ option_struct->remote_database);
SPIDER_PARAM_STR_LIST("password", tgt_passwords);
SPIDER_PARAM_INT_WITH_MAX("sts_mode", sts_mode, 1, 2);
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -2423,6 +2439,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("crd_bg_mode", crd_bg_mode, 0, 2);
SPIDER_PARAM_INT_WITH_MAX("sts_bg_mode", sts_bg_mode, 0, 2);
SPIDER_PARAM_LONG_LIST_WITH_MAX("link_status", link_statuses, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("use_handler");
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_handler", use_handlers, 0, 3);
SPIDER_PARAM_INT_WITH_MAX("casual_read", casual_read, 0, 63);
SPIDER_PARAM_INT("buffer_size", buffer_size, 0);
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 8417e07a6b0..95ac1d50e81 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -738,10 +738,11 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
}
else if (*fmt == 'f' || *fmt == 'g')
{
+ double d;
#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
__msan_check_mem_is_initialized(ap, sizeof(double));
#endif
- double d= va_arg(ap, double);
+ d= va_arg(ap, double);
#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
__msan_unpoison(&d, sizeof(double));
#endif
diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc
index cca95bb6d37..b8666482193 100644
--- a/tpool/aio_liburing.cc
+++ b/tpool/aio_liburing.cc
@@ -161,6 +161,8 @@ private:
}
io_uring_cqe_seen(&aio->uring_, cqe);
+ if (iocb->m_ret_len != iocb->m_len && !iocb->m_err)
+ finish_synchronous(iocb);
// If we need to resubmit the IO operation, but the ring is full,
// we will follow the same path as for any other error codes.
diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc
index 4abc2139881..fc6e5b53e1a 100644
--- a/tpool/aio_linux.cc
+++ b/tpool/aio_linux.cc
@@ -128,6 +128,8 @@ class aio_linux final : public aio
{
iocb->m_ret_len= event.res;
iocb->m_err= 0;
+ if (iocb->m_ret_len != iocb->m_len)
+ finish_synchronous(iocb);
}
iocb->m_internal_task.m_func= iocb->m_callback;
iocb->m_internal_task.m_arg= iocb;
diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc
index 6b6fe71c8ab..4bc58c2930c 100644
--- a/tpool/aio_simulated.cc
+++ b/tpool/aio_simulated.cc
@@ -136,32 +136,7 @@ public:
static void simulated_aio_callback(void *param)
{
aiocb *cb= (aiocb *) param;
-#ifdef _WIN32
- size_t ret_len;
-#else
- ssize_t ret_len;
-#endif
- int err= 0;
- switch (cb->m_opcode)
- {
- case aio_opcode::AIO_PREAD:
- ret_len= pread(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset);
- break;
- case aio_opcode::AIO_PWRITE:
- ret_len= pwrite(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset);
- break;
- default:
- abort();
- }
-#ifdef _WIN32
- if (static_cast<int>(ret_len) < 0)
- err= GetLastError();
-#else
- if (ret_len < 0)
- err= errno;
-#endif
- cb->m_ret_len = ret_len;
- cb->m_err = err;
+ synchronous(cb);
cb->m_internal_task.m_func= cb->m_callback;
thread_pool *pool= (thread_pool *)cb->m_internal;
pool->submit_task(&cb->m_internal_task);
diff --git a/tpool/tpool.h b/tpool/tpool.h
index f857dddd57a..2c61c2d62b2 100644
--- a/tpool/tpool.h
+++ b/tpool/tpool.h
@@ -161,7 +161,7 @@ class aio
{
public:
/**
- Submit asyncronous IO.
+ Submit asynchronous IO.
On completion, cb->m_callback is executed.
*/
virtual int submit_io(aiocb *cb)= 0;
@@ -170,6 +170,10 @@ public:
/** "Unind" file to AIO handler (used on Windows only) */
virtual int unbind(const native_file_handle &fd)= 0;
virtual ~aio(){};
+protected:
+ static void synchronous(aiocb *cb);
+ /** finish a partial read/write callback synchronously */
+ static void finish_synchronous(aiocb *cb);
};
class timer
diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc
index ecc489c3357..a1b9a3ce945 100644
--- a/tpool/tpool_generic.cc
+++ b/tpool/tpool_generic.cc
@@ -52,6 +52,58 @@ namespace tpool
static const int OVERSUBSCRIBE_FACTOR = 2;
/**
+ Process the cb synchronously
+*/
+void aio::synchronous(aiocb *cb)
+{
+#ifdef _WIN32
+ size_t ret_len;
+#else
+ ssize_t ret_len;
+#endif
+ int err= 0;
+ switch (cb->m_opcode)
+ {
+ case aio_opcode::AIO_PREAD:
+ ret_len= pread(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset);
+ break;
+ case aio_opcode::AIO_PWRITE:
+ ret_len= pwrite(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset);
+ break;
+ default:
+ abort();
+ }
+#ifdef _WIN32
+ if (static_cast<int>(ret_len) < 0)
+ err= GetLastError();
+#else
+ if (ret_len < 0)
+ {
+ err= errno;
+ ret_len= 0;
+ }
+#endif
+ cb->m_ret_len = ret_len;
+ cb->m_err = err;
+ if (!err && cb->m_ret_len != cb->m_len)
+ finish_synchronous(cb);
+}
+
+
+/**
+ A partial read/write has occured, continue synchronously.
+*/
+void aio::finish_synchronous(aiocb *cb)
+{
+ assert(cb->m_ret_len != (unsigned int) cb->m_len && !cb->m_err);
+ /* partial read/write */
+ cb->m_buffer= (char *) cb->m_buffer + cb->m_ret_len;
+ cb->m_len-= (unsigned int) cb->m_ret_len;
+ cb->m_offset+= cb->m_ret_len;
+ synchronous(cb);
+}
+
+/**
Implementation of generic threadpool.
This threadpool consists of the following components