From 5a61fd58197deee41b14a02a18550ef628b09442 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 29 Aug 2024 12:30:05 +0200 Subject: [PATCH 001/185] MDEV-34831: MDEV-34704 introduces a typo, --qick Fix MDEV-34704 typos. --- client/mysql.cc | 3 ++- mysql-test/main/client.result | 2 +- mysql-test/main/client.test | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 37f8482cfc5..aadfa72fcf7 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1681,7 +1681,8 @@ static struct my_option my_long_options[] = "if the output is suspended. Doesn't use history file.", &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"quick-max-column-width", 0, - "Maximal field length limit in case of --qick", &quick_max_column_width, + "Maximum number of characters displayed in a column header" + " when using --quick", &quick_max_column_width, &quick_max_column_width, 0, GET_ULONG, REQUIRED_ARG, LONG_MAX, 0, ULONG_MAX, 0, 1, 0}, {"raw", 'r', "Write fields without conversion. Used with --batch.", diff --git a/mysql-test/main/client.result b/mysql-test/main/client.result index bc3b9f64e81..86620d58bc6 100644 --- a/mysql-test/main/client.result +++ b/mysql-test/main/client.result @@ -58,5 +58,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1"); +-----------+------------+----------------------+------+ drop table t1; # -# End of 10.7 tests +# End of 10.5 tests # diff --git a/mysql-test/main/client.test b/mysql-test/main/client.test index 20df85f0807..d7249c15e75 100644 --- a/mysql-test/main/client.test +++ b/mysql-test/main/client.test @@ -42,5 +42,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1"); drop table t1; --echo # ---echo # End of 10.7 tests +--echo # End of 10.5 tests --echo # From b1d74b7e7214178ab0e81b5fb4c27165ecd9f83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 29 Apr 2024 10:13:03 +0300 Subject: [PATCH 002/185] MDEV-33997 : Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*) Problem was that we did not found that table was partitioned and then we should find what is actual underlaying storage engine. We should not use RSU for !InnoDB tables. Signed-off-by: Julius Goryavsky --- mysql-test/suite/wsrep/r/MDEV-33997.result | 38 ++++++++++++++ mysql-test/suite/wsrep/t/MDEV-33997.cnf | 9 ++++ .../suite/wsrep/t/MDEV-33997.combinations | 4 ++ mysql-test/suite/wsrep/t/MDEV-33997.test | 49 +++++++++++++++++++ sql/log_event_server.cc | 14 +++--- sql/sql_parse.cc | 7 +++ 6 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/wsrep/r/MDEV-33997.result create mode 100644 mysql-test/suite/wsrep/t/MDEV-33997.cnf create mode 100644 mysql-test/suite/wsrep/t/MDEV-33997.combinations create mode 100644 mysql-test/suite/wsrep/t/MDEV-33997.test diff --git a/mysql-test/suite/wsrep/r/MDEV-33997.result b/mysql-test/suite/wsrep/r/MDEV-33997.result new file mode 100644 index 00000000000..f0e43462054 --- /dev/null +++ b/mysql-test/suite/wsrep/r/MDEV-33997.result @@ -0,0 +1,38 @@ +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +c +1 +1 +DROP TABLE t; +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +c +1 +DROP TABLE t; +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SELECT * FROM t; +c +DROP TABLE t; +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +COMMIT; +SELECT * FROM t; +c +1 +DROP TABLE t; diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.cnf b/mysql-test/suite/wsrep/t/MDEV-33997.cnf new file mode 100644 index 00000000000..489c4385dbd --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.combinations b/mysql-test/suite/wsrep/t/MDEV-33997.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.test b/mysql-test/suite/wsrep/t/MDEV-33997.test new file mode 100644 index 00000000000..3d015244d7d --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.test @@ -0,0 +1,49 @@ +--source include/have_wsrep.inc +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_partition.inc +# +# MDEV-33997: Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*) +# +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; + +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +DROP TABLE t; + +# +# MDEV-27296 : Assertion `((thd && (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on)) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed +# Second test case +# +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +DROP TABLE t; + +# +# We should not allow RSU for MyISAM +# +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +--error ER_NOT_SUPPORTED_YET +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +DROP TABLE t; + +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; + +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +--error ER_NOT_SUPPORTED_YET +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +DROP TABLE t; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index d8056fd4378..69a27ed6350 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -5519,13 +5519,15 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) #ifdef WITH_WSREP if (WSREP(thd)) { - WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d " + WSREP_WARN("BF applier thread=%lu failed to open_and_lock_tables for " + "%s, fatal: %d " "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)", - thd->get_stmt_da()->sql_errno(), - thd->is_fatal_error, - thd->wsrep_cs().mode(), - thd->wsrep_trx().state(), - (long long) wsrep_thd_trx_seqno(thd)); + thd_get_thread_id(thd), + thd->get_stmt_da()->message(), + thd->is_fatal_error, + thd->wsrep_cs().mode(), + thd->wsrep_trx().state(), + wsrep_thd_trx_seqno(thd)); } #endif /* WITH_WSREP */ if (thd->is_error() && diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 2d6c7621f7b..01fa466780e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4759,6 +4759,13 @@ mysql_execute_command(THD *thd) thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; } + /* Only TOI allowed to !InnoDB tables */ + if (!is_innodb && wsrep_OSU_method_get(thd) != WSREP_OSU_TOI) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); + break; + } + // For !InnoDB we start TOI if it is not yet started and hope for the best if (!is_innodb && !wsrep_toi) { From 9091afdc55ab2e6276256da59ce79e318abfb1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 15 Jun 2023 14:51:56 +0300 Subject: [PATCH 003/185] MDEV-31173 : Server crashes when setting wsrep_cluster_address after adding invalid value to wsrep_allowlist table Problem was that wsrep_schema tables were not marked as category information. Fix allows access to wsrep_schema tables even when node is detached. This is 10.4-10.9 version of fix. Signed-off-by: Julius Goryavsky --- .../r/galera_wsrep_schema_detached.result | 27 +++++++++++++ .../t/galera_wsrep_schema_detached.test | 39 +++++++++++++++++++ sql/table.cc | 23 +++++------ sql/wsrep_schema.cc | 12 +++++- sql/wsrep_schema.h | 12 +++--- 5 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_wsrep_schema_detached.result create mode 100644 mysql-test/suite/galera/t/galera_wsrep_schema_detached.test diff --git a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result new file mode 100644 index 00000000000..493bf9d3cac --- /dev/null +++ b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result @@ -0,0 +1,27 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: async IST sender failed to serve.*"); +SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; +connection node_2; +SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; +SET GLOBAL WSREP_ON=0; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; +EXPECT_1 +1 +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; +EXPECT_2 +2 +connection node_1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; +connection node_2; +Killing server ... +connection node_1; +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test new file mode 100644 index 00000000000..f67091a5fb9 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -0,0 +1,39 @@ +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_1 +call mtr.add_suppression("WSREP: async IST sender failed to serve.*"); +SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; + +--connection node_2 +SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; +SET GLOBAL WSREP_ON=0; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; + +--connection node_1 +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; + +--connection node_2 +--source include/kill_galera.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false'; + +# Cleanup +--source include/auto_increment_offset_restore.inc diff --git a/sql/table.cc b/sql/table.cc index 74b478cb816..f0020deb519 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -276,17 +276,6 @@ const char *fn_frm_ext(const char *name) TABLE_CATEGORY get_table_category(const Lex_ident_db &db, const Lex_ident_table &name) { -#ifdef WITH_WSREP - if (db.str && db.streq(MYSQL_SCHEMA_NAME)) - { - if (name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_STREAMING_TABLE)}) || - name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}) || - name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_MEMBERS_TABLE)})) - { - return TABLE_CATEGORY_INFORMATION; - } - } -#endif /* WITH_WSREP */ if (is_infoschema_db(&db)) return TABLE_CATEGORY_INFORMATION; @@ -308,6 +297,18 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db, return TABLE_CATEGORY_LOG; } +#ifdef WITH_WSREP + if (db.streq(WSREP_LEX_SCHEMA)) + { + if(name.streq(WSREP_LEX_STREAMING)) + return TABLE_CATEGORY_INFORMATION; + if (name.streq(WSREP_LEX_CLUSTER)) + return TABLE_CATEGORY_INFORMATION; + if (name.streq(WSREP_LEX_MEMBERS)) + return TABLE_CATEGORY_INFORMATION; + } +#endif /* WITH_WSREP */ + return TABLE_CATEGORY_USER; } diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index abc387cc15f..4cb839053c3 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2021 Codership Oy +/* Copyright (C) 2015-2023 Codership Oy 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 @@ -35,6 +35,16 @@ #include #include +#define WSREP_SCHEMA "mysql" +#define WSREP_STREAMING_TABLE "wsrep_streaming_log" +#define WSREP_CLUSTER_TABLE "wsrep_cluster" +#define WSREP_MEMBERS_TABLE "wsrep_cluster_members" + +LEX_CSTRING WSREP_LEX_SCHEMA= {STRING_WITH_LEN(WSREP_SCHEMA)}; +LEX_CSTRING WSREP_LEX_STREAMING= {STRING_WITH_LEN(WSREP_STREAMING_TABLE)}; +LEX_CSTRING WSREP_LEX_CLUSTER= {STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}; +LEX_CSTRING WSREP_LEX_MEMBERS= {STRING_WITH_LEN(WSREP_MEMBERS_TABLE)}; + const char* wsrep_sr_table_name_full= WSREP_SCHEMA "/" WSREP_STREAMING_TABLE; static const std::string wsrep_schema_str= WSREP_SCHEMA; diff --git a/sql/wsrep_schema.h b/sql/wsrep_schema.h index 979b175481c..f0f79046768 100644 --- a/sql/wsrep_schema.h +++ b/sql/wsrep_schema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2019 Codership Oy +/* Copyright (C) 2015-2023 Codership Oy 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 @@ -33,11 +33,6 @@ struct TABLE_LIST; struct st_mysql_lex_string; typedef struct st_mysql_lex_string LEX_STRING; -#define WSREP_SCHEMA "mysql" -#define WSREP_STREAMING_TABLE "wsrep_streaming_log" -#define WSREP_CLUSTER_TABLE "wsrep_cluster" -#define WSREP_MEMBERS_TABLE "wsrep_cluster_members" - /** Name of the table in `wsrep_schema_str` used for storing streaming replication data. In an InnoDB full format, e.g. "database/tablename". */ extern const char* wsrep_sr_table_name_full; @@ -146,4 +141,9 @@ class Wsrep_schema extern Wsrep_schema* wsrep_schema; +extern LEX_CSTRING WSREP_LEX_SCHEMA; +extern LEX_CSTRING WSREP_LEX_STREAMING; +extern LEX_CSTRING WSREP_LEX_CLUSTER; +extern LEX_CSTRING WSREP_LEX_MEMBERS; + #endif /* !WSREP_SCHEMA_H */ From 74d716876537e244ae20a71874c9e670e0cfc930 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 30 Aug 2024 10:28:28 -0700 Subject: [PATCH 004/185] MDEV-25084 Assertion failure when moving equality from having to where This bug was fixed by the patch for bug MDEV-26402. Only a test case that failed before this patch was applied is added in this commit. --- mysql-test/main/having_cond_pushdown.result | 10 ++++++++++ mysql-test/main/having_cond_pushdown.test | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 3531c855781..c5877da4abd 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -5187,4 +5187,14 @@ HAVING (SELECT MAX(b) FROM t1) = a AND a > b; a b 2 1 DROP TABLE t1; +# +# MDEV-25084: Moving equality with constant right side +# from HAVING to WHERE +# (fixed by the patch for MDEV-26402) +# +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +f a +DROP TABLE t1; End of 10.5 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index fd414e62a8c..51a346b0ad4 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1584,4 +1584,16 @@ eval $q; DROP TABLE t1; + +--echo # +--echo # MDEV-25084: Moving equality with constant right side +--echo # from HAVING to WHERE +--echo # (fixed by the patch for MDEV-26402) +--echo # + +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +DROP TABLE t1; + --echo End of 10.5 tests From b65bbb2fae419eef54cb79584e618b3ef5409aa2 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 30 Aug 2024 15:49:51 +0200 Subject: [PATCH 005/185] MDEV-34647: small refactoring after main fix --- sql/sql_parse.cc | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 01fa466780e..377d3051794 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4747,36 +4747,36 @@ mysql_execute_command(THD *thd) #ifdef WITH_WSREP if (wsrep && !first_table->view) { - bool is_innodb= first_table->table->file->partition_ht()->db_type == DB_TYPE_INNODB; - - // For consistency check inserted table needs to be InnoDB - if (!is_innodb && thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK) + const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type; + // For InnoDB we don't need to worry about anything here: + if (db_type != DB_TYPE_INNODB) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - HA_ERR_UNSUPPORTED, - "Galera cluster does support consistency check only" - " for InnoDB tables."); - thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; - } - - /* Only TOI allowed to !InnoDB tables */ - if (!is_innodb && wsrep_OSU_method_get(thd) != WSREP_OSU_TOI) - { - my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); - break; - } - - // For !InnoDB we start TOI if it is not yet started and hope for the best - if (!is_innodb && !wsrep_toi) - { - const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type; - - /* Currently we support TOI for MyISAM only. */ - if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam) - WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + // For consistency check inserted table needs to be InnoDB + if (thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + "Galera cluster does support consistency check only" + " for InnoDB tables."); + thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; + } + /* Only TOI allowed to !InnoDB tables */ + if (wsrep_OSU_method_get(thd) != WSREP_OSU_TOI) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); + break; + } + // For !InnoDB we start TOI if it is not yet started and hope for the best + if (!wsrep_toi) + { + /* Currently we support TOI for MyISAM only. */ + if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam) + WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + } } } #endif /* WITH_WSREP */ + /* Only the INSERT table should be merged. Other will be handled by select. From 54a10a429334a9579558a5d284c510d6f8b5bc97 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Tue, 21 May 2024 12:40:19 +0300 Subject: [PATCH 006/185] MDEV-32363 Shut down Galera networking and logging on fatal signal When handling fatal signal, shut down Galera networking before printing out stack trace and writing core file. This is to achieve fail-silent semantics on crashes which may keep the process running for a long time, but not fully responding e.g. due to core dumping or symbol resolving. Also suppress all Galera/wsrep logging to avoid logging from background threads to garble crash information from signal handler. Notice that for fully fail-silent crash, Galera 26.4.19 is needed. Signed-off-by: Julius Goryavsky --- sql/signal_handler.cc | 8 ++++++++ sql/wsrep_server_service.cc | 9 ++++++++- sql/wsrep_server_service.h | 4 ++++ sql/wsrep_server_state.cc | 23 +++++++++++++++++++++++ sql/wsrep_server_state.h | 2 ++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 3d497e39289..002a4c244d1 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -25,6 +25,10 @@ #include "my_stacktrace.h" #include +#ifdef WITH_WSREP +#include "wsrep_server_state.h" +#endif /* WITH_WSREP */ + #ifdef __WIN__ #include #include @@ -221,6 +225,10 @@ extern "C" sig_handler handle_fatal_signal(int sig) "the equation.\n\n"); } +#ifdef WITH_WSREP + Wsrep_server_state::handle_fatal_signal(); +#endif /* WITH_WSREP */ + #ifdef HAVE_STACKTRACE thd= current_thd; diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index af2c3efd214..6184ba2df59 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -161,9 +161,16 @@ void Wsrep_server_service::bootstrap() wsrep_set_SE_checkpoint(wsrep::gtid::undefined(), wsrep_gtid_server.undefined()); } +static std::atomic suppress_logging{false}; +void wsrep_suppress_error_logging() { suppress_logging= true; } + void Wsrep_server_service::log_message(enum wsrep::log::level level, - const char* message) + const char *message) { + if (suppress_logging.load(std::memory_order_relaxed)) + { + return; + } switch (level) { case wsrep::log::debug: diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h index 3a7da229cd4..9a1e148b55f 100644 --- a/sql/wsrep_server_service.h +++ b/sql/wsrep_server_service.h @@ -99,4 +99,8 @@ class Wsrep_storage_service; Wsrep_storage_service* wsrep_create_storage_service(THD *orig_thd, const char *ctx); +/** + Suppress all error logging from wsrep/Galera library. + */ +void wsrep_suppress_error_logging(); #endif /* WSREP_SERVER_SERVICE */ diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index 6bc4eaf4d86..a936d9dd79d 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -18,6 +18,8 @@ #include "wsrep_server_state.h" #include "wsrep_binlog.h" /* init/deinit group commit */ +#include "my_stacktrace.h" /* my_safe_printf_stderr() */ + mysql_mutex_t LOCK_wsrep_server_state; mysql_cond_t COND_wsrep_server_state; @@ -82,3 +84,24 @@ void Wsrep_server_state::destroy() mysql_cond_destroy(&COND_wsrep_server_state); } } + +void Wsrep_server_state::handle_fatal_signal() +{ + if (m_instance) + { + /* Galera background threads are still running and the logging may be + relatively verbose in case of networking error. Silence all wsrep + logging before shutting down networking to avoid garbling signal + handler output. */ + my_safe_printf_stderr("WSREP: Suppressing further logging\n"); + wsrep_suppress_error_logging(); + + /* Shut down all communication with other nodes to fail silently. */ + my_safe_printf_stderr("WSREP: Shutting down network communications\n"); + if (m_instance->provider().set_node_isolation( + wsrep::provider::node_isolation::isolated)) { + my_safe_printf_stderr("WSREP: Galera library does not support node isolation\n"); + } + my_safe_printf_stderr("\n"); + } +} diff --git a/sql/wsrep_server_state.h b/sql/wsrep_server_state.h index 1ef937300f6..43a93fd5aef 100644 --- a/sql/wsrep_server_state.h +++ b/sql/wsrep_server_state.h @@ -56,6 +56,8 @@ public: return (get_provider().capabilities() & capability); } + static void handle_fatal_signal(); + private: Wsrep_server_state(const std::string& name, const std::string& incoming_address, From 69c6cb5dc4907c9133bb6f8077f35ad5eafb7549 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sun, 19 May 2024 00:23:00 +0300 Subject: [PATCH 007/185] Fix recovering state GTID in case log file contains non-text bytes - use grep with -a option. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/include/galera_wsrep_recover.inc | 4 ++-- mysql-test/suite/galera/t/galera_pc_recovery.test | 4 ++-- mysql-test/suite/wsrep/t/wsrep-recover-step.inc | 2 +- scripts/galera_recovery.sh | 4 ++-- scripts/mysqld_safe.sh | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index aa2f0e2e777..efe803dcc9f 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -10,8 +10,8 @@ if (!$wsrep_recover_additional) --perl use strict; - my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; - my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; + my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position); die if $wsrep_start_position eq ''; diff --git a/mysql-test/suite/galera/t/galera_pc_recovery.test b/mysql-test/suite/galera/t/galera_pc_recovery.test index 16abe6fc9ba..0fd9c8ab3d9 100644 --- a/mysql-test/suite/galera/t/galera_pc_recovery.test +++ b/mysql-test/suite/galera/t/galera_pc_recovery.test @@ -38,10 +38,10 @@ SELECT COUNT(*) = 1 FROM t1; --perl use strict; - my $wsrep_start_position1 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position1 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position1); - my $wsrep_start_position2 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position2 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position2); die if $wsrep_start_position1 eq '' || $wsrep_start_position2 eq ''; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc index 22669438fe0..b131ac07641 100644 --- a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc +++ b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc @@ -18,7 +18,7 @@ --perl use strict; - my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position); die if $wsrep_start_position eq ''; open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 9ff5e4e5f50..50aeb3a0b91 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -81,10 +81,10 @@ wsrep_recover_position() { # Parse server's error log for recovered position. The server prints # "..skipping position recovery.." if started without wsrep. - recovered_pos="$(grep 'WSREP: Recovered position:' $log_file)" + recovered_pos="$(grep -a 'WSREP: Recovered position:' $log_file)" if [ -z "$recovered_pos" ]; then - skipped="$(grep WSREP $log_file | grep 'skipping position recovery')" + skipped="$(grep -a WSREP $log_file | grep 'skipping position recovery')" if [ -z "$skipped" ]; then log "WSREP: Failed to recover position: '`cat $log_file`'" exit 1 diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index be115066f80..074840e992d 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -260,9 +260,9 @@ wsrep_recover_position() { exit 1 fi - local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" + local rp="$(grep -a 'WSREP: Recovered position:' $wr_logfile)" if [ -z "$rp" ]; then - local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" + local skipped="$(grep -a WSREP $wr_logfile | grep 'skipping position recovery')" if [ -z "$skipped" ]; then log_error "WSREP: Failed to recover position: '`cat $wr_logfile`'" ret=1 From 7119149f8394d063f2f512a7fefc1d733f048867 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sun, 19 May 2024 21:26:46 +0300 Subject: [PATCH 008/185] If donor loop receives unknown signal from the SST script it is an error condition (SST failure), so it should set error code before exiting. Signed-off-by: Julius Goryavsky --- sql/wsrep_sst.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 08a3d159e94..13500a83f43 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1840,6 +1840,8 @@ wait_signal: else { WSREP_WARN("Received unknown signal: '%s'", out); + /* since it is the end of the loop, we must set error code */ + err=-EINVAL; proc.wait(); } } From 731a5aba0b6eb465e82a3f243c5daaf735f7313f Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sun, 19 May 2024 21:08:46 +0300 Subject: [PATCH 009/185] Use only MySQL code for TOI error vote For TOI events specifically we have a situation where in case of the same error different nodes may generate different messages. This may be for two reasons: - different locale setting between the current client session and server default (we can reasonably require server locales to be identical on all nodes, but user can change message locale for the session) - non-deterministic course of STATEMENT execution e.g. for ALTER TABLE On the other hand we may reasonably expect TOI event failures since they are executed after replication, so we must ensure that voting is consistent. For that purpose error codes should be sufficiently unique and deterministic for TOI event failures as DDLs normally deal with a single object, so we can merely use MySQL error codes to vote on. Notice that this problem does not happen with regular transactional writesets, since the originator node will always vote success and replica nodes are assumed to have the same global locale setting. As such different error messages indicate different errors even if the error code is the same (e.g. ER_DUP_KEY can happen on different rows tables). Use only MySQL error code (without the error message) for error voting in case of TOI event failure. Signed-off-by: Julius Goryavsky --- .../suite/galera_3nodes/r/galera_toi_vote.result | 3 ++- .../suite/galera_3nodes/t/galera_toi_vote.test | 3 +++ sql/wsrep_applier.cc | 16 +++++++++++++--- sql/wsrep_applier.h | 16 +++++++++++++++- sql/wsrep_high_priority_service.cc | 11 ++++++----- sql/wsrep_mysqld.cc | 5 ++++- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result index d8d3abe40e9..345fa92c13d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result +++ b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result @@ -7,8 +7,9 @@ connection node_3; SET SESSION wsrep_on=OFF; DROP SCHEMA test; connection node_1; +SET SESSION lc_messages='fr_FR'; CREATE SCHEMA test; -ERROR HY000: Can't create database 'test'; database exists +ERROR HY000: Ne peut créer la base 'test'; elle existe déjà connection node_1; SET SESSION wsrep_sync_wait=0; connection node_2; diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test index 6bc87cf8874..bd53c510cd4 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test +++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test @@ -24,6 +24,9 @@ DROP SCHEMA test; # This should fail on nodes 1 and 2 and succeed on node 3 --connection node_1 +# Make error message on source node different by changing locale +# It should still agree with node 2 +SET SESSION lc_messages='fr_FR'; --error ER_DB_CREATE_EXISTS CREATE SCHEMA test; diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index 513e17b3045..0ec8e6e7f47 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -82,7 +82,9 @@ wsrep_get_apply_format(THD* thd) return thd->wsrep_rgi->rli->relay_log.description_event_for_exec; } -void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst) +void wsrep_store_error(const THD* const thd, + wsrep::mutable_buffer& dst, + bool const include_msg) { Diagnostics_area::Sql_condition_iterator it= thd->get_stmt_da()->sql_conditions(); @@ -100,8 +102,16 @@ void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst) uint const err_code= cond->get_sql_errno(); const char* const err_str= cond->get_message_text(); - slider+= my_snprintf(slider, buf_end - slider, " %s, Error_code: %d;", - err_str, err_code); + if (include_msg) + { + slider+= snprintf(slider, buf_end - slider, " %s, Error_code: %d;", + err_str, err_code); + } + else + { + slider+= snprintf(slider, buf_end - slider, " Error_code: %d;", + err_code); + } } if (slider != dst.data()) diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h index fefca306a70..e633b1b9bf2 100644 --- a/sql/wsrep_applier.h +++ b/sql/wsrep_applier.h @@ -35,7 +35,21 @@ int wsrep_apply_events(THD* thd, #define WSREP_ERR_FAILED 6 // Operation failed for some internal reason #define WSREP_ERR_ABORTED 7 // Operation was aborted externally -void wsrep_store_error(const THD* thd, wsrep::mutable_buffer& buf); +/* Loops over THD diagnostic area and concatenates all error messages + * and error codes to a single continuous buffer to create a unique + * but consistent failure signature which provider can use for voting + * between the nodes in the cluster. + * + * @param thd THD context + * @param dst buffer to store the signature + * @param include_msg whether to use MySQL error message in addition to + * MySQL error code. Note that in the case of a TOI + * operation the message may be not consistent between + * the nodes e.g. due to a different client locale setting + * and should be omitted */ +void wsrep_store_error(const THD* thd, + wsrep::mutable_buffer& buf, + bool include_msg); class Format_description_log_event; void wsrep_set_apply_format(THD*, Format_description_log_event*); diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 7eb3f07849a..2c0e2e643fa 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -123,14 +123,15 @@ static void wsrep_setup_uk_and_fk_checks(THD* thd) static int apply_events(THD* thd, Relay_log_info* rli, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err) + wsrep::mutable_buffer& err, + bool const include_msg) { int const ret= wsrep_apply_events(thd, rli, data.data(), data.size()); if (ret || wsrep_thd_has_ignored_error(thd)) { if (ret) { - wsrep_store_error(thd, err); + wsrep_store_error(thd, err, include_msg); } wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size()); } @@ -427,7 +428,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, #endif thd->set_time(); - int ret= apply_events(thd, m_rli, data, err); + int ret= apply_events(thd, m_rli, data, err, false); wsrep_thd_set_ignored_error(thd, false); trans_commit(thd); @@ -595,7 +596,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, #endif /* ENABLED_DEBUG_SYNC */ wsrep_setup_uk_and_fk_checks(thd); - int ret= apply_events(thd, m_rli, data, err); + int ret= apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) @@ -764,7 +765,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, ws_meta, thd->wsrep_sr().fragments()); } - ret= ret || apply_events(thd, m_rli, data, err); + ret= ret || apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) { diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index e584c2cc144..6bb879a0367 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2489,7 +2489,10 @@ static void wsrep_TOI_end(THD *thd) { if (thd->is_error() && !wsrep_must_ignore_error(thd)) { - wsrep_store_error(thd, err); + /* use only error code, for the message can be inconsistent + * between the nodes due to differing lc_message settings + * in client session and server applier thread */ + wsrep_store_error(thd, err, false); } int const ret= client_state.leave_toi_local(err); From 83196a7b2398ed3caa52a04e09b656828ad64804 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sun, 19 May 2024 22:09:18 +0300 Subject: [PATCH 010/185] Add a basic MTR test for DDL error voting to ensure that all DDLs generate consistent error messages, Signed-off-by: Julius Goryavsky --- .../suite/galera/r/galera_vote_ddl.result | 70 +++++++++++++++++++ mysql-test/suite/galera/t/galera_vote_ddl.inc | 54 ++++++++++++++ .../suite/galera/t/galera_vote_ddl.test | 34 +++++++++ 3 files changed, 158 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera_vote_ddl.result create mode 100644 mysql-test/suite/galera/t/galera_vote_ddl.inc create mode 100644 mysql-test/suite/galera/t/galera_vote_ddl.test diff --git a/mysql-test/suite/galera/r/galera_vote_ddl.result b/mysql-test/suite/galera/r/galera_vote_ddl.result new file mode 100644 index 00000000000..bc5d99256e5 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_vote_ddl.result @@ -0,0 +1,70 @@ +connection node_2; +connection node_1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_1; +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); +connection node_1; +DROP TABLE nonexistent; +ERROR 42S02: Unknown table 'test.nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +TRUNCATE TABLE nonexistent; +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE nonexistent.t1 (s INT); +ERROR 42000: Unknown database 'nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE t1 (s INT); +ERROR 42S01: Table 't1' already exists +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +ALTER TABLE nonexistent ADD COLUMN (c INT); +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +DROP TABLE t1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 0; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 0; +connection node_1; +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); +connection node_1; +DROP TABLE nonexistent; +ERROR 42S02: Unknown table 'test.nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +TRUNCATE TABLE nonexistent; +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE nonexistent.t1 (s INT); +ERROR 42000: Unknown database 'nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE t1 (s INT); +ERROR 42S01: Table 't1' already exists +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +ALTER TABLE nonexistent ADD COLUMN (c INT); +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +DROP TABLE t1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 7; diff --git a/mysql-test/suite/galera/t/galera_vote_ddl.inc b/mysql-test/suite/galera/t/galera_vote_ddl.inc new file mode 100644 index 00000000000..80a543fb886 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_ddl.inc @@ -0,0 +1,54 @@ +--connection node_1 +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); + +--connection node_1 +--error 1051 +DROP TABLE nonexistent; + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1146 +TRUNCATE TABLE nonexistent; + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1049 +CREATE TABLE nonexistent.t1 (s INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1050 +CREATE TABLE t1 (s INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1146 +ALTER TABLE nonexistent ADD COLUMN (c INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_vote_ddl.test b/mysql-test/suite/galera/t/galera_vote_ddl.test new file mode 100644 index 00000000000..9db6e612e7e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_ddl.test @@ -0,0 +1,34 @@ +# +# Test voting on identical DDL errors (error messages should match) +# + +--source include/galera_cluster.inc +--source include/have_binlog_format_row.inc + +# +# 1. Ignore all DDL errors (avoids voting) +# +--connection node_1 +--let $wsrep_ignore_apply_errors_saved1 = `SELECT @@global.wsrep_ignore_apply_errors` +SET @@global.wsrep_ignore_apply_errors = 7; +--connection node_2 +--let $wsrep_ignore_apply_errors_saved2 = `SELECT @@global.wsrep_ignore_apply_errors` +SET @@global.wsrep_ignore_apply_errors = 7; + +--source galera_vote_ddl.inc + +# +# 2. Don't ignore any errors (forces voting) +# +--connection node_1 +SET @@global.wsrep_ignore_apply_errors = 0; +--connection node_2 +SET @@global.wsrep_ignore_apply_errors = 0; + +--source galera_vote_ddl.inc + +--connection node_1 +--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved1 + +--connection node_2 +--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved2 From dd64f29d6bea6f36be9634edd5c2d27f2205ca33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 12 Apr 2024 11:24:42 +0300 Subject: [PATCH 011/185] MDEV-33897 : Galera test failure on galera_3nodes.galera_gtid_consistency Based on logs SST was started before donor reached Primaty state. Add wait_conditions to make sure that nodes reach Primary state before starting next node. Signed-off-by: Julius Goryavsky --- .../r/galera_gtid_consistency.result | 33 +++++++------- .../t/galera_gtid_consistency.cnf | 35 ++++++--------- .../t/galera_gtid_consistency.test | 44 ++++++++++++++++--- 3 files changed, 71 insertions(+), 41 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result index ffc5ec0627a..91ff0342b8d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result @@ -1,6 +1,9 @@ connection node_2; connection node_1; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; set wsrep_sync_wait=0; connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; @@ -44,9 +47,9 @@ connection node_1b; connection node_1; connection node_3; connection node_1; -CALL insert_row('node1', 500); +CALL insert_row('node1', 100); connection node_3; -CALL insert_row('node3', 500); +CALL insert_row('node3', 100); CREATE TABLE t2(i int primary key) engine=innodb; connection node_2; # Restart node_2 @@ -60,7 +63,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 connection node_2; # GTID in node2 show variables like 'wsrep_gtid_domain_id'; @@ -68,7 +71,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 connection node_3; # GTID in node3 show variables like 'wsrep_gtid_domain_id'; @@ -76,7 +79,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 # Shutdown node_3 connection node_3; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; @@ -98,7 +101,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 connection node_2; # GTID in node2 show variables like 'wsrep_gtid_domain_id'; @@ -106,7 +109,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 connection node_3; # GTID in node3 show variables like 'wsrep_gtid_domain_id'; @@ -114,7 +117,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 # One by one shutdown all nodes connection node_3; # shutdown node_3 @@ -132,7 +135,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -163,7 +166,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_2; node2 GTID show variables like 'wsrep_gtid_domain_id'; @@ -171,7 +174,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_3; node3 GTID show variables like 'wsrep_gtid_domain_id'; @@ -179,22 +182,22 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_1; table size in node1 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_2; table size in node2 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_3; table size in node3 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_2; call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node"); call mtr.add_suppression("Sending JOIN failed: "); diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf index c27490faf36..c0acbe58ad3 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf @@ -1,38 +1,31 @@ !include ../galera_3nodes.cnf +[mysqld] +loose-galera-gtid-consistency=1 +wsrep_sst_auth="root:" +wsrep_sst_method=mariabackup +log_slave_updates=ON +log_bin=mariadb-bin-log +binlog-format=row +wsrep-gtid-mode=ON +wsrep-debug=1 +gtid-strict-mode=1 + [mysqld.1] wsrep-node-name="node1" -wsrep_gtid_domain_id=1111 gtid_domain_id=2 server_id=10999 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1111 [mysqld.2] wsrep-node-name="node2" -wsrep_gtid_domain_id=1112 gtid_domain_id=3 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1112 [mysqld.3] wsrep-node-name="node3" -wsrep_gtid_domain_id=1113 gtid_domain_id=4 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1113 [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test index f00972b0461..6a160720398 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test @@ -13,6 +13,13 @@ # from the bootstrap node (node_1), and use it # --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + --connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 set wsrep_sync_wait=0; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 @@ -98,10 +105,10 @@ show variables like '%gtid_binlog_pos%'; # while node 2 is absent # --connection node_1 -CALL insert_row('node1', 500); +CALL insert_row('node1', 100); --connection node_3 -CALL insert_row('node3', 500); +CALL insert_row('node3', 100); CREATE TABLE t2(i int primary key) engine=innodb; @@ -225,12 +232,19 @@ show variables like '%gtid_binlog_pos%'; # bootstap cluster in order node1 - node2 - node3 # send some inserts and DDL after each node started # ---sleep 5 + --echo # Bootstrap from node_1 --connection node_1 --let $restart_parameters = --wsrep_new_cluster --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + show variables like 'wsrep_gtid_domain_id'; show variables like '%gtid_binlog_pos%'; @@ -243,6 +257,13 @@ ANALYZE TABLE t2; --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + # # connection node_1b may not be functional anymore, after node was # shutdown, open node_1c for controlling node 1 state @@ -265,6 +286,14 @@ ALTER TABLE t2 ADD COLUMN (k int); --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + + --connection node_1c --echo # wait until all nodes are back in cluster --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; @@ -335,13 +364,18 @@ DROP TABLE t2; DROP TABLE t3; --connection node_3 ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3' --source include/wait_condition.inc --connection node_2 ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3' --source include/wait_condition.inc +# Restore original auto_increment_offset values. +--let $galera_cluster_size=3 +--source ../galera/include/auto_increment_offset_restore.inc + --disconnect node_3 --disconnect node_2b --disconnect node_1b --disconnect node_1c + From 7e748d075b7dc8aef36b1155cc43253d6a8a8ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 30 Aug 2024 08:32:10 +0300 Subject: [PATCH 012/185] MDEV-34841 : Enable working Galera tests * Fixes galera.galera_bf_kill_debug test case. * Enable galera_ssl_upgrade, galera_ssl_reload, galera_pc_bootstrap * Add MDEV to disabled tests that miss it Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/t/galera_ssl_upgrade.cnf | 4 ++++ mysql-test/suite/galera/t/galera_ssl_upgrade.test | 2 ++ mysql-test/suite/galera_3nodes/disabled.def | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 2954ae0f4cb..7c495102564 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -1,5 +1,9 @@ !include ../galera_2nodes.cnf +[mysqld] +loose-galera-ssl-upgrade=1 +wsrep-debug=1 + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index c09615527fd..78897ffd738 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -7,6 +7,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_ssl_communication.inc +--source include/have_openssl.inc +--source include/force_restart.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index b7f0d8da8c1..c52df019c65 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -11,5 +11,6 @@ ############################################################################## galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed -galera_pc_bootstrap : temporarily disabled at the request of Codership -galera_ipv6_mariabackup_section : temporarily disabled at the request of Codership +galera_ipv6_rsync : MDEV-34842 Can't connect to server on '::1' (115) +galera_ipv6_rsync_section : MDEV-34842 Can't connect to server on '::1' (115) +galera_ipv6_mariabackup_section : MDEV-34842 Can't connect to server on '::1' (115) From 1c48950e1f82829c6a21cd0b54d5011959a54755 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Wed, 19 Jun 2024 14:08:13 +0300 Subject: [PATCH 013/185] MDEV-30536: Fix Galera bulk insert optimization MTR test After closing https://github.com/codership/galera-bugs/issues/947, Galera now correctly certifies table-level keys, which made bulk insert work again. The corresponding MTR test is made deterministic and re-enabled. Requires Galera 26.4.19 Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 1 - .../suite/galera/r/galera_insert_bulk.result | 19 +++++++- .../suite/galera/t/galera_insert_bulk.test | 43 +++++++++++++++++-- 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 447d30c458d..0c15ec63f2c 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -14,7 +14,6 @@ galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up galera_bf_kill_debug : timeout after 900 seconds galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos' -galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert() galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() diff --git a/mysql-test/suite/galera/r/galera_insert_bulk.result b/mysql-test/suite/galera/r/galera_insert_bulk.result index f4d4adf64e1..7191464ba64 100644 --- a/mysql-test/suite/galera/r/galera_insert_bulk.result +++ b/mysql-test/suite/galera/r/galera_insert_bulk.result @@ -2,6 +2,8 @@ connection node_2; connection node_1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +connection node_1; SET foreign_key_checks = 0; SET unique_checks = 0; START TRANSACTION; @@ -10,11 +12,20 @@ SET foreign_key_checks = 1; SET unique_checks = 1; INSERT INTO t1 VALUES (1001); connection node_1; +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +connection node_1; +SET foreign_key_checks = 0; +SET unique_checks = 0; START TRANSACTION; connection node_2; SET foreign_key_checks = 1; @@ -23,8 +34,14 @@ START TRANSACTION; INSERT INTO t1 VALUES (1001); connection node_1; COMMIT; -2 +3 connection node_2; +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/galera_insert_bulk.test b/mysql-test/suite/galera/t/galera_insert_bulk.test index f58870d5f74..7faf8356420 100644 --- a/mysql-test/suite/galera/t/galera_insert_bulk.test +++ b/mysql-test/suite/galera/t/galera_insert_bulk.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc # # Make bulk insert BF-abort, but regular insert succeed. @@ -13,6 +15,10 @@ --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +# Delay applying of the single insert from the other node. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; + +--connection node_1 # Disable foreign and unique key checks to allow bulk insert. SET foreign_key_checks = 0; SET unique_checks = 0; @@ -30,7 +36,7 @@ while ($count < 1000) --connection node_2 -# Disable bulk insert. +# Disable bulk insert on this node. SET foreign_key_checks = 1; SET unique_checks = 1; @@ -38,10 +44,20 @@ SET unique_checks = 1; INSERT INTO t1 VALUES (1001); --connection node_1 + +# We need to trigger Galera-level certification conflict. For this: +# - start applying single insert from the other node before bulk insert certifies +# - certifying bulk insert will lead to the conflict +# - keep applying single insert +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; + --error ER_LOCK_DEADLOCK COMMIT; DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; # # Make bulk insert succeed, but regular insert BF-abort. @@ -50,8 +66,17 @@ DROP TABLE t1; --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +--connection node_2 +# Delay applying of the bulk insert from the other node. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; + +--connection node_1 --let $before_bulk_keys = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` +# Disable foreign and unique key checks to allow bulk insert. +SET foreign_key_checks = 0; +SET unique_checks = 0; + START TRANSACTION; --let $count=0 @@ -64,8 +89,7 @@ while ($count < 1000) --enable_query_log --connection node_2 - -# Disable bulk insert. +# Disable bulk insert on this node. SET foreign_key_checks = 1; SET unique_checks = 1; @@ -77,12 +101,23 @@ INSERT INTO t1 VALUES (1001); --connection node_1 COMMIT; -# Expect two keys to be added for bulk insert: DB-level shared key and table-level exclusive key. +# Expect three keys to be added for bulk insert: "zero-level" key, DB-level shared key and table-level exclusive key. --let $bulk_keys_count = `SELECT VARIABLE_VALUE - $before_bulk_keys FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` --echo $bulk_keys_count --connection node_2 + +# We need to trigger Galera-level certification conflict. For this: +# - start applying bulk insert from the other node before local insert certifies +# - certifying local insert will lead to the conflict +# - keep applying bulk insert +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; + --error ER_LOCK_DEADLOCK COMMIT; DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +--source include/galera_end.inc From b1f75221701c3ddd5de25ebb2322b3a109ccf20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 30 Aug 2024 08:32:10 +0300 Subject: [PATCH 014/185] MDEV-34841 : Enable working Galera tests * Fixes galera.galera_bf_kill_debug test case. * Enable galera_ssl_upgrade, galera_ssl_reload, galera_pc_bootstrap * Add MDEV to disabled tests that miss it P.S. This commit contains additional changes compared to the similar commit for 10.5 branch. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 2 -- mysql-test/suite/galera/r/galera_bf_kill_debug.result | 7 +++++-- mysql-test/suite/galera/t/galera_bf_kill_debug.test | 9 +++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 0c15ec63f2c..e00bdbf85c0 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -12,8 +12,6 @@ galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up -galera_bf_kill_debug : timeout after 900 seconds -galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos' galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert() galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() diff --git a/mysql-test/suite/galera/r/galera_bf_kill_debug.result b/mysql-test/suite/galera/r/galera_bf_kill_debug.result index c3eae243f47..52bd1b0e370 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill_debug.result +++ b/mysql-test/suite/galera/r/galera_bf_kill_debug.result @@ -22,16 +22,19 @@ update t1 set b= 1 where a=1; connection node_2b; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached"; connection node_2; -SET DEBUG_SYNC= 'before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; +SET DEBUG_SYNC= 'wsrep_kill_before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; connection node_2b; SET DEBUG_SYNC='now WAIT_FOR awake_reached'; SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort"; +connection node_1; +COMMIT; +connection node_2b; SET DEBUG_SYNC = "now SIGNAL continue_kill"; connection node_2; connection node_2a; select * from t1; -connection node_2; +connection node_2b; SET DEBUG_SYNC = "RESET"; drop table t1; disconnect node_2a; diff --git a/mysql-test/suite/galera/t/galera_bf_kill_debug.test b/mysql-test/suite/galera/t/galera_bf_kill_debug.test index c322f283757..d24a6dd19ef 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill_debug.test +++ b/mysql-test/suite/galera/t/galera_bf_kill_debug.test @@ -66,7 +66,7 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached"; # # pause KILL execution before awake # -SET DEBUG_SYNC= 'before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; +SET DEBUG_SYNC= 'wsrep_kill_before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; --disable_query_log --send_eval KILL $k_thread --enable_query_log @@ -78,6 +78,11 @@ SET DEBUG_SYNC='now WAIT_FOR awake_reached'; # release applier and KILL operator SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort"; + +--connection node_1 +COMMIT; + +--connection node_2b SET DEBUG_SYNC = "now SIGNAL continue_kill"; --connection node_2 @@ -87,7 +92,7 @@ SET DEBUG_SYNC = "now SIGNAL continue_kill"; --error 0,1213,2013 select * from t1; ---connection node_2 +--connection node_2b SET DEBUG_SYNC = "RESET"; drop table t1; From 235f33e3606b79c5e3b75f4cfd1ca6d92320e9a2 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Wed, 17 Jan 2024 17:32:29 +0300 Subject: [PATCH 015/185] MDEV-33133: MDL conflict handling code should skip BF-aborted trxs It's possible that MDL conflict handling code is called more than once for a transaction when: - it holds more than one conflicting MDL lock - reschedule_waiters() is executed, which results in repeated attempts to BF-abort already aborted transaction. In such situations, it might be that BF-aborting logic sees a partially rolled back transaction and erroneously decides on future actions for such a transaction. The specific situation tested and fixed is when a SR transaction applied in the node gets BF-aborted by a started TOI operation. It's then caught with the server transaction already rolled back, but with no MDL locks yet released. This caused wrong state detection for such a transaction during repeated MDL conflict handling code execution. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-33133.result | 34 ++++++++ mysql-test/suite/galera/t/MDEV-33133.test | 80 +++++++++++++++++++ .../t/galera_gtid_consistency.test | 2 - sql/wsrep_high_priority_service.cc | 12 +++ sql/wsrep_mysqld.cc | 13 ++- 5 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-33133.result create mode 100644 mysql-test/suite/galera/t/MDEV-33133.test diff --git a/mysql-test/suite/galera/r/MDEV-33133.result b/mysql-test/suite/galera/r/MDEV-33133.result new file mode 100644 index 00000000000..a326b5efc4d --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-33133.result @@ -0,0 +1,34 @@ +connection node_2; +connection node_1; +connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_rollback_mdl_release'; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_1a; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ha_write_row_start SIGNAL may_toi WAIT_FOR bf_abort'; +INSERT INTO t1 VALUES (2); +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR may_toi'; +SET DEBUG_SYNC = 'after_wsrep_thd_abort WAIT_FOR sync.wsrep_rollback_mdl_release_reached'; +TRUNCATE TABLE t1; +connection node_1a; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_rollback_mdl_release'; +connection node_2; +INSERT INTO t1 VALUES (3); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +disconnect node_1a; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/MDEV-33133.test b/mysql-test/suite/galera/t/MDEV-33133.test new file mode 100644 index 00000000000..90d1f93f4cb --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-33133.test @@ -0,0 +1,80 @@ +# +# MDEV-33133: MDL conflict handling code should skip transactions +# BF-aborted before. +# +# It's possible that MDL conflict handling code is called more +# than once for a transaction when: +# - it holds more than one conflicting MDL lock +# - reschedule_waiters() is executed, +# which results in repeated attempts to BF-abort already aborted +# transaction. +# In such situations, it might be that BF-aborting logic sees +# a partially rolled back transaction and erroneously decides +# on future actions for such a transaction. +# +# The specific situation tested and fixed is when a SR transaction +# applied in the node gets BF-aborted by a started TOI operation. +# It's then caught with the server transaction already rolled back, +# but with no MDL locks yet released. This caused wrong state +# detection for such a transaction during repeated MDL conflict +# handling code execution. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1 + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_rollback_mdl_release'; + +--connection node_2 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +--connection node_1a +# Sync wait for SR transaction to replicate and apply fragment. +SELECT COUNT(*) FROM t1; +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ha_write_row_start SIGNAL may_toi WAIT_FOR bf_abort'; +--send + INSERT INTO t1 VALUES (2); + +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR may_toi'; +# BF-abort SR transaction and wait until it reaches the point +# prior to release MDL locks. +# Then abort local INSERT, which will go through rescedule_waiters() +# and see SR transaction holding MDL locks but already rolled back. +# In this case SR transaction should be skipped in MDL conflict +# handling code. +SET DEBUG_SYNC = 'after_wsrep_thd_abort WAIT_FOR sync.wsrep_rollback_mdl_release_reached'; +--send + TRUNCATE TABLE t1; + +--connection node_1a +# Local INSERT gets aborted. +--error ER_LOCK_DEADLOCK +--reap +# Let the aborted SR transaction continue and finally release MDL locks, +# which in turn allows TRUNCATE to complete. +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_rollback_mdl_release'; + +--connection node_2 +# SR transaction has been BF-aborted. +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (3); + +--connection node_1 +# TRUNCATE completes. +--reap + +# Cleanup +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +--disconnect node_1a +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test index 6a160720398..871014b39d0 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test @@ -2,7 +2,6 @@ --source include/big_test.inc --source include/force_restart.inc - # # Testing gtid consistency in 3 node cluster when nodes drop # and join back to cluster. @@ -378,4 +377,3 @@ DROP TABLE t3; --disconnect node_2b --disconnect node_1b --disconnect node_1c - diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 2c0e2e643fa..1838095687f 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -392,6 +392,18 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle, wsrep_thd_transaction_state_str(m_thd), m_thd->killed); +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_rollback_mdl_release", + { + const char act[]= + "now " + "SIGNAL sync.wsrep_rollback_mdl_release_reached " + "WAIT_FOR signal.wsrep_rollback_mdl_release"; + DBUG_ASSERT(!debug_sync_set_action(m_thd, + STRING_WITH_LEN(act))); + };); +#endif + m_thd->release_transactional_locks(); free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC)); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 6bb879a0367..83de938aa13 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2747,8 +2747,15 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, mysql_mutex_lock(&granted_thd->LOCK_thd_kill); mysql_mutex_lock(&granted_thd->LOCK_thd_data); - if (wsrep_thd_is_toi(granted_thd) || - wsrep_thd_is_applying(granted_thd)) + if (granted_thd->wsrep_aborter != 0) + { + DBUG_ASSERT(granted_thd->wsrep_aborter == request_thd->thread_id); + WSREP_DEBUG("BF thread waiting for a victim to release locks"); + mysql_mutex_unlock(&granted_thd->LOCK_thd_data); + mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); + } + else if (wsrep_thd_is_toi(granted_thd) || + wsrep_thd_is_applying(granted_thd)) { if (wsrep_thd_is_aborting(granted_thd)) { @@ -2824,6 +2831,8 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, { mysql_mutex_unlock(&request_thd->LOCK_thd_data); } + + DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } /**/ From a50a5e0f3b5e93ffa07ea13ef90a3a3356bba5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 26 Jul 2024 09:04:30 +0300 Subject: [PATCH 016/185] MDEV-34647 : 'INSERT...SELECT' on MyISAM table suddenly replicated by Galera Replication of MyISAM and Aria DML is experimental and best effort only. Earlier change make INSERT SELECT on both MyISAM and Aria to replicate using TOI and STATEMENT replication. Replication should happen only if user has set needed wsrep_mode setting. Note: This commit contains additional changes compared to those already made for the 10.5 branch. + small refactoring after main fix. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-34647.result | 3 ++- mysql-test/suite/galera/r/mdev-22063.result | 4 ++++ mysql-test/suite/galera/t/MDEV-34647.test | 5 ++--- mysql-test/suite/galera/t/mdev-22063.test | 5 +++++ sql/sql_parse.cc | 5 ++++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera/r/MDEV-34647.result b/mysql-test/suite/galera/r/MDEV-34647.result index 16a4e839f13..0333f14ece1 100644 --- a/mysql-test/suite/galera/r/MDEV-34647.result +++ b/mysql-test/suite/galera/r/MDEV-34647.result @@ -39,7 +39,7 @@ id val 7 d 9 d 11 d -set global wsrep_mode=REPLICATE_MYISAM; +set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA'; create table t4(id serial, val varchar(100)) engine=myisam; insert into t4 values(null, 'a'); insert into t4 values(null, 'b'); @@ -95,6 +95,7 @@ id val 4 d 5 d 6 d +set global wsrep_mode=default; connection node_1; drop table t1,t2,t3,t4,t5; set global wsrep_mode=default; diff --git a/mysql-test/suite/galera/r/mdev-22063.result b/mysql-test/suite/galera/r/mdev-22063.result index 585d70acb61..228f63d6688 100644 --- a/mysql-test/suite/galera/r/mdev-22063.result +++ b/mysql-test/suite/galera/r/mdev-22063.result @@ -17,12 +17,14 @@ SELECT * FROM s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 connection node_2; +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; SELECT * FROM t1; a SELECT * FROM s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 connection node_1; +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; DROP TABLE t1; DROP SEQUENCE s; # Case 2 REPLACE INTO ... SELECT with error @@ -240,3 +242,5 @@ pk DROP TABLE t1; DROP VIEW view_t1; SET GLOBAL wsrep_mode=DEFAULT; +connection node_2; +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index 8840c233c6d..db776681aa1 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -22,7 +22,7 @@ insert into t3 select null, 'c'; insert into t3 select null, 'd' from t3; select * from t3; -set global wsrep_mode=REPLICATE_MYISAM; +set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA'; create table t4(id serial, val varchar(100)) engine=myisam; insert into t4 values(null, 'a'); @@ -45,9 +45,8 @@ select * from t2; select * from t3; select * from t4; select * from t5; - +set global wsrep_mode=default; --connection node_1 drop table t1,t2,t3,t4,t5; set global wsrep_mode=default; - diff --git a/mysql-test/suite/galera/t/mdev-22063.test b/mysql-test/suite/galera/t/mdev-22063.test index ccc199e308f..260067d8a7b 100644 --- a/mysql-test/suite/galera/t/mdev-22063.test +++ b/mysql-test/suite/galera/t/mdev-22063.test @@ -16,6 +16,7 @@ SELECT * FROM t1; SELECT * FROM s; --connection node_2 +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 's' @@ -27,6 +28,7 @@ SELECT * FROM t1; SELECT * FROM s; --connection node_1 +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; DROP TABLE t1; DROP SEQUENCE s; @@ -183,3 +185,6 @@ SELECT * FROM t1; DROP TABLE t1; DROP VIEW view_t1; SET GLOBAL wsrep_mode=DEFAULT; + +--connection node_2 +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9d432e7f821..3bf814d663f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4728,8 +4728,11 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) if (!wsrep_toi) { /* Currently we support TOI for MyISAM only. */ - if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam) + if ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) || + (db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))) + { WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + } } } } From 72243bc23605ff0ba7409789e4fda1e43be83427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 14 Jun 2023 08:55:58 +0300 Subject: [PATCH 017/185] MDEV-31173 : Server crashes when setting wsrep_cluster_address after adding invalid value to wsrep_allowlist table Problem was that wsrep_schema tables were not marked as category information. Fix allows access to wsrep_schema tables even when node is detached. Signed-off-by: Julius Goryavsky --- .../suite/galera/r/galera_wsrep_schema_detached.result | 9 +++++++++ .../suite/galera/t/galera_wsrep_schema_detached.test | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result index 493bf9d3cac..41275ede6d2 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result +++ b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result @@ -11,12 +11,21 @@ SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_allowlist; +EXPECT_0 +0 SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; EXPECT_1 1 SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; EXPECT_2 2 +INSERT INTO mysql.wsrep_allowlist (ip) VALUES (0); +SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig; +SELECT 1; +1 +1 +DELETE FROM mysql.wsrep_allowlist; connection node_1; SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; connection node_2; diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test index f67091a5fb9..9942d63f142 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -13,9 +13,15 @@ SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_allowlist; SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; +INSERT INTO mysql.wsrep_allowlist (ip) VALUES (0); +SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig; +SELECT 1; +DELETE FROM mysql.wsrep_allowlist; + --connection node_1 SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; From 819765a47dd1aab58fc1693ce7b19c1f3015b375 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 9 Aug 2024 11:22:14 +0300 Subject: [PATCH 018/185] Code cleanup in test_if_skip_sort_order() Added comments Moved a part into find_indexes_matching_order(). --- sql/sql_select.cc | 112 +++++++++++++++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 32 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d8958041160..1b8552a805e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -330,6 +330,14 @@ static void optimize_rownum(THD *thd, SELECT_LEX_UNIT *unit, Item *cond); static bool process_direct_rownum_comparison(THD *thd, SELECT_LEX_UNIT *unit, Item *cond); +static +bool find_indexes_matching_order(JOIN *join, TABLE *table, ORDER *order, + key_map *usable_keys); +static +void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, + Item_field *item_field, + key_map *col_keys); + #ifndef DBUG_OFF /* @@ -24633,6 +24641,7 @@ find_field_in_item_list (Field *field, void *data) that belong to 'table' and are equal to 'item_field'. */ +static void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, Item_field *item_field, key_map *col_keys) @@ -24777,6 +24786,58 @@ static void prepare_for_reverse_ordered_access(JOIN_TAB *tab) } +/* + @brief + Given a table and order, find indexes that produce rows in the order + + @param usable_keys OUT Bitmap of indexes that produce rows in order. + + @return + false Some indexes were found + true No indexes found +*/ + +static +bool find_indexes_matching_order(JOIN *join, TABLE *table, ORDER *order, + key_map *usable_keys) +{ + /* Find indexes that cover all ORDER/GROUP BY fields */ + for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) + { + Item *item= (*tmp_order->item)->real_item(); + if (item->type() != Item::FIELD_ITEM) + { + usable_keys->clear_all(); + return true; /* No suitable keys */ + } + + /* + Take multiple-equalities into account. Suppose we have + ORDER BY col1, col10 + and there are + multiple-equal(col1, col2, col3), + multiple-equal(col10, col11). + + Then, + - when item=col1, we find the set of indexes that cover one of {col1, + col2, col3} + - when item=col10, we find the set of indexes that cover one of {col10, + col11} + + And we compute an intersection of these sets to find set of indexes that + cover all ORDER BY components. + */ + key_map col_keys; + compute_part_of_sort_key_for_equals(join, table, (Item_field*)item, + &col_keys); + usable_keys->intersect(col_keys); + if (usable_keys->is_clear_all()) + return true; // No usable keys + } + return false; + +} + /** Test if we can skip the ORDER BY by using an index. @@ -24838,41 +24899,17 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, been taken into account. */ usable_keys= *map; - - /* Find indexes that cover all ORDER/GROUP BY fields */ - for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) + + // Step #1: Find indexes that produce the required ordering. + if (find_indexes_matching_order(tab->join, table, order, &usable_keys)) { - Item *item= (*tmp_order->item)->real_item(); - if (item->type() != Item::FIELD_ITEM) - { - usable_keys.clear_all(); - DBUG_RETURN(0); - } - - /* - Take multiple-equalities into account. Suppose we have - ORDER BY col1, col10 - and there are - multiple-equal(col1, col2, col3), - multiple-equal(col10, col11). - - Then, - - when item=col1, we find the set of indexes that cover one of {col1, - col2, col3} - - when item=col10, we find the set of indexes that cover one of {col10, - col11} - - And we compute an intersection of these sets to find set of indexes that - cover all ORDER BY components. - */ - key_map col_keys; - compute_part_of_sort_key_for_equals(tab->join, table, (Item_field*)item, - &col_keys); - usable_keys.intersect(col_keys); - if (usable_keys.is_clear_all()) - goto use_filesort; // No usable keys + DBUG_RETURN(false); // Cannot skip sorting } + /* + Step #2: Analyze the current access method. Note the used index as ref_key + and #used keyparts in ref_key_parts. + */ ref_key= -1; /* Test if constant range in WHERE */ if (tab->ref.key >= 0 && tab->ref.key_parts) @@ -24916,6 +24953,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } } + /* + Step #3: Check if index ref_key that we're using produces the required + ordering or if there is another index new_ref_key such that + - ref_key is a prefix of new_ref_key (so, access method can be reused) + - new_ref_key produces the required ordering + */ if (ref_key >= 0 && ref_key != MAX_KEY) { /* Current access method uses index ref_key with ref_key_parts parts */ @@ -25035,6 +25078,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, &used_key_parts))) goto check_reverse_order; } + + /* + Step #4: Go through all indexes that produce required ordering (in + usable_keys) and check if any of them is cheaper than ref_key + */ { uint UNINIT_VAR(best_key_parts); uint saved_best_key_parts= 0; From c8d040938a7ebe10e62506a726702c5990ef4dda Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 18 Aug 2024 20:10:19 +0300 Subject: [PATCH 019/185] MDEV-34720: Poor plan choice for large JOIN with ORDER BY and small LIMIT (Variant 2b: call greedy_search() twice, correct handling for limited search_depth) Modify the join optimizer to specifically try to produce join orders that can short-cut their execution for ORDER BY..LIMIT clause. The optimization is controlled by @@optimizer_join_limit_pref_ratio. Default value 0 means don't construct short-cutting join orders. Other value means construct short-cutting join order, and prefer it only if it promises speedup of more than #value times. In Optimizer Trace, look for these names: * join_limit_shortcut_is_applicable * join_limit_shortcut_plan_search * join_limit_shortcut_choice --- mysql-test/main/mysqld--help.result | 10 + mysql-test/main/order_by_limit_join.result | 461 ++++++++++++++++++ mysql-test/main/order_by_limit_join.test | 207 ++++++++ .../sys_vars/r/sysvars_server_embedded.result | 10 + .../r/sysvars_server_notembedded.result | 10 + sql/sql_class.h | 1 + sql/sql_select.cc | 394 ++++++++++++++- sql/sql_select.h | 14 + sql/sys_vars.cc | 14 + 9 files changed, 1110 insertions(+), 11 deletions(-) create mode 100644 mysql-test/main/order_by_limit_join.result create mode 100644 mysql-test/main/order_by_limit_join.test diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index cabf8037508..08cd1202655 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -724,6 +724,15 @@ The following specify which files/extra groups are read (specified before remain keys. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. Use 'ALL' to set all combinations. + --optimizer-join-limit-pref-ratio=# + For queries with JOIN and ORDER BY LIMIT : make the + optimizer consider a join order that allows to short-cut + execution after producing #LIMIT matches if that promises + N times speedup. (A conservative setting here would be is + a high value, like 100 so the short-cutting plan is used + if it promises a speedup of 100x or more). Short-cutting + plans are inherently risky so the default is 0 which + means do not consider this optimization --optimizer-max-sel-arg-weight=# The maximum weight of the SEL_ARG graph. Set to 0 for no limit @@ -1697,6 +1706,7 @@ old-mode UTF8_IS_UTF8MB3 old-passwords FALSE old-style-user-limits FALSE optimizer-adjust-secondary-key-costs +optimizer-join-limit-pref-ratio 0 optimizer-max-sel-arg-weight 32000 optimizer-max-sel-args 16000 optimizer-prune-level 1 diff --git a/mysql-test/main/order_by_limit_join.result b/mysql-test/main/order_by_limit_join.result new file mode 100644 index 00000000000..3f48aa3f65f --- /dev/null +++ b/mysql-test/main/order_by_limit_join.result @@ -0,0 +1,461 @@ +# +# MDEV-34720: Poor plan choice for large JOIN with ORDER BY and small LIMIT +# +create table t1 ( +a int, +b int, +c int, +col1 int, +col2 int, +index(a), +index(b), +index(col1) +); +insert into t1 select +mod(seq, 100), +mod(seq, 95), +seq, +seq, +seq +from +seq_1_to_10000; +create table t10 ( +a int, +a_value char(10), +key(a) +); +insert into t10 select seq, seq from seq_1_to_100; +create table t11 ( +b int, +b_value char(10), +key(b) +); +insert into t11 select seq, seq from seq_1_to_100; +set @tmp_os=@@optimizer_trace; +set optimizer_trace=1; +# +# Query 1 - basic example. +# +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a,b col1 5 NULL 10 Using where +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "fanout": 1, + "read_time": 53.27053125, + "table": "t1", + "rows_estimation": 10000, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "updated_limit": 10, + "index_scan_time": 10, + "records": 10000, + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": 46064.98442, + "risk_ratio": 10, + "shortcut_join_cost": 97.28224614, + "shortcut_cost_with_risk": 972.8224614, + "use_shortcut_cost": true + } +] +# +# Query 2 - same as above but without a suitable index. +# +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +# t1 is first but there's no suitable index, +# so we use filesort but using temporary: +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 10000 Using where; Using filesort +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [], + "can_skip_filesort": false, + "full_join_cost": 46064.98442, + "risk_ratio": 10, + "shortcut_join_cost": 2097.281246, + "shortcut_cost_with_risk": 20972.81246, + "use_shortcut_cost": true + } +] +# +# Query 3: Counter example with large limit +# +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 5000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +# Same plan as above: +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 5000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.5, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "fanout": 1, + "read_time": 53.27053125, + "table": "t1", + "rows_estimation": 10000, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "updated_limit": 5000, + "index_scan_time": 5000, + "usable": false, + "cause": "cost" + } + ] + } + } + ], + "can_skip_filesort": false, + "full_join_cost": 46064.98442, + "risk_ratio": 10, + "shortcut_join_cost": 24059.12698, + "shortcut_cost_with_risk": 240591.2698, + "use_shortcut_cost": false + } +] +# +# Query 4: LEFT JOIN makes it impossible to put ORDER-BY-table first, +# however the optimizer still puts it as sort_by_table. +# +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t10 left join (t1 join t11 on t1.b=t11.b ) on t1.a=t10.a +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 100 Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +# This will show nothing as limit shortcut code figures that +# it's not possible to use t1 to construct shortcuts: +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +NULL +# +# Query 5: Same as Q1 but also with a semi-join +# +set optimizer_join_limit_pref_ratio=default; +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +where +t1.a in (select a from t10) and +t1.b in (select b from t11) +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 PRIMARY t10 ref a a 5 test.t10.a 1 Using index; LooseScan +1 PRIMARY t1 ref a,b a 5 test.t10.a 100 Using where +1 PRIMARY t11 ref b b 5 test.t1.b 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t11 index b b 5 NULL 100 Using index +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +where +t1.a in (select a from t10) and +t1.b in (select b from t11) +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index a,b col1 5 NULL 1 Using where +1 PRIMARY t10 ref a a 5 test.t1.a 1 +1 PRIMARY t11 ref b b 5 test.t1.b 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t11 index b b 5 NULL 100 Using index +2 MATERIALIZED t10 index a a 5 NULL 100 Using index +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "fanout": 1, + "read_time": 53.27053125, + "table": "t1", + "rows_estimation": 10000, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "updated_limit": 10, + "index_scan_time": 10, + "records": 10000, + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": 47079.71684, + "risk_ratio": 10, + "shortcut_join_cost": 98.29697856, + "shortcut_cost_with_risk": 982.9697856, + "use_shortcut_cost": true + } +] +# +# Query 6: same as Query 1 but let's limit the search depth +# +set @tmp_osd=@@optimizer_search_depth; +set optimizer_search_depth=1; +set optimizer_join_limit_pref_ratio=default; +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t11 ALL b NULL NULL NULL 100 Using join buffer (flat, BNL join) +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a,b col1 5 NULL 10 Using where +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "fanout": 1, + "read_time": 53.27053125, + "table": "t1", + "rows_estimation": 10000, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "updated_limit": 10, + "index_scan_time": 10, + "records": 10000, + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": 46064.98442, + "risk_ratio": 10, + "shortcut_join_cost": 97.28224614, + "shortcut_cost_with_risk": 972.8224614, + "use_shortcut_cost": true + } +] +set optimizer_search_depth=@tmp_osd; +set optimizer_trace=@tmp_os; +set optimizer_join_limit_pref_ratio=default; +drop table t1, t10, t11; diff --git a/mysql-test/main/order_by_limit_join.test b/mysql-test/main/order_by_limit_join.test new file mode 100644 index 00000000000..da05cdc30c3 --- /dev/null +++ b/mysql-test/main/order_by_limit_join.test @@ -0,0 +1,207 @@ +--echo # +--echo # MDEV-34720: Poor plan choice for large JOIN with ORDER BY and small LIMIT +--echo # + +--source include/have_sequence.inc + +# We need optimizer trace +--source include/not_embedded.inc + +create table t1 ( + a int, + b int, + c int, + col1 int, + col2 int, + index(a), + index(b), + index(col1) +); + +insert into t1 select + mod(seq, 100), + mod(seq, 95), + seq, + seq, + seq +from + seq_1_to_10000; + + +create table t10 ( + a int, + a_value char(10), + key(a) +); +insert into t10 select seq, seq from seq_1_to_100; + +create table t11 ( + b int, + b_value char(10), + key(b) +); +insert into t11 select seq, seq from seq_1_to_100; + +set @tmp_os=@@optimizer_trace; +set optimizer_trace=1; + +--echo # +--echo # Query 1 - basic example. +--echo # +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 2 - same as above but without a suitable index. +--echo # +let $query= +explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col2 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +eval $query; + +--echo # t1 is first but there's no suitable index, +--echo # so we use filesort but using temporary: +set optimizer_join_limit_pref_ratio=10; +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 3: Counter example with large limit +--echo # +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 5000; + +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +eval $query; + +--echo # Same plan as above: +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=10; +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 4: LEFT JOIN makes it impossible to put ORDER-BY-table first, +--echo # however the optimizer still puts it as sort_by_table. +--echo # +set optimizer_join_limit_pref_ratio=10; +explain +select + * +from + t10 left join (t1 join t11 on t1.b=t11.b ) on t1.a=t10.a +order by + t1.col2 +limit 10; + +set @trace=(select trace from information_schema.optimizer_trace); +--echo # This will show nothing as limit shortcut code figures that +--echo # it's not possible to use t1 to construct shortcuts: +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 5: Same as Q1 but also with a semi-join +--echo # +set optimizer_join_limit_pref_ratio=default; +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +where + t1.a in (select a from t10) and + t1.b in (select b from t11) +order by + t1.col1 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 6: same as Query 1 but let's limit the search depth +--echo # +set @tmp_osd=@@optimizer_search_depth; +set optimizer_search_depth=1; +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 10; + +set optimizer_join_limit_pref_ratio=default; +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + + +set optimizer_search_depth=@tmp_osd; +set optimizer_trace=@tmp_os; +set optimizer_join_limit_pref_ratio=default; +drop table t1, t10, t11; + diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index b5c47ac5ecd..42b661bc448 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2282,6 +2282,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT For queries with JOIN and ORDER BY LIMIT : make the optimizer consider a join order that allows to short-cut execution after producing #LIMIT matches if that promises N times speedup. (A conservative setting here would be is a high value, like 100 so the short-cutting plan is used if it promises a speedup of 100x or more). Short-cutting plans are inherently risky so the default is 0 which means do not consider this optimization +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARGS VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 59b9cbb8d96..b626551a570 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2442,6 +2442,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT For queries with JOIN and ORDER BY LIMIT : make the optimizer consider a join order that allows to short-cut execution after producing #LIMIT matches if that promises N times speedup. (A conservative setting here would be is a high value, like 100 so the short-cutting plan is used if it promises a speedup of 100x or more). Short-cutting plans are inherently risky so the default is 0 which means do not consider this optimization +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARGS VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED diff --git a/sql/sql_class.h b/sql/sql_class.h index a347700f72f..615bf97a0ef 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -760,6 +760,7 @@ typedef struct system_variables ulong net_retry_count; ulong net_wait_timeout; ulong net_write_timeout; + ulonglong optimizer_join_limit_pref_ratio; ulong optimizer_prune_level; ulong optimizer_search_depth; ulong optimizer_selectivity_sampling_limit; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1b8552a805e..3be4adb092f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -233,12 +233,14 @@ static COND *make_cond_for_table_from_pred(THD *thd, Item *root_cond, static Item* part_of_refkey(TABLE *form,Field *field); uint find_shortest_key(TABLE *table, const key_map *usable_keys); -static bool test_if_cheaper_ordering(const JOIN_TAB *tab, +static bool test_if_cheaper_ordering(bool in_join_optimizer, + const JOIN_TAB *tab, ORDER *order, TABLE *table, key_map usable_keys, int key, ha_rows select_limit, int *new_key, int *new_key_direction, ha_rows *new_select_limit, + double *new_read_time, uint *new_used_key_parts= NULL, uint *saved_best_key_parts= NULL); static int test_if_order_by_key(JOIN *join, @@ -330,6 +332,10 @@ static void optimize_rownum(THD *thd, SELECT_LEX_UNIT *unit, Item *cond); static bool process_direct_rownum_comparison(THD *thd, SELECT_LEX_UNIT *unit, Item *cond); +static +bool join_limit_shortcut_is_applicable(const JOIN *join); +POSITION *join_limit_shortcut_finalize_plan(JOIN *join, double *cost); + static bool find_indexes_matching_order(JOIN *join, TABLE *table, ORDER *order, key_map *usable_keys); @@ -5817,6 +5823,7 @@ make_join_statistics(JOIN *join, List &tables_list, join->sort_by_table= get_sort_by_table(join->order, join->group_list, join->select_lex->leaf_tables, join->const_table_map); + join->limit_shortcut_applicable= join_limit_shortcut_is_applicable(join); /* Update info on indexes that can be used for search lookups as reading const tables may has added new sargable predicates. @@ -9175,6 +9182,7 @@ choose_plan(JOIN *join, table_map join_tables) THD *thd= join->thd; DBUG_ENTER("choose_plan"); + join->limit_optimization_mode= false; join->cur_embedding_map= 0; reset_nj_counters(join, join->join_list); qsort2_cmp jtab_sort_func; @@ -9232,9 +9240,45 @@ choose_plan(JOIN *join, table_map join_tables) if (search_depth == 0) /* Automatically determine a reasonable value for 'search_depth' */ search_depth= determine_search_depth(join); + + double limit_cost= DBL_MAX; + POSITION *limit_plan= NULL; + + /* First, build a join plan that can short-cut ORDER BY...LIMIT */ + if (join->limit_shortcut_applicable && !join->emb_sjm_nest) + { + bool res; + Json_writer_object wrapper(join->thd); + Json_writer_array trace(join->thd, "join_limit_shortcut_plan_search"); + join->limit_optimization_mode= true; + res= greedy_search(join, join_tables, search_depth, prune_level, + use_cond_selectivity); + join->limit_optimization_mode= false; + + if (res) + DBUG_RETURN(TRUE); + DBUG_ASSERT(join->best_read != DBL_MAX); + + /* + We've built a join order. Adjust its cost based on ORDER BY...LIMIT + short-cutting. + */ + limit_plan= join_limit_shortcut_finalize_plan(join, &limit_cost); + } + + /* The main call to search for the query plan: */ if (greedy_search(join, join_tables, search_depth, prune_level, use_cond_selectivity)) DBUG_RETURN(TRUE); + + DBUG_ASSERT(join->best_read != DBL_MAX); + if (limit_plan && limit_cost < join->best_read) + { + /* Plan that uses ORDER BY ... LIMIT shortcutting is better. */ + memcpy((uchar*)join->best_positions, (uchar*)limit_plan, + sizeof(POSITION)*join->table_count); + join->best_read= limit_cost; + } } /* @@ -10344,6 +10388,311 @@ check_if_edge_table(POSITION *pos, } +/* + @brief + Check if it is potentally possible to short-cut the JOIN execution due to + ORDER BY ... LIMIT clause + + @detail + It is possible when the join has "ORDER BY ... LIMIT n" clause, and the + sort+limit operation is done right after the join operation (there's no + grouping or DISTINCT in between). + Then we can potentially build a join plan that enumerates rows in the + ORDER BY order and so will be able to terminate as soon as it has produced + #limit rows. + + Note that it is not a requirement that sort_by_table has an index that + matches ORDER BY. If it doesn't have one, the optimizer will pass + sort_by_table to filesort. Reading from sort_by_table won't use + short-cutting but the rest of the join will. +*/ + +static +bool join_limit_shortcut_is_applicable(const JOIN *join) +{ + /* + Any post-join operation like GROUP BY or DISTINCT or window functions + means we cannot short-cut join execution + */ + if (!join->thd->variables.optimizer_join_limit_pref_ratio || + !join->order || + join->select_limit == HA_POS_ERROR || + join->group_list || + join->select_distinct || + join->select_options & SELECT_BIG_RESULT || + join->rollup.state != ROLLUP::STATE_NONE || + join->select_lex->have_window_funcs() || + join->select_lex->with_sum_func) + { + return false; + } + + /* + Cannot do short-cutting if + (1) ORDER BY refers to more than one table or + (2) the table it refers to cannot be first table in the join order + */ + if (!join->sort_by_table || // (1) + join->sort_by_table->reginfo.join_tab->dependent) // (2) + return false; + + Json_writer_object wrapper(join->thd); + Json_writer_object trace(join->thd, "join_limit_shortcut_is_applicable"); + trace.add("applicable", 1); + /* It looks like we can short-cut limit due to join */ + return true; +} + + +/* + @brief + Check if we could use an index-based access method to produce rows + in the order for ORDER BY ... LIMIT. + + @detail + This should do what test_if_skip_sort_order() does. We can't use that + function directly, because: + + 1. We're at the join optimization stage and have not done query plan + fix-ups done in get_best_combination() and co. + + 2. The code in test_if_skip_sort_order() does modify query plan structures, + for example it may change the table's quick select. This is done even if + it's called with no_changes=true parameter. + + @param access_method_changed OUT Whether the function changed the access + method to get rows in desired order. + @param new_access_cost OUT if access method changed: its cost. + + @return + true - Can skip sorting + false - Cannot skip sorting +*/ + +bool test_if_skip_sort_order_early(JOIN *join, + bool *access_method_changed, + double *new_access_cost) +{ + const POSITION *pos= &join->best_positions[join->const_tables]; + TABLE *table= pos->table->table; + key_map usable_keys= table->keys_in_use_for_order_by; + + *access_method_changed= false; + + // Step #1: Find indexes that produce the required ordering. + if (find_indexes_matching_order(join, table, join->order, &usable_keys)) + { + return false; // Cannot skip sorting + } + + // Step #2: Check if the index we're using produces the needed ordering + uint ref_key; + if (pos->key) + { + // Mirror the (wrong) logic in test_if_skip_sort_order: + if (pos->spl_plan || pos->type == JT_REF_OR_NULL) + return false; // Use filesort + + ref_key= pos->key->key; + } + else + { + if (pos->table->quick) + { + if (pos->table->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE) + ref_key= pos->table->quick->index; + else + ref_key= MAX_KEY; + } + else + ref_key= MAX_KEY; + } + + if (ref_key != MAX_KEY && usable_keys.is_set(ref_key)) + { + return true; // we're using an index that produces the reqired ordering. + } + + /* + Step #3: check if we can switch to using an index that would produce the + ordering. + (But don't actually switch, this will be done by test_if_skip_sort_order) + */ + int best_key= -1; + uint UNINIT_VAR(best_key_parts); + uint saved_best_key_parts= 0; + int best_key_direction= 0; + JOIN_TAB *tab= pos->table; + ha_rows new_limit; + double new_read_time; + if (test_if_cheaper_ordering(/*in_join_optimizer */TRUE, + tab, join->order, table, usable_keys, + ref_key, join->select_limit, + &best_key, &best_key_direction, + &new_limit, &new_read_time, + &best_key_parts, + &saved_best_key_parts)) + { + // Ok found a way to skip sorting + *access_method_changed= true; + *new_access_cost= new_read_time; + return true; + } + + return false; +} + + +/* + Compute the cost of join assuming we only need fraction of the output. +*/ + +double recompute_join_cost_with_limit(const JOIN *join, bool skip_sorting, + double *first_table_cost, + double fraction) +{ + POSITION *pos= join->best_positions + join->const_tables; + /* + Generally, we assume that producing X% of output takes X% of the cost. + */ + double partial_join_cost= join->best_read * fraction; + + if (skip_sorting) + { + /* + First table produces rows in required order. Two options: + + A. first_table_cost=NULL means we use whatever access method the join + optimizer has picked. Its cost was included in join->best_read and + we've already took a fraction of it. + + B. first_table_cost!=NULL means we will need to switch to another access + method, we have the cost to read rows to produce #LIMIT rows in join + output. + */ + if (first_table_cost) + { + /* + Subtract the remainder of the first table's cost we had in + join->best_read: + */ + partial_join_cost -= pos->read_time*fraction; + partial_join_cost -= pos->records_read*fraction / TIME_FOR_COMPARE; + + /* Add the cost of the new access method we've got: */ + partial_join_cost= COST_ADD(partial_join_cost, *first_table_cost); + } + } + else + { + DBUG_ASSERT(!first_table_cost); + /* + Cannot skip sorting. We read the first table entirely, then sort it. + + partial_join_cost includes pos->read_time*fraction. Add to it + pos->read_time*(1-fraction) so we have the cost to read the entire first + table. Do the same for costs of checking the WHERE. + */ + double extra_first_table_cost= pos->read_time * (1.0 - fraction); + double extra_first_table_where= pos->records_read * (1.0 - fraction) / + TIME_FOR_COMPARE; + + partial_join_cost= COST_ADD(partial_join_cost, + COST_ADD(extra_first_table_cost, + extra_first_table_where)); + } + return partial_join_cost; +} + + +/* + @brief + Finalize building the join order which allows to short-cut the join + execution. + + @detail + This is called after we have produced a join order that allows short- + cutting. + Here, we decide if it is cheaper to use this one or the original join + order. +*/ + +POSITION *join_limit_shortcut_finalize_plan(JOIN *join, double *cost) +{ + Json_writer_object wrapper(join->thd); + Json_writer_object trace(join->thd, "join_limit_shortcut_choice"); + + double fraction= join->select_limit / join->join_record_count; + trace.add("limit_fraction", fraction); + + /* Check which fraction of join output we need */ + if (fraction >= 1.0) + { + trace.add("skip_adjustment", "no short-cutting"); + return NULL; + } + + /* + Check if the first table's access method produces the required ordering. + Possible options: + 1. Yes: we can just take a fraction of the execution cost. + 2A No: change the access method to one that does produce the required + ordering, update the costs. + 2B No: Need to pass the first table to filesort(). + */ + bool skip_sorting; + bool access_method_changed; + double new_access_cost; + { + Json_writer_array tmp(join->thd, "test_if_skip_sort_order_early"); + skip_sorting= test_if_skip_sort_order_early(join, + &access_method_changed, + &new_access_cost); + } + trace.add("can_skip_filesort", skip_sorting); + + double cost_with_shortcut= + recompute_join_cost_with_limit(join, skip_sorting, + access_method_changed ? + &new_access_cost : (double*)0, + fraction); + double risk_ratio= + (double)join->thd->variables.optimizer_join_limit_pref_ratio; + trace.add("full_join_cost", join->best_read); + trace.add("risk_ratio", risk_ratio); + trace.add("shortcut_join_cost", cost_with_shortcut); + cost_with_shortcut *= risk_ratio; + trace.add("shortcut_cost_with_risk", cost_with_shortcut); + if (cost_with_shortcut < join->best_read) + { + trace.add("use_shortcut_cost", true); + POSITION *pos= (POSITION*)memdup_root(join->thd->mem_root, + join->best_positions, + sizeof(POSITION)* + (join->table_count + 1)); + *cost= cost_with_shortcut; + return pos; + } + trace.add("use_shortcut_cost", false); + return NULL; +} + + +/* + @brief + If we're in Limit Optimization Mode, allow only join->sort_by_table as + the first table in the join order +*/ + +static +bool join_limit_shortcut_allows_table(const JOIN *join, uint idx, JOIN_TAB *s) +{ + if (join->limit_optimization_mode && idx == join->const_tables) + return (join->sort_by_table == s->table); + return true; +} + + /** Find a good, possibly optimal, query execution plan (QEP) by a possibly exhaustive search. @@ -10520,7 +10869,8 @@ best_extension_by_limited_search(JOIN *join, if ((allowed_tables & real_table_bit) && !(remaining_tables & s->dependent) && - !check_interleaving_with_nj(s)) + !check_interleaving_with_nj(s) && + join_limit_shortcut_allows_table(join, idx, s)) { double current_record_count, current_read_time; double partial_join_cardinality; @@ -24790,7 +25140,8 @@ static void prepare_for_reverse_ordered_access(JOIN_TAB *tab) @brief Given a table and order, find indexes that produce rows in the order - @param usable_keys OUT Bitmap of indexes that produce rows in order. + @param usable_keys IN Bitmap of keys we can use + OUT Bitmap of indexes that produce rows in order. @return false Some indexes were found @@ -25089,11 +25440,13 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, int best_key_direction= 0; JOIN *join= tab->join; ha_rows table_records= table->stat_records(); + double new_read_time_dummy; - test_if_cheaper_ordering(tab, order, table, usable_keys, + test_if_cheaper_ordering(FALSE, tab, order, table, usable_keys, ref_key, select_limit, &best_key, &best_key_direction, - &select_limit, &best_key_parts, + &select_limit, &new_read_time_dummy, + &best_key_parts, &saved_best_key_parts); /* @@ -30324,11 +30677,13 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab, */ static bool -test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, +test_if_cheaper_ordering(bool in_join_optimizer, + const JOIN_TAB *tab, ORDER *order, TABLE *table, key_map usable_keys, int ref_key, ha_rows select_limit_arg, int *new_key, int *new_key_direction, - ha_rows *new_select_limit, uint *new_used_key_parts, + ha_rows *new_select_limit, double *new_read_time, + uint *new_used_key_parts, uint *saved_best_key_parts) { DBUG_ENTER("test_if_cheaper_ordering"); @@ -30386,7 +30741,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, if (join) { - uint tablenr= (uint)(tab - join->join_tab); + uint tablenr= join->const_tables; read_time= join->best_positions[tablenr].read_time; records= join->best_positions[tablenr].records_read; for (uint i= tablenr+1; i < join->table_count; i++) @@ -30424,12 +30779,27 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, Calculate the selectivity of the ref_key for REF_ACCESS. For RANGE_ACCESS we use table->opt_range_condition_rows. */ - if (ref_key >= 0 && ref_key != MAX_KEY && tab->type == JT_REF) + if (in_join_optimizer) + { + if (ref_key >= 0 && ref_key != MAX_KEY && + join->best_positions[join->const_tables].type == JT_REF) + { + refkey_rows_estimate= + (ha_rows)join->best_positions[join->const_tables].records_read; + set_if_bigger(refkey_rows_estimate, 1); + } + } + else if (ref_key >= 0 && ref_key != MAX_KEY && tab->type == JT_REF) { /* If ref access uses keypart=const for all its key parts, and quick select uses the same # of key parts, then they are equivalent. Reuse #rows estimate from quick select as it is more precise. + + Note: we could just have used + join->best_positions[join->const_tables].records_read + here. That number was computed in best_access_path() and it already + includes adjustments based on table->opt_range[ref_key].rows. */ if (tab->ref.const_ref_part_map == make_prev_keypart_map(tab->ref.key_parts) && @@ -30755,6 +31125,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, *new_key= best_key; *new_key_direction= best_key_direction; *new_select_limit= has_limit ? best_select_limit : table_records; + *new_read_time= read_time; if (new_used_key_parts != NULL) *new_used_key_parts= best_key_parts; DBUG_RETURN(TRUE); @@ -30854,10 +31225,11 @@ uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select, table->opt_range_condition_rows= table->stat_records(); int key, direction; - if (test_if_cheaper_ordering(NULL, order, table, + double new_cost; + if (test_if_cheaper_ordering(FALSE, NULL, order, table, table->keys_in_use_for_order_by, -1, limit, - &key, &direction, &limit) && + &key, &direction, &limit, &new_cost) && !is_key_used(table, key, table->write_set)) { *need_sort= FALSE; diff --git a/sql/sql_select.h b/sql/sql_select.h index 128426993ac..59c4ebfc14e 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1205,6 +1205,20 @@ public: passing 1st non-const table to filesort(). NULL means no such table exists. */ TABLE *sort_by_table; + + /* + If true, there is ORDER BY x LIMIT n clause and for certain join orders, it + is possible to short-cut the join execution, i.e. stop it as soon as n + output rows were produced. See join_limit_shortcut_is_applicable(). + */ + bool limit_shortcut_applicable; + + /* + Used during join optimization: if true, we're building a join order that + will short-cut join execution as soon as #LIMIT rows are produced. + */ + bool limit_optimization_mode; + /* Number of tables in the join. (In MySQL, it is named 'tables' and is also the number of elements in diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 42ec52b38a9..c5b507b936d 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2702,6 +2702,20 @@ static Sys_var_ulong Sys_optimizer_selectivity_sampling_limit( VALID_RANGE(SELECTIVITY_SAMPLING_THRESHOLD, UINT_MAX), DEFAULT(SELECTIVITY_SAMPLING_LIMIT), BLOCK_SIZE(1)); +static Sys_var_ulonglong Sys_optimizer_join_limit_pref_ratio( + "optimizer_join_limit_pref_ratio", + "For queries with JOIN and ORDER BY LIMIT : make the optimizer " + "consider a join order that allows to short-cut execution after " + "producing #LIMIT matches if that promises N times speedup. " + "(A conservative setting here would be is a high value, like 100 so " + "the short-cutting plan is used if it promises a speedup of 100x or " + "more). Short-cutting plans are inherently risky so the default is 0 " + "which means do not consider this optimization", + SESSION_VAR(optimizer_join_limit_pref_ratio), + CMD_LINE(REQUIRED_ARG), + VALID_RANGE(0, UINT_MAX), + DEFAULT(0), BLOCK_SIZE(1)); + static Sys_var_ulong Sys_optimizer_use_condition_selectivity( "optimizer_use_condition_selectivity", "Controls selectivity of which conditions the optimizer takes into " From b3cc9529160f8fcdda5ad510f5a4d083f057deab Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 3 Sep 2024 05:57:22 +0200 Subject: [PATCH 020/185] galera tests: updated .result for galera_gtid_2_cluster test --- mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result index 1cb14cd3eff..b849cc9f368 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -223,10 +223,14 @@ select @@gtid_binlog_state; drop table t1; stop slave; reset slave; +Warnings: +Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' cluster 2 node 1 connection node_4; stop slave; reset slave; +Warnings: +Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' cluster 1 node 1 connection node_1; change master to master_use_gtid=no, ignore_server_ids=(); From 4e2c02a12c1120501ab591f923cf9e624f688035 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 15 Jan 2024 18:25:36 +0300 Subject: [PATCH 021/185] MDEV-33133: MDL conflict handling code should skip BF-aborted trxs It's possible that MDL conflict handling code is called more than once for a transaction when: - it holds more than one conflicting MDL lock - reschedule_waiters() is executed, which results in repeated attempts to BF-abort already aborted transaction. In such situations, it might be that BF-aborting logic sees a partially rolled back transaction and erroneously decides on future actions for such a transaction. The specific situation tested and fixed is when a SR transaction applied in the node gets BF-aborted by a started TOI operation. It's then caught with the server transaction already rolled back, but with no MDL locks yet released. This caused wrong state detection for such a transaction during repeated MDL conflict handling code execution. Signed-off-by: Julius Goryavsky --- sql/wsrep_mysqld.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index e1ef3e9de81..f70e76219d7 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -3138,8 +3138,6 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, { DBUG_ASSERT(granted_thd->wsrep_aborter == request_thd->thread_id); WSREP_DEBUG("BF thread waiting for a victim to release locks"); - mysql_mutex_unlock(&granted_thd->LOCK_thd_data); - mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); } else if (wsrep_thd_is_toi(granted_thd) || wsrep_thd_is_applying(granted_thd)) @@ -3218,13 +3216,12 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, } mysql_mutex_unlock(&granted_thd->LOCK_thd_data); mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); + DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } else { mysql_mutex_unlock(&request_thd->LOCK_thd_data); } - - DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } /**/ From 9878238f7457280f3368e5d31b66aac49433c792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 3 Sep 2024 14:15:57 +0300 Subject: [PATCH 022/185] MDEV-34791: Redundant page lookups hurt performance btr_cur_t::search_leaf(): When the index root page is also a leaf page, we may need to upgrade our existing shared root page latch into an exclusive latch. Even if we end up waiting, the root page won't be able to go away while we hold an index()->lock. The index page may be split; that is all. btr_latch_prev(): Acquire the page latch while holding a buffer-fix and an index tree latch. Merge the change buffer if needed. Use buf_pool_t::page_fix() for this special case instead of complicating buf_page_get_low() and buf_page_get_gen(). row_merge_read_clustered_index(): Remove some code that does not seem to be useful. No difference was observed with regard to removing this code when a CREATE INDEX or OPTIMIZE TABLE statement was run concurrently with sysbench oltp_update_index --tables=1 --table_size=1000 --threads=16. buf_pool_t::unzip(): Decompress a ROW_FORMAT=COMPRESSED page. buf_pool_t::page_fix(): Handle also ROW_FORMAT=COMPRESSED pages as well as change buffer merge. Optionally return an error. Add a flag for suppressing a page latch wait and a special return value -1 to indicate that the call would block. This is the preferred way of buffer-fixing blocks. The functions buf_page_get_gen() and buf_page_get_low() are only being invoked with rw_latch=RW_NO_LATCH in operations on SPATIAL INDEX. buf_page_t: Define some static functions for interpreting state(). buf_page_get_zip(), buf_read_page(), buf_read_ahead_random(), buf_read_ahead_linear(): Remove the redundant parameter zip_size. We must look up the tablespace and can invoke fil_space_t::zip_size() on it. buf_page_get_low(): Require mtr!=nullptr. buf_page_get_gen(): Implement some lock downgrading during recovery. ibuf_page_low(): Use buf_pool_t::page_fix() in a debug check. We do wait for a page read here, because otherwise a debug assertion in buf_page_get_low() in the test innodb.ibuf_delete could occasionally fail. PageConverter::operator(): Invoke buf_pool_t::page_fix() in order to possibly evict a block. This allows us to remove some special case code from buf_page_get_low(). --- storage/innobase/btr/btr0btr.cc | 2 +- storage/innobase/btr/btr0cur.cc | 195 +++++++------ storage/innobase/btr/btr0pcur.cc | 4 +- storage/innobase/buf/buf0buf.cc | 423 +++++++++++++++-------------- storage/innobase/buf/buf0rea.cc | 44 +-- storage/innobase/gis/gis0sea.cc | 4 +- storage/innobase/ibuf/ibuf0ibuf.cc | 20 +- storage/innobase/include/buf0buf.h | 126 +++++---- storage/innobase/include/buf0rea.h | 10 +- storage/innobase/row/row0import.cc | 59 ++-- storage/innobase/row/row0merge.cc | 40 +-- storage/innobase/trx/trx0undo.cc | 9 +- 12 files changed, 491 insertions(+), 445 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index e386c162ed9..93ad4b671c8 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1262,7 +1262,7 @@ void btr_drop_temporary_table(const dict_table_t &table) { if (buf_block_t *block= buf_page_get_low({SRV_TMP_SPACE_ID, index->page}, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, - nullptr, false, nullptr)) + nullptr, false)) { btr_free_but_not_root(block, MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index cfbc6532c41..b6d50f19e31 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -938,24 +938,21 @@ static inline page_cur_mode_t btr_cur_nonleaf_mode(page_cur_mode_t mode) MY_ATTRIBUTE((nonnull,warn_unused_result)) /** Acquire a latch on the previous page without violating the latching order. -@param block index page -@param page_id page identifier with valid space identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param rw_latch the latch on block (RW_S_LATCH or RW_X_LATCH) -@param mtr mini-transaction +@param page_id page identifier with valid space identifier @param err error code +@param mtr mini-transaction @retval 0 if an error occurred @retval 1 if the page could be latched in the wrong order @retval -1 if the latch on block was temporarily released */ -static int btr_latch_prev(buf_block_t *block, page_id_t page_id, - ulint zip_size, - rw_lock_type_t rw_latch, mtr_t *mtr, dberr_t *err) +static int btr_latch_prev(rw_lock_type_t rw_latch, + page_id_t page_id, dberr_t *err, mtr_t *mtr) { ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); - ut_ad(page_id.space() == block->page.id().space()); - const auto prev_savepoint= mtr->get_savepoint(); - ut_ad(block == mtr->at_savepoint(prev_savepoint - 1)); + buf_block_t *block= mtr->at_savepoint(mtr->get_savepoint() - 1); + + ut_ad(page_id.space() == block->page.id().space()); const page_t *const page= block->page.frame; page_id.set_page_no(btr_page_get_prev(page)); @@ -971,68 +968,78 @@ static int btr_latch_prev(buf_block_t *block, page_id_t page_id, buffer-fixes on both blocks will prevent eviction. */ retry: - /* Pass no_wait pointer to ensure that we don't wait on the current page - latch while holding the next page latch to avoid latch ordering violation. */ - bool no_wait= false; int ret= 1; - - buf_block_t *prev= buf_page_get_gen(page_id, zip_size, RW_NO_LATCH, nullptr, - BUF_GET, mtr, err, false, &no_wait); + buf_block_t *prev= buf_pool.page_fix(page_id, err, buf_pool_t::FIX_NOWAIT); if (UNIV_UNLIKELY(!prev)) - { - /* Check if we had to return because we couldn't wait on latch. */ - if (no_wait) - goto ordered_latch; return 0; + if (prev == reinterpret_cast(-1)) + { + /* The block existed in buf_pool.page_hash, but not in a state that is + safe to access without waiting for some pending operation, such as + buf_page_t::read_complete() or buf_pool_t::unzip(). + + Retry while temporarily releasing the successor block->page.lock + (but retaining a buffer-fix so that the block cannot be evicted. */ + + if (rw_latch == RW_S_LATCH) + block->page.lock.s_unlock(); + else + block->page.lock.x_unlock(); + + prev= buf_pool.page_fix(page_id, err, buf_pool_t::FIX_WAIT_READ); + + if (!prev) + { + ut_ad(*err != DB_SUCCESS); + if (rw_latch == RW_S_LATCH) + block->page.lock.s_lock(); + else + block->page.lock.x_lock(); + return 0; + } + else if (rw_latch == RW_S_LATCH) + goto wait_for_s; + else + goto wait_for_x; } static_assert(MTR_MEMO_PAGE_S_FIX == mtr_memo_type_t(BTR_SEARCH_LEAF), ""); static_assert(MTR_MEMO_PAGE_X_FIX == mtr_memo_type_t(BTR_MODIFY_LEAF), ""); if (rw_latch == RW_S_LATCH - ? prev->page.lock.s_lock_try() : prev->page.lock.x_lock_try()) - { - mtr->lock_register(prev_savepoint, mtr_memo_type_t(rw_latch)); - if (UNIV_UNLIKELY(prev->page.id() != page_id)) - { - fail: - /* the page was just read and found to be corrupted */ - mtr->rollback_to_savepoint(prev_savepoint); - return 0; - } - } + ? prev->page.lock.s_lock_try() + : prev->page.lock.x_lock_try()) + mtr->memo_push(prev, mtr_memo_type_t(rw_latch)); else { - ut_ad(mtr->at_savepoint(mtr->get_savepoint() - 1)->page.id() == page_id); - mtr->release_last_page(); -ordered_latch: if (rw_latch == RW_S_LATCH) + { block->page.lock.s_unlock(); - else - block->page.lock.x_unlock(); - - prev= buf_page_get_gen(page_id, zip_size, rw_latch, prev, - BUF_GET, mtr, err); - if (rw_latch == RW_S_LATCH) + wait_for_s: + prev->page.lock.s_lock(); block->page.lock.s_lock(); + } else + { + block->page.lock.x_unlock(); + wait_for_x: + prev->page.lock.x_lock(); block->page.lock.x_lock(); + } + ut_ad(block == mtr->at_savepoint(mtr->get_savepoint() - 1)); + mtr->memo_push(prev, mtr_memo_type_t(rw_latch)); const page_id_t prev_page_id= page_id; page_id.set_page_no(btr_page_get_prev(page)); + ret= -1; if (UNIV_UNLIKELY(page_id != prev_page_id)) { mtr->release_last_page(); if (page_id.page_no() == FIL_NULL) - return -1; + return ret; goto retry; } - - if (UNIV_UNLIKELY(!prev)) - goto fail; - - ret= -1; } const page_t *const p= prev->page.frame; @@ -1061,11 +1068,11 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, btr_intention_t lock_intention; bool detected_same_key_root= false; - mem_heap_t* heap = NULL; - rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets = offsets_; - rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets2 = offsets2_; + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets2= offsets2_; rec_offs_init(offsets_); rec_offs_init(offsets2_); @@ -1314,7 +1321,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, ut_a(page_zip_validate(page_zip, block->page.frame, index())); #endif /* UNIV_ZIP_DEBUG */ - const uint32_t page_level= btr_page_get_level(block->page.frame); + uint32_t page_level= btr_page_get_level(block->page.frame); if (height == ULINT_UNDEFINED) { @@ -1322,6 +1329,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, #ifdef BTR_CUR_ADAPT info->root_guess= block; #endif + reached_root: height= page_level; tree_height= height + 1; @@ -1331,35 +1339,55 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, We may have to reacquire the page latch in a different mode. */ switch (rw_latch) { case RW_S_LATCH: - if ((latch_mode & ~12) != RW_S_LATCH) + if (!(latch_mode & BTR_SEARCH_LEAF)) { + rw_latch= RW_X_LATCH; ut_ad(rw_lock_type_t(latch_mode & ~12) == RW_X_LATCH); - goto relatch_x; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_X_FIX); + if (!block->page.lock.s_x_upgrade_try()) + { + block->page.lock.s_unlock(); + block->page.lock.x_lock(); + /* Dropping the index tree (and freeing the root page) + should be impossible while we hold index()->lock. */ + ut_ad(!block->page.is_freed()); + page_level= btr_page_get_level(block->page.frame); + if (UNIV_UNLIKELY(page_level != 0)) + { + /* btr_root_raise_and_insert() was executed meanwhile */ + ut_ad(mtr->memo_contains_flagged(&index()->lock, + MTR_MEMO_S_LOCK)); + block->page.lock.x_u_downgrade(); + block->page.lock.u_s_downgrade(); + rw_latch= RW_S_LATCH; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_S_FIX); + goto reached_root; + } + } } - if (latch_mode != BTR_MODIFY_PREV) - { - if (!latch_by_caller) - /* Release the tree s-latch */ - mtr->rollback_to_savepoint(savepoint, savepoint + 1); - goto reached_latched_leaf; - } - /* fall through */ + if (latch_mode == BTR_MODIFY_PREV) + goto reached_leaf; + if (rw_latch != RW_S_LATCH) + break; + if (!latch_by_caller) + /* Release the tree s-latch */ + mtr->rollback_to_savepoint(savepoint, savepoint + 1); + goto reached_latched_leaf; case RW_SX_LATCH: - ut_ad(rw_latch == RW_S_LATCH || - latch_mode == BTR_MODIFY_ROOT_AND_LEAF); - relatch_x: - mtr->rollback_to_savepoint(block_savepoint); - height= ULINT_UNDEFINED; + ut_ad(latch_mode == BTR_MODIFY_ROOT_AND_LEAF); + static_assert(int{BTR_MODIFY_ROOT_AND_LEAF} == int{RW_SX_LATCH}, ""); rw_latch= RW_X_LATCH; - goto search_loop; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_X_FIX); + block->page.lock.u_x_upgrade(); + break; case RW_X_LATCH: if (latch_mode == BTR_MODIFY_TREE) goto reached_index_root_and_leaf; - goto reached_root_and_leaf; + break; case RW_NO_LATCH: ut_ad(0); } - goto reached_leaf; + goto reached_root_and_leaf; } } else if (UNIV_UNLIKELY(height != page_level)) @@ -1417,7 +1445,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, /* latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err)) + !btr_latch_prev(rw_latch, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1442,7 +1470,7 @@ release_tree: ut_ad(rw_latch == RW_X_LATCH); /* x-latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err)) + !btr_latch_prev(rw_latch, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1590,7 +1618,7 @@ release_tree: ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); if (!not_first_access) - buf_read_ahead_linear(page_id, zip_size, false); + buf_read_ahead_linear(page_id, false); if (page_has_prev(block->page.frame) && page_rec_is_first(page_cur.rec, block->page.frame)) @@ -1599,7 +1627,7 @@ release_tree: /* Latch the previous page if the node pointer is the leftmost of the current page. */ - int ret= btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err); + int ret= btr_latch_prev(rw_latch, page_id, &err, mtr); if (!ret) goto func_exit; ut_ad(block_savepoint + 2 == mtr->get_savepoint()); @@ -1632,7 +1660,7 @@ release_tree: ? BUF_GET_IF_IN_POOL_OR_WATCH : BUF_GET_IF_IN_POOL; else if (!not_first_access) - buf_read_ahead_linear(page_id, zip_size, false); + buf_read_ahead_linear(page_id, false); break; case BTR_MODIFY_TREE: ut_ad(rw_latch == RW_X_LATCH); @@ -1784,8 +1812,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple, #endif /* UNIV_ZIP_DEBUG */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, block->zip_size(), - RW_X_LATCH, mtr, &err)) + !btr_latch_prev(RW_X_LATCH, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1994,7 +2021,6 @@ index_locked: page_cur.index = index; uint32_t page= index->page; - const auto zip_size= index->table->space->zip_size(); for (ulint height= ULINT_UNDEFINED;;) { @@ -2045,8 +2071,7 @@ index_locked: { /* x-latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, block->page.id(), zip_size, RW_X_LATCH, - mtr, &err)) + !btr_latch_prev(RW_X_LATCH, block->page.id(), &err, mtr)) break; if (page_has_next(block->page.frame) && !btr_block_get(*index, btr_page_get_next(block->page.frame), @@ -2100,8 +2125,7 @@ index_locked: if (latch_mode != BTR_MODIFY_TREE) { if (!height && first && first_access) - buf_read_ahead_linear(page_id_t(block->page.id().space(), page), - block->page.zip_size(), false); + buf_read_ahead_linear({block->page.id().space(), page}, false); } else if (btr_cur_need_opposite_intention(block->page, index->is_clust(), lock_intention, @@ -2126,7 +2150,8 @@ index_locked: { if (!btr_cur_will_modify_tree(index, block->page.frame, lock_intention, page_cur.rec, - node_ptr_max_size, zip_size, mtr)) + node_ptr_max_size, + index->table->space->zip_size(), mtr)) { ut_ad(n_blocks); /* release buffer-fixes on pages that will not be modified @@ -6716,7 +6741,7 @@ btr_copy_blob_prefix( return copied_len; } if (!buf_page_make_young_if_needed(&block->page)) { - buf_read_ahead_linear(id, 0, false); + buf_read_ahead_linear(id, false); } page = buf_block_get_frame(block); @@ -6795,7 +6820,7 @@ btr_copy_zblob_prefix( bpage is protected by the B-tree page latch that is being held on the clustered index record, or, in row_merge_copy_blobs(), by an exclusive table lock. */ - bpage = buf_page_get_zip(id, zip_size); + bpage = buf_page_get_zip(id); if (UNIV_UNLIKELY(!bpage)) { ib::error() << "Cannot load compressed BLOB " << id; diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index d30f037ab99..c7fcfd205fb 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -548,9 +548,7 @@ btr_pcur_move_to_next_page( const auto s = mtr->get_savepoint(); mtr->rollback_to_savepoint(s - 2, s - 1); if (first_access) { - buf_read_ahead_linear(next_block->page.id(), - next_block->zip_size(), - ibuf_inside(mtr)); + buf_read_ahead_linear(next_block->page.id(), ibuf_inside(mtr)); } return DB_SUCCESS; } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 7a466939eae..580e004ab3b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2180,13 +2180,10 @@ be implemented at a higher level. In other words, all possible accesses to a given page through this function must be protected by the same set of mutexes or latches. @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size in bytes @return pointer to the block, s-latched */ TRANSACTIONAL_TARGET -buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) +buf_page_t* buf_page_get_zip(const page_id_t page_id) { - ut_ad(zip_size); - ut_ad(ut_is_2pow(zip_size)); ha_handler_stats *const stats= mariadb_stats; buf_inc_get(stats); @@ -2287,7 +2284,7 @@ lookup: return bpage; must_read_page: - switch (dberr_t err= buf_read_page(page_id, zip_size)) { + switch (dberr_t err= buf_read_page(page_id)) { case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); @@ -2322,8 +2319,8 @@ buf_block_init_low( /********************************************************************//** Decompress a block. -@return TRUE if successful */ -ibool +@return true if successful */ +bool buf_zip_decompress( /*===============*/ buf_block_t* block, /*!< in/out: block */ @@ -2367,7 +2364,7 @@ func_exit: if (space) { space->release(); } - return(TRUE); + return true; } ib::error() << "Unable to decompress " @@ -2401,7 +2398,7 @@ err_exit: space->release(); } - return(FALSE); + return false; } ATTRIBUTE_COLD @@ -2476,7 +2473,99 @@ static bool buf_page_ibuf_merge_try(buf_block_t *block, ulint rw_latch, return false; } -buf_block_t* buf_pool_t::page_fix(const page_id_t id) +ATTRIBUTE_COLD +buf_block_t *buf_pool_t::unzip(buf_page_t *b, buf_pool_t::hash_chain &chain) +{ + buf_block_t *block= buf_LRU_get_free_block(false); + buf_block_init_low(block); + page_hash_latch &hash_lock= page_hash.lock_get(chain); + wait_for_unfix: + mysql_mutex_lock(&mutex); + hash_lock.lock(); + + /* b->lock implies !b->can_relocate() */ + ut_ad(b->lock.have_x()); + ut_ad(b == page_hash.get(b->id(), chain)); + + /* Wait for b->unfix() in any other threads. */ + uint32_t state= b->state(); + ut_ad(buf_page_t::buf_fix_count(state)); + ut_ad(!buf_page_t::is_freed(state)); + + switch (state) { + case buf_page_t::UNFIXED + 1: + case buf_page_t::IBUF_EXIST + 1: + case buf_page_t::REINIT + 1: + break; + default: + ut_ad(state < buf_page_t::READ_FIX); + + if (state < buf_page_t::UNFIXED + 1) + { + ut_ad(state > buf_page_t::FREED); + b->lock.x_unlock(); + hash_lock.unlock(); + buf_LRU_block_free_non_file_page(block); + mysql_mutex_unlock(&mutex); + b->unfix(); + return nullptr; + } + + mysql_mutex_unlock(&mutex); + hash_lock.unlock(); + std::this_thread::sleep_for(std::chrono::microseconds(100)); + goto wait_for_unfix; + } + + /* Ensure that another buf_page_get_low() or buf_page_t::page_fix() + will wait for block->page.lock.x_unlock(). buf_relocate() will + copy the state from b to block and replace b with block in page_hash. */ + b->set_state(buf_page_t::READ_FIX); + + mysql_mutex_lock(&flush_list_mutex); + buf_relocate(b, &block->page); + + /* X-latch the block for the duration of the decompression. */ + block->page.lock.x_lock(); + + buf_flush_relocate_on_flush_list(b, &block->page); + mysql_mutex_unlock(&flush_list_mutex); + + /* Insert at the front of unzip_LRU list */ + buf_unzip_LRU_add_block(block, false); + + mysql_mutex_unlock(&mutex); + hash_lock.unlock(); + +#if defined SUX_LOCK_GENERIC || defined UNIV_DEBUG + b->lock.x_unlock(); + b->lock.free(); +#endif + ut_free(b); + + n_pend_unzip++; + const bool ok{buf_zip_decompress(block, false)}; + n_pend_unzip--; + + if (UNIV_UNLIKELY(!ok)) + { + mysql_mutex_lock(&mutex); + block->page.read_unfix(state); + block->page.lock.x_unlock(); + if (!buf_LRU_free_page(&block->page, true)) + ut_ad(0); + mysql_mutex_unlock(&mutex); + return nullptr; + } + else + block->page.read_unfix(state); + + return block; +} + +buf_block_t *buf_pool_t::page_fix(const page_id_t id, + dberr_t *err, + buf_pool_t::page_fix_conflicts c) { ha_handler_stats *const stats= mariadb_stats; buf_inc_get(stats); @@ -2486,37 +2575,97 @@ buf_block_t* buf_pool_t::page_fix(const page_id_t id) { hash_lock.lock_shared(); buf_page_t *b= page_hash.get(id, chain); - if (b) + if (b && !watch_is_sentinel(*b)) { - uint32_t state= b->fix(); - hash_lock.unlock_shared(); + uint32_t state= b->fix() + 1; ut_ad(!b->in_zip_hash); - ut_ad(b->frame); - ut_ad(state >= buf_page_t::FREED); - if (state >= buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) + hash_lock.unlock_shared(); + + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + ut_ad(state > buf_page_t::FREED); + if (c == FIX_ALSO_FREED && b->id() == id) + { + ut_ad(state == buf_page_t::FREED + 1); + return reinterpret_cast(b); + } + /* The page was marked as freed or corrupted. */ + unfix_corrupted: + b->unfix(); + corrupted: + if (err) + *err= DB_CORRUPTION; + return nullptr; + } + + if ((state >= buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) || + (state >= buf_page_t::IBUF_EXIST && state < buf_page_t::REINIT)) + { + if (c == FIX_NOWAIT) + { + would_block: + b->unfix(); + return reinterpret_cast(-1); + } + + if (UNIV_UNLIKELY(!b->frame)) + { + wait_for_unzip: + b->unfix(); + std::this_thread::sleep_for(std::chrono::microseconds(100)); + continue; + } b->lock.s_lock(); state= b->state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); + + if (state >= buf_page_t::IBUF_EXIST && state < buf_page_t::REINIT && + buf_page_ibuf_merge_try(reinterpret_cast(b), + RW_S_LATCH, err)) + goto unfix_corrupted; + b->lock.s_unlock(); } - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) + + if (UNIV_UNLIKELY(!b->frame)) { - /* The page was marked as freed or corrupted. */ - b->unfix(); - b= nullptr; + if (b->lock.x_lock_try()); + else if (c == FIX_NOWAIT) + goto would_block; + else + goto wait_for_unzip; + + buf_block_t *block= unzip(b, chain); + if (!block) + goto corrupted; + + b= &block->page; + state= b->state(); + + if (state >= buf_page_t::IBUF_EXIST && state < buf_page_t::REINIT && + buf_page_ibuf_merge_try(block, RW_X_LATCH, err)) + goto unfix_corrupted; + + b->lock.x_unlock(); } + return reinterpret_cast(b); } hash_lock.unlock_shared(); - switch (buf_read_page(id, 0)) { + + if (c == FIX_NOWAIT) + return reinterpret_cast(-1); + + switch (dberr_t local_err= buf_read_page(id)) { default: + if (err) + *err= local_err; return nullptr; case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); - buf_read_ahead_random(id, 0, false); + buf_read_ahead_random(id, false); } } } @@ -2524,42 +2673,30 @@ buf_block_t* buf_pool_t::page_fix(const page_id_t id) /** Low level function used to get access to a database page. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in] mtr mini-transaction @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge to happen -while reading the page from file -then it makes sure that it does merging of change buffer changes while -reading the page from file. -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ TRANSACTIONAL_TARGET buf_block_t* buf_page_get_low( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge, - bool* no_wait) + bool allow_ibuf_merge) { - unsigned access_time; ulint retries = 0; - ut_ad(!mtr || mtr->is_active()); - ut_ad(mtr || mode == BUF_PEEK_IF_IN_POOL); - ut_ad((rw_latch == RW_S_LATCH) - || (rw_latch == RW_X_LATCH) - || (rw_latch == RW_SX_LATCH) - || (rw_latch == RW_NO_LATCH)); + ut_ad(mtr->is_active()); ut_ad(rw_latch != RW_NO_LATCH || !allow_ibuf_merge); if (err) { @@ -2586,7 +2723,7 @@ buf_page_get_low( } #endif /* UNIV_DEBUG */ - ut_ad(!mtr || !ibuf_inside(mtr) + ut_ad(!ibuf_inside(mtr) || ibuf_page_low(page_id, zip_size, FALSE, NULL)); ha_handler_stats* const stats = mariadb_stats; @@ -2658,11 +2795,11 @@ loop: corrupted, or if an encrypted page with a valid checksum cannot be decypted. */ - switch (dberr_t local_err = buf_read_page(page_id, zip_size)) { + switch (dberr_t local_err = buf_read_page(page_id)) { case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); - buf_read_ahead_random(page_id, zip_size, ibuf_inside(mtr)); + buf_read_ahead_random(page_id, ibuf_inside(mtr)); break; default: if (mode != BUF_GET_POSSIBLY_FREED @@ -2707,18 +2844,7 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - if (!no_wait) { - block->page.lock.s_lock(); - } else if (!block->page.lock.s_lock_try()) { - ut_ad(rw_latch == RW_NO_LATCH); - /* We should not wait trying to acquire S latch for - current page while holding latch for the next page. - It would violate the latching order resulting in - possible deadlock. Caller must handle the failure. */ - block->page.unfix(); - *no_wait= true; - return nullptr; - } + block->page.lock.s_lock(); state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); @@ -2748,18 +2874,6 @@ ignore_unfixed: } ut_ad(id == page_id); } else if (mode != BUF_PEEK_IF_IN_POOL) { - } else if (!mtr) { - ut_ad(!block->page.oldest_modification()); - mysql_mutex_lock(&buf_pool.mutex); - block->unfix(); - -free_unfixed_block: - if (!buf_LRU_free_page(&block->page, true)) { - ut_ad(0); - } - - mysql_mutex_unlock(&buf_pool.mutex); - return nullptr; } else if (UNIV_UNLIKELY(!block->page.frame)) { /* The BUF_PEEK_IF_IN_POOL mode is mainly used for dropping an adaptive hash index. There cannot be an @@ -2770,121 +2884,6 @@ free_unfixed_block: ut_ad(mode == BUF_GET_IF_IN_POOL || mode == BUF_PEEK_IF_IN_POOL || block->zip_size() == zip_size); - if (UNIV_UNLIKELY(!block->page.frame)) { - if (!block->page.lock.x_lock_try()) { -wait_for_unzip: - /* The page is being read or written, or - another thread is executing buf_zip_decompress() - in buf_page_get_low() on it. */ - block->page.unfix(); - std::this_thread::sleep_for( - std::chrono::microseconds(100)); - goto loop; - } - - buf_block_t *new_block = buf_LRU_get_free_block(false); - buf_block_init_low(new_block); - -wait_for_unfix: - mysql_mutex_lock(&buf_pool.mutex); - page_hash_latch& hash_lock=buf_pool.page_hash.lock_get(chain); - - /* It does not make sense to use - transactional_lock_guard here, because buf_relocate() - would likely make a memory transaction too large. */ - hash_lock.lock(); - - /* block->page.lock implies !block->page.can_relocate() */ - ut_ad(&block->page == buf_pool.page_hash.get(page_id, chain)); - - /* Wait for any other threads to release their buffer-fix - on the compressed-only block descriptor. - FIXME: Never fix() before acquiring the lock. - Only in buf_page_get_gen(), buf_page_get_low(), buf_page_free() - we are violating that principle. */ - state = block->page.state(); - - switch (state) { - case buf_page_t::UNFIXED + 1: - case buf_page_t::IBUF_EXIST + 1: - case buf_page_t::REINIT + 1: - break; - default: - ut_ad(state < buf_page_t::READ_FIX); - - if (state < buf_page_t::UNFIXED + 1) { - ut_ad(state > buf_page_t::FREED); - block->page.lock.x_unlock(); - hash_lock.unlock(); - buf_LRU_block_free_non_file_page(new_block); - mysql_mutex_unlock(&buf_pool.mutex); - goto ignore_block; - } - - mysql_mutex_unlock(&buf_pool.mutex); - hash_lock.unlock(); - std::this_thread::sleep_for( - std::chrono::microseconds(100)); - goto wait_for_unfix; - } - - /* Ensure that another buf_page_get_low() will wait for - new_block->page.lock.x_unlock(). */ - block->page.set_state(buf_page_t::READ_FIX); - - /* Move the compressed page from block->page to new_block, - and uncompress it. */ - - mysql_mutex_lock(&buf_pool.flush_list_mutex); - buf_relocate(&block->page, &new_block->page); - - /* X-latch the block for the duration of the decompression. */ - new_block->page.lock.x_lock(); - ut_d(block->page.lock.x_unlock()); - - buf_flush_relocate_on_flush_list(&block->page, - &new_block->page); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - - /* Insert at the front of unzip_LRU list */ - buf_unzip_LRU_add_block(new_block, FALSE); - - mysql_mutex_unlock(&buf_pool.mutex); - hash_lock.unlock(); - -#if defined SUX_LOCK_GENERIC || defined UNIV_DEBUG - block->page.lock.free(); -#endif - ut_free(reinterpret_cast(block)); - block = new_block; - - buf_pool.n_pend_unzip++; - - access_time = block->page.is_accessed(); - - if (!access_time && !recv_no_ibuf_operations - && ibuf_page_exists(block->page.id(), block->zip_size())) { - state = buf_page_t::IBUF_EXIST + 1; - } - - /* Decompress the page while not holding - buf_pool.mutex. */ - const auto ok = buf_zip_decompress(block, false); - --buf_pool.n_pend_unzip; - if (!ok) { - if (err) { - *err = DB_PAGE_CORRUPTED; - } - mysql_mutex_lock(&buf_pool.mutex); - } - state = block->page.read_unfix(state); - block->page.lock.x_unlock(); - - if (!ok) { - goto free_unfixed_block; - } - } - #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG re_evict: if (mode != BUF_GET_IF_IN_POOL @@ -2948,10 +2947,29 @@ re_evict_fail: ut_ad((~buf_page_t::LRU_MASK) & state); ut_ad(state > buf_page_t::WRITE_FIX || state < buf_page_t::READ_FIX); + if (UNIV_UNLIKELY(!block->page.frame)) { + if (!block->page.lock.x_lock_try()) { +wait_for_unzip: + /* The page is being read or written, or + another thread is executing buf_pool.unzip() on it. */ + block->page.unfix(); + std::this_thread::sleep_for( + std::chrono::microseconds(100)); + goto loop; + } + + block = buf_pool.unzip(&block->page, chain); + + if (!block) { + goto ignore_unfixed; + } + + block->page.lock.x_unlock(); + } + #ifdef UNIV_DEBUG if (!(++buf_dbg_counter % 5771)) buf_pool.validate(); #endif /* UNIV_DEBUG */ - ut_ad(block->page.frame); /* The state = block->page.state() may be stale at this point, and in fact, at any point of time if we consider its @@ -3014,35 +3032,30 @@ re_evict_fail: /** Get access to a database page. Buffered redo log may be applied. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in,out] mtr mini-transaction, or NULL @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge while -reading the pages from file. -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@param[in] allow_ibuf_merge Allow change buffer merge to happen +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ buf_block_t* buf_page_get_gen( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge, - bool* no_wait) + bool allow_ibuf_merge) { buf_block_t *block= recv_sys.recover(page_id); if (UNIV_LIKELY(!block)) return buf_page_get_low(page_id, zip_size, rw_latch, - guess, mode, mtr, err, allow_ibuf_merge, - no_wait); + guess, mode, mtr, err, allow_ibuf_merge); else if (UNIV_UNLIKELY(block == reinterpret_cast(-1))) { corrupted: @@ -3050,7 +3063,6 @@ buf_page_get_gen( *err= DB_CORRUPTION; return nullptr; } - /* Recovery is a special case; we fix() before acquiring lock. */ auto s= block->page.fix(); ut_ad(s >= buf_page_t::FREED); /* The block may be write-fixed at this point because we are not @@ -3097,12 +3109,21 @@ buf_page_get_gen( } } - if (rw_latch == RW_X_LATCH) - { - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); - return block; + switch (rw_latch) { + case RW_NO_LATCH: + block->page.lock.x_unlock(); + case RW_X_LATCH: + break; + case RW_SX_LATCH: + block->page.lock.x_u_downgrade(); + break; + case RW_S_LATCH: + block->page.lock.x_u_downgrade(); + block->page.lock.u_s_downgrade(); } - block->page.lock.x_unlock(); + + mtr->memo_push(block, mtr_memo_type_t(rw_latch)); + return block; } mtr->page_lock(block, rw_latch); return block; diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index ee6bffd4031..f05bb96aaa0 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -354,14 +354,12 @@ performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous i/o. @param[in] page_id page id of a page which the current thread wants to access -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] ibuf whether we are inside ibuf routine @return number of page read requests issued; NOTE that if we read ibuf pages, it may happen that the page at the given page number does not get read even if we return a positive value! */ TRANSACTIONAL_TARGET -ulint -buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) +ulint buf_read_ahead_random(const page_id_t page_id, bool ibuf) { if (!srv_random_read_ahead || page_id.space() >= SRV_TMP_SPACE_ID) /* Disable the read-ahead for temporary tablespace */ @@ -371,9 +369,7 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) /* No read-ahead to avoid thread deadlocks */ return 0; - if (ibuf_bitmap_page(page_id, zip_size) || trx_sys_hdr_page(page_id)) - /* If it is an ibuf bitmap page or trx sys hdr, we do no - read-ahead, as that could break the ibuf page access order */ + if (trx_sys_hdr_page(page_id)) return 0; if (os_aio_pending_reads_approx() > @@ -384,6 +380,17 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) if (!space) return 0; + const unsigned zip_size{space->zip_size()}; + + if (ibuf_bitmap_page(page_id, zip_size)) + { + /* If it is a change buffer bitmap page, we do no + read-ahead, as that could break the ibuf page access order */ + no_read_ahead: + space->release(); + return 0; + } + const uint32_t buf_read_ahead_area= buf_pool.read_ahead_area; ulint count= 5 + buf_read_ahead_area / 8; const page_id_t low= page_id - (page_id.page_no() % buf_read_ahead_area); @@ -403,9 +410,7 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) goto read_ahead; } -no_read_ahead: - space->release(); - return 0; + goto no_read_ahead; read_ahead: if (space->is_stopping()) @@ -449,14 +454,13 @@ if it is not already there. Sets the io_fix and an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. @param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @retval DB_SUCCESS if the page was read and is not corrupted @retval DB_SUCCESS_LOCKED_REC if the page was not read @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ -dberr_t buf_read_page(const page_id_t page_id, ulint zip_size) +dberr_t buf_read_page(const page_id_t page_id) { fil_space_t *space= fil_space_t::get(page_id.space()); if (!space) @@ -468,7 +472,7 @@ dberr_t buf_read_page(const page_id_t page_id, ulint zip_size) buf_LRU_stat_inc_io(); /* NOT protected by buf_pool.mutex */ return buf_read_page_low(space, true, BUF_READ_ANY_PAGE, - page_id, zip_size, false); + page_id, space->zip_size(), false); } /** High-level function which reads a page asynchronously from a file to the @@ -515,12 +519,10 @@ NOTE 3: the calling thread must want access to the page given: this rule is set to prevent unintended read-aheads performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous io. @param[in] page_id page id; see NOTE 3 above -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] ibuf whether if we are inside ibuf routine @return number of page read requests issued */ TRANSACTIONAL_TARGET -ulint -buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) +ulint buf_read_ahead_linear(const page_id_t page_id, bool ibuf) { /* check if readahead is disabled. Disable the read ahead logic for temporary tablespace */ @@ -547,15 +549,12 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) /* This is not a border page of the area */ return 0; - if (ibuf_bitmap_page(page_id, zip_size) || trx_sys_hdr_page(page_id)) - /* If it is an ibuf bitmap page or trx sys hdr, we do no - read-ahead, as that could break the ibuf page access order */ - return 0; - fil_space_t *space= fil_space_t::get(page_id.space()); if (!space) return 0; + const unsigned zip_size= space->zip_size(); + if (high_1.page_no() > space->last_page_number()) { /* The area is not whole. */ @@ -564,6 +563,11 @@ fail: return 0; } + if (ibuf_bitmap_page(page_id, zip_size) || trx_sys_hdr_page(page_id)) + /* If it is an ibuf bitmap page or trx sys hdr, we do no + read-ahead, as that could break the ibuf page access order */ + goto fail; + /* How many out of order accessed pages can we ignore when working out the access pattern for linear readahead */ ulint count= std::min(buf_pool_t::READ_AHEAD_PAGES - diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 4aab68e9ca2..fb34080966b 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -649,7 +649,7 @@ dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple, search_loop: auto buf_mode= BUF_GET; - ulint rw_latch= RW_NO_LATCH; + rw_lock_type_t rw_latch= RW_NO_LATCH; if (height) { @@ -660,7 +660,7 @@ dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple, rw_latch= upper_rw_latch; } else if (latch_mode <= BTR_MODIFY_LEAF) - rw_latch= latch_mode; + rw_latch= rw_lock_type_t(latch_mode); dberr_t err; auto block_savepoint= mtr->get_savepoint(); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index a7a32e67203..033857857e0 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -929,10 +929,12 @@ ibuf_page_low( ut_ad(fil_system.sys_space->purpose == FIL_TYPE_TABLESPACE); #ifdef UNIV_DEBUG - if (!x_latch) { - mtr_start(&local_mtr); - - /* Get the bitmap page without a page latch, so that + if (x_latch) { + } else if (buf_block_t* block = buf_pool.page_fix( + ibuf_bitmap_page_no_calc(page_id, zip_size))) { + local_mtr.start(); + local_mtr.memo_push(block, MTR_MEMO_BUF_FIX); + /* We got the bitmap page without a page latch, so that we will not be violating the latching order when another bitmap page has already been latched by this thread. The page will be buffer-fixed, and thus it @@ -942,16 +944,10 @@ ibuf_page_low( not be modified by any other thread. Nobody should be calling ibuf_add_free_page() or ibuf_remove_free_page() while the page is linked to the insert buffer b-tree. */ - buf_block_t* block = buf_page_get_gen( - ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_NO_LATCH, nullptr, BUF_GET, &local_mtr); - - ret = block - && ibuf_bitmap_page_get_bits_low( + ret = ibuf_bitmap_page_get_bits_low( block->page.frame, page_id, zip_size, MTR_MEMO_BUF_FIX, &local_mtr, IBUF_BITMAP_IBUF); - - mtr_commit(&local_mtr); + local_mtr.commit(); return(ret); } #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index a2c55f3edf7..82179e6d646 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -194,42 +194,37 @@ be implemented at a higher level. In other words, all possible accesses to a given page through this function must be protected by the same set of mutexes or latches. @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size in bytes @return pointer to the block, s-latched */ -buf_page_t *buf_page_get_zip(const page_id_t page_id, ulint zip_size); +buf_page_t *buf_page_get_zip(const page_id_t page_id); /** Get access to a database page. Buffered redo log may be applied. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @param[in,out] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge while -reading the pages from file. -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@param[in] allow_ibuf_merge Allow change buffer merge to happen +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ buf_block_t* buf_page_get_gen( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err = NULL, - bool allow_ibuf_merge = false, - bool* no_wait = nullptr) + dberr_t* err = nullptr, + bool allow_ibuf_merge = false) MY_ATTRIBUTE((nonnull(6), warn_unused_result)); /** This is the low level function used to get access to a database page. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH @@ -237,26 +232,19 @@ BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH block with page_id is to be evicted @param[out] err DB_SUCCESS or error code @param[in] allow_ibuf_merge Allow change buffer merge to happen -while reading the page from file -then it makes sure that it does merging of change buffer changes while -reading the page from file. -@param[in] holds_next_page_latch True if caller holds next page latch. -We must not wait for current page latch. -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ buf_block_t* buf_page_get_low( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, dberr_t* err, - bool allow_ibuf_merge, - bool* no_wait); + bool allow_ibuf_merge) + MY_ATTRIBUTE((nonnull(6), warn_unused_result)); /** Initialize a page in the buffer pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one @@ -398,8 +386,8 @@ void buf_page_print(const byte* read_buf, ulint zip_size = 0) ATTRIBUTE_COLD __attribute__((nonnull)); /********************************************************************//** Decompress a block. -@return TRUE if successful */ -ibool +@return true if successful */ +bool buf_zip_decompress( /*===============*/ buf_block_t* block, /*!< in/out: block */ @@ -664,37 +652,49 @@ public: public: const page_id_t &id() const { return id_; } uint32_t state() const { return zip.fix; } - uint32_t buf_fix_count() const - { - uint32_t f= state(); - ut_ad(f >= FREED); - return f < UNFIXED ? (f - FREED) : (~LRU_MASK & f); - } + static uint32_t buf_fix_count(uint32_t s) + { ut_ad(s >= FREED); return s < UNFIXED ? (s - FREED) : (~LRU_MASK & s); } + + uint32_t buf_fix_count() const { return buf_fix_count(state()); } + /** Check if a file block is io-fixed. + @param s state() + @return whether s corresponds to an io-fixed block */ + static bool is_io_fixed(uint32_t s) + { ut_ad(s >= FREED); return s >= READ_FIX; } + /** Check if a file block is read-fixed. + @param s state() + @return whether s corresponds to a read-fixed block */ + static bool is_read_fixed(uint32_t s) + { return is_io_fixed(s) && s < WRITE_FIX; } + /** Check if a file block is write-fixed. + @param s state() + @return whether s corresponds to a write-fixed block */ + static bool is_write_fixed(uint32_t s) + { ut_ad(s >= FREED); return s >= WRITE_FIX; } + /** @return whether this block is read or write fixed; read_complete() or write_complete() will always release the io-fix before releasing U-lock or X-lock */ - bool is_io_fixed() const - { const auto s= state(); ut_ad(s >= FREED); return s >= READ_FIX; } + bool is_io_fixed() const { return is_io_fixed(state()); } /** @return whether this block is write fixed; write_complete() will always release the write-fix before releasing U-lock */ - bool is_write_fixed() const { return state() >= WRITE_FIX; } - /** @return whether this block is read fixed; this should never hold - when a thread is holding the block lock in any mode */ - bool is_read_fixed() const { return is_io_fixed() && !is_write_fixed(); } + bool is_write_fixed() const { return is_write_fixed(state()); } + /** @return whether this block is read fixed */ + bool is_read_fixed() const { return is_read_fixed(state()); } /** @return if this belongs to buf_pool.unzip_LRU */ bool belongs_to_unzip_LRU() const { return UNIV_LIKELY_NULL(zip.data) && frame; } - bool is_freed() const - { const auto s= state(); ut_ad(s >= FREED); return s < UNFIXED; } - bool is_ibuf_exist() const + static bool is_freed(uint32_t s) { ut_ad(s >= FREED); return s < UNFIXED; } + bool is_freed() const { return is_freed(state()); } + static bool is_ibuf_exist(uint32_t s) { - const auto s= state(); ut_ad(s >= UNFIXED); ut_ad(s < READ_FIX); return (s & LRU_MASK) == IBUF_EXIST; } + bool is_ibuf_exist() const { return is_ibuf_exist(state()); } bool is_reinit() const { return !(~state() & REINIT); } void set_reinit(uint32_t prev_state) @@ -1416,11 +1416,43 @@ public: } public: + /** page_fix() mode of operation */ + enum page_fix_conflicts{ + /** Fetch if in the buffer pool, also blocks marked as free */ + FIX_ALSO_FREED= -1, + /** Fetch, waiting for page read completion */ + FIX_WAIT_READ, + /** Fetch, but avoid any waits for */ + FIX_NOWAIT + }; + /** Look up and buffer-fix a page. + Note: If the page is read-fixed (being read into the buffer pool), + we would have to wait for the page latch before determining if the page + is accessible (it could be corrupted and have been evicted again). + If the caller is holding other page latches so that waiting for this + page latch could lead to lock order inversion (latching order violation), + the mode c=FIX_WAIT_READ must not be used. @param id page identifier + @param err error code (will only be assigned when returning nullptr) + @param c how to handle conflicts @return undo log page, buffer-fixed + @retval -1 if c=FIX_NOWAIT and buffer-fixing would require waiting @retval nullptr if the undo page was corrupted or freed */ - buf_block_t *page_fix(const page_id_t id); + buf_block_t *page_fix(const page_id_t id, dberr_t *err, + page_fix_conflicts c); + + buf_block_t *page_fix(const page_id_t id) + { return page_fix(id, nullptr, FIX_WAIT_READ); } + + + /** Decompress a page and relocate the block descriptor + @param b buffer-fixed compressed-only ROW_FORMAT=COMPRESSED page + @param chain hash table chain for b->id().fold() + @return the decompressed block, x-latched and read-fixed + @retval nullptr if the decompression failed (b->unfix() will be invoked) */ + ATTRIBUTE_COLD __attribute__((nonnull, warn_unused_result)) + buf_block_t *unzip(buf_page_t *b, hash_chain &chain); /** @return whether the buffer pool contains a page @tparam allow_watch whether to allow watch_is_sentinel() @@ -1698,8 +1730,8 @@ public: /** map of block->frame to buf_block_t blocks that belong to buf_buddy_alloc(); protected by buf_pool.mutex */ hash_table_t zip_hash; - Atomic_counter - n_pend_unzip; /*!< number of pending decompressions */ + /** number of pending unzip() */ + Atomic_counter n_pend_unzip; time_t last_printout_time; /*!< when buf_print_io was last time diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 3dd085dda5c..32296720c79 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -34,14 +34,13 @@ buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. @param page_id page id -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 @retval DB_SUCCESS if the page was read and is not corrupted @retval DB_SUCCESS_LOCKED_REC if the page was not read @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ -dberr_t buf_read_page(const page_id_t page_id, ulint zip_size); +dberr_t buf_read_page(const page_id_t page_id); /** High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there. Sets the io_fix flag and sets @@ -65,13 +64,11 @@ performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous i/o. @param[in] page_id page id of a page which the current thread wants to access -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] ibuf whether we are inside ibuf routine @return number of page read requests issued; NOTE that if we read ibuf pages, it may happen that the page at the given page number does not get read even if we return a positive value! */ -ulint -buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf); +ulint buf_read_ahead_random(const page_id_t page_id, bool ibuf); /** Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. @@ -96,11 +93,10 @@ NOTE 3: the calling thread must want access to the page given: this rule is set to prevent unintended read-aheads performed by ibuf routines, a situation which could result in a deadlock if the OS does not support asynchronous io. @param[in] page_id page id; see NOTE 3 above -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] ibuf whether if we are inside ibuf routine @return number of page read requests issued */ ulint -buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf); +buf_read_ahead_linear(const page_id_t page_id, bool ibuf); /** Schedule a page for recovery. @param space tablespace diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index b130675da15..4d5f3592b5a 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2160,38 +2160,43 @@ updated then its state must be set to BUF_PAGE_NOT_USED. @retval DB_SUCCESS or error code. */ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW { - /* If we already had an old page with matching number - in the buffer pool, evict it now, because - we no longer evict the pages on DISCARD TABLESPACE. */ - buf_page_get_low(block->page.id(), get_zip_size(), RW_NO_LATCH, - nullptr, BUF_PEEK_IF_IN_POOL, - nullptr, nullptr, false, nullptr); + /* If we already had an old page with matching number in the buffer + pool, evict it now, because we no longer evict the pages on + DISCARD TABLESPACE. */ + if (buf_block_t *b= buf_pool.page_fix(block->page.id(), nullptr, + buf_pool_t::FIX_ALSO_FREED)) + { + ut_ad(!b->page.oldest_modification()); + mysql_mutex_lock(&buf_pool.mutex); + b->unfix(); - uint16_t page_type; + if (!buf_LRU_free_page(&b->page, true)) + ut_ad(0); - if (dberr_t err = update_page(block, page_type)) { - return err; - } + mysql_mutex_unlock(&buf_pool.mutex); + } - const bool full_crc32 = fil_space_t::full_crc32(get_space_flags()); - byte* frame = get_frame(block); - memset_aligned<8>(frame + FIL_PAGE_LSN, 0, 8); + uint16_t page_type; - if (!block->page.zip.data) { - buf_flush_init_for_writing( - NULL, block->page.frame, NULL, full_crc32); - } else if (fil_page_type_is_index(page_type)) { - buf_flush_init_for_writing( - NULL, block->page.zip.data, &block->page.zip, - full_crc32); - } else { - /* Calculate and update the checksum of non-index - pages for ROW_FORMAT=COMPRESSED tables. */ - buf_flush_update_zip_checksum( - block->page.zip.data, block->zip_size()); - } + if (dberr_t err= update_page(block, page_type)) + return err; - return DB_SUCCESS; + const bool full_crc32= fil_space_t::full_crc32(get_space_flags()); + byte *frame= get_frame(block); + memset_aligned<8>(frame + FIL_PAGE_LSN, 0, 8); + + if (!block->page.zip.data) + buf_flush_init_for_writing(nullptr, block->page.frame, nullptr, + full_crc32); + else if (fil_page_type_is_index(page_type)) + buf_flush_init_for_writing(nullptr, block->page.zip.data, &block->page.zip, + full_crc32); + else + /* Calculate and update the checksum of non-index + pages for ROW_FORMAT=COMPRESSED tables. */ + buf_flush_update_zip_checksum(block->page.zip.data, block->zip_size()); + + return DB_SUCCESS; } static void reload_fts_table(row_prebuilt_t *prebuilt, diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 276bcb6166d..c623265192a 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1971,38 +1971,6 @@ corrupted_rec: mem_heap_empty(row_heap); if (!mtr_started) { - goto scan_next; - } - - if (clust_index->lock.is_waiting()) { - /* There are waiters on the clustered - index tree lock, likely the purge - thread. Store and restore the cursor - position, and yield so that scanning a - large table will not starve other - threads. */ - - /* Store the cursor position on the last user - record on the page. */ - if (!btr_pcur_move_to_prev_on_page(&pcur)) { - goto corrupted_index; - } - /* Leaf pages must never be empty, unless - this is the only page in the index tree. */ - if (!btr_pcur_is_on_user_rec(&pcur) - && btr_pcur_get_block(&pcur)->page.id() - .page_no() != clust_index->page) { - goto corrupted_index; - } - - btr_pcur_store_position(&pcur, &mtr); - mtr.commit(); - mtr_started = false; - - /* Give the waiters a chance to proceed. */ - std::this_thread::yield(); -scan_next: - ut_ad(!mtr_started); ut_ad(!mtr.is_active()); mtr.start(); mtr_started = true; @@ -2015,7 +1983,7 @@ scan_next: corrupted_index: err = DB_CORRUPTION; goto func_exit; - } + } /* Move to the successor of the original record. */ if (!btr_pcur_move_to_next_user_rec( @@ -2050,14 +2018,14 @@ end_of_index: buf_page_make_young_if_needed(&block->page); + const auto s = mtr.get_savepoint(); + mtr.rollback_to_savepoint(s - 2, s - 1); + page_cur_set_before_first(block, cur); if (!page_cur_move_to_next(cur) || page_cur_is_after_last(cur)) { goto corrupted_rec; } - - const auto s = mtr.get_savepoint(); - mtr.rollback_to_savepoint(s - 2, s - 1); } } else { mem_heap_empty(row_heap); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index c0f5b1fb22c..5626b88dcf6 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -185,7 +185,7 @@ trx_undo_get_prev_rec_from_prev_page(buf_block_t *&block, uint16_t rec, return nullptr; if (!buf_page_make_young_if_needed(&block->page)) - buf_read_ahead_linear(block->page.id(), 0, false); + buf_read_ahead_linear(block->page.id(), false); return trx_undo_page_get_last_rec(block, page_no, offset); } @@ -242,7 +242,7 @@ trx_undo_get_prev_rec(buf_block_t *&block, uint16_t rec, uint32_t page_no, static trx_undo_rec_t* trx_undo_get_next_rec_from_next_page(const buf_block_t *&block, uint32_t page_no, uint16_t offset, - ulint mode, mtr_t *mtr) + rw_lock_type_t mode, mtr_t *mtr) { if (page_no == block->page.id().page_no() && mach_read_from_2(block->page.frame + offset + TRX_UNDO_NEXT_LOG)) @@ -272,7 +272,8 @@ trx_undo_get_next_rec_from_next_page(const buf_block_t *&block, @retval nullptr if none */ static trx_undo_rec_t* trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, - uint16_t offset, ulint mode, const buf_block_t*& block, + uint16_t offset, rw_lock_type_t mode, + const buf_block_t *&block, mtr_t *mtr, dberr_t *err) { buf_block_t *b= buf_page_get_gen(page_id_t{space.id, page_no}, 0, mode, @@ -282,7 +283,7 @@ trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, return nullptr; if (!buf_page_make_young_if_needed(&b->page)) - buf_read_ahead_linear(b->page.id(), 0, false); + buf_read_ahead_linear(b->page.id(), false); if (trx_undo_rec_t *rec= trx_undo_page_get_first_rec(b, page_no, offset)) return rec; From 9f0b106631f34da376e518a23c902b0f7fa26667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 3 Sep 2024 18:22:10 +0300 Subject: [PATCH 023/185] MDEV-34845 buf_flush_buffer_pool(): Assertion `!os_aio_pending_reads()' failed buf_flush_buffer_pool(): Wait for any pending asynchronous reads to complete. This assertion failed in a run where buf_read_ahead_linear() had been triggered in an SQL statement that was executed right before shutdown. Reviewed by: Debarun Banerjee --- storage/innobase/buf/buf0flu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 46129a037b0..494cd7b3f42 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2588,12 +2588,12 @@ ATTRIBUTE_COLD void buf_flush_page_cleaner_init() /** Flush the buffer pool on shutdown. */ ATTRIBUTE_COLD void buf_flush_buffer_pool() { - ut_ad(!os_aio_pending_reads()); ut_ad(!buf_page_cleaner_is_active); ut_ad(!buf_flush_sync_lsn); service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, "Waiting to flush the buffer pool"); + os_aio_wait_until_no_pending_reads(false); mysql_mutex_lock(&buf_pool.flush_list_mutex); From d1dc70675c000fc5c6b38ce4456fd2faf56abaf0 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 4 Sep 2024 10:10:04 +1000 Subject: [PATCH 024/185] MDEV-34864 SHOW INDEX FROM - SEQ_IN_INDEX to ULong MySQL-Connector-Net casts SEQ_IN_INDEX to uint and will raise an exception if the type is a System.Int64. As we don't support a huge number of multi-columns in an index reducing to a uint is sufficient to represent all values and maintain compatibility with MySQL-Connector-Net. This matches the type (uint) returned by MySQL-8.3 and 8.0. Reviewer: Alexander Barkov --- mysql-test/main/show_check.result | 6 +++--- mysql-test/suite/funcs_1/r/is_columns_is.result | 4 ++-- mysql-test/suite/funcs_1/r/is_columns_is_embedded.result | 4 ++-- mysql-test/suite/funcs_1/r/is_statistics.result | 6 +++--- sql/sql_show.cc | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index 7c0a3251e45..ecbaa8af774 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -66,7 +66,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 8 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 8 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 1 N 4097 0 8 def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 8 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 @@ -650,7 +650,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 63 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 63 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 6 N 4097 0 63 def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 63 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 @@ -920,7 +920,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 192 2 N 4097 0 33 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 192 7 N 4097 0 33 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 192 1 N 4097 0 33 def information_schema STATISTICS STATISTICS COLLATION Collation 253 3 1 Y 4096 0 33 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 0758acc66a9..4f739e054ba 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -356,7 +356,7 @@ def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) select NEVER NULL def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select NEVER NULL def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10) select NEVER NULL -def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) select NEVER NULL +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO int NULL NULL 10 0 NULL NULL NULL int(2) unsigned select NEVER NULL def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL @@ -898,7 +898,7 @@ NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5) NULL information_schema STATISTICS NON_UNIQUE bigint NULL NULL NULL NULL bigint(1) 3.0000 information_schema STATISTICS INDEX_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema STATISTICS INDEX_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -NULL information_schema STATISTICS SEQ_IN_INDEX bigint NULL NULL NULL NULL bigint(2) +NULL information_schema STATISTICS SEQ_IN_INDEX int NULL NULL NULL NULL int(2) unsigned 3.0000 information_schema STATISTICS COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema STATISTICS COLLATION varchar 1 3 utf8 utf8_general_ci varchar(1) NULL information_schema STATISTICS CARDINALITY bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index a759b66d106..da9e42d6e09 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -356,7 +356,7 @@ def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) NEVER NULL def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) NEVER NULL def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10) NEVER NULL -def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) NEVER NULL +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO int NULL NULL 10 0 NULL NULL NULL int(2) unsigned NEVER NULL def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL @@ -898,7 +898,7 @@ NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5) NULL information_schema STATISTICS NON_UNIQUE bigint NULL NULL NULL NULL bigint(1) 3.0000 information_schema STATISTICS INDEX_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema STATISTICS INDEX_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -NULL information_schema STATISTICS SEQ_IN_INDEX bigint NULL NULL NULL NULL bigint(2) +NULL information_schema STATISTICS SEQ_IN_INDEX int NULL NULL NULL NULL int(2) unsigned 3.0000 information_schema STATISTICS COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema STATISTICS COLLATION varchar 1 3 utf8 utf8_general_ci varchar(1) NULL information_schema STATISTICS CARDINALITY bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 3d5ed9c3674..ae1b7db30bb 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -34,7 +34,7 @@ TABLE_NAME varchar(64) NO NULL NON_UNIQUE bigint(1) NO NULL INDEX_SCHEMA varchar(64) NO NULL INDEX_NAME varchar(64) NO NULL -SEQ_IN_INDEX bigint(2) NO NULL +SEQ_IN_INDEX int(2) unsigned NO NULL COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL @@ -53,7 +53,7 @@ STATISTICS CREATE TEMPORARY TABLE `STATISTICS` ( `NON_UNIQUE` bigint(1) NOT NULL, `INDEX_SCHEMA` varchar(64) NOT NULL, `INDEX_NAME` varchar(64) NOT NULL, - `SEQ_IN_INDEX` bigint(2) NOT NULL, + `SEQ_IN_INDEX` int(2) unsigned NOT NULL, `COLUMN_NAME` varchar(64) NOT NULL, `COLLATION` varchar(1), `CARDINALITY` bigint(21), @@ -72,7 +72,7 @@ TABLE_NAME varchar(64) NO NULL NON_UNIQUE bigint(1) NO NULL INDEX_SCHEMA varchar(64) NO NULL INDEX_NAME varchar(64) NO NULL -SEQ_IN_INDEX bigint(2) NO NULL +SEQ_IN_INDEX int(2) unsigned NO NULL COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ed32d298d19..9057ff8712f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9392,7 +9392,7 @@ ST_FIELD_INFO stat_fields_info[]= Column("NON_UNIQUE", SLonglong(1),NOT_NULL, "Non_unique", OPEN_FRM_ONLY), Column("INDEX_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), Column("INDEX_NAME", Name(), NOT_NULL, "Key_name", OPEN_FRM_ONLY), - Column("SEQ_IN_INDEX", SLonglong(2),NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), + Column("SEQ_IN_INDEX", ULong(2), NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), Column("COLUMN_NAME", Name(), NOT_NULL, "Column_name", OPEN_FRM_ONLY), Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FULL_TABLE), Column("CARDINALITY", SLonglong(), NULLABLE, "Cardinality", OPEN_FULL_TABLE), From 9011e3be1836bb304b1baccf5757b5447d6b09bb Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Tue, 3 Sep 2024 19:15:59 +0200 Subject: [PATCH 025/185] Update man pages, binary names, version --- man/comp_err.1 | 10 +- man/galera_new_cluster.1 | 2 +- man/galera_recovery.1 | 2 +- man/innochecksum.1 | 4 +- man/mariadb-access.1 | 122 ++--- man/mariadb-admin.1 | 234 +++++----- man/mariadb-backup.1 | 2 +- man/mariadb-binlog.1 | 334 +++++++------- man/mariadb-check.1 | 302 ++++++------- man/mariadb-client-test.1 | 102 ++--- man/mariadb-conv.1 | 4 +- man/mariadb-convert-table-format.1 | 62 +-- man/mariadb-dump.1 | 592 ++++++++++++------------ man/mariadb-dumpslow.1 | 40 +- man/mariadb-find-rows.1 | 46 +- man/mariadb-fix-extensions.1 | 20 +- man/mariadb-hotcopy.1 | 134 +++--- man/mariadb-import.1 | 232 +++++----- man/mariadb-install-db.1 | 132 +++--- man/mariadb-plugin.1 | 100 ++--- man/mariadb-secure-installation.1 | 34 +- man/mariadb-service-convert.1 | 8 +- man/mariadb-setpermission.1 | 48 +- man/mariadb-show.1 | 176 ++++---- man/mariadb-slap.1 | 286 ++++++------ man/mariadb-test.1 | 288 ++++++------ man/mariadb-tzinfo-to-sql.1 | 46 +- man/mariadb-upgrade.1 | 210 ++++----- man/mariadb-waitpid.1 | 38 +- man/mariadb.1 | 692 ++++++++++++++--------------- man/mariadb_config.1 | 74 +-- man/mariadbd-multi.1 | 254 +++++------ man/mariadbd-safe-helper.1 | 2 +- man/mariadbd-safe.1 | 284 ++++++------ man/mariadbd.8 | 20 +- man/mbstream.1 | 2 +- man/msql2mysql.1 | 10 +- man/my_print_defaults.1 | 18 +- man/my_safe_process.1 | 2 +- man/myisam_ftdump.1 | 4 +- man/myisamchk.1 | 20 +- man/myisamlog.1 | 4 +- man/myisampack.1 | 20 +- man/mysql-stress-test.pl.1 | 134 +++--- man/mysql-test-run.pl.1 | 646 +++++++++++++-------------- man/mysql.server.1 | 18 +- man/mytop.1 | 2 +- man/perror.1 | 4 +- man/replace.1 | 4 +- man/resolve_stack_dump.1 | 8 +- man/resolveip.1 | 4 +- man/wsrep_sst_backup.1 | 2 +- man/wsrep_sst_common.1 | 2 +- man/wsrep_sst_mariabackup.1 | 2 +- man/wsrep_sst_mysqldump.1 | 2 +- man/wsrep_sst_rsync.1 | 2 +- man/wsrep_sst_rsync_wan.1 | 2 +- 57 files changed, 2924 insertions(+), 2924 deletions(-) diff --git a/man/comp_err.1 b/man/comp_err.1 index 6f000869797..5bda07b7ea1 100644 --- a/man/comp_err.1 +++ b/man/comp_err.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBCOMP_ERR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBCOMP_ERR\fR" "1" "4 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -23,7 +23,7 @@ comp_err \- compile MariaDB error message file creates the errmsg\&.sys file that is used by -\fBmysqld\fR +\fBmariadbd\fR to determine the error messages to display for different error codes\&. \fBcomp_err\fR normally is run automatically when MariaDB is built\&. It compiles the @@ -39,7 +39,7 @@ mysqld_ername\&.h, and sql_state\&.h header files\&. .PP -For more information about how error messages are defined, see the MySQL Internals Manual\&. +For more information about how error messages are defined, see the MariaDB Manual\&. .PP Invoke \fBcomp_err\fR @@ -141,7 +141,7 @@ Print some debugging information when the program exits\&. \fB\-H \fR\fB\fIfile_name\fR\fR .sp The name of the error header file\&. The default is -mysqld_error\&.h\&. +mariadbd_error\&.h\&. .RE .sp .RS 4 @@ -247,7 +247,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index 4e03abf1d3c..28708728079 100644 --- a/man/galera_new_cluster.1 +++ b/man/galera_new_cluster.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 18da2fa5fd0..1d93c865b0d 100644 --- a/man/galera_recovery.1 +++ b/man/galera_recovery.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_RECOVERY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBGALERA_RECOVERY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index ae7a5b03523..1046d4a0d74 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBINNOCHECKSUM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBINNOCHECKSUM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -303,7 +303,7 @@ Displays version information and exits\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2023 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-access.1 b/man/mariadb-access.1 index 762c1959584..eb01301a573 100644 --- a/man/mariadb-access.1 +++ b/man/mariadb-access.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ACCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-ACCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlaccess +.\" mariadb-access .SH "NAME" -mariadb-access \- client for checking access privileges (mysqlaccess is now a symlink to mariadb-access) +mariadb-access \- client for checking access privileges (mariadb-access is now a symlink to mariadb-access) .SH "SYNOPSIS" -.HP \w'\fBmysqlaccess\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-access\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-access [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqlaccess\fR +\fBmariadb-access\fR is a diagnostic tool written by Yves Carlier\&. It checks the access privileges for a host name, user name, and database combination\&. Note that -\fBmysqlaccess\fR +\fBmariadb-access\fR checks access using only the user, db, and @@ -33,20 +33,20 @@ procs_priv tables\&. .PP Invoke -\fBmysqlaccess\fR +\fBmariadb-access\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-access [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlaccess\fR +\fBmariadb-access\fR supports the following options\&. .sp .RS 4 @@ -57,8 +57,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: help option -.\" help option: mysqlaccess +.\" mariadb-access: help option +.\" help option: mariadb-access \fB\-\-help\fR, \fB\-?\fR .sp @@ -73,8 +73,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: brief option -.\" brief option: mysqlaccess +.\" mariadb-access: brief option +.\" brief option: mariadb-access \fB\-\-brief\fR, \fB\-b\fR .sp @@ -89,12 +89,12 @@ Generate reports in single\-line tabular format\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: commit option -.\" commit option: mysqlaccess +.\" mariadb-access: commit option +.\" commit option: mariadb-access \fB\-\-commit\fR .sp Copy the new access privileges from the temporary tables to the original grant tables\&. The grant tables must be flushed for the new privileges to take effect\&. (For example, execute a -\fBmysqladmin reload\fR +\fBmariadb-admin reload\fR command\&.) .RE .sp @@ -106,8 +106,8 @@ command\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: copy option -.\" copy option: mysqlaccess +.\" mariadb-access: copy option +.\" copy option: mariadb-access \fB\-\-copy\fR .sp Reload the temporary grant tables from original ones\&. @@ -121,8 +121,8 @@ Reload the temporary grant tables from original ones\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: db option -.\" db option: mysqlaccess +.\" mariadb-access: db option +.\" db option: mariadb-access \fB\-\-db=\fR\fB\fIdb_name\fR\fR, \fB\-d \fR\fB\fIdb_name\fR\fR .sp @@ -137,8 +137,8 @@ Specify the database name\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: debug option -.\" debug option: mysqlaccess +.\" mariadb-access: debug option +.\" debug option: mariadb-access \fB\-\-debug=\fR\fB\fIN\fR\fR .sp Specify the debug level\&. @@ -154,8 +154,8 @@ can be an integer from 0 to 3\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: host option -.\" host option: mysqlaccess +.\" mariadb-access: host option +.\" host option: mariadb-access \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -170,12 +170,12 @@ The host name to use in the access privileges\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: howto option -.\" howto option: mysqlaccess +.\" mariadb-access: howto option +.\" howto option: mariadb-access \fB\-\-howto\fR .sp Display some examples that show how to use -\fBmysqlaccess\fR\&. +\fBmariadb-access\fR\&. .RE .sp .RS 4 @@ -186,8 +186,8 @@ Display some examples that show how to use .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: old_server option -.\" old_server option: mysqlaccess +.\" mariadb-access: old_server option +.\" old_server option: mariadb-access \fB\-\-old_server\fR .sp Connect to a very old MySQL server (before MySQL 3\&.21) that does not know how to handle full @@ -202,8 +202,8 @@ WHERE clauses\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: password option -.\" password option: mysqlaccess +.\" mariadb-access: password option +.\" password option: mariadb-access \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -214,7 +214,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlaccess\fR +\fBmariadb-access\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. See @@ -229,8 +229,8 @@ Section\ \&5.3.2.2, \(lqEnd-User Guidelines for Password Security\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: plan option -.\" plan option: mysqlaccess +.\" mariadb-access: plan option +.\" plan option: mariadb-access \fB\-\-plan\fR .sp Display suggestions and ideas for future releases\&. @@ -244,8 +244,8 @@ Display suggestions and ideas for future releases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: preview option -.\" preview option: mysqlaccess +.\" mariadb-access: preview option +.\" preview option: mariadb-access \fB\-\-preview\fR .sp Show the privilege differences after making changes to the temporary grant tables\&. @@ -259,8 +259,8 @@ Show the privilege differences after making changes to the temporary grant table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: relnotes option -.\" relnotes option: mysqlaccess +.\" mariadb-access: relnotes option +.\" relnotes option: mariadb-access \fB\-\-relnotes\fR .sp Display the release notes\&. @@ -274,8 +274,8 @@ Display the release notes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: rhost option -.\" rhost option: mysqlaccess +.\" mariadb-access: rhost option +.\" rhost option: mariadb-access \fB\-\-rhost=\fR\fB\fIhost_name\fR\fR, \fB\-H \fR\fB\fIhost_name\fR\fR .sp @@ -290,8 +290,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: rollback option -.\" rollback option: mysqlaccess +.\" mariadb-access: rollback option +.\" rollback option: mariadb-access \fB\-\-rollback\fR .sp Undo the most recent changes to the temporary grant tables\&. @@ -305,8 +305,8 @@ Undo the most recent changes to the temporary grant tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: spassword option -.\" spassword option: mysqlaccess +.\" mariadb-access: spassword option +.\" spassword option: mariadb-access \fB\-\-spassword[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-P[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -317,7 +317,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlaccess\fR +\fBmariadb-access\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. See @@ -332,8 +332,8 @@ Section\ \&5.3.2.2, \(lqEnd-User Guidelines for Password Security\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: superuser option -.\" superuser option: mysqlaccess +.\" mariadb-access: superuser option +.\" superuser option: mariadb-access \fB\-\-superuser=\fR\fB\fIuser_name\fR\fR, \fB\-U \fR\fB\fIuser_name\fR\fR .sp @@ -348,8 +348,8 @@ Specify the user name for connecting as the superuser\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: table option -.\" table option: mysqlaccess +.\" mariadb-access: table option +.\" table option: mariadb-access \fB\-\-table\fR, \fB\-t\fR .sp @@ -364,8 +364,8 @@ Generate reports in table format\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: user option -.\" user option: mysqlaccess +.\" mariadb-access: user option +.\" user option: mariadb-access \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -380,8 +380,8 @@ The user name to use in the access privileges\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: version option -.\" version option: mysqlaccess +.\" mariadb-access: version option +.\" version option: mariadb-access \fB\-\-version\fR, \fB\-v\fR .sp @@ -389,33 +389,33 @@ Display version information and exit\&. .RE .PP If your MariaDB distribution is installed in some non\-standard location, you must change the location where -\fBmysqlaccess\fR +\fBmariadb-access\fR expects to find the -\fBmysql\fR +\fBmariadb\fR client\&. Edit the -mysqlaccess +mariadb-access script at approximately line 18\&. Search for a line that looks like this: .sp .if n \{\ .RS 4 .\} .nf -$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable +$MYSQL = '/usr/local/bin/mariadb'; # path to mariadb executable .fi .if n \{\ .RE .\} .PP Change the path to reflect the location where -\fBmysql\fR +\fBmariadb\fR actually is stored on your system\&. If you do not do this, a Broken pipe error will occur when you run -\fBmysqlaccess\fR\&. +\fBmariadb-access\fR\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-admin.1 b/man/mariadb-admin.1 index 85dab8d2682..db970e1a0cd 100644 --- a/man/mariadb-admin.1 +++ b/man/mariadb-admin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ADMIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-ADMIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqladmin +.\" mariadb-admin .\" administration: server .\" server administration .SH "NAME" -mariadb-admin \- client for administering a MariaDB server (mysqladmin is now a symlink to mariadb-admin) +mariadb-admin \- client for administering a MariaDB server (mariadb-admin is now a symlink to mariadb-admin) .SH "SYNOPSIS" -.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u -\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR +.HP \w'\fBmariadb-admin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u +\fBmariadb-admin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR .SH "DESCRIPTION" .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR is a client for performing administrative operations\&. You can use it to check the server's configuration and current status, to create and drop databases, and more\&. .PP Invoke -\fBmysqladmin\fR +\fBmariadb-admin\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR +shell> \fBmariadb-admin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR .fi .if n \{\ .RE .\} .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR supports the following commands\&. Some of the commands take an argument following the command name\&. .sp .RS 4 @@ -387,9 +387,9 @@ password \fInew\-password\fR Set a new password\&. This changes the password to \fInew\-password\fR for the account that you use with -\fBmysqladmin\fR +\fBmariadb-admin\fR for connecting to the server\&. Thus, the next time you invoke -\fBmysqladmin\fR +\fBmariadb-admin\fR (or any other client program) using the same account, you will need to specify the new password\&. .sp If the @@ -400,7 +400,7 @@ value contains spaces or other characters that are special to your command inter .RS 4 .\} .nf -shell> \fBmysqladmin password "my new password"\fR +shell> \fBmariadb-admin password "my new password"\fR .fi .if n \{\ .RE @@ -424,9 +424,9 @@ password command with flush\-privileges on the same command line to re\-enable the grant tables because the flush operation occurs after you connect\&. However, you can use -\fBmysqladmin flush\-privileges\fR +\fBmariadb-admin flush\-privileges\fR to re\-enable the grant table and then use a separate -\fBmysqladmin password\fR +\fBmariadb-admin password\fR command to change the password\&. .sp .5v .RE @@ -443,7 +443,7 @@ command to change the password\&. ping .sp Check whether the server is alive\&. The return status from -\fBmysqladmin\fR +\fBmariadb-admin\fR is 0 if the server is running, 1 if it is not\&. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running\&. .RE @@ -602,7 +602,7 @@ All commands can be shortened to any unique prefix\&. For example: .RS 4 .\} .nf -shell> \fBmysqladmin proc stat\fR +shell> \fBmariadb-admin proc stat\fR +\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | Id | User | Host | db | Command | Time | State | Info | +\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -619,7 +619,7 @@ Open tables: 19 Queries per second avg: 0\&.0268 .\" status command: results .PP The -\fBmysqladmin status\fR +\fBmariadb-admin status\fR command result displays the following values: .sp .RS 4 @@ -739,7 +739,7 @@ The number of tables that currently are open\&. Memory in use .sp The amount of memory allocated directly by -\fBmysqld\fR\&. This value is displayed only when MariaDB has been compiled with +\fBmariadbd\fR\&. This value is displayed only when MariaDB has been compiled with \fB\-\-with\-debug=full\fR\&. .RE .sp @@ -755,23 +755,23 @@ The amount of memory allocated directly by Maximum memory used .sp The maximum amount of memory allocated directly by -\fBmysqld\fR\&. This value is displayed only when MariaDB has been compiled with +\fBmariadbd\fR\&. This value is displayed only when MariaDB has been compiled with \fB\-\-with\-debug=full\fR\&. .RE .PP If you execute -\fBmysqladmin shutdown\fR +\fBmariadb-admin shutdown\fR when connecting to a local server using a Unix socket file, -\fBmysqladmin\fR +\fBmariadb-admin\fR waits until the server's process ID file has been removed, to ensure that the server has stopped properly\&. -.\" mysqladmin command options -.\" command options: mysqladmin -.\" options: command-line: mysqladmin -.\" startup parameters: mysqladmin +.\" mariadb-admin command options +.\" command options: mariadb-admin +.\" options: command-line: mariadb-admin +.\" startup parameters: mariadb-admin .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR supports the following options, which can be specified on the command line or in the -[mysqladmin] +[mariadb-admin] and [client] option file groups\&. @@ -784,8 +784,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: help option -.\" help option: mysqladmin +.\" mariadb-admin: help option +.\" help option: mariadb-admin \fB\-\-help\fR, \fB\-?\fR .sp @@ -800,8 +800,8 @@ Display help and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: character-sets-dir option -.\" character-sets-dir option: mysqladmin +.\" mariadb-admin: character-sets-dir option +.\" character-sets-dir option: mariadb-admin \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -815,8 +815,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: compress option -.\" compress option: mysqladmin +.\" mariadb-admin: compress option +.\" compress option: mariadb-admin \fB\-\-compress\fR, \fB\-C\fR .sp @@ -831,8 +831,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: connect-timeout option -.\" connect-timeout option: mysqladmin +.\" mariadb-admin: connect-timeout option +.\" connect-timeout option: mariadb-admin \fB\-\-connect-timeout=\fR\fB\fItimeout\fR\fR .sp Equivalent to \fB\-\-connect_timeout\fR, see the end of this section\&. @@ -846,8 +846,8 @@ Equivalent to \fB\-\-connect_timeout\fR, see the end of this section\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: count option -.\" count option: mysqladmin +.\" mariadb-admin: count option +.\" count option: mariadb-admin \fB\-\-count=\fR\fB\fIN\fR\fR, \fB\-c \fR\fB\fIN\fR\fR .sp @@ -864,14 +864,14 @@ option is given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug option -.\" debug option: mysqladmin +.\" mariadb-admin: debug option +.\" debug option: mariadb-admin \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqladmin.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-admin.trace'. .RE .sp .RS 4 @@ -882,8 +882,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqladmin.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug-check option -.\" debug-check option: mysqladmin +.\" mariadb-admin: debug-check option +.\" debug-check option: mariadb-admin \fB\-\-debug\-check\fR .sp Check memory and open file usage at exit.\&. @@ -897,8 +897,8 @@ Check memory and open file usage at exit.\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug-info option -.\" debug-info option: mysqladmin +.\" mariadb-admin: debug-info option +.\" debug-info option: mariadb-admin \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -912,8 +912,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: default-auth option -.\" default-auth option: mysqladmin +.\" mariadb-admin: default-auth option +.\" default-auth option: mariadb-admin \fB\-\-default\-auth\fR .sp Default authentication client-side plugin to use\&. @@ -927,8 +927,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: default-character-set option -.\" default-character-set option: mysqladmin +.\" mariadb-admin: default-character-set option +.\" default-character-set option: mariadb-admin \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -944,8 +944,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: defaults-extra-file option -.\" defaults-extra-file option: mysqladmin +.\" mariadb-admin: defaults-extra-file option +.\" defaults-extra-file option: mariadb-admin \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -960,8 +960,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: defaults-file option -.\" defaults-file option: mysqladmin +.\" mariadb-admin: defaults-file option +.\" defaults-file option: mariadb-admin \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. Must be given as first option\&. @@ -975,8 +975,8 @@ Set \fB\fIfilename\fR\fR as the file to read default options from, override glob .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: force option -.\" force option: mysqladmin +.\" mariadb-admin: force option +.\" force option: mariadb-admin \fB\-\-force\fR, \fB\-f\fR .sp @@ -993,8 +993,8 @@ command\&. With multiple commands, continue even if an error occurs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: host option -.\" host option: mysqladmin +.\" mariadb-admin: host option +.\" host option: mariadb-admin \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -1009,8 +1009,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: local option -.\" local option: mysqladmin +.\" mariadb-admin: local option +.\" local option: mariadb-admin \fB\-\-local\fR, \fB\-l\fR .sp @@ -1021,8 +1021,8 @@ Suppress the SQL command(s) from being written to the binary log by using FLUSH .ie n \{\ \h'-04'\(bu\h'+03'\c .\} -.\" mysqladmin: no-beep option -.\" no-beep option: mysqladmin +.\" mariadb-admin: no-beep option +.\" no-beep option: mariadb-admin \fB\-\-no\-beep\fR, \fB\-b\fR .sp @@ -1037,8 +1037,8 @@ Suppress the warning beep that is emitted by default for errors such as a failur .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: no-defaults option -.\" no-defaults option: mysqladmin +.\" mariadb-admin: no-defaults option +.\" no-defaults option: mariadb-admin \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -1052,8 +1052,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: password option -.\" password option: mysqladmin +.\" mariadb-admin: password option +.\" password option: mariadb-admin \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -1066,7 +1066,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqladmin\fR +\fBmariadb-admin\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. @@ -1080,8 +1080,8 @@ Specifying a password on the command line should be considered insecure\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: pipe option -.\" pipe option: mysqladmin +.\" mariadb-admin: pipe option +.\" pipe option: mariadb-admin \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -1096,8 +1096,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: port option -.\" port option: mysqladmin +.\" mariadb-admin: port option +.\" port option: mariadb-admin \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -1114,8 +1114,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: print-defaults option -.\" print-defaults option: mysqladmin +.\" mariadb-admin: print-defaults option +.\" print-defaults option: mariadb-admin \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -1129,8 +1129,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: protocol option -.\" protocol option: mysqladmin +.\" mariadb-admin: protocol option +.\" protocol option: mariadb-admin \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -1144,8 +1144,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: relative option -.\" relative option: mysqladmin +.\" mariadb-admin: relative option +.\" relative option: mariadb-admin \fB\-\-relative\fR, \fB\-r\fR .sp @@ -1164,8 +1164,8 @@ command\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: shutdown-timeout option -.\" shutdown-timeout option: mysqladmin +.\" mariadb-admin: shutdown-timeout option +.\" shutdown-timeout option: mariadb-admin \fB\-\-shutdown\-timeout\fR\fB\fItimeout\fR\fR .sp Equivalent of \fB\-\-shutdown_timeout\fR, see the end of this section\&. @@ -1179,8 +1179,8 @@ Equivalent of \fB\-\-shutdown_timeout\fR, see the end of this section\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: silent option -.\" silent option: mysqladmin +.\" mariadb-admin: silent option +.\" silent option: mariadb-admin \fB\-\-silent\fR, \fB\-s\fR .sp @@ -1195,8 +1195,8 @@ Exit silently if a connection to the server cannot be established\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: sleep option -.\" sleep option: mysqladmin +.\" mariadb-admin: sleep option +.\" sleep option: mariadb-admin \fB\-\-sleep=\fR\fB\fIdelay\fR\fR, \fB\-i \fR\fB\fIdelay\fR\fR .sp @@ -1207,7 +1207,7 @@ seconds in between\&. The option determines the number of iterations\&. If \fB\-\-count\fR is not given, -\fBmysqladmin\fR +\fBmariadb-admin\fR executes commands indefinitely until interrupted\&. .RE .sp @@ -1219,8 +1219,8 @@ executes commands indefinitely until interrupted\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: socket option -.\" socket option: mysqladmin +.\" mariadb-admin: socket option +.\" socket option: mariadb-admin \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -1237,8 +1237,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-admin: SSL options +.\" SSL options: mariadb-admin \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -1253,8 +1253,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-admin: SSL CA option +.\" SSL CA option: mariadb-admin \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -1269,8 +1269,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-admin: SSL CA Path option +.\" SSL CA Path option: mariadb-admin \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1285,8 +1285,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-admin: SSL Cert option +.\" SSL Cert option: mariadb-admin \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1301,8 +1301,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-admin: SSL Cipher option +.\" SSL Cipher option: mariadb-admin \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1317,8 +1317,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-admin: SSL Key option +.\" SSL Key option: mariadb-admin \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1333,8 +1333,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-admin: SSL Crl option +.\" SSL CRL option: mariadb-admin \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1349,8 +1349,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-admin: SSL Crlpath option +.\" SSL Crlpath option: mariadb-admin \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1365,8 +1365,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-admin: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-admin \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1380,8 +1380,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: TLS Version option -.\" TLS Version option: mysqladmin +.\" mariadb-admin: TLS Version option +.\" TLS Version option: mariadb-admin \fB\-\-tls\-version=\fR\fB\fIname\fR\fR, .sp Accepts a comma-separated list of TLS protocol versions\&. A TLS protocol version will only be enabled if it @@ -1396,8 +1396,8 @@ is present in this list\&. All other TLS protocol versions will not be permitted .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: user option -.\" user option: mysqladmin +.\" mariadb-admin: user option +.\" user option: mariadb-admin \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1412,8 +1412,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: verbose option -.\" verbose option: mysqladmin +.\" mariadb-admin: verbose option +.\" verbose option: mariadb-admin \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1428,8 +1428,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: version option -.\" version option: mysqladmin +.\" mariadb-admin: version option +.\" version option: mariadb-admin \fB\-\-version\fR, \fB\-V\fR .sp @@ -1444,8 +1444,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: vertical option -.\" vertical option: mysqladmin +.\" mariadb-admin: vertical option +.\" vertical option: mariadb-admin \fB\-\-vertical\fR, \fB\-E\fR .sp @@ -1461,8 +1461,8 @@ Print output vertically\&. This is similar to .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: wait option -.\" wait option: mysqladmin +.\" mariadb-admin: wait option +.\" wait option: mariadb-admin \fB\-\-wait[=\fR\fB\fIcount\fR\fR\fB]\fR, \fB\-w[\fR\fB\fIcount\fR\fR\fB]\fR .sp @@ -1479,8 +1479,8 @@ value is given, it indicates the number of times to retry\&. The default is one .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: --wait-for-all-slaves option -.\" --wait-for-all-slaves option: mysqladmin +.\" mariadb-admin: --wait-for-all-slaves option +.\" --wait-for-all-slaves option: mariadb-admin \fB\-\-wait\-for\-all\-slaves\fR .sp Wait for the last binlog event to be sent to all connected slaves before shutting down\&. @@ -1522,7 +1522,7 @@ The maximum number of seconds to wait for server shutdown\&. The default value i .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-backup.1 b/man/mariadb-backup.1 index 705234fe67b..fc7c4d6552a 100644 --- a/man/mariadb-backup.1 +++ b/man/mariadb-backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-binlog.1 b/man/mariadb-binlog.1 index 7103fa22f2b..ba03372f046 100644 --- a/man/mariadb-binlog.1 +++ b/man/mariadb-binlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-BINLOG\fR" "1" "14 April 2021" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-BINLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,31 +11,31 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlbinlog +.\" mariadb-binlog .SH "NAME" -mariadb-binlog \- utility for processing binary log files (mysqlbinlog is now a symlink to mariadb-binlog) +mariadb-binlog \- utility for processing binary log files (mariadb-binlog is now a symlink to mariadb-binlog) .SH "SYNOPSIS" -.HP \w'\fBmysqlbinlog\ [\fR\fBoptions\fR\fB]\ \fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u -\fBmysqlbinlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR +.HP \w'\fBmariadb-binlog\ [\fR\fBoptions\fR\fB]\ \fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u +\fBmariadb-binlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP The server's binary log consists of files containing \(lqevents\(rq that describe modifications to database contents\&. The server writes these files in binary format\&. To display their contents in text format, use the -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR utility\&. You can also use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to display the contents of relay log files written by a slave server in a replication setup because relay logs have the same format as binary logs\&. .PP Invoke -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-binlog [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR .fi .if n \{\ .RE @@ -48,7 +48,7 @@ binlog\&.000003, use this command: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.0000003\fR +shell> \fBmariadb-binlog binlog\&.0000003\fR .fi .if n \{\ .RE @@ -90,12 +90,12 @@ error_code indicates the result from executing the event\&. Zero means that no error occurred\&. .PP The output from -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR can be re\-executed (for example, by using it as input to -\fBmysql\fR) to redo the statements in the log\&. This is useful for recovery operations after a server crash\&. For other usage examples, see the discussion later in this section\&. +\fBmariadb\fR) to redo the statements in the log\&. This is useful for recovery operations after a server crash\&. For other usage examples, see the discussion later in this section\&. .PP Normally, you use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to read binary log files directly and apply them to the local MariaDB server\&. It is also possible to read binary logs from a remote server by using the \fB\-\-read\-from\-remote\-server\fR option\&. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server\&. These options are @@ -108,9 +108,9 @@ option\&. To read remote binary logs, the connection parameter options can be gi \fB\-\-read\-from\-remote\-server\fR option\&. .PP -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR supports the following options, which can be specified on the command line or in the -[mysqlbinlog] +[mariadb-binlog] and [client] option file groups\&. @@ -123,8 +123,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: help option -.\" help option: mysqlbinlog +.\" mariadb-binlog: help option +.\" help option: mariadb-binlog \fB\-\-help\fR, \fB\-?\fR .sp @@ -139,8 +139,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: base64-output option -.\" base64-output option: mysqlbinlog +.\" mariadb-binlog: base64-output option +.\" base64-output option: mariadb-binlog \fB\-\-base64\-output=\fR\fB\fIvalue\fR\fR\fB\fR .sp This option determines when events should be displayed encoded as base\-64 strings using @@ -178,7 +178,7 @@ option is given\&. Automatic BINLOG display is the only safe behavior if you intend to use the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to re\-execute binary log file contents\&. The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form\&. .sp .5v .RE @@ -196,7 +196,7 @@ NEVER causes BINLOG statements not to be displayed\&. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR exits with an error if a row event is found that must be displayed using BINLOG\&. .RE @@ -211,7 +211,7 @@ BINLOG\&. .\} DECODE\-ROWS specifies to -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR that you intend for row events to be decoded and displayed as commented SQL statements by also specifying the \fB\-\-verbose\fR option\&. Like @@ -239,7 +239,7 @@ For examples that show the effect of and \fB\-\-verbose\fR on row event output, see -the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. +the section called \(lqMARIADB-BINLOG ROW EVENT DISPLAY\(rq\&. .RE .RE .sp @@ -251,8 +251,8 @@ the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: binlog-row-event-max-size option -.\" binlog-row-event-max-size option: mysqlbinlog +.\" mariadb-binlog: binlog-row-event-max-size option +.\" binlog-row-event-max-size option: mariadb-binlog \fB\-\-binlog\-row\-event\-max\-size\=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -266,8 +266,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: character-sets-dir option -.\" character-sets-dir option: mysqlbinlog +.\" mariadb-binlog: character-sets-dir option +.\" character-sets-dir option: mariadb-binlog \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -281,13 +281,13 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: database option -.\" database option: mysqlbinlog +.\" mariadb-binlog: database option +.\" database option: mariadb-binlog \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-d \fR\fB\fIdb_name\fR\fR .sp This option causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to output entries from the binary log (local log only) that occur while \fIdb_name\fR has been selected as the default database by @@ -296,11 +296,11 @@ USE\&. The \fB\-\-database\fR option for -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR is similar to the \fB\-\-binlog\-do\-db\fR option for -\fBmysqld\fR, but can be used to specify only one database\&. If +\fBmariadbd\fR, but can be used to specify only one database\&. If \fB\-\-database\fR is given multiple times, only the last instance is used\&. .sp @@ -378,7 +378,7 @@ INSERT INTO t2 (j) VALUES(203); .RE .\} .sp -\fBmysqlbinlog \-\-database=test\fR +\fBmariadb-binlog \-\-database=test\fR does not output the first two INSERT statements because there is no default database\&. It outputs the three @@ -389,7 +389,7 @@ INSERT statements following USE db2\&. .sp -\fBmysqlbinlog \-\-database=db2\fR +\fBmariadb-binlog \-\-database=db2\fR does not output the first two INSERT statements because there is no default database\&. It does not output the three @@ -401,10 +401,10 @@ statements following USE db2\&. .PP \fBRow-based logging\fR. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR outputs only entries that change tables belonging to \fIdb_name\fR\&. The default database has no effect on this\&. Suppose that the binary log just described was created using row\-based logging rather than statement\-based logging\&. -\fBmysqlbinlog \-\-database=test\fR +\fBmariadb-binlog \-\-database=test\fR outputs only those entries that modify t1 in the test database, regardless of whether @@ -415,7 +415,7 @@ binlog_format set to MIXED and you want it to be possible to use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with the \fB\-\-database\fR option, you must ensure that tables that are modified are in the database selected by @@ -433,7 +433,7 @@ USE\&. (In particular, no cross\-database updates should be used\&.) .ps -1 .br This option did not work correctly for -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with row\-based logging prior to MySQL 5\&.1\&.37\&. .sp .5v .RE @@ -448,14 +448,14 @@ with row\-based logging prior to MySQL 5\&.1\&.37\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug option -.\" debug option: mysqlbinlog +.\" mariadb-binlog: debug option +.\" debug option: mariadb-binlog \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlbinlog.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-binlog.trace'. .RE .sp .RS 4 @@ -466,8 +466,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlbinlog.trace' .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug-check option -.\" debug-check option: mysqlbinlog +.\" mariadb-binlog: debug-check option +.\" debug-check option: mariadb-binlog \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -481,8 +481,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug-info option -.\" debug-info option: mysqlbinlog +.\" mariadb-binlog: debug-info option +.\" debug-info option: mariadb-binlog \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -496,8 +496,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: defaults-extra-file option -.\" defaults-extra-file option: mysqlbinlog +.\" mariadb-binlog: defaults-extra-file option +.\" defaults-extra-file option: mariadb-binlog \fB\-\-defaults\-extra\-file=\fR\fB\fIname\fR .sp Read this file after the global files are read\&. @@ -511,8 +511,8 @@ Read this file after the global files are read\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: defaults-file option -.\" defaults-file option: mysqlbinlog +.\" mariadb-binlog: defaults-file option +.\" defaults-file option: mariadb-binlog \fB\-\-defaults\-file=\fR\fB\fIname\fR .sp Only read default options from the given file\&. @@ -526,8 +526,8 @@ Only read default options from the given file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: default-auth option -.\" default-auth option: mysqlbinlog +.\" mariadb-binlog: default-auth option +.\" default-auth option: mariadb-binlog \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -541,8 +541,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: disable-log-bin option -.\" disable-log-bin option: mysqlbinlog +.\" mariadb-binlog: disable-log-bin option +.\" disable-log-bin option: mariadb-binlog \fB\-\-disable\-log\-bin\fR, \fB\-D\fR .sp @@ -553,7 +553,7 @@ option and are sending the output to the same MariaDB server\&. This option also This option requires that you have the SUPER privilege\&. It causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to include a SET sql_log_bin = 0 statement in its output to disable binary logging of the remaining output\&. The @@ -571,8 +571,8 @@ privilege\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: flashback option -.\" flashback option: mysqlbinlog +.\" mariadb-binlog: flashback option +.\" flashback option: mariadb-binlog \fB\-\-flashback\fR, \fB\-B\fR .sp @@ -587,8 +587,8 @@ Support flashback mode\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: force-if-open option -.\" force-if-open option: mysqlbinlog +.\" mariadb-binlog: force-if-open option +.\" force-if-open option: mariadb-binlog \fB\-\-force\-if\-open\fR .sp Force if binlog was not closed properly. Defaults to on; use \fB--skip-force-if-open\fR to disable\&. @@ -602,15 +602,15 @@ Force if binlog was not closed properly. Defaults to on; use \fB--skip-force-if- .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: force-read option -.\" force-read option: mysqlbinlog +.\" mariadb-binlog: force-read option +.\" force-read option: mariadb-binlog \fB\-\-force\-read\fR, \fB\-f\fR .sp With this option, if -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues\&. Without this option, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR stops if it reads such an event\&. .RE .sp @@ -622,13 +622,13 @@ stops if it reads such an event\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: hexdump option -.\" hexdump option: mysqlbinlog +.\" mariadb-binlog: hexdump option +.\" hexdump option: mariadb-binlog \fB\-\-hexdump\fR, \fB\-H\fR .sp Display a hex dump of the log in comments, as described in -the section called \(lqMYSQLBINLOG HEX DUMP FORMAT\(rq\&. The hex output can be helpful for replication debugging\&. +the section called \(lqMARIADB-BINLOG HEX DUMP FORMAT\(rq\&. The hex output can be helpful for replication debugging\&. .RE .sp .RS 4 @@ -639,8 +639,8 @@ the section called \(lqMYSQLBINLOG HEX DUMP FORMAT\(rq\&. The hex output can be .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: host option -.\" host option: mysqlbinlog +.\" mariadb-binlog: host option +.\" host option: mariadb-binlog \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -655,8 +655,8 @@ Get the binary log from the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: local-load option -.\" local-load option: mysqlbinlog +.\" mariadb-binlog: local-load option +.\" local-load option: mariadb-binlog \fB\-\-local\-load=\fR\fB\fIpath\fR\fR, \fB\-l \fR\fB\fIpath\fR\fR .sp @@ -673,8 +673,8 @@ in the specified directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: no-defaults option -.\" no-defaults option: mysqlbinlog +.\" mariadb-binlog: no-defaults option +.\" no-defaults option: mariadb-binlog \fB\-\-no\-defaults\fR .sp Don't read default options from any option file\&. @@ -688,8 +688,8 @@ Don't read default options from any option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: offset option -.\" offset option: mysqlbinlog +.\" mariadb-binlog: offset option +.\" offset option: mariadb-binlog \fB\-\-offset=\fR\fB\fIN\fR\fR, \fB\-o \fR\fB\fIN\fR\fR .sp @@ -706,12 +706,12 @@ entries in the log\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: open-files-limit option -.\" open-files-limit option: mysqlbinlog +.\" mariadb-binlog: open-files-limit option +.\" open-files-limit option: mariadb-binlog \fB\-\-open\-files\-limit=\fR\fB\fINUM\fR\fR .sp Sets the open_files_limit variable, which is used to reserve file descriptors for -\fBmysqlbinlog\fR\&. +\fBmariadb-binlog\fR\&. .RE .sp .RS 4 @@ -722,8 +722,8 @@ Sets the open_files_limit variable, which is used to reserve file descriptors fo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: password option -.\" password option: mysqlbinlog +.\" mariadb-binlog: password option +.\" password option: mariadb-binlog \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -736,7 +736,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You @@ -751,8 +751,8 @@ can use an option file to avoid giving the password on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: plugin-dir option -.\" plugin-dir option: mysqlbinlog +.\" mariadb-binlog: plugin-dir option +.\" plugin-dir option: mariadb-binlog \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -766,8 +766,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: print-defaults option -.\" print-defaults option: mysqlbinlog +.\" mariadb-binlog: print-defaults option +.\" print-defaults option: mariadb-binlog \fB\-\-print\-defaults\fR .sp Print the program argument list from all option files and exit\&. @@ -781,8 +781,8 @@ Print the program argument list from all option files and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: port option -.\" port option: mysqlbinlog +.\" mariadb-binlog: port option +.\" port option: mariadb-binlog \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -800,8 +800,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: protocol option -.\" protocol option: mysqlbinlog +.\" mariadb-binlog: protocol option +.\" protocol option: mariadb-binlog \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -815,8 +815,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: raw option -.\" raw option: mysqlbinlog +.\" mariadb-binlog: raw option +.\" raw option: mariadb-binlog \fB\-\-raw\fR .sp Requires \fB-R\fR\&. Output raw binlog data instead of SQL statements\&. Output files named after server logs\&. @@ -830,8 +830,8 @@ Requires \fB-R\fR\&. Output raw binlog data instead of SQL statements\&. Output .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: read-from-remote-server option -.\" read-from-remote-server option: mysqlbinlog +.\" mariadb-binlog: read-from-remote-server option +.\" read-from-remote-server option: mariadb-binlog \fB\-\-read\-from\-remote\-server\fR, \fB\-R\fR .sp @@ -854,8 +854,8 @@ This option requires that the remote server be running\&. It works only for bina .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: result-file option -.\" result-file option: mysqlbinlog +.\" mariadb-binlog: result-file option +.\" result-file option: mariadb-binlog \fB\-\-result\-file=\fR\fB\fIname\fR\fR, \fB\-r \fR\fB\fIname\fR\fR .sp @@ -870,8 +870,8 @@ Direct output to the given file\&. With --raw this is a prefix for the file name .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: rewrite-db option -.\" rewrite-db option: mysqlbinlog +.\" mariadb-binlog: rewrite-db option +.\" rewrite-db option: mariadb-binlog \fB\-\-rewrite\-db=\fR\fB\fIname\fR\fR, \fB\-r \fR\fB\fIname\fR\fR .sp @@ -896,8 +896,8 @@ quote the value (e.g. \fB--rewrite-db="oldname->newname"\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: server-id option -.\" server-id option: mysqlbinlog +.\" mariadb-binlog: server-id option +.\" server-id option: mariadb-binlog \fB\-\-server\-id=\fR\fB\fIid\fR\fR .sp Display only those events created by the server having the given server ID\&. @@ -911,8 +911,8 @@ Display only those events created by the server having the given server ID\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: set-charset option -.\" set-charset option: mysqlbinlog +.\" mariadb-binlog: set-charset option +.\" set-charset option: mariadb-binlog \fB\-\-set\-charset=\fR\fB\fIcharset_name\fR\fR .sp Add a @@ -928,8 +928,8 @@ statement to the output to specify the character set to be used for processing l .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: short-form option -.\" short-form option: mysqlbinlog +.\" mariadb-binlog: short-form option +.\" short-form option: mariadb-binlog \fB\-\-short\-form\fR, \fB\-s\fR .sp @@ -947,8 +947,8 @@ base64-output, consider using \fB--base64-output=never\fR instead\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: socket option -.\" socket option: mysqlbinlog +.\" mariadb-binlog: socket option +.\" socket option: mariadb-binlog \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -965,8 +965,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: start-datetime option -.\" start-datetime option: mysqlbinlog +.\" mariadb-binlog: start-datetime option +.\" start-datetime option: mariadb-binlog \fB\-\-start\-datetime=\fR\fB\fIdatetime\fR\fR .sp Start reading the binary log at the first event having a timestamp equal to or later than the @@ -974,7 +974,7 @@ Start reading the binary log at the first event having a timestamp equal to or l argument\&. The \fIdatetime\fR value is relative to the local time zone on the machine where you run -\fBmysqlbinlog\fR\&. The value should be in a format accepted for the +\fBmariadb-binlog\fR\&. The value should be in a format accepted for the DATETIME or TIMESTAMP @@ -984,7 +984,7 @@ data types\&. For example: .RS 4 .\} .nf -shell> \fBmysqlbinlog \-\-start\-datetime="2014\-12\-25 11:25:56" binlog\&.000003\fR +shell> \fBmariadb-binlog \-\-start\-datetime="2014\-12\-25 11:25:56" binlog\&.000003\fR .fi .if n \{\ .RE @@ -1001,8 +1001,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: start-position option -.\" start-position option: mysqlbinlog +.\" mariadb-binlog: start-position option +.\" start-position option: mariadb-binlog \fB\-\-start\-position=\fR\fB\fIN\fR\fR, \fB\-j \fR\fB\fIN\fR\fR .sp @@ -1027,8 +1027,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: gtid-strict-mode -.\" gtid-strict-mode option: mysqlbinlog +.\" mariadb-binlog: gtid-strict-mode +.\" gtid-strict-mode option: mariadb-binlog \fB\-\-gtid\-strict\-mode .sp Process binlog according to gtid-strict-mode specification\&. The start, stop @@ -1044,8 +1044,8 @@ numbers of any gtid domain must comprise monotically growing sequence\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-datetime option -.\" stop-datetime option: mysqlbinlog +.\" mariadb-binlog: stop-datetime option +.\" stop-datetime option: mariadb-binlog \fB\-\-stop\-datetime=\fR\fB\fIdatetime\fR\fR .sp Stop reading the binary log at the first event having a timestamp equal to or later than the @@ -1067,8 +1067,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-never option -.\" stop-never option: mysqlbinlog +.\" mariadb-binlog: stop-never option +.\" stop-never option: mariadb-binlog \fB\-\-stop\-never\fR .sp Wait for more data from the server instead of stopping at the end of the last log\&. Implies \fB--to-last-log\fR\&. @@ -1082,8 +1082,8 @@ Wait for more data from the server instead of stopping at the end of the last lo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-never-slave-server-id option -.\" stop-never-slave-server-id option: mysqlbinlog +.\" mariadb-binlog: stop-never-slave-server-id option +.\" stop-never-slave-server-id option: mariadb-binlog \fB\-\-stop\-never-slave-server-id\fR .sp The slave server_id used for \fB--read-from-remote-server --stop-never\fR\&. @@ -1097,8 +1097,8 @@ The slave server_id used for \fB--read-from-remote-server --stop-never\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-position option -.\" stop-position option: mysqlbinlog +.\" mariadb-binlog: stop-position option +.\" stop-position option: mariadb-binlog \fB\-\-stop\-position=\fR\fB\fIN\fR\fR .sp Stop reading the binary log at the first event having a position equal to or @@ -1120,8 +1120,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: table option -.\" table option: mysqlbinlog +.\" mariadb-binlog: table option +.\" table option: mariadb-binlog \fB\-\-table\fR, \fB\-T\fR .sp @@ -1137,8 +1137,8 @@ List entries for just this table (local log only)\&. .IP \(bu 2.3 .\} -.\" mysqlbinlog: to-last-log option -.\" to-last-log option: mysqlbinlog +.\" mariadb-binlog: to-last-log option +.\" to-last-log option: mariadb-binlog \fB\-\-to\-last\-log\fR, \fB\-t\fR .sp @@ -1154,8 +1154,8 @@ Do not stop at the end of the requested binary log from a MariaDB server, but ra .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: user option -.\" user option: mysqlbinlog +.\" mariadb-binlog: user option +.\" user option: mariadb-binlog \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1170,8 +1170,8 @@ The MariaDB username to use when connecting to a remote server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: verbose option -.\" verbose option: mysqlbinlog +.\" mariadb-binlog: verbose option +.\" verbose option: mariadb-binlog \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1183,7 +1183,7 @@ For examples that show the effect of and \fB\-\-verbose\fR on row event output, see -the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. +the section called \(lqMARIADB-BINLOG ROW EVENT DISPLAY\(rq\&. .RE .sp .RS 4 @@ -1194,8 +1194,8 @@ the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: version option -.\" version option: mysqlbinlog +.\" mariadb-binlog: version option +.\" version option: mariadb-binlog \fB\-\-version\fR, \fB\-V\fR .sp @@ -1221,9 +1221,9 @@ Specify the number of open file descriptors to reserve\&. .RE .PP You can pipe the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR into the -\fBmysql\fR +\fBmariadb\fR client to execute the events contained in the binary log\&. This technique is used to recover from a crash when you have an old backup\&. For example: .sp @@ -1231,7 +1231,7 @@ backup\&. For example: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.000001 | mariadb \-u root \-p\fR .fi .if n \{\ .RE @@ -1243,32 +1243,32 @@ Or: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.[0\-9]* | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.[0\-9]* | mariadb \-u root \-p\fR .fi .if n \{\ .RE .\} .PP You can also redirect the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to a text file instead, if you need to modify the statement log first (for example, to remove statements that you do not want to execute for some reason)\&. After editing the file, execute the statements that it contains by using it as input to the -\fBmysql\fR +\fBmariadb\fR program: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 > tmpfile\fR +shell> \fBmariadb-binlog binlog\&.000001 > tmpfile\fR shell> \&.\&.\&. \fIedit tmpfile\fR \&.\&.\&. -shell> \fBmysql \-u root \-p < tmpfile\fR +shell> \fBmariadb \-u root \-p < tmpfile\fR .fi .if n \{\ .RE .\} .PP When -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR is invoked with the \fB\-\-start\-position\fR option, it displays only those events with an offset in the binary log greater than or equal to a given position (the given position must match the start of one event)\&. It also has options to stop and start when it sees an event with a given date and time\&. This enables you to perform point\-in\-time recovery using the @@ -1283,8 +1283,8 @@ If you have more than one binary log to execute on the MariaDB server, the safe .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 | mysql \-u root \-p # DANGER!!\fR -shell> \fBmysqlbinlog binlog\&.000002 | mysql \-u root \-p # DANGER!!\fR +shell> \fBmariadb-binlog binlog\&.000001 | mariadb \-u root \-p # DANGER!!\fR +shell> \fBmariadb-binlog binlog\&.000002 | mariadb \-u root \-p # DANGER!!\fR .fi .if n \{\ .RE @@ -1293,22 +1293,22 @@ shell> \fBmysqlbinlog binlog\&.000002 | mysql \-u root \-p # DANGER!!\fR Processing binary logs this way using different connections to the server causes problems if the first log file contains a CREATE TEMPORARY TABLE statement and the second log contains a statement that uses the temporary table\&. When the first -\fBmysql\fR +\fBmariadb\fR process terminates, the server drops the temporary table\&. When the second -\fBmysql\fR +\fBmariadb\fR process attempts to use the table, the server reports \(lqunknown table\&.\(rq .PP To avoid problems like this, use a \fIsingle\fR -\fBmysql\fR +\fBmariadb\fR process to execute the contents of all binary logs that you want to process\&. Here is one way to do so: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 binlog\&.000002 | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.000001 binlog\&.000002 | mariadb \-u root \-p\fR .fi .if n \{\ .RE @@ -1320,19 +1320,19 @@ Another approach is to write all the logs to a single file and then process the .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 > /tmp/statements\&.sql\fR -shell> \fBmysqlbinlog binlog\&.000002 >> /tmp/statements\&.sql\fR -shell> \fBmysql \-u root \-p \-e "source /tmp/statements\&.sql"\fR +shell> \fBmariadb-binlog binlog\&.000001 > /tmp/statements\&.sql\fR +shell> \fBmariadb-binlog binlog\&.000002 >> /tmp/statements\&.sql\fR +shell> \fBmariadb \-u root \-p \-e "source /tmp/statements\&.sql"\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR can produce output that reproduces a LOAD DATA INFILE operation without the original data file\&. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR copies the data to a temporary file and writes a LOAD DATA LOCAL INFILE statement that refers to the file\&. The default location of the directory where these files are written is system\-specific\&. To specify a directory explicitly, use the @@ -1340,7 +1340,7 @@ statement that refers to the file\&. The default location of the directory where option\&. .PP Because -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR converts LOAD DATA INFILE statements to @@ -1370,19 +1370,19 @@ automatically deleted because they are needed until you actually execute those s \fIoriginal_file_name\-#\-#\fR\&. .sp .5v .RE -.SH "MYSQLBINLOG HEX DUMP FORMAT" +.SH "MARIADB-BINLOG HEX DUMP FORMAT" .PP The \fB\-\-hexdump\fR option causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to produce a hex dump of the binary log contents: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog \-\-hexdump master\-bin\&.000001\fR +shell> \fBmariadb-binlog \-\-hexdump master\-bin\&.000001\fR .fi .if n \{\ .RE @@ -1772,11 +1772,11 @@ T} .TE .sp 1 .RE -.SH "MYSQLBINLOG ROW EVENT DISPLAY" -.\" BINLOG statement: mysqlbinlog output +.SH "MARIADB-BINLOG ROW EVENT DISPLAY" +.\" BINLOG statement: mariadb-binlog output .PP The following examples illustrate how -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR displays row events that specify data modifications\&. These correspond to events with the WRITE_ROWS_EVENT, UPDATE_ROWS_EVENT, and @@ -1810,7 +1810,7 @@ COMMIT; .\} .PP By default, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR displays row events encoded as base\-64 strings using BINLOG statements\&. Omitting extraneous lines, the output for the row events produced by the preceding statement sequence looks like this: @@ -1819,7 +1819,7 @@ statements\&. Omitting extraneous lines, the output for the row events produced .RS 4 .\} .nf -shell> \fBmysqlbinlog \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1843,7 +1843,7 @@ fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; To see the row events as comments in the form of \(lqpseudo\-SQL\(rq statements, run -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with the \fB\-\-verbose\fR or @@ -1855,7 +1855,7 @@ option\&. The output will contain lines beginning with .RS 4 .\} .nf -shell> \fBmysqlbinlog \-v \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-v \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1905,7 +1905,7 @@ twice to also display data types and some metadata for each column\&. The output .RS 4 .\} .nf -shell> \fBmysqlbinlog \-vv \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-vv \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1946,7 +1946,7 @@ fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; .\} .PP You can tell -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to suppress the BINLOG statements for row events by using the @@ -1963,7 +1963,7 @@ provides a convenient way to see row events only as SQL statements: .RS 4 .\} .nf -shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -2013,7 +2013,7 @@ shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\f You should not suppress BINLOG statements if you intend to re\-execute -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR output\&. .sp .5v .RE @@ -2115,7 +2115,7 @@ clause\&. .RE .PP Proper interpretation of row events requires the information from the format description event at the beginning of the binary log\&. Because -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR does not know in advance whether the rest of the log contains row events, by default it displays the format description event using a BINLOG statement in the initial part of the output\&. @@ -2128,7 +2128,7 @@ option can be used to prevent this header from being written\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2021 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-check.1 b/man/mariadb-check.1 index 0b101ccb7d1..3a401bd4071 100644 --- a/man/mariadb-check.1 +++ b/man/mariadb-check.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CHECK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CHECK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,20 +11,20 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlcheck +.\" mariadb-check .\" maintenance: tables .\" repair: tables .\" tables: maintenance .\" tables: repair .SH "NAME" -mariadb-check \- a table maintenance program (mysqlcheck is now a symlink to mariadb-check) +mariadb-check \- a table maintenance program (mariadb-check is now a symlink to mariadb-check) .SH "SYNOPSIS" -.HP \w'\fBmysqlcheck\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u -\fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR +.HP \w'\fBmariadb-check\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u +\fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR .SH "DESCRIPTION" .PP The -\fBmysqlcheck\fR +\fBmariadb-check\fR client performs table maintenance: It checks, repairs, optimizes, or analyzes tables\&. .PP Each table is locked and therefore unavailable to other sessions while it is being processed, although for check operations, the table is locked with a @@ -34,26 +34,26 @@ lock only\&. Table maintenance operations can be time\-consuming, particularly f or \fB\-\-all\-databases\fR option to process all tables in one or more databases, an invocation of -\fBmysqlcheck\fR +\fBmariadb-check\fR might take a long time\&. (This is also true for -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR because that program invokes -\fBmysqlcheck\fR +\fBmariadb-check\fR to check all tables and repair them if necessary\&.) .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR is similar in function to \fBmyisamchk\fR, but works differently\&. The main operational difference is that -\fBmysqlcheck\fR +\fBmariadb-check\fR must be used when the -\fBmysqld\fR +\fBmariadbd\fR server is running, whereas \fBmyisamchk\fR should be used when it is not\&. The benefit of using -\fBmysqlcheck\fR +\fBmariadb-check\fR is that you do not have to stop the server to perform table maintenance\&. .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR uses the SQL statements CHECK TABLE, REPAIR TABLE, @@ -64,7 +64,7 @@ in a convenient way for the user\&. It determines which statements to use for th The MyISAM storage engine supports all four maintenance operations, so -\fBmysqlcheck\fR +\fBmariadb-check\fR can be used to perform any of them on MyISAM tables\&. Other storage engines do not necessarily support all operations\&. In such cases, an error message is displayed\&. For example, if @@ -77,7 +77,7 @@ table, an attempt to check it produces this result: .RS 4 .\} .nf -shell> \fBmysqlcheck test t\fR +shell> \fBmariadb-check test t\fR test\&.t note : The storage engine for the table doesn't support check .fi @@ -86,7 +86,7 @@ note : The storage engine for the table doesn't support check .\} .PP If -\fBmysqlcheck\fR +\fBmariadb-check\fR is unable to repair a table, see the MariaDB Knowledge Base for manual table repair strategies\&. This will be the case, for example, for InnoDB @@ -95,7 +95,7 @@ CHECK TABLE, but not repaired with REPAIR TABLE\&. .PP The use of -\fBmysqlcheck\fR +\fBmariadb-check\fR with partitioned tables is not supported\&. .if n \{\ .sp @@ -115,15 +115,15 @@ It is best to make a backup of a table before performing a table repair operatio .RE .PP There are three general ways to invoke -\fBmysqlcheck\fR: +\fBmariadb-check\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR .fi .if n \{\ .RE @@ -137,18 +137,18 @@ or \fB\-\-all\-databases\fR option, entire databases are checked\&. .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR has a special feature compared to other client programs\&. The default behavior of checking tables (\fB\-\-check\fR) can be changed by renaming the binary\&. If you want to have a tool that repairs tables by default, you should just make a copy of -\fBmysqlcheck\fR +\fBmariadb-check\fR named -\fBmysqlrepair\fR, or make a symbolic link to -\fBmysqlcheck\fR +\fBmariadb-repair\fR, or make a symbolic link to +\fBmariadb-check\fR named -\fBmysqlrepair\fR\&. If you invoke -\fBmysqlrepair\fR, it repairs tables\&. +\fBmariadb-repair\fR\&. If you invoke +\fBmariadb-repair\fR, it repairs tables\&. .PP The following names can be used to change -\fBmysqlcheck\fR +\fBmariadb-check\fR default behavior\&. .TS allbox tab(:); @@ -156,7 +156,7 @@ l l l l l l. T{ -\fBmysqlrepair\fR +\fBmariadb-repair\fR T}:T{ The default option is \fB\-\-repair\fR T} @@ -173,9 +173,9 @@ T} .TE .sp 1 .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR supports the following options, which can be specified on the command line or in the -[mysqlcheck] +[mariadb-check] and [client] option file groups\&. @@ -189,8 +189,8 @@ The \fB-c\fR, \fB-r\fR, \fB-a\fR and \fB-o\fR options are exclusive to each othe .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: help option -.\" help option: mysqlcheck +.\" mariadb-check: help option +.\" help option: mariadb-check \fB\-\-help\fR, \fB\-?\fR .sp @@ -205,8 +205,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: all-databases option -.\" all-databases option: mysqlcheck +.\" mariadb-check: all-databases option +.\" all-databases option: mariadb-check \fB\-\-all\-databases\fR, \fB\-A\fR .sp @@ -223,8 +223,8 @@ option and naming all the databases on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: all-in-1 option -.\" all-in-1 option: mysqlcheck +.\" mariadb-check: all-in-1 option +.\" all-in-1 option: mariadb-check \fB\-\-all\-in\-1\fR, \fB\-1\fR .sp @@ -239,8 +239,8 @@ Instead of issuing a statement for each table, execute a single statement for ea .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: analyze option -.\" analyze option: mysqlcheck +.\" mariadb-check: analyze option +.\" analyze option: mariadb-check \fB\-\-analyze\fR, \fB\-a\fR .sp @@ -255,8 +255,8 @@ Analyze the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: auto-repair option -.\" auto-repair option: mysqlcheck +.\" mariadb-check: auto-repair option +.\" auto-repair option: mariadb-check \fB\-\-auto\-repair\fR .sp If a checked table is corrupted, automatically fix it\&. Any necessary repairs are done after all tables have been checked\&. @@ -270,8 +270,8 @@ If a checked table is corrupted, automatically fix it\&. Any necessary repairs a .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: character-sets-dir option -.\" character-sets-dir option: mysqlcheck +.\" mariadb-check: character-sets-dir option +.\" character-sets-dir option: mariadb-check \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -285,8 +285,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check option -.\" check option: mysqlcheck +.\" mariadb-check: check option +.\" check option: mariadb-check \fB\-\-check\fR, \fB\-c\fR .sp @@ -301,8 +301,8 @@ Check the tables for errors\&. This is the default operation\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check-only-changed option -.\" check-only-changed option: mysqlcheck +.\" mariadb-check: check-only-changed option +.\" check-only-changed option: mariadb-check \fB\-\-check\-only\-changed\fR, \fB\-C\fR .sp @@ -317,8 +317,8 @@ Check only tables that have changed since the last check or that have not been c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check-upgrade option -.\" check-upgrade option: mysqlcheck +.\" mariadb-check: check-upgrade option +.\" check-upgrade option: mariadb-check \fB\-\-check\-upgrade\fR, \fB\-g\fR .sp @@ -341,8 +341,8 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: compress option -.\" compress option: mysqlcheck +.\" mariadb-check: compress option +.\" compress option: mariadb-check \fB\-\-compress\fR .sp Compress all information sent between the client and the server if both support compression\&. @@ -356,13 +356,13 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: databases option -.\" databases option: mysqlcheck +.\" mariadb-check: databases option +.\" databases option: mariadb-check \fB\-\-databases\fR, \fB\-B\fR .sp Process all tables in the named databases\&. Normally, -\fBmysqlcheck\fR +\fBmariadb-check\fR treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&. .RE .sp @@ -374,8 +374,8 @@ treats the first name argument on the command line as a database name and follow .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug option -.\" debug option: mysqlcheck +.\" mariadb-check: debug option +.\" debug option: mariadb-check \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -392,8 +392,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug-check option -.\" debug-check option: mysqlcheck +.\" mariadb-check: debug-check option +.\" debug-check option: mariadb-check \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -407,8 +407,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug-info option -.\" debug-info option: mysqlcheck +.\" mariadb-check: debug-info option +.\" debug-info option: mariadb-check \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -422,8 +422,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: default-auth option -.\" default-auth option: mysqlcheck +.\" mariadb-check: default-auth option +.\" default-auth option: mariadb-check \fB\-\-default\-auth=\fR\fB\fIname\fR\fR .sp Default authentication client-side plugin to use\&. @@ -437,8 +437,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: default-character-set option -.\" default-character-set option: mysqlcheck +.\" mariadb-check: default-character-set option +.\" default-character-set option: mariadb-check \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -454,8 +454,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-extra-file option -.\" defaults-extra-file option: mysqlcheck +.\" mariadb-check: defaults-extra-file option +.\" defaults-extra-file option: mariadb-check \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -470,8 +470,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-file option -.\" defaults-file option: mysqlcheck +.\" mariadb-check: defaults-file option +.\" defaults-file option: mariadb-check \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -486,8 +486,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: extended option -.\" extended option: mysqlcheck +.\" mariadb-check: extended option +.\" extended option: mariadb-check \fB\-\-extended\fR, \fB\-e\fR .sp @@ -505,8 +505,8 @@ instead of the much faster repair by sorting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fast option -.\" fast option: mysqlcheck +.\" mariadb-check: fast option +.\" fast option: mariadb-check \fB\-\-fast\fR, \fB\-F\fR .sp @@ -521,8 +521,8 @@ Check only tables that have not been closed properly\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fix-db-names option -.\" fix-db-names option: mysqlcheck +.\" mariadb-check: fix-db-names option +.\" fix-db-names option: mariadb-check \fB\-\-fix\-db\-names\fR .sp Convert database names to the format used since MySQL 5\&.1\&. Only database names that contain special characters are affected\&. @@ -536,8 +536,8 @@ Convert database names to the format used since MySQL 5\&.1\&. Only database nam .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fix-table-names option -.\" fix-table-names option: mysqlcheck +.\" mariadb-check: fix-table-names option +.\" fix-table-names option: mariadb-check \fB\-\-fix\-table\-names\fR .sp Convert table names (including views) to the format used since MySQL 5\&.1\&. Only table names that contain special characters are affected\&. @@ -551,8 +551,8 @@ Convert table names (including views) to the format used since MySQL 5\&.1\&. On .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: flush option -.\" flush option: mysqlcheck +.\" mariadb-check: flush option +.\" flush option: mariadb-check \fB\-\-flush\fR, .sp Flush each table after check. This is useful if you don't @@ -567,8 +567,8 @@ want to have the checked tables take up space in the caches after the check\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: force option -.\" force option: mysqlcheck +.\" mariadb-check: force option +.\" force option: mariadb-check \fB\-\-force\fR, \fB\-f\fR .sp @@ -583,8 +583,8 @@ Continue even if an SQL error occurs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: host option -.\" host option: mysqlcheck +.\" mariadb-check: host option +.\" host option: mariadb-check \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -599,8 +599,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: medium-check option -.\" medium-check option: mysqlcheck +.\" mariadb-check: medium-check option +.\" medium-check option: mariadb-check \fB\-\-medium\-check\fR, \fB\-m\fR .sp @@ -617,8 +617,8 @@ operation\&. This finds only 99\&.99% of all errors, which should be good enough .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: no-defaults option -.\" no-defaults option: mysqlcheck +.\" mariadb-check: no-defaults option +.\" no-defaults option: mariadb-check \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -632,8 +632,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: optimize option -.\" optimize option: mysqlcheck +.\" mariadb-check: optimize option +.\" optimize option: mariadb-check \fB\-\-optimize\fR, \fB\-o\fR .sp @@ -648,8 +648,8 @@ Optimize the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: password option -.\" password option: mysqlcheck +.\" mariadb-check: password option +.\" password option: mariadb-check \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -662,7 +662,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlcheck\fR +\fBmariadb-check\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -676,8 +676,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: persisent option -.\" persistent option: mysql +.\" mariadb-check: persisent option +.\" persistent option: mariadb-check \fB\-\-persistent\fR, \fB\-Z\fR .sp @@ -692,8 +692,8 @@ Used with ANALYZE TABLE to append the option PERSISENT FOR ALL. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: pipe option -.\" pipe option: mysql +.\" mariadb-check: pipe option +.\" pipe option: mariadb-check \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -708,8 +708,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: plugin-dir option -.\" plugin-dir option: mysqlcheck +.\" mariadb-check: plugin-dir option +.\" plugin-dir option: mariadb-check \fB\-\-plugin\-dir=\fR\fB\fIname\fR\fR .sp Directory for client-side plugins\&. @@ -723,8 +723,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: port option -.\" port option: mysqlcheck +.\" mariadb-check: port option +.\" port option: mariadb-check \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -740,8 +740,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: print-defaults option -.\" print-defaults option: mysqlcheck +.\" mariadb-check: print-defaults option +.\" print-defaults option: mariadb-check \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -756,8 +756,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: process-tables option -.\" process-tables option: mysqlcheck +.\" mariadb-check: process-tables option +.\" process-tables option: mariadb-check \fB\-\-process\-tables\fR .sp Perform the requested operation on tables. Defaults to on; use \fB--skip-process-tables\fR to disable\&. @@ -771,8 +771,8 @@ Perform the requested operation on tables. Defaults to on; use \fB--skip-process .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: process-views option -.\" process-views option: mysqlcheck +.\" mariadb-check: process-views option +.\" process-views option: mariadb-check \fB\-\-process\-views=\fB\fIval\fR .sp Perform the requested operation (only CHECK VIEW or REPAIR VIEW). Possible values are NO, YES (correct the checksum, if necessary, add the mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle the algorithm MERGE<->TEMPTABLE\&. @@ -786,8 +786,8 @@ Perform the requested operation (only CHECK VIEW or REPAIR VIEW). Possible value .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: protocol option -.\" protocol option: mysqlcheck +.\" mariadb-check: protocol option +.\" protocol option: mariadb-check \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -801,8 +801,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: quick option -.\" quick option: mysqlcheck +.\" mariadb-check: quick option +.\" quick option: mariadb-check \fB\-\-quick\fR, \fB\-q\fR .sp @@ -819,8 +819,8 @@ If you are using this option to repair tables, it tries to repair only the index .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: repair option -.\" repair option: mysqlcheck +.\" mariadb-check: repair option +.\" repair option: mariadb-check \fB\-\-repair\fR, \fB\-r\fR .sp @@ -835,8 +835,8 @@ Perform a repair that can fix almost anything except unique keys that are not un .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: silent option -.\" silent option: mysqlcheck +.\" mariadb-check: silent option +.\" silent option: mariadb-check \fB\-\-silent\fR, \fB\-s\fR .sp @@ -851,8 +851,8 @@ Silent mode\&. Print only error messages\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: skip-database option -.\" skip-database option: mysqlcheck +.\" mariadb-check: skip-database option +.\" skip-database option: mariadb-check \fB\-\-skip\-database=\fB\fIdb_name\fR .sp Don't process the database (case-sensitive) specified as argument\&. @@ -866,8 +866,8 @@ Don't process the database (case-sensitive) specified as argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: socket option -.\" socket option: mysqlcheck +.\" mariadb-check: socket option +.\" socket option: mariadb-check \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -884,8 +884,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-check: SSL options +.\" SSL options: mariadb-check \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -900,8 +900,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-check: SSL CA option +.\" SSL CA option: mariadb-check \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -916,8 +916,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-check: SSL CA Path option +.\" SSL CA Path option: mariadb-check \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -932,8 +932,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-check: SSL Cert option +.\" SSL Cert option: mariadb-check \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -948,8 +948,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-check: SSL Cipher option +.\" SSL Cipher option: mariadb-check \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -964,8 +964,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-check: SSL Key option +.\" SSL Key option: mariadb-check \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -980,8 +980,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-check: SSL Crl option +.\" SSL CRL option: mariadb-check \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -996,8 +996,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-check: SSL Crlpath option +.\" SSL Crlpath option: mariadb-check \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1012,8 +1012,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-check: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-check \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1027,8 +1027,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: tables option -.\" tables option: mysqlcheck +.\" mariadb-check: tables option +.\" tables option: mariadb-check \fB\-\-tables\fR .sp Override the @@ -1046,8 +1046,8 @@ option\&. All name arguments following the option are regarded as table names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: use-frm option -.\" use-frm option: mysqlcheck +.\" mariadb-check: use-frm option +.\" use-frm option: mariadb-check \fB\-\-use\-frm\fR .sp For repair operations on @@ -1067,8 +1067,8 @@ header is corrupted\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: user option -.\" user option: mysqlcheck +.\" mariadb-check: user option +.\" user option: mariadb-check \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1083,13 +1083,13 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: verbose option -.\" verbose option: mysqlcheck +.\" mariadb-check: verbose option +.\" verbose option: mariadb-check \fB\-\-verbose\fR, \fB\-v\fR .sp Verbose mode\&. Print information about the various stages of program operation\&. -Using one \fB--verbose\fR option will give you more information about what mysqlcheck is +Using one \fB--verbose\fR option will give you more information about what mariadb-check is doing\&. .sp Using two \fB--verbose\fR options will also give you connection information\&. @@ -1106,8 +1106,8 @@ the check phase\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: version option -.\" version option: mysqlcheck +.\" mariadb-check: version option +.\" version option: mariadb-check \fB\-\-version\fR, \fB\-V\fR .sp @@ -1122,8 +1122,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: write-binlog option -.\" write-binlog option: mysqlcheck +.\" mariadb-check: write-binlog option +.\" write-binlog option: mariadb-check \fB\-\-write\-binlog\fR .sp This option is enabled by default, so that @@ -1131,7 +1131,7 @@ ANALYZE TABLE, OPTIMIZE TABLE, and REPAIR TABLE statements generated by -\fBmysqlcheck\fR +\fBmariadb-check\fR are written to the binary log\&. Use \fB\-\-skip\-write\-binlog\fR to cause @@ -1143,7 +1143,7 @@ when these statements should not be sent to replication slaves or run when using .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-client-test.1 b/man/mariadb-client-test.1 index 2866dfa5029..dba0aa6f225 100644 --- a/man/mariadb-client-test.1 +++ b/man/mariadb-client-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,37 +11,37 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_client_test -.\" mysql_client_test_embedded +.\" mariadb-client-test +.\" mariadb-client-test-embedded .SH "NAME" -mariadb-client-test \- test client API (mysql_client_test is now a symlink to mariadb-client-test) +mariadb-client-test \- test client API (mariadb-client-test is now a symlink to mariadb-client-test) .br -mariadb-client-test-embedded \- test client API for embedded server (mysql_client_test_embedded is now a symlink to mariadb-client-test-embedded) +mariadb-client-test-embedded \- test client API for embedded server (mariadb-client-test-embedded is now a symlink to mariadb-client-test-embedded) .SH "SYNOPSIS" -.HP \w'\fBmysql_client_test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u -\fBmysql_client_test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR -.HP \w'\fBmysql_client_test_embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u -\fBmysql_client_test_embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +.HP \w'\fBmariadb-client-test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u +\fBmariadb-client-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +.HP \w'\fBmariadb-client-test-embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u +\fBmariadb-client-test-embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR .SH "DESCRIPTION" .PP The -\fBmysql_client_test\fR +\fBmariadb-client-test\fR program is used for testing aspects of the MariaDB client API that cannot be tested using -\fBmysqltest\fR +\fBmariadb-test\fR and its test language\&. -\fBmysql_client_test_embedded\fR +\fBmariadb-client-test-embedded\fR is similar but used for testing the embedded server\&. Both programs are run as part of the test suite\&. .PP The source code for the programs can be found in in -tests/mysql_client_test\&.c +tests/mariadb-client-test\&.c in a source distribution\&. The program serves as a good source of examples illustrating how to use various features of the client API\&. .PP -\fBmysql_client_test\fR +\fBmariadb-client-test\fR is used in a test by the same name in the main tests suite of -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR but may also be run directly\&. Unlike the other programs listed here, it does not read an external description of what tests to run\&. Instead, all tests are coded into the program, which is written to cover all aspects of the C language API\&. .PP -\fBmysql_client_test\fR +\fBmariadb-client-test\fR supports the following options: .sp .RS 4 @@ -52,8 +52,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: help option -.\" help option: mysql_client_test +.\" mariadb-client-test: help option +.\" help option: mariadb-client-test \fB\-\-help\fR, \fB\-?\fR .sp @@ -69,8 +69,8 @@ Display a help message and exit\&. .IP \(bu 2.3 .\} \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR, -.\" mysql_client_test: basedir option -.\" basedir option: mysql_client_test +.\" mariadb-client-test: basedir option +.\" basedir option: mariadb-client-test \fB\-b \fR\fB\fIdir_name\fR\fR .sp The base directory for the tests\&. @@ -85,8 +85,8 @@ The base directory for the tests\&. .IP \(bu 2.3 .\} \fB\-\-count=\fR\fB\fIcount\fR\fR, -.\" mysql_client_test: count option -.\" count option: mysql_client_test +.\" mariadb-client-test: count option +.\" count option: mariadb-client-test \fB\-t \fR\fB\fIcount\fR\fR .sp The number of times to execute the tests\&. @@ -100,8 +100,8 @@ The number of times to execute the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: database option -.\" database option: mysql_client_test +.\" mariadb-client-test: database option +.\" database option: mariadb-client-test \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -116,14 +116,14 @@ The database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: debug option -.\" debug option: mysql_client_test +.\" mariadb-client-test: debug option +.\" debug option: mariadb-client-test \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-#[\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is 'd:t:o,/tmp/mysql_client_test.trace'. +value is 'd:t:o,/tmp/mariadb-client-test.trace'. .RE .sp .RS 4 @@ -135,8 +135,8 @@ value is 'd:t:o,/tmp/mysql_client_test.trace'. .IP \(bu 2.3 .\} \fB\-\-getopt\-ll\-test=\fR\fB\fIoption\fR\fR, -.\" mysql_client_test: getopt-ll-test option -.\" getopt-ll-test option: mysql_client_test +.\" mariadb-client-test: getopt-ll-test option +.\" getopt-ll-test option: mariadb-client-test \fB\-g \fR\fB\fIoption\fR\fR .sp Option to use for testing bugs in the @@ -152,8 +152,8 @@ library\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: host option -.\" host option: mysql_client_test +.\" mariadb-client-test: host option +.\" host option: mariadb-client-test \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -168,8 +168,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: password option -.\" password option: mysql_client_test +.\" mariadb-client-test: password option +.\" password option: mariadb-client-test \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -178,8 +178,8 @@ The password to use when connecting to the server\&. If you use the short option have a space between the option and the password\&. If you omit the \fIpassword\fR value following the -.\" mysql_client_test: password option -.\" password option: mysql_client_test +.\" mariadb-client-test: password option +.\" password option: mariadb-client-test \fB\-\-password\fR or \fB\-p\fR @@ -194,8 +194,8 @@ option on the command line, you are prompted for one\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: port option -.\" port option: mysql_client_test +.\" mariadb-client-test: port option +.\" port option: mariadb-client-test \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -211,8 +211,8 @@ The TCP/IP port number to use for the connection\&. .IP \(bu 2.3 .\} \fB\-\-server\-arg=\fR\fB\fIarg\fR\fR, -.\" mysql_client_test: server-arg option -.\" server-arg option: mysql_client_test +.\" mariadb-client-test: server-arg option +.\" server-arg option: mariadb-client-test \fB\-A \fR\fB\fIarg\fR\fR .sp Argument to send to the embedded server\&. @@ -240,8 +240,8 @@ Show all test names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: silent option -.\" silent option: mysql_client_test +.\" mariadb-client-test: silent option +.\" silent option: mariadb-client-test \fB\-\-silent\fR, \fB\-s\fR .sp @@ -256,8 +256,8 @@ Be more silent\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: socket option -.\" socket option: mysql_client_test +.\" mariadb-client-test: socket option +.\" socket option: mariadb-client-test \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -278,8 +278,8 @@ localhost \fB\-c\fR .sp The option is used when called from -\fBmysql\-test\-run\&.pl\fR, so that -\fBmysql_client_test\fR +\fBmariadb\-test\-run\&.pl\fR, so that +\fBmariadb-client-test\fR may optionally behave in a different way than if called manually, for example by skipping some tests\&. Currently, there is no difference in behavior but the option is included in order to make this possible\&. .RE .sp @@ -291,8 +291,8 @@ may optionally behave in a different way than if called manually, for example by .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: user option -.\" user option: mysql_client_test +.\" mariadb-client-test: user option +.\" user option: mariadb-client-test \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -308,17 +308,17 @@ The MariaDB user name to use when connecting to the server\&. .IP \(bu 2.3 .\} \fB\-v \fR\fB\fIdir_name\fR\fR, -.\" mysql_client_test: vardir option -.\" vardir option: mysql_client_test +.\" mariadb-client-test: vardir option +.\" vardir option: mariadb-client-test \fB\-\-vardir=\fR\fB\fIdir_name\fR\fR .sp The data directory for tests\&. The default is -mysql\-test/var\&. +mariadb\-test/var\&. .RE .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1 index 487ad003aec..9a04fe53a49 100644 --- a/man/mariadb-conv.1 +++ b/man/mariadb-conv.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONV\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONV\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -90,7 +90,7 @@ Treat the specified characters as delimiters\&. .SH "COPYRIGHT" .br .PP -Copyright 2020 MariaDB Foundation +Copyright 2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-convert-table-format.1 b/man/mariadb-convert-table-format.1 index 89f6f37bcf9..90daee617f8 100644 --- a/man/mariadb-convert-table-format.1 +++ b/man/mariadb-convert-table-format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,18 +11,18 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_convert_table_format +.\" mariadb_convert_table_format .SH "NAME" -mariadb-convert-table-format \- convert tables to use a given storage engine (mysql_convert_table_format is now a symlink to mariadb-convert-table-format) +mariadb-convert-table-format \- convert tables to use a given storage engine (mariadb-convert-table-format is now a symlink to mariadb-convert-table-format) .SH "SYNOPSIS" -.HP \w'\fBmysql_convert_table_format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u -\fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR +.HP \w'\fBmariadb-convert-table-format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u +\fBmariadb-convert-table-format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_convert_table_format\fR +\fBmariadb_convert_table_format\fR converts the tables in a database to use a particular storage engine (MyISAM by default)\&. -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR is written in Perl and requires that the DBI and @@ -31,14 +31,14 @@ Perl modules be installed (see Section\ \&2.15, \(lqPerl Installation Notes\(rq)\&. .PP Invoke -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB]\fR\fB\fIdb_name\fR\fR +shell> \fBmariadb-convert-table-format [\fR\fB\fIoptions\fR\fR\fB]\fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -48,7 +48,7 @@ The \fIdb_name\fR argument indicates the database containing the tables to be converted\&. .PP -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR supports the options described in the following list\&. .sp .RS 4 @@ -59,8 +59,8 @@ supports the options described in the following list\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: help option -.\" help option: mysql_convert_table_format +.\" mariadb-convert-table-format: help option +.\" help option: mariadb-convert-table-format \fB\-\-help\fR .sp Display a help message and exit\&. @@ -74,8 +74,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: force option -.\" force option: mysql_convert_table_format +.\" mariadb-convert-table-format: force option +.\" force option: mariadb-convert-table-format \fB\-\-force\fR .sp Continue even if errors occur\&. @@ -89,8 +89,8 @@ Continue even if errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: host option -.\" host option: mysql_convert_table_format +.\" mariadb-convert-table-format: host option +.\" host option: mariadb-convert-table-format \fB\-\-host=\fR\fB\fIhost_name\fR\fR .sp Connect to the MariaDB server on the given host\&. @@ -104,8 +104,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: password option -.\" password option: mysql_convert_table_format +.\" mariadb-convert-table-format: password option +.\" password option: mariadb-convert-table-format \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. @@ -121,8 +121,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: port option -.\" port option: mysql_convert_table_format +.\" mariadb-convert-table-format: port option +.\" port option: mariadb-convert-table-format \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for the connection\&. @@ -136,8 +136,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: socket option -.\" socket option: mysql_convert_table_format +.\" mariadb-convert-table-format: socket option +.\" socket option: mariadb-convert-table-format \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp For connections to @@ -152,8 +152,8 @@ localhost, the Unix socket file to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: type option -.\" type option: mysql_convert_table_format +.\" mariadb-convert-table-format: type option +.\" type option: mariadb-convert-table-format \fB\-\-type=\fR\fB\fIengine_name\fR\fR .sp Specify the storage engine that the tables should be converted to use\&. The default is @@ -169,8 +169,8 @@ if this option is not given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: user option -.\" user option: mysql_convert_table_format +.\" mariadb-convert-table-format: user option +.\" user option: mariadb-convert-table-format \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. @@ -184,8 +184,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: verbose option -.\" verbose option: mysql_convert_table_format +.\" mariadb-convert-table-format: verbose option +.\" verbose option: mariadb-convert-table-format \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -199,8 +199,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: version option -.\" version option: mysql_convert_table_format +.\" mariadb-convert-table-format: version option +.\" version option: mariadb-convert-table-format \fB\-\-version\fR .sp Display version information and exit\&. @@ -208,7 +208,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dump.1 b/man/mariadb-dump.1 index bbb5b59c714..61aca2be527 100644 --- a/man/mariadb-dump.1 +++ b/man/mariadb-dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMP\fR" "1" "24 October 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-DUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,42 +11,42 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqldump +.\" mariadb-dump .\" dumping: databases and tables .\" backups: databases and tables .\" databases: dumping .\" tables: dumping .SH "NAME" -mariadb-dump \- a database backup program (mysqldump is now a symlink to mariadb-dump) +mariadb-dump \- a database backup program (mariadb-dump is now a symlink to mariadb-dump) .SH "SYNOPSIS" -.HP \w'\fBmysqldump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u -\fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR +.HP \w'\fBmariadb-dump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u +\fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR .SH "DESCRIPTION" .PP The -\fBmysqldump\fR +\fBmariadb-dump\fR client is a backup program originally written by Igor Romanenko\&. It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MariaDB server)\&. The dump typically contains SQL statements to create the table, populate it, or both\&. However, -\fBmysqldump\fR +\fBmariadb-dump\fR can also be used to generate files in CSV, other delimited text, or XML format\&. .PP If you are doing a backup on the server and your tables all are MyISAM tables, consider using the -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR instead because it can accomplish faster backups and faster restores\&. See -\fBmysqlhotcopy\fR(1)\&. +\fBmariadb-hotcopy\fR(1)\&. .PP There are four general ways to invoke -\fBmysqldump\fR: +\fBmariadb-dump\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR .fi .if n \{\ .RE @@ -60,7 +60,7 @@ or \fB\-\-all\-databases\fR option, entire databases are dumped\&. .PP -\fBmysqldump\fR +\fBmariadb-dump\fR does not dump the INFORMATION_SCHEMA or performance_schema databases by default\&. To dump these, @@ -69,12 +69,12 @@ name them explicitly on the command line, although you must also use the option\&. .PP To see a list of the options your version of -\fBmysqldump\fR +\fBmariadb-dump\fR supports, execute -\fBmysqldump \-\-help\fR\&. +\fBmariadb-dump \-\-help\fR\&. .PP Some -\fBmysqldump\fR +\fBmariadb-dump\fR options are shorthand for groups of other options: .sp .RS 4 @@ -174,7 +174,7 @@ would not have the intended effect; it is the same as \fB\-\-skip\-opt\fR by itself\&. .PP -\fBmysqldump\fR +\fBmariadb-dump\fR can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it\&. Buffering in memory can be a problem if you are dumping large tables\&. To dump tables row by row, use the \fB\-\-quick\fR option (or @@ -186,7 +186,7 @@ option (and hence \fB\-\-skip\-quick\fR\&. .PP If you are using a recent version of -\fBmysqldump\fR +\fBmariadb-dump\fR to generate a dump to be reloaded into a very old MySQL server, you should not use the \fB\-\-opt\fR or @@ -196,13 +196,13 @@ option\&. Use instead\&. .RE .PP -\fBmysqldump\fR +\fBmariadb-dump\fR supports the following options, which can be specified on the command line or in the -[mysqldump] +[mariadb-dump] and [client] option file groups\&. -\fBmysqldump\fR +\fBmariadb-dump\fR also supports the options for processing option file\&. .sp .RS 4 @@ -213,8 +213,8 @@ also supports the options for processing option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: help option -.\" help option: mysqldump +.\" mariadb-dump: help option +.\" help option: mariadb-dump \fB\-\-help\fR, \fB\-?\fR .sp @@ -229,8 +229,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-database option -.\" add-drop-database option: mysqldump +.\" mariadb-dump: add-drop-database option +.\" add-drop-database option: mariadb-dump \fB\-\-add\-drop\-database\fR .sp Add a @@ -254,8 +254,8 @@ statements are written unless one of those options is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-table option -.\" add-drop-table option: mysqldump +.\" mariadb-dump: add-drop-table option +.\" add-drop-table option: mariadb-dump \fB\-\-add\-drop\-table\fR .sp Add a @@ -273,8 +273,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-trigger option -.\" add-drop-trigger option: mysqldump +.\" mariadb-dump: add-drop-trigger option +.\" add-drop-trigger option: mariadb-dump \fB\-\-add\-drop\-trigger\fR .sp Add a @@ -292,8 +292,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-locks option -.\" add-locks option: mysqldump +.\" mariadb-dump: add-locks option +.\" add-locks option: mariadb-dump \fB\-\-add\-locks\fR .sp Surround each table dump with @@ -311,8 +311,8 @@ statements\&. This results in faster inserts when the dump file is reloaded\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: all-databases option -.\" all-databases option: mysqldump +.\" mariadb-dump: all-databases option +.\" all-databases option: mariadb-dump \fB\-\-all\-databases\fR, \fB\-A\fR .sp @@ -329,15 +329,15 @@ option and naming all the databases on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: all-tablespaces option -.\" all-tablespaces option: mysqldump +.\" mariadb-dump: all-tablespaces option +.\" all-tablespaces option: mariadb-dump \fB\-\-all\-tablespaces\fR, \fB\-Y\fR .sp Adds to a table dump all SQL statements needed to create any tablespaces used by an NDBCLUSTER table\&. This information is not otherwise included in the output from -\fBmysqldump\fR\&. This option is currently relevant only to MySQL Cluster tables\&. +\fBmariadb-dump\fR\&. This option is currently relevant only to MySQL Cluster tables\&. .sp .RE .sp @@ -349,8 +349,8 @@ table\&. This information is not otherwise included in the output from .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: allow-keywords option -.\" allow-keywords option: mysqldump +.\" mariadb-dump: allow-keywords option +.\" allow-keywords option: mariadb-dump \fB\-\-allow\-keywords\fR .sp Allow creation of column names that are keywords\&. This works by prefixing each column name with the table name\&. @@ -364,8 +364,8 @@ Allow creation of column names that are keywords\&. This works by prefixing each .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: apply-slave-statements option -.\" apply-slave-statements option: mysqldump +.\" mariadb-dump: apply-slave-statements option +.\" apply-slave-statements option: mariadb-dump \fB\-\-apply\-slave\-statements\fR .sp Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump\&. @@ -379,8 +379,8 @@ Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump\& .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: as-of option -.\" as-of option: mysqldump +.\" mariadb-dump: as-of option +.\" as-of option: mariadb-dump \fB\-\-as\-of=\fR\fB\fIname\fR\fR .sp Dump system versioned table as of specified timestamp\&. @@ -394,8 +394,8 @@ Dump system versioned table as of specified timestamp\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: character-sets-dir option -.\" character-sets-dir option: mysqldump +.\" mariadb-dump: character-sets-dir option +.\" character-sets-dir option: mariadb-dump \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -409,8 +409,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: comments option -.\" comments option: mysqldump +.\" mariadb-dump: comments option +.\" comments option: mariadb-dump \fB\-\-comments\fR, \fB\-i\fR .sp @@ -426,8 +426,8 @@ Write additional information in the dump file such as program version, server ve .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compact option -.\" compact option: mysqldump +.\" mariadb-dump: compact option +.\" compact option: mariadb-dump \fB\-\-compact\fR .sp Produce more compact output\&. This option enables the @@ -448,8 +448,8 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compatible option -.\" compatible option: mysqldump +.\" mariadb-dump: compatible option +.\" compatible option: mariadb-dump \fB\-\-compatible=\fR\fB\fIname\fR\fR .sp Produce output that is more compatible with other database systems or with older MySQL servers\&. The value of @@ -481,8 +481,8 @@ does not map data types to Oracle types or use Oracle comment syntax\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: complete-insert option -.\" complete-insert option: mysqldump +.\" mariadb-dump: complete-insert option +.\" complete-insert option: mariadb-dump \fB\-\-complete\-insert\fR, \fB\-c\fR .sp @@ -499,8 +499,8 @@ statements that include column names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compress option -.\" compress option: mysqldump +.\" mariadb-dump: compress option +.\" compress option: mariadb-dump \fB\-\-compress\fR, \fB\-C\fR .sp @@ -515,8 +515,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: copy-s3-tables option -.\" copy-s3-tables option: mysqldump +.\" mariadb-dump: copy-s3-tables option +.\" copy-s3-tables option: mariadb-dump \fB\-\-copy\-s3\-tables\fR .sp By default S3 tables are ignored\&. With this option set, the result file will contain a CREATE statement @@ -531,8 +531,8 @@ for a similar Aria table, followed by the table data and ending with an ALTER TA .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: create-options option -.\" create-options option: mysqldump +.\" mariadb-dump: create-options option +.\" create-options option: mariadb-dump \fB\-\-create\-options\fR, \fB\-a\fR .sp @@ -549,13 +549,13 @@ statements\&. Use \fB\-\-skip-create-options\fR to disable. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: databases option -.\" databases option: mysqldump +.\" mariadb-dump: databases option +.\" databases option: mariadb-dump \fB\-\-databases\fR, \fB\-B\fR .sp Dump several databases\&. Normally, -\fBmysqldump\fR +\fBmariadb-dump\fR treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&. CREATE DATABASE and @@ -571,14 +571,14 @@ statements are included in the output before each new database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug option -.\" debug option: mysqldump +.\" mariadb-dump: debug option +.\" debug option: mariadb-dump \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mysqldump.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mariadb-dump.trace'. .RE .sp .RS 4 @@ -589,8 +589,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mysqldump.tr .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug-check option -.\" debug-check option: mysqldump +.\" mariadb-dump: debug-check option +.\" debug-check option: mariadb-dump \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -604,8 +604,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug-info option -.\" debug-info option: mysqldump +.\" mariadb-dump: debug-info option +.\" debug-info option: mariadb-dump \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -619,8 +619,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: default-auth option -.\" default-auth option: mysqldump +.\" mariadb-dump: default-auth option +.\" default-auth option: mariadb-dump \fB\-\-default\-auth\fR .sp Default authentication client-side plugin to use\&. @@ -634,14 +634,14 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: default-character-set option -.\" default-character-set option: mysqldump +.\" mariadb-dump: default-character-set option +.\" default-character-set option: mariadb-dump \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use \fIcharset_name\fR as the default character set\&. If no character set is specified, -\fBmysqldump\fR +\fBmariadb-dump\fR uses utf8\&. .sp @@ -655,8 +655,8 @@ utf8\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: defaults-extra-file option -.\" defaults-extra-file option: mysqldump +.\" mariadb-dump: defaults-extra-file option +.\" defaults-extra-file option: mariadb-dump \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -671,8 +671,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: defaults-file option -.\" defaults-file option: mysqldump +.\" mariadb-dump: defaults-file option +.\" defaults-file option: mariadb-dump \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -691,7 +691,7 @@ Must be given as first option\&. .\" defaults-group-suffix option: my_print_defaults \fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR, .sp -Also read groups with a suffix of \fIstr\fR\&. For example, since mysqldump normally reads the [client] and [mysqldump] groups, \-\-defaults\-group\-suffix=x would cause it to also read the groups [mysqldump_x] and [client_x]\&. +Also read groups with a suffix of \fIstr\fR\&. For example, since mariadb-dump normally reads the [client] and [mariadb-dump] groups, \-\-defaults\-group\-suffix=x would cause it to also read the groups [mariadb-dump_x] and [client_x]\&. .RE .sp .RS 4 @@ -702,8 +702,8 @@ Also read groups with a suffix of \fIstr\fR\&. For example, since mysqldump norm .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: delayed-insert option -.\" delayed-insert option: mysqldump +.\" mariadb-dump: delayed-insert option +.\" delayed-insert option: mariadb-dump \fB\-\-delayed\-insert\fR .sp Write @@ -721,8 +721,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: delete-master-logs option -.\" delete-master-logs option: mysqldump +.\" mariadb-dump: delete-master-logs option +.\" delete-master-logs option: mariadb-dump \fB\-\-delete\-master\-logs\fR .sp On a master replication server, delete the binary logs by sending a @@ -739,8 +739,8 @@ statement to the server after performing the dump operation\&. This option autom .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: disable-keys option -.\" disable-keys option: mysqldump +.\" mariadb-dump: disable-keys option +.\" disable-keys option: mariadb-dump \fB\-\-disable\-keys\fR, \fB\-K\fR .sp @@ -763,14 +763,14 @@ tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-date option -.\" dump-date option: mysqldump +.\" mariadb-dump: dump-date option +.\" dump-date option: mariadb-dump \fB\-\-dump\-date\fR .sp If the \fB\-\-comments\fR option is given, -\fBmysqldump\fR +\fBmariadb-dump\fR produces a comment at the end of the dump of the following form: .sp .if n \{\ @@ -802,8 +802,8 @@ suppresses date printing\& .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-history option -.\" dump-history option: mysqldump +.\" mariadb-dump: dump-history option +.\" dump-history option: mariadb-dump \fB\-\-dump\-history\fR .sp Dump tables with history. Until this option, mariadb-dump could not read historical rows from versioned tables, @@ -818,8 +818,8 @@ and so historical data would not be backed up\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-slave option -.\" dump-slave option: mysqldump +.\" mariadb-dump: dump-slave option +.\" dump-slave option: mariadb-dump \fB\-\-dump\-slave[=\fR\fB\fIvalue\fR\fR\fB]\fR .sp Used for producing a dump file from a replication slave server that can be used to set up another slave server @@ -829,7 +829,7 @@ output; if set to 2, that command will be prefixed with a comment symbol\&. This \-\-lock\-all\-tables on, unless \-\-single-transaction is specified too (in which case a global read lock is only taken a short time at the beginning of the dump \- don't forget to read about \-\-single-transaction below)\&. In all cases any action on logs will happen at the exact moment of the dump\&. Option automatically turns -\-\-lock\-tables off\&. Using this option causes mysqldump to stop the slave SQL thread before beginning the dump, +\-\-lock\-tables off\&. Using this option causes mariadb-dump to stop the slave SQL thread before beginning the dump, and restart it again after completion\&. .RE .sp @@ -841,8 +841,8 @@ and restart it again after completion\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: events option -.\" events option: mysqldump +.\" mariadb-dump: events option +.\" events option: mariadb-dump \fB\-\-events\fR, \fB\-E\fR .sp @@ -857,8 +857,8 @@ Include Event Scheduler events for the dumped databases in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: extended-insert option -.\" extended-insert option: mysqldump +.\" mariadb-dump: extended-insert option +.\" extended-insert option: mariadb-dump \fB\-\-extended\-insert\fR, \fB\-e\fR .sp @@ -877,17 +877,17 @@ lists\&. This results in a smaller dump file and speeds up inserts when the file .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: fields-terminated-by option -.\" fields-terminated-by option: mysqldump +.\" mariadb-dump: fields-terminated-by option +.\" fields-terminated-by option: mariadb-dump \fB\-\-fields\-terminated\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-enclosed-by option -.\" fields-enclosed-by option: mysqldump +.\" mariadb-dump: fields-enclosed-by option +.\" fields-enclosed-by option: mariadb-dump \fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-optionally-enclosed-by option -.\" fields-optionally-enclosed-by option: mysqldump +.\" mariadb-dump: fields-optionally-enclosed-by option +.\" fields-optionally-enclosed-by option: mariadb-dump \fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-escaped-by option -.\" fields-escaped-by option: mysqldump +.\" mariadb-dump: fields-escaped-by option +.\" fields-escaped-by option: mariadb-dump \fB\-\-fields\-escaped\-by=\&.\&.\&.\fR .sp These options are used with the @@ -906,8 +906,8 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: first-slave option -.\" first-slave option: mysqldump +.\" mariadb-dump: first-slave option +.\" first-slave option: mariadb-dump \fB\-\-first\-slave\fR .sp Removed in MariaDB 5.5\&. Use @@ -923,8 +923,8 @@ instead\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: flush-logs option -.\" flush-logs option: mysqldump +.\" mariadb-dump: flush-logs option +.\" flush-logs option: mariadb-dump \fB\-\-flush\-logs\fR, \fB\-F\fR .sp @@ -952,8 +952,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: flush-privileges option -.\" flush-privileges option: mysqldump +.\" mariadb-dump: flush-privileges option +.\" flush-privileges option: mariadb-dump \fB\-\-flush\-privileges\fR .sp Send a @@ -975,21 +975,21 @@ database for proper restoration\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: force option -.\" force option: mysqldump +.\" mariadb-dump: force option +.\" force option: mariadb-dump \fB\-\-force\fR, \fB\-f\fR .sp Continue even if an SQL error occurs during a table dump\&. .sp One use for this option is to cause -\fBmysqldump\fR +\fBmariadb-dump\fR to continue executing even when it encounters a view that has become invalid because the definition refers to a table that has been dropped\&. Without \fB\-\-force\fR, -\fBmysqldump\fR +\fBmariadb-dump\fR exits with an error message\&. With \fB\-\-force\fR, -\fBmysqldump\fR +\fBmariadb-dump\fR prints the error message, but it also writes an SQL comment containing the view definition to the dump output and continues executing\&. .RE .sp @@ -1001,8 +1001,8 @@ prints the error message, but it also writes an SQL comment containing the view .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: gtid option -.\" gtid option: mysqldump +.\" mariadb-dump: gtid option +.\" gtid option: mariadb-dump \fB\-\-gtid\fR .sp Available from MariaDB 10.0.13, and is used together with \fB\-\-master\-data\fR and \fB\-\-dump\-slave\fR to more conveniently set up a new GTID slave\&. It causes those options to output SQL statements that configure the slave to use the global transaction ID to connect to the master instead of old-style filename/offset positions\&. The old-style positions are still included in comments when \fB\-\-gtid\fR is used; likewise the GTID position is included in comments even if \fB\-\-gtid\fR is not used\&. @@ -1016,8 +1016,8 @@ Available from MariaDB 10.0.13, and is used together with \fB\-\-master\-data\fR .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: header option -.\" header option: mysqldump +.\" mariadb-dump: header option +.\" header option: mariadb-dump \fB\-\-header\fR .sp Used together with --tab. When enabled, adds header with column names to the top of output txt files. @@ -1031,8 +1031,8 @@ Used together with --tab. When enabled, adds header with column names to the top .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: hex-blob option -.\" hex-blob option: mysqldump +.\" mariadb-dump: hex-blob option +.\" hex-blob option: mariadb-dump \fB\-\-hex\-blob\fR .sp Dump binary columns using hexadecimal notation (for example, 'abc' becomes @@ -1052,8 +1052,8 @@ BIT\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: host option -.\" host option: mysqldump +.\" mariadb-dump: host option +.\" host option: mariadb-dump \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -1069,8 +1069,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: ignore-table option -.\" ignore-table option: mysqldump +.\" mariadb-dump: ignore-table option +.\" ignore-table option: mariadb-dump \fB\-\-ignore\-table=\fR\fB\fIdb_name\&.tbl_name\fR\fR .sp Do not dump the given table, which must be specified using both the database and table names\&. To ignore multiple tables, use this option multiple times\&. This option also can be used to ignore views\&. @@ -1084,8 +1084,8 @@ Do not dump the given table, which must be specified using both the database and .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: include-master-host-port option -.\" include-master-host-port option: mysqldump +.\" mariadb-dump: include-master-host-port option +.\" include-master-host-port option: mariadb-dump \fB\-\-include\-master\-host\-port\fR .sp Add the MASTER_HOST and MASTER_PORT options for the CHANGE MASTER TO statement when using @@ -1100,8 +1100,8 @@ the \fB--dump-slave\fR option for a slave dump\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: insert-ignore option -.\" insert-ignore option: mysqldump +.\" mariadb-dump: insert-ignore option +.\" insert-ignore option: mariadb-dump \fB\-\-insert\-ignore\fR .sp Write @@ -1119,8 +1119,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lines-terminated-by option -.\" lines-terminated-by option: mysqldump +.\" mariadb-dump: lines-terminated-by option +.\" lines-terminated-by option: mariadb-dump \fB\-\-lines\-terminated\-by=\&.\&.\&.\fR .sp This option is used with the @@ -1139,8 +1139,8 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lock-all-tables option -.\" lock-all-tables option: mysqldump +.\" mariadb-dump: lock-all-tables option +.\" lock-all-tables option: mariadb-dump \fB\-\-lock\-all\-tables\fR, \fB\-x\fR .sp @@ -1158,8 +1158,8 @@ and .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lock-tables option -.\" lock-tables option: mysqldump +.\" mariadb-dump: lock-tables option +.\" lock-tables option: mariadb-dump \fB\-\-lock\-tables\fR, \fB\-l\fR .sp @@ -1189,8 +1189,8 @@ Use \fB--skip-lock-tables\fR to disable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: log-error option -.\" log-error option: mysqldump +.\" mariadb-dump: log-error option +.\" log-error option: mariadb-dump \fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR .sp Log warnings and errors by appending them to the named file\&. The default is to do no logging\&. @@ -1204,8 +1204,8 @@ Log warnings and errors by appending them to the named file\&. The default is to .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: log-queries option -.\" log-queries option: mysqldump +.\" mariadb-dump: log-queries option +.\" log-queries option: mariadb-dump \fB\-\-log\-queries\fR\fR .sp When restoring the dump, the server will, if logging is turned on, log the queries to the general and slow query log\&. @@ -1220,8 +1220,8 @@ Defaults to on; use \fB--skip-log-queries\fR to disable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: master-data option -.\" master-data option: mysqldump +.\" mariadb-dump: master-data option +.\" master-data option: mariadb-dump \fB\-\-master\-data[=\fR\fB\fIvalue\fR\fR\fB]\fR .sp Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master\&. It causes the dump output to include a @@ -1260,8 +1260,8 @@ Stop the slave's SQL thread and get its current status: .RS 4 .\} .nf -mysql> \fBSTOP SLAVE SQL_THREAD;\fR -mysql> \fBSHOW SLAVE STATUS;\fR +mariadb> \fBSTOP SLAVE SQL_THREAD;\fR +mariadb> \fBSHOW SLAVE STATUS;\fR .fi .if n \{\ .RE @@ -1302,7 +1302,7 @@ Dump the slave server: .RS 4 .\} .nf -shell> \fBmysqldump \-\-master\-data=2 \-\-all\-databases > dumpfile\fR +shell> \fBmariadb-dump \-\-master\-data=2 \-\-all\-databases > dumpfile\fR .fi .if n \{\ .RE @@ -1323,7 +1323,7 @@ Restart the slave: .RS 4 .\} .nf -mysql> \fBSTART SLAVE;\fR +mariadb> \fBSTART SLAVE;\fR .fi .if n \{\ .RE @@ -1344,7 +1344,7 @@ On the new slave, load the dump file: .RS 4 .\} .nf -shell> \fBmysql < dumpfile\fR +shell> \fBmariadb < dumpfile\fR .fi .if n \{\ .RE @@ -1365,7 +1365,7 @@ On the new slave, set the replication coordinates to those of the master server .RS 4 .\} .nf -mysql> \fBCHANGE MASTER TO\fR +mariadb> \fBCHANGE MASTER TO\fR \-> \fBMASTER_LOG_FILE = '\fR\fB\fIfile_name\fR\fR\fB', MASTER_LOG_POS = \fR\fB\fIfile_pos\fR\fR\fB;\fR .fi .if n \{\ @@ -1388,8 +1388,8 @@ to point the slave to the correct master server host\&. Add any such parameters .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: max-allowed-packet option -.\" max-allowed-packet option: mysqldump +.\" mariadb-dump: max-allowed-packet option +.\" max-allowed-packet option: mariadb-dump \fB\-\-max\-allowed\-packet=\fR\fB\fIlength\fR\fR .sp Sets the maximum packet length to send to or receive from server\&. @@ -1403,8 +1403,8 @@ Sets the maximum packet length to send to or receive from server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: max-statement-time option -.\" max-statement-time option: mysqldump +.\" mariadb-dump: max-statement-time option +.\" max-statement-time option: mariadb-dump \fB\-\-max\-statement\-time=\fR\fB\fIseconds\fR\fR .sp Sets the maximum time any statement can run before being timed out by the server. (Default value is 0 (no limit))\& @@ -1418,8 +1418,8 @@ Sets the maximum time any statement can run before being timed out by the server .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: net-buffer-length option -.\" net-buffer-length option: mysqldump +.\" mariadb-dump: net-buffer-length option +.\" net-buffer-length option: mariadb-dump \fB\-\-net\-buffer\-length=\fR\fB\fIlength\fR\fR .sp Sets the buffer size for TCP/IP and socket communication\&. @@ -1433,8 +1433,8 @@ Sets the buffer size for TCP/IP and socket communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-autocommit option -.\" no-autocommit option: mysqldump +.\" mariadb-dump: no-autocommit option +.\" no-autocommit option: mariadb-dump \fB\-\-no\-autocommit\fR .sp Enclose the @@ -1454,8 +1454,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-create-db option -.\" no-create-db option: mysqldump +.\" mariadb-dump: no-create-db option +.\" no-create-db option: mariadb-dump \fB\-\-no\-create\-db\fR, \fB\-n\fR .sp @@ -1476,8 +1476,8 @@ option is given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-create-info option -.\" no-create-info option: mysqldump +.\" mariadb-dump: no-create-info option +.\" no-create-info option: mariadb-dump \fB\-\-no\-create\-info\fR, \fB\-t\fR .sp @@ -1494,8 +1494,8 @@ statements that re\-create each dumped table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-data option -.\" no-data option: mysqldump +.\" mariadb-dump: no-data option +.\" no-data option: mariadb-dump \fB\-\-no\-data\fR, \fB\-d\fR .sp @@ -1512,8 +1512,8 @@ statement for the table (for example, to create an empty copy of the table by lo .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-defaults option -.\" no-defaults option: mysqldump +.\" mariadb-dump: no-defaults option +.\" no-defaults option: mariadb-dump \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -1527,8 +1527,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-set-names option -.\" no-set-names option: mysqldump +.\" mariadb-dump: no-set-names option +.\" no-set-names option: mariadb-dump \fB\-\-no\-set\-names\fR, \fB\-N\fR .sp @@ -1544,8 +1544,8 @@ This has the same effect as .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: opt option -.\" opt option: mysqldump +.\" mariadb-dump: opt option +.\" opt option: mariadb-dump \fB\-\-opt\fR .sp This option is shorthand\&. It is the same as specifying @@ -1571,8 +1571,8 @@ See the discussion at the beginning of this section for information about select .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: order-by-primary option -.\" order-by-primary option: mysqldump +.\" mariadb-dump: order-by-primary option +.\" order-by-primary option: mariadb-dump \fB\-\-order\-by\-primary\fR .sp Dump each table's rows sorted by its primary key, or by its first unique index, if such an index exists\&. This is useful when dumping a @@ -1590,8 +1590,8 @@ table, but will make the dump operation take considerably longer\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: order-by-size option -.\" order-by-size option: mysqldump +.\" mariadb-dump: order-by-size option +.\" order-by-size option: mariadb-dump \fB\-\-order\-by\-size\fR .sp Dump each table according to their size, smallest first. Useful when using \-\-single-transaction on tables @@ -1608,8 +1608,8 @@ and by dumping those first, this reduces the chance that a \-\-single-transactio .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: parallel option -.\" parallel option: mysqldump +.\" mariadb-dump: parallel option +.\" parallel option: mariadb-dump \fB\-\-parallel=#\fR, \fB\-j\fR .sp @@ -1628,8 +1628,8 @@ adding more parallel jobs does not bring better performance. .IP \(bu 2.3 .\} -.\" mysqldump: password option -.\" password option: mysqldump +.\" mariadb-dump: password option +.\" password option: mariadb-dump \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -1642,7 +1642,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqldump\fR +\fBmariadb-dump\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -1656,8 +1656,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: pipe option -.\" pipe option: mysqldump +.\" mariadb-dump: pipe option +.\" pipe option: mariadb-dump \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -1672,8 +1672,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: plugin-dir option -.\" plugin-dir option: mysqldump +.\" mariadb-dump: plugin-dir option +.\" plugin-dir option: mariadb-dump \fB\-\-plugin\-dir\fR .sp Directory for client-side plugins\&. @@ -1687,8 +1687,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: port option -.\" port option: mysqldump +.\" mariadb-dump: port option +.\" port option: mariadb-dump \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -1704,8 +1704,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: protocol option -.\" protocol option: mysqldump +.\" mariadb-dump: protocol option +.\" protocol option: mariadb-dump \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -1719,13 +1719,13 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: quick option -.\" quick option: mysqldump +.\" mariadb-dump: quick option +.\" quick option: mariadb-dump \fB\-\-quick\fR, \fB\-q\fR .sp This option is useful for dumping large tables\&. It forces -\fBmysqldump\fR +\fBmariadb-dump\fR to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out\&. .RE .sp @@ -1737,8 +1737,8 @@ to retrieve rows for a table from the server a row at a time rather than retriev .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: print-defaults option -.\" print-defaults option: mysqldump +.\" mariadb-dump: print-defaults option +.\" print-defaults option: mariadb-dump \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -1752,8 +1752,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: quote-names option -.\" quote-names option: mysqldump +.\" mariadb-dump: quote-names option +.\" quote-names option: mariadb-dump \fB\-\-quote\-names\fR, \fB\-Q\fR .sp @@ -1778,8 +1778,8 @@ that may enable .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: replace option -.\" replace option: mysqldump +.\" mariadb-dump: replace option +.\" replace option: mariadb-dump \fB\-\-replace\fR .sp Write @@ -1797,8 +1797,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: result-file option -.\" result-file option: mysqldump +.\" mariadb-dump: result-file option +.\" result-file option: mariadb-dump \fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR, \fB\-r \fR\fB\fIfile_name\fR\fR .sp @@ -1817,8 +1817,8 @@ carriage return/newline sequences\&. The result file is created and its previous .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: routines option -.\" routines option: mysqldump +.\" mariadb-dump: routines option +.\" routines option: mariadb-dump \fB\-\-routines\fR, \fB\-R\fR .sp @@ -1851,8 +1851,8 @@ database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: set-charset option -.\" set-charset option: mysqldump +.\" mariadb-dump: set-charset option +.\" set-charset option: mariadb-dump \fB\-\-set\-charset\fR .sp Add @@ -1871,8 +1871,8 @@ statement, use .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: single-transaction option -.\" single-transaction option: mysqldump +.\" mariadb-dump: single-transaction option +.\" single-transaction option: mariadb-dump \fB\-\-single\-transaction\fR .sp This option sends a @@ -1900,7 +1900,7 @@ RENAME TABLE, TRUNCATE TABLE\&. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the SELECT that is performed by -\fBmysqldump\fR +\fBmariadb-dump\fR to retrieve the table contents to obtain incorrect contents or fail\&. .sp The @@ -1925,8 +1925,8 @@ option with .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-add-drop-table option -.\" skip-add-drop-table option: mysqldump +.\" mariadb-dump: skip-add-drop-table option +.\" skip-add-drop-table option: mariadb-dump \fB\-\-skip\-add\-drop\-table\fR .sp Disable the @@ -1942,8 +1942,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-add-locks option -.\" skip-add-locks option: mysqldump +.\" mariadb-dump: skip-add-locks option +.\" skip-add-locks option: mariadb-dump \fB\-\-skip\-add\-locks\fR .sp Disable the @@ -1959,8 +1959,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-comments option -.\" skip-comments option: mysqldump +.\" mariadb-dump: skip-comments option +.\" skip-comments option: mariadb-dump \fB\-\-skip\-comments\fR .sp Disable the @@ -1976,8 +1976,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-compact option -.\" skip-compact option: mysqldump +.\" mariadb-dump: skip-compact option +.\" skip-compact option: mariadb-dump \fB\-\-skip\-compact\fR .sp Disable the @@ -1993,8 +1993,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-disable-keys option -.\" skip-disable-keys option: mysqldump +.\" mariadb-dump: skip-disable-keys option +.\" skip-disable-keys option: mariadb-dump \fB\-\-skip\-disable\-keys\fR .sp Disable the @@ -2010,8 +2010,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-extended-insert option -.\" skip-extended-insert option: mysqldump +.\" mariadb-dump: skip-extended-insert option +.\" skip-extended-insert option: mariadb-dump \fB\-\-skip\-extended\-insert\fR .sp Disable the @@ -2027,8 +2027,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-opt option -.\" skip-opt option: mysqldump +.\" mariadb-dump: skip-opt option +.\" skip-opt option: mariadb-dump \fB\-\-skip\-opt\fR .sp Disable the @@ -2044,8 +2044,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-quick option -.\" skip-quick option: mysqldump +.\" mariadb-dump: skip-quick option +.\" skip-quick option: mariadb-dump \fB\-\-skip\-quick\fR .sp Disable the @@ -2061,8 +2061,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-quote-names option -.\" skip-quote-names option: mysqldump +.\" mariadb-dump: skip-quote-names option +.\" skip-quote-names option: mariadb-dump \fB\-\-skip\-quote\-names\fR .sp Disable the @@ -2078,8 +2078,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-set-charset option -.\" skip-set-charset option: mysqldump +.\" mariadb-dump: skip-set-charset option +.\" skip-set-charset option: mariadb-dump \fB\-\-skip\-set\-charset\fR .sp Disable the @@ -2095,8 +2095,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-triggers option -.\" skip-triggers option: mysqldump +.\" mariadb-dump: skip-triggers option +.\" skip-triggers option: mariadb-dump \fB\-\-skip\-triggers\fR .sp Disable the @@ -2112,8 +2112,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-tz-utc option -.\" skip-tz-utc option: mysqldump +.\" mariadb-dump: skip-tz-utc option +.\" skip-tz-utc option: mariadb-dump \fB\-\-skip\-tz\-utc\fR .sp Disable the @@ -2129,8 +2129,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: socket option -.\" socket option: mysqldump +.\" mariadb-dump: socket option +.\" socket option: mariadb-dump \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -2147,8 +2147,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-admin: SSL options +.\" SSL options: mariadb-admin \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -2163,8 +2163,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-admin: SSL CA option +.\" SSL CA option: mariadb-admin \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -2179,8 +2179,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-admin: SSL CA Path option +.\" SSL CA Path option: mariadb-admin \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -2195,8 +2195,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-admin: SSL Cert option +.\" SSL Cert option: mariadb-admin \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -2211,8 +2211,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-admin: SSL Cipher option +.\" SSL Cipher option: mariadb-admin \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -2227,8 +2227,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-admin: SSL Key option +.\" SSL Key option: mariadb-admin \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -2243,8 +2243,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-admin: SSL Crl option +.\" SSL CRL option: mariadb-admin \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -2259,8 +2259,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-admin: SSL Crlpath option +.\" SSL Crlpath option: mariadb-admin \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -2275,8 +2275,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-admin: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-admin \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -2290,8 +2290,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: Dump system tables option -.\" Dump system tables option: mysqladmin +.\" mariadb-admin: Dump system tables option +.\" Dump system tables option: mariadb-admin \fB\-\-system=\fR\fB\fI{all, users, plugins, udfs, servers, stats, timezones}\fR\fR .sp Dump the system tables in the mysql database in a logical form\&. This option is an empty set by default\&. @@ -2393,13 +2393,13 @@ To help in migrating from MySQL to MariaDB, this option is designed to be able t .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tab option -.\" tab option: mysqldump +.\" mariadb-dump: tab option +.\" tab option: mariadb-dump \fB\-\-tab=\fR\fB\fIpath\fR\fR, \fB\-T \fR\fB\fIpath\fR\fR .sp Produce tab\-separated text\-format data files\&. For each dumped table, -\fBmysqldump\fR +\fBmariadb-dump\fR creates a \fItbl_name\fR\&.sql file that contains the @@ -2420,9 +2420,9 @@ file that contains its data\&. The option value is the directory in which to wri .ps -1 .br This option should be used only when -\fBmysqldump\fR +\fBmariadb-dump\fR is run on the same machine as the -\fBmysqld\fR +\fBmariadbd\fR server\&. You must have the FILE privilege, and the server must have permission to write files in the directory that you specify\&. @@ -2449,8 +2449,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tables option -.\" tables option: mysqldump +.\" mariadb-dump: tables option +.\" tables option: mariadb-dump \fB\-\-tables\fR .sp Override the @@ -2458,7 +2458,7 @@ Override the or \fB\-B\fR option\&. -\fBmysqldump\fR +\fBmariadb-dump\fR regards all name arguments following the option as table names\&. .RE .sp @@ -2470,8 +2470,8 @@ regards all name arguments following the option as table names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: triggers option -.\" triggers option: mysqldump +.\" mariadb-dump: triggers option +.\" triggers option: mariadb-dump \fB\-\-triggers\fR .sp Include triggers for each dumped table in the output\&. This option is enabled by default; disable it with @@ -2486,14 +2486,14 @@ Include triggers for each dumped table in the output\&. This option is enabled b .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tz-utc option -.\" tz-utc option: mysqldump +.\" mariadb-dump: tz-utc option +.\" tz-utc option: mariadb-dump \fB\-\-tz\-utc\fR .sp This option enables TIMESTAMP columns to be dumped and reloaded between servers in different time zones\&. -\fBmysqldump\fR +\fBmariadb-dump\fR sets its connection time zone to UTC and adds SET TIME_ZONE='+00:00' to the dump file\&. Without this option, @@ -2514,8 +2514,8 @@ is enabled by default\&. To disable it, use .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: user option -.\" user option: mysqldump +.\" mariadb-dump: user option +.\" user option: mariadb-dump \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -2530,8 +2530,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: verbose option -.\" verbose option: mysqldump +.\" mariadb-dump: verbose option +.\" verbose option: mariadb-dump \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -2546,8 +2546,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: version option -.\" version option: mysqldump +.\" mariadb-dump: version option +.\" version option: mariadb-dump \fB\-\-version\fR, \fB\-V\fR .sp @@ -2562,8 +2562,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: where option -.\" where option: mysqldump +.\" mariadb-dump: where option +.\" where option: mariadb-dump \fB\-\-where='\fR\fB\fIwhere_condition\fR\fR\fB'\fR, \fB\-w '\fR\fB\fIwhere_condition\fR\fR\fB'\fR .sp @@ -2594,8 +2594,8 @@ Examples: .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: xml option -.\" xml option: mysqldump +.\" mariadb-dump: xml option +.\" xml option: mariadb-dump \fB\-\-xml\fR, \fB\-X\fR .sp @@ -2630,23 +2630,23 @@ T} .TE .sp 1 The output from the -\fBmysql\fR +\fBmariadb\fR client when run using the \fB\-\-xml\fR option also follows the preceding rules\&. (See -the section called \(lqMYSQL OPTIONS\(rq\&.) +the section called \(lqMARIADB OPTIONS\(rq\&.) .sp XML output from -\fBmysqldump\fR +\fBmariadb-dump\fR includes the XML namespace, as shown here: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-xml \-u root world City\fR +shell> \fBmariadb-dump \-\-xml \-u root world City\fR - + @@ -2680,7 +2680,7 @@ Collation="latin1_swedish_ci" Create_options="" Comment="" /> - + .fi .if n \{\ .RE @@ -2737,7 +2737,7 @@ statements (as with the or \fB\-\-opt\fR option), -\fBmysqldump\fR +\fBmariadb-dump\fR creates rows up to net_buffer_length length\&. If you increase this variable, you should also ensure that the @@ -2746,14 +2746,14 @@ variable in the MariaDB server is at least this large\&. .RE .PP A common use of -\fBmysqldump\fR +\fBmariadb-dump\fR is for making a backup of an entire database: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file\&.sql\fR\fR +shell> \fBmariadb-dump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file\&.sql\fR\fR .fi .if n \{\ .RE @@ -2765,7 +2765,7 @@ You can load the dump file back into the server like this: .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file\&.sql\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file\&.sql\fR\fR .fi .if n \{\ .RE @@ -2777,20 +2777,20 @@ Or like this: .RS 4 .\} .nf -shell> \fBmysql \-e "source \fR\fB\fI/path\-to\-backup/backup\-file\&.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \-e "source \fR\fB\fI/path\-to\-backup/backup\-file\&.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE .\} .PP -\fBmysqldump\fR +\fBmariadb-dump\fR is also very useful for populating databases by copying data from one MariaDB server to another: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-opt \fR\fB\fIdb_name\fR\fR\fB | mysql \-\-host=\fR\fB\fIremote_host\fR\fR\fB \-C \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb-dump \-\-opt \fR\fB\fIdb_name\fR\fR\fB | mariadb \-\-host=\fR\fB\fIremote_host\fR\fR\fB \-C \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -2802,7 +2802,7 @@ It is possible to dump several databases with one command: .RS 4 .\} .nf -shell> \fBmysqldump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \&.\&.\&.] > my_databases\&.sql\fR +shell> \fBmariadb-dump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \&.\&.\&.] > my_databases\&.sql\fR .fi .if n \{\ .RE @@ -2816,7 +2816,7 @@ option: .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2825,14 +2825,14 @@ shell> \fBmysqldump \-\-all\-databases > all_databases\&.sql\fR For InnoDB tables, -\fBmysqldump\fR +\fBmariadb-dump\fR provides a way of making an online backup: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2851,7 +2851,7 @@ when you need to restore an old backup and replay the changes that happened sinc .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-master\-data=2 > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-master\-data=2 > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2863,7 +2863,7 @@ Or: .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR \fB> all_databases\&.sql\fR .fi .if n \{\ @@ -2878,15 +2878,15 @@ options can be used simultaneously, which provides a convenient way to make an o InnoDB storage engine\&. .PP -.\" mysqldump: views -.\" mysqldump: problems -.\" mysqldump: workarounds +.\" mariadb-dump: views +.\" mariadb-dump: problems +.\" mariadb-dump: workarounds .PP If you encounter problems backing up views, please read the section that covers restrictions on views which describes a workaround for backing up views when this fails due to insufficient privileges\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dumpslow.1 b/man/mariadb-dumpslow.1 index 960c634dded..d7d575e06e5 100644 --- a/man/mariadb-dumpslow.1 +++ b/man/mariadb-dumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMPSLOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-DUMPSLOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,20 +11,20 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqldumpslow +.\" mariadb-dumpslow .SH "NAME" -mariadb-dumpslow \- Summarize slow query log files (mysqldumpslow is now a symlink to mariadb-dumpslow) +mariadb-dumpslow \- Summarize slow query log files (mariadb-dumpslow is now a symlink to mariadb-dumpslow) .SH "SYNOPSIS" -.HP \w'\fBmysqldumpslow\ [\fR\fBoptions\fR\fB]\ [\fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.]\fR\ 'u -\fBmysqldumpslow [\fR\fBoptions\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR +.HP \w'\fBmariadb-dumpslow\ [\fR\fBoptions\fR\fB]\ [\fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.]\fR\ 'u +\fBmariadb-dumpslow [\fR\fBoptions\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR .SH "DESCRIPTION" .PP The MariaDB slow query log contains information about queries that take a long time to execute\&. -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR parses MariaDB slow query log files and prints a summary of their contents\&. .PP Normally, -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR groups queries that are similar except for the particular values of number and string data values\&. It \(lqabstracts\(rq these values to N and 'S' when displaying summary output\&. The @@ -34,20 +34,20 @@ and options can be used to modify value abstracting behavior\&. .PP Invoke -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldumpslow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-dumpslow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE .\} .PP -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR supports the following options\&. .sp .RS 4 @@ -58,8 +58,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: help option -.\" help option: mysqldumpslow +.\" mariadb-dumpslow: help option +.\" help option: mariadb-dumpslow \fB\-\-help\fR .sp Display a help message and exit\&. @@ -86,8 +86,8 @@ Do not abstract all numbers to N and strings to 'S'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: debug option -.\" debug option: mysqldumpslow +.\" mariadb-dumpslow: debug option +.\" debug option: mariadb-dumpslow \fB\-\-debug\fR, \fB\-d\fR .sp @@ -135,7 +135,7 @@ file name\&. The value can contain a wildcard\&. The default is \fB\-i \fR\fB\fIname\fR\fR .sp Name of server instance (if using -\fBmysql\&.server\fR +\fBmariadb\&.server\fR startup script)\&. .RE .sp @@ -289,8 +289,8 @@ queries in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: verbose option -.\" verbose option: mysqldumpslow +.\" mariadb-dumpslow: verbose option +.\" verbose option: mariadb-dumpslow \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -303,8 +303,8 @@ Example of usage: .RS 4 .\} .nf -shell> \fBmysqldumpslow\fR -Reading mysql slow query log from /usr/local/mysql/data/mysqld51\-apple\-slow\&.log +shell> \fBmariadb-dumpslow\fR +Reading mariadb slow query log from /usr/local/mysql/data/mysqld51\-apple\-slow\&.log Count: 1 Time=4\&.32s (4s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@localhost insert into t2 select * from t1 Count: 3 Time=2\&.53s (7s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@localhost @@ -318,7 +318,7 @@ Count: 3 Time=2\&.13s (6s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@local .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-find-rows.1 b/man/mariadb-find-rows.1 index c80490c23f0..d93972f016b 100644 --- a/man/mariadb-find-rows.1 +++ b/man/mariadb-find-rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIND-ROWS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-FIND-ROWS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,15 +11,15 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_find_rows +.\" mariadb-find-rows .SH "NAME" -mariadb-find-rows \- extract SQL statements from files (mysql_find_rows is now a symlink to mariadb-find-rows) +mariadb-find-rows \- extract SQL statements from files (mariadb-find-rows is now a symlink to mariadb-find-rows) .SH "SYNOPSIS" -.HP \w'\fBmysql_find_rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u -\fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR +.HP \w'\fBmariadb-find-rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u +\fBmariadb-find-rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR .SH "DESCRIPTION" .PP -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR reads files containing SQL statements and extracts statements that match a given regular expression or that contain USE \fIdb_name\fR or @@ -27,14 +27,14 @@ SET statements\&. The utility was written for use with update log files (as used prior to MySQL 5\&.0) and as such expects statements to be terminated with semicolon (;) characters\&. It may be useful with other files that contain SQL statements as long as statements are terminated with semicolons\&. .PP Invoke -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-find-rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE @@ -43,7 +43,7 @@ shell> \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\ Each \fIfile_name\fR argument should be the name of file containing SQL statements\&. If no file names are given, -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR reads the standard input\&. .PP Examples: @@ -52,14 +52,14 @@ Examples: .RS 4 .\} .nf -mysql_find_rows \-\-regexp=problem_table \-\-rows=20 < update\&.log -mysql_find_rows \-\-regexp=problem_table update\-log\&.1 update\-log\&.2 +mariadb-find-rows \-\-regexp=problem_table \-\-rows=20 < update\&.log +mariadb-find-rows \-\-regexp=problem_table update\-log\&.1 update\-log\&.2 .fi .if n \{\ .RE .\} .PP -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR supports the following options: .sp .RS 4 @@ -70,8 +70,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: help option -.\" help option: mysql_find_rows +.\" mariadb-find-rows: help option +.\" help option: mariadb-find-rows \fB\-\-help\fR, \fB\-\-Information\fR .sp @@ -86,8 +86,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: regexp option -.\" regexp option: mysql_find_rows +.\" mariadb-find-rows: regexp option +.\" regexp option: mariadb-find-rows \fB\-\-regexp=\fR\fB\fIpattern\fR\fR .sp Display queries that match the pattern\&. @@ -101,8 +101,8 @@ Display queries that match the pattern\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: rows option -.\" rows option: mysql_find_rows +.\" mariadb-find-rows: rows option +.\" rows option: mariadb-find-rows \fB\-\-rows=\fR\fB\fIN\fR\fR .sp Quit after displaying @@ -118,8 +118,8 @@ queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: skip-use-db option -.\" skip-use-db option: mysql_find_rows +.\" mariadb-find-rows: skip-use-db option +.\" skip-use-db option: mariadb-find-rows \fB\-\-skip\-use\-db\fR .sp Do not include @@ -135,8 +135,8 @@ statements in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: start_row option -.\" start_row option: mysql_find_rows +.\" mariadb-find-rows: start_row option +.\" start_row option: mariadb-find-rows \fB\-\-start_row=\fR\fB\fIN\fR\fR .sp Start output from this row\&. @@ -144,7 +144,7 @@ Start output from this row\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-fix-extensions.1 b/man/mariadb-fix-extensions.1 index 2313b9f6586..14e6975ac88 100644 --- a/man/mariadb-fix-extensions.1 +++ b/man/mariadb-fix-extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_fix_extensions +.\" mariadb-fix-extensions .SH "NAME" -mariadb-fix-extensions \- normalize table file name extensions (mysql_fix_extensions is now a symlink to mariadb-fix-extensions) +mariadb-fix-extensions \- normalize table file name extensions (mariadb-fix-extensions is now a symlink to mariadb-fix-extensions) .SH "SYNOPSIS" -.HP \w'\fBmysql_fix_extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u -\fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR +.HP \w'\fBmariadb-fix-extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u +\fBmariadb-fix-extensions \fR\fB\fIdata_dir\fR\fR .SH "DESCRIPTION" .PP This script is deprecated and will be removed in a later release. .PP -\fBmysql_fix_extensions\fR +\fBmariadb-fix-extensions\fR converts the extensions for MyISAM (or @@ -39,16 +39,16 @@ and renames them to have extensions of \&.ISM, respectively\&. This can be useful after transferring the files from a system with case\-insensitive file names (such as Windows) to a system with case\-sensitive file names\&. .PP Invoke -\fBmysql_fix_extensions\fR +\fBmariadb-fix-extensions\fR like this, where \fIdata_dir\fR -is the path name to the MySQL data directory\&. +is the path name to the MariaDB data directory\&. .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR +shell> \fBmariadb-fix-extensions \fR\fB\fIdata_dir\fR\fR .fi .if n \{\ .RE @@ -56,7 +56,7 @@ shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-hotcopy.1 b/man/mariadb-hotcopy.1 index 01f26c15ab5..94e4f9c1005 100644 --- a/man/mariadb-hotcopy.1 +++ b/man/mariadb-hotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-HOTCOPY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-HOTCOPY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,19 +11,19 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlhotcopy +.\" mariadb-hotcopy .\" dumping: databases and tables .\" backups: databases and tables .\" databases: dumping .\" tables: dumping .SH "NAME" -mariadb-hotcopy \- a database backup program (mysqlhotcopy is now a symlink to mariadb-hotcopy) +mariadb-hotcopy \- a database backup program (mariadb-hotcopy is now a symlink to mariadb-hotcopy) .SH "SYNOPSIS" -.HP \w'\fBmysqlhotcopy\ \fR\fB\fIarguments\fR\fR\ 'u -\fBmysqlhotcopy \fR\fB\fIarguments\fR\fR +.HP \w'\fBmariadb-hotcopy\ \fR\fB\fIarguments\fR\fR\ 'u +\fBmariadb-hotcopy \fR\fB\fIarguments\fR\fR .SH "DESCRIPTION" .PP -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR is a Perl script that was originally written and contributed by Tim Bunce\&. It uses FLUSH TABLES, LOCK TABLES, and @@ -31,7 +31,7 @@ cp or scp to make a database backup\&. It is a fast way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located\&. -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR works only for backing up MyISAM and @@ -39,7 +39,7 @@ ARCHIVE tables\&. It runs on Unix and NetWare\&. .PP To use -\fBmysqlhotcopy\fR, you must have read access to the files for the tables that you are backing up, the +\fBmariadb-hotcopy\fR, you must have read access to the files for the tables that you are backing up, the SELECT privilege for those tables, the RELOAD @@ -52,7 +52,7 @@ privilege (to be able to lock the tables)\&. .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_directory\fR\fR\fB]\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_directory\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -62,7 +62,7 @@ shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_director .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name_1\fR\fR\fB \&.\&.\&. \fR\fB\fIdb_name_n\fR\fR\fB \fR\fB\fI/path/to/new_directory\fR\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name_1\fR\fR\fB \&.\&.\&. \fR\fB\fIdb_name_n\fR\fR\fB \fR\fB\fI/path/to/new_directory\fR\fR .fi .if n \{\ .RE @@ -74,7 +74,7 @@ Back up tables in the given database that match a regular expression: .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB\&./\fR\fB\fIregex\fR\fR\fB/\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB\&./\fR\fB\fIregex\fR\fR\fB/\fR .fi .if n \{\ .RE @@ -86,15 +86,15 @@ The regular expression for the table name can be negated by prefixing it with a .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB\&./~\fR\fB\fIregex\fR\fR\fB/\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB\&./~\fR\fB\fIregex\fR\fR\fB/\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR supports the following options, which can be specified on the command line or in the -[mysqlhotcopy] +[mariadb-hotcopy] and [client] option file groups\&. @@ -107,8 +107,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: help option -.\" help option: mysqlhotcopy +.\" mariadb-hotcopy: help option +.\" help option: mariadb-hotcopy \fB\-\-help\fR, \fB\-?\fR .sp @@ -123,8 +123,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: addtodest option -.\" addtodest option: mysqlhotcopy +.\" mariadb-hotcopy: addtodest option +.\" addtodest option: mariadb-hotcopy \fB\-\-addtodest\fR .sp Do not rename target directory (if it exists); merely add files to it\&. @@ -138,8 +138,8 @@ Do not rename target directory (if it exists); merely add files to it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: allowold option -.\" allowold option: mysqlhotcopy +.\" mariadb-hotcopy: allowold option +.\" allowold option: mariadb-hotcopy \fB\-\-allowold\fR .sp Do not abort if a target exists; rename it by adding an @@ -155,8 +155,8 @@ suffix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: checkpoint option -.\" checkpoint option: mysqlhotcopy +.\" mariadb-hotcopy: checkpoint option +.\" checkpoint option: mariadb-hotcopy \fB\-\-checkpoint=\fR\fB\fIdb_name\fR\fR\fB\&.\fR\fB\fItbl_name\fR\fR .sp Insert checkpoint entries into the specified database @@ -173,20 +173,20 @@ and table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: chroot option -.\" chroot option: mysqlhotcopy +.\" mariadb-hotcopy: chroot option +.\" chroot option: mariadb-hotcopy \fB\-\-chroot=\fR\fB\fIpath\fR\fR .sp Base directory of the \fBchroot\fR jail in which -\fBmysqld\fR +\fBmariadbd\fR operates\&. The \fIpath\fR value should match that of the \fB\-\-chroot\fR option given to -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .RE .sp .RS 4 @@ -197,8 +197,8 @@ option given to .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: debug option -.\" debug option: mysqlhotcopy +.\" mariadb-hotcopy: debug option +.\" debug option: mariadb-hotcopy \fB\-\-debug\fR .sp Enable debug output\&. @@ -212,8 +212,8 @@ Enable debug output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: dryrun option -.\" dryrun option: mysqlhotcopy +.\" mariadb-hotcopy: dryrun option +.\" dryrun option: mariadb-hotcopy \fB\-\-dryrun\fR, \fB\-n\fR .sp @@ -228,8 +228,8 @@ Report actions without performing them\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: flushlog option -.\" flushlog option: mysqlhotcopy +.\" mariadb-hotcopy: flushlog option +.\" flushlog option: mariadb-hotcopy \fB\-\-flushlog\fR .sp Flush logs after all tables are locked\&. @@ -243,8 +243,8 @@ Flush logs after all tables are locked\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: host option -.\" host option: mysqlhotcopy +.\" mariadb-hotcopy: host option +.\" host option: mariadb-hotcopy \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -261,8 +261,8 @@ using a Unix socket file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: keepold option -.\" keepold option: mysqlhotcopy +.\" mariadb-hotcopy: keepold option +.\" keepold option: mariadb-hotcopy \fB\-\-keepold\fR .sp Do not delete previous (renamed) target when done\&. @@ -276,8 +276,8 @@ Do not delete previous (renamed) target when done\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: method option -.\" method option: mysqlhotcopy +.\" mariadb-hotcopy: method option +.\" method option: mariadb-hotcopy \fB\-\-method=\fR\fB\fIcommand\fR\fR .sp The method for copying files (cp @@ -294,8 +294,8 @@ cp\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: noindices option -.\" noindices option: mysqlhotcopy +.\" mariadb-hotcopy: noindices option +.\" noindices option: mariadb-hotcopy \fB\-\-noindices\fR .sp Do not include full index files for @@ -312,8 +312,8 @@ tables in the backup\&. This makes the backup smaller and faster\&. The indexes .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: old-server option -.\" old-server option: mysqlhotcopy +.\" mariadb-hotcopy: old-server option +.\" old-server option: mariadb-hotcopy \fB\-\-old\-server\fR .sp Connect to old MySQL-server (before v5.5) which doesn't have FLUSH TABLES WITH READ LOCK fully implemented.\&. @@ -327,8 +327,8 @@ Connect to old MySQL-server (before v5.5) which doesn't have FLUSH TABLES WITH R .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: password option -.\" password option: mysqlhotcopy +.\" mariadb-hotcopy: password option +.\" password option: mariadb-hotcopy \fB\-\-password=\fR\fB\fIpassword\fR\fR, \fB\-p\fR\fB\fIpassword\fR\fR .sp @@ -345,8 +345,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: port option -.\" port option: mysqlhotcopy +.\" mariadb-hotcopy: port option +.\" port option: mariadb-hotcopy \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -361,8 +361,8 @@ The TCP/IP port number to use when connecting to the local server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: quiet option -.\" quiet option: mysqlhotcopy +.\" mariadb-hotcopy: quiet option +.\" quiet option: mariadb-hotcopy \fB\-\-quiet\fR, \fB\-q\fR .sp @@ -377,8 +377,8 @@ Be silent except for errors\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: record_log_pos option -.\" record_log_pos option: mysqlhotcopy +.\" mariadb-hotcopy: record_log_pos option +.\" record_log_pos option: mariadb-hotcopy \fB\-\-record_log_pos=\fR\fB\fIdb_name\fR\fR\fB\&.\fR\fB\fItbl_name\fR\fR .sp Record master and slave status in the specified database @@ -395,8 +395,8 @@ and table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: regexp option -.\" regexp option: mysqlhotcopy +.\" mariadb-hotcopy: regexp option +.\" regexp option: mariadb-hotcopy \fB\-\-regexp=\fR\fB\fIexpr\fR\fR .sp Copy all databases with names that match the given regular expression\&. @@ -410,8 +410,8 @@ Copy all databases with names that match the given regular expression\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: resetmaster option -.\" resetmaster option: mysqlhotcopy +.\" mariadb-hotcopy: resetmaster option +.\" resetmaster option: mariadb-hotcopy \fB\-\-resetmaster\fR .sp Reset the binary log after locking all the tables\&. @@ -425,8 +425,8 @@ Reset the binary log after locking all the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: resetslave option -.\" resetslave option: mysqlhotcopy +.\" mariadb-hotcopy: resetslave option +.\" resetslave option: mariadb-hotcopy \fB\-\-resetslave\fR .sp Reset the @@ -442,8 +442,8 @@ file after locking all the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: socket option -.\" socket option: mysqlhotcopy +.\" mariadb-hotcopy: socket option +.\" socket option: mariadb-hotcopy \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -459,8 +459,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: suffix option -.\" suffix option: mysqlhotcopy +.\" mariadb-hotcopy: suffix option +.\" suffix option: mariadb-hotcopy \fB\-\-suffix=\fR\fB\fIstr\fR\fR .sp The suffix to use for names of copied databases\&. @@ -474,8 +474,8 @@ The suffix to use for names of copied databases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: tmpdir option -.\" tmpdir option: mysqlhotcopy +.\" mariadb-hotcopy: tmpdir option +.\" tmpdir option: mariadb-hotcopy \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR .sp The temporary directory\&. The default is @@ -490,8 +490,8 @@ The temporary directory\&. The default is .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: user option -.\" user option: mysqlhotcopy +.\" mariadb-hotcopy: user option +.\" user option: mariadb-hotcopy \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -501,7 +501,7 @@ The MariaDB user name to use when connecting to the server\&. Use perldoc for additional -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR documentation, including information about the structure of the tables needed for the \fB\-\-checkpoint\fR and @@ -512,7 +512,7 @@ options: .RS 4 .\} .nf -shell> \fBperldoc mysqlhotcopy\fR +shell> \fBperldoc mariadb-hotcopy\fR .fi .if n \{\ .RE @@ -520,7 +520,7 @@ shell> \fBperldoc mysqlhotcopy\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-import.1 b/man/mariadb-import.1 index 99578950ad3..2c23aca8d17 100644 --- a/man/mariadb-import.1 +++ b/man/mariadb-import.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-IMPORT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-IMPORT\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,44 +11,44 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlimport +.\" mariadb-import .\" importing: data .\" data: importing .\" files: text .\" text files: importing .SH "NAME" -mariadb-import \- a data import program (mysqlimport is now a symlink to mariadb-import) +mariadb-import \- a data import program (mariadb-import is now a symlink to mariadb-import) .SH "SYNOPSIS" -.HP \w'\fBmysqlimport\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \fR\fB\fItextfile1\fR\fR\fB\ \&.\&.\&.\fR\ 'u -\fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB \&.\&.\&.\fR +.HP \w'\fBmariadb-import\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \fR\fB\fItextfile1\fR\fR\fB\ \&.\&.\&.\fR\ 'u +\fBmariadb-import [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP The -\fBmysqlimport\fR +\fBmariadb-import\fR client provides a command\-line interface to the LOAD DATA INFILE SQL statement\&. Most options to -\fBmysqlimport\fR +\fBmariadb-import\fR correspond directly to clauses of LOAD DATA INFILE syntax\&. .PP Invoke -\fBmysqlimport\fR +\fBmariadb-import\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB [\fR\fB\fItextfile2\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-import [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB [\fR\fB\fItextfile2\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE .\} .PP For each text file named on the command line, -\fBmysqlimport\fR +\fBmariadb-import\fR strips any extension from the file name and uses the result to determine the name of the table into which to import the file's contents\&. For example, files named patient\&.txt, patient\&.text, and @@ -57,13 +57,13 @@ all would be imported into a table named patient\&. .PP .PP -\fBmysqlimport\fR +\fBmariadb-import\fR supports the following options, which can be specified on the command line or in the -[mysqlimport] +[mariadb-import] and [client] option file groups\&. -\fBmysqlimport\fR +\fBmariadb-import\fR also supports the options for processing option files\&. .sp .RS 4 @@ -74,8 +74,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: help option -.\" help option: mysqlimport +.\" mariadb-import: help option +.\" help option: mariadb-import \fB\-\-help\fR, \fB\-?\fR .sp @@ -90,8 +90,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: character-sets-dir option -.\" character-sets-dir option: mysqlimport +.\" mariadb-import: character-sets-dir option +.\" character-sets-dir option: mariadb-import \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -105,8 +105,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: columns option -.\" columns option: mysqlimport +.\" mariadb-import: columns option +.\" columns option: mariadb-import \fB\-\-columns=\fR\fB\fIcolumn_list\fR\fR, \fB\-c \fR\fB\fIcolumn_list\fR\fR .sp @@ -121,8 +121,8 @@ This option takes a comma\-separated list of column names as its value\&. The or .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: compress option -.\" compress option: mysqlimport +.\" mariadb-import: compress option +.\" compress option: mariadb-import \fB\-\-compress\fR, \fB\-C\fR .sp @@ -137,8 +137,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug option -.\" debug option: mysqlimport +.\" mariadb-import: debug option +.\" debug option: mariadb-import \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -155,8 +155,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug-check option -.\" debug-check option: mysqlimport +.\" mariadb-import: debug-check option +.\" debug-check option: mariadb-import \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -170,8 +170,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug-info option -.\" debug-info option: mysqlimport +.\" mariadb-import: debug-info option +.\" debug-info option: mariadb-import \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -185,8 +185,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: default-auth option -.\" default-auth option: mysqlimport +.\" mariadb-import: default-auth option +.\" default-auth option: mariadb-import \fB\-\-default\-auth=\fIplugin_name\fR .sp Default authentication client-side plugin to use\&. @@ -200,8 +200,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: default-character-set option -.\" default-character-set option: mysqlimport +.\" mariadb-import: default-character-set option +.\" default-character-set option: mariadb-import \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -217,8 +217,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: defaults-extra-file option -.\" defaults-extra-file option: mysqlimport +.\" mariadb-import: defaults-extra-file option +.\" defaults-extra-file option: mariadb-import \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -233,8 +233,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: defaults-file option -.\" defaults-file option: mysqlimport +.\" mariadb-import: defaults-file option +.\" defaults-file option: mariadb-import \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -249,8 +249,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: delete option -.\" delete option: mysqlimport +.\" mariadb-import: delete option +.\" delete option: mariadb-import \fB\-\-delete\fR, \fB\-d\fR .sp @@ -265,17 +265,17 @@ Empty the table before importing the text file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: fields-terminated-by option -.\" fields-terminated-by option: mysqlimport +.\" mariadb-import: fields-terminated-by option +.\" fields-terminated-by option: mariadb-import \fB\-\-fields\-terminated\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-enclosed-by option -.\" fields-enclosed-by option: mysqlimport +.\" mariadb-import: fields-enclosed-by option +.\" fields-enclosed-by option: mariadb-import \fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-optionally-enclosed-by option -.\" fields-optionally-enclosed-by option: mysqlimport +.\" mariadb-import: fields-optionally-enclosed-by option +.\" fields-optionally-enclosed-by option: mariadb-import \fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-escaped-by option -.\" fields-escaped-by option: mysqlimport +.\" mariadb-import: fields-escaped-by option +.\" fields-escaped-by option: mariadb-import \fB\-\-fields\-escaped\-by=\&.\&.\&.\fR .sp These options have the same meaning as the corresponding clauses for @@ -290,14 +290,14 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: force option -.\" force option: mysqlimport +.\" mariadb-import: force option +.\" force option: mariadb-import \fB\-\-force\fR, \fB\-f\fR .sp Ignore errors\&. For example, if a table for a text file does not exist, continue processing any remaining files\&. Without \fB\-\-force\fR, -\fBmysqlimport\fR +\fBmariadb-import\fR exits if a table does not exist\&. .RE .sp @@ -309,8 +309,8 @@ exits if a table does not exist\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: host option -.\" host option: mysqlimport +.\" mariadb-import: host option +.\" host option: mariadb-import \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -326,8 +326,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore option -.\" ignore option: mysqlimport +.\" mariadb-import: ignore option +.\" ignore option: mariadb-import \fB\-\-ignore\fR, \fB\-i\fR .sp @@ -344,8 +344,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore-foreign-keys option -.\" ignore-foreign-keys option: mysqlimport +.\" mariadb-import: ignore-foreign-keys option +.\" ignore-foreign-keys option: mariadb-import \fB\-\-ignore\-foreign\-keys\fR, \fB\-k\fR .sp @@ -360,8 +360,8 @@ Disable foreign key checks while importing the data\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore-lines option -.\" ignore-lines option: mysqlimport +.\" mariadb-import: ignore-lines option +.\" ignore-lines option: mariadb-import \fB\-\-ignore\-lines=\fR\fB\fIN\fR\fR .sp Ignore the first @@ -377,8 +377,8 @@ lines of the data file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: lines-terminated-by option -.\" lines-terminated-by option: mysqlimport +.\" mariadb-import: lines-terminated-by option +.\" lines-terminated-by option: mariadb-import \fB\-\-lines\-terminated\-by=\&.\&.\&.\fR .sp This option has the same meaning as the corresponding clause for @@ -394,8 +394,8 @@ LOAD DATA INFILE\&. For example, to import Windows files that have lines termina .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: local option -.\" local option: mysqlimport +.\" mariadb-import: local option +.\" local option: mariadb-import \fB\-\-local\fR, \fB\-L\fR .sp @@ -410,8 +410,8 @@ Read input files locally from the client host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: lock-tables option -.\" lock-tables option: mysqlimport +.\" mariadb-import: lock-tables option +.\" lock-tables option: mariadb-import \fB\-\-lock\-tables\fR, \fB\-l\fR .sp @@ -428,8 +428,8 @@ tables for writing before processing any text files\&. This ensures that all tab .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: low-priority option -.\" low-priority option: mysqlimport +.\" mariadb-import: low-priority option +.\" low-priority option: mariadb-import \fB\-\-low\-priority\fR .sp Use @@ -448,8 +448,8 @@ MERGE)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: no-defaults option -.\" no-defaults option: mysqlimport +.\" mariadb-import: no-defaults option +.\" no-defaults option: mariadb-import \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -464,8 +464,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: password option -.\" password option: mysqlimport +.\" mariadb-import: password option +.\" password option: mariadb-import \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -478,7 +478,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlimport\fR +\fBmariadb-import\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -492,8 +492,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: pipe option -.\" pipe option: mysqlimport +.\" mariadb-import: pipe option +.\" pipe option: mariadb-import \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -508,8 +508,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: plugin-dir option -.\" plugin-dir option: mysqlimport +.\" mariadb-import: plugin-dir option +.\" plugin-dir option: mariadb-import \fB\-\-plugin\-dir=\fR\fB\fIname\fR\fR .sp Directory for client-side plugins\&. @@ -523,8 +523,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: port option -.\" port option: mysqlimport +.\" mariadb-import: port option +.\" port option: mariadb-import \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -540,8 +540,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: protocol option -.\" protocol option: mysqlimport +.\" mariadb-import: protocol option +.\" protocol option: mariadb-import \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -555,8 +555,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: print-defaults option -.\" print-defaults option: mysqlimport +.\" mariadb-import: print-defaults option +.\" print-defaults option: mariadb-import \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -571,8 +571,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: replace option -.\" replace option: mysqlimport +.\" mariadb-import: replace option +.\" replace option: mariadb-import \fB\-\-replace\fR, \fB\-r\fR .sp @@ -593,8 +593,8 @@ options control handling of input rows that duplicate existing rows on unique ke .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: silent option -.\" silent option: mysqlimport +.\" mariadb-import: silent option +.\" silent option: mariadb-import \fB\-\-silent\fR, \fB\-s\fR .sp @@ -609,8 +609,8 @@ Silent mode\&. Produce output only when errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: socket option -.\" socket option: mysqlimport +.\" mariadb-import: socket option +.\" socket option: mariadb-import \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -627,8 +627,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-import: SSL options +.\" SSL options: mariadb-import \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -643,8 +643,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-import: SSL CA option +.\" SSL CA option: mariadb-import \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -659,8 +659,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-import: SSL CA Path option +.\" SSL CA Path option: mariadb-import \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -675,8 +675,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-import: SSL Cert option +.\" SSL Cert option: mariadb-import \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -691,8 +691,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-import: SSL Cipher option +.\" SSL Cipher option: mariadb-import \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -707,8 +707,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-import: SSL Key option +.\" SSL Key option: mariadb-import \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -723,8 +723,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-import: SSL Crl option +.\" SSL CRL option: mariadb-import \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -739,8 +739,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-import: SSL Crlpath option +.\" SSL Crlpath option: mariadb-import \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -755,8 +755,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-import: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-import \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -770,8 +770,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: user option -.\" user option: mysqlimport +.\" mariadb-import: user option +.\" user option: mariadb-import \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -786,8 +786,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: use-threads option -.\" use-threads option: mysqlimport +.\" mariadb-import: use-threads option +.\" use-threads option: mariadb-import \fB\-\-use\-threads=\fR\fB\fIN\fR\fR .sp Load files in parallel using @@ -803,8 +803,8 @@ threads\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: verbose option -.\" verbose option: mysqlimport +.\" mariadb-import: verbose option +.\" verbose option: mariadb-import \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -819,8 +819,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: version option -.\" version option: mysqlimport +.\" mariadb-import: version option +.\" version option: mariadb-import \fB\-\-version\fR, \fB\-V\fR .sp @@ -828,13 +828,13 @@ Display version information and exit\&. .RE .PP Here is a sample session that demonstrates use of -\fBmysqlimport\fR: +\fBmariadb-import\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR +shell> \fBmariadb \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR shell> \fBed\fR a 100 Max Sydow @@ -847,9 +847,9 @@ shell> \fBod \-c imptest\&.txt\fR 0000000 1 0 0 \et M a x S y d o w \en 1 0 0000020 1 \et C o u n t D r a c u l a \en 0000040 -shell> \fBmysqlimport \-\-local test imptest\&.txt\fR +shell> \fBmariadb-import \-\-local test imptest\&.txt\fR test\&.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 -shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR +shell> \fBmariadb \-e 'SELECT * FROM imptest' test\fR +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | id | n | +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -863,7 +863,7 @@ shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-install-db.1 b/man/mariadb-install-db.1 index f945c259748..53ff26bdeae 100644 --- a/man/mariadb-install-db.1 +++ b/man/mariadb-install-db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-INSTALL-DB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-INSTALL-DB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,54 +11,54 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_install_db +.\" mariadb-install-db .SH "NAME" -mariadb-install-db \- initialize MariaDB data directory (mysql_install_db is now a symlink to mariadb-install-db) +mariadb-install-db \- initialize MariaDB data directory (mariadb-install-db is now a symlink to mariadb-install-db) .SH "SYNOPSIS" -.HP \w'\fBmysql_install_db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-install-db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-install-db [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR initializes the MariaDB data directory and creates the system tables that it contains, if they do not exist\&. .PP To invoke -\fBmysql_install_db\fR, use the following syntax: +\fBmariadb-install-db\fR, use the following syntax: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-install-db [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP Because the MariaDB server, -\fBmysqld\fR, needs to access the data directory when it runs later, you should either run -\fBmysql_install_db\fR +\fBmariadbd\fR, needs to access the data directory when it runs later, you should either run +\fBmariadb-install-db\fR from the same account that will be used for running -\fBmysqld\fR +\fBmariadbd\fR or run it as root and use the \fB\-\-user\fR option to indicate the user name that -\fBmysqld\fR +\fBmariadbd\fR will run as\&. It might be necessary to specify other options such as \fB\-\-basedir\fR or \fB\-\-datadir\fR if -\fBmysql_install_db\fR +\fBmariadb-install-db\fR does not use the correct locations for the installation directory or data directory\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBbin/mysql_install_db \-\-user=mysql \e\fR +shell> \fBbin/mariadb-install-db \-\-user=mysql \e\fR \fB\-\-basedir=/opt/mysql/mysql \e\fR \fB\-\-datadir=/opt/mysql/mysql/data\fR .fi @@ -66,9 +66,9 @@ shell> \fBbin/mysql_install_db \-\-user=mysql \e\fR .RE .\} .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR needs to invoke -\fBmysqld\fR +\fBmariadbd\fR with the \fB\-\-bootstrap\fR and @@ -81,17 +81,17 @@ option, and \fB\-\-skip\-grant\-tables\fR will be disabled\&. To handle this, set the -MYSQLD_BOOTSTRAP +mariadbd_BOOTSTRAP environment variable to the full path name of a server that has all options enabled\&. -\fBmysql_install_db\fR +\fBmariadb-install-db\fR will use that server\&. .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR supports the following options, which can be specified on the command line or in the -[mysql_install_db] +[mariadb-install-db] and (if they are common to -\fBmysqld\fR) -[mysqld] +\fBmariadbd\fR) +[mariadbd] option file groups\&. .sp .RS 4 @@ -102,8 +102,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: basedir option -.\" basedir option: mysql_install_db +.\" mariadb-install-db: basedir option +.\" basedir option: mariadb-install-db \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp The path to the MariaDB installation directory\&. @@ -117,8 +117,8 @@ The path to the MariaDB installation directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: builddir option -.\" builddir option: mysql_install_db +.\" mariadb-install-db: builddir option +.\" builddir option: mariadb-install-db \fB\-\-builddir=\fIpath\fR .sp If using \fB--srcdir\fR with out-of-directory builds, you will need to set this @@ -133,8 +133,8 @@ to the location of the build directory where built files reside.\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: cross-bootstrap option -.\" cross-bootstrap option: mysql_install_db +.\" mariadb-install-db: cross-bootstrap option +.\" cross-bootstrap option: mariadb-install-db \fB\-\-cross\-bootstrap\fR .sp For internal use. Used when building the MariaDB system tables on a different host than the target.\&. @@ -148,10 +148,10 @@ For internal use. Used when building the MariaDB system tables on a different ho .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: datadir option -.\" datadir option: mysql_install_db -.\" mysql_install_db: ldata option -.\" ldata option: mysql_install_db +.\" mariadb-install-db: datadir option +.\" datadir option: mariadb-install-db +.\" mariadb-install-db: ldata option +.\" ldata option: mariadb-install-db \fB\-\-datadir=\fR\fB\fIpath\fR\fR, \fB\-\-ldata=\fR\fB\fIpath\fR\fR .sp @@ -166,8 +166,8 @@ The path to the MariaDB data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-extra-file option -.\" defaults-extra-file option: mysqlcheck +.\" mariadb-install-db: defaults-extra-file option +.\" defaults-extra-file option: mariadb-install-db \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -182,8 +182,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-file option -.\" defaults-file option: mysqlcheck +.\" mariadb-install-db: defaults-file option +.\" defaults-file option: mariadb-install-db \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -198,8 +198,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: defaults-group-suffix option -.\" defaults-group-suffix option: mysql_install_db +.\" mariadb-install-db: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb-install-db \fB\-\-defaults\-group\-suffix=\fR\fB\fIname\fR\fR .sp In addition to the given groups, also read groups with this suffix\&. @@ -213,12 +213,12 @@ In addition to the given groups, also read groups with this suffix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: force option -.\" force option: mysql_install_db +.\" mariadb-install-db: force option +.\" force option: mariadb-install-db \fB\-\-force\fR .sp Cause -\fBmysql_install_db\fR +\fBmariadb-install-db\fR to run even if DNS does not work\&. In that case, grant table entries that normally use host names will use IP addresses\&. .RE .sp @@ -230,8 +230,8 @@ to run even if DNS does not work\&. In that case, grant table entries that norma .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: help option -.\" help option: mysqlcheck +.\" mariadb-install-db: help option +.\" help option: mariadb-install-db \fB\-\-help\fR .sp Display a help message and exit\&. @@ -245,8 +245,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: no-defaults option -.\" no-defaults option: mysqlcheck +.\" mariadb-install-db: no-defaults option +.\" no-defaults option: mariadb-install-db \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -260,8 +260,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: print-defaults option -.\" print-defaults option: mysqlcheck +.\" mariadb-install-db: print-defaults option +.\" print-defaults option: mariadb-install-db \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -276,8 +276,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: rpm option -.\" rpm option: mysql_install_db +.\" mariadb-install-db: rpm option +.\" rpm option: mariadb-install-db \fB\-\-rpm\fR .sp For internal use\&. This option is used by RPM files during the MariaDB installation process\&. @@ -291,8 +291,8 @@ For internal use\&. This option is used by RPM files during the MariaDB installa .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: skip-name-resolve option -.\" skip-name-resolve option: mysql_install_db +.\" mariadb-install-db: skip-name-resolve option +.\" skip-name-resolve option: mariadb-install-db \fB\-\-skip\-name\-resolve\fR .sp Use IP addresses rather than host names when creating grant table entries\&. This option can be useful if your DNS does not work\&. @@ -306,12 +306,12 @@ Use IP addresses rather than host names when creating grant table entries\&. Thi .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: srcdir option -.\" srcdir option: mysql_install_db +.\" mariadb-install-db: srcdir option +.\" srcdir option: mariadb-install-db \fB\-\-srcdir=\fR\fB\fIpath\fR\fR .sp For internal use\&. The directory under which -\fBmysql_install_db\fR +\fBmariadb-install-db\fR looks for support files such as the error message file and the file for populating the help tables\&.4\&. .RE .sp @@ -323,17 +323,17 @@ looks for support files such as the error message file and the file for populati .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: user option -.\" user option: mysql_install_db +.\" mariadb-install-db: user option +.\" user option: mariadb-install-db \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The login user name to use for running -\fBmysqld\fR\&. Files and directories created by -\fBmysqld\fR +\fBmariadbd\fR\&. Files and directories created by +\fBmariadbd\fR will be owned by this user\&. You must be root to use this option\&. By default, -\fBmysqld\fR +\fBmariadbd\fR runs using your current login name and files and directories that it creates will be owned by you\&. .RE .sp @@ -345,8 +345,8 @@ runs using your current login name and files and directories that it creates wil .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: extra-file option -.\" extra-file option: mysql_install_db +.\" mariadb-install-db: extra-file option +.\" extra-file option: mariadb-install-db \fB\-\-extra-file=\fR\fB\fIfile_path\fR\fR .sp Add user defined SQL file, to be executed following regular database initialization. @@ -360,8 +360,8 @@ Add user defined SQL file, to be executed following regular database initializat .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: verbose option -.\" verbose option: mysql_install_db +.\" mariadb-install-db: verbose option +.\" verbose option: mariadb-install-db \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -375,8 +375,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: windows option -.\" windows option: mysql_install_db +.\" mariadb-install-db: windows option +.\" windows option: mariadb-install-db \fB\-\-windows\fR .sp For internal use\&. This option is used for creating Windows distributions\&. @@ -384,7 +384,7 @@ For internal use\&. This option is used for creating Windows distributions\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-plugin.1 b/man/mariadb-plugin.1 index 0512bb50ed2..a383d99da1e 100644 --- a/man/mariadb-plugin.1 +++ b/man/mariadb-plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-PLUGIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-PLUGIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -20,16 +20,16 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_plugin +.\" mariadb-plugin .SH "NAME" -mariadb-plugin \- configure MariaDB server plugins (mysql_plugin is now a symlink to mariadb-plugin) +mariadb-plugin \- configure MariaDB server plugins (mariadb-plugin is now a symlink to mariadb-plugin) .SH "SYNOPSIS" -.HP \w'\fBmysql_plugin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIplugin\fR\fR\fB\ {ENABLE|DISABLE}\fR\ 'u -\fBmysql_plugin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIplugin\fR\fR\fB {ENABLE|DISABLE}\fR +.HP \w'\fBmariadb-plugin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIplugin\fR\fR\fB\ {ENABLE|DISABLE}\fR\ 'u +\fBmariadb-plugin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIplugin\fR\fR\fB {ENABLE|DISABLE}\fR .SH "DESCRIPTION" .PP The -\fBmysql_plugin\fR +\fBmariadb-plugin\fR utility enables MariaDB administrators to manage which plugins a MariaDB server loads\&. It provides an alternative to manually specifying the \fB\-\-plugin\-load\fR option at server startup or using the @@ -39,11 +39,11 @@ UNINSTALL PLUGIN statements at runtime\&. .PP Depending on whether -\fBmysql_plugin\fR +\fBmariadb-plugin\fR is invoked to enable or disable plugins, it inserts or deletes rows in the mysql\&.plugin table that serves as a plugin registry\&. (To perform this operation, -\fBmysql_plugin\fR +\fBmariadb-plugin\fR invokes the MariaDB server in bootstrap mode\&. This means that the server must not already be running\&.) For normal server startups, the server loads and enables plugins listed in mysql\&.plugin automatically\&. For additional control over plugin activation, use @@ -51,15 +51,15 @@ automatically\&. For additional control over plugin activation, use options named for specific plugins\&. .PP Each invocation of -\fBmysql_plugin\fR +\fBmariadb-plugin\fR reads a configuration file to determine how to configure the plugins contained in a single plugin library object file\&. To invoke -\fBmysql_plugin\fR, use this syntax: +\fBmariadb-plugin\fR, use this syntax: .sp .if n \{\ .RS 4 .\} .nf -mysql_plugin [\fIoptions\fR] \fIplugin\fR {ENABLE|DISABLE} +mariadb-plugin [\fIoptions\fR] \fIplugin\fR {ENABLE|DISABLE} .fi .if n \{\ .RE @@ -89,7 +89,7 @@ myplugins\&. Suppose that this plugin library contains three plugins, plugin1, plugin2, and plugin3, all of which should be configured under -\fBmysql_plugin\fR +\fBmariadb-plugin\fR control\&. By convention, configuration files have a suffix of \&.ini and the same basename as the plugin library, so the default configuration file name for this plugin library is @@ -118,14 +118,14 @@ or are taken as comments and ignored\&. .PP To enable the plugins listed in the configuration file, invoke -\fBmysql_plugin\fR +\fBmariadb-plugin\fR this way: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_plugin myplugins ENABLE\fR +shell> \fBmariadb-plugin myplugins ENABLE\fR .fi .if n \{\ .RE @@ -137,25 +137,25 @@ rather than ENABLE\&. .PP An error occurs if -\fBmysql_plugin\fR +\fBmariadb-plugin\fR cannot find the configuration file or plugin library file, or if -\fBmysql_plugin\fR +\fBmariadb-plugin\fR cannot start the MariaDB server\&. .PP -\fBmysql_plugin\fR +\fBmariadb-plugin\fR supports the following options, which can be specified on the command line or in the -[mysqld] +[mariadbd] group of any option file\&. For options specified in a -[mysqld] +[mariadbd] group, -\fBmysql_plugin\fR +\fBmariadb-plugin\fR recognizes the \fB\-\-basedir\fR, \fB\-\-datadir\fR, and \fB\-\-plugin\-dir\fR options and ignores others\&. .PP -mysql_plugin Options +mariadb-plugin Options .sp .RS 4 .ie n \{\ @@ -165,8 +165,8 @@ mysql_plugin Options .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: help option -.\" help option: mysql_plugin +.\" mariadb-plugin: help option +.\" help option: mariadb-plugin \fB\-\-help\fR, \fB\-?\fR .sp @@ -181,8 +181,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: basedir option -.\" basedir option: mysql_plugin +.\" mariadb-plugin: basedir option +.\" basedir option: mariadb-plugin \fB\-\-basedir=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp @@ -197,8 +197,8 @@ The server base directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: datadir option -.\" datadir option: mysql_plugin +.\" mariadb-plugin: datadir option +.\" datadir option: mariadb-plugin \fB\-\-datadir=\fR\fB\fIpath\fR\fR, \fB\-d \fR\fB\fIpath\fR\fR .sp @@ -213,8 +213,8 @@ The server data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: my-print-defaults option -.\" my-print-defaults option: mysql_plugin +.\" mariadb-plugin: my-print-defaults option +.\" my-print-defaults option: mariadb-plugin \fB\-\-my\-print\-defaults=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp @@ -231,13 +231,13 @@ program\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: mysqld option -.\" mysqld option: mysql_plugin -\fB\-\-mysqld=\fR\fB\fIpath\fR\fR, +.\" mariadb-plugin: mariadbd option +.\" mariadbd option: mariadb-plugin +\fB\-\-mariadbd=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp The path to the -\fBmysqld\fR +\fBmariadbd\fR server\&. .RE .sp @@ -249,15 +249,15 @@ server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: no-defaults option -.\" no-defaults option: mysql_plugin +.\" mariadb-plugin: no-defaults option +.\" no-defaults option: mariadb-plugin \fB\-\-no\-defaults\fR, \fB\-p\fR .sp Do not read values from the configuration file\&. This option enables an administrator to skip reading defaults from the configuration file\&. .sp With -\fBmysql_plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support +\fBmariadb-plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support \fB\-\-no\-defaults\fR\&. .RE .sp @@ -269,8 +269,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: plugin-dir option -.\" plugin-dir option: mysql_plugin +.\" mariadb-plugin: plugin-dir option +.\" plugin-dir option: mariadb-plugin \fB\-\-plugin\-dir=\fR\fB\fIpath\fR\fR, \fB\-p \fR\fB\fIpath\fR\fR .sp @@ -285,13 +285,13 @@ The server plugin directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: plugin-ini option -.\" plugin-ini option: mysql_plugin +.\" mariadb-plugin: plugin-ini option +.\" plugin-ini option: mariadb-plugin \fB\-\-plugin\-ini=\fR\fB\fIfile_name\fR\fR, \fB\-i \fR\fB\fIfile_name\fR\fR .sp The -\fBmysql_plugin\fR +\fBmariadb-plugin\fR configuration file\&. Relative path names are interpreted relative to the current directory\&. If this option is not given, the default is \fIplugin\fR\&.ini in the plugin directory, where @@ -309,13 +309,13 @@ argument on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: print-defaults option -.\" print-defaults option: mysql_plugin +.\" mariadb-plugin: print-defaults option +.\" print-defaults option: mariadb-plugin \fB\-\-print\-defaults\fR, \fB\-P\fR .sp Display the default values from the configuration file\&. This option causes -\fBmysql_plugin\fR +\fBmariadb-plugin\fR to print the defaults for \fB\-\-basedir\fR, \fB\-\-datadir\fR, and @@ -323,7 +323,7 @@ to print the defaults for if they are found in the configuration file\&. If no value for a variable is found, nothing is shown\&. .sp With -\fBmysql_plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support +\fBmariadb-plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support \fB\-\-print\-defaults\fR\&. .RE .sp @@ -335,8 +335,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: verbose option -.\" verbose option: mysql_plugin +.\" mariadb-plugin: verbose option +.\" verbose option: mariadb-plugin \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -351,8 +351,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: version option -.\" version option: mysql_plugin +.\" mariadb-plugin: version option +.\" version option: mariadb-plugin \fB\-\-version\fR, \fB\-V\fR .sp @@ -361,7 +361,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2019 MariaDB Foundation +Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-secure-installation.1 b/man/mariadb-secure-installation.1 index 0d30ee24087..aff28db32f9 100644 --- a/man/mariadb-secure-installation.1 +++ b/man/mariadb-secure-installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,12 +11,12 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_secure_installation +.\" mariadb-secure-installation .SH "NAME" -mariadb-secure-installation \- improve MariaDB installation security (mysql_secure_installation is now a symlink to mariadb-secure-installation) +mariadb-secure-installation \- improve MariaDB installation security (mariadb-secure-installation is now a symlink to mariadb-secure-installation) .SH "SYNOPSIS" -.HP \w'\fBmysql_secure_installation\fR\ 'u -\fBmysql_secure_installation\fR +.HP \w'\fBmariadb-secure-installation\fR\ 'u +\fBmariadb-secure-installation\fR .SH "DESCRIPTION" .PP This program enables you to improve the security of your MariaDB installation in the following ways: @@ -71,14 +71,14 @@ test database, which by default can be accessed by anonymous users\&. .RE .PP -\fBmysql_secure_installation\fR +\fBmariadb-secure-installation\fR can be invoked without arguments: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_secure_installation\fR +shell> \fBmariadb-secure-installation\fR .fi .if n \{\ .RE @@ -86,7 +86,7 @@ shell> \fBmysql_secure_installation\fR .PP The script will prompt you to determine which actions to perform\&. .PP -\fBmysql_secure_installation\fR +\fBmariadb-secure-installation\fR accepts some options: .sp .RS 4 @@ -97,8 +97,8 @@ accepts some options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: basedir option -.\" basedir option: mysql_secure_installation +.\" mariadb-secure-installation: basedir option +.\" basedir option: mariadb-secure-installation \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR .sp Base directory\&. @@ -112,8 +112,8 @@ Base directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: defaults-extra-file option -.\" defaults-extra-file option: mysql_secure_installation +.\" mariadb-secure-installation: defaults-extra-file option +.\" defaults-extra-file option: mariadb-secure-installation \fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR .sp Additional option file\&. @@ -127,8 +127,8 @@ Additional option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: defaults-file option -.\" defaults-file option: mysql_secure_installation +.\" mariadb-secure-installation: defaults-file option +.\" defaults-file option: mariadb-secure-installation \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp Option file\&. @@ -142,8 +142,8 @@ Option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: no-defaults option -.\" no-defaults option: mysql_secure_installation +.\" mariadb-secure-installation: no-defaults option +.\" no-defaults option: mariadb-secure-installation \fB\-\-no\-defaults\fR .sp Don't read any defaults file\&. @@ -153,7 +153,7 @@ Other unrecognized options will be passed on to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 258c1793b41..3ee9d54f2be 100644 --- a/man/mariadb-service-convert.1 +++ b/man/mariadb-service-convert.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "3 September 2024" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -9,11 +9,11 @@ .\" disable justification (adjust text to left margin only) .ad l .SH NAME -mariadb-service-convert \- generate a mariadb.service file based on the current mysql/mariadb settings +mariadb-service-convert \- generate a mariadb.service file based on the current mariadb settings .SH DESCRIPTION -Use: Generate a mariadb.service file based on the current mysql/mariadb settings\. +Use: Generate a mariadb.service file based on the current mariadb settings\. This is to assist distro maintainers in migrating to systemd service definations from -a user mysqld_safe settings in the my.cnf files\. +a user mariadbd-safe settings in the my.cnf files\. .PP Redirect output to user directory like /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf .PP diff --git a/man/mariadb-setpermission.1 b/man/mariadb-setpermission.1 index 7725ad69828..f5c7f78156b 100644 --- a/man/mariadb-setpermission.1 +++ b/man/mariadb-setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SETPERMISSION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SETPERMISSION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_setpermission +.\" mariadb-setpermission .SH "NAME" -mariadb-setpermission \- interactively set permissions in grant tables (mysql_setpermission is now a symlink to mariadb-setpermission) +mariadb-setpermission \- interactively set permissions in grant tables (mariadb-setpermission is now a symlink to mariadb-setpermission) .SH "SYNOPSIS" -.HP \w'\fBmysql_setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR is a Perl script that was originally written and contributed by Luuk de Boer\&. It interactively sets permissions in the MariaDB grant tables\&. -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR is written in Perl and requires that the DBI and @@ -29,14 +29,14 @@ DBD::MariaDB Perl modules be installed\&. .PP Invoke -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -47,7 +47,7 @@ should be either \fB\-\-help\fR to display the help message, or options that indicate how to connect to the MariaDB server\&. The account used when you connect determines which permissions you have when attempting to modify existing permissions in the grant tables\&. .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR also reads options from the [client] and @@ -56,7 +56,7 @@ groups in the \&.my\&.cnf file in your home directory, if the file exists\&. .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR supports the following options: .sp .RS 4 @@ -67,8 +67,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: help option -.\" help option: mysql_setpermission +.\" mariadb-setpermission: help option +.\" help option: mariadb-setpermission \fB\-\-help\fR .sp Display a help message and exit\&. @@ -82,8 +82,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: host option -.\" host option: mysql_setpermission +.\" mariadb-setpermission: host option +.\" host option: mariadb-setpermission \fB\-\-host=\fR\fB\fIhost_name\fR\fR .sp Connect to the MariaDB server on the given host\&. @@ -97,8 +97,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: password option -.\" password option: mysql_setpermission +.\" mariadb-setpermission: password option +.\" password option: mariadb-setpermission \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. @@ -114,8 +114,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: port option -.\" port option: mysql_setpermission +.\" mariadb-setpermission: port option +.\" port option: mariadb-setpermission \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for the connection\&. @@ -129,8 +129,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: socket option -.\" socket option: mysql_setpermission +.\" mariadb-setpermission: socket option +.\" socket option: mariadb-setpermission \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp For connections to @@ -145,8 +145,8 @@ localhost, the Unix socket file to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: user option -.\" user option: mysql_setpermission +.\" mariadb-setpermission: user option +.\" user option: mariadb-setpermission \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. @@ -154,7 +154,7 @@ The MariaDB user name to use when connecting to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-show.1 b/man/mariadb-show.1 index 85b20a971fb..cefd05ff4be 100644 --- a/man/mariadb-show.1 +++ b/man/mariadb-show.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SHOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SHOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,39 +11,39 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlshow +.\" mariadb-show .\" databases: displaying .\" displaying: database information .\" tables: displaying .\" columns: displaying .\" showing: database information .SH "NAME" -mariadb-show \- display database, table, and column information (mysqlshow is now a symlink to mariadb-show) +mariadb-show \- display database, table, and column information (mariadb-show is now a symlink to mariadb-show) .SH "SYNOPSIS" -.HP \w'\fBmysqlshow\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ [\fR\fB\fIcol_name\fR\fR\fB]]]\fR\ 'u -\fBmysqlshow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR +.HP \w'\fBmariadb-show\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ [\fR\fB\fIcol_name\fR\fR\fB]]]\fR\ 'u +\fBmariadb-show [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR .SH "DESCRIPTION" .PP The -\fBmysqlshow\fR +\fBmariadb-show\fR client can be used to quickly see which databases exist, their tables, or a table's columns or indexes\&. .PP -\fBmysqlshow\fR +\fBmariadb-show\fR provides a command\-line interface to several SQL SHOW statements\&. The same information can be obtained by using those statements directly\&. For example, you can issue them from the -\fBmysql\fR +\fBmariadb\fR client program\&. .PP Invoke -\fBmysqlshow\fR +\fBmariadb-show\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlshow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR +shell> \fBmariadb-show [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR .fi .if n \{\ .RE @@ -98,18 +98,18 @@ and wildcard characters\&. This might cause some confusion when you try to display the columns for a table with a \(lq_\(rq in the name, because in this case, -\fBmysqlshow\fR +\fBmariadb-show\fR shows you only the table names that match the pattern\&. This is easily fixed by adding an extra \(lq%\(rq last on the command line as a separate argument\&. .PP -\fBmysqlshow\fR +\fBmariadb-show\fR supports the following options, which can be specified on the command line or in the -[mysqlshow] +[mariadb-show] and [client] option file groups\&. -\fBmysqlshow\fR +\fBmariadb-show\fR also supports the options for processing option files described. .sp .RS 4 @@ -120,8 +120,8 @@ also supports the options for processing option files described. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: help option -.\" help option: mysqlshow +.\" mariadb-show: help option +.\" help option: mariadb-show \fB\-\-help\fR, \fB\-?\fR .sp @@ -136,8 +136,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: character-sets-dir option -.\" character-sets-dir option: mysqlshow +.\" mariadb-show: character-sets-dir option +.\" character-sets-dir option: mariadb-show \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR, \fB\-c\fR \fIpath\fR\fR .sp @@ -152,8 +152,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: compress option -.\" compress option: mysqlshow +.\" mariadb-show: compress option +.\" compress option: mariadb-show \fB\-\-compress\fR, \fB\-C\fR .sp @@ -168,8 +168,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: count option -.\" count option: mysqlshow +.\" mariadb-show: count option +.\" count option: mariadb-show \fB\-\-count\fR .sp Show the number of rows per table\&. This can be slow for non\-MyISAM @@ -184,8 +184,8 @@ tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug option -.\" debug option: mysqlshow +.\" mariadb-show: debug option +.\" debug option: mariadb-show \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -202,8 +202,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug-check option -.\" debug-check option: mysqlshow +.\" mariadb-show: debug-check option +.\" debug-check option: mariadb-show \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -217,8 +217,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug-info option -.\" debug-info option: mysqlshow +.\" mariadb-show: debug-info option +.\" debug-info option: mariadb-show \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -232,8 +232,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: default-auth option -.\" default-auth option: mysqlshow +.\" mariadb-show: default-auth option +.\" default-auth option: mariadb-show \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -247,8 +247,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: default-character-set option -.\" default-character-set option: mysqlshow +.\" mariadb-show: default-character-set option +.\" default-character-set option: mariadb-show \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -264,8 +264,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-extra-file option -.\" defaults-extra-file option: mysqlshow +.\" mariadb-show: defaults-extra-file option +.\" defaults-extra-file option: mariadb-show \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -280,8 +280,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-file option -.\" defaults-file option: mysqlshow +.\" mariadb-show: defaults-file option +.\" defaults-file option: mariadb-show \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -296,8 +296,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-group-suffix option -.\" defaults-group-suffix option: mysqlshow +.\" mariadb-show: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb-show \fB\-\-defaults\-group\-suffix=\fR\fB\fIsuffix\fR\fR .sp In addition to the groups named on the command line, read groups that have the given suffix\&. @@ -311,8 +311,8 @@ In addition to the groups named on the command line, read groups that have the g .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: host option -.\" host option: mysqlshow +.\" mariadb-show: host option +.\" host option: mariadb-show \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -327,8 +327,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: keys option -.\" keys option: mysqlshow +.\" mariadb-show: keys option +.\" keys option: mariadb-show \fB\-\-keys\fR, \fB\-k\fR .sp @@ -343,8 +343,8 @@ Show table indexes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: no-defaults option -.\" no-defaults option: mysqlshow +.\" mariadb-show: no-defaults option +.\" no-defaults option: mariadb-show \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -359,8 +359,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: password option -.\" password option: mysqlshow +.\" mariadb-show: password option +.\" password option: mariadb-show \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -373,7 +373,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlshow\fR +\fBmariadb-show\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -387,8 +387,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: pipe option -.\" pipe option: mysqlshow +.\" mariadb-show: pipe option +.\" pipe option: mariadb-show \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -403,8 +403,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: plugin-dir option -.\" plugin-dir option: mysqlshow +.\" mariadb-show: plugin-dir option +.\" plugin-dir option: mariadb-show \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -418,8 +418,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: port option -.\" port option: mysqlshow +.\" mariadb-show: port option +.\" port option: mariadb-show \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -435,8 +435,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: protocol option -.\" protocol option: mysqlshow +.\" mariadb-show: protocol option +.\" protocol option: mariadb-show \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -450,8 +450,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: print-defaults option -.\" print-defaults option: mysqlshow +.\" mariadb-show: print-defaults option +.\" print-defaults option: mariadb-show \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -466,8 +466,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: show-table-type option -.\" show-table-type option: mysqlshow +.\" mariadb-show: show-table-type option +.\" show-table-type option: mariadb-show \fB\-\-show\-table\-type\fR, \fB\-t\fR .sp @@ -486,8 +486,8 @@ VIEW\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: socket option -.\" socket option: mysqlshow +.\" mariadb-show: socket option +.\" socket option: mariadb-show \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -504,8 +504,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL options -.\" SSL options: mysqlshow +.\" mariadb-show: SSL options +.\" SSL options: mariadb-show \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -520,8 +520,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA option -.\" SSL CA option: mysqlshow +.\" mariadb-show: SSL CA option +.\" SSL CA option: mariadb-show \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -536,8 +536,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA Path option -.\" SSL CA Path option: mysqlshow +.\" mariadb-show: SSL CA Path option +.\" SSL CA Path option: mariadb-show \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -552,8 +552,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cert option -.\" SSL Cert option: mysqlshow +.\" mariadb-show: SSL Cert option +.\" SSL Cert option: mariadb-show \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -568,8 +568,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cipher option -.\" SSL Cipher option: mysqlshow +.\" mariadb-show: SSL Cipher option +.\" SSL Cipher option: mariadb-show \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -584,8 +584,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Key option -.\" SSL Key option: mysqlshow +.\" mariadb-show: SSL Key option +.\" SSL Key option: mariadb-show \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -600,8 +600,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crl option -.\" SSL CRL option: mysqlshow +.\" mariadb-show: SSL Crl option +.\" SSL CRL option: mariadb-show \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -616,8 +616,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crlpath option -.\" SSL Crlpath option: mysqlshow +.\" mariadb-show: SSL Crlpath option +.\" SSL Crlpath option: mariadb-show \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -632,8 +632,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqlshow +.\" mariadb-show: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-show \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -647,8 +647,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: status option -.\" status option: mysqlshow +.\" mariadb-show: status option +.\" status option: mariadb-show \fB\-\-status\fR, \fB\-i\fR .sp @@ -663,8 +663,8 @@ Display extra information about each table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: user option -.\" user option: mysqlshow +.\" mariadb-show: user option +.\" user option: mariadb-show \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -679,8 +679,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: verbose option -.\" verbose option: mysqlshow +.\" mariadb-show: verbose option +.\" verbose option: mariadb-show \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -695,8 +695,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: version option -.\" version option: mysqlshow +.\" mariadb-show: version option +.\" version option: mariadb-show \fB\-\-version\fR, \fB\-V\fR .sp @@ -705,7 +705,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-slap.1 b/man/mariadb-slap.1 index dbb458cea36..edcc2b3a6a9 100644 --- a/man/mariadb-slap.1 +++ b/man/mariadb-slap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SLAP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SLAP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,27 +11,27 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlslap +.\" mariadb-slap .\" load emulation .SH "NAME" -mariadb-slap \- load emulation client (mysqlslap is now a symlink to mariadb-slap) +mariadb-slap \- load emulation client (mariadb-slap is now a symlink to mariadb-slap) .SH "SYNOPSIS" -.HP \w'\fBmysqlslap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-slap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-slap [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR is a diagnostic program designed to emulate client load for a MariaDB server and to report the timing of each stage\&. It works as if multiple clients are accessing the server\&. .PP Invoke -\fBmysqlslap\fR +\fBmariadb-slap\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-slap [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -44,10 +44,10 @@ or enable you to specify a string containing an SQL statement or a file containing statements\&. If you specify a file, by default it must contain one statement per line\&. (That is, the implicit statement delimiter is the newline character\&.) Use the \fB\-\-delimiter\fR option to specify a different delimiter, which enables you to specify statements that span multiple lines or place multiple statements on a single line\&. You cannot include comments in a file; -\fBmysqlslap\fR +\fBmariadb-slap\fR does not understand them\&. .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR runs in three stages: .sp .RS 4 @@ -91,7 +91,7 @@ Supply your own create and query SQL statements, with 50 clients querying and 20 .RS 4 .\} .nf -mysqlslap \-\-delimiter=";" \e +mariadb-slap \-\-delimiter=";" \e \-\-create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \e \-\-query="SELECT * FROM a" \-\-concurrency=50 \-\-iterations=200 .fi @@ -100,7 +100,7 @@ mysqlslap \-\-delimiter=";" \e .\} .PP Let -\fBmysqlslap\fR +\fBmariadb-slap\fR build the query SQL statement with a table of two INT columns and three @@ -111,7 +111,7 @@ columns\&. Use five clients querying 20 times each\&. Do not create the table or .RS 4 .\} .nf -mysqlslap \-\-concurrency=5 \-\-iterations=20 \e +mariadb-slap \-\-concurrency=5 \-\-iterations=20 \e \-\-number\-int\-cols=2 \-\-number\-char\-cols=3 \e \-\-auto\-generate\-sql .fi @@ -129,7 +129,7 @@ then run all the queries in the query file with five clients (five times each): .RS 4 .\} .nf -mysqlslap \-\-concurrency=5 \e +mariadb-slap \-\-concurrency=5 \e \-\-iterations=5 \-\-query=query\&.sql \-\-create=create\&.sql \e \-\-delimiter=";" .fi @@ -137,13 +137,13 @@ mysqlslap \-\-concurrency=5 \e .RE .\} .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR supports the following options, which can be specified on the command line or in the -[mysqlslap] +[mariadb-slap] and [client] option file groups\&. -\fBmysqlslap\fR +\fBmariadb-slap\fR also supports the options for processing option files\&. .sp .RS 4 @@ -154,8 +154,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: help option -.\" help option: mysqlslap +.\" mariadb-slap: help option +.\" help option: mariadb-slap \fB\-\-help\fR, \fB\-?\fR .sp @@ -170,8 +170,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql option -.\" auto-generate-sql option: mysqlslap +.\" mariadb-slap: auto-generate-sql option +.\" auto-generate-sql option: mariadb-slap \fB\-\-auto\-generate\-sql\fR, \fB\-a\fR .sp @@ -186,8 +186,8 @@ Generate SQL statements automatically when they are not supplied in files or via .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-add-autoincrement option -.\" auto-generate-sql-add-autoincrement option: mysqlslap +.\" mariadb-slap: auto-generate-sql-add-autoincrement option +.\" auto-generate-sql-add-autoincrement option: mariadb-slap \fB\-\-auto\-generate\-sql\-add\-autoincrement\fR .sp Add an @@ -203,8 +203,8 @@ column to automatically generated tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-execute-number option -.\" auto-generate-sql-execute-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-execute-number option +.\" auto-generate-sql-execute-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-execute\-number=\fR\fB\fIN\fR\fR .sp Specify how many queries to generate automatically\&. @@ -218,8 +218,8 @@ Specify how many queries to generate automatically\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-guid-primary option -.\" auto-generate-sql-guid-primary option: mysqlslap +.\" mariadb-slap: auto-generate-sql-guid-primary option +.\" auto-generate-sql-guid-primary option: mariadb-slap \fB\-\-auto\-generate\-sql\-guid\-primary\fR .sp Add a GUID\-based primary key to automatically generated tables\&. @@ -233,8 +233,8 @@ Add a GUID\-based primary key to automatically generated tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-load-type option -.\" auto-generate-sql-load-type option: mysqlslap +.\" mariadb-slap: auto-generate-sql-load-type option +.\" auto-generate-sql-load-type option: mariadb-slap \fB\-\-auto\-generate\-sql\-load\-type=\fR\fB\fItype\fR\fR .sp Specify the test load type\&. The allowable values are @@ -259,8 +259,8 @@ mixed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-secondary-indexes option -.\" auto-generate-sql-secondary-indexes option: mysqlslap +.\" mariadb-slap: auto-generate-sql-secondary-indexes option +.\" auto-generate-sql-secondary-indexes option: mariadb-slap \fB\-\-auto\-generate\-sql\-secondary\-indexes=\fR\fB\fIN\fR\fR .sp Specify how many secondary indexes to add to automatically generated tables\&. By default, none are added\&. @@ -274,8 +274,8 @@ Specify how many secondary indexes to add to automatically generated tables\&. B .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-unique-query-number option -.\" auto-generate-sql-unique-query-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-unique-query-number option +.\" auto-generate-sql-unique-query-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-unique\-query\-number=\fR\fB\fIN\fR\fR .sp How many different queries to generate for automatic tests\&. For example, if you run a @@ -291,8 +291,8 @@ test that performs 1000 selects, you can use this option with a value of 1000 to .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-unique-write-number option -.\" auto-generate-sql-unique-write-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-unique-write-number option +.\" auto-generate-sql-unique-write-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-unique\-write\-number=\fR\fB\fIN\fR\fR .sp How many different queries to generate for @@ -307,8 +307,8 @@ How many different queries to generate for .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-write-number option -.\" auto-generate-sql-write-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-write-number option +.\" auto-generate-sql-write-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-write\-number=\fR\fB\fIN\fR\fR .sp How many row inserts to perform on each thread\&. The default is 100\&. @@ -322,8 +322,8 @@ How many row inserts to perform on each thread\&. The default is 100\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: commit option -.\" commit option: mysqlslap +.\" mariadb-slap: commit option +.\" commit option: mariadb-slap \fB\-\-commit=\fR\fB\fIN\fR\fR .sp How many statements to execute before committing\&. The default is 0 (no commits are done)\&. @@ -337,8 +337,8 @@ How many statements to execute before committing\&. The default is 0 (no commits .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: compress option -.\" compress option: mysqlslap +.\" mariadb-slap: compress option +.\" compress option: mariadb-slap \fB\-\-compress\fR, \fB\-C\fR .sp @@ -353,8 +353,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: concurrency option -.\" concurrency option: mysqlslap +.\" mariadb-slap: concurrency option +.\" concurrency option: mariadb-slap \fB\-\-concurrency=\fR\fB\fIN\fR\fR, \fB\-c \fR\fB\fIN\fR\fR .sp @@ -371,8 +371,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: create option -.\" create option: mysqlslap +.\" mariadb-slap: create option +.\" create option: mariadb-slap \fB\-\-create=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to use for creating the table\&. @@ -386,8 +386,8 @@ The file or string containing the statement to use for creating the table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: create-schema option -.\" create-schema option: mysqlslap +.\" mariadb-slap: create-schema option +.\" create-schema option: mariadb-slap \fB\-\-create\-schema=\fR\fB\fIvalue\fR\fR .sp The schema in which to run the tests\&. @@ -401,8 +401,8 @@ The schema in which to run the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: csv option -.\" csv option: mysqlslap +.\" mariadb-slap: csv option +.\" csv option: mariadb-slap \fB\-\-csv[=\fR\fB\fIfile_name\fR\fR\fB]\fR .sp Generate output in comma\-separated values format\&. The output goes to the named file, or to the standard output if no file is given\&. @@ -416,14 +416,14 @@ Generate output in comma\-separated values format\&. The output goes to the name .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug option -.\" debug option: mysqlslap +.\" mariadb-slap: debug option +.\" debug option: mariadb-slap \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlslap.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-slap.trace'. .RE .sp .RS 4 @@ -434,8 +434,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlslap.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug-check option -.\" debug-check option: mysqlslap +.\" mariadb-slap: debug-check option +.\" debug-check option: mariadb-slap \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -449,8 +449,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug-info option -.\" debug-info option: mysqlslap +.\" mariadb-slap: debug-info option +.\" debug-info option: mariadb-slap \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -465,8 +465,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: default-auth option -.\" default-auth option: mysqlslap +.\" mariadb-slap: default-auth option +.\" default-auth option: mariadb-slap \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -480,8 +480,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: defaults-extra-file option -.\" defaults-extra-file option: mysqlslap +.\" mariadb-slap: defaults-extra-file option +.\" defaults-extra-file option: mariadb-slap \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -496,8 +496,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: defaults-file option -.\" defaults-file option: mysqlslap +.\" mariadb-slap: defaults-file option +.\" defaults-file option: mariadb-slap \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -512,8 +512,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: delimiter option -.\" delimiter option: mysqlslap +.\" mariadb-slap: delimiter option +.\" delimiter option: mariadb-slap \fB\-\-delimiter=\fR\fB\fIstr\fR\fR, \fB\-F \fR\fB\fIstr\fR\fR .sp @@ -528,8 +528,8 @@ The delimiter to use in SQL statements supplied in files or via command options\ .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: detach option -.\" detach option: mysqlslap +.\" mariadb-slap: detach option +.\" detach option: mariadb-slap \fB\-\-detach=\fR\fB\fIN\fR\fR .sp Detach (close and reopen) each connection after each @@ -545,8 +545,8 @@ statements\&. The default is 0 (connections are not detached)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: engine option -.\" engine option: mysqlslap +.\" mariadb-slap: engine option +.\" engine option: mariadb-slap \fB\-\-engine=\fR\fB\fIengine_name\fR\fR, \fB\-e \fR\fB\fIengine_name\fR\fR .sp @@ -563,8 +563,8 @@ each engine\&. You can also specify an option for an engine after a colon, for e .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: host option -.\" host option: mysqlslap +.\" mariadb-slap: host option +.\" host option: mariadb-slap \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -579,8 +579,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: init-command option -.\" init-command option: mysqlslap +.\" mariadb-slap: init-command option +.\" init-command option: mariadb-slap \fB\-\-init\-command=str\fR .sp SQL Command to execute when connecting to MariaDB server\&. Will automatically be re\-executed when reconnecting\&. @@ -594,8 +594,8 @@ SQL Command to execute when connecting to MariaDB server\&. Will automatically b .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: iterations option -.\" iterations option: mysqlslap +.\" mariadb-slap: iterations option +.\" iterations option: mariadb-slap \fB\-\-iterations=\fR\fB\fIN\fR\fR, \fB\-i \fR\fB\fIN\fR\fR .sp @@ -610,8 +610,8 @@ The number of times to run the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: no-defaults option -.\" no-defaults option: mysqlslap +.\" mariadb-slap: no-defaults option +.\" no-defaults option: mariadb-slap \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -626,8 +626,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: no-drop option -.\" no-drop option: mysqlslap +.\" mariadb-slap: no-drop option +.\" no-drop option: mariadb-slap \fB\-\-no\-drop\fR .sp Do not drop any schema created during the test after the test is complete\&. @@ -641,8 +641,8 @@ Do not drop any schema created during the test after the test is complete\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-char-cols option -.\" number-char-cols option: mysqlslap +.\" mariadb-slap: number-char-cols option +.\" number-char-cols option: mariadb-slap \fB\-\-number\-char\-cols=\fR\fB\fIN\fR\fR, \fB\-x \fR\fB\fIN\fR\fR .sp @@ -661,8 +661,8 @@ is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-int-cols option -.\" number-int-cols option: mysqlslap +.\" mariadb-slap: number-int-cols option +.\" number-int-cols option: mariadb-slap \fB\-\-number\-int\-cols=\fR\fB\fIN\fR\fR, \fB\-y \fR\fB\fIN\fR\fR .sp @@ -681,12 +681,12 @@ is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-of-queries option -.\" number-of-queries option: mysqlslap +.\" mariadb-slap: number-of-queries option +.\" number-of-queries option: mariadb-slap \fB\-\-number\-of\-queries=\fR\fB\fIN\fR\fR .sp Limit each client to approximately this many queries\&. Query counting takes into account the statement delimiter\&. For example, if you invoke -\fBmysqlslap\fR +\fBmariadb-slap\fR as follows, the ; delimiter is recognized so that each instance of the query string counts as two queries\&. As a result, 5 rows (not 10) are inserted\&. @@ -695,7 +695,7 @@ delimiter is recognized so that each instance of the query string counts as two .RS 4 .\} .nf -shell> \fBmysqlslap \-\-delimiter=";" \-\-number\-of\-queries=10\fR +shell> \fBmariadb-slap \-\-delimiter=";" \-\-number\-of\-queries=10\fR \fB\-\-query="use test;insert into t values(null)"\fR .fi .if n \{\ @@ -711,12 +711,12 @@ shell> \fBmysqlslap \-\-delimiter=";" \-\-number\-of\-queries=10\fR .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: only-print option -.\" only-print option: mysqlslap +.\" mariadb-slap: only-print option +.\" only-print option: mariadb-slap \fB\-\-only\-print\fR .sp Do not connect to databases\&. -\fBmysqlslap\fR +\fBmariadb-slap\fR only prints what it would have done\&. .RE .sp @@ -728,8 +728,8 @@ only prints what it would have done\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: password option -.\" password option: mysqlslap +.\" mariadb-slap: password option +.\" password option: mariadb-slap \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -742,7 +742,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlslap\fR +\fBmariadb-slap\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -756,8 +756,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pipe option -.\" pipe option: mysqlslap +.\" mariadb-slap: pipe option +.\" pipe option: mariadb-slap \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -772,8 +772,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: plugin-dir option -.\" plugin-dir option: mysqlslap +.\" mariadb-slap: plugin-dir option +.\" plugin-dir option: mariadb-slap \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -787,8 +787,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: port option -.\" port option: mysqlslap +.\" mariadb-slap: port option +.\" port option: mariadb-slap \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -804,8 +804,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: post-query option -.\" post-query option: mysqlslap +.\" mariadb-slap: post-query option +.\" post-query option: mariadb-slap \fB\-\-post\-query=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to execute after the tests have completed\&. This execution is not counted for timing purposes\&. @@ -819,8 +819,8 @@ The file or string containing the statement to execute after the tests have comp .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: post-system option -.\" post-system option: mysqlslap +.\" mariadb-slap: post-system option +.\" post-system option: mariadb-slap \fB\-\-post\-system=\fR\fB\fIstr\fR\fR .sp The string to execute via @@ -836,8 +836,8 @@ after the tests have completed\&. This execution is not counted for timing purpo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pre-query option -.\" pre-query option: mysqlslap +.\" mariadb-slap: pre-query option +.\" pre-query option: mariadb-slap \fB\-\-pre\-query=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to execute before running the tests\&. This execution is not counted for timing purposes\&. @@ -851,8 +851,8 @@ The file or string containing the statement to execute before running the tests\ .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pre-system option -.\" pre-system option: mysqlslap +.\" mariadb-slap: pre-system option +.\" pre-system option: mariadb-slap \fB\-\-pre\-system=\fR\fB\fIstr\fR\fR .sp The string to execute via @@ -868,8 +868,8 @@ before running the tests\&. This execution is not counted for timing purposes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: print-defaults option -.\" print-defaults option: mysqlslap +.\" mariadb-slap: print-defaults option +.\" print-defaults option: mariadb-slap \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -884,8 +884,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: protocol option -.\" protocol option: mysqlslap +.\" mariadb-slap: protocol option +.\" protocol option: mariadb-slap \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -899,8 +899,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: query option -.\" query option: mysqlslap +.\" mariadb-slap: query option +.\" query option: mariadb-slap \fB\-\-query=\fR\fB\fIvalue\fR\fR, \fB\-q \fR\fB\fIvalue\fR\fR .sp @@ -917,8 +917,8 @@ statement to use for retrieving data\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: shared-memory-base-name option -.\" shared-memory-base-name option: mysqlslap +.\" mariadb-slap: shared-memory-base-name option +.\" shared-memory-base-name option: mariadb-slap \fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR .sp On Windows, the shared\-memory name to use, for connections made via shared memory to a local server\&. This option applies only if the server supports shared\-memory connections\&. @@ -932,8 +932,8 @@ On Windows, the shared\-memory name to use, for connections made via shared memo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: silent option -.\" silent option: mysqlslap +.\" mariadb-slap: silent option +.\" silent option: mariadb-slap \fB\-\-silent\fR, \fB\-s\fR .sp @@ -948,8 +948,8 @@ Silent mode\&. No output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: socket option -.\" socket option: mysqlslap +.\" mariadb-slap: socket option +.\" socket option: mariadb-slap \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -966,8 +966,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL options -.\" SSL options: mysqlshow +.\" mariadb-slap: SSL options +.\" SSL options: mariadb-slap \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -982,8 +982,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA option -.\" SSL CA option: mysqlshow +.\" mariadb-slap: SSL CA option +.\" SSL CA option: mariadb-slap \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -998,8 +998,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA Path option -.\" SSL CA Path option: mysqlshow +.\" mariadb-slap: SSL CA Path option +.\" SSL CA Path option: mariadb-slap \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1014,8 +1014,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cert option -.\" SSL Cert option: mysqlshow +.\" mariadb-slap: SSL Cert option +.\" SSL Cert option: mariadb-slap \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1030,8 +1030,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cipher option -.\" SSL Cipher option: mysqlshow +.\" mariadb-slap: SSL Cipher option +.\" SSL Cipher option: mariadb-slap \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1046,8 +1046,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Key option -.\" SSL Key option: mysqlshow +.\" mariadb-slap: SSL Key option +.\" SSL Key option: mariadb-slap \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1062,8 +1062,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crl option -.\" SSL CRL option: mysqlshow +.\" mariadb-slap: SSL Crl option +.\" SSL CRL option: mariadb-slap \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1078,8 +1078,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crlpath option -.\" SSL Crlpath option: mysqlshow +.\" mariadb-slap: SSL Crlpath option +.\" SSL Crlpath option: mariadb-slap \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1094,8 +1094,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqlshow +.\" mariadb-slap: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-slap \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1109,8 +1109,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: user option -.\" user option: mysqlslap +.\" mariadb-slap: user option +.\" user option: mariadb-slap \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1125,8 +1125,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: verbose option -.\" verbose option: mysqlslap +.\" mariadb-slap: verbose option +.\" verbose option: mariadb-slap \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1141,8 +1141,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: version option -.\" version option: mysqlslap +.\" mariadb-slap: version option +.\" version option: mariadb-slap \fB\-\-version\fR, \fB\-V\fR .sp @@ -1151,7 +1151,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-test.1 b/man/mariadb-test.1 index b1326ba8dbe..5baef13d4e0 100644 --- a/man/mariadb-test.1 +++ b/man/mariadb-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqltest -.\" mysqltest_embedded +.\" mariadb-test +.\" mariadb-test-embedded .SH "NAME" -mariadb-test \- program to run test cases (mysqltest is now a symlink to mariadb-test) +mariadb-test \- program to run test cases (mariadb-test is now a symlink to mariadb-test) .br -mysqltest_embedded \- program to run embedded test cases +mariadb-test-embedded \- program to run embedded test cases .SH "SYNOPSIS" -.HP \w'\fBmysqltest\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u -\fBmysqltest [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR -.HP \w'\fBmysqltest_embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u -\fBmysqltest_embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR +.HP \w'\fBmariadb-test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u +\fBmariadb-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR +.HP \w'\fBmariadb-test-embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u +\fBmariadb-test-embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysqltest\fR +\fBmariadb-test\fR program runs a test case against a MariaDB server and optionally compares the output with a result file\&. This program reads input written in a special test language\&. Typically, you invoke -\fBmysqltest\fR +\fBmariadb-test\fR via -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR rather than invoking it directly\&. .PP -\fBmysqltest_embedded\fR +\fBmariadb-test-embedded\fR is similar but is built with support for the -libmysqld +libmariadbd embedded server\&. .PP Features of -\fBmysqltest\fR: +\fBmariadb-test\fR: .sp .RS 4 .ie n \{\ @@ -82,7 +82,7 @@ Can test whether the result from an SQL statement or shell command is as expecte .IP \(bu 2.3 .\} Can connect to one or more standalone -\fBmysqld\fR +\fBmariadbd\fR servers and switch between connections .RE .sp @@ -94,24 +94,24 @@ servers and switch between connections .sp -1 .IP \(bu 2.3 .\} -Can connect to an embedded server (libmysqld), if MariaDB is compiled with support for -libmysqld\&. (In this case, the executable is named -\fBmysqltest_embedded\fR +Can connect to an embedded server (libmariadbd), if MariaDB is compiled with support for +libmariadbd\&. (In this case, the executable is named +\fBmariadb-test-embedded\fR rather than -\fBmysqltest\fR\&.) +\fBmariadb-test\fR\&.) .RE .PP By default, -\fBmysqltest\fR +\fBmariadb-test\fR reads the test case on the standard input\&. To run -\fBmysqltest\fR +\fBmariadb-test\fR this way, you normally invoke it like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqltest [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB] < \fR\fB\fItest_file\fR\fR +shell> \fBmariadb-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB] < \fR\fB\fItest_file\fR\fR .fi .if n \{\ .RE @@ -122,10 +122,10 @@ You can also name the test case file with a option\&. .PP The exit value from -\fBmysqltest\fR +\fBmariadb-test\fR is 0 for success, 1 for failure, and 62 if it skips the test case (for example, if after checking some preconditions it decides not to run the test)\&. .PP -\fBmysqltest\fR +\fBmariadb-test\fR supports the following options: .sp .RS 4 @@ -136,8 +136,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: help option -.\" help option: mysqltest +.\" mariadb-test: help option +.\" help option: mariadb-test \fB\-\-help\fR, \fB\-?\fR .sp @@ -152,8 +152,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: basedir option -.\" basedir option: mysqltest +.\" mariadb-test: basedir option +.\" basedir option: mariadb-test \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR, \fB\-b \fR\fB\fIdir_name\fR\fR .sp @@ -168,8 +168,8 @@ The base directory for tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: character-sets-dir option -.\" character-sets-dir option: mysqltest +.\" mariadb-test: character-sets-dir option +.\" character-sets-dir option: mariadb-test \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -183,8 +183,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: compress option -.\" compress option: mysqltest +.\" mariadb-test: compress option +.\" compress option: mariadb-test \fB\-\-compress\fR, \fB\-C\fR .sp @@ -199,8 +199,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: connect-timeout option -.\" connect-timeout option: mysqltest +.\" mariadb-test: connect-timeout option +.\" connect-timeout option: mariadb-test \fB\-\-connect\-timeout=\fInum\fR .sp This can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options to change the number of seconds before an unsuccessful connection attempt times out\&. @@ -214,8 +214,8 @@ This can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: continue-on-error option -.\" continue-on-error option: mysqltest +.\" mariadb-test: continue-on-error option +.\" continue-on-error option: mariadb-test \fB\-\-continue\-on\-error\fR .sp Continue test even if we got an error\&. This is mostly @@ -232,8 +232,8 @@ a newly created big test file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: cursor-protocol option -.\" cursor-protocol option: mysqltest +.\" mariadb-test: cursor-protocol option +.\" cursor-protocol option: mariadb-test \fB\-\-cursor\-protocol\fR .sp Use cursors for prepared statements\&. @@ -247,8 +247,8 @@ Use cursors for prepared statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: database option -.\" database option: mysqltest +.\" mariadb-test: database option +.\" database option: mariadb-test \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -263,14 +263,14 @@ The default database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug option -.\" debug option: mysqltest +.\" mariadb-test: debug option +.\" debug option: mariadb-test \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-#[\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is 'd:t:S:i:O,/tmp/mysqltest.trace'. +value is 'd:t:S:i:O,/tmp/mariadb-test.trace'. .RE .sp .RS 4 @@ -281,8 +281,8 @@ value is 'd:t:S:i:O,/tmp/mysqltest.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug-check option -.\" debug-check option: mysqltest +.\" mariadb-test: debug-check option +.\" debug-check option: mariadb-test \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -296,8 +296,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug-info option -.\" debug-info option: mysqltest +.\" mariadb-test: debug-info option +.\" debug-info option: mariadb-test \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -311,8 +311,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: host option -.\" host option: mysqltest +.\" mariadb-test: host option +.\" host option: mariadb-test \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -327,8 +327,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: logdir option -.\" logdir option: mysqltest +.\" mariadb-test: logdir option +.\" logdir option: mariadb-test \fB\-\-logdir=\fR\fB\fIdir_name\fR\fR .sp The directory to use for log files\&. @@ -342,8 +342,8 @@ The directory to use for log files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: mark-progress option -.\" mark-progress option: mysqltest +.\" mariadb-test: mark-progress option +.\" mark-progress option: mariadb-test \fB\-\-mark\-progress\fR .sp Write the line number and elapsed time to @@ -358,8 +358,8 @@ Write the line number and elapsed time to .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: max-connect-retries option -.\" max-connect-retries option: mysqltest +.\" mariadb-test: max-connect-retries option +.\" max-connect-retries option: mariadb-test \fB\-\-max\-connect\-retries=\fR\fB\fInum\fR\fR .sp The maximum number of connection attempts when connecting to server\&. @@ -373,8 +373,8 @@ The maximum number of connection attempts when connecting to server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: max-connections option -.\" max-connections option: mysqltest +.\" mariadb-test: max-connections option +.\" max-connections option: mariadb-test \fB\-\-max\-connections=\fR\fB\fInum\fR\fR .sp The maximum number of simultaneous server connections per client (that is, per test)\&. If not set, the maximum is 128\&. Minimum allowed limit is 8, maximum is 5120\&. @@ -388,8 +388,8 @@ The maximum number of simultaneous server connections per client (that is, per t .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: no-defaults option -.\" no-defaults option: mysqltest +.\" mariadb-test: no-defaults option +.\" no-defaults option: mariadb-test \fB\-\-no\-defaults\fR .sp Do not read default options from any option files\&. If used, this must be the first option\&. @@ -403,8 +403,8 @@ Do not read default options from any option files\&. If used, this must be the f .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: non-blocking-api option -.\" non-blocking-api option: mysqltest +.\" mariadb-test: non-blocking-api option +.\" non-blocking-api option: mariadb-test \fB\-\-non\-blocking\-api\fR .sp Use the non-blocking client API for communication\&. @@ -418,8 +418,8 @@ Use the non-blocking client API for communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: overlay-dir option -.\" overlay-dir option: mysqltest +.\" mariadb-test: overlay-dir option +.\" overlay-dir option: mariadb-test \fB\-\-overlay\-dir=\fIdir_name\fR .sp Overlay directory\&. @@ -433,8 +433,8 @@ Overlay directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: password option -.\" password option: mysqltest +.\" mariadb-test: password option +.\" password option: mariadb-test \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -457,8 +457,8 @@ option on the command line, you are prompted for one\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: plugin-dir option -.\" plugin-dir option: mysqltest +.\" mariadb-test: plugin-dir option +.\" plugin-dir option: mariadb-test \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -472,8 +472,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: port option -.\" port option: mysqltest +.\" mariadb-test: port option +.\" port option: mariadb-test \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -489,12 +489,12 @@ my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: prologue option -.\" prologue option: mysqltest +.\" mariadb-test: prologue option +.\" prologue option: mariadb-test \fB\-\-prologue=\fR\fB\fIname\fR\fR .sp Include the contents of the given file before processing the contents of the test file\&. The included file should have the same format as other -\fBmysqltest\fR +\fBmariadb-test\fR test files\&. This option has the same effect as putting a \-\-source \fIfile_name\fR command as the first line of the test file\&. @@ -508,8 +508,8 @@ command as the first line of the test file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: protocol option -.\" protocol option: mysqltest +.\" mariadb-test: protocol option +.\" protocol option: mariadb-test \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -523,8 +523,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: ps-protocol option -.\" ps-protocol option: mysqltest +.\" mariadb-test: ps-protocol option +.\" ps-protocol option: mariadb-test \fB\-\-ps\-protocol\fR .sp Use the prepared\-statement protocol for communication\&. @@ -538,13 +538,13 @@ Use the prepared\-statement protocol for communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: quiet option -.\" quiet option: mysqltest +.\" mariadb-test: quiet option +.\" quiet option: mariadb-test \fB\-\-quiet\fR .sp Suppress all normal output\&. This is a synonym for -.\" mysqltest: silent option -.\" silent option: mysqltest +.\" mariadb-test: silent option +.\" silent option: mariadb-test \fB\-\-silent\fR\&. .RE .sp @@ -556,8 +556,8 @@ Suppress all normal output\&. This is a synonym for .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: record option -.\" record option: mysqltest +.\" mariadb-test: record option +.\" record option: mariadb-test \fB\-\-record\fR, \fB\-r\fR .sp @@ -575,15 +575,15 @@ option, if that option is given\&. It is an error to use this option without als .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: result-file option -.\" result-file option: mysqltest +.\" mariadb-test: result-file option +.\" result-file option: mariadb-test \fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR, \fB\-R \fR\fB\fIfile_name\fR\fR .sp This option specifies the file for test case expected results\&. \fB\-\-result\-file\fR, together with \fB\-\-record\fR, determines how -\fBmysqltest\fR +\fBmariadb-test\fR treats the test actual and expected results for a test case: .sp .RS 4 @@ -595,7 +595,7 @@ treats the test actual and expected results for a test case: .IP \(bu 2.3 .\} If the test produces no results, -\fBmysqltest\fR +\fBmariadb-test\fR exits with an error message to that effect, unless \fB\-\-result\-file\fR is given and the named file is an empty file\&. @@ -612,7 +612,7 @@ is given and the named file is an empty file\&. Otherwise, if \fB\-\-result\-file\fR is not given, -\fBmysqltest\fR +\fBmariadb-test\fR sends test results to the standard output\&. .RE .sp @@ -628,9 +628,9 @@ With \fB\-\-result\-file\fR but not \fB\-\-record\fR, -\fBmysqltest\fR +\fBmariadb-test\fR reads the expected results from the given file and compares them with the actual results\&. If the results do not match, -\fBmysqltest\fR +\fBmariadb-test\fR writes a \&.reject file in the same directory as the result file, outputs a diff of the two files, and exits with an error\&. @@ -648,7 +648,7 @@ With both \fB\-\-result\-file\fR and \fB\-\-record\fR, -\fBmysqltest\fR +\fBmariadb-test\fR updates the given file by writing the actual test results to it\&. .RE .RE @@ -661,8 +661,8 @@ updates the given file by writing the actual test results to it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: result-format-version option -.\" result-format-version option: mysqltest +.\" mariadb-test: result-format-version option +.\" result-format-version option: mariadb-test \fB\-\-result\-format\-version=\fI#\fR .sp Version of the result file format to use\&. @@ -676,8 +676,8 @@ Version of the result file format to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: server-arg option -.\" server-arg option: mysqltest +.\" mariadb-test: server-arg option +.\" server-arg option: mariadb-test \fB\-\-server\-arg=\fR\fB\fIvalue\fR\fR, \fB\-A \fR\fB\fIvalue\fR\fR .sp @@ -695,8 +695,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: server-file option -.\" server-file option: mysqltest +.\" mariadb-test: server-file option +.\" server-file option: mariadb-test \fB\-\-server\-file=\fR\fB\fIfile_name\fR\fR, \fB\-F \fR\fB\fIfile_name\fR\fR .sp @@ -711,8 +711,8 @@ Read arguments for the embedded server from the given file\&. The file should co .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: silent option -.\" silent option: mysqltest +.\" mariadb-test: silent option +.\" silent option: mariadb-test \fB\-\-silent\fR, \fB\-s\fR .sp @@ -727,8 +727,8 @@ Suppress all normal output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: sleep option -.\" sleep option: mysqltest +.\" mariadb-test: sleep option +.\" sleep option: mariadb-test \fB\-\-sleep=\fR\fB\fInum\fR\fR, \fB\-T \fR\fB\fInum\fR\fR .sp @@ -752,8 +752,8 @@ commands in the test case\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: socket option -.\" socket option: mysqltest +.\" mariadb-test: socket option +.\" socket option: mariadb-test \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -770,12 +770,12 @@ localhost .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: sp-protocol option -.\" sp-protocol option: mysqltest +.\" mariadb-test: sp-protocol option +.\" sp-protocol option: mariadb-test \fB\-\-sp\-protocol\fR .sp Execute DML statements within a stored procedure\&. For every DML statement, -\fBmysqltest\fR +\fBmariadb-test\fR creates and invokes a stored procedure that executes the statement rather than executing the statement directly\&. .RE .sp @@ -787,8 +787,8 @@ creates and invokes a stored procedure that executes the statement rather than e .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL options -.\" SSL options: mysqltest +.\" mariadb-test: SSL options +.\" SSL options: mariadb-test \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -803,8 +803,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL CA option -.\" SSL CA option: mysqltest +.\" mariadb-test: SSL CA option +.\" SSL CA option: mariadb-test \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -819,8 +819,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL CA Path option -.\" SSL CA Path option: mysqltest +.\" mariadb-test: SSL CA Path option +.\" SSL CA Path option: mariadb-test \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -835,8 +835,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Cert option -.\" SSL Cert option: mysqltest +.\" mariadb-test: SSL Cert option +.\" SSL Cert option: mariadb-test \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -851,8 +851,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Cipher option -.\" SSL Cipher option: mysqltest +.\" mariadb-test: SSL Cipher option +.\" SSL Cipher option: mariadb-test \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -867,8 +867,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Key option -.\" SSL Key option: mysqltest +.\" mariadb-test: SSL Key option +.\" SSL Key option: mariadb-test \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -883,8 +883,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Crl option -.\" SSL CRL option: mysqltest +.\" mariadb-test: SSL Crl option +.\" SSL CRL option: mariadb-test \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -899,8 +899,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Crlpath option -.\" SSL Crlpath option: mysqltest +.\" mariadb-test: SSL Crlpath option +.\" SSL Crlpath option: mariadb-test \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -915,8 +915,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqltest +.\" mariadb-test: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-test \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -930,8 +930,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: suite-dir option -.\" suite-dir option: mysqltest +.\" mariadb-test: suite-dir option +.\" suite-dir option: mariadb-test \fB\-\-suite\-dir=\fIdir_name\fR .sp Suite directory\&. @@ -945,8 +945,8 @@ Suite directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: tail-lines option -.\" tail-lines option: mysqltest +.\" mariadb-test: tail-lines option +.\" tail-lines option: mariadb-test \fB\-\-tail\-lines=\fR\fB\fInn\fR\fR .sp Specify how many lines of the result to include in the output if the test fails because an SQL statement fails\&. The default is 0, meaning no lines of result printed\&. @@ -960,8 +960,8 @@ Specify how many lines of the result to include in the output if the test fails .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: test-file option -.\" test-file option: mysqltest +.\" mariadb-test: test-file option +.\" test-file option: mariadb-test \fB\-\-test\-file=\fR\fB\fIfile_name\fR\fR, \fB\-x \fR\fB\fIfile_name\fR\fR .sp @@ -976,13 +976,13 @@ Read test input from this file\&. The default is to read from the standard input .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: timer-file option -.\" timer-file option: mysqltest +.\" mariadb-test: timer-file option +.\" timer-file option: mariadb-test \fB\-\-timer\-file=\fR\fB\fIfile_name\fR\fR, \fB\-m \fR\fB\fIfile_name\fR\fR .sp If given, the number of microseconds spent running the test will be written to this file\&. This is used by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR for its reporting\&. .RE .sp @@ -994,8 +994,8 @@ for its reporting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: tmpdir option -.\" tmpdir option: mysqltest +.\" mariadb-test: tmpdir option +.\" tmpdir option: mariadb-test \fB\-\-tmpdir=\fR\fB\fIdir_name\fR\fR, \fB\-t \fR\fB\fIdir_name\fR\fR .sp @@ -1010,8 +1010,8 @@ The temporary directory where socket files are created\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: user option -.\" user option: mysqltest +.\" mariadb-test: user option +.\" user option: mariadb-test \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1026,8 +1026,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: verbose option -.\" verbose option: mysqltest +.\" mariadb-test: verbose option +.\" verbose option: mariadb-test \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1042,8 +1042,8 @@ Verbose mode\&. Print out more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: version option -.\" version option: mysqltest +.\" mariadb-test: version option +.\" version option: mariadb-test \fB\-\-version\fR, \fB\-V\fR .sp @@ -1058,8 +1058,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: view-protocol option -.\" view-protocol option: mysqltest +.\" mariadb-test: view-protocol option +.\" view-protocol option: mariadb-test \fB\-\-view\-protocol\fR .sp Every @@ -1069,7 +1069,7 @@ statement is wrapped inside a view\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-tzinfo-to-sql.1 b/man/mariadb-tzinfo-to-sql.1 index e287db0c9ce..f1b751229d7 100644 --- a/man/mariadb-tzinfo-to-sql.1 +++ b/man/mariadb-tzinfo-to-sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "22 April 2022" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_tzinfo_to_sql +.\" mariadb-tzinfo-to-sql .\" time zone tables .SH "NAME" -mariadb-tzinfo-to-sql \- load the time zone tables (mysql_tzinfo_to_sql is now a symlink to mariadb-tzinfo-to-sql) +mariadb-tzinfo-to-sql \- load the time zone tables (mariadb-tzinfo-to-sql is now a symlink to mariadb-tzinfo-to-sql) .SH "SYNOPSIS" -.HP \w'\fBmysql_tzinfo_to_sql\ \fR\fB\fIarguments\fR\fR\ 'u -\fBmysql_tzinfo_to_sql \fR\fB\fIarguments\fR\fR +.HP \w'\fBmariadb-tzinfo-to-sql\ \fR\fB\fIarguments\fR\fR\ 'u +\fBmariadb-tzinfo-to-sql \fR\fB\fIarguments\fR\fR .SH "DESCRIPTION" .PP The -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR program loads the time zone tables in the mysql database\&. It is used on systems that have a @@ -31,45 +31,45 @@ database (the set of files describing time zones)\&. Examples of such systems ar directory (/usr/share/lib/zoneinfo on Solaris)\&. .PP -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR can be invoked several ways: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_dir\fR\fR -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file tz_name\fR\fR -shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR -shell> \fBmysql_tzinfo_to_sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_dir\fR\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_file tz_name\fR\fR +shell> \fBmariadb-tzinfo-to-sql \-\-leap \fR\fB\fItz_file\fR\fR +shell> \fBmariadb-tzinfo-to-sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR .fi .if n \{\ .RE .\} .PP For the first invocation syntax, pass the zoneinfo directory path name to -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR and send the output into the -\fBmysql\fR +\fBmariadb\fR program\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql /usr/share/zoneinfo | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql /usr/share/zoneinfo | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR reads your system's time zone files and generates SQL statements from them\&. -\fBmysql\fR +\fBmariadb\fR processes those statements to load the time zone tables\&. .PP The second syntax causes -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR to load a single time zone file \fItz_file\fR that corresponds to a time zone name @@ -79,14 +79,14 @@ that corresponds to a time zone name .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file\fR\fR\fB \fR\fB\fItz_name\fR\fR\fB | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_file\fR\fR\fB \fR\fB\fItz_name\fR\fR\fB | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP If your time zone needs to account for leap seconds, invoke -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR using the third syntax, which initializes the leap second information\&. \fItz_file\fR is the name of your time zone file: @@ -95,21 +95,21 @@ is the name of your time zone file: .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP Using the \-\-skip\-write\-binlog option prevents writing of changes to the binary log or to other Galera -cluster members. This can be used with any form of running \fBmysql_tzinfo_to_sql\fR. +cluster members. This can be used with any form of running \fBmariadb-tzinfo-to-sql\fR. .PP After running -\fBmysql_tzinfo_to_sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&. +\fBmariadb-tzinfo-to-sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-upgrade.1 b/man/mariadb-upgrade.1 index fb4988cd040..32d506d8dfe 100644 --- a/man/mariadb-upgrade.1 +++ b/man/mariadb-upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-UPGRADE\fR" "1" "20 July 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-UPGRADE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,26 +11,26 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_upgrade -.\" upgrading MySQL -.\" MySQL: upgrading +.\" mariadb-upgrade +.\" upgrading MariaDB +.\" MariaDB: upgrading .SH "NAME" -mariadb-upgrade \- check tables for MariaDB upgrade (mysql_upgrade is now a symlink to mariadb-upgrade) +mariadb-upgrade \- check tables for MariaDB upgrade (mariadb-upgrade is now a symlink to mariadb-upgrade) .SH "SYNOPSIS" -.HP \w'\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR examines all tables in all databases for incompatibilities with the current version of the MariaDB Server\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\&. .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR should be executed each time you upgrade MariaDB\&. .PP If a table is found to have a possible incompatibility, -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR performs a table check\&. If any problems are found, a table repair is attempted\&. .if n \{\ .sp @@ -46,7 +46,7 @@ performs a table check\&. If any problems are found, a table repair is attempted .br .PP On Windows Server 2008 and Windows Vista, you must run -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR with administrator privileges\&. You can do this by running a Command Prompt as Administrator and running the command\&. Failure to do so may result in the upgrade failing to execute correctly\&. .sp .5v .RE @@ -70,31 +70,31 @@ performing an upgrade\&. .RE .PP To use -\fBmysql_upgrade\fR, make sure that the server is running, and then invoke it like this: +\fBmariadb-upgrade\fR, make sure that the server is running, and then invoke it like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP After running -\fBmysql_upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&. +\fBmariadb-upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&. .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR executes the following commands to check and repair tables and to upgrade the system tables: .sp .if n \{\ .RS 4 .\} .nf -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair -mysql < \fIfix_priv_tables\fR -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names +mariadb-check \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair +mariadb < \fIfix_priv_tables\fR +mariadb-check \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names .fi .if n \{\ .RE @@ -111,9 +111,9 @@ Notes about the preceding commands: .IP \(bu 2.3 .\} Because -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR invokes -\fBmysqlcheck\fR +\fBmariadb-check\fR with the \fB\-\-all\-databases\fR option, it processes all tables in all databases, which might take a long time to complete\&. Each table is locked and therefore unavailable to other sessions while it is being processed\&. Check and repair operations can be time\-consuming, particularly for large tables\&. @@ -146,43 +146,43 @@ statement\&. .\} \fIfix_priv_tables\fR represents a script generated internally by -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR that contains SQL statements to upgrade the tables in the mysql database\&. .RE .PP All checked and repaired tables are marked with the current MariaDB version number\&. This ensures that next time you run -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR with the same version of the server, it can tell whether there is any need to check or repair the table again\&. -.\" mysql_upgrade_info file: mysql_upgrade -.\" mysql_upgrade: mysql_upgrade_info file +.\" mariadb-upgrade_info file: mariadb-upgrade +.\" mariadb-upgrade: mariadb-upgrade_info file .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also saves the MariaDB version number in a file named -mysql_upgrade_info +mariadb-upgrade_info in the data directory\&. This is used to quickly check whether all tables have been checked for this release so that table\-checking can be skipped\&. To ignore this file and perform the check regardless, use the \fB\-\-force\fR option\&. .PP -For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&. +For this reason, \fBmariadb-upgrade\fR needs to be run as a user with write access to the data directory\&. .PP If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR is included in the server RPM but requires the client RPM because the latter includes -\fBmysqlcheck\fR\&. +\fBmariadb-check\fR\&. .PP .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR supports the following options, which can be specified on the command line or in the -[mysql_upgrade] +[mariadb-upgrade] and [client] option file groups\&. Other options are passed to -\fBmysqlcheck\fR\&. For example, it might be necessary to specify the +\fBmariadb-check\fR\&. For example, it might be necessary to specify the \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR option\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also supports the options for processing option files\&. .sp .RS 4 @@ -193,8 +193,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: help option -.\" help option: mysql_upgrade +.\" mariadb-upgrade: help option +.\" help option: mariadb-upgrade \fB\-\-help\fR, \fB\-?\fR .sp @@ -209,8 +209,8 @@ Display a short help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: basedir option -.\" basedir option: mysql_upgrade +.\" mariadb-upgrade: basedir option +.\" basedir option: mariadb-upgrade \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -224,8 +224,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: character-sets-dir option -.\" character-sets-dir option: mysql_upgrade +.\" mariadb-upgrade: character-sets-dir option +.\" character-sets-dir option: mariadb-upgrade \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -239,8 +239,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: check-if-upgrade-is-needed option -.\" check-if-upgrade-is-needed option: mysql_upgrade +.\" mariadb-upgrade: check-if-upgrade-is-needed option +.\" check-if-upgrade-is-needed option: mariadb-upgrade \fB\-\-check\-if\-upgrade\-is\-needed\fR .sp Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgrade needed or current version couldn't be determined, 1 when no action required\&. @@ -254,8 +254,8 @@ Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgra .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: datadir option -.\" datadir option: mysql_upgrade +.\" mariadb-upgrade: datadir option +.\" datadir option: mariadb-upgrade \fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -269,8 +269,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug option -.\" debug option: mysql_upgrade +.\" mariadb-upgrade: debug option +.\" debug option: mariadb-upgrade \fB\-\-debug=\fR\fB\fIpath\fR\fR, \fB\-# \fIpath\fR\fR .sp @@ -285,8 +285,8 @@ For debug builds, output debug log\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug-check option -.\" debug-check option: mysql_upgrade +.\" mariadb-upgrade: debug-check option +.\" debug-check option: mariadb-upgrade \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -300,8 +300,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug-info option -.\" debug-info option: mysql_upgrade +.\" mariadb-upgrade: debug-info option +.\" debug-info option: mariadb-upgrade \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -316,8 +316,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: default-character-set option -.\" default-character-set option: mysql_upgrade +.\" mariadb-upgrade: default-character-set option +.\" default-character-set option: mariadb-upgrade \fB\-\-default\-character\-set=\fR\fB\fIname\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -331,16 +331,16 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: force option -.\" force option: mysql_upgrade +.\" mariadb-upgrade: force option +.\" force option: mariadb-upgrade \fB\-\-force\fR .sp Ignore the -mysql_upgrade_info +mariadb-upgrade_info file and force execution of -\fBmysqlcheck\fR +\fBmariadb-check\fR even if -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR has already been executed for the current version of MariaDB\&. .RE .sp @@ -352,8 +352,8 @@ has already been executed for the current version of MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: host option -.\" host option: mysql_upgrade +.\" mariadb-upgrade: host option +.\" host option: mariadb-upgrade \fB\-\-host\fR .sp Connect to MariaDB on the given host\&. @@ -367,8 +367,8 @@ Connect to MariaDB on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: password option -.\" password option: mysql_upgrade +.\" mariadb-upgrade: password option +.\" password option: mariadb-upgrade \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -381,7 +381,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -395,8 +395,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: port option -.\" port option: mysql_upgrade +.\" mariadb-upgrade: port option +.\" port option: mariadb-upgrade \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -411,8 +411,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: protocol option -.\" protocol option: mysql_upgrade +.\" mariadb-upgrade: protocol option +.\" protocol option: mariadb-upgrade \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -426,8 +426,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: silent option -.\" silent option: mysql_upgrade +.\" mariadb-upgrade: silent option +.\" silent option: mariadb-upgrade \fB\-\-silent\fR .sp Print less information\&. @@ -441,8 +441,8 @@ Print less information\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: socket option -.\" socket option: mysql_upgrade +.\" mariadb-upgrade: socket option +.\" socket option: mariadb-upgrade \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -458,8 +458,8 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL options -.\" SSL options: mysql_upgrade +.\" mariadb-upgrade: SSL options +.\" SSL options: mariadb-upgrade \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -474,8 +474,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL CA option -.\" SSL CA option: mysql_upgrade +.\" mariadb-upgrade: SSL CA option +.\" SSL CA option: mariadb-upgrade \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -490,8 +490,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL CA Path option -.\" SSL CA Path option: mysql_upgrade +.\" mariadb-upgrade: SSL CA Path option +.\" SSL CA Path option: mariadb-upgrade \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -506,8 +506,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Cert option -.\" SSL Cert option: mysql_upgrade +.\" mariadb-upgrade: SSL Cert option +.\" SSL Cert option: mariadb-upgrade \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -522,8 +522,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Cipher option -.\" SSL Cipher option: mysql_upgrade +.\" mariadb-upgrade: SSL Cipher option +.\" SSL Cipher option: mariadb-upgrade \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -538,8 +538,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Key option -.\" SSL Key option: mysql_upgrade +.\" mariadb-upgrade: SSL Key option +.\" SSL Key option: mariadb-upgrade \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -554,8 +554,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Crl option -.\" SSL CRL option: mysql_upgrade +.\" mariadb-upgrade: SSL Crl option +.\" SSL CRL option: mariadb-upgrade \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -570,8 +570,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Crlpath option -.\" SSL Crlpath option: mysql_upgrade +.\" mariadb-upgrade: SSL Crlpath option +.\" SSL Crlpath option: mariadb-upgrade \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -586,8 +586,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysql_upgrade +.\" mariadb-upgrade: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-upgrade \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -601,8 +601,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: tmpdir option -.\" tmpdir option: mysql_upgrade +.\" mariadb-upgrade: tmpdir option +.\" tmpdir option: mariadb-upgrade \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR, \fB\-t \fR\fB\fIpath\fR\fR .sp @@ -617,8 +617,8 @@ The path name of the directory to use for creating temporary files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: upgrade-system-tables option -.\" upgrade-system-tables option: mysql_upgrade +.\" mariadb-upgrade: upgrade-system-tables option +.\" upgrade-system-tables option: mariadb-upgrade \fB\-\-upgrade\-system\-tables\fR\fR, \fB\-s \fR .sp @@ -633,8 +633,8 @@ Only upgrade the system tables in the mysql database\&. Tables in other database .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: user option -.\" user option: mysql_upgrade +.\" mariadb-upgrade: user option +.\" user option: mariadb-upgrade \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -649,15 +649,15 @@ The MariaDB user name to use when connecting to the server and not using the cur .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: verbose option -.\" verbose option: mysql_upgrade +.\" mariadb-upgrade: verbose option +.\" verbose option: mariadb-upgrade \fB\-\-verbose\fR .sp Display more output about the process\&. Using it twice will print connection arguments; using it 3 times will print out all CHECK, RENAME and ALTER TABLE commands used during the check phase; using it 4 times (added in MariaDB 10.0.14) will also write out all mariadb-check commands used; using it 5 times will print all -the mariadb commands used and their results while running mysql_fix_privilege_tables script\&. +the mariadb commands used and their results while running mariadb-fix-privilege-tables script\&. .RE .sp .RS 4 @@ -668,8 +668,8 @@ the mariadb commands used and their results while running mysql_fix_privilege_ta .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: version option -.\" version option: mysql_upgrade +.\" mariadb-upgrade: version option +.\" version option: mariadb-upgrade \fB\-\-version\fR, \fB\-V\fR .sp @@ -684,8 +684,8 @@ Output version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: version-check option -.\" version-check option: mysql_upgrade +.\" mariadb-upgrade: version-check option +.\" version-check option: mariadb-upgrade \fB\-\-version\-check\fR, \fB\-k\fR .sp @@ -703,18 +703,18 @@ it was built/distributed. Defaults to on; use \fB\-\-skip\-version\-check\fR to .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: write-binlog option -.\" write-binlog option: mysql_upgrade +.\" mariadb-upgrade: write-binlog option +.\" write-binlog option: mariadb-upgrade \fB\-\-write\-binlog\fR .sp Cause binary logging to be enabled while -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR runs\&. .RE .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-waitpid.1 b/man/mariadb-waitpid.1 index 268518d5b98..3c4448d3faa 100644 --- a/man/mariadb-waitpid.1 +++ b/man/mariadb-waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-WAITPID\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-WAITPID\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_waitpid +.\" mariadb-waitpid .SH "NAME" -mariadb-waitpid \- kill process and wait for its termination (mysql_waitpid is now a symlink to mariadb-waitpid) +mariadb-waitpid \- kill process and wait for its termination (mariadb-waitpid is now a symlink to mariadb-waitpid) .SH "SYNOPSIS" -.HP \w'\fBmysql_waitpid\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpid\fR\fR\fB\ \fR\fB\fIwait_time\fR\fR\ 'u -\fBmysql_waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR +.HP \w'\fBmariadb-waitpid\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpid\fR\fR\fB\ \fR\fB\fIwait_time\fR\fR\ 'u +\fBmariadb-waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR signals a process to terminate and waits for the process to exit\&. It uses the kill() system call and Unix signals, so it runs on Unix and Unix\-like systems\&. .PP Invoke -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR +shell> \fBmariadb-waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR .fi .if n \{\ .RE .\} .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR sends signal 0 to the process identified by \fIpid\fR and waits up to @@ -50,16 +50,16 @@ and must be positive integers\&. .PP If process termination occurs within the wait time or the process does not exist, -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR returns 0\&. Otherwise, it returns 1\&. .PP If the kill() system call cannot handle signal 0, -\fBmysql_waitpid()\fR +\fBmariadb-waitpid()\fR uses signal 1 instead\&. .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR supports the following options: .sp .RS 4 @@ -70,8 +70,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: help option -.\" help option: mysql_waitpid +.\" mariadb-waitpid: help option +.\" help option: mariadb-waitpid \fB\-\-help\fR, \fB\-?\fR, \fB\-I\fR @@ -87,8 +87,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: verbose option -.\" verbose option: mysql_waitpid +.\" mariadb-waitpid: verbose option +.\" verbose option: mariadb-waitpid \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -103,8 +103,8 @@ Verbose mode\&. Display a warning if signal 0 could not be used and signal 1 is .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: version option -.\" version option: mysql_waitpid +.\" mariadb-waitpid: version option +.\" version option: mariadb-waitpid \fB\-\-version\fR, \fB\-V\fR .sp @@ -113,7 +113,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb.1 b/man/mariadb.1 index fec2b5c3724..2e65f9c50bb 100644 --- a/man/mariadb.1 +++ b/man/mariadb.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,7 +11,7 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql +.\" mariadb .\" command-line tool .\" tools: command-line .\" scripts: SQL @@ -20,11 +20,11 @@ .SH "NAME" mariadb \- the MariaDB command\-line tool (mysql is now a symlink to mariadb) .SH "SYNOPSIS" -.HP \w'\fBmysql\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u -\fBmysql [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR +.HP \w'\fBmariadb\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u +\fBmariadb [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR .SH "DESCRIPTION" .PP -\fBmysql\fR +\fBmariadb\fR is a simple SQL shell (with GNU readline capabilities)\&. It supports interactive and non\-interactive use\&. When used interactively, query results are presented in an ASCII\-table format\&. When used non\-interactively (for example, as a filter), the result is presented in tab\-separated format\&. The output format can be changed using command options\&. @@ -32,21 +32,21 @@ capabilities)\&. It supports interactive and non\-interactive use\&. When used i If you have problems due to insufficient memory for large result sets, use the \fB\-\-quick\fR option\&. This forces -\fBmysql\fR +\fBmariadb\fR to retrieve results from the server a row at a time rather than retrieving the entire result set and buffering it in memory before displaying it\&. This is done by returning the result set using the -mysql_use_result() +mariadb_use_result() C API function in the client/server library rather than mysql_store_result()\&. .PP Using -\fBmysql\fR +\fBmariadb\fR is very easy\&. Invoke it from the prompt of your command interpreter as follows: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -58,7 +58,7 @@ Or: .RS 4 .\} .nf -shell> \fBmysql \-\-user=\fR\fB\fIuser_name\fR\fR\fB \-\-password=\fR\fB\fIyour_password\fR\fR\fB \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \-\-user=\fR\fB\fIuser_name\fR\fR\fB \-\-password=\fR\fB\fIyour_password\fR\fR\fB \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -71,9 +71,9 @@ Then type an SQL statement, end it with and press Enter\&. .PP Typing Control\-C causes -\fBmysql\fR +\fBmariadb\fR to attempt to kill the current statement\&. If this cannot be done, or Control\-C is typed again before the statement is killed, -\fBmysql\fR +\fBmariadb\fR exits\&. .PP You can execute SQL statements in a script file (batch file) like this: @@ -82,22 +82,22 @@ You can execute SQL statements in a script file (batch file) like this: .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIscript\&.sql\fR\fR\fB > \fR\fB\fIoutput\&.tab\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIscript\&.sql\fR\fR\fB > \fR\fB\fIoutput\&.tab\fR\fR .fi .if n \{\ .RE .\} -.SH "MYSQL OPTIONS" -.\" mysql command options -.\" command options: mysql -.\" options: command-line: mysql -.\" startup parameters: mysql +.SH "MARIADB OPTIONS" +.\" mariadb command options +.\" command options: mariadb +.\" options: command-line: mariadb +.\" startup parameters: mariadb .PP -\fBmysql\fR +\fBmariadb\fR supports the following options, which can be specified on the command line or in the -[mysql], [client], [client-server] or [client-mariadb] +[mariadb], [client], [client-server] or [client-mariadb] option file groups\&. -\fBmysql\fR +\fBmariadb\fR also supports the options for processing option files\&. .sp .RS 4 @@ -108,8 +108,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: help option -.\" help option: mysql +.\" mariadb: help option +.\" help option: mariadb \fB\-\-help\fR, \fB\-?\fR, \fB\-I\fR @@ -125,8 +125,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: abort-source-on-error option -.\" abort-source-on-error: mysql +.\" mariadb: abort-source-on-error option +.\" abort-source-on-error: mariadb \fB\-\-abort\-source\-on\-error\fR .sp Abort 'source filename' operations in case of errors\&. @@ -140,20 +140,20 @@ Abort 'source filename' operations in case of errors\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: auto-rehash option -.\" auto-rehash option: mysql +.\" mariadb: auto-rehash option +.\" auto-rehash option: mariadb \fB\-\-auto\-rehash\fR .sp Enable automatic rehashing\&. This option is on by default, which enables database, table, and column name completion\&. Use \fB\-\-disable\-auto\-rehash\fR, \fB\-\-no\-auto\-rehash\fR, or \fB\-\-skip\-auto\-rehash\fR to disable rehashing\&. That causes -\fBmysql\fR +\fBmariadb\fR to start faster, but you must issue the rehash command if you want to use name completion\&. .sp To complete a name, enter the first part and press Tab\&. If the name is unambiguous, -\fBmysql\fR +\fBmariadb\fR completes it\&. Otherwise, you can press Tab again to see the possible names that begin with what you have typed so far\&. Completion does not occur if there is no default database\&. .RE .sp @@ -165,8 +165,8 @@ completes it\&. Otherwise, you can press Tab again to see the possible names tha .sp -1 .IP \(bu 2.3 .\} -.\" mysql: auto-vertical-output option -.\" auto-vertical-output option: mysql +.\" mariadb: auto-vertical-output option +.\" auto-vertical-output option: mariadb \fB\-\-auto\-vertical\-output\fR .sp Automatically switch to vertical output mode if the result is wider than the terminal width\&. @@ -180,13 +180,13 @@ Automatically switch to vertical output mode if the result is wider than the ter .sp -1 .IP \(bu 2.3 .\} -.\" mysql: batch option -.\" batch option: mysql +.\" mariadb: batch option +.\" batch option: mariadb \fB\-\-batch\fR, \fB\-B\fR .sp Print results using tab as the column separator, with each row on a new line\&. With this option, -\fBmysql\fR +\fBmariadb\fR does not use the history file\&. .sp Batch mode results in nontabular output format and escaping of special characters\&. Escaping may be disabled by using raw mode; see the description for the @@ -202,15 +202,15 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: binary-mode option -.\" binary-mode option: mysql +.\" mariadb: binary-mode option +.\" binary-mode option: mariadb \fB\-\-binary\-mode\fR .sp Binary mode allows certain character sequences to be processed as data that would otherwise be treated with a special meaning by the parser\&. Specifically, this switch turns off parsing of all client commands except \eC and DELIMITER in non-interactive mode (i\&.e\&., when binary mode is combined -with either 1) piped input, 2) the --batch mysql option, or 3) the 'source' +with either 1) piped input, 2) the --batch mariadb option, or 3) the 'source' command)\&. Also, in binary mode, occurrences of '\er\en' and ASCII '\e0' are preserved within strings, whereas by default, '\er\en' is translated to '\en' and '\e0' is disallowed in user input\&. @@ -224,8 +224,8 @@ and '\e0' is disallowed in user input\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: character-sets-dir option -.\" character-sets-dir option: mysql +.\" mariadb: character-sets-dir option +.\" character-sets-dir option: mariadb \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -239,8 +239,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: column-names option -.\" column-names option: mysql +.\" mariadb: column-names option +.\" column-names option: mariadb \fB\-\-column\-names\fR .sp Write column names in results\&. @@ -254,8 +254,8 @@ Write column names in results\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: column-type-info option -.\" column-type-info option: mysql +.\" mariadb: column-type-info option +.\" column-type-info option: mariadb \fB\-\-column\-type\-info\fR, \fB\-m\fR .sp @@ -270,8 +270,8 @@ Display result set metadata\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: comments option -.\" comments option: mysql +.\" mariadb: comments option +.\" comments option: mariadb \fB\-\-comments\fR, \fB\-c\fR .sp @@ -286,8 +286,8 @@ Whether to preserve comments in statements sent to the server\&. The default is .sp -1 .IP \(bu 2.3 .\} -.\" mysql: compress option -.\" compress option: mysql +.\" mariadb: compress option +.\" compress option: mariadb \fB\-\-compress\fR, \fB\-C\fR .sp @@ -302,8 +302,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysql: connect-timeout option -.\" connect-timeout option: mysql +.\" mariadb: connect-timeout option +.\" connect-timeout option: mariadb \fB\-\-connect\-timeout=\fR\fB\fIseconds\fR\fR .sp Set the number of seconds before connection timeout\&. (Default value is 0\&.) @@ -317,8 +317,8 @@ Set the number of seconds before connection timeout\&. (Default value is 0\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: database option -.\" database option: mysql +.\" mariadb: database option +.\" database option: mariadb \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -333,8 +333,8 @@ The database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug option -.\" debug option: mysql +.\" mariadb: debug option +.\" debug option: mariadb \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -351,8 +351,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysql.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug-check option -.\" debug-check option: mysql +.\" mariadb: debug-check option +.\" debug-check option: mariadb \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -366,8 +366,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug-info option -.\" debug-info option: mysql +.\" mariadb: debug-info option +.\" debug-info option: mariadb \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -382,8 +382,8 @@ Prints debugging information and memory and CPU usage statistics when the progra .sp -1 .IP \(bu 2.3 .\} -.\" mysql: default-auth option -.\" default-auth option: mysql +.\" mariadb: default-auth option +.\" default-auth option: mariadb \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -397,8 +397,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: default-character-set option -.\" default-character-set option: mysql +.\" mariadb: default-character-set option +.\" default-character-set option: mariadb \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -408,7 +408,7 @@ as the default character set for the client and connection\&. A common issue that can occur when the operating system uses utf8 or another multi\-byte character set is that output from the -\fBmysql\fR +\fBmariadb\fR client is formatted incorrectly, due to the fact that the MariaDB client uses the latin1 character set by default\&. You can usually fix such issues by using this option to force the client to use the system character set instead\&. @@ -422,8 +422,8 @@ character set by default\&. You can usually fix such issues by using this option .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-extra-file option -.\" defaults-extra-file option: mysql +.\" mariadb: defaults-extra-file option +.\" defaults-extra-file option: mariadb \fB\-\-defaults-extra-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -438,8 +438,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-file option -.\" defaults-file option: mysql +.\" mariadb: defaults-file option +.\" defaults-file option: mariadb \fB\-\-defaults-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. Must be given as first option\&. @@ -453,8 +453,8 @@ Set \fB\fIfilename\fR\fR as the file to read default options from, override glob .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-group-suffix option -.\" defaults-group-suffix option: mysql +.\" mariadb: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb \fB\-\-defaults\-group\-suffix=\fR\fB\fIsuffix\fR\fR .sp In addition to the groups named on the command line, read groups that have the given suffix\&. @@ -468,8 +468,8 @@ In addition to the groups named on the command line, read groups that have the g .sp -1 .IP \(bu 2.3 .\} -.\" mysql: delimiter option -.\" delimiter option: mysql +.\" mariadb: delimiter option +.\" delimiter option: mariadb \fB\-\-delimiter=\fR\fB\fIstr\fR\fR .sp Set the statement delimiter\&. The default is the semicolon character (\(lq;\(rq)\&. @@ -483,18 +483,18 @@ Set the statement delimiter\&. The default is the semicolon character (\(lq;\(rq .sp -1 .IP \(bu 2.3 .\} -.\" mysql: disable named commands -.\" disable named command: mysql +.\" mariadb: disable named commands +.\" disable named command: mariadb \fB\-\-disable\-named\-commands\fR .sp Disable named commands\&. Use the \e* form only, or use named commands only at the beginning of a line ending with a semicolon (\(lq;\(rq)\&. -\fBmysql\fR +\fBmariadb\fR starts with this option \fIenabled\fR by default\&. However, even with this option, long\-format commands still work from the first line\&. See -the section called \(lqMYSQL COMMANDS\(rq\&. +the section called \(lqMARIADB COMMANDS\(rq\&. .RE .sp .RS 4 @@ -505,8 +505,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: enable cleartext plugin option -.\" enable cleartext plugin option: mysql +.\" mariadb: enable cleartext plugin option +.\" enable cleartext plugin option: mariadb \fB\-\-enable\-cleartext\-plugin\fR .sp Obsolete option\&. Exists only for MySQL compatibility\&. @@ -520,8 +520,8 @@ Obsolete option\&. Exists only for MySQL compatibility\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: execute option -.\" execute option: mysql +.\" mariadb: execute option +.\" execute option: mariadb \fB\-\-execute=\fR\fB\fIstatement\fR\fR, \fB\-e \fR\fB\fIstatement\fR\fR .sp @@ -537,8 +537,8 @@ Execute the statement and quit\&. Disables \fB\-\-force\fR and history file\&. T .sp -1 .IP \(bu 2.3 .\} -.\" mysql: force option -.\" force option: mysql +.\" mariadb: force option +.\" force option: mariadb \fB\-\-force\fR, \fB\-f\fR .sp @@ -553,8 +553,8 @@ Continue even if an SQL error occurs\&. Sets \fB\-\-abort\-source\-on-error\fR t .sp -1 .IP \(bu 2.3 .\} -.\" mysql: host option -.\" host option: mysql +.\" mariadb: host option +.\" host option: mariadb \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -569,8 +569,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: html option -.\" html option: mysql +.\" mariadb: html option +.\" html option: mariadb \fB\-\-html\fR, \fB\-H\fR .sp @@ -585,8 +585,8 @@ Produce HTML output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: ignore-spaces option -.\" ignore-spaces option: mysql +.\" mariadb: ignore-spaces option +.\" ignore-spaces option: mariadb \fB\-\-ignore\-spaces\fR, \fB\-i\fR .sp @@ -601,8 +601,8 @@ Ignore spaces after function names\&. Allows one to have spaces (including tab c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: init-command option -.\" init-command option: mysql +.\" mariadb: init-command option +.\" init-command option: mariadb \fB\-\-init\-command=\fR\fB\fIstr\fR\fR\fR .sp SQL Command to execute when connecting to the MariaDB server\&. Will automatically be re-executed when reconnecting\&. @@ -616,8 +616,8 @@ SQL Command to execute when connecting to the MariaDB server\&. Will automatical .sp -1 .IP \(bu 2.3 .\} -.\" mysql: line-numbers option -.\" line-numbers option: mysql +.\" mariadb: line-numbers option +.\" line-numbers option: mariadb \fB\-\-line\-numbers\fR .sp Write line numbers for errors\&. Disable this with @@ -632,8 +632,8 @@ Write line numbers for errors\&. Disable this with .sp -1 .IP \(bu 2.3 .\} -.\" mysql: local-infile option -.\" local-infile option: mysql +.\" mariadb: local-infile option +.\" local-infile option: mariadb \fB\-\-local\-infile[={0|1}]\fR .sp Enable or disable @@ -658,8 +658,8 @@ has no effect if the server does not also support it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: max-allowed-packet option -.\" max-allowed-packet option: mysql +.\" mariadb: max-allowed-packet option +.\" max-allowed-packet option: mariadb \fB\-\-max\-allowed\-packet=\fR\fB\fInum\fR\fR .sp Set the maximum packet length to send to or receive from the server\&. (Default value is 16MB, largest 1GB\&.) @@ -673,8 +673,8 @@ Set the maximum packet length to send to or receive from the server\&. (Default .sp -1 .IP \(bu 2.3 .\} -.\" mysql: max-join-size option -.\" max-join-size option: mysql +.\" mariadb: max-join-size option +.\" max-join-size option: mariadb \fB\-\-max\-join\-size=\fR\fB\fInum\fR\fR .sp Set the automatic limit for rows in a join when using @@ -689,13 +689,13 @@ Set the automatic limit for rows in a join when using .sp -1 .IP \(bu 2.3 .\} -.\" mysql: named-commands option -.\" named-commands option: mysql +.\" mariadb: named-commands option +.\" named-commands option: mariadb \fB\-\-named\-commands\fR, \fB\-G\fR .sp Enable named -\fBmysql\fR +\fBmariadb\fR commands\&. Long\-format commands are allowed, not just short\-format commands\&. For example, quit and @@ -703,7 +703,7 @@ and both are recognized\&. Use \fB\-\-skip\-named\-commands\fR to disable named commands\&. See -the section called \(lqMYSQL COMMANDS\(rq\&. Disabled by default\&. +the section called \(lqMARIADB COMMANDS\(rq\&. Disabled by default\&. .RE .sp .RS 4 @@ -716,8 +716,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. Disabled by default\&. .\} \h'-04'\(bu\h'+03'\c .\} -.\" mysql: net-buffer-length option -.\" net-buffer-length option: mysql +.\" mariadb: net-buffer-length option +.\" net-buffer-length option: mariadb \fB\-\-net\-buffer\-length=\fR\fB\fIsize\fR\fR .sp Set the buffer size for TCP/IP and socket communication\&. (Default value is 16KB\&.) @@ -731,8 +731,8 @@ Set the buffer size for TCP/IP and socket communication\&. (Default value is 16K .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-auto-rehash option -.\" no-auto-rehash option: mysql +.\" mariadb: no-auto-rehash option +.\" no-auto-rehash option: mariadb \fB\-\-no\-auto\-rehash\fR, \fB\-A\fR .sp @@ -749,8 +749,8 @@ This has the same effect as .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-beep option -.\" no-beep option: mysql +.\" mariadb: no-beep option +.\" no-beep option: mariadb \fB\-\-no\-beep\fR, \fB\-b\fR .sp @@ -765,8 +765,8 @@ Do not beep when errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-defaults option -.\" no-defaults option: mysql +.\" mariadb: no-defaults option +.\" no-defaults option: mariadb \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -780,8 +780,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysql: one-database option -.\" one-database option: mysql +.\" mariadb: one-database option +.\" one-database option: mariadb \fB\-\-one\-database\fR, \fB\-o\fR .sp @@ -796,8 +796,8 @@ Ignore statements except those those that occur while the default database is th .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pager option -.\" pager option: mysql +.\" mariadb: pager option +.\" pager option: mariadb \fB\-\-pager[=\fR\fB\fIcommand\fR\fR\fB]\fR .sp Use the given command for paging query output\&. If the command is omitted, the default pager is the value of your @@ -807,7 +807,7 @@ environment variable\&. Valid pagers are \fBmore\fR, \fBcat [> filename]\fR, and so forth\&. This option works only on Unix and only in interactive mode\&. To disable paging, use \fB\-\-skip\-pager\fR\&. -the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&. +the section called \(lqMARIADB COMMANDS\(rq, discusses output paging further\&. .RE .sp .RS 4 @@ -818,8 +818,8 @@ the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: password option -.\" password option: mysql +.\" mariadb: password option +.\" password option: mariadb \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -832,7 +832,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysql\fR +\fBmariadb\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -846,8 +846,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pipe option -.\" pipe option: mysql +.\" mariadb: pipe option +.\" pipe option: mariadb \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -862,8 +862,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysql: plugin-dir option -.\" plugin-dir option: mysql +.\" mariadb: plugin-dir option +.\" plugin-dir option: mariadb \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -877,8 +877,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: port option -.\" port option: mysql +.\" mariadb: port option +.\" port option: mariadb \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -894,8 +894,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysql: print-defaults option -.\" print-defaults option: mysql +.\" mariadb: print-defaults option +.\" print-defaults option: mariadb \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -909,8 +909,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysql: progress-reports option -.\" progress-reports option: mysql +.\" mariadb: progress-reports option +.\" progress-reports option: mariadb \fB\-\-progress\-reports\fR .sp Get progress reports for long running commands (such as ALTER TABLE)\&. (Defaults to on; use \fB\-\-skip\-progress\-reports\fR to disable\&.) @@ -924,12 +924,12 @@ Get progress reports for long running commands (such as ALTER TABLE)\&. (Default .sp -1 .IP \(bu 2.3 .\} -.\" mysql: prompt option -.\" prompt option: mysql +.\" mariadb: prompt option +.\" prompt option: mariadb \fB\-\-prompt=\fR\fB\fIformat_str\fR\fR .sp Set the prompt to the specified format\&. The special sequences that the prompt can contain are described in -the section called \(lqMYSQL COMMANDS\(rq\&. +the section called \(lqMARIADB COMMANDS\(rq\&. .RE .sp .RS 4 @@ -940,8 +940,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: protocol option -.\" protocol option: mysql +.\" mariadb: protocol option +.\" protocol option: mariadb \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -955,13 +955,13 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysql: quick option -.\" quick option: mysql +.\" mariadb: quick option +.\" quick option: mariadb \fB\-\-quick\fR, \fB\-q\fR .sp Do not cache each query result, print each row as it is received\&. This may slow down the server if the output is suspended\&. With this option, -\fBmysql\fR +\fBmariadb\fR does not use the history file\&. .RE .sp @@ -973,8 +973,8 @@ does not use the history file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: raw option -.\" raw option: mysql +.\" mariadb: raw option +.\" raw option: mariadb \fB\-\-raw\fR, \fB\-r\fR .sp @@ -999,19 +999,19 @@ The following example demonstrates tabular versus nontabular output and the use .RS 4 .\} .nf -% \fBmysql\fR -mysql> SELECT CHAR(92); +% \fBmariadb\fR +mariadb> SELECT CHAR(92); +\-\-\-\-\-\-\-\-\-\-+ | CHAR(92) | +\-\-\-\-\-\-\-\-\-\-+ | \e | +\-\-\-\-\-\-\-\-\-\-+ -% \fBmysql \-s\fR -mysql> SELECT CHAR(92); +% \fBmariadb \-s\fR +mariadb> SELECT CHAR(92); CHAR(92) \e\e -% \fBmysql \-s \-r\fR -mysql> SELECT CHAR(92); +% \fBmariadb \-s \-r\fR +mariadb> SELECT CHAR(92); CHAR(92) \e .fi @@ -1028,8 +1028,8 @@ CHAR(92) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: reconnect option -.\" reconnect option: mysql +.\" mariadb: reconnect option +.\" reconnect option: mariadb \fB\-\-reconnect\fR .sp If the connection to the server is lost, automatically try to reconnect\&. A single reconnect attempt is made each time the connection is lost\&. Enabled by default, to disable use @@ -1044,10 +1044,10 @@ If the connection to the server is lost, automatically try to reconnect\&. A sin .sp -1 .IP \(bu 2.3 .\} -.\" mysql: safe-updates option -.\" safe-updates option: mysql -.\" mysql: i-am-a-dummy option -.\" i-am-a-dummy option: mysql +.\" mariadb: safe-updates option +.\" safe-updates option: mariadb +.\" mariadb: i-am-a-dummy option +.\" i-am-a-dummy option: mariadb \fB\-\-safe\-updates\fR, \fB\-\-i\-am\-a\-dummy\fR, \fB\-U\fR @@ -1059,7 +1059,7 @@ DELETE statements that specify which rows to modify by using key values\&. If you have set this option in an option file, you can override it by using \fB\-\-safe\-updates\fR on the command line\&. See -the section called \(lqMYSQL TIPS\(rq, for more information about this option\&. +the section called \(lqMARIADB TIPS\(rq, for more information about this option\&. .RE .sp .RS 4 @@ -1070,8 +1070,8 @@ the section called \(lqMYSQL TIPS\(rq, for more information about this option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: secure-auth option -.\" secure-auth option: mysql +.\" mariadb: secure-auth option +.\" secure-auth option: mariadb \fB\-\-secure\-auth\fR .sp Do not send passwords to the server in old (pre\-4\&.1\&.1) format\&. This prevents connections except for servers that use the newer password format\&. @@ -1085,8 +1085,8 @@ Do not send passwords to the server in old (pre\-4\&.1\&.1) format\&. This preve .sp -1 .IP \(bu 2.3 .\} -.\" mysql: select-limit option -.\" select-limit option: mysql +.\" mariadb: select-limit option +.\" select-limit option: mariadb \fB\-\-select\-limit=\fR\fB\fIlimit\fR\fR .sp Set automatic limit for SELECT when using \fB\-\-safe\-updates\fR\&. (Default value is 1,000\&.) @@ -1100,8 +1100,8 @@ Set automatic limit for SELECT when using \fB\-\-safe\-updates\fR\&. (Default va .sp -1 .IP \(bu 2.3 .\} -.\" mysql: server-arg option -.\" server-arg option: mysql +.\" mariadb: server-arg option +.\" server-arg option: mariadb \fB\-\-server\-arg=\fR\fB\fIname\fR\fR .sp Send \fB\fIname\fR\fR as a parameter to the embedded server\&. @@ -1115,8 +1115,8 @@ Send \fB\fIname\fR\fR as a parameter to the embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: show-warnings option -.\" show-warnings option: mysql +.\" mariadb: show-warnings option +.\" show-warnings option: mariadb \fB\-\-show\-warnings\fR .sp Cause warnings to be shown after each statement if there are any\&. This option applies to interactive and batch mode\&. @@ -1130,8 +1130,8 @@ Cause warnings to be shown after each statement if there are any\&. This option .sp -1 .IP \(bu 2.3 .\} -.\" mysql: sigint-ignore option -.\" sigint-ignore option: mysql +.\" mariadb: sigint-ignore option +.\" sigint-ignore option: mariadb \fB\-\-sigint\-ignore\fR .sp Ignore @@ -1147,8 +1147,8 @@ signals (typically the result of typing Control\-C)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: silent option -.\" silent option: mysql +.\" mariadb: silent option +.\" silent option: mariadb \fB\-\-silent\fR, \fB\-s\fR .sp @@ -1167,8 +1167,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-auto-rehash option -.\" skip-auto-rehash option: mysql +.\" mariadb: skip-auto-rehash option +.\" skip-auto-rehash option: mariadb \fB\-\-skip\-auto\-rehash\fR .sp Disable automatic rehashing\&. Synonym for \fB\-\-disable\-auto\-rehash\fR\&. @@ -1182,8 +1182,8 @@ Disable automatic rehashing\&. Synonym for \fB\-\-disable\-auto\-rehash\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-column-names option -.\" skip-column-names option: mysql +.\" mariadb: skip-column-names option +.\" skip-column-names option: mariadb \fB\-\-skip\-column\-names\fR, \fB\-N\fR .sp @@ -1198,8 +1198,8 @@ Do not write column names in results\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-line-numbers option -.\" skip-line-numbers option: mysql +.\" mariadb: skip-line-numbers option +.\" skip-line-numbers option: mariadb \fB\-\-skip\-line\-numbers\fR, \fB\-L\fR .sp @@ -1214,8 +1214,8 @@ Do not write line numbers for errors\&. Useful when you want to compare result f .sp -1 .IP \(bu 2.3 .\} -.\" mysql: socket option -.\" socket option: mysql +.\" mariadb: socket option +.\" socket option: mariadb \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -1232,8 +1232,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL options -.\" SSL options: mysql +.\" mariadb: SSL options +.\" SSL options: mariadb \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -1248,8 +1248,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL CA option -.\" SSL CA option: mysql +.\" mariadb: SSL CA option +.\" SSL CA option: mariadb \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -1264,8 +1264,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL CA Path option -.\" SSL CA Path option: mysql +.\" mariadb: SSL CA Path option +.\" SSL CA Path option: mariadb \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1280,8 +1280,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Cert option -.\" SSL Cert option: mysql +.\" mariadb: SSL Cert option +.\" SSL Cert option: mariadb \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1296,8 +1296,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Cipher option -.\" SSL Cipher option: mysql +.\" mariadb: SSL Cipher option +.\" SSL Cipher option: mariadb \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1312,8 +1312,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Key option -.\" SSL Key option: mysql +.\" mariadb: SSL Key option +.\" SSL Key option: mariadb \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1328,8 +1328,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Crl option -.\" SSL CRL option: mysql +.\" mariadb: SSL Crl option +.\" SSL CRL option: mariadb \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1344,8 +1344,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Crlpath option -.\" SSL Crlpath option: mysql +.\" mariadb: SSL Crlpath option +.\" SSL Crlpath option: mariadb \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1360,8 +1360,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysql +.\" mariadb: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1375,8 +1375,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: table option -.\" table option: mysql +.\" mariadb: table option +.\" table option: mariadb \fB\-\-table\fR, \fB\-t\fR .sp @@ -1391,12 +1391,12 @@ Display output in table format\&. This is the default for interactive use, but c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: tee option -.\" tee option: mysql +.\" mariadb: tee option +.\" tee option: mariadb \fB\-\-tee=\fR\fB\fIfile_name\fR\fR .sp Append a copy of output to the given file\&. This option works only in interactive mode\&. -the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&. +the section called \(lqMARIADB COMMANDS\(rq, discusses tee files further\&. .RE .sp .RS 4 @@ -1407,8 +1407,8 @@ the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: unbuffered option -.\" unbuffered option: mysql +.\" mariadb: unbuffered option +.\" unbuffered option: mariadb \fB\-\-unbuffered\fR, \fB\-n\fR .sp @@ -1423,8 +1423,8 @@ Flush the buffer after each query\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: user option -.\" user option: mysql +.\" mariadb: user option +.\" user option: mariadb \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1439,8 +1439,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: verbose option -.\" verbose option: mysql +.\" mariadb: verbose option +.\" verbose option: mariadb \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1457,8 +1457,8 @@ produces table output format even in batch mode\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: version option -.\" version option: mysql +.\" mariadb: version option +.\" version option: mariadb \fB\-\-version\fR, \fB\-V\fR .sp @@ -1473,8 +1473,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: vertical option -.\" vertical option: mysql +.\" mariadb: vertical option +.\" vertical option: mariadb \fB\-\-vertical\fR, \fB\-E\fR .sp @@ -1490,8 +1490,8 @@ Print query output rows vertically (one line per column value)\&. Without this o .sp -1 .IP \(bu 2.3 .\} -.\" mysql: wait option -.\" wait option: mysql +.\" mariadb: wait option +.\" wait option: mariadb \fB\-\-wait\fR, \fB\-w\fR .sp @@ -1506,8 +1506,8 @@ If the connection cannot be established, wait and retry instead of aborting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: xml option -.\" xml option: mysql +.\" mariadb: xml option +.\" xml option: mariadb \fB\-\-xml\fR, \fB\-X\fR .sp @@ -1515,10 +1515,10 @@ Produce XML output\&. The output when \fB\-\-xml\fR is used with -\fBmysql\fR +\fBmariadb\fR matches that of -\fBmysqldump \fR\fB\fB\-\-xml\fR\fR\&. See -\fBmysqldump\fR(1) +\fBmariadb-dump \fR\fB\fB\-\-xml\fR\fR\&. See +\fBmariadb-dump\fR(1) for details\&. .sp The XML output also uses an XML namespace, as shown here: @@ -1527,7 +1527,7 @@ The XML output also uses an XML namespace, as shown here: .RS 4 .\} .nf -shell> \fBmysql \-\-xml \-uroot \-e "SHOW VARIABLES LIKE 'version%'"\fR +shell> \fBmariadb \-\-xml \-uroot \-e "SHOW VARIABLES LIKE 'version%'"\fR @@ -1632,15 +1632,15 @@ statements when using .\" environment variable: MARIADB_HISTFILE .\" HOME environment variable .\" environment variable: HOME -.\" mysql history file -.\" command-line history: mysql +.\" mariadb history file +.\" command-line history: mariadb .\" .mariadb_history file .PP On Unix, the -\fBmysql\fR +\fBmariadb\fR client writes a record of executed statements to a history file\&. By default, this file is named \&.mariadb_history -and is created in your home directory\&. For backwards compatibility \&.mysql_history will be used if present and +and is created in your home directory\&. For backwards compatibility \&.mariadb_history will be used if present and \&.mariadb_history is missing\&. To specify a different file, set the value of the MARIADB_HISTFILE environment variable\&. The environment variable MYSQL_HISTFILE will be used if MARIADB_HISTFILE isn't present\&. @@ -1692,42 +1692,42 @@ shell> \fBln \-s /dev/null $HOME/\&.mariadb_history\fR .sp You need do this only once\&. .RE -.SH "MYSQL COMMANDS" +.SH "MARIADB COMMANDS" .PP -\fBmysql\fR +\fBmariadb\fR sends each SQL statement that you issue to the server to be executed\&. There is also a set of commands that -\fBmysql\fR +\fBmariadb\fR itself interprets\&. For a list of these commands, type help or \eh at the -mysql> +mariadb> prompt: -.\" mysql commands: list of +.\" mariadb commands: list of .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp\fR -List of all MySQL commands: +mariadb> \fBhelp\fR +List of all MariaDB commands: Note that all text commands must be first on line and end with ';' ? (\e?) Synonym for 'help'\&. clear (\ec) Clear command\&. connect (\er) Reconnect to the server\&. Optional arguments are db and host\&. delimiter (\ed) Set statement delimiter\&. edit (\ee) Edit command with $EDITOR\&. -ego (\eG) Send command to mysql server, display result vertically\&. -exit (\eq) Exit mysql\&. Same as quit\&. -go (\eg) Send command to mysql server\&. +ego (\eG) Send command to mariadb server, display result vertically\&. +exit (\eq) Exit mariadb\&. Same as quit\&. +go (\eg) Send command to mariadb server\&. help (\eh) Display this help\&. nopager (\en) Disable pager, print to stdout\&. notee (\et) Don't write into outfile\&. pager (\eP) Set PAGER [to_pager]\&. Print the query results via PAGER\&. print (\ep) Print current command\&. -prompt (\eR) Change your mysql prompt\&. -quit (\eq) Quit mysql\&. +prompt (\eR) Change your mariadb prompt\&. +quit (\eq) Quit mariadb\&. rehash (\e#) Rebuild completion hash\&. source (\e\&.) Execute an SQL script file\&. Takes a file name as an argument\&. status (\es) Get status information from the server\&. @@ -1759,23 +1759,23 @@ comments is not supported\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: help command -.\" help command: mysql +.\" mariadb: help command +.\" help command: mariadb \fBhelp [\fR\fB\fIarg\fR\fR\fB]\fR, \fB\eh [\fR\fB\fIarg\fR\fR\fB]\fR, \fB\e? [\fR\fB\fIarg\fR\fR\fB]\fR, \fB? [\fR\fB\fIarg\fR\fR\fB]\fR .sp Display a help message listing the available -\fBmysql\fR +\fBmariadb\fR commands\&. .sp If you provide an argument to the help command, -\fBmysql\fR +\fBmariadb\fR uses it as a search string to access server\-side help\&. For more information, see -the section called \(lqMYSQL SERVER-SIDE HELP\(rq\&. +the section called \(lqMARIADB SERVER-SIDE HELP\(rq\&. .RE .sp .RS 4 @@ -1786,15 +1786,15 @@ the section called \(lqMYSQL SERVER-SIDE HELP\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: charset command -.\" charset command: mysql +.\" mariadb: charset command +.\" charset command: mariadb \fBcharset \fR\fB\fIcharset_name\fR\fR, \fB\eC \fR\fB\fIcharset_name\fR\fR .sp Change the default character set and issue a SET NAMES statement\&. This enables the character set to remain synchronized on the client and server if -\fBmysql\fR +\fBmariadb\fR is run with auto\-reconnect enabled (which is not recommended), because the specified character set is used for reconnects\&. .RE .sp @@ -1806,8 +1806,8 @@ is run with auto\-reconnect enabled (which is not recommended), because the spec .sp -1 .IP \(bu 2.3 .\} -.\" mysql: clear command -.\" clear command: mysql +.\" mariadb: clear command +.\" clear command: mariadb \fBclear\fR, \fB\ec\fR .sp @@ -1822,8 +1822,8 @@ Clear the current input\&. Use this if you change your mind about executing the .sp -1 .IP \(bu 2.3 .\} -.\" mysql: connect command -.\" connect command: mysql +.\" mariadb: connect command +.\" connect command: mariadb \fBconnect [\fR\fB\fIdb_name\fR\fR\fB \fR\fB\fIhost_name\fR\fR\fB]]\fR, \fB\er [\fR\fB\fIdb_name\fR\fR\fB \fR\fB\fIhost_name\fR\fR\fB]]\fR .sp @@ -1838,19 +1838,19 @@ Reconnect to the server\&. The optional database name and host name arguments ma .sp -1 .IP \(bu 2.3 .\} -.\" mysql: delimiter command -.\" delimiter command: mysql +.\" mariadb: delimiter command +.\" delimiter command: mariadb \fBdelimiter \fR\fB\fIstr\fR\fR, \fB\ed \fR\fB\fIstr\fR\fR .sp Change the string that -\fBmysql\fR +\fBmariadb\fR interprets as the separator between SQL statements\&. The default is the semicolon character (\(lq;\(rq)\&. .sp The delimiter can be specified as an unquoted or quoted argument\&. Quoting can be done with either single quote (') or douple quote (") characters\&. To include a quote within a quoted string, either quote the string with the other quote character or escape the quote with a backslash (\(lq\e\(rq) character\&. Backslash should be avoided outside of quoted strings because it is the escape character for MariaDB\&. For an unquoted argument, the delmiter is read up to the first space or end of line\&. For a quoted argument, the delimiter is read up to the matching quote on the line\&. .sp When the delimiter recognized by -\fBmysql\fR +\fBmariadb\fR is set to something other than the default of \(lq;\(rq, instances of that character are sent to the server without interpretation\&. However, the server itself still interprets \(lq;\(rq @@ -1865,13 +1865,13 @@ as a statement delimiter and processes statements accordingly\&. This behavior o .sp -1 .IP \(bu 2.3 .\} -.\" mysql: edit command -.\" edit command: mysql +.\" mariadb: edit command +.\" edit command: mariadb \fBedit\fR, \fB\ee\fR .sp Edit the current input statement\&. -\fBmysql\fR +\fBmariadb\fR checks the values of the EDITOR and @@ -1893,8 +1893,8 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: ego command -.\" ego command: mysql +.\" mariadb: ego command +.\" ego command: mariadb \fBego\fR, \fB\eG\fR .sp @@ -1909,13 +1909,13 @@ Send the current statement to the server to be executed and display the result u .sp -1 .IP \(bu 2.3 .\} -.\" mysql: exit command -.\" exit command: mysql +.\" mariadb: exit command +.\" exit command: mariadb \fBexit\fR, \fB\eq\fR .sp Exit -\fBmysql\fR\&. +\fBmariadb\fR\&. .RE .sp .RS 4 @@ -1926,8 +1926,8 @@ Exit .sp -1 .IP \(bu 2.3 .\} -.\" mysql: go command -.\" go command: mysql +.\" mariadb: go command +.\" go command: mariadb \fBgo\fR, \fB\eg\fR .sp @@ -1942,8 +1942,8 @@ Send the current statement to the server to be executed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: nopager command -.\" nopager command: mysql +.\" mariadb: nopager command +.\" nopager command: mariadb \fBnopager\fR, \fB\en\fR .sp @@ -1963,8 +1963,8 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: notee command -.\" notee command: mysql +.\" mariadb: notee command +.\" notee command: mariadb \fBnotee\fR, \fB\et\fR .sp @@ -1980,8 +1980,8 @@ Disable output copying to the tee file\&. See the description for .sp -1 .IP \(bu 2.3 .\} -.\" mysql: nowarning command -.\" nowarning command: mysql +.\" mariadb: nowarning command +.\" nowarning command: mariadb \fBnowarning\fR, \fB\ew\fR .sp @@ -1996,18 +1996,18 @@ Enable display of warnings after each statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pager command -.\" pager command: mysql +.\" mariadb: pager command +.\" pager command: mariadb \fBpager [\fR\fB\fIcommand\fR\fR\fB]\fR, \fB\eP [\fR\fB\fIcommand\fR\fR\fB]\fR .sp Enable output paging\&. By using the \fB\-\-pager\fR option when you invoke -\fBmysql\fR, it is possible to browse or search query results in interactive mode with Unix programs such as +\fBmariadb\fR, it is possible to browse or search query results in interactive mode with Unix programs such as \fBless\fR, \fBmore\fR, or any other similar program\&. If you specify no value for the option, -\fBmysql\fR +\fBmariadb\fR checks the value of the PAGER environment variable and sets the pager to that\&. Pager functionality works only in interactive mode\&. @@ -2036,8 +2036,8 @@ for browsing output in some situations\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: print command -.\" print command: mysql +.\" mariadb: print command +.\" print command: mariadb \fBprint\fR, \fB\ep\fR .sp @@ -2052,21 +2052,21 @@ Print the current input statement without executing it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: prompt command -.\" prompt command: mysql +.\" mariadb: prompt command +.\" prompt command: mariadb \fBprompt [\fR\fB\fIstr\fR\fR\fB]\fR, \fB\eR [\fR\fB\fIstr\fR\fR\fB]\fR .sp Reconfigure the -\fBmysql\fR +\fBmariadb\fR prompt to the given string\&. The special character sequences that can be used in the prompt are described later in this section\&. .sp If you specify the prompt command with no argument, -\fBmysql\fR +\fBmariadb\fR resets the prompt to the default of -mysql>\&. +mariadb>\&. .RE .sp .RS 4 @@ -2077,13 +2077,13 @@ mysql>\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: quit command -.\" quit command: mysql +.\" mariadb: quit command +.\" quit command: mariadb \fBquit\fR, \fB\eq\fR .sp Exit -\fBmysql\fR\&. +\fBmariadb\fR\&. .RE .sp .RS 4 @@ -2094,8 +2094,8 @@ Exit .sp -1 .IP \(bu 2.3 .\} -.\" mysql: rehash command -.\" rehash command: mysql +.\" mariadb: rehash command +.\" rehash command: mariadb \fBrehash\fR, \fB\e#\fR .sp @@ -2112,8 +2112,8 @@ option\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: source command -.\" source command: mysql +.\" mariadb: source command +.\" source command: mariadb \fBsource \fR\fB\fIfile_name\fR\fR, \fB\e\&. \fR\fB\fIfile_name\fR\fR .sp @@ -2131,8 +2131,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysql: status command -.\" status command: mysql +.\" mariadb: status command +.\" status command: mariadb \fBstatus\fR, \fB\es\fR .sp @@ -2141,7 +2141,7 @@ Provide status information about the connection and the server you are using\&. mode, status also prints the values for the -\fBmysql\fR +\fBmariadb\fR variables that affect your queries\&. .RE .sp @@ -2153,8 +2153,8 @@ variables that affect your queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: system command -.\" system command: mysql +.\" mariadb: system command +.\" system command: mariadb \fBsystem \fR\fB\fIcommand\fR\fR, \fB\e! \fR\fB\fIcommand\fR\fR .sp @@ -2173,16 +2173,16 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: tee command -.\" tee command: mysql +.\" mariadb: tee command +.\" tee command: mariadb \fBtee [\fR\fB\fIfile_name\fR\fR\fB]\fR, \fB\eT [\fR\fB\fIfile_name\fR\fR\fB]\fR .sp By using the \fB\-\-tee\fR option when you invoke -\fBmysql\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&. -\fBmysql\fR +\fBmariadb\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&. +\fBmariadb\fR flushes results to the file after each statement, just before it prints its next prompt\&. Tee functionality works only in interactive mode\&. .sp You can enable this feature interactively with the @@ -2204,8 +2204,8 @@ again re\-enables logging\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: use command -.\" use command: mysql +.\" mariadb: use command +.\" use command: mariadb \fBuse \fR\fB\fIdb_name\fR\fR, \fB\eu \fR\fB\fIdb_name\fR\fR .sp @@ -2222,8 +2222,8 @@ as the default database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: warnings command -.\" warnings command: mysql +.\" mariadb: warnings command +.\" warnings command: mariadb \fBwarnings\fR, \fB\eW\fR .sp @@ -2248,7 +2248,7 @@ You can use it to write to a file and the results go only to the file: .RS 4 .\} .nf -mysql> \fBpager cat > /tmp/log\&.txt\fR +mariadb> \fBpager cat > /tmp/log\&.txt\fR .fi .if n \{\ .RE @@ -2260,7 +2260,7 @@ You can also pass any options for the program that you want to use as your pager .RS 4 .\} .nf -mysql> \fBpager less \-n \-i \-S\fR +mariadb> \fBpager less \-n \-i \-S\fR .fi .if n \{\ .RE @@ -2320,7 +2320,7 @@ to cause it to exit if output fits on one screen, which is convenient when no sc .RS 4 .\} .nf -mysql> \fBpager less \-n \-i \-S \-F \-X\fR +mariadb> \fBpager less \-n \-i \-S \-F \-X\fR .fi .if n \{\ .RE @@ -2341,7 +2341,7 @@ You can specify very complex pager commands for handling query output: .RS 4 .\} .nf -mysql> \fBpager cat | tee /dr1/tmp/res\&.txt \e\fR +mariadb> \fBpager cat | tee /dr1/tmp/res\&.txt \e\fR \fB| tee /dr2/tmp/res2\&.txt | less \-n \-i \-S\fR .fi .if n \{\ @@ -2371,7 +2371,7 @@ program and still have everything appended into a file the same time\&. The diff used with the \fBpager\fR command and the -\fBmysql\fR +\fBmariadb\fR built\-in \fBtee\fR command is that the built\-in @@ -2387,13 +2387,13 @@ used with does not log quite that much\&. Additionally, \fBtee\fR file logging can be turned on and off interactively from within -\fBmysql\fR\&. This is useful when you want to log some queries to a file, but not others\&. -.\" mysql prompt command +\fBmariadb\fR\&. This is useful when you want to log some queries to a file, but not others\&. +.\" mariadb prompt command .PP The \fBprompt\fR command reconfigures the default -mysql> +mariadb> prompt\&. The string for defining the prompt can contain the following special sequences\&. .TS allbox tab(:); @@ -2618,13 +2618,13 @@ shell> \fBexport MYSQL_PS1="(\eu@\eh) [\ed]> "\fR You can set the \fB\-\-prompt\fR option on the command line to -\fBmysql\fR\&. For example: +\fBmariadb\fR\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \-\-prompt="(\eu@\eh) [\ed]> "\fR +shell> \fBmariadb \-\-prompt="(\eu@\eh) [\ed]> "\fR (user@host) [database]> .fi .if n \{\ @@ -2644,7 +2644,7 @@ shell> \fBmysql \-\-prompt="(\eu@\eh) [\ed]> "\fR You can set the prompt option in the -[mysql] +[mariadb] group of any MariaDB option file, such as /etc/my\&.cnf or the @@ -2655,7 +2655,7 @@ file in your home directory\&. For example: .RS 4 .\} .nf -[mysql] +[mariadb] prompt=(\e\eu@\e\eh) [\e\ed]>\e\e_ .fi .if n \{\ @@ -2674,7 +2674,7 @@ format: .RS 4 .\} .nf -[mysql] +[mariadb] prompt="\e\er:\e\em:\e\es> " .fi .if n \{\ @@ -2700,24 +2700,24 @@ prompt .RS 4 .\} .nf -mysql> \fBprompt (\eu@\eh) [\ed]>\e_\fR +mariadb> \fBprompt (\eu@\eh) [\ed]>\e_\fR PROMPT set to '(\eu@\eh) [\ed]>\e_' (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> prompt -Returning to default PROMPT of mysql> -mysql> +Returning to default PROMPT of mariadb> +mariadb> .fi .if n \{\ .RE .\} .RE -.SH "MYSQL SERVER-SIDE HELP" +.SH "MARIADB SERVER-SIDE HELP" .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp \fR\fB\fIsearch_string\fR\fR +mariadb> \fBhelp \fR\fB\fIsearch_string\fR\fR .fi .if n \{\ .RE @@ -2726,7 +2726,7 @@ mysql> \fBhelp \fR\fB\fIsearch_string\fR\fR If you provide an argument to the help command, -\fBmysql\fR +\fBmariadb\fR uses it as a search string to access server\-side help\&. The proper operation of this command requires that the help tables in the mysql database be initialized with help topic information. @@ -2737,7 +2737,7 @@ If there is no match for the search string, the search fails: .RS 4 .\} .nf -mysql> \fBhelp me\fR +mariadb> \fBhelp me\fR Nothing found Please try to run 'help contents' for a list of all accessible topics .fi @@ -2753,7 +2753,7 @@ to see a list of the help categories: .RS 4 .\} .nf -mysql> \fBhelp contents\fR +mariadb> \fBhelp contents\fR You asked for help about help category: "Contents" For more information, type 'help ', where is one of the following categories: @@ -2778,14 +2778,14 @@ following categories: .\} .PP If the search string matches multiple items, -\fBmysql\fR +\fBmariadb\fR shows a list of matching topics: .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp logs\fR +mariadb> \fBhelp logs\fR Many help items for your request exist\&. To make a more specific request, please type 'help ', where is one of the following topics: @@ -2804,7 +2804,7 @@ Use a topic as the search string to see the help entry for that topic: .RS 4 .\} .nf -mysql> \fBhelp show binary logs\fR +mariadb> \fBhelp show binary logs\fR Name: 'SHOW BINARY LOGS' Description: Syntax: @@ -2813,7 +2813,7 @@ SHOW MASTER LOGS Lists the binary log files on the server\&. This statement is used as part of the procedure described in [purge\-binary\-logs], that shows how to determine which logs can be purged\&. -mysql> SHOW BINARY LOGS; +mariadb> SHOW BINARY LOGS; +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | Log_name | File_size | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ @@ -2830,38 +2830,38 @@ mysql> SHOW BINARY LOGS; .\" data: importing .\" files: text .\" text files: importing -.\" source (mysql client command) -.\" \. (mysql client command) -.\" mysql source (command for reading from text files) -.\" mysql \. (command for reading from text files) +.\" source (mariadb client command) +.\" \. (mariadb client command) +.\" mariadb source (command for reading from text files) +.\" mariadb \. (command for reading from text files) .PP The -\fBmysql\fR +\fBmariadb\fR client typically is used interactively, like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE .\} .PP However, it is also possible to put your SQL statements in a file and then tell -\fBmysql\fR +\fBmariadb\fR to read its input from that file\&. To do so, create a text file \fItext_file\fR that contains the statements you wish to execute\&. Then invoke -\fBmysql\fR +\fBmariadb\fR as shown here: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fItext_file\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fItext_file\fR\fR .fi .if n \{\ .RE @@ -2875,14 +2875,14 @@ statement as the first statement in the file, it is unnecessary to specify the d .RS 4 .\} .nf -shell> \fBmysql < text_file\fR +shell> \fBmariadb < text_file\fR .fi .if n \{\ .RE .\} .PP If you are already running -\fBmysql\fR, you can execute an SQL script file using the +\fBmariadb\fR, you can execute an SQL script file using the source command or \e\&. @@ -2892,8 +2892,8 @@ command: .RS 4 .\} .nf -mysql> \fBsource \fR\fB\fIfile_name\fR\fR -mysql> \fB\e\&. \fR\fB\fIfile_name\fR\fR +mariadb> \fBsource \fR\fB\fIfile_name\fR\fR +mariadb> \fB\e\&. \fR\fB\fIfile_name\fR\fR .fi .if n \{\ .RE @@ -2915,23 +2915,23 @@ The statement shown outputs \&. .PP You can also invoke -\fBmysql\fR +\fBmariadb\fR with the \fB\-\-verbose\fR option, which causes each statement to be displayed before the result that it produces\&. .PP -\fBmysql\fR +\fBmariadb\fR ignores Unicode byte order mark (BOM) characters at the beginning of input files\&. Presence of a BOM does not cause -\fBmysql\fR +\fBmariadb\fR to change its default character set\&. To do that, invoke -\fBmysql\fR +\fBmariadb\fR with an option such as \fB\-\-default\-character\-set=utf8\fR\&. .PP -.SH "MYSQL TIPS" +.SH "MARIADB TIPS" .PP This section describes some techniques that can help you use -\fBmysql\fR +\fBmariadb\fR more effectively\&. .SS "Displaying Query Results Vertically" .PP @@ -2941,7 +2941,7 @@ Some query results are much more readable when displayed vertically, instead of .RS 4 .\} .nf -mysql> \fBSELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\eG\fR +mariadb> \fBSELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\eG\fR *************************** 1\&. row *************************** msg_nro: 3068 date: 2000\-03\-01 23:29:50 @@ -2980,7 +2980,7 @@ clause\&. Normally, such a statement deletes all rows from the table\&. With When you use the \fB\-\-safe\-updates\fR option, -\fBmysql\fR +\fBmariadb\fR issues the following statement when it connects to the MariaDB server: .sp .if n \{\ @@ -3065,32 +3065,32 @@ options: .RS 4 .\} .nf -shell> \fBmysql \-\-safe\-updates \-\-select\-limit=500 \-\-max\-join\-size=10000\fR +shell> \fBmariadb \-\-safe\-updates \-\-select\-limit=500 \-\-max\-join\-size=10000\fR .fi .if n \{\ .RE .\} -.SS "Disabling mysql Auto\-Reconnect" +.SS "Disabling mariadb Auto\-Reconnect" .PP If the -\fBmysql\fR +\fBmariadb\fR client loses its connection to the server while sending a statement, it immediately and automatically tries to reconnect once to the server and send the statement again\&. However, even if -\fBmysql\fR +\fBmariadb\fR succeeds in reconnecting, your first connection has ended and all your previous session objects and settings are lost: temporary tables, the autocommit mode, and user\-defined and session variables\&. Also, any current transaction rolls back\&. This behavior may be dangerous for you, as in the following example where the server was shut down and restarted between the first and second statements without you knowing it: .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBSET @a=1;\fR +mariadb> \fBSET @a=1;\fR Query OK, 0 rows affected (0\&.05 sec) -mysql> \fBINSERT INTO t VALUES(@a);\fR -ERROR 2006: MySQL server has gone away +mariadb> \fBINSERT INTO t VALUES(@a);\fR +ERROR 2006: MariaDB server has gone away No connection\&. Trying to reconnect\&.\&.\&. Connection id: 1 Current database: test Query OK, 1 row affected (1\&.30 sec) -mysql> \fBSELECT * FROM t;\fR +mariadb> \fBSELECT * FROM t;\fR +\-\-\-\-\-\-+ | a | +\-\-\-\-\-\-+ @@ -3105,9 +3105,9 @@ mysql> \fBSELECT * FROM t;\fR The @a user variable has been lost with the connection, and after the reconnection it is undefined\&. If it is important to have -\fBmysql\fR +\fBmariadb\fR terminate with an error if the connection has been lost, you can start the -\fBmysql\fR +\fBmariadb\fR client with the \fB\-\-skip\-reconnect\fR option\&. @@ -3115,7 +3115,7 @@ option\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb_config.1 b/man/mariadb_config.1 index 941e372864b..6e47a2240d5 100644 --- a/man/mariadb_config.1 +++ b/man/mariadb_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL_CONFIG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONFIG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,18 +11,18 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_config +.\" mariadb-dump .SH "NAME" -mysql_config \- get compile options for compiling clients +mariadb-dump \- get compile options for compiling clients .SH "SYNOPSIS" -.HP \w'\fBmysql_config\ \fR\fB\fIoptions\fR\fR\ 'u -\fBmysql_config \fR\fB\fIoptions\fR\fR +.HP \w'\fBmariadb-dump\ \fR\fB\fIoptions\fR\fR\ 'u +\fBmariadb-dump \fR\fB\fIoptions\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_config\fR +\fBmariadb-dump\fR provides you with useful information for compiling your MariaDB client and connecting it to MariaDB\&. .PP -\fBmysql_config\fR +\fBmariadb-dump\fR supports the following options\&. .sp .RS 4 @@ -33,8 +33,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: cflags option -.\" cflags option: mysql_config +.\" mariadb-dump: cflags option +.\" cflags option: mariadb-dump \fB\-\-cflags\fR .sp Compiler flags to find include files and critical compiler flags and defines used when compiling the @@ -52,8 +52,8 @@ for more portable options that contain only include paths\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: include option -.\" include option: mysql_config +.\" mariadb-dump: include option +.\" include option: mariadb-dump \fB\-\-include\fR .sp Compiler options to find MariaDB include files\&. @@ -67,10 +67,10 @@ Compiler options to find MariaDB include files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libmysqld-libs option -.\" libmysqld-libs option: mysql_config -.\" mysql_config: embedded option -.\" embedded option: mysql_config +.\" mariadb-dump: libmysqld-libs option +.\" libmysqld-libs option: mariadb-dump +.\" mariadb-dump: embedded option +.\" embedded option: mariadb-dump \fB\-\-libmysqld\-libs\fR, \fB\-\-embedded\fR .sp @@ -85,8 +85,8 @@ Libraries and options required to link with the MariaDB embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libs option -.\" libs option: mysql_config +.\" mariadb-dump: libs option +.\" libs option: mariadb-dump \fB\-\-libs\fR .sp Libraries and options required to link with the MariaDB client library\&. @@ -100,8 +100,8 @@ Libraries and options required to link with the MariaDB client library\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libs_r option -.\" libs_r option: mysql_config +.\" mariadb-dump: libs_r option +.\" libs_r option: mariadb-dump \fB\-\-libs_r\fR .sp Libraries and options required to link with the thread\-safe MariaDB client library\&. @@ -115,8 +115,8 @@ Libraries and options required to link with the thread\-safe MariaDB client libr .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: plugindir option -.\" plugindir option: mysql_config +.\" mariadb-dump: plugindir option +.\" plugindir option: mariadb-dump \fB\-\-plugindir\fR .sp The default plugin directory path name, defined when configuring MariaDB\&. @@ -130,8 +130,8 @@ The default plugin directory path name, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: port option -.\" port option: mysql_config +.\" mariadb-dump: port option +.\" port option: mariadb-dump \fB\-\-port\fR .sp The default TCP/IP port number, defined when configuring MariaDB\&. @@ -145,8 +145,8 @@ The default TCP/IP port number, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: socket option -.\" socket option: mysql_config +.\" mariadb-dump: socket option +.\" socket option: mariadb-dump \fB\-\-socket\fR .sp The default Unix socket file, defined when configuring MariaDB\&. @@ -160,8 +160,8 @@ The default Unix socket file, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: variable option -.\" variable option: mysql_config +.\" mariadb-dump: variable option +.\" variable option: mariadb-dump \fB\-\-variable=VAR\fR .sp Path to MariaDB include, library and plugin directories\&. \fBVAR\fR is one of @@ -176,23 +176,23 @@ Path to MariaDB include, library and plugin directories\&. \fBVAR\fR is one of .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: version option -.\" version option: mysql_config +.\" mariadb-dump: version option +.\" version option: mariadb-dump \fB\-\-version\fR .sp Version number for the MariaDB distribution\&. .RE .PP If you invoke -\fBmysql_config\fR +\fBmariadb-dump\fR with no options, it displays a list of all options that it supports, and their values: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_config\fR -Usage: /usr/local/mysql/bin/mysql_config [options] +shell> \fBmariadb-dump\fR +Usage: /usr/local/mysql/bin/mariadb-dump [options] Options: \-\-cflags [\-I/usr/local/mysql/include/mysql \-mcpu=pentiumpro] \-\-include [\-I/usr/local/mysql/include/mysql] @@ -211,16 +211,16 @@ Options: .\} .PP You can use -\fBmysql_config\fR +\fBmariadb-dump\fR within a command line to include the value that it displays for a particular option\&. For example, to compile a MariaDB client program, use -\fBmysql_config\fR +\fBmariadb-dump\fR as follows: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBCFG=/usr/local/mysql/bin/mysql_config\fR +shell> \fBCFG=/usr/local/mysql/bin/mariadb-dump\fR shell> \fBsh \-c "gcc \-o progname `$CFG \-\-include` progname\&.c `$CFG \-\-libs`"\fR .fi .if n \{\ @@ -228,12 +228,12 @@ shell> \fBsh \-c "gcc \-o progname `$CFG \-\-include` progname\&.c `$CFG \-\-lib .\} .PP When you use -\fBmysql_config\fR +\fBmariadb-dump\fR this way, be sure to invoke it within backtick (\(lq`\(rq) characters\&. That tells the shell to execute it and substitute its output into the surrounding command\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-multi.1 b/man/mariadbd-multi.1 index e51e3875613..06f58c69e08 100644 --- a/man/mariadbd-multi.1 +++ b/man/mariadbd-multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-MULTI\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-MULTI\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,25 +11,25 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld_multi -.\" tools: mysqld_multi +.\" mariadbd-multi +.\" tools: mariadbd-multi .\" scripts -.\" multi mysqld +.\" multi mariadbd .SH "NAME" -mariadbd-multi \- manage multiple MariaDB servers (mysqld_multi is now a symlink to mariadbd-multi) +mariadbd-multi \- manage multiple MariaDB servers (mariadbd-multi is now a symlink to mariadbd-multi) .SH "SYNOPSIS" -.HP \w'\fBmysqld_multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u -\fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR +.HP \w'\fBmariadbd-multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u +\fBmariadbd-multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR .SH "DESCRIPTION" .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR is designed to manage several -\fBmysqld\fR +\fBmariadbd\fR processes that listen for connections on different Unix socket files and TCP/IP ports\&. It can start or stop servers, or report their current status\&. .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR searches for groups named -[mysqld\fIN\fR] +[mariadbd\fIN\fR] in my\&.cnf (or in the file named by the @@ -38,20 +38,20 @@ option)\&. \fIN\fR can be any positive integer\&. This number is referred to in the following discussion as the option group number, or \fIGNR\fR\&. Group numbers distinguish option groups from one another and are used as arguments to -\fBmysqld_multi\fR +\fBmariadbd-multi\fR to specify which servers you want to start, stop, or obtain a status report for\&. Options listed in these groups are the same that you would use in the -[mysqld] +[mariadbd] group used for starting -\fBmysqld\fR\&. However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. +\fBmariadbd\fR\&. However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. .PP To invoke -\fBmysqld_multi\fR, use the following syntax: +\fBmariadbd-multi\fR, use the following syntax: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR +shell> \fBmariadbd-multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR .fi .if n \{\ .RE @@ -63,7 +63,7 @@ report indicate which operation to perform\&. You can perform the designated operation for a single server or multiple servers, depending on the \fIGNR\fR list that follows the option name\&. If there is no list, -\fBmysqld_multi\fR +\fBmariadbd-multi\fR performs the operation for all servers in the option file\&. .PP Each @@ -71,44 +71,44 @@ Each value represents an option group number or range of group numbers\&. The value should be the number at the end of the group name in the option file\&. For example, the \fIGNR\fR for a group named -[mysqld17] +[mariadbd17] is 17\&. To specify a range of numbers, separate the first and last numbers by a dash\&. The \fIGNR\fR value 10\-13 represents groups -[mysqld10] +[mariadbd10] through -[mysqld13]\&. Multiple groups or group ranges can be specified on the command line, separated by commas\&. There must be no whitespace characters (spaces or tabs) in the +[mariadbd13]\&. Multiple groups or group ranges can be specified on the command line, separated by commas\&. There must be no whitespace characters (spaces or tabs) in the \fIGNR\fR list; anything after a whitespace character is ignored\&. .PP This command starts a single server using option group -[mysqld17]: +[mariadbd17]: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi start 17\fR +shell> \fBmariadbd-multi start 17\fR .fi .if n \{\ .RE .\} .PP This command stops several servers, using option groups -[mysqld8] +[mariadbd8] and -[mysqld10] +[mariadbd10] through -[mysqld13]: +[mariadbd13]: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi stop 8,10\-13\fR +shell> \fBmariadbd-multi stop 8,10\-13\fR .fi .if n \{\ .RE @@ -120,13 +120,13 @@ For an example of how you might set up an option file, use this command: .RS 4 .\} .nf -shell> \fBmysqld_multi \-\-example\fR +shell> \fBmariadbd-multi \-\-example\fR .fi .if n \{\ .RE .\} .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR searches for option files as follows: .sp .RS 4 @@ -137,8 +137,8 @@ searches for option files as follows: .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: no-defaults option -.\" no-defaults option: mysqld_multi +.\" mariadbd-multi: no-defaults option +.\" no-defaults option: mariadbd-multi With \fB\-\-no\-defaults\fR, no option files are read\&. .RE @@ -151,8 +151,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: defaults-file option -.\" defaults-file option: mysqld_multi +.\" mariadbd-multi: defaults-file option +.\" defaults-file option: mariadbd-multi With \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR, only the named file is read\&. .RE @@ -165,43 +165,43 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: defaults-extra-file option -.\" defaults-extra-file option: mysqld_multi +.\" mariadbd-multi: defaults-extra-file option +.\" defaults-extra-file option: mariadbd-multi Otherwise, option files in the standard list of locations are read, including any file named by the \fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR option, if one is given\&. (If the option is given multiple times, the last value is used\&.) .RE .PP Option files read are searched for -[mysqld_multi] +[mariadbd-multi] and -[mysqld\fIN\fR] +[mariadbd\fIN\fR] option groups\&. The -[mysqld_multi] +[mariadbd-multi] group can be used for options to -\fBmysqld_multi\fR +\fBmariadbd-multi\fR itself\&. -[mysqld\fIN\fR] +[mariadbd\fIN\fR] groups can be used for options passed to specific -\fBmysqld\fR +\fBmariadbd\fR instances\&. .PP The -[mysqld] +[mariadbd] or -[mysqld_safe] +[mariadbd_safe] groups can be used for common options read by all instances of -\fBmysqld\fR +\fBmariadbd\fR or -\fBmysqld_safe\fR\&. You can specify a +\fBmariadbd_safe\fR\&. You can specify a \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR option to use a different configuration file for that instance, in which case the -[mysqld] +[mariadbd] or -[mysqld_safe] +[mariadbd_safe] groups from that file will be used for that instance\&. .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR supports the following options\&. .sp .RS 4 @@ -212,8 +212,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: help option -.\" help option: mysqld_multi +.\" mariadbd-multi: help option +.\" help option: mariadbd-multi \fB\-\-help\fR .sp Display a help message and exit\&. @@ -227,8 +227,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: example option -.\" example option: mysqld_multi +.\" mariadbd-multi: example option +.\" example option: mariadbd-multi \fB\-\-example\fR .sp Display a sample option file\&. @@ -242,8 +242,8 @@ Display a sample option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: log option -.\" log option: mysqld_multi +.\" mariadbd-multi: log option +.\" log option: mariadbd-multi \fB\-\-log=\fR\fB\fIfile_name\fR\fR .sp Specify the name of the log file\&. If the file exists, log output is appended to it\&. @@ -257,12 +257,12 @@ Specify the name of the log file\&. If the file exists, log output is appended t .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: mysqladmin option -.\" mysqladmin option: mysqld_multi -\fB\-\-mysqladmin=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-multi: mariadb-admin option +.\" mariadb-admin option: mariadbd-multi +\fB\-\-mariadb-admin=\fR\fB\fIprog_name\fR\fR .sp The -\fBmysqladmin\fR +\fBmariadb-admin\fR binary to be used to stop servers\&. .RE .sp @@ -274,33 +274,33 @@ binary to be used to stop servers\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: mysqld option -.\" mysqld option: mysqld_multi -\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-multi: mariadbd option +.\" mariadbd option: mariadbd-multi +\fB\-\-mariadbd=\fR\fB\fIprog_name\fR\fR .sp The -\fBmysqld\fR +\fBmariadbd\fR binary to be used\&. Note that you can specify -\fBmysqld_safe\fR +\fBmariadbd_safe\fR as the value for this option also\&. If you use -\fBmysqld_safe\fR +\fBmariadbd_safe\fR to start the server, you can include the -mysqld +mariadbd or ledir options in the corresponding -[mysqld\fIN\fR] +[mariadbd\fIN\fR] option group\&. These options indicate the name of the server that -\fBmysqld_safe\fR +\fBmariadbd_safe\fR should start and the path name of the directory where the server is located\&. (See the descriptions for these options in -\fBmysqld_safe\fR(1)\&.) Example: +\fBmariadbd_safe\fR(1)\&.) Example: .sp .if n \{\ .RS 4 .\} .nf -[mysqld38] -mysqld = mysqld\-debug +[mariadbd38] +mariadbd = mariadbd\-debug ledir = /opt/local/mysql/libexec .fi .if n \{\ @@ -316,8 +316,8 @@ ledir = /opt/local/mysql/libexec .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: no-log option -.\" no-log option: mysqld_multi +.\" mariadbd-multi: no-log option +.\" no-log option: mariadbd-multi \fB\-\-no\-log\fR .sp Print log information to @@ -333,12 +333,12 @@ rather than to the log file\&. By default, output goes to the log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: password option -.\" password option: mysqld_multi +.\" mariadbd-multi: password option +.\" password option: mariadbd-multi \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password of the MariaDB account to use when invoking -\fBmysqladmin\fR\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. +\fBmariadb-admin\fR\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. .RE .sp .RS 4 @@ -349,8 +349,8 @@ The password of the MariaDB account to use when invoking .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: silent option -.\" silent option: mysqld_multi +.\" mariadbd-multi: silent option +.\" silent option: mariadbd-multi \fB\-\-silent\fR .sp Silent mode; disable warnings\&. @@ -364,8 +364,8 @@ Silent mode; disable warnings\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: tcp-ip option -.\" tcp-ip option: mysqld_multi +.\" mariadbd-multi: tcp-ip option +.\" tcp-ip option: mariadbd-multi \fB\-\-tcp\-ip\fR .sp Connect to the MariaDB server(s) via the TCP/IP port instead of the UNIX socket\&. This affects stopping @@ -382,12 +382,12 @@ stop and report operations\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: user option -.\" user option: mysqld_multi +.\" mariadbd-multi: user option +.\" user option: mariadbd-multi \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The user name of the MariaDB account to use when invoking -\fBmysqladmin\fR\&. +\fBmariadb-admin\fR\&. .RE .sp .RS 4 @@ -398,8 +398,8 @@ The user name of the MariaDB account to use when invoking .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: verbose option -.\" verbose option: mysqld_multi +.\" mariadbd-multi: verbose option +.\" verbose option: mariadbd-multi \fB\-\-verbose\fR .sp Be more verbose\&. @@ -413,8 +413,8 @@ Be more verbose\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: version option -.\" version option: mysqld_multi +.\" mariadbd-multi: version option +.\" version option: mariadbd-multi \fB\-\-version\fR .sp Display version information and exit\&. @@ -428,15 +428,15 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: wsrep-new-cluster option -.\" wsrep-new-cluster option: mysqld_multi +.\" mariadbd-multi: wsrep-new-cluster option +.\" wsrep-new-cluster option: mariadbd-multi \fB\-\-wsrep\-new\-cluster\fR .sp Bootstrap a cluster\&. .RE .PP Some notes about -\fBmysqld_multi\fR: +\fBmariadbd-multi\fR: .sp .RS 4 .ie n \{\ @@ -447,15 +447,15 @@ Some notes about .IP \(bu 2.3 .\} \fBMost important\fR: Before using -\fBmysqld_multi\fR +\fBmariadbd-multi\fR be sure that you understand the meanings of the options that are passed to the -\fBmysqld\fR +\fBmariadbd\fR servers and \fIwhy\fR you would want to have separate -\fBmysqld\fR +\fBmariadbd\fR processes\&. Beware of the dangers of using multiple -\fBmysqld\fR +\fBmariadbd\fR servers with the same data directory\&. Use separate data directories, unless you \fIknow\fR what you are doing\&. Starting multiple servers with the same data directory does @@ -474,7 +474,7 @@ give you extra performance in a threaded system\&. .IP \(bu 2.3 .\} \fBImportant\fR: Make sure that the data directory for each server is fully accessible to the Unix account that the specific -\fBmysqld\fR +\fBmariadbd\fR process is started as\&. \fIDo not\fR use the Unix @@ -495,9 +495,9 @@ what you are doing\&. .IP \(bu 2.3 .\} Make sure that the MariaDB account used for stopping the -\fBmysqld\fR +\fBmariadbd\fR servers (with the -\fBmysqladmin\fR +\fBmariadbadmin\fR program) has the same user name and password for each server\&. Also, make sure that the account has the SHUTDOWN privilege\&. If the servers that you want to manage have different user names or passwords for the administrative accounts, you might want to create an account on each server that has the same user name and password\&. For example, you might set up a common @@ -508,9 +508,9 @@ account by executing the following commands for each server: .RS 4 .\} .nf -shell> \fBmysql \-u root \-S /tmp/mysql\&.sock \-p\fR +shell> \fBmariadb \-u root \-S /tmp/mariadb\&.sock \-p\fR Enter password: -mysql> \fBGRANT SHUTDOWN ON *\&.*\fR +mariadb> \fBGRANT SHUTDOWN ON *\&.*\fR \-> \fBTO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';\fR .fi .if n \{\ @@ -520,7 +520,7 @@ mysql> \fBGRANT SHUTDOWN ON *\&.*\fR Change the connection parameters appropriately when connecting to each one\&. Note that the host name part of the account name must allow you to connect as multi_admin from the host where you want to run -\fBmysqld_multi\fR\&. +\fBmariadbd-multi\fR\&. .RE .sp .RS 4 @@ -532,7 +532,7 @@ from the host where you want to run .IP \(bu 2.3 .\} The Unix socket file and the TCP/IP port number must be different for every -\fBmysqld\fR\&. (Alternatively, if the host has multiple network addresses, you can use +\fBmariadbd\fR\&. (Alternatively, if the host has multiple network addresses, you can use \fB\-\-bind\-address\fR to cause different servers to listen to different interfaces\&.) .RE @@ -548,27 +548,27 @@ to cause different servers to listen to different interfaces\&.) The \fB\-\-pid\-file\fR option is very important if you are using -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to start -\fBmysqld\fR +\fBmariadbd\fR (for example, -\fB\-\-mysqld=mysqld_safe\fR) Every -\fBmysqld\fR +\fB\-\-mariadbd=mariadbd-safe\fR) Every +\fBmariadbd\fR should have its own process ID file\&. The advantage of using -\fBmysqld_safe\fR +\fBmariadbd-safe\fR instead of -\fBmysqld\fR +\fBmariadbd\fR is that -\fBmysqld_safe\fR +\fBmariadbd-safe\fR monitors its -\fBmysqld\fR +\fBmariadbd\fR process and restarts it if the process terminates due to a signal sent using kill \-9 or for other reasons, such as a segmentation fault\&. Please note that the -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script might require that you start it from a certain place\&. This means that you might have to change location to a certain directory before running -\fBmysqld_multi\fR\&. If you have problems starting, please see the -\fBmysqld_safe\fR +\fBmariadbd-multi\fR\&. If you have problems starting, please see the +\fBmariadbd-safe\fR script\&. Check especially the lines: .sp .if n \{\ @@ -578,7 +578,7 @@ script\&. Check especially the lines: \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- MY_PWD=`pwd` # Check if we are starting this relative (for the binary release) -if test \-d $MY_PWD/data/mysql \-a \e +if test \-d $MY_PWD/data/mariadb \-a \e \-f \&./share/mariadb/english/errmsg\&.sys \-a \e \-x \&./bin/mariadbd \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- @@ -588,7 +588,7 @@ if test \-d $MY_PWD/data/mysql \-a \e .\} .sp The test performed by these lines should be successful, or you might encounter problems\&. See -\fBmysqld_safe\fR(1)\&. +\fBmariadbd-safe\fR(1)\&. .RE .sp .RS 4 @@ -602,20 +602,20 @@ The test performed by these lines should be successful, or you might encounter p You might want to use the \fB\-\-user\fR option for -\fBmysqld\fR, but to do this you need to run the -\fBmysqld_multi\fR +\fBmariadbd\fR, but to do this you need to run the +\fBmariadbd-multi\fR script as the Unix root user\&. Having the option in the option file doesn't matter; you just get a warning if you are not the superuser and the -\fBmysqld\fR +\fBmariadbd\fR processes are started under your own Unix account\&. .RE .PP The following example shows how you might set up an option file for use with -\fBmysqld_multi\fR\&. The order in which the -\fBmysqld\fR +\fBmariadbd-multi\fR\&. The order in which the +\fBmariadbd\fR programs are started or stopped depends on the order in which they appear in the option file\&. Group numbers need not form an unbroken sequence\&. The first and fifth -[mysqld\fIN\fR] +[mariadbd\fIN\fR] groups were intentionally omitted from the example to illustrate that you can have \(lqgaps\(rq in the option file\&. This gives you more flexibility\&. @@ -627,33 +627,33 @@ in the option file\&. This gives you more flexibility\&. # This file should probably be in your home dir (~/\&.my\&.cnf) # or /etc/my\&.cnf # Version 2\&.1 by Jani Tolonen -[mysqld_multi] -mysqld = /usr/local/bin/mysqld_safe -mysqladmin = /usr/local/bin/mysqladmin +[mariadbd-multi] +mariadbd = /usr/local/bin/mariadbd-safe +mariadb-admin = /usr/local/bin/mariadb-admin user = multi_admin password = multipass -[mysqld2] -socket = /tmp/mysql\&.sock2 +[mariadbd2] +socket = /tmp/mariadb\&.sock2 port = 3307 pid\-file = /usr/local/mysql/var2/hostname\&.pid2 datadir = /usr/local/mysql/var2 language = /usr/local/share/mariadb/english user = john -[mysqld3] +[mariadbd3] socket = /tmp/mysql\&.sock3 port = 3308 pid\-file = /usr/local/mysql/var3/hostname\&.pid3 datadir = /usr/local/mysql/var3 language = /usr/local/share/mariadb/swedish user = monty -[mysqld4] +[mariadbd4] socket = /tmp/mysql\&.sock4 port = 3309 pid\-file = /usr/local/mysql/var4/hostname\&.pid4 datadir = /usr/local/mysql/var4 language = /usr/local/share/mariadb/estonia user = tonu -[mysqld6] +[mariadbd6] socket = /tmp/mysql\&.sock6 port = 3311 pid\-file = /usr/local/mysql/var6/hostname\&.pid6 @@ -668,7 +668,7 @@ user = jani .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-safe-helper.1 b/man/mariadbd-safe-helper.1 index 24bb980c37d..58b1707f504 100644 --- a/man/mariadbd-safe-helper.1 +++ b/man/mariadbd-safe-helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadbd-safe.1 b/man/mariadbd-safe.1 index a96e1487980..3221b03e6b9 100644 --- a/man/mariadbd-safe.1 +++ b/man/mariadbd-safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,58 +11,58 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld_safe -.\" tools: mysqld_safe +.\" mariadbd-safe +.\" tools: mariadbd-safe .\" scripts .SH "NAME" -mariadbd-safe \- MariaDB server startup script (mysqld_safe is now a symlink to mariadbd-safe) +mariadbd-safe \- MariaDB server startup script (mariadbd-safe is now a symlink to mariadbd-safe) .SH "SYNOPSIS" -.HP \w'\fBmysqld_safe\ \fR\fB\fIoptions\fR\fR\ 'u -\fBmysqld_safe \fR\fB\fIoptions\fR\fR +.HP \w'\fBmariadbd-safe\ \fR\fB\fIoptions\fR\fR\ 'u +\fBmariadbd-safe \fR\fB\fIoptions\fR\fR .SH "DESCRIPTION" .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is the recommended way to start a -\fBmysqld\fR +\fBmariadbd\fR server on Unix\&. -\fBmysqld_safe\fR +\fBmariadbd-safe\fR adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file\&. Descriptions of error logging is given later in this section\&. .sp -\fBmysqld_safe\fR +\fBmariadbd-safe\fR tries to start an executable named -\fBmysqld\fR\&. To override the default behavior and specify explicitly the name of the server you want to run, specify a -\fB\-\-mysqld\fR +\fBmariadbd\fR\&. To override the default behavior and specify explicitly the name of the server you want to run, specify a +\fB\-\-mariadbd\fR or -\fB\-\-mysqld\-version\fR +\fB\-\-mariadbd\-version\fR option to -\fBmysqld_safe\fR\&. You can also use +\fBmariadbd-safe\fR\&. You can also use \fB\-\-ledir\fR to indicate the directory where -\fBmysqld_safe\fR +\fBmariadbd-safe\fR should look for the server\&. .PP Many of the options to -\fBmysqld_safe\fR +\fBmariadbd-safe\fR are the same as the options to -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .PP Options unknown to -\fBmysqld_safe\fR +\fBmariadbd-safe\fR are passed to -\fBmysqld\fR +\fBmariadbd\fR if they are specified on the command line, but ignored if they are specified in the -[mysqld_safe] or [mariadb_safe] +[mariadbd-safe] or [mariadb_safe] groups of an option file\&. .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR reads all options from the -[mysqld], +[mariadbd], [server], -[mysqld_safe], and [mariadb_safe] +[mariadbd-safe], and [mariadb_safe] sections in option files\&. For example, if you specify a -[mysqld] +[mariadbd] section like this, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR will find and use the \fB\-\-log\-error\fR option: @@ -71,7 +71,7 @@ option: .RS 4 .\} .nf -[mysqld] +[mariadbd] log\-error=error\&.log .fi .if n \{\ @@ -79,14 +79,14 @@ log\-error=error\&.log .\} .PP For backward compatibility, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR also reads -[safe_mysqld] +[safe_mariadbd] sections, although you should rename such sections to -[mysqld_safe] +[mariadbd-safe] in current installations\&. .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR supports the options in the following list\&. It also reads option files and supports the options for processing them. .sp .RS 4 @@ -97,8 +97,8 @@ supports the options in the following list\&. It also reads option files and sup .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: help option -.\" help option: mysqld_safe +.\" mariadbd-safe: help option +.\" help option: mariadbd-safe \fB\-\-help\fR .sp Display a help message and exit\&. @@ -112,8 +112,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: basedir option -.\" basedir option: mysqld_safe +.\" mariadbd-safe: basedir option +.\" basedir option: mariadbd-safe \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp The path to the MariaDB installation directory\&. @@ -127,12 +127,12 @@ The path to the MariaDB installation directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: core-file-size option -.\" core-file-size option: mysqld_safe +.\" mariadbd-safe: core-file-size option +.\" core-file-size option: mariadbd-safe \fB\-\-core\-file\-size=\fR\fB\fIsize\fR\fR .sp The size of the core file that -\fBmysqld\fR +\fBmariadbd\fR should be able to create\&. The option value is passed to \fBulimit \-c\fR\&. .RE @@ -145,11 +145,11 @@ should be able to create\&. The option value is passed to .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: crash-script option -.\" crash-script option: mysqld_safe +.\" mariadbd-safe: crash-script option +.\" crash-script option: mariadbd-safe \fB\-\-crash\-script=\fR\fB\fIfile\fR\fR .sp -Script to call in the event of mysqld crashing\&. +Script to call in the event of mariadbd crashing\&. .RE .sp .RS 4 @@ -160,8 +160,8 @@ Script to call in the event of mysqld crashing\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: datadir option -.\" datadir option: mysqld_safe +.\" mariadbd-safe: datadir option +.\" datadir option: mariadbd-safe \fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp The path to the data directory\&. @@ -175,8 +175,8 @@ The path to the data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: defaults-extra-file option -.\" defaults-extra-file option: mysqld_safe +.\" mariadbd-safe: defaults-extra-file option +.\" defaults-extra-file option: mariadbd-safe \fB\-\-defaults\-extra\-file=\fR\fB\fIpath\fR\fR .sp The name of an option file to be read in addition to the usual option files\&. This must be the first option on the command line if it is used\&. If the file does not exist or is otherwise inaccessible, the server will exit with an error\&. @@ -190,8 +190,8 @@ The name of an option file to be read in addition to the usual option files\&. T .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: defaults-file option -.\" defaults-file option: mysqld_safe +.\" mariadbd-safe: defaults-file option +.\" defaults-file option: mariadbd-safe \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp The name of an option file to be read instead of the usual option files\&. This must be the first option on the command line if it is used\&. @@ -205,8 +205,8 @@ The name of an option file to be read instead of the usual option files\&. This .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: flush-caches option -.\" flush-caches option: mysqld_safe +.\" mariadbd-safe: flush-caches option +.\" flush-caches option: mariadbd-safe \fB\-\-flush\-caches\fR .sp Flush and purge buffers/caches before starting the server\&. @@ -220,12 +220,12 @@ Flush and purge buffers/caches before starting the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: ledir option -.\" ledir option: mysqld_safe +.\" mariadbd-safe: ledir option +.\" ledir option: mariadbd-safe \fB\-\-ledir=\fR\fB\fIpath\fR\fR .sp If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR cannot find the server, use this option to indicate the path name to the directory where the server is located\&. .RE .sp @@ -237,8 +237,8 @@ cannot find the server, use this option to indicate the path name to the directo .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: log-error option -.\" log-error option: mysqld_safe +.\" mariadbd-safe: log-error option +.\" log-error option: mariadbd-safe \fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR .sp Write the error log to the given file\&. @@ -252,8 +252,8 @@ Write the error log to the given file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: malloc-lib option -.\" malloc-lib option: mysqld_safe +.\" mariadbd-safe: malloc-lib option +.\" malloc-lib option: mariadbd-safe \fB\-\-malloc\-lib=\fR\fB\fIlib\fR\fR .sp Preload shared library lib if available\&. @@ -267,14 +267,14 @@ Preload shared library lib if available\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: mysqld option -.\" mysqld option: mysqld_safe -\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-safe: mariadbd option +.\" mariadbd option: mariadbd-safe +\fB\-\-mariadbd=\fR\fB\fIprog_name\fR\fR .sp The name of the server program (in the ledir directory) that you want to start\&. This option is needed if you use the MariaDB binary distribution but have the data directory outside of the binary distribution\&. If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR cannot find the server, use the \fB\-\-ledir\fR option to indicate the path name to the directory where the server is located\&. @@ -288,26 +288,26 @@ option to indicate the path name to the directory where the server is located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: mysqld-version option -.\" mysqld-version option: mysqld_safe -\fB\-\-mysqld\-version=\fR\fB\fIsuffix\fR\fR +.\" mariadbd-safe: mariadbd-version option +.\" mariadbd-version option: mariadbd-safe +\fB\-\-mariadbd\-version=\fR\fB\fIsuffix\fR\fR .sp This option is similar to the -\fB\-\-mysqld\fR +\fB\-\-mariadbd\fR option, but you specify only the suffix for the server program name\&. The basename is assumed to be -\fBmysqld\fR\&. For example, if you use -\fB\-\-mysqld\-version=debug\fR, -\fBmysqld_safe\fR +\fBmariadbd\fR\&. For example, if you use +\fB\-\-mariadbd\-version=debug\fR, +\fBmariadbd-safe\fR starts the -\fBmysqld\-debug\fR +\fBmariadbd\-debug\fR program in the ledir directory\&. If the argument to -\fB\-\-mysqld\-version\fR +\fB\-\-mariadbd\-version\fR is empty, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR uses -\fBmysqld\fR +\fBmariadbd\fR in the ledir directory\&. @@ -321,8 +321,8 @@ directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: nice option -.\" nice option: mysqld_safe +.\" mariadbd-safe: nice option +.\" nice option: mariadbd-safe \fB\-\-nice=\fR\fB\fIpriority\fR\fR .sp Use the @@ -338,13 +338,13 @@ program to set the server's scheduling priority to the given value\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: no-auto-restart option -.\" no-auto-restart option: mysqld_safe +.\" mariadbd-safe: no-auto-restart option +.\" no-auto-restart option: mariadbd-safe \fB\-\-no\-auto\-restart\fR, \fB\-\-nowatch\fR, \fB\-\-no\-watch\fR .sp -Exit after starting mysqld\&. +Exit after starting mariadbd\&. .RE .sp .RS 4 @@ -355,8 +355,8 @@ Exit after starting mysqld\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: no-defaults option -.\" no-defaults option: mysqld_safe +.\" mariadbd-safe: no-defaults option +.\" no-defaults option: mariadbd-safe \fB\-\-no\-defaults\fR .sp Do not read any option files\&. This must be the first option on the command line if it is used\&. @@ -370,11 +370,11 @@ Do not read any option files\&. This must be the first option on the command lin .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: numa-interleave option -.\" numa-interleave option: mysqld_safe +.\" mariadbd-safe: numa-interleave option +.\" numa-interleave option: mariadbd-safe \fB\-\-numa\-interleave\fR .sp -Run mysqld with its memory interleaved on all NUMA nodes\&. +Run mariadbd with its memory interleaved on all NUMA nodes\&. .RE .sp .RS 4 @@ -385,15 +385,15 @@ Run mysqld with its memory interleaved on all NUMA nodes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: open-files-limit option -.\" open-files-limit option: mysqld_safe +.\" mariadbd-safe: open-files-limit option +.\" open-files-limit option: mariadbd-safe \fB\-\-open\-files\-limit=\fR\fB\fIcount\fR\fR .sp The number of files that -\fBmysqld\fR +\fBmariadbd\fR should be able to open\&. The option value is passed to \fBulimit \-n\fR\&. Note that you need to start -\fBmysqld_safe\fR +\fBmariadbd-safe\fR as root for this to work properly! @@ -407,8 +407,8 @@ for this to work properly! .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: pid-file option -.\" pid-file option: mysqld_safe +.\" mariadbd-safe: pid-file option +.\" pid-file option: mariadbd-safe \fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR .sp The path name of the process ID file\&. @@ -422,8 +422,8 @@ The path name of the process ID file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: plugin-dir option -.\" plugin-dir option: mysqld_safe +.\" mariadbd-safe: plugin-dir option +.\" plugin-dir option: mariadbd-safe \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -437,8 +437,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: port option -.\" port option: mysqld_safe +.\" mariadbd-safe: port option +.\" port option: mariadbd-safe \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The port number that the server should use when listening for TCP/IP connections\&. The port number must be 1024 or higher unless the server is started by the @@ -454,12 +454,12 @@ system user\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: skip-kill-mysqld option -.\" skip-kill-mysqld option: mysqld_safe -\fB\-\-skip\-kill\-mysqld\fR +.\" mariadbd-safe: skip-kill-mariadbd option +.\" skip-kill-mariadbd option: mariadbd-safe +\fB\-\-skip\-kill\-mariadbd\fR .sp Do not try to kill stray -\fBmysqld\fR +\fBmariadbd\fR processes at startup\&. This option works only on Linux\&. .RE .sp @@ -471,8 +471,8 @@ processes at startup\&. This option works only on Linux\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: socket option -.\" socket option: mysqld_safe +.\" mariadbd-safe: socket option +.\" socket option: mariadbd-safe \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp The Unix socket file that the server should use when listening for local connections\&. @@ -486,10 +486,10 @@ The Unix socket file that the server should use when listening for local connect .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: syslog option -.\" syslog option: mysqld_safe -.\" mysqld_safe: skip-syslog option -.\" skip-syslog option: mysqld_safe +.\" mariadbd-safe: syslog option +.\" syslog option: mariadbd-safe +.\" mariadbd-safe: skip-syslog option +.\" skip-syslog option: mariadbd-safe \fB\-\-syslog\fR, \fB\-\-skip\-syslog\fR .sp @@ -512,23 +512,23 @@ syslog; messages are written to an error log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: syslog-tag option -.\" syslog-tag option: mysqld_safe +.\" mariadbd-safe: syslog-tag option +.\" syslog-tag option: mariadbd-safe \fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR .sp For logging to syslog, messages from -\fBmysqld_safe\fR +\fBmariadbd-safe\fR and -\fBmysqld\fR +\fBmariadbd\fR are written with a tag of -mysqld_safe +mariadbd-safe and -mysqld, respectively\&. To specify a suffix for the tag, use +mariadbd, respectively\&. To specify a suffix for the tag, use \fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR, which modifies the tags to be -mysqld_safe\-\fItag\fR +mariadbd-safe\-\fItag\fR and -mysqld\-\fItag\fR\&. +mariadbd\-\fItag\fR\&. .RE .sp .RS 4 @@ -539,8 +539,8 @@ mysqld\-\fItag\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: timezone option -.\" timezone option: mysqld_safe +.\" mariadbd-safe: timezone option +.\" timezone option: mariadbd-safe \fB\-\-timezone=\fR\fB\fItimezone\fR\fR .sp Set the @@ -556,12 +556,12 @@ time zone environment variable to the given option value\&. Consult your operati .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: user option -.\" user option: mysqld_safe +.\" mariadbd-safe: user option +.\" user option: mariadbd-safe \fB\-\-user={\fR\fB\fIuser_name\fR\fR\fB|\fR\fB\fIuser_id\fR\fR\fB}\fR .sp Run the -\fBmysqld\fR +\fBmariadbd\fR server as the user having the name \fIuser_name\fR or the numeric user ID @@ -570,7 +570,7 @@ in this context refers to a system login account, not a MariaDB user listed in t .RE .PP If you execute -\fBmysqld_safe\fR +\fBmariadbd-safe\fR with the \fB\-\-defaults\-file\fR or @@ -581,7 +581,7 @@ option to name an option file, the option must be the first one given on the com .RS 4 .\} .nf -mysql> \fBmysqld_safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +mariadb> \fBmariadbd-safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .fi .if n \{\ .RE @@ -593,16 +593,16 @@ Instead, use the following command: .RS 4 .\} .nf -mysql> \fBmysqld_safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR +mariadb> \fBmariadbd-safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR .fi .if n \{\ .RE .\} .PP The -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script is written so that it normally can start a server that was installed from either a source or a binary distribution of MariaDB, even though these types of distributions typically install the server in slightly different locations\&. -\fBmysqld_safe\fR +\fBmariadbd-safe\fR expects one of the following conditions to be true: .sp .RS 4 @@ -614,9 +614,9 @@ expects one of the following conditions to be true: .IP \(bu 2.3 .\} The server and databases can be found relative to the working directory (the directory from which -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is invoked)\&. For binary distributions, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR looks under its working directory for bin and @@ -626,7 +626,7 @@ libexec and var directories\&. This condition should be met if you execute -\fBmysqld_safe\fR +\fBmariadbd-safe\fR from your MariaDB installation directory (for example, /usr/local/mysql for a binary distribution)\&. @@ -641,7 +641,7 @@ for a binary distribution)\&. .IP \(bu 2.3 .\} If the server and databases cannot be found relative to the working directory, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR attempts to locate them by absolute path names\&. Typical locations are /usr/local/libexec and @@ -649,9 +649,9 @@ and .RE .PP Because -\fBmysqld_safe\fR +\fBmariadbd-safe\fR tries to find the server and databases relative to its own working directory, you can install a binary distribution of MariaDB anywhere, as long as you run -\fBmysqld_safe\fR +\fBmariadbd-safe\fR from the MariaDB installation directory: .sp .if n \{\ @@ -659,14 +659,14 @@ from the MariaDB installation directory: .\} .nf shell> \fBcd \fR\fB\fImysql_installation_directory\fR\fR -shell> \fBbin/mysqld_safe &\fR +shell> \fBbin/mariadbd-safe &\fR .fi .if n \{\ .RE .\} .PP If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR fails, even when invoked from the MariaDB installation directory, you can specify the \fB\-\-ledir\fR and @@ -674,16 +674,16 @@ and options to indicate the directories in which the server and databases are located on your system\&. .PP When you use -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to start -\fBmysqld\fR, -\fBmysqld_safe\fR +\fBmariadbd\fR, +\fBmariadbd-safe\fR arranges for error (and notice) messages from itself and from -\fBmysqld\fR +\fBmariadbd\fR to go to the same destination\&. .PP There are several -\fBmysqld_safe\fR +\fBmariadbd-safe\fR options for controlling the destination of these messages: .sp .RS 4 @@ -754,28 +754,28 @@ are both given, a warning is issued and takes precedence\&. .PP When -\fBmysqld_safe\fR +\fBmariadbd-safe\fR writes a message, notices go to the logging destination (syslog or the error log file) and stdout\&. Errors go to the logging destination and stderr\&. .PP Normally, you should not edit the -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script\&. Instead, configure -\fBmysqld_safe\fR +\fBmariadbd-safe\fR by using command\-line options or options in the -[mysqld_safe] +[mariadbd-safe] section of a my\&.cnf option file\&. In rare cases, it might be necessary to edit -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to get it to start the server properly\&. However, if you do this, your modified version of -\fBmysqld_safe\fR +\fBmariadbd-safe\fR might be overwritten if you upgrade MariaDB in the future, so you should make a copy of your edited version that you can reinstall\&. .PP On NetWare, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is a NetWare Loadable Module (NLM) that is ported from the original Unix shell script\&. It starts the server as follows: .sp .RS 4 @@ -822,7 +822,7 @@ Provides a screen presence for the MariaDB server\&. .IP " 4." 4.2 .\} Starts -\fBmysqld\fR, monitors it, and restarts it if it terminates in error\&. +\fBmariadbd\fR, monitors it, and restarts it if it terminates in error\&. .RE .sp .RS 4 @@ -834,7 +834,7 @@ Starts .IP " 5." 4.2 .\} Sends error messages from -\fBmysqld\fR +\fBmariadbd\fR to the \fIhost_name\fR\&.err file in the data directory\&. @@ -849,7 +849,7 @@ file in the data directory\&. .IP " 6." 4.2 .\} Sends -\fBmysqld_safe\fR +\fBmariadbd-safe\fR screen output to the \fIhost_name\fR\&.safe file in the data directory\&. @@ -857,7 +857,7 @@ file in the data directory\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd.8 b/man/mariadbd.8 index 16280234034..e84a271127d 100644 --- a/man/mariadbd.8 +++ b/man/mariadbd.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD\fR" "8" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD\fR" "8" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,28 +11,28 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld: MariaDB server -.\" MariaDB server: mysqld +.\" mariadbd: MariaDB server +.\" MariaDB server: mariadbd .SH "NAME" -mariadbd \- the MariaDB server (mysqld is now a symlink to mariadbd) +mariadbd \- the MariaDB server (mariadbd is now a symlink to mariadbd) .SH "SYNOPSIS" -.HP \w'\fBmysqld\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqld [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadbd\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadbd [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqld\fR, also known as MariaDB Server, is the main program that does most of the work in a MariaDB installation\&. MariaDB Server manages access to the MariaDB data directory that contains databases and tables\&. The data directory is also the default location for other information such as log files and status files\&. +\fBmariadbd\fR, also known as MariaDB Server, is the main program that does most of the work in a MariaDB installation\&. MariaDB Server manages access to the MariaDB data directory that contains databases and tables\&. The data directory is also the default location for other information such as log files and status files\&. .PP When MariaDB server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients\&. .PP The -\fBmysqld\fR +\fBmariadbd\fR program has many options that can be specified at startup\&. For a complete list of options, run this command: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld \-\-verbose \-\-help\fR +shell> \fBmariadbd \-\-verbose \-\-help\fR .fi .if n \{\ .RE @@ -45,7 +45,7 @@ the MariaDB Knowledge Base\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mbstream.1 b/man/mbstream.1 index 9409d8660e5..da2d3fc2c39 100644 --- a/man/mbstream.1 +++ b/man/mbstream.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMBSTREAM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMBSTREAM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index ed6c136f395..f9355a9d232 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMSQL2MYSQL\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMSQL2MYSQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,17 +13,17 @@ .\" ----------------------------------------------------------------- .\" msql2mysql .SH "NAME" -msql2mysql \- convert mSQL programs for use with MySQL +msql2mysql \- convert mSQL programs for use with MariaDB .SH "SYNOPSIS" .HP \w'\fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP -Initially, the MySQL C API was developed to be very similar to that for the mSQL database system\&. Because of this, mSQL programs often can be converted relatively easily for use with MySQL by changing the names of the C API functions\&. +Initially, the MySQL C API was developed to be very similar to that for the mSQL database system\&. Because of this, mSQL programs often can be converted relatively easily for use with MariaDB by changing the names of the C API functions\&. .PP The \fBmsql2mysql\fR -utility performs the conversion of mSQL C API function calls to their MySQL equivalents\&. +utility performs the conversion of mSQL C API function calls to their MariaDB equivalents\&. \fBmsql2mysql\fR converts the input file in place, so make a copy of the original before converting it\&. For example, use \fBmsql2mysql\fR @@ -53,7 +53,7 @@ utility to make the function name substitutions\&. See .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index 38f2c0a8fe1..8816e46b06e 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "18 December 2023" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -21,9 +21,9 @@ my_print_defaults \- display options from option files .PP \fBmy_print_defaults\fR displays the options that are present in option groups of option files\&. The output indicates what options will be used by programs that read the specified option groups\&. For example, the -\fBmysqlcheck\fR +\fBmariadb-check\fR program reads the -[mysqlcheck] +[mariadb-check] and [client] option groups\&. To see what options are present in those groups in the standard option files, invoke @@ -34,7 +34,7 @@ like this: .RS 4 .\} .nf -shell> \fBmy_print_defaults mysqlcheck client\fR +shell> \fBmy_print_defaults mariadb-check client\fR \-\-user=myusername \-\-password=secret \-\-host=localhost @@ -162,11 +162,11 @@ Read the same set of groups that the mariadbd binary does. .IP \(bu 2.3 .\} -.\" my_print_defaults: --mysqld option -.\" mysqld option: my_print_defaults -\fB\-\-mysqld\fR +.\" my_print_defaults: --mariadbd option +.\" mariadbd option: my_print_defaults +\fB\-\-mariadbd\fR .sp -Read the same set of groups that the mysqld binary does. +Read the same set of groups that the mariadbd binary does. .RE .sp .RS 4 @@ -219,7 +219,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_safe_process.1 b/man/my_safe_process.1 index 455e1b8860f..955275bfb01 100644 --- a/man/my_safe_process.1 +++ b/man/my_safe_process.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_SAFE_PROCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMY_SAFE_PROCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index 449ff55d37a..8df198f0354 100644 --- a/man/myisam_ftdump.1 +++ b/man/myisam_ftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAM_FTDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAM_FTDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -235,7 +235,7 @@ Verbose mode\&. Print more output about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamchk.1 b/man/myisamchk.1 index 1dc053337ec..fd68cf378b5 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMCHK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMCHK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -196,13 +196,13 @@ warning: clients are using or haven't closed the table properly .\} .PP This means that you are trying to check a table that has been updated by another program (such as the -\fBmysqld\fR +\fBmariadbd\fR server) that hasn't yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more MyISAM tables\&. .PP If -\fBmysqld\fR +\fBmariadbd\fR is running, you must force it to flush any table modifications that are still buffered in memory by using FLUSH TABLES\&. You should then ensure that no one is using the tables while you are running \fBmyisamchk\fR @@ -348,7 +348,7 @@ Display version information and exit\&. \fB\-w\fR .sp Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing\&. If you are running -\fBmysqld\fR +\fBmariadbd\fR with external locking disabled, the table can be locked only by another \fBmyisamchk\fR command\&. @@ -604,7 +604,7 @@ ft_stopword_file values to \fBmyisamchk\fR that you use for -\fBmysqld\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with +\fBmariadbd\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with \fBmyisamchk\fR like this: .sp @@ -621,7 +621,7 @@ shell> \fBmyisamchk \-\-recover \-\-ft_min_word_len=3 \fR\fB\fItbl_name\fR\fR\fB To ensure that \fBmyisamchk\fR and the server use the same values for full\-text parameters, you can place each one in both the -[mysqld] +[mariadbd] and [myisamchk] sections of an option file: @@ -630,7 +630,7 @@ sections of an option file: .RS 4 .\} .nf -[mysqld] +[mariadbd] ft_min_word_len=3 [myisamchk] ft_min_word_len=3 @@ -803,7 +803,7 @@ operation\&. This finds only 99\&.99% of all errors, which should be good enough Do not mark the table as checked\&. This is useful if you use \fBmyisamchk\fR to check a table that is in use by some other application that does not use locking, such as -\fBmysqld\fR +\fBmariadbd\fR when run with external locking disabled\&. .RE .sp @@ -825,7 +825,7 @@ Store information in the file to indicate when the table was checked and whether the table crashed\&. This should be used to get full benefit of the \fB\-\-check\-only\-changed\fR option, but you shouldn't use this option if the -\fBmysqld\fR +\fBmariadbd\fR server is using the table and you are running it with external locking disabled\&. .RE .SH "MYISAMCHK REPAIR OPTIONS" @@ -2505,7 +2505,7 @@ instead of .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamlog.1 b/man/myisamlog.1 index dbf50cf7800..4f99586ff90 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMLOG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -218,7 +218,7 @@ Display version information\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisampack.1 b/man/myisampack.1 index 89dab7d8cf5..db999d33a13 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMPACK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMPACK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -34,11 +34,11 @@ packs the data file 40%\(en70%\&. .PP When the table is used later, the server reads into memory the information needed to decompress columns\&. This results in much better performance when accessing individual rows, because you only have to uncompress exactly one row\&. .PP -MySQL uses +MariaDB uses mmap() when possible to perform memory mapping on compressed tables\&. If mmap() -does not work, MySQL falls back to normal read/write file operations\&. +does not work, MariaDB falls back to normal read/write file operations\&. .PP Please note the following: .sp @@ -51,7 +51,7 @@ Please note the following: .IP \(bu 2.3 .\} If the -\fBmysqld\fR +\fBmariadbd\fR server was invoked with external locking disabled, it is not a good idea to invoke \fBmyisampack\fR if the table might be updated by the server during the packing process\&. It is safest to compress tables with the server stopped\&. @@ -320,7 +320,7 @@ Display version information and exit\&. \fB\-w\fR .sp Wait and retry if the table is in use\&. If the -\fBmysqld\fR +\fBmariadbd\fR server was invoked with external locking disabled, it is not a good idea to invoke \fBmyisampack\fR if the table might be updated by the server during the packing process\&. @@ -798,7 +798,7 @@ The number of bits used in the Huffman tree\&. After you run \fBmyisampack\fR, you must run \fBmyisamchk\fR -to re\-create any indexes\&. At this time, you can also sort the index blocks and create statistics needed for the MySQL optimizer to work more efficiently: +to re\-create any indexes\&. At this time, you can also sort the index blocks and create statistics needed for the MariaDB optimizer to work more efficiently: .sp .if n \{\ .RS 4 @@ -810,10 +810,10 @@ shell> \fBmyisamchk \-rq \-\-sort\-index \-\-analyze \fR\fB\fItbl_name\fR\fR\fB\ .RE .\} .PP -After you have installed the packed table into the MySQL database directory, you should execute -\fBmysqladmin flush\-tables\fR +After you have installed the packed table into the MariaDB database directory, you should execute +\fBmariadb-admin flush\-tables\fR to force -\fBmysqld\fR +\fBmariadbd\fR to start using the new table\&. .PP To unpack a packed table, use the @@ -823,7 +823,7 @@ option to .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index 6024a2ece08..b6929463b43 100644 --- a/man/mysql-stress-test.pl.1 +++ b/man/mysql-stress-test.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\-STRESS\-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\-STRESS\-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,36 +11,36 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql-stress-test.pl +.\" mariadb-stress-test.pl .SH "NAME" -mysql-stress-test.pl \- server stress test program +mariadb-stress-test.pl \- server stress test program .SH "SYNOPSIS" -.HP \w'\fBmysql\-stress\-test\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb\-stress\-test\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR Perl script performs stress\-testing of the MariaDB server\&. .PP -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR requires a version of Perl that has been built with threads support\&. .PP Invoke -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR supports the following options: .sp .RS 4 @@ -51,8 +51,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: help option -.\" help option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: help option +.\" help option: mariadb-stress-test.pl \fB\-\-help\fR .sp Display a help message and exit\&. @@ -66,8 +66,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: abort-on-error option -.\" abort-on-error option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: abort-on-error option +.\" abort-on-error option: mariadb-stress-test.pl \fB\-\-abort\-on\-error=\fR\fB\fIN\fR\fR .sp Causes the program to abort if an error with severity less than or equal to N was encountered\&. Set to 1 to abort on any error\&. @@ -81,8 +81,8 @@ Causes the program to abort if an error with severity less than or equal to N wa .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: check-tests-file option -.\" check-tests-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: check-tests-file option +.\" check-tests-file option: mariadb-stress-test.pl \fB\-\-check\-tests\-file\fR .sp Periodically check the file that lists the tests to be run\&. If it has been modified, reread the file\&. This can be useful if you update the list of tests to be run during a stress test\&. @@ -96,8 +96,8 @@ Periodically check the file that lists the tests to be run\&. If it has been mod .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: cleanup option -.\" cleanup option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: cleanup option +.\" cleanup option: mariadb-stress-test.pl \fB\-\-cleanup\fR .sp Force cleanup of the working directory\&. @@ -111,8 +111,8 @@ Force cleanup of the working directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: log-error-details option -.\" log-error-details option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: log-error-details option +.\" log-error-details option: mariadb-stress-test.pl \fB\-\-log\-error\-details\fR .sp Log error details in the global error log file\&. @@ -126,8 +126,8 @@ Log error details in the global error log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: loop-count option -.\" loop-count option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: loop-count option +.\" loop-count option: mariadb-stress-test.pl \fB\-\-loop\-count=\fR\fB\fIN\fR\fR .sp In sequential test mode, the number of loops to execute before exiting\&. @@ -141,12 +141,12 @@ In sequential test mode, the number of loops to execute before exiting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: mysqltest option -.\" mysqltest option: mysql-stress-test.pl -\fB\-\-mysqltest=\fR\fB\fIpath\fR\fR +.\" mariadb-stress-test.pl: mariadb-test option +.\" mariadb-test option: mariadb-stress-test.pl +\fB\-\-mariadb-test=\fR\fB\fIpath\fR\fR .sp The path name to the -\fBmysqltest\fR +\fBmariadb-test\fR program\&. .RE .sp @@ -158,8 +158,8 @@ program\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-database option -.\" server-database option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-database option +.\" server-database option: mariadb-stress-test.pl \fB\-\-server\-database=\fR\fB\fIdb_name\fR\fR .sp The database to use for the tests\&. The default is @@ -174,8 +174,8 @@ test\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-host option -.\" server-host option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-host option +.\" server-host option: mariadb-stress-test.pl \fB\-\-server\-host=\fR\fB\fIhost_name\fR\fR .sp The host name of the local host to use for making a TCP/IP connection to the local server\&. By default, the connection is made to @@ -191,8 +191,8 @@ using a Unix socket file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-logs-dir option -.\" server-logs-dir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-logs-dir option +.\" server-logs-dir option: mariadb-stress-test.pl \fB\-\-server\-logs\-dir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -208,8 +208,8 @@ is the directory where all client session logs will be stored\&. Usually this is .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-password option -.\" server-password option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-password option +.\" server-password option: mariadb-stress-test.pl \fB\-\-server\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. @@ -223,8 +223,8 @@ The password to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-port option -.\" server-port option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-port option +.\" server-port option: mariadb-stress-test.pl \fB\-\-server\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for connecting to the server\&. The default is 3306\&. @@ -238,13 +238,13 @@ The TCP/IP port number to use for connecting to the server\&. The default is 330 .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-socket option -.\" server-socket option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-socket option +.\" server-socket option: mariadb-stress-test.pl \fB\-\-server\-socket=\fR\fB\fIfile_name\fR\fR .sp For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. The default is -/tmp/mysql\&.sock\&. +/tmp/mariadb\&.sock\&. .RE .sp .RS 4 @@ -255,8 +255,8 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-user option -.\" server-user option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-user option +.\" server-user option: mariadb-stress-test.pl \fB\-\-server\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. The default is @@ -271,8 +271,8 @@ root\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: sleep-time option -.\" sleep-time option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: sleep-time option +.\" sleep-time option: mariadb-stress-test.pl \fB\-\-sleep\-time=\fR\fB\fIN\fR\fR .sp The delay in seconds between test executions\&. @@ -286,8 +286,8 @@ The delay in seconds between test executions\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-basedir option -.\" stress-basedir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-basedir option +.\" stress-basedir option: mariadb-stress-test.pl \fB\-\-stress\-basedir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -303,8 +303,8 @@ is the working directory for the test run\&. It is used as the temporary locatio .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-datadir option -.\" stress-datadir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-datadir option +.\" stress-datadir option: mariadb-stress-test.pl \fB\-\-stress\-datadir=\fR\fB\fIpath\fR\fR .sp The directory of data files to be used during testing\&. The default location is the @@ -322,8 +322,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-init-file option -.\" stress-init-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-init-file option +.\" stress-init-file option: mariadb-stress-test.pl \fB\-\-stress\-init\-file[=\fR\fB\fIpath\fR\fR\fB]\fR .sp \fIfile_name\fR @@ -340,8 +340,8 @@ in the test suite directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-mode option -.\" stress-mode option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-mode option +.\" stress-mode option: mariadb-stress-test.pl \fB\-\-stress\-mode=\fR\fB\fImode\fR\fR .sp This option indicates the test order in stress\-test mode\&. The @@ -362,8 +362,8 @@ random\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-suite-basedir option -.\" stress-suite-basedir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-suite-basedir option +.\" stress-suite-basedir option: mariadb-stress-test.pl \fB\-\-stress\-suite\-basedir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -387,8 +387,8 @@ option\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-tests-file option -.\" stress-tests-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-tests-file option +.\" stress-tests-file option: mariadb-stress-test.pl \fB\-\-stress\-tests\-file[=\fR\fB\fIfile_name\fR\fR\fB]\fR .sp Use this option to run the stress tests\&. @@ -409,14 +409,14 @@ in the stress suite directory\&. (See .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: suite option -.\" suite option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: suite option +.\" suite option: mariadb-stress-test.pl \fB\-\-suite=\fR\fB\fIsuite_name\fR\fR .sp Run the named test suite\&. The default name is main (the regular test suite located in the -mysql\-test +mariadb\-test directory)\&. .RE .sp @@ -428,8 +428,8 @@ directory)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: test-count option -.\" test-count option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: test-count option +.\" test-count option: mariadb-stress-test.pl \fB\-\-test\-count=\fR\fB\fIN\fR\fR .sp The number of tests to execute before exiting\&. @@ -443,8 +443,8 @@ The number of tests to execute before exiting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: test-duration option -.\" test-duration option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: test-duration option +.\" test-duration option: mariadb-stress-test.pl \fB\-\-test\-duration=\fR\fB\fIN\fR\fR .sp The duration of stress testing in seconds\&. @@ -458,8 +458,8 @@ The duration of stress testing in seconds\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: threads option -.\" threads option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: threads option +.\" threads option: mariadb-stress-test.pl \fB\-\-threads=\fR\fB\fIN\fR\fR .sp The number of threads\&. The default is 1\&. @@ -473,8 +473,8 @@ The number of threads\&. The default is 1\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: verbose option -.\" verbose option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: verbose option +.\" verbose option: mariadb-stress-test.pl \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -482,7 +482,7 @@ Verbose mode\&. Print more information about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 1677c070f3b..a1ac726ae68 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\-TEST\-RUN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\-TEST\-RUN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,31 +11,31 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql-test-run.pl +.\" mariadb-test-run.pl .SH "NAME" -mysql-test-run.pl \- run MariaDB test suite +mariadb-test-run.pl \- run MariaDB test suite .SH "SYNOPSIS" -.HP \w'\fBmysql\-test\-run\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb\-test\-run\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR Perl script is the main application used to run the MariaDB test suite\&. It invokes -\fBmysqltest\fR +\fBmariadb-test\fR to run individual test cases\&. .PP Invoke -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR in the -mysql\-test +mariadb\-test directory like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +shell> \fBmariadb\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR .fi .if n \{\ .RE @@ -49,11 +49,11 @@ t/\fItest_name\fR\&.test\&. For each \fItest_name\fR argument, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR runs the named test case\&. With no \fItest_name\fR arguments, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR runs all \&.test files in the @@ -68,9 +68,9 @@ is assumed\&. Any leading path name is ignored\&. These commands are equivalent: .RS 4 .\} .nf -shell> \fBmysql\-test\-run\&.pl mytest\fR -shell> \fBmysql\-test\-run\&.pl mytest\&.test\fR -shell> \fBmysql\-test\-run\&.pl t/mytest\&.test\fR +shell> \fBmariadb\-test\-run\&.pl mytest\fR +shell> \fBmariadb\-test\-run\&.pl mytest\&.test\fR +shell> \fBmariadb\-test\-run\&.pl t/mytest\&.test\fR .fi .if n \{\ .RE @@ -89,7 +89,7 @@ A suite name can be given as part of the test name\&. That is, the syntax for na .\} .PP If a suite name is given, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR looks in that suite for the test\&. The test file corresponding to a test named \fIsuite_name\&.test_name\fR is found in @@ -98,7 +98,7 @@ main for the tests in the top t directory\&. With no suite name, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR looks in the default list of suites for a match and runs the test in any suites where it finds the test\&. Suppose that the default suite list is main, binlog, @@ -112,7 +112,7 @@ suites\&. With an argument of mytest or mytest\&.test, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will run mytest\&.test from the @@ -152,14 +152,14 @@ with anything in between\&. In the latter case, the pattern match is not anchore xmainytesta\&. .PP To perform setup prior to running tests, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR needs to invoke -\fBmysqld\fR +\fBmariadbd\fR with the \fB\-\-bootstrap\fR and \fB\-\-skip\-grant\-tables\fR -options\&. If MySQL was configured with the +options\&. If MariaDB was configured with the \fB\-\-disable\-grant\-options\fR option, \fB\-\-bootstrap\fR, @@ -168,7 +168,7 @@ option, will be disabled\&. To handle this, set the MYSQLD_BOOTSTRAP environment variable to the full path name of a server that has all options enabled\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will use that server to perform setup; it is not used to run the tests\&. .PP The @@ -182,7 +182,7 @@ is disabled\&. This is an expected failure that can be handled as follows: .\} .nf shell> \fBexport MYSQLD_BOOTSTRAP\fR -shell> \fBMYSQLD_BOOTSTRAP=/full/path/to/mysqld\fR +shell> \fBMYSQLD_BOOTSTRAP=/full/path/to/mariadbd\fR shell> \fBmake test force="\-\-skip\-test=init_file"\fR .fi .if n \{\ @@ -190,15 +190,15 @@ shell> \fBmake test force="\-\-skip\-test=init_file"\fR .\} .PP To run -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR on Windows, you'll need either Cygwin or ActiveState Perl to run it\&. You may also need to install the modules required by the script\&. To run the test script, change location into the -mysql\-test +mariadb\-test directory, set the MTR_VS_CONFIG environment variable to the configuration you selected earlier (or use the \fB\-\-vs\-config\fR option), and invoke -\fBmysql\-test\-run\&.pl\fR\&. For example (using Cygwin and the +\fBmariadb\-test\-run\&.pl\fR\&. For example (using Cygwin and the \fBbash\fR shell): .sp @@ -206,19 +206,19 @@ shell): .RS 4 .\} .nf -shell> \fBcd mysql\-test\fR +shell> \fBcd mariadb\-test\fR shell> \fBexport MTR_VS_CONFIG=debug\fR -shell> \fB\&./mysqltest\-run\&.pl \-\-force \-\-timer\fR -shell> \fB\&./mysqltest\-run\&.pl \-\-force \-\-timer \-\-ps\-protocol\fR +shell> \fB\&./mariadb-test\-run\&.pl \-\-force \-\-timer\fR +shell> \fB\&./mariadb-test\-run\&.pl \-\-force \-\-timer \-\-ps\-protocol\fR .fi .if n \{\ .RE .\} .PP -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR uses several environment variables\&. Some of them are listed in the following table\&. Some of these are set from the outside and used by -\fBmysql\-test\-run\&.pl\fR, others are set by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR, others are set by +\fBmariadb\-test\-run\&.pl\fR instead, and may be referred to in tests\&. .TS allbox tab(:); @@ -242,7 +242,7 @@ T} T{ MTR_VERSION T}:T{ -If set to 1, will run the older version 1 of \fBmysql\-test\-run\&.pl\fR\&. This will affect what functionailty is available and what command line options are supported\&. +If set to 1, will run the older version 1 of \fBmariadb\-test\-run\&.pl\fR\&. This will affect what functionailty is available and what command line options are supported\&. T} T{ MTR_MEM @@ -275,12 +275,12 @@ T} T{ MYSQL_TEST T}:T{ -Path name to \fBmysqltest\fR binary +Path name to \fBmariadb-test\fR binary T} T{ MYSQLD_BOOTSTRAP T}:T{ -Full path name to \fBmysqld\fR that has all options enabled +Full path name to \fBmariadbd\fR that has all options enabled T} T{ MYSQLTEST_VARDIR @@ -291,7 +291,7 @@ T} T{ MYSQL_TEST_DIR T}:T{ -Full path to the mysql\-test directory where tests +Full path to the mariadb\-test directory where tests are being run from T} T{ @@ -309,9 +309,9 @@ MTR_BUILD_THREAD\&. It gives the actual port number directly (will be rounded do MTR_BUILD_THREAD, the port number is found by multiplying this by 10 and adding 10000\&. .PP Tests sometimes rely on certain environment variables being defined\&. For example, certain tests assume that -MYSQL_TEST +MARIADB-TEST is defined so that -\fBmysqltest\fR +\fBmariadb-test\fR can invoke itself with exec $MYSQL_TEST\&. .PP @@ -319,18 +319,18 @@ Other tests may refer to the last three variables listed in the preceding table, $MYSQL_TMP_DIR/\fIfile_name\fR\&. .PP If you are running -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR version 1 by setting MTR_VERSION, note that this only affects the test driver, not the test client (and its language) or the tests themselves\&. .PP A few tests might not run with version 1 because they depend on some feature of version 2\&. You may have those tests skipped by adding the test name to the file lib/v1/incompatible\&.tests\&. This feature is available from MySQL 5\&.1\&.40\&. .PP -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR supports the options in the following list\&. An argument of \fB\-\-\fR tells -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR not to process any following arguments as options\&. .sp .RS 4 @@ -341,8 +341,8 @@ not to process any following arguments as options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: help option -.\" help option: mysql-test-run.pl +.\" mariadb-test-run.pl: help option +.\" help option: mariadb-test-run.pl \fB\-\-help\fR, \fB\-h\fR .sp @@ -357,8 +357,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: big-test option -.\" big-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: big-test option +.\" big-test option: mariadb-test-run.pl \fB\-\-big\-test\fR .sp Allow tests marked as "big" to run\&. Tests can be thus marked by including the line @@ -377,11 +377,11 @@ This is typically used for tests that take a very long to run, or that use many .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-dbx option -.\" boot-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-dbx option +.\" boot-dbx option: mariadb-test-run.pl \fB\-\-boot\-dbx\fR .sp -Run the mysqld server used for bootstrapping the database through the dbx debugger\&. +Run the mariadbd server used for bootstrapping the database through the dbx debugger\&. .RE .sp .RS 4 @@ -392,11 +392,11 @@ Run the mysqld server used for bootstrapping the database through the dbx debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-ddd option -.\" boot-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-ddd option +.\" boot-ddd option: mariadb-test-run.pl \fB\-\-boot\-ddd\fR .sp -Run the mysqld server used for bootstrapping the database through the ddd debugger\&. +Run the mariadbd server used for bootstrapping the database through the ddd debugger\&. .RE .sp .RS 4 @@ -407,11 +407,11 @@ Run the mysqld server used for bootstrapping the database through the ddd debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-gdb option -.\" boot-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-gdb option +.\" boot-gdb option: mariadb-test-run.pl \fB\-\-boot\-gdb\fR .sp -Run the mysqld server used for bootstrapping the database through the gdb debugger\&. +Run the mariadbd server used for bootstrapping the database through the gdb debugger\&. .RE .sp .RS 4 @@ -422,15 +422,15 @@ Run the mysqld server used for bootstrapping the database through the gdb debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: build-thread option -.\" build-thread option: mysql-test-run.pl +.\" mariadb-test-run.pl: build-thread option +.\" build-thread option: mariadb-test-run.pl \fB\-\-[mtr\-]build\-thread=\fR\fB\fInumber\fR\fR .sp Specify a number to calculate port numbers from\&. The formula is 10 * \fIbuild_thread\fR + 10000\&. Instead of a number, it can be set to auto, which is also the default value, in which case -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will allocate a number unique to this host\&. .sp The value (number or @@ -451,8 +451,8 @@ is supported as an alternative\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: callgrind option -.\" callgrind option: mysql-test-run.pl +.\" mariadb-test-run.pl: callgrind option +.\" callgrind option: mariadb-test-run.pl \fB\-\-callgrind\fR .sp Instructs @@ -469,8 +469,8 @@ to use .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: check-testcases option -.\" check-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: check-testcases option +.\" check-testcases option: mariadb-test-run.pl \fB\-\-check\-testcases\fR .sp Check test cases for side effects\&. This is done by checking system state before and after each test case; if there is any difference, a warning to that effect will be written, but the test case will not be marked as failed because of it\&. This check is enabled by default\&. @@ -484,8 +484,8 @@ Check test cases for side effects\&. This is done by checking system state befor .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-bindir option -.\" client-bindir option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-bindir option +.\" client-bindir option: mariadb-test-run.pl \fB\-\-client\-bindir=\fR\fB\fIpath\fR\fR .sp The path to the directory where client binaries are located\&. @@ -499,12 +499,12 @@ The path to the directory where client binaries are located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-dbx option -.\" client-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-dbx option +.\" client-dbx option: mariadb-test-run.pl \fB\-\-client\-dbx\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBdbx\fR debugger\&. @@ -518,12 +518,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-ddd option -.\" client-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-ddd option +.\" client-ddd option: mariadb-test-run.pl \fB\-\-client\-ddd\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBddd\fR debugger\&. @@ -537,12 +537,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-debugger option -.\" client-debugger option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-debugger option +.\" client-debugger option: mariadb-test-run.pl \fB\-\-client\-debugger=\fR\fB\fIdebugger\fR\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the named debugger\&. .RE .sp @@ -554,12 +554,12 @@ in the named debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-gdb option -.\" client-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-gdb option +.\" client-gdb option: mariadb-test-run.pl \fB\-\-client\-gdb\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBgdb\fR debugger\&. @@ -573,8 +573,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-libdir option -.\" client-libdir option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-libdir option +.\" client-libdir option: mariadb-test-run.pl \fB\-\-client\-libdir=\fR\fB\fIpath\fR\fR .sp The path to the directory where client libraries are located\&. @@ -588,17 +588,17 @@ The path to the directory where client libraries are located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: combination option -.\" combination option: mysql-test-run.pl +.\" mariadb-test-run.pl: combination option +.\" combination option: mariadb-test-run.pl \fB\-\-combination=\fR\fB\fIvalue\fR\fR .sp Extra options to pass to -\fBmysqld\fR\&. The value should consist of one or more comma\-separated -\fBmysqld\fR +\fBmariadbd\fR\&. The value should consist of one or more comma\-separated +\fBmariadbd\fR options\&. This option is similar to -\fB\-\-mysqld\fR +\fB\-\-mariadbd\fR but should be given two or more times\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR executes multiple test runs, using the options for each instance of \fB\-\-combination\fR in successive runs\&. If @@ -618,8 +618,8 @@ file in the suite directory\&. The file should contain a section of options for .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: comment option -.\" comment option: mysql-test-run.pl +.\" mariadb-test-run.pl: comment option +.\" comment option: mariadb-test-run.pl \fB\-\-comment=\fR\fB\fIstr\fR\fR .sp Write @@ -636,8 +636,8 @@ to the output within lines filled with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: compress option -.\" compress option: mysql-test-run.pl +.\" mariadb-test-run.pl: compress option +.\" compress option: mariadb-test-run.pl \fB\-\-compress\fR .sp Compress all information sent between the client and the server if both support compression\&. @@ -651,8 +651,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: cursor-protocol option -.\" cursor-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: cursor-protocol option +.\" cursor-protocol option: mariadb-test-run.pl \fB\-\-cursor\-protocol\fR .sp Use the cursor protocol between client and server @@ -668,12 +668,12 @@ Use the cursor protocol between client and server .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: dbx option -.\" dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: dbx option +.\" dbx option: mariadb-test-run.pl \fB\-\-dbx\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBdbx\fR debugger\&. @@ -687,12 +687,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ddd option -.\" ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: ddd option +.\" ddd option: mariadb-test-run.pl \fB\-\-ddd\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBddd\fR debugger\&. @@ -706,8 +706,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug option -.\" debug option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug option +.\" debug option: mariadb-test-run.pl \fB\-\-debug\fR .sp Dump trace output for all clients and servers\&. @@ -721,8 +721,8 @@ Dump trace output for all clients and servers\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-common option -.\" debug-common option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-common option +.\" debug-common option: mariadb-test-run.pl \fB\-\-debug\-common\fR .sp Same as \fB--debug\fR, but sets the 'd' debug flags to "query,info,error,enter,exit"\&. @@ -736,8 +736,8 @@ Same as \fB--debug\fR, but sets the 'd' debug flags to "query,info,error,enter,e .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-server option -.\" debug-server option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-server option +.\" debug-server option: mariadb-test-run.pl \fB\-\-debug\-server\fR .sp Use debug version of server, but without turning on tracing\&. @@ -751,12 +751,12 @@ Use debug version of server, but without turning on tracing\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debugger option -.\" debugger option: mysql-test-run.pl +.\" mariadb-test-run.pl: debugger option +.\" debugger option: mariadb-test-run.pl \fB\-\-debugger=\fR\fB\fIdebugger\fR\fR .sp Start -\fBmysqld\fR +\fBmariadbd\fR using the named debugger\&. .RE .sp @@ -768,20 +768,20 @@ using the named debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-sync-timeout option -.\" debug-sync-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-sync-timeout option +.\" debug-sync-timeout option: mariadb-test-run.pl \fB\-\-debug\-sync\-timeout=\fR\fB\fIN\fR\fR .sp Controls whether the Debug Sync facility for testing and debugging is enabled\&. The option value is a timeout in seconds\&. The default value is 300\&. A value of 0 disables Debug Sync\&. The value of this option also becomes the default timeout for individual synchronization points\&. .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR passes \fB\-\-loose\-debug\-sync\-timeout=\fR\fB\fIN\fR\fR to -\fBmysqld\fR\&. The +\fBmariadbd\fR\&. The \fB\-\-loose\fR prefix is used so that -\fBmysqld\fR +\fBmariadbd\fR does not fail if Debug Sync is not compiled in\&. .RE .sp @@ -793,8 +793,8 @@ does not fail if Debug Sync is not compiled in\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: defaults-file option -.\" defaults-file option: mysql-test-run.pl +.\" mariadb-test-run.pl: defaults-file option +.\" defaults-file option: mariadb-test-run.pl \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp Use the named file as fixed config file template for all tests\&. @@ -808,8 +808,8 @@ Use the named file as fixed config file template for all tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: defaults_extra_file option -.\" default_extra_file option: mysql-test-run.pl +.\" mariadb-test-run.pl: defaults_extra_file option +.\" default_extra_file option: mariadb-test-run.pl \fB\-\-defaults_extra_file=\fR\fB\fIfile_name\fR\fR .sp Add setting from the named file to all generated configs\&. @@ -823,8 +823,8 @@ Add setting from the named file to all generated configs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: do-test option -.\" do-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: do-test option +.\" do-test option: mariadb-test-run.pl \fB\-\-do\-test=\fR\fB\fIprefix\fR\fR|\fB\fIregex\fR\fR .sp Run all test cases having a name that begins with the given @@ -860,8 +860,8 @@ xmainytestz\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: dry-run option -.\" dry-run option: mysql-test-run.pl +.\" mariadb-test-run.pl: dry-run option +.\" dry-run option: mariadb-test-run.pl \fB\-\-dry\-run\fR .sp Don't run any tests, print the list of tests that were selected for execution\&. @@ -875,12 +875,12 @@ Don't run any tests, print the list of tests that were selected for execution\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: embedded-server option -.\" embedded-server option: mysql-test-run.pl +.\" mariadb-test-run.pl: embedded-server option +.\" embedded-server option: mariadb-test-run.pl \fB\-\-embedded\-server\fR .sp Use a version of -\fBmysqltest\fR +\fBmariadb-test\fR built with the embedded server\&. .RE .sp @@ -892,8 +892,8 @@ built with the embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: enable-disabled option -.\" enable-disabled option: mysql-test-run.pl +.\" mariadb-test-run.pl: enable-disabled option +.\" enable-disabled option: mariadb-test-run.pl \fB\-\-enable\-disabled\fR .sp Ignore any @@ -909,8 +909,8 @@ file, and also run tests marked as disabled\&. Success or failure of those tests .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: experimental option -.\" experimental option: mysql-test-run.pl +.\" mariadb-test-run.pl: experimental option +.\" experimental option: mariadb-test-run.pl \fB\-\-experimental=\fR\fB\fIfile_name\fR\fR .sp Specify a file that contains a list of test cases that should be displayed with the @@ -920,7 +920,7 @@ code rather than if they fail\&. .sp For an example of a file that might be specified via this option, see -mysql\-test/collections/default\&.experimental\&. +mariadb\-test/collections/default\&.experimental\&. .RE .sp .RS 4 @@ -931,13 +931,13 @@ mysql\-test/collections/default\&.experimental\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: extern option -.\" extern option: mysql-test-run.pl +.\" mariadb-test-run.pl: extern option +.\" extern option: mariadb-test-run.pl \fB\-\-extern\fR \fIoption\fR=\fIvalue\fR .sp Use an already running server\&. The option/value pair is what is needed by the -\fBmysql\fR +\fBmariadb\fR client to connect to the server\&. Each \fB\-\-extern\fR option can only take one option/value pair as an argument, so you need to repeat @@ -948,7 +948,7 @@ for each pair needed\&. Example: .RS 4 .\} .nf - \&./mysql\-test\-run\&.pl \-\-extern socket=var/tmp/mysqld\&.1\&.sock alias + \&./mariadb\-test\-run\&.pl \-\-extern socket=var/tmp/mariadbd\&.1\&.sock alias .fi .if n \{\ .RE @@ -967,8 +967,8 @@ file that requires the server to be restarted with specific options, the file wi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: fast option -.\" fast option: mysql-test-run.pl +.\" mariadb-test-run.pl: fast option +.\" fast option: mariadb-test-run.pl \fB\-\-fast\fR .sp Do not perform controlled shutdown when servers need to be restarted or at the end of the test run\&. This is equivalent to using @@ -983,8 +983,8 @@ Do not perform controlled shutdown when servers need to be restarted or at the e .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: force-restart option -.\" force-restart option: mysql-test-run.pl +.\" mariadb-test-run.pl: force-restart option +.\" force-restart option: mariadb-test-run.pl \fB\-\-force\-restart\fR .sp Always restart servers between tests\&. @@ -998,12 +998,12 @@ Always restart servers between tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: force option -.\" force option: mysql-test-run.pl +.\" mariadb-test-run.pl: force option +.\" force option: mariadb-test-run.pl \fB\-\-force\fR .sp Normally, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR exits if a test case fails\&. \fB\-\-force\fR causes execution to continue regardless of test case failure\&. @@ -1017,8 +1017,8 @@ causes execution to continue regardless of test case failure\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gcov option -.\" gcov option: mysql-test-run.pl +.\" mariadb-test-run.pl: gcov option +.\" gcov option: mariadb-test-run.pl \fB\-\-gcov\fR .sp Collect coverage information after the test\&. The result is a @@ -1034,8 +1034,8 @@ file per source and header file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gcov-src-dir option -.\" gcov-src-dir option: mysql-test-run.pl +.\" mariadb-test-run.pl: gcov-src-dir option +.\" gcov-src-dir option: mariadb-test-run.pl \fB\-\-gcov\-src\-dir\fR .sp Colllect coverage only within the given subdirectory\&. For example, if you're only developing the SQL layer, @@ -1050,12 +1050,12 @@ it makes sense to use \fB--gcov-src-dir=sql\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gdb option -.\" gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: gdb option +.\" gdb option: mariadb-test-run.pl \fB\-\-gdb\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBgdb\fR debugger\&. @@ -1069,8 +1069,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gprof option -.\" gprof option: mysql-test-run.pl +.\" mariadb-test-run.pl: gprof option +.\" gprof option: mariadb-test-run.pl \fB\-\-gprof\fR .sp Collect profiling information using the @@ -1086,8 +1086,8 @@ profiling tool\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-dbx option -.\" manual-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-dbx option +.\" manual-dbx option: mariadb-test-run.pl \fB\-\-manual\-dbx\fR .sp Use a server that has already been started by the user in the @@ -1103,8 +1103,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-ddd option -.\" manual-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-ddd option +.\" manual-ddd option: mariadb-test-run.pl \fB\-\-manual\-ddd\fR .sp Use a server that has already been started by the user in the @@ -1120,8 +1120,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-debug option -.\" manual-debug option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-debug option +.\" manual-debug option: mariadb-test-run.pl \fB\-\-manual\-debug\fR .sp Use a server that has already been started by the user in a debugger\&. @@ -1135,8 +1135,8 @@ Use a server that has already been started by the user in a debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-gdb option -.\" manual-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-gdb option +.\" manual-gdb option: mariadb-test-run.pl \fB\-\-manual\-gdb\fR .sp Use a server that has already been started by the user in the @@ -1152,8 +1152,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-lldb option -.\" manual-lldb option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-lldb option +.\" manual-lldb option: mariadb-test-run.pl \fB\-\-manual\-lldb\fR .sp Use a server that has already been started by the user in the @@ -1169,8 +1169,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mark-progress option -.\" mark-progress option: mysql-test-run.pl +.\" mariadb-test-run.pl: mark-progress option +.\" mark-progress option: mariadb-test-run.pl \fB\-\-mark\-progress\fR .sp Marks progress with timing (in milliseconds) and line number in @@ -1185,12 +1185,12 @@ var/log/\fItestname\fR\&.progress\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-connections option -.\" max-connections option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-connections option +.\" max-connections option: mariadb-test-run.pl \fB\-\-max\-connections=\fR\fB\fInum\fR\fR .sp The maximum number of simultaneous server connections that may be used per test\&. If not set, the maximum is 128\&. Minimum allowed limit is 8, maximum is 5120\&. Corresponds to the same option for -\fBmysqltest\fR\&. +\fBmariadb-test\fR\&. .RE .sp .RS 4 @@ -1201,8 +1201,8 @@ The maximum number of simultaneous server connections that may be used per test\ .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-save-core option -.\" max-save-core option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-save-core option +.\" max-save-core option: mariadb-test-run.pl \fB\-\-max\-save\-core=\fR\fB\fIN\fR\fR .sp Limit the number of core files saved, to avoid filling up disks in case of a frequently crashing server\&. Defaults to 5, set to 0 for no limit\&. May also be set with the environment variable @@ -1217,8 +1217,8 @@ MTR_MAX_SAVE_CORE .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-save-datadir option -.\" max-save-datadir option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-save-datadir option +.\" max-save-datadir option: mariadb-test-run.pl \fB\-\-max\-save\-datadir=\fR\fB\fIN\fR\fR .sp Limit the number of data directories saved after failed tests, to avoid filling up disks in case of frequent failures\&. Defaults to 20, set to 0 for no limit\&. May also be set with the environment variable @@ -1233,8 +1233,8 @@ MTR_MAX_SAVE_DATADIR .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-test-fail option -.\" max-test-fail option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-test-fail option +.\" max-test-fail option: mariadb-test-run.pl \fB\-\-max\-test\-fail=\fR\fB\fIN\fR\fR .sp Stop execution after the specified number of tests have failed, to avoid using up resources (and time) in case of massive failures\&. retries are not counted, nor are failures of tests marked experimental\&. Defaults to 10, set to 0 for no limit\&. May also be set with the environment variable @@ -1249,14 +1249,14 @@ MTR_MAX_TEST_FAIL .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mem option -.\" mem option: mysql-test-run.pl +.\" mariadb-test-run.pl: mem option +.\" mem option: mariadb-test-run.pl \fB\-\-mem\fR .sp This option is not supported on Windows\&. .sp Run the test suite in memory, using tmpfs or ramdisk\&. This can decrease test times significantly, in particular if you would otherwise be running over a remote file system\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR attempts to find a suitable location using a built\-in list of standard locations for tmpfs and puts the var directory there\&. This option also affects placement of temporary files, which are created in @@ -1271,7 +1271,7 @@ is given, it is added to the beginning of the list of locations to search, so it Once you have run tests with \fB\-\-mem\fR within a -mysql\-testdirectory, a soflink +mariadb\-testdirectory, a soflink var will have been set up to the temporary directory, and this will be re\-used the next time, until the soflink is deleted\&. Thus, you do not have to repeat the \fB\-\-mem\fR @@ -1286,13 +1286,13 @@ option next time\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mysqld option -.\" mysqld option: mysql-test-run.pl -\fB\-\-mysqld=\fR\fB\fIvalue\fR\fR +.\" mariadb-test-run.pl: mariadbd option +.\" mariadbd option: mariadb-test-run.pl +\fB\-\-mariadbd=\fR\fB\fIvalue\fR\fR .sp Extra options to pass to -\fBmysqld\fR\&. The value should consist of one or more comma\-separated -\fBmysqld\fR +\fBmariadbd\fR\&. The value should consist of one or more comma\-separated +\fBmariadbd\fR options\&. .RE .sp @@ -1304,11 +1304,11 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mysqld-env option -.\" mysqld-env option: mysql-test-run.pl -\fB\-\-mysqld\-env=\fR\fB\fIVAR=VAL\fR\fR +.\" mariadb-test-run.pl: mariadbd-env option +.\" mariadbd-env option: mariadb-test-run.pl +\fB\-\-mariadbd\-env=\fR\fB\fIVAR=VAL\fR\fR .sp -Specify additional environment settings for "mysqld"\&. Use additional \fB--mysqld-env\fR options to set more than one variable\&. +Specify additional environment settings for "mariadbd"\&. Use additional \fB--mariadbd-env\fR options to set more than one variable\&. .RE .sp .RS 4 @@ -1319,8 +1319,8 @@ Specify additional environment settings for "mysqld"\&. Use additional \fB--mysq .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: nocheck-testcases option -.\" nocheck-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: nocheck-testcases option +.\" nocheck-testcases option: mariadb-test-run.pl \fB\-\-nocheck\-testcases\fR .sp Disable the check for test case side effects; see @@ -1336,8 +1336,8 @@ for a description\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: noreorder option -.\" noreorder option: mysql-test-run.pl +.\" mariadb-test-run.pl: noreorder option +.\" noreorder option: mariadb-test-run.pl \fB\-\-noreorder\fR .sp Do not reorder tests to reduce number of restarts, but run them in exactly the order given\&. If a whole suite is to be run, the tests are run in alphabetical order, though similar combinations will be grouped together\&. If more than one suite is listed, the tests are run one suite at a time, in the order listed\&. @@ -1351,12 +1351,12 @@ Do not reorder tests to reduce number of restarts, but run them in exactly the o .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: notimer option -.\" notimer option: mysql-test-run.pl +.\" mariadb-test-run.pl: notimer option +.\" notimer option: mariadb-test-run.pl \fB\-\-notimer\fR .sp Cause -\fBmysqltest\fR +\fBmariadb-test\fR not to generate a timing file\&. The effect of this is that the report from each test case does not include the timing in milliseconds as it normally does\&. .RE .sp @@ -1368,8 +1368,8 @@ not to generate a timing file\&. The effect of this is that the report from each .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: nowarnings option -.\" nowarnings option: mysql-test-run.pl +.\" mariadb-test-run.pl: nowarnings option +.\" nowarnings option: mariadb-test-run.pl \fB\-\-nowarnings\fR .sp Do not look for and report errors and warning in the server logs\&. @@ -1383,8 +1383,8 @@ Do not look for and report errors and warning in the server logs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: parallel option -.\" parallel option: mysql-test-run.pl +.\" mariadb-test-run.pl: parallel option +.\" parallel option: mariadb-test-run.pl \fB\-\-parallel={\fR\fB\fIN\fR\fR\fB|auto}\fR .sp Run tests using @@ -1403,8 +1403,8 @@ for auto\-setting of .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: port-base option -.\" port-base option: mysql-test-run.pl +.\" mariadb-test-run.pl: port-base option +.\" port-base option: mariadb-test-run.pl \fB\-\-[mtr\-]port\-base=\fR\fB\fIP\fR\fR .sp Specify base of port numbers to be used; a block of 10 will be allocated\&. @@ -1413,7 +1413,7 @@ should be divisible by 10; if it is not, it will be rounded down\&. If running w .sp If the port number is given as auto, which is also the default, -\fBmysql\-test\-run\&.pl\fR will allocate a number unique to this host\&. The value may also be given with the environment variable +\fBmariadb\-test\-run\&.pl\fR will allocate a number unique to this host\&. The value may also be given with the environment variable MTR_PORT_BASE\&. .sp If both \fB\-\-build\-thread\fR and \fB\-\-port\-base\fR are used, @@ -1429,8 +1429,8 @@ takes precedence\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: print-testcases option -.\" print-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: print-testcases option +.\" print-testcases option: mariadb-test-run.pl \fB\-\-print\-testcases\fR .sp Do not run any tests, but print details about all tests, in the order they would have been run\&. @@ -1444,8 +1444,8 @@ Do not run any tests, but print details about all tests, in the order they would .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ps-protocol option -.\" ps-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: ps-protocol option +.\" ps-protocol option: mariadb-test-run.pl \fB\-\-ps\-protocol\fR .sp Use the binary protocol between client and server\&. @@ -1459,14 +1459,14 @@ Use the binary protocol between client and server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: record option -.\" record option: mysql-test-run.pl +.\" mariadb-test-run.pl: record option +.\" record option: mariadb-test-run.pl \fB\-\-record\fR .sp Pass the \fB\-\-record\fR option to -\fBmysqltest\fR\&. This option requires a specific test case to be named on the command line\&. +\fBmariadb-test\fR\&. This option requires a specific test case to be named on the command line\&. .RE .sp .RS 4 @@ -1477,8 +1477,8 @@ option to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: reorder option -.\" reorder option: mysql-test-run.pl +.\" mariadb-test-run.pl: reorder option +.\" reorder option: mariadb-test-run.pl \fB\-\-reorder\fR .sp Reorder tests to minimize the number of server restarts needed\&. This is the default behavior\&. There is no guarantee that a particular set of tests will always end up in the same order\&. @@ -1492,8 +1492,8 @@ Reorder tests to minimize the number of server restarts needed\&. This is the de .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: repeat option -.\" repeat option: mysql-test-run.pl +.\" mariadb-test-run.pl: repeat option +.\" repeat option: mariadb-test-run.pl \fB\-\-repeat=\fR\fB\fIN\fR\fR .sp Run each test @@ -1509,8 +1509,8 @@ number of times\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: report-features option -.\" report-features option: mysql-test-run.pl +.\" mariadb-test-run.pl: report-features option +.\" report-features option: mariadb-test-run.pl \fB\-\-report\-features\fR .sp First run a "test" that reports MariaDB features, displaying the output of SHOW ENGINES and SHOW VARIABLES\&. This can be @@ -1525,8 +1525,8 @@ used to verify that binaries are built with all required features\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: report-times option -.\" report-times option: mysql-test-run.pl +.\" mariadb-test-run.pl: report-times option +.\" report-times option: mariadb-test-run.pl \fB\-\-report\-times\fR .sp Report how much time has been spent on different phases of test execution\&. @@ -1540,8 +1540,8 @@ Report how much time has been spent on different phases of test execution\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: retry option -.\" retry option: mysql-test-run.pl +.\" mariadb-test-run.pl: retry option +.\" retry option: mariadb-test-run.pl \fB\-\-retry=\fR\fB\fIN\fR\fR .sp If a test fails, it is retried up to a maximum of @@ -1568,8 +1568,8 @@ may fail in total, as each repetition is considered a new test case, which may i .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: retry-failure option -.\" retry-failure option: mysql-test-run.pl +.\" mariadb-test-run.pl: retry-failure option +.\" retry-failure option: mariadb-test-run.pl \fB\-\-retry\-failure=\fR\fB\fIN\fR\fR .sp When using the \fB-\-retry\fR option to retry failed tests, @@ -1584,8 +1584,8 @@ stop when N failures have occurred (default 2)\&. Setting it to 0 or 1 effective .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: shutdown-timeout option -.\" shutdown-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: shutdown-timeout option +.\" shutdown-timeout option: mariadb-test-run.pl \fB\-\-shutdown\-timeout=\fR\fB\fISECONDS\fR\fR .sp Max number of seconds to wait for servers to do controlled shutdown before killing them\&. Default is 10\&. @@ -1599,8 +1599,8 @@ Max number of seconds to wait for servers to do controlled shutdown before killi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-combinations option -.\" skip-combinations option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-combinations option +.\" skip-combinations option: mariadb-test-run.pl \fB\-\-skip\-combinations\fR .sp Do not apply combinations; ignore combinations file or option\&. @@ -1614,8 +1614,8 @@ Do not apply combinations; ignore combinations file or option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-rpl option -.\" skip-rpl option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-rpl option +.\" skip-rpl option: mariadb-test-run.pl \fB\-\-skip\-rpl\fR .sp Skip replication test cases\&. @@ -1629,12 +1629,12 @@ Skip replication test cases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-ssl option -.\" skip-ssl option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-ssl option +.\" skip-ssl option: mariadb-test-run.pl \fB\-\-skip\-ssl\fR .sp Do not start -\fBmysqld\fR +\fBmariadbd\fR with support for SSL connections\&. .RE .sp @@ -1646,8 +1646,8 @@ with support for SSL connections\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-test option -.\" skip-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-test option +.\" skip-test option: mariadb-test-run.pl \fB\-\-skip\-test=\fR\fB\fIregex\fR\fR|\fR\fB\fIregex\fR\fR .sp Specify a regular expression to be applied to test case names\&. Cases with names that match the expression are skipped\&. tests to skip\&. @@ -1667,8 +1667,8 @@ option for details\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-test-list option -.\" skip-test-list option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-test-list option +.\" skip-test-list option: mariadb-test-run.pl \fB\-\-skip\-test\-list=\fB\fIFILE\fR .sp Skip the tests listed in FILE\&. Each line in the file is an entry and should be formatted as: : @@ -1686,7 +1686,7 @@ Skip the tests listed in FILE\&. Each line in the file is an entry and should be .sp \fB\-\-skip\-*\fR options not otherwise recognized by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR are passed to the master server\&. .RE .sp @@ -1698,14 +1698,14 @@ are passed to the master server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: sleep option -.\" sleep option: mysql-test-run.pl +.\" mariadb-test-run.pl: sleep option +.\" sleep option: mariadb-test-run.pl \fB\-\-sleep=\fR\fB\fIN\fR\fR .sp Pass \fB\-\-sleep=\fR\fB\fIN\fR\fR to -\fBmysqltest\fR\&. +\fBmariadb-test\fR\&. .RE .sp .RS 4 @@ -1716,8 +1716,8 @@ to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: sp-protocol option -.\" sp-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: sp-protocol option +.\" sp-protocol option: mariadb-test-run.pl \fB\-\-sp\-protocol\fR .sp Create a stored procedure to execute all queries\&. @@ -1731,18 +1731,18 @@ Create a stored procedure to execute all queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ssl option -.\" ssl option: mysql-test-run.pl +.\" mariadb-test-run.pl: ssl option +.\" ssl option: mariadb-test-run.pl \fB\-\-ssl\fR .sp If -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR is started with the \fB\-\-ssl\fR option, it sets up a secure connection for all test cases\&. In this case, if -\fBmysqld\fR +\fBmariadbd\fR does not support SSL, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR exits with an error message: Couldn't find support for SSL .RE @@ -1755,8 +1755,8 @@ Couldn't find support for SSL .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: staging-run option -.\" staging-run option: mysql-test-run.pl +.\" mariadb-test-run.pl: staging-run option +.\" staging-run option: mariadb-test-run.pl \fB\-\-staging\-run\fR .sp Run a limited number of tests (no slow tests)\&. Used for running staging trees with valgrind\&. @@ -1770,21 +1770,21 @@ Run a limited number of tests (no slow tests)\&. Used for running staging trees .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-and-exit option -.\" start-and-exit option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-and-exit option +.\" start-and-exit option: mariadb-test-run.pl \fB\-\-start\fR .sp Initialize and start servers with the startup settings for the specified test case\&. You can use this option to start a server to which you can connect later\&. For example, after building a source distribution you can start a server and connect to it with the -\fBmysql\fR +\fBmariadb\fR client like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBcd mysql\-test\fR -shell> \fB\&./mysql\-test\-run\&.pl \-\-start alias &\fR -shell> \fB\&.\&./mysql \-S \&./var/tmp/master\&.sock \-h localhost \-u root\fR +shell> \fBcd mariadb\-test\fR +shell> \fB\&./mariadb\-test\-run\&.pl \-\-start alias &\fR +shell> \fB\&.\&./mariadb \-S \&./var/tmp/master\&.sock \-h localhost \-u root\fR .fi .if n \{\ .RE @@ -1794,7 +1794,7 @@ If no tests are named on the command line, the server(s) will be started with se \fB\-\-start\fR option\&. .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will stop once the server has been started, but will terminate if the server dies\&. If killed, it will also shut down the server\&. .RE .sp @@ -1806,12 +1806,12 @@ will stop once the server has been started, but will terminate if the server die .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-and-exit option -.\" start-and-exit option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-and-exit option +.\" start-and-exit option: mariadb-test-run.pl \fB\-\-start\-and\-exit\fR .sp Same -\fB\-\-start\fR, but mysql-test-run terminates and leaves just the server running\&. +\fB\-\-start\fR, but mariadb-test-run terminates and leaves just the server running\&. .RE .sp .RS 4 @@ -1822,8 +1822,8 @@ Same .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-dirty option -.\" start-dirty option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-dirty option +.\" start-dirty option: mariadb-test-run.pl \fB\-\-start\-dirty\fR .sp This is similar to @@ -1838,11 +1838,11 @@ This is similar to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-from option -.\" start-from option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-from option +.\" start-from option: mariadb-test-run.pl \fB\-\-start\-from=\fR\fB\fItest_name\fR\fR .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR sorts the list of names of the test cases to be run, and then begins with \fItest_name\fR\&. .RE @@ -1855,11 +1855,11 @@ sorts the list of names of the test cases to be run, and then begins with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace option -.\" strace option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace option +.\" strace option: mariadb-test-run.pl \fB\-\-strace\fR .sp -Run the "mysqld" executables using strace. Default options are \fB-f -o var/log/'mysqld-name'.strace\fR\&. +Run the "mariadbd" executables using strace. Default options are \fB-f -o var/log/'mariadbd-name'.strace\fR\&. .RE .sp .RS 4 @@ -1870,17 +1870,17 @@ Run the "mysqld" executables using strace. Default options are \fB-f -o var/log/ .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace-client option -.\" strace-client option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace-client option +.\" strace-client option: mariadb-test-run.pl \fB\-\-strace\-client\fR .sp Create \fBstrace\fR output for -\fBmysqltest\fR, optionally specifying name and path +\fBmariadb-test\fR, optionally specifying name and path to the trace program to use\&. .sp -Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace +Example: \&./mariadb\-test\-run\&.pl \-\-strace\-client=ktrace .RE .sp .RS 4 @@ -1891,8 +1891,8 @@ Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace-option option -.\" strace-option option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace-option option +.\" strace-option option: mariadb-test-run.pl \fB\-\-strace\-option\fR=\fR\fB\fIARGS\fR\fR .sp Option to give @@ -1908,11 +1908,11 @@ replaces default option(s)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stress option -.\" stress option: mysql-test-run.pl +.\" mariadb-test-run.pl: stress option +.\" stress option: mariadb-test-run.pl \fB\-\-stress=\fR\fB\fIARGS\fR\fR .sp -Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are separated by comma\&. +Run stress test, providing options to mariadb\-stress\-test\&.pl\&. Options are separated by comma\&. .RE .sp .RS 4 @@ -1923,8 +1923,8 @@ Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are se .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: suite option -.\" suite option: mysql-test-run.pl +.\" mariadb-test-run.pl: suite option +.\" suite option: mariadb-test-run.pl \fB\-\-suite[s]=\fR\fB\fIsuite_name...\fR\fR .sp Comma separated list of suite names to run. The default is: @@ -1942,11 +1942,11 @@ plugins-,roles-,rpl-,sys_vars-,unit-,vcol-"\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stop-file option -.\" stop-file option: mysql-test-run.pl +.\" mariadb-test-run.pl: stop-file option +.\" stop-file option: mariadb-test-run.pl \fB\-\-stop\-file=\fR\fB\fIfile\fR\fR .sp -If this file is detected, mysqltest will not start new tests until the file is removed (also MTR_STOP_FILE environment variable)\&. +If this file is detected, mariadb-test will not start new tests until the file is removed (also MTR_STOP_FILE environment variable)\&. .RE .sp .RS 4 @@ -1957,11 +1957,11 @@ If this file is detected, mysqltest will not start new tests until the file is r .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stop-keep-alive option -.\" stop-keep-alive option: mysql-test-run.pl +.\" mariadb-test-run.pl: stop-keep-alive option +.\" stop-keep-alive option: mariadb-test-run.pl \fB\-\-stop\-keep\-alive=\fR\fB\fIsec\fR\fR .sp -Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mysqltest is waiting to remove the file (for buildbot) (also MTR_STOP_KEEP_ALIVE environment variable)\&. +Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mariadb-test is waiting to remove the file (for buildbot) (also MTR_STOP_KEEP_ALIVE environment variable)\&. .RE .sp .RS 4 @@ -1972,8 +1972,8 @@ Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mysqlt .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: suite-timeout option -.\" suite-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: suite-timeout option +.\" suite-timeout option: mariadb-test-run.pl \fB\-\-suite\-timeout=\fR\fB\fIminutes\fR\fR .sp Specify the maximum test suite runtime in minutes\&. The default is 360\&. @@ -1987,8 +1987,8 @@ Specify the maximum test suite runtime in minutes\&. The default is 360\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: testcase-timeout option -.\" testcase-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: testcase-timeout option +.\" testcase-timeout option: mariadb-test-run.pl \fB\-\-testcase\-timeout\fR .sp Specify the maximum test case runtime in minutes\&. The default is 15\&. @@ -2002,8 +2002,8 @@ Specify the maximum test case runtime in minutes\&. The default is 15\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timediff option -.\" timediff option: mysql-test-run.pl +.\" mariadb-test-run.pl: timediff option +.\" timediff option: mariadb-test-run.pl \fB\-\-timediff\fR .sp Used with \fB\-\-timestamp\fR, also print time passed since the previous test started\&. @@ -2017,12 +2017,12 @@ Used with \fB\-\-timestamp\fR, also print time passed since the previous test st .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timer option -.\" timer option: mysql-test-run.pl +.\" mariadb-test-run.pl: timer option +.\" timer option: mariadb-test-run.pl \fB\-\-timer\fR .sp Cause -\fBmysqltest\fR +\fBmariadb-test\fR to generate a timing file\&. The default file is named \&./var/log/timer\&. .RE @@ -2035,8 +2035,8 @@ to generate a timing file\&. The default file is named .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timestamp option -.\" timestamp option: mysql-test-run.pl +.\" mariadb-test-run.pl: timestamp option +.\" timestamp option: mariadb-test-run.pl \fB\-\-timestamp\fR .sp Prints a timestamp before the test case name in each test report line, showing when the test ended\&. @@ -2050,8 +2050,8 @@ Prints a timestamp before the test case name in each test report line, showing w .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: tmpdir option -.\" tmpdir option: mysql-test-run.pl +.\" mariadb-test-run.pl: tmpdir option +.\" tmpdir option: mariadb-test-run.pl \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR .sp The directory where temporary file are stored\&. The default location is @@ -2068,8 +2068,8 @@ will be set to the path for this directory, whether it has the default value or .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: user option -.\" user option: mysql-test-run.pl +.\" mariadb-test-run.pl: user option +.\" user option: mariadb-test-run.pl \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server (default root)\&. @@ -2083,11 +2083,11 @@ The MariaDB user name to use when connecting to the server (default root)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: user-args option -.\" user-args option: mysql-test-run.pl +.\" mariadb-test-run.pl: user-args option +.\" user-args option: mariadb-test-run.pl \fB\-\-user\-args\fR .sp -In combination with \fBstart*\fR and no test name, drops arguments to mysqld except those specified with \fB\-\-mysqld\fR (if any)\&. +In combination with \fBstart*\fR and no test name, drops arguments to mariadbd except those specified with \fB\-\-mariadbd\fR (if any)\&. .RE .sp .RS 4 @@ -2098,14 +2098,14 @@ In combination with \fBstart*\fR and no test name, drops arguments to mysqld exc .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind option -.\" valgrind option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind option +.\" valgrind option: mariadb-test-run.pl \fB\-\-valgrind[\-all]\fR .sp Run -\fBmysqltest\fR +\fBmariadb-test\fR and -\fBmysqld\fR +\fBmariadbd\fR with \fBvalgrind\fR\&. This and the following \fB\-\-valgrind\fR @@ -2122,12 +2122,12 @@ support\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-mysqld option -.\" valgrind-mysqld option: mysql-test-run.pl -\fB\-\-valgrind\-mysqld\fR +.\" mariadb-test-run.pl: valgrind-mariadbd option +.\" valgrind-mariadbd option: mariadb-test-run.pl +\fB\-\-valgrind\-mariadbd\fR .sp Run the -\fBmysqld\fR +\fBmariadbd\fR server with \fBvalgrind\fR\&. .RE @@ -2140,14 +2140,14 @@ server with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-mysqltest option -.\" valgrind-mysqltest option: mysql-test-run.pl -\fB\-\-valgrind\-mysqltest\fR +.\" mariadb-test-run.pl: valgrind-mariadb-test option +.\" valgrind-mariadb-test option: mariadb-test-run.pl +\fB\-\-valgrind\-mariadb-test\fR .sp Run the -\fBmysqltest\fR +\fBmariadb-test\fR and -\fBmysql_client_test\fR +\fBmariadb-client-test\fR executables with \fBvalgrind\fR\&. .RE @@ -2160,8 +2160,8 @@ executables with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-options option -.\" valgrind-options option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind-options option +.\" valgrind-options option: mariadb-test-run.pl \fB\-\-valgrind\-option=\fR\fB\fIstr\fR\fR .sp Option to give \fBvalgrind\fR. Replaces default option(s)\&. Can be specified more then once&. @@ -2175,8 +2175,8 @@ Option to give \fBvalgrind\fR. Replaces default option(s)\&. Can be specified mo .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-path option -.\" valgrind-path option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind-path option +.\" valgrind-path option: mariadb-test-run.pl \fB\-\-valgrind\-path=\fR\fB\fIpath\fR\fR .sp Path to the @@ -2192,8 +2192,8 @@ executable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: vardir option -.\" vardir option: mysql-test-run.pl +.\" mariadb-test-run.pl: vardir option +.\" vardir option: mariadb-test-run.pl \fB\-\-vardir=\fR\fB\fIpath\fR\fR .sp Specify the path where files generated during the test run are stored\&. The default location is @@ -2210,8 +2210,8 @@ will be set to the path for this directory, whether it has the default value or .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: verbose option -.\" verbose option: mysql-test-run.pl +.\" mariadb-test-run.pl: verbose option +.\" verbose option: mariadb-test-run.pl \fB\-\-verbose\fR .sp Give more verbose output regarding test execution\&. Use the option twice to get even more output\&. Note that the output generated within each test case is not affected\&. @@ -2225,8 +2225,8 @@ Give more verbose output regarding test execution\&. Use the option twice to get .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: verbose-restart option -.\" verbose-restart option: mysql-test-run.pl +.\" mariadb-test-run.pl: verbose-restart option +.\" verbose-restart option: mariadb-test-run.pl \fB\-\-verbose\-restart\fR .sp Write when and why servers are restarted between test cases\&. @@ -2240,8 +2240,8 @@ Write when and why servers are restarted between test cases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: view-protocol option -.\" view-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: view-protocol option +.\" view-protocol option: mariadb-test-run.pl \fB\-\-view\-protocol\fR .sp Create a view to execute all non updating queries\&. @@ -2255,8 +2255,8 @@ Create a view to execute all non updating queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: vs-config option -.\" vs-config option: mysql-test-run.pl +.\" mariadb-test-run.pl: vs-config option +.\" vs-config option: mariadb-test-run.pl \fB\-\-vs\-config=\fR\fB\fIconfig_val\fR\fR .sp Visual Studio configuration used to create executables @@ -2272,8 +2272,8 @@ This option is for Windows only\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: wait-all option -.\" wait-all option: mysql-test-run.pl +.\" mariadb-test-run.pl: wait-all option +.\" wait-all option: mariadb-test-run.pl \fB\-\-wait\-all\fR .sp If @@ -2291,8 +2291,8 @@ is used, wait for all servers to exit before termination\&. Otherwise, it will t .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: warnings option -.\" warnings option: mysql-test-run.pl +.\" mariadb-test-run.pl: warnings option +.\" warnings option: mariadb-test-run.pl \fB\-\-warnings\fR .sp Search the server log for errors or warning after each test and report any suspicious ones; if any are found, the test will be marked as failed\&. This is the default behavior, it may be turned off with @@ -2304,7 +2304,7 @@ Search the server log for errors or warning after each test and report any suspi .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql.server.1 b/man/mysql.server.1 index b3eff1dd984..5a367298724 100644 --- a/man/mysql.server.1 +++ b/man/mysql.server.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\&.SERVER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYSQL\&.SERVER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -35,7 +35,7 @@ directory with the name mysql\&. You need not install it manually\&. .PP Some vendors provide RPM packages that install a startup script under a different name such as -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .PP If you install MariaDB from a source distribution or using a binary distribution format that does not install \fBmysql\&.server\fR @@ -45,7 +45,7 @@ automatically, you can install it manually\&. reads options from the [mysql\&.server] and -[mysqld] +[mariadbd] sections of option files\&. For backward compatibility, it also reads [mysql_server] sections, although you should rename such sections to @@ -124,12 +124,12 @@ exits with an error\&. The default value is 900\&. A value of 0 means not to wai .sp -1 .IP \(bu 2.3 .\} -.\" mysql.server: use-mysqld_safe option -.\" use-mysqld_safe option: mysql.server -\fB\-\-use\-mysqld_safe\fR +.\" mysql.server: use-mariadbd_safe option +.\" use-mariadbd_safe option: mysql.server +\fB\-\-use\-mariadbd_safe\fR .sp Use -\fBmysqld_safe\fR +\fBmariadbd_safe\fR to start the server\&. This is the default\&. .RE .sp @@ -161,12 +161,12 @@ Use Instance Manager to start the server\&. \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The login user name to use for running -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .RE .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mytop.1 b/man/mytop.1 index 6585439fce9..d1ffa9d085d 100644 --- a/man/mytop.1 +++ b/man/mytop.1 @@ -1,4 +1,4 @@ -.TH MYTOP "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH MYTOP "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .SH NAME mytop \- display MariaDB server performance info like 'top' .SH "SEE ALSO" diff --git a/man/perror.1 b/man/perror.1 index 94a4bdb3be5..581387c1839 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBPERROR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBPERROR\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -143,7 +143,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/replace.1 b/man/replace.1 index f5327815bb1..adc79e9f451 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBREPLACE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBREPLACE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -153,7 +153,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index df97e405b86..e3e473bec0e 100644 --- a/man/resolve_stack_dump.1 +++ b/man/resolve_stack_dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -37,9 +37,9 @@ shell> \fBresolve_stack_dump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIsymbols_file\f .\} .PP The symbols file should include the output from the -\fBnm \-\-numeric\-sort mysqld\fR +\fBnm \-\-numeric\-sort mariadbd\fR command\&. The numeric dump file should contain a numeric stack track from -\fBmysqld\fR\&. If no numeric dump file is named on the command line, the stack trace is read from the standard input\&. +\fBmariadbd\fR\&. If no numeric dump file is named on the command line, the stack trace is read from the standard input\&. .PP \fBresolve_stack_dump\fR supports the following options\&. @@ -110,7 +110,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolveip.1 b/man/resolveip.1 index 8abc823b24b..c21a8d034ba 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVEIP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBRESOLVEIP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -92,7 +92,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/wsrep_sst_backup.1 b/man/wsrep_sst_backup.1 index d7b145575cc..fe69d6938fd 100644 --- a/man/wsrep_sst_backup.1 +++ b/man/wsrep_sst_backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_BACKUP\FR" "1" "22 May 2022" "MariaDB 10\&.3" "MariaDB Database System" +.TH "\FBWSREP_SST_BACKUP\FR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index 9fd5122c4b4..cf9e9a03dcd 100644 --- a/man/wsrep_sst_common.1 +++ b/man/wsrep_sst_common.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_COMMON\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_COMMON\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1 index 7259b028bbc..1bc94893677 100644 --- a/man/wsrep_sst_mariabackup.1 +++ b/man/wsrep_sst_mariabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 56581ae889e..6646df59e93 100644 --- a/man/wsrep_sst_mysqldump.1 +++ b/man/wsrep_sst_mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index 155cb8ce637..fab949e1ee4 100644 --- a/man/wsrep_sst_rsync.1 +++ b/man/wsrep_sst_rsync.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1 index 3eb67b3d718..7205dbc2e0c 100644 --- a/man/wsrep_sst_rsync_wan.1 +++ b/man/wsrep_sst_rsync_wan.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- From cbe13e9ec087489aa9268d6c879a87af7fa0cc77 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 4 Sep 2024 11:13:36 +0200 Subject: [PATCH 026/185] Windows installer - ignore hashicorp-key-management, even if it was built. Fixes MSI installer. Do not install hashicorp-key-management, as also we would need to install dependencies, in this case libcurl. For that, MDEV-33474 needs to be fixed first. --- win/packaging/CPackWixConfig.cmake | 2 +- win/packaging/ComponentsIgnore.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 53449b51d92..f6ef25d5b46 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -53,7 +53,7 @@ add_component(Backup DESCRIPTION "Installs backup utilities(mariabackup and mbstream)") #Miscellaneous hidden components, part of server / or client programs -foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine plugin-hashicorp-key-management) +foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine) add_component(${comp} GROUP MySQLServer HIDDEN) endforeach() diff --git a/win/packaging/ComponentsIgnore.cmake b/win/packaging/ComponentsIgnore.cmake index 729c7f74cb8..5f037e365af 100644 --- a/win/packaging/ComponentsIgnore.cmake +++ b/win/packaging/ComponentsIgnore.cmake @@ -1,2 +1,2 @@ # Components ignored in both ZIP and WIX generators -set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded) +set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded hashicorp-key-management plugin-hashicorp-key-management) From fe5829a1214bcb2e4323d3fb826bf607e1059ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 4 Sep 2024 14:24:30 +0300 Subject: [PATCH 027/185] MDEV-34446 SIGSEGV on SET GLOBAL innodb_log_file_size with memory-mapped log file log_t::resize_write(): Advance log_sys.resize_lsn and reset the resize_log offset to START_OFFSET whenever the memory-mapped buffer would wrap around. Previously, in case the initial target offset would be beyond the requested innodb_log_file_size, we only adjusted the offset but not the LSN. An incorrect LSN would cause log_sys.buf_free to be out of bounds when the log resizing completes. The log_sys.lsn_lock will cover the entire duration of replicating memory-mapped log for resizing. We just need a mutex that is compatible with the caller holding log_sys.latch. While the choice of mtr_t::finisher (for normal log writes) depends on mtr_t::spin_wait_delay, replicating the log during resizing is a rare operation where we can afford possible additional context switching overhead. --- storage/innobase/mtr/mtr0mtr.cc | 112 ++++++++++++++------------------ 1 file changed, 49 insertions(+), 63 deletions(-) diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index fe9a882a36c..d531838b5fd 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1217,19 +1217,43 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, if (!resize_flush_buf) { ut_ad(is_pmem()); + lsn_lock.wr_lock(); const size_t resize_capacity{resize_target - START_OFFSET}; - const lsn_t resizing{resize_in_progress()}; - if (UNIV_UNLIKELY(lsn < resizing)) { - size_t l= resizing - lsn; - if (l >= len) - return; - end+= l - len; - len-= l; - lsn+= l; + const lsn_t resizing{resize_in_progress()}; + /* For memory-mapped log, log_t::resize_start() would never + set log_sys.resize_lsn to less than log_sys.lsn. It cannot + execute concurrently with this thread, because we are holding + log_sys.latch and it would hold an exclusive log_sys.latch. */ + if (UNIV_UNLIKELY(lsn < resizing)) + { + /* This function may execute in multiple concurrent threads + that hold a shared log_sys.latch. Before we got lsn_lock, + another thread could have executed resize_lsn.store(lsn) below + with a larger lsn than ours. + + append_prepare() guarantees that the concurrent writes + cannot overlap, that is, our entire log must be discarded. + Besides, incomplete mini-transactions cannot be parsed anyway. */ + ut_ad(resizing >= lsn + len); + goto pmem_done; + } + + s= START_OFFSET; + + if (UNIV_UNLIKELY(lsn - resizing + len >= resize_capacity)) + { + resize_lsn.store(lsn, std::memory_order_relaxed); + lsn= 0; + } + else + { + lsn-= resizing; + s+= lsn; + } } - lsn-= resizing; - s= START_OFFSET + lsn % resize_capacity; + + ut_ad(s + len <= resize_target); if (UNIV_UNLIKELY(end < &buf[START_OFFSET])) { @@ -1239,59 +1263,22 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, ut_ad(end + capacity() + len >= &buf[file_size]); size_t l= size_t(buf - (end - START_OFFSET)); - if (UNIV_LIKELY(s + len <= resize_target)) - { - /* The destination buffer (log_sys.resize_buf) did not wrap around */ - memcpy(resize_buf + s, end + capacity(), l); - memcpy(resize_buf + s + l, &buf[START_OFFSET], len - l); - goto pmem_nowrap; - } - else - { - /* Both log_sys.buf and log_sys.resize_buf wrapped around */ - const size_t rl= resize_target - s; - if (l <= rl) - { - /* log_sys.buf wraps around first */ - memcpy(resize_buf + s, end + capacity(), l); - memcpy(resize_buf + s + l, &buf[START_OFFSET], rl - l); - memcpy(resize_buf + START_OFFSET, &buf[START_OFFSET + rl - l], - len - l); - } - else - { - /* log_sys.resize_buf wraps around first */ - memcpy(resize_buf + s, end + capacity(), rl); - memcpy(resize_buf + START_OFFSET, end + capacity() + rl, l - rl); - memcpy(resize_buf + START_OFFSET + (l - rl), - &buf[START_OFFSET], len - l); - } - goto pmem_wrap; - } + memcpy(resize_buf + s, end + capacity(), l); + memcpy(resize_buf + s + l, &buf[START_OFFSET], len - l); } else { ut_ad(end + len <= &buf[file_size]); - - if (UNIV_LIKELY(s + len <= resize_target)) - { - memcpy(resize_buf + s, end, len); - pmem_nowrap: - s+= len - seq; - } - else - { - /* The log_sys.resize_buf wrapped around */ - memcpy(resize_buf + s, end, resize_target - s); - memcpy(resize_buf + START_OFFSET, end + (resize_target - s), - len - (resize_target - s)); - pmem_wrap: - s+= len - seq; - if (s >= resize_target) - s-= resize_capacity; - resize_lsn.fetch_add(resize_capacity); /* Move the target ahead. */ - } + memcpy(resize_buf + s, end, len); } + s+= len - seq; + + /* Always set the sequence bit. If the resized log were to wrap around, + we will advance resize_lsn. */ + ut_ad(resize_buf[s] <= 1); + resize_buf[s]= 1; + pmem_done: + lsn_lock.wr_unlock(); } else #endif @@ -1301,12 +1288,11 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, ut_ad(s + len <= buf_size); memcpy(resize_buf + s, end, len); s+= len - seq; + /* Always set the sequence bit. If the resized log were to wrap around, + we will advance resize_lsn. */ + ut_ad(resize_buf[s] <= 1); + resize_buf[s]= 1; } - - /* Always set the sequence bit. If the resized log were to wrap around, - we will advance resize_lsn. */ - ut_ad(resize_buf[s] <= 1); - resize_buf[s]= 1; } } From c991efd9c35eb3f2a90b2562071860a10a4cbaa2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 Aug 2024 13:34:53 +1000 Subject: [PATCH 028/185] MDEV-34825 FreeBSD fails to build under clang natively clang doesn't have /usr/local/lib in the path. As such there are various depedency linkages that will fail. For example pcre and libfmt.` --- cmake/os/FreeBSD.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index e1c764692bc..9eccdd90c34 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -28,3 +28,6 @@ SET(EXECINFO_ROOT /usr/local CACHE INTERNAL "Where to find execinfo library and INCLUDE_DIRECTORIES(${EXECINFO_ROOT}/include) SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${EXECINFO_ROOT}/include) SET(ENV{LIB} "$ENV{LIB}:${EXECINFO_ROOT}/lib") + +# For all userspace dependencies +LINK_DIRECTORIES(/usr/local/lib) From 2e23c7342ff724b6eb82fd020e0bcdf312ae3209 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 Aug 2024 14:32:37 +1000 Subject: [PATCH 029/185] MDEV-34567 unit.my_apc always failing on FreeBSD-14 Without the call to my_mutex_init, the mutex attributes my_fast_mutexattr and my_errorcheck_mutexattr are uninitialized. Linux tolerates this but FreeBSD doesn't (and segfaults). We fix for all since the unit text should be testing the standard mutexes of the system. --- unittest/sql/my_apc-t.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index f1a28225f41..8fb9181377a 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -190,6 +190,7 @@ int main(int args, char **argv) pthread_t request_thr[N_THREADS]; int i; + my_mutex_init(); my_thread_global_init(); mysql_mutex_init(0, &apc_counters_mutex, MY_MUTEX_INIT_FAST); From b2ebe1cb7bde32945af67512a76ef7d980f8d1a2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 12 Jan 2024 16:57:37 +0100 Subject: [PATCH 030/185] MDEV-33091 pcre2 headers aren't found on Solaris use pkg-config to find pcre2, if possible rename PCRE_INCLUDES to use PKG_CHECK_MODULES naming, PCRE_INCLUDE_DIRS --- client/CMakeLists.txt | 2 +- cmake/pcre.cmake | 34 +++++++++++++--------- cmake/plugin.cmake | 2 +- extra/mariabackup/CMakeLists.txt | 2 +- libmysqld/CMakeLists.txt | 2 +- libmysqld/examples/CMakeLists.txt | 2 +- plugin/feedback/CMakeLists.txt | 2 +- plugin/qc_info/CMakeLists.txt | 2 +- sql/CMakeLists.txt | 2 +- storage/perfschema/CMakeLists.txt | 2 +- storage/perfschema/unittest/CMakeLists.txt | 2 +- unittest/embedded/CMakeLists.txt | 2 +- 12 files changed, 32 insertions(+), 24 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3ad788f8023..a8e80bc8b5b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/mysys_ssl ${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 89f928f684a..4873051170e 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -1,4 +1,3 @@ -INCLUDE (CheckCSourceRuns) INCLUDE (ExternalProject) SET(WITH_PCRE "auto" CACHE STRING @@ -6,7 +5,8 @@ SET(WITH_PCRE "auto" CACHE STRING MACRO(BUNDLE_PCRE2) SET(dir "${CMAKE_BINARY_DIR}/extra/pcre2") - SET(PCRE_INCLUDES ${dir}/src/pcre2-build ${dir}/src/pcre2/src) + SET(PCRE_INCLUDE_DIRS ${dir}/src/pcre2-build ${dir}/src/pcre2/src) + MESSAGE(STATUS "Will download and bundle pcre2") SET(byproducts) FOREACH(lib pcre2-posix pcre2-8) ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL) @@ -76,18 +76,26 @@ SET_TARGET_PROPERTIES(pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE) ENDMACRO() MACRO (CHECK_PCRE) - IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto") - CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" HAVE_PCRE2) - ENDIF() - IF(NOT HAVE_PCRE2 OR WITH_PCRE STREQUAL "bundled") - IF (WITH_PCRE STREQUAL "system") - MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") + IF (NOT TARGET pcre2 AND NOT PCRE_FOUND) + IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto") + FIND_PACKAGE(PkgConfig QUIET) + PKG_CHECK_MODULES(PCRE libpcre2-8) + # in case pkg-config or libpcre2-8.pc is not installed: + IF(NOT PCRE_FOUND) + UNSET(PCRE_FOUND CACHE) + CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" PCRE_FOUND) + ENDIF() ENDIF() - BUNDLE_PCRE2() - ELSE() - CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK) - IF(NEEDS_PCRE2_DEBIAN_HACK) - SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree") + IF(NOT PCRE_FOUND OR WITH_PCRE STREQUAL "bundled") + IF (WITH_PCRE STREQUAL "system") + MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") + ENDIF() + BUNDLE_PCRE2() + ELSE() + CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK) + IF(NEEDS_PCRE2_DEBIAN_HACK) + SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree") + ENDIF() ENDIF() ENDIF() ENDMACRO() diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 7fd3b6294b9..378fc5f5f1c 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -44,7 +44,7 @@ MACRO(MYSQL_ADD_PLUGIN) # Add common include directories INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 6a83ba0238a..8fcc8b2af54 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -36,7 +36,7 @@ INCLUDE_DIRECTORIES( ) IF(NOT HAVE_SYSTEM_REGEX) - INCLUDE_DIRECTORIES(${PCRE_INCLUDES}) + INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS}) ADD_DEFINITIONS(${PCRE2_DEBIAN_HACK}) ENDIF() diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 44115b5c1fc..854c30d33ce 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -23,7 +23,7 @@ ${CMAKE_SOURCE_DIR}/libmysqld ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/tpool ${CMAKE_BINARY_DIR}/sql -${PCRE_INCLUDES} +${PCRE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS} diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index 2a10def8e2e..d6646a128ca 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -15,7 +15,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libmysqld/include - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/sql ${MY_READLINE_INCLUDE_DIR} ) diff --git a/plugin/feedback/CMakeLists.txt b/plugin/feedback/CMakeLists.txt index 2103250e5a6..fc35cbadc31 100644 --- a/plugin/feedback/CMakeLists.txt +++ b/plugin/feedback/CMakeLists.txt @@ -1,5 +1,5 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}) SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc diff --git a/plugin/qc_info/CMakeLists.txt b/plugin/qc_info/CMakeLists.txt index b8c5f926cff..329f49c1fc9 100644 --- a/plugin/qc_info/CMakeLists.txt +++ b/plugin/qc_info/CMakeLists.txt @@ -1,4 +1,4 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql - ${PCRE_INCLUDES}) + ${PCRE_INCLUDE_DIRS}) MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc RECOMPILE_FOR_EMBEDDED) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 8d24a140865..9e735a51433 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -52,7 +52,7 @@ ENDIF() INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql -${PCRE_INCLUDES} +${PCRE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/sql diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt index aea4040c408..8bdba6d9c8b 100644 --- a/storage/perfschema/CMakeLists.txt +++ b/storage/perfschema/CMakeLists.txt @@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_BINARY_DIR}/sql ${CMAKE_CURRENT_BINARY_DIR} - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}) ADD_DEFINITIONS(-DMYSQL_SERVER) diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt index 2a22990f807..600795c78fc 100644 --- a/storage/perfschema/unittest/CMakeLists.txt +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/mysql - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/sql ${SSL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/unittest/mytap diff --git a/unittest/embedded/CMakeLists.txt b/unittest/embedded/CMakeLists.txt index cf48550c377..428bb811de6 100644 --- a/unittest/embedded/CMakeLists.txt +++ b/unittest/embedded/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libmysqld/include - ${PCRE_INCLUDES} + ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/sql ${MY_READLINE_INCLUDE_DIR} ) From 566c22e8148433e967f3bc5b482c037b8ec44511 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 1 Feb 2024 11:26:36 +0100 Subject: [PATCH 031/185] pcre.cmake: always check the library with check_library_exists() even if pkg-config has it. otherwise build dependencies aren't detected. --- cmake/pcre.cmake | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 4873051170e..db685c3572d 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -81,18 +81,15 @@ MACRO (CHECK_PCRE) FIND_PACKAGE(PkgConfig QUIET) PKG_CHECK_MODULES(PCRE libpcre2-8) # in case pkg-config or libpcre2-8.pc is not installed: - IF(NOT PCRE_FOUND) - UNSET(PCRE_FOUND CACHE) - CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" PCRE_FOUND) - ENDIF() + CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "${PCRE_LIBRARY_DIRS}" HAVE_PCRE2_MATCH_8) ENDIF() - IF(NOT PCRE_FOUND OR WITH_PCRE STREQUAL "bundled") + IF(NOT HAVE_PCRE2_MATCH_8 OR WITH_PCRE STREQUAL "bundled") IF (WITH_PCRE STREQUAL "system") MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") ENDIF() BUNDLE_PCRE2() ELSE() - CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK) + CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "${PCRE_LIBRARY_DIRS}" NEEDS_PCRE2_DEBIAN_HACK) IF(NEEDS_PCRE2_DEBIAN_HACK) SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree") ENDIF() From 7b2b03c4f27959b64618aa3ff3cd308a7d2c877c Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 28 Aug 2024 18:37:49 +1000 Subject: [PATCH 032/185] MDEV-34825 FreeBSD fails to build under clang natively Upstream the patch from: https://github.com/freebsd/freebsd-ports/blob/15d22e1c70da81aaa5751ad0d82f92e9451c4d81/databases/mariadb106-server/files/patch-mysys_crc32_crc32c.cc --- mysys/crc32/crc32c.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/crc32/crc32c.cc b/mysys/crc32/crc32c.cc index 6de7af70db7..0d65d0027d4 100644 --- a/mysys/crc32/crc32c.cc +++ b/mysys/crc32/crc32c.cc @@ -455,7 +455,7 @@ static int arch_ppc_probe(void) { return arch_ppc_crc32; } -# elif defined __FreeBSD_version && __FreeBSD_version >= 1200000 +# elif defined __FreeBSD__ # include # include # include From e9b70e59a3946b47ee0812c029221cb246675cf0 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 28 Aug 2024 18:40:52 +1000 Subject: [PATCH 033/185] MDEV-34825 FreeBSD - upstream riscv64 compatibility patch From https://github.com/freebsd/freebsd-ports/blob/15d22e1c70da81aaa5751ad0d82f92e9451c4d81/databases/mariadb106-server/files/patch-sql_mysqld.cc --- sql/mysqld.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e5bc8bde3d6..d874a115bce 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -208,7 +208,7 @@ typedef fp_except fp_except_t; inline void setup_fpu() { -#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) +#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) && defined(FP_X_INV) /* We can't handle floating point exceptions with threads, so disable this on freebsd Don't fall for overflow, underflow,divide-by-zero or loss of precision. @@ -221,7 +221,7 @@ inline void setup_fpu() fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | FP_X_IMP)); #endif /* FP_X_DNML */ -#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */ +#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT && FP_X_INV */ #ifdef HAVE_FEDISABLEEXCEPT fedisableexcept(FE_ALL_EXCEPT); From dff354e7df2fa774ce4da77202a17e2cae99ac59 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 Aug 2024 18:56:55 +1000 Subject: [PATCH 034/185] MDEV-34825: my_cpu.h - non-glibc ism for POWER Taking both the FreeBSD[1] and Alpine[1] patch concepts; provide non-GLIBC definations for HMT_*. Provide FreeBSD ASM base for __ppc_get_timebase. On alternately use __builtin_ppc_get_timebase which is described on https://gcc.gnu.org/onlinedocs/gcc/Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations.html an not depended on glibc/musl. [1] https://github.com/freebsd/freebsd-ports/blob/15d22e1c70da81aaa5751ad0d82f92e9451c4d81/databases/mariadb106-server/files/patch-include_my__cpu.h [2] https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/mariadb/ppc-remove-glibc-dep.patch --- include/my_cpu.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/include/my_cpu.h b/include/my_cpu.h index 05fa937c98d..1f562dc700c 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -24,6 +24,7 @@ */ #ifdef _ARCH_PWR8 +#ifdef __GLIBC__ #include /* Very low priority */ #define HMT_very_low() __ppc_set_ppr_very_low() @@ -37,6 +38,18 @@ #define HMT_medium_high() __ppc_set_ppr_med_high() /* High priority */ #define HMT_high() asm volatile("or 3,3,3") +#else /* GLIBC */ +#if defined(__FreeBSD__) +#include +#include +#endif +#define HMT_very_low() __asm__ volatile ("or 31,31,31") +#define HMT_low() __asm__ volatile ("or 1,1,1") +#define HMT_medium_low() __asm__ volatile ("or 6,6,6") +#define HMT_medium() __asm__ volatile ("or 2,2,2") +#define HMT_medium_high() __asm__ volatile ("or 5,5,5") +#define HMT_high() asm volatile("or 3,3,3") +#endif /* GLIBC */ #else #define HMT_very_low() #define HMT_low() @@ -81,7 +94,13 @@ static inline void MY_RELAX_CPU(void) __asm__ __volatile__ ("pause"); #endif #elif defined(_ARCH_PWR8) - __ppc_get_timebase(); +#ifdef __FreeBSD__ + uint64_t __tb; + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); +#else + /* Changed from __ppc_get_timebase for musl compatibility */ + __builtin_ppc_get_timebase(); +#endif #elif defined __GNUC__ && (defined __arm__ || defined __aarch64__) /* Mainly, prevent the compiler from optimizing away delay loops */ #ifdef _aarch64_ From 8024b8e4c19ff08793382278b3fa36c263799d9b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 5 Sep 2024 11:22:40 +1000 Subject: [PATCH 035/185] MDEV-33091 pcre2 headers - handle columnstore From e735cf2ed7cefb2af36f10f3cb47dfc060789df3, the PCRE_INCLUDES changed to PCRE_INCLUDE_DIRS for consistency. The columnstore module depends on the old name. Create a mapping for the columnstore submodule. 10.6+ fix for submodule is: * https://github.com/mariadb-corporation/mariadb-columnstore-engine/pull/3304 --- storage/columnstore/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index 7c875251214..2b6d8b7d3a5 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -21,6 +21,7 @@ CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") return() ENDIF() + SET(PCRE_INCLUDES "${PCRE_INCLUDE_DIRS}") add_subdirectory(columnstore) IF(TARGET columnstore) From 2ed33f2fb660617aa39d4abb7e7383764e63ac8c Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Wed, 4 Sep 2024 21:25:07 +0200 Subject: [PATCH 036/185] MDEV-26114: Update Sys Schema README --- scripts/sys_schema/README.md | 582 +++++++++++++++++------------------ 1 file changed, 287 insertions(+), 295 deletions(-) diff --git a/scripts/sys_schema/README.md b/scripts/sys_schema/README.md index 3c90f41f8e0..443b63a3f2b 100644 --- a/scripts/sys_schema/README.md +++ b/scripts/sys_schema/README.md @@ -1,8 +1,8 @@ -# The MySQL sys schema +# The MariaDB sys schema -A collection of views, functions and procedures to help MySQL administrators get insight in to MySQL Database usage. +A collection of views, functions and procedures to help MariaDB administrators get insight into MariaDB Database usage. -There are install files available for 5.6 and 5.7 respectively. To load these, you must position yourself within the directory that you downloaded to, as these top level files SOURCE individual files that are shared across versions in most cases (though not all). +There are install files available. To load these, you must position yourself within the directory that you downloaded to, as these top level files SOURCE individual files that are shared across versions in most cases (though not all). ## Overview of objects @@ -54,10 +54,10 @@ Summarizes statement activity, file IO and connections by host. When the host found is NULL, it is assumed to be a "background" thread. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc host_summary; +mariadb> desc host_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -76,7 +76,7 @@ mysql> desc host_summary; +------------------------+---------------+------+-----+---------+-------+ 12 rows in set (0.15 sec) -mysql> desc x$host_summary; +mariadb> desc x$host_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -99,7 +99,7 @@ mysql> desc x$host_summary; ##### Example ```SQL - mysql> select * from host_summary; + mariadb> select * from host_summary; +------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+ | host | statements | statement_latency | statement_avg_latency | table_scans | file_ios | file_io_latency | current_connections | total_connections | unique_users | +------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+ @@ -118,7 +118,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_file_io; +mariadb> desc host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -128,7 +128,7 @@ mysql> desc host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ 3 rows in set (0.00 sec) -mysql> desc x$host_summary_by_file_io; +mariadb> desc x$host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -142,7 +142,7 @@ mysql> desc x$host_summary_by_file_io; ##### Example ```SQL - mysql> select * from host_summary_by_file_io; + mariadb> select * from host_summary_by_file_io; +------------+-------+------------+ | host | ios | io_latency | +------------+-------+------------+ @@ -162,7 +162,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_file_io_type; +mariadb> desc host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -174,7 +174,7 @@ mysql> desc host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.70 sec) -mysql> desc x$host_summary_by_file_io_type; +mariadb> desc x$host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -190,7 +190,7 @@ mysql> desc x$host_summary_by_file_io_type; ##### Example ```SQL - mysql> select * from host_summary_by_file_io_type; + mariadb> select * from host_summary_by_file_io_type; +------------+--------------------------------------+-------+---------------+-------------+ | host | event_name | total | total_latency | max_latency | +------------+--------------------------------------+-------+---------------+-------------+ @@ -225,7 +225,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_stages; +mariadb> desc host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -237,7 +237,7 @@ mysql> desc host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.06 sec) -mysql> desc x$host_summary_by_stages; +mariadb> desc x$host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -253,7 +253,7 @@ mysql> desc x$host_summary_by_stages; ##### Example ```SQL - mysql> select * from host_summary_by_stages; + mariadb> select * from host_summary_by_stages; +------+--------------------------------+-------+---------------+-------------+ | host | event_name | total | total_latency | avg_latency | +------+--------------------------------+-------+---------------+-------------+ @@ -287,7 +287,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_statement_latency; +mariadb> desc host_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -303,7 +303,7 @@ mysql> desc host_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ 9 rows in set (0.29 sec) -mysql> desc x$host_summary_by_statement_latency; +mariadb> desc x$host_summary_by_statement_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -323,7 +323,7 @@ mysql> desc x$host_summary_by_statement_latency; ##### Example ```SQL - mysql> select * from host_summary_by_statement_latency; + mariadb> select * from host_summary_by_statement_latency; +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | host | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -342,7 +342,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_statement_type; +mariadb> desc host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -359,7 +359,7 @@ mysql> desc host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ 10 rows in set (0.30 sec) -mysql> desc x$host_summary_by_statement_type; +mariadb> desc x$host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -380,7 +380,7 @@ mysql> desc x$host_summary_by_statement_type; ##### Example ```SQL - mysql> select * from host_summary_by_statement_type; + mariadb> select * from host_summary_by_statement_type; +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | host | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -402,7 +402,7 @@ Summarizes the output of the INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table, aggreg ##### Structures ```SQL -mysql> desc innodb_buffer_stats_by_schema; +mariadb> desc innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -416,7 +416,7 @@ mysql> desc innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ 7 rows in set (0.08 sec) -mysql> desc x$innodb_buffer_stats_by_schema; +mariadb> desc x$innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -434,7 +434,7 @@ mysql> desc x$innodb_buffer_stats_by_schema; ##### Example ```SQL -mysql> select * from innodb_buffer_stats_by_schema; +mariadb> select * from innodb_buffer_stats_by_schema; +--------------------------+------------+------------+-------+--------------+-----------+-------------+ | object_schema | allocated | data | pages | pages_hashed | pages_old | rows_cached | +--------------------------+------------+------------+-------+--------------+-----------+-------------+ @@ -453,7 +453,7 @@ Summarizes the output of the INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table, aggreg ##### Structures ```SQL -mysql> desc innodb_buffer_stats_by_table; +mariadb> desc innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -468,7 +468,7 @@ mysql> desc innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ 8 rows in set (0.09 sec) -mysql> desc x$innodb_buffer_stats_by_table; +mariadb> desc x$innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -487,7 +487,7 @@ mysql> desc x$innodb_buffer_stats_by_table; ##### Example ```SQL -mysql> select * from innodb_buffer_stats_by_table; +mariadb> select * from innodb_buffer_stats_by_table; +--------------------------+------------------------------------+------------+-----------+-------+--------------+-----------+-------------+ | object_schema | object_name | allocated | data | pages | pages_hashed | pages_old | rows_cached | +--------------------------+------------------------------------+------------+-----------+-------+--------------+-----------+-------------+ @@ -531,7 +531,7 @@ The lock waits are ordered by the age of the lock descending. ##### Structures ```SQL -mysql> desc sys.innodb_lock_waits; +mariadb> desc sys.innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------------------+-------+ @@ -564,7 +564,7 @@ mysql> desc sys.innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ 26 rows in set (0.01 sec) -mysql> desc sys.x$innodb_lock_waits; +mariadb> desc sys.x$innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------------------+-------+ @@ -601,7 +601,7 @@ mysql> desc sys.x$innodb_lock_waits; ##### Example ```SQL -mysql> SELECT * FROM innodb_lock_waits\G +mariadb> SELECT * FROM innodb_lock_waits\G *************************** 1. row *************************** wait_started: 2014-11-11 13:39:20 wait_age: 00:00:07 @@ -640,7 +640,7 @@ Shows the top IO consumers by thread, ordered by total latency. ##### Structures ```SQL -mysql> desc io_by_thread_by_latency; +mariadb> desc io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -655,7 +655,7 @@ mysql> desc io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ 8 rows in set (0.14 sec) -mysql> desc x$io_by_thread_by_latency; +mariadb> desc x$io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -674,7 +674,7 @@ mysql> desc x$io_by_thread_by_latency; ##### Example ```SQL -mysql> select * from io_by_thread_by_latency; +mariadb> select * from io_by_thread_by_latency; +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ | user | total | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ @@ -701,7 +701,7 @@ Shows the top global IO consumers by bytes usage by file. ##### Structures ```SQL -mysql> desc io_global_by_file_by_bytes; +mariadb> desc io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -717,7 +717,7 @@ mysql> desc io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ 9 rows in set (0.15 sec) -mysql> desc x$io_global_by_file_by_bytes; +mariadb> desc x$io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -737,7 +737,7 @@ mysql> desc x$io_global_by_file_by_bytes; ##### Example ```SQL -mysql> SELECT * FROM io_global_by_file_by_bytes LIMIT 5; +mariadb> SELECT * FROM io_global_by_file_by_bytes LIMIT 5; +--------------------------------------------+------------+------------+-----------+-------------+---------------+-----------+------------+-----------+ | file | count_read | total_read | avg_read | count_write | total_written | avg_write | total | write_pct | +--------------------------------------------+------------+------------+-----------+-------------+---------------+-----------+------------+-----------+ @@ -758,7 +758,7 @@ Shows the top global IO consumers by latency by file. ##### Structures ```SQL -mysql> desc io_global_by_file_by_latency; +mariadb> desc io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -774,7 +774,7 @@ mysql> desc io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ 9 rows in set (0.00 sec) -mysql> desc x$io_global_by_file_by_latency; +mariadb> desc x$io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -794,7 +794,7 @@ mysql> desc x$io_global_by_file_by_latency; ##### Example ```SQL -mysql> select * from io_global_by_file_by_latency limit 5; +mariadb> select * from io_global_by_file_by_latency limit 5; +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ | file | total | total_latency | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ @@ -815,7 +815,7 @@ Shows the top global IO consumer classes by bytes usage. ##### Structures ```SQL -mysql> desc io_global_by_wait_by_bytes; +mariadb> desc io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ @@ -835,7 +835,7 @@ mysql> desc io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ 13 rows in set (0.02 sec) -mysql> desc x$io_global_by_wait_by_bytes; +mariadb> desc x$io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ @@ -859,7 +859,7 @@ mysql> desc x$io_global_by_wait_by_bytes; ##### Example ```SQL -mysql> select * from io_global_by_wait_by_bytes; +mariadb> select * from io_global_by_wait_by_bytes; +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ | event_name | total | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ @@ -891,7 +891,7 @@ Shows the top global IO consumers by latency. ##### Structures ```SQL -mysql> desc io_global_by_wait_by_latency; +mariadb> desc io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -912,7 +912,7 @@ mysql> desc io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ 14 rows in set (0.19 sec) -mysql> desc x$io_global_by_wait_by_latency; +mariadb> desc x$io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -937,7 +937,7 @@ mysql> desc x$io_global_by_wait_by_latency; ##### Example ```SQL -mysql> SELECT * FROM io_global_by_wait_by_latency; +mariadb> SELECT * FROM io_global_by_wait_by_latency; +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ | event_name | total | total_latency | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ @@ -969,7 +969,7 @@ Shows the latest file IO, by file / thread. ##### Structures ```SQL -mysql> desc latest_file_io; +mariadb> desc latest_file_io; +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ @@ -981,7 +981,7 @@ mysql> desc latest_file_io; +-----------+--------------+------+-----+---------+-------+ 5 rows in set (0.10 sec) -mysql> desc x$latest_file_io; +mariadb> desc x$latest_file_io; +-----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------+------+-----+---------+-------+ @@ -997,7 +997,7 @@ mysql> desc x$latest_file_io; ##### Example ```SQL -mysql> select * from latest_file_io limit 5; +mariadb> select * from latest_file_io limit 5; +----------------------+----------------------------------------+------------+-----------+-----------+ | thread | file | latency | operation | requested | +----------------------+----------------------------------------+------------+-----------+-----------+ @@ -1013,14 +1013,14 @@ mysql> select * from latest_file_io limit 5; ##### Description -Summarizes memory use by host using the 5.7 Performance Schema instrumentation. +Summarizes memory use by host using the Performance Schema instrumentation. When the host found is NULL, it is assumed to be a local "background" thread. ##### Structures ```SQL -mysql> desc memory_by_host_by_current_bytes; +mariadb> desc memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1033,7 +1033,7 @@ mysql> desc memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ 6 rows in set (0.24 sec) -mysql> desc x$memory_by_host_by_current_bytes; +mariadb> desc x$memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1050,7 +1050,7 @@ mysql> desc x$memory_by_host_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; +mariadb> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; +------------+--------------------+-------------------+-------------------+-------------------+-----------------+ | host | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +------------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1063,14 +1063,14 @@ mysql> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; ##### Description -Summarizes memory use by user using the 5.7 Performance Schema instrumentation. +Summarizes memory use by user using the Performance Schema instrumentation. The user columns shows either the background or foreground user name appropriately. ##### Structures ```SQL -mysql> desc memory_by_thread_by_current_bytes; +mariadb> desc memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------------+------+-----+---------+-------+ @@ -1084,7 +1084,7 @@ mysql> desc memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ 7 rows in set (0.49 sec) -mysql> desc x$memory_by_thread_by_current_bytes; +mariadb> desc x$memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------------+------+-----+---------+-------+ @@ -1102,7 +1102,7 @@ mysql> desc x$memory_by_thread_by_current_bytes; ##### Example ```SQL -mysql> select * from sys.memory_by_thread_by_current_bytes limit 5; +mariadb> select * from sys.memory_by_thread_by_current_bytes limit 5; +-----------+----------------+--------------------+-------------------+-------------------+-------------------+-----------------+ | thread_id | user | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +-----------+----------------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1118,14 +1118,14 @@ mysql> select * from sys.memory_by_thread_by_current_bytes limit 5; ##### Description -Summarizes memory use by user using the 5.7 Performance Schema instrumentation. +Summarizes memory use by user using the Performance Schema instrumentation. When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc memory_by_user_by_current_bytes; +mariadb> desc memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1138,7 +1138,7 @@ mysql> desc memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ 6 rows in set (0.06 sec) -mysql> desc x$memory_by_user_by_current_bytes; +mariadb> desc x$memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1155,7 +1155,7 @@ mysql> desc x$memory_by_user_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_by_user_by_current_bytes; +mariadb> select * from memory_by_user_by_current_bytes; +------+--------------------+-------------------+-------------------+-------------------+-----------------+ | user | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1173,7 +1173,7 @@ Shows the current memory usage within the server globally broken down by allocat ##### Structures ```SQL -mysql> desc memory_global_by_current_bytes; +mariadb> desc memory_global_by_current_bytes; +-------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+-------+ @@ -1187,7 +1187,7 @@ mysql> desc memory_global_by_current_bytes; +-------------------+--------------+------+-----+---------+-------+ 7 rows in set (0.08 sec) -mysql> desc x$memory_global_by_current_bytes; +mariadb> desc x$memory_global_by_current_bytes; +-------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------+------+-----+---------+-------+ @@ -1205,7 +1205,7 @@ mysql> desc x$memory_global_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_global_by_current_bytes; +mariadb> select * from memory_global_by_current_bytes; +----------------------------------------+---------------+---------------+-------------------+------------+------------+----------------+ | event_name | current_count | current_alloc | current_avg_alloc | high_count | high_alloc | high_avg_alloc | +----------------------------------------+---------------+---------------+-------------------+------------+------------+----------------+ @@ -1227,7 +1227,7 @@ Shows the total memory usage within the server globally. ##### Structures ```SQL -mysql> desc memory_global_total; +mariadb> desc memory_global_total; +-----------------+------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+------+------+-----+---------+-------+ @@ -1235,7 +1235,7 @@ mysql> desc memory_global_total; +-----------------+------+------+-----+---------+-------+ 1 row in set (0.07 sec) -mysql> desc x$memory_global_total; +mariadb> desc x$memory_global_total; +-----------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------+------+-----+---------+-------+ @@ -1247,7 +1247,7 @@ mysql> desc x$memory_global_total; ##### Example ```SQL -mysql> select * from memory_global_total; +mariadb> select * from memory_global_total; +-----------------+ | total_allocated | +-----------------+ @@ -1261,12 +1261,12 @@ mysql> select * from memory_global_total; Creates a union of the following information: - * performance_schema.global_status (information_schema.GLOBAL_STATUS in MySQL 5.6) + * performance_schema.global_status * information_schema.INNODB_METRICS - * Performance Schema global memory usage information (only in MySQL 5.7) + * Performance Schema global memory usage information * Current time -In MySQL 5.7 it is required that performance_schema = ON, though there is no requirements to which +It is required that performance_schema = ON, though there is no requirements to which instruments and consumers that are enabled. See also the description of the Enabled column below. For view has the following columns: @@ -1280,7 +1280,7 @@ For view has the following columns: ##### Structures ```SQL -mysql> DESC metrics; +mariadb> DESC metrics; +----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+-------+ @@ -1306,7 +1306,7 @@ mysq> DESC metrics_56; ##### Example ```SQL -mysql> SELECT * FROM metrics; +mariadb> SELECT * FROM metrics; +-----------------------------------------------+-------------------------...+--------------------------------------+---------+ | Variable_name | Variable_value ...| Type | Enabled | +-----------------------------------------------+-------------------------...+--------------------------------------+---------+ @@ -1348,10 +1348,10 @@ Performs less locking than the legacy sources, whilst giving extra information. The output includes both background threads and user connections by default. See also `session` / `x$session` for a view that contains only user session information. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc processlist; +mariadb> desc processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -1386,7 +1386,7 @@ mysql> desc processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ 28 rows in set (0.04 sec) -mysql> desc x$processlist; +mariadb> desc x$processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -1425,7 +1425,7 @@ mysql> desc x$processlist; ##### Example ```SQL -mysql> select * from sys.processlist where conn_id is not null and command != 'daemon' and conn_id != connection_id()\G +mariadb> select * from sys.processlist where conn_id is not null and command != 'daemon' and conn_id != connection_id()\G *************************** 1. row *************************** thd_id: 44524 conn_id: 44502 @@ -1466,7 +1466,7 @@ Used to check whether Performance Schema is not able to monitor all runtime data ##### Structure ```SQL -mysql> desc ps_check_lost_instrumentation; +mariadb> desc ps_check_lost_instrumentation; +----------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------+------+-----+---------+-------+ @@ -1479,7 +1479,7 @@ mysql> desc ps_check_lost_instrumentation; ##### Example ```SQL -mysql> select * from ps_check_lost_instrumentation; +mariadb> select * from ps_check_lost_instrumentation; +----------------------------------------+----------------+ | variable_name | variable_value | +----------------------------------------+----------------+ @@ -1497,7 +1497,7 @@ Present current auto_increment usage/capacity in all tables. ##### Structures ```SQL -mysql> desc schema_auto_increment_columns; +mariadb> desc schema_auto_increment_columns; +----------------------+------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------+------------------------+------+-----+---------+-------+ @@ -1517,7 +1517,7 @@ mysql> desc schema_auto_increment_columns; ##### Example ```SQL -mysql> select * from schema_auto_increment_columns limit 5; +mariadb> select * from schema_auto_increment_columns limit 5; +-------------------+-------------------+-------------+-----------+-------------+-----------+-------------+---------------------+----------------+----------------------+ | table_schema | table_name | column_name | data_type | column_type | is_signed | is_unsigned | max_value | auto_increment | auto_increment_ratio | +-------------------+-------------------+-------------+-----------+-------------+-----------+-------------+---------------------+----------------+----------------------+ @@ -1540,7 +1540,7 @@ Ordered by the total wait time descending - top indexes are most contended. ##### Structures ```SQL -mysql> desc schema_index_statistics; +mariadb> desc schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -1558,7 +1558,7 @@ mysql> desc schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ 11 rows in set (0.17 sec) -mysql> desc x$schema_index_statistics; +mariadb> desc x$schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -1580,7 +1580,7 @@ mysql> desc x$schema_index_statistics; ##### Example ```SQL -mysql> select * from schema_index_statistics limit 5; +mariadb> select * from schema_index_statistics limit 5; +------------------+-------------+------------+---------------+----------------+---------------+----------------+--------------+----------------+--------------+----------------+ | table_schema | table_name | index_name | rows_selected | select_latency | rows_inserted | insert_latency | rows_updated | update_latency | rows_deleted | delete_latency | +------------------+-------------+------------+---------------+----------------+---------------+----------------+--------------+----------------+--------------+----------------+ @@ -1603,7 +1603,7 @@ Note: On instances with a large numbers of objects, this could take some time to ##### Structure ```SQL -mysql> desc schema_object_overview; +mariadb> desc schema_object_overview; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ @@ -1617,7 +1617,7 @@ mysql> desc schema_object_overview; ##### Example ```SQL -mysql> select * from schema_object_overview; +mariadb> select * from schema_object_overview; +--------------------+---------------+-------+ | db | object_type | count | +--------------------+---------------+-------+ @@ -1650,7 +1650,7 @@ Also includes the helper view (used by schema_table_statistics_with_buffer as we ##### Structures ```SQL -mysql> desc schema_table_statistics; +mariadb> desc schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -1676,7 +1676,7 @@ mysql> desc schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ 19 rows in set (0.12 sec) -mysql> desc x$schema_table_statistics; +mariadb> desc x$schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -1702,7 +1702,7 @@ mysql> desc x$schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ 19 rows in set (0.13 sec) -mysql> desc x$ps_schema_table_statistics_io; +mariadb> desc x$ps_schema_table_statistics_io; +---------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------------+---------------+------+-----+---------+-------+ @@ -1723,7 +1723,7 @@ mysql> desc x$ps_schema_table_statistics_io; ##### Example ```SQL -mysql> select * from schema_table_statistics\G +mariadb> select * from schema_table_statistics\G *************************** 1. row *************************** table_schema: sys table_name: sys_config @@ -1757,7 +1757,7 @@ Also includes the the helper view `x$schema_flattened_keys`. ##### Structures ```SQL -mysql> desc sys.schema_redundant_indexes; +mariadb> desc sys.schema_redundant_indexes; +----------------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+--------------+------+-----+---------+-------+ @@ -1774,7 +1774,7 @@ mysql> desc sys.schema_redundant_indexes; +----------------------------+--------------+------+-----+---------+-------+ 10 rows in set (0.00 sec) -mysql> desc sys.x$schema_flattened_keys; +mariadb> desc sys.x$schema_flattened_keys; +----------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+-------------+------+-----+---------+-------+ @@ -1791,7 +1791,7 @@ mysql> desc sys.x$schema_flattened_keys; ##### Example ```SQL -mysql> select * from sys.schema_redundant_indexes\G +mariadb> select * from sys.schema_redundant_indexes\G *************************** 1. row *************************** table_schema: test table_name: rkey @@ -1805,7 +1805,7 @@ redundant_index_non_unique: 1 sql_drop_index: ALTER TABLE `test`.`rkey` DROP INDEX `j` 1 row in set (0.20 sec) -mysql> SHOW CREATE TABLE test.rkey\G +mariadb> SHOW CREATE TABLE test.rkey\G *************************** 1. row *************************** Table: rkey Create Table: CREATE TABLE `rkey` ( @@ -1828,7 +1828,7 @@ Shows sessions that are blocked waiting on table metadata locks, and who is bloc ##### Structures ```SQL -mysql> desc schema_table_lock_waits; +mariadb> desc schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------+-------+ @@ -1853,7 +1853,7 @@ mysql> desc schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ 18 rows in set (0.15 sec) -mysql> desc x$schema_table_lock_waits; +mariadb> desc x$schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------+-------+ @@ -1882,7 +1882,7 @@ mysql> desc x$schema_table_lock_waits; ##### Example ```SQL -mysql> select * from sys.schema_table_lock_waits\G +mariadb> select * from sys.schema_table_lock_waits\G *************************** 1. row *************************** object_schema: test object_name: t @@ -1919,7 +1919,7 @@ Uses the x$ps_schema_table_statistics_io helper view from schema_table_statistic ##### Structures ```SQL -mysql> desc schema_table_statistics_with_buffer; +mariadb> desc schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+---------------------+------+-----+---------+-------+ @@ -1951,7 +1951,7 @@ mysql> desc schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ 25 rows in set (0.05 sec) -mysql> desc x$schema_table_statistics_with_buffer; +mariadb> desc x$schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+---------------------+------+-----+---------+-------+ @@ -1987,7 +1987,7 @@ mysql> desc x$schema_table_statistics_with_buffer; ##### Example ```SQL -mysql> select * from schema_table_statistics_with_buffer limit 1\G +mariadb> select * from schema_table_statistics_with_buffer limit 1\G *************************** 1. row *************************** table_schema: mem table_name: mysqlserver @@ -2024,7 +2024,7 @@ Finds tables that are being accessed by full table scans ordering by the number ##### Structures ```SQL -mysql> desc schema_tables_with_full_table_scans; +mariadb> desc schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -2035,7 +2035,7 @@ mysql> desc schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ 4 rows in set (0.02 sec) -mysql> desc x$schema_tables_with_full_table_scans; +mariadb> desc x$schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -2050,7 +2050,7 @@ mysql> desc x$schema_tables_with_full_table_scans; ##### Example ```SQL -mysql> select * from schema_tables_with_full_table_scans limit 5; +mariadb> select * from schema_tables_with_full_table_scans limit 5; +--------------------+--------------------------------+-------------------+-----------+ | object_schema | object_name | rows_full_scanned | latency | +--------------------+--------------------------------+-------------------+-----------+ @@ -2075,7 +2075,7 @@ PRIMARY (key) indexes are ignored. ##### Structure ```SQL -mysql> desc schema_unused_indexes; +mariadb> desc schema_unused_indexes; +---------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+-------+ @@ -2089,7 +2089,7 @@ mysql> desc schema_unused_indexes; ##### Example ```SQL -mysql> select * from schema_unused_indexes limit 5; +mariadb> select * from schema_unused_indexes limit 5; +--------------------+---------------------+--------------------+ | object_schema | object_name | index_name | +--------------------+---------------------+--------------------+ @@ -2111,10 +2111,10 @@ Performs less locking than the legacy sources, whilst giving extra information. The output of this view is restricted to threads from user sessions. See also processlist / x$processlist which contains both user and background threads. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc session; +mariadb> desc session; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -2149,7 +2149,7 @@ mysql> desc session; +------------------------+------------------------------------------+------+-----+---------+-------+ 28 rows in set (0.00 sec) -mysql> desc x$session; +mariadb> desc x$session; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -2188,7 +2188,7 @@ mysql> desc x$session; ##### Example ```SQL -mysql> select * from sys.session\G +mariadb> select * from sys.session\G *************************** 1. row *************************** thd_id: 24 conn_id: 2 @@ -2229,7 +2229,7 @@ Shows SSL version, cipher and the count of re-used SSL sessions per connection ##### Structures ```SQL -mysql> desc sys.session_ssl_status; +mariadb> desc sys.session_ssl_status; +---------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+---------------------+------+-----+---------+-------+ @@ -2244,7 +2244,7 @@ mysql> desc sys.session_ssl_status; ##### Example ```SQL -mysql> select * from session_ssl_status; +mariadb> select * from session_ssl_status; +-----------+-------------+--------------------+---------------------+ | thread_id | ssl_version | ssl_cipher | ssl_sessions_reused | +-----------+-------------+--------------------+---------------------+ @@ -2259,12 +2259,12 @@ mysql> select * from session_ssl_status; ##### Description -Lists a normalized statement view with aggregated statistics, mimics the MySQL Enterprise Monitor Query Analysis view, ordered by the total execution time per normalized statement +Lists a normalized statement view with aggregated statistics, ordered by the total execution time per normalized statement ##### Structures ```SQL -mysql> desc statement_analysis; +mariadb> desc statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2294,7 +2294,7 @@ mysql> desc statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ 23 rows in set (0.26 sec) -mysql> desc x$statement_analysis; +mariadb> desc x$statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2328,7 +2328,7 @@ mysql> desc x$statement_analysis; ##### Example ```SQL -mysql> select * from statement_analysis limit 1\G +mariadb> select * from statement_analysis limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2364,7 +2364,7 @@ Lists all normalized statements that have raised errors or warnings. ##### Structures ```SQL -mysql> desc statements_with_errors_or_warnings; +mariadb> desc statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------------------+-------+ @@ -2381,7 +2381,7 @@ mysql> desc statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ 10 rows in set (0.55 sec) -mysql> desc x$statements_with_errors_or_warnings; +mariadb> desc x$statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------------------+-------+ @@ -2402,7 +2402,7 @@ mysql> desc x$statements_with_errors_or_warnings; ##### Example ```SQL -mysql> select * from statements_with_errors_or_warnings LIMIT 1\G +mariadb> select * from statements_with_errors_or_warnings LIMIT 1\G *************************** 1. row *************************** query: CREATE OR REPLACE ALGORITHM = ... _delete` AS `rows_deleted` ... db: sys @@ -2427,7 +2427,7 @@ This view ignores SHOW statements, as these always cause a full table scan, and ##### Structures ```SQL -mysql> desc statements_with_full_table_scans; +mariadb> desc statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+------------------------+------+-----+---------------------+-------+ @@ -2448,7 +2448,7 @@ mysql> desc statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ 14 rows in set (0.04 sec) -mysql> desc x$statements_with_full_table_scans; +mariadb> desc x$statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+------------------------+------+-----+---------------------+-------+ @@ -2473,7 +2473,7 @@ mysql> desc x$statements_with_full_table_scans; ##### Example ```SQL -mysql> select * from statements_with_full_table_scans limit 1\G +mariadb> select * from statements_with_full_table_scans limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_tables_w ... ex_usage` . `COUNT_READ` DESC db: sys @@ -2505,7 +2505,7 @@ Also includes two helper views: ##### Structures ```SQL -mysql> desc statements_with_runtimes_in_95th_percentile; +mariadb> desc statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2528,7 +2528,7 @@ mysql> desc statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ 16 rows in set (0.11 sec) -mysql> desc x$statements_with_runtimes_in_95th_percentile; +mariadb> desc x$statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2551,7 +2551,7 @@ mysql> desc x$statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ 16 rows in set (0.00 sec) -mysql> desc x$ps_digest_avg_latency_distribution; +mariadb> desc x$ps_digest_avg_latency_distribution; +--------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------------+------+-----+---------+-------+ @@ -2560,7 +2560,7 @@ mysql> desc x$ps_digest_avg_latency_distribution; +--------+---------------+------+-----+---------+-------+ 2 rows in set (0.10 sec) -mysql> desc x$ps_digest_95th_percentile_by_avg_us; +mariadb> desc x$ps_digest_95th_percentile_by_avg_us; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2573,7 +2573,7 @@ mysql> desc x$ps_digest_95th_percentile_by_avg_us; ##### Example ```SQL -mysql> select * from statements_with_runtimes_in_95th_percentile\G +mariadb> select * from statements_with_runtimes_in_95th_percentile\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2602,7 +2602,7 @@ Lists all normalized statements that have done sorts, ordered by total_latency d ##### Structures ```SQL -mysql> desc statements_with_sorting; +mariadb> desc statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2622,7 +2622,7 @@ mysql> desc statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ 13 rows in set (0.01 sec) -mysql> desc x$statements_with_sorting; +mariadb> desc x$statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2646,7 +2646,7 @@ mysql> desc x$statements_with_sorting; ##### Example ```SQL -mysql> select * from statements_with_sorting limit 1\G +mariadb> select * from statements_with_sorting limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2672,7 +2672,7 @@ Lists all normalized statements that use temporary tables ordered by number of o ##### Structures ```SQL -mysql> desc statements_with_temp_tables; +mariadb> desc statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+---------------------+------+-----+---------------------+-------+ @@ -2690,7 +2690,7 @@ mysql> desc statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ 11 rows in set (0.30 sec) -mysql> desc x$statements_with_temp_tables; +mariadb> desc x$statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+---------------------+------+-----+---------------------+-------+ @@ -2712,7 +2712,7 @@ mysql> desc x$statements_with_temp_tables; ##### Example ```SQL -mysql> select * from statements_with_temp_tables limit 1\G +mariadb> select * from statements_with_temp_tables limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2735,10 +2735,10 @@ Summarizes statement activity, file IO and connections by user. When the user found is NULL, it is assumed to be a "background" thread. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc user_summary; +mariadb> desc user_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -2757,7 +2757,7 @@ mysql> desc user_summary; +------------------------+---------------+------+-----+---------+-------+ 12 rows in set (0.00 sec) -mysql> desc x$user_summary; +mariadb> desc x$user_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -2780,7 +2780,7 @@ mysql> desc x$user_summary; ##### Example ```SQL -mysql> select * from user_summary\G +mariadb> select * from user_summary\G *************************** 1. row *************************** user: root statements: 4981 @@ -2820,7 +2820,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_file_io; +mariadb> desc user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2830,7 +2830,7 @@ mysql> desc user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ 3 rows in set (0.20 sec) -mysql> desc x$user_summary_by_file_io; +mariadb> desc x$user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2844,7 +2844,7 @@ mysql> desc x$user_summary_by_file_io; ##### Example ```SQL -mysql> select * from user_summary_by_file_io; +mariadb> select * from user_summary_by_file_io; +------------+-------+------------+ | user | ios | io_latency | +------------+-------+------------+ @@ -2864,7 +2864,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_file_io_type; +mariadb> desc user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------+-------+ @@ -2876,7 +2876,7 @@ mysql> desc user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.02 sec) -mysql> desc x$user_summary_by_file_io_type; +mariadb> desc x$user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------+-------+ @@ -2892,7 +2892,7 @@ mysql> desc x$user_summary_by_file_io_type; ##### Example ```SQL -mysql> select * from user_summary_by_file_io_type; +mariadb> select * from user_summary_by_file_io_type; +------------+--------------------------------------+-------+-----------+-------------+ | user | event_name | total | latency | max_latency | +------------+--------------------------------------+-------+-----------+-------------+ @@ -2936,7 +2936,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_stages; +mariadb> desc user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -2948,7 +2948,7 @@ mysql> desc user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.01 sec) -mysql> desc x$user_summary_by_stages; +mariadb> desc x$user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -2964,7 +2964,7 @@ mysql> desc x$user_summary_by_stages; ##### Example ```SQL -mysql> select * from user_summary_by_stages; +mariadb> select * from user_summary_by_stages; +------+--------------------------------+-------+---------------+-------------+ | user | event_name | total | total_latency | avg_latency | +------+--------------------------------+-------+---------------+-------------+ @@ -2998,7 +2998,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_statement_latency; +mariadb> desc user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3014,7 +3014,7 @@ mysql> desc user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ 9 rows in set (0.00 sec) -mysql> desc x$user_summary_by_statement_latency; +mariadb> desc x$user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3034,7 +3034,7 @@ mysql> desc x$user_summary_by_statement_latency; ##### Example ```SQL -mysql> select * from user_summary_by_statement_latency; +mariadb> select * from user_summary_by_statement_latency; +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | user | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -3053,7 +3053,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_statement_type; +mariadb> desc user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3070,7 +3070,7 @@ mysql> desc user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ 10 rows in set (0.21 sec) -mysql> desc x$user_summary_by_statement_type; +mariadb> desc x$user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3091,7 +3091,7 @@ mysql> desc x$user_summary_by_statement_type; ##### Example ```SQL -mysql> select * from user_summary_by_statement_type; +mariadb> select * from user_summary_by_statement_type; +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -3124,7 +3124,7 @@ Lists the top wait classes by average latency, ignoring idle (this may be very l ##### Structures ```SQL -mysql> desc wait_classes_global_by_avg_latency; +mariadb> desc wait_classes_global_by_avg_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3137,7 +3137,7 @@ mysql> desc wait_classes_global_by_avg_latency; +---------------+---------------+------+-----+---------+-------+ 6 rows in set (0.11 sec) -mysql> desc x$wait_classes_global_by_avg_latency; +mariadb> desc x$wait_classes_global_by_avg_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3154,7 +3154,7 @@ mysql> desc x$wait_classes_global_by_avg_latency; ##### Example ```SQL -mysql> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; +mariadb> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; +-------------------+--------+---------------+-------------+-------------+-------------+ | event_class | total | total_latency | min_latency | avg_latency | max_latency | +-------------------+--------+---------------+-------------+-------------+-------------+ @@ -3176,7 +3176,7 @@ Lists the top wait classes by total latency, ignoring idle (this may be very lar ##### Structures ```SQL -mysql> desc wait_classes_global_by_latency; +mariadb> desc wait_classes_global_by_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3189,7 +3189,7 @@ mysql> desc wait_classes_global_by_latency; +---------------+---------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) -mysql> desc x$wait_classes_global_by_latency; +mariadb> desc x$wait_classes_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3206,7 +3206,7 @@ mysql> desc x$wait_classes_global_by_latency; ##### Example ```SQL -mysql> select * from wait_classes_global_by_latency; +mariadb> select * from wait_classes_global_by_latency; +-------------------+--------+---------------+-------------+-------------+-------------+ | event_class | total | total_latency | min_latency | avg_latency | max_latency | +-------------------+--------+---------------+-------------+-------------+-------------+ @@ -3228,7 +3228,7 @@ Lists the top wait events per user by their total latency, ignoring idle (this m ##### Structures ```SQL -mysql> desc waits_by_user_by_latency; +mariadb> desc waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3241,7 +3241,7 @@ mysql> desc waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) -mysql> desc x$waits_by_user_by_latency; +mariadb> desc x$waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3258,7 +3258,7 @@ mysql> desc x$waits_by_user_by_latency; ##### Example ```SQL -mysql> select * from waits_by_user_by_latency; +mariadb> select * from waits_by_user_by_latency; +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ | user | event | total | total_latency | avg_latency | max_latency | +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ @@ -3289,7 +3289,7 @@ Lists the top wait events per host by their total latency, ignoring idle (this m ##### Structures ```SQL -mysql> desc waits_by_host_by_latency; +mariadb> desc waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3302,7 +3302,7 @@ mysql> desc waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ 6 rows in set (0.36 sec) -mysql> desc x$waits_by_host_by_latency; +mariadb> desc x$waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3319,7 +3319,7 @@ mysql> desc x$waits_by_host_by_latency; ##### Example ```SQL - mysql> select * from waits_by_host_by_latency; + mariadb> select * from waits_by_host_by_latency; +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ | host | event | total | total_latency | avg_latency | max_latency | +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ @@ -3350,7 +3350,7 @@ Lists the top wait events by their total latency, ignoring idle (this may be ver ##### Structures ```SQL -mysql> desc waits_global_by_latency; +mariadb> desc waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3362,7 +3362,7 @@ mysql> desc waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.01 sec) -mysql> desc x$waits_global_by_latency; +mariadb> desc x$waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3378,7 +3378,7 @@ mysql> desc x$waits_global_by_latency; ##### Example ```SQL -mysql> select * from waits_global_by_latency; +mariadb> select * from waits_global_by_latency; +-----------------------------------------------------+---------+---------------+-------------+-------------+ | events | total | total_latency | avg_latency | max_latency | +-----------------------------------------------------+---------+---------------+-------------+-------------+ @@ -3432,7 +3432,7 @@ VARCHAR(64) ##### Example ```SQL -mysql> SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); +mariadb> SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); +----------------------------------------------------------------------------+ | sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd') | +----------------------------------------------------------------------------+ @@ -3459,7 +3459,7 @@ VARCHAR(64) ##### Example ```SQL -mysql> SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); +mariadb> SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); +---------------------------------------------------------------------------+ | sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd') | +---------------------------------------------------------------------------+ @@ -3484,7 +3484,7 @@ TEXT ##### Example ```SQL -mysql> SELECT sys.format_bytes(2348723492723746) AS size; +mariadb> SELECT sys.format_bytes(2348723492723746) AS size; +----------+ | size | +----------+ @@ -3492,7 +3492,7 @@ mysql> SELECT sys.format_bytes(2348723492723746) AS size; +----------+ 1 row in set (0.00 sec) -mysql> SELECT sys.format_bytes(2348723492723) AS size; +mariadb> SELECT sys.format_bytes(2348723492723) AS size; +----------+ | size | +----------+ @@ -3500,7 +3500,7 @@ mysql> SELECT sys.format_bytes(2348723492723) AS size; +----------+ 1 row in set (0.00 sec) -mysql> SELECT sys.format_bytes(23487234) AS size; +mariadb> SELECT sys.format_bytes(23487234) AS size; +-----------+ | size | +-----------+ @@ -3527,7 +3527,7 @@ VARCHAR(512) CHARSET UTF8 ##### Example ```SQL -mysql> select @@datadir; +mariadb> select @@datadir; +-----------------------------------------------+ | @@datadir | +-----------------------------------------------+ @@ -3535,7 +3535,7 @@ mysql> select @@datadir; +-----------------------------------------------+ 1 row in set (0.06 sec) -mysql> select format_path('/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD') AS path; +mariadb> select format_path('/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD') AS path; +--------------------------+ | path | +--------------------------+ @@ -3564,7 +3564,7 @@ LONGTEXT ##### Example ```SQL -mysql> SELECT sys.format_statement(digest_text) +mariadb> SELECT sys.format_statement(digest_text) -> FROM performance_schema.events_statements_summary_by_digest -> ORDER by sum_timer_wait DESC limit 5; +-------------------------------------------------------------------+ @@ -3597,7 +3597,7 @@ TEXT ##### Example ```SQL -mysql> select format_time(342342342342345); +mariadb> select format_time(342342342342345); +------------------------------+ | format_time(342342342342345) | +------------------------------+ @@ -3605,7 +3605,7 @@ mysql> select format_time(342342342342345); +------------------------------+ 1 row in set (0.00 sec) -mysql> select format_time(342342342); +mariadb> select format_time(342342342); +------------------------+ | format_time(342342342) | +------------------------+ @@ -3613,7 +3613,7 @@ mysql> select format_time(342342342); +------------------------+ 1 row in set (0.00 sec) -mysql> select format_time(34234); +mariadb> select format_time(34234); +--------------------+ | format_time(34234) | +--------------------+ @@ -3643,7 +3643,7 @@ TEXT ##### Example ```SQL -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------+ @@ -3651,10 +3651,10 @@ mysql> select @@sql_mode; +-----------------------------------------------------------------------------------+ 1 row in set (0.00 sec) -mysql> set sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); +mariadb> set sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); Query OK, 0 rows affected (0.06 sec) -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------------------+ @@ -3684,7 +3684,7 @@ TEXT ##### Example ```SQL -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------------------+ @@ -3692,10 +3692,10 @@ mysql> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) -mysql> set sql_mode = sys.list_drop(@@sql_mode, 'ONLY_FULL_GROUP_BY'); +mariadb> set sql_mode = sys.list_drop(@@sql_mode, 'ONLY_FULL_GROUP_BY'); Query OK, 0 rows affected (0.03 sec) -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +----------------------------------------------------------------------------+ | @@sql_mode | +----------------------------------------------------------------------------+ @@ -3721,7 +3721,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_account_enabled('localhost', 'root'); +mariadb> SELECT sys.ps_is_account_enabled('localhost', 'root'); +------------------------------------------------+ | sys.ps_is_account_enabled('localhost', 'root') | +------------------------------------------------+ @@ -3746,7 +3746,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_consumer_enabled('events_stages_history'); +mariadb> SELECT sys.ps_is_consumer_enabled('events_stages_history'); +-----------------------------------------------------+ | sys.ps_is_consumer_enabled('events_stages_history') | +-----------------------------------------------------+ @@ -3759,7 +3759,7 @@ mysql> SELECT sys.ps_is_consumer_enabled('events_stages_history'); ##### Description -Returns whether an instrument is enabled by default in this version of MySQL. +Returns whether an instrument is enabled by default in this version of MariaDB. ##### Parameters @@ -3771,7 +3771,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +mariadb> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +--------------------------------------------------------------+ | sys.ps_is_instrument_default_enabled('statement/sql/select') | +--------------------------------------------------------------+ @@ -3784,7 +3784,7 @@ mysql> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); ##### Description -Returns whether an instrument is timed by default in this version of MySQL. +Returns whether an instrument is timed by default in this version of MariaDB. ##### Parameters @@ -3796,7 +3796,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +mariadb> SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +------------------------------------------------------------+ | sys.ps_is_instrument_default_timed('statement/sql/select') | +------------------------------------------------------------+ @@ -3821,7 +3821,7 @@ ENUM('YES', 'NO', 'UNKNOWN') ##### Example ```SQL -mysql> SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +mariadb> SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +------------------------------------------------+ | sys.ps_is_thread_instrumented(CONNECTION_ID()) | +------------------------------------------------+ @@ -3846,7 +3846,7 @@ BIGINT UNSIGNED ##### Example ```SQL -mysql> SELECT sys.ps_thread_id(79); +mariadb> SELECT sys.ps_thread_id(79); +----------------------+ | sys.ps_thread_id(79) | +----------------------+ @@ -3854,7 +3854,7 @@ mysql> SELECT sys.ps_thread_id(79); +----------------------+ 1 row in set (0.00 sec) -mysql> SELECT sys.ps_thread_id(CONNECTION_ID()); +mariadb> SELECT sys.ps_thread_id(CONNECTION_ID()); +-----------------------------------+ | sys.ps_thread_id(CONNECTION_ID()) | +-----------------------------------+ @@ -3878,12 +3878,11 @@ Outputs a JSON formatted stack of all statements, stages and events within Perfo (line separation added for output) ```SQL - mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G + mariadb> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G *************************** 1. row *************************** -thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2014-02-19 13:39:03", -"mysql_version": "5.7.3-m13","mysql_user": "root@localhost","events": -[{"nesting_event_id": "0", "event_id": "10", "timer_wait": 256.35, "event_info": -"sql/select", "wait_info": "select @@version_comment limit 1\nerrors: 0\nwarnings: 0\nlock time: +thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2024-09-04 21:21:44", +"mysql_version": "10.6.19-MariaDB","mysql_user": "msandbox@localhost","events": []} + ... ``` @@ -4000,7 +3999,7 @@ TEXT ##### Example ```SQL -mysql> SELECT sys.quote_identifier('my_identifier') AS Identifier; +mariadb> SELECT sys.quote_identifier('my_identifier') AS Identifier; +-----------------+ | Identifier | +-----------------+ @@ -4008,7 +4007,7 @@ mysql> SELECT sys.quote_identifier('my_identifier') AS Identifier; +-----------------+ 1 row in set (0.00 sec) -mysql> SELECT sys.quote_identifier('my`idenfier') AS Identifier; +mariadb> SELECT sys.quote_identifier('my`idenfier') AS Identifier; +----------------+ | Identifier | +----------------+ @@ -4050,7 +4049,7 @@ VARCHAR(128) ##### Example ```SQL -- Get the configuration value from sys.sys_config falling back on 128 if the option is not present in the table. -mysql> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; +mariadb> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; +-------+ | Value | +-------+ @@ -4059,7 +4058,7 @@ mysql> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; 1 row in set (0.00 sec) -- Check whether the option is already set, if not assign - IFNULL(...) one liner example. -mysql> SET @sys.statement_truncate_len = IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 64)); +mariadb> SET @sys.statement_truncate_len = IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 64)); Query OK, 0 rows affected (0.00 sec) -- Check whether the option is already set, if not assign - IF ... THEN ... END IF example. @@ -4072,7 +4071,7 @@ END IF; ##### Description -Returns the major version of MySQL Server. +Returns the major version of MariaDB Server. ##### Returns @@ -4080,12 +4079,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.version_major(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_major() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 5 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.version_major(); ++-----------------+---------------------+ +| VERSION() | sys.version_major() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 10 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4093,7 +4092,7 @@ mysql> SELECT VERSION(), sys.version_major(); ##### Description -Returns the minor (release series) version of MySQL Server. +Returns the minor (release series) version of MariaDB Server. ##### Returns @@ -4101,12 +4100,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.server_minor(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_minor() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 7 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.server_minor(); ++-----------------+---------------------+ +| VERSION() | sys.version_minor() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 6 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4114,7 +4113,7 @@ mysql> SELECT VERSION(), sys.server_minor(); ##### Description -Returns the patch release version of MySQL Server. +Returns the patch release version of MariaDB Server. ##### Returns @@ -4122,12 +4121,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.version_patch(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_patch() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 9 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.version_patch(); ++-----------------+---------------------+ +| VERSION() | sys.version_patch() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 19 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4151,7 +4150,7 @@ Useful for creating a "ps" synonym for "performance_schema", or "is" instead of ##### Example ```SQL -mysql> SHOW DATABASES; +mariadb> SHOW DATABASES; +--------------------+ | Database | +--------------------+ @@ -4163,7 +4162,7 @@ mysql> SHOW DATABASES; +--------------------+ 5 rows in set (0.00 sec) -mysql> CALL sys.create_synonym_db('performance_schema', 'ps'); +mariadb> CALL sys.create_synonym_db('performance_schema', 'ps'); +---------------------------------------+ | summary | +---------------------------------------+ @@ -4173,7 +4172,7 @@ mysql> CALL sys.create_synonym_db('performance_schema', 'ps'); Query OK, 0 rows affected (8.57 sec) -mysql> SHOW DATABASES; +mariadb> SHOW DATABASES; +--------------------+ | Database | +--------------------+ @@ -4186,7 +4185,7 @@ mysql> SHOW DATABASES; +--------------------+ 6 rows in set (0.00 sec) -mysql> SHOW FULL TABLES FROM ps; +mariadb> SHOW FULL TABLES FROM ps; +-----------------------------------------+------------+ | Tables_in_ps | Table_type | +-----------------------------------------+------------+ @@ -4206,7 +4205,6 @@ Create a report of the current status of the server for diagnostics purposes. Da * The GLOBAL VARIABLES * Several sys schema views including metrics or equivalent (depending on version and settings) * Queries in the 95th percentile -* Several ndbinfo views for MySQL Cluster * Replication (both master and slave) information. Some of the sys schema views are calculated as initial (optional), overall, delta: @@ -4224,10 +4222,6 @@ Some of the sys schema views are calculated as initial (optional), overall, delt Requires the SUPER privilege for "SET sql_log_bin = 0;". -Versions supported: -* MySQL 5.6: 5.6.10 and later -* MySQL 5.7: 5.7.9 and later - Some configuration options are supported: * sys.diagnostics.allow_i_s_tables @@ -4269,10 +4263,10 @@ Supported values are: ##### Example ```SQL -mysql> TEE diag.out; -mysql> CALL sys.diagnostics(120, 30, 'current'); +mariadb> TEE diag.out; +mariadb> CALL sys.diagnostics(120, 30, 'current'); ... -mysql> NOTEE; +mariadb> NOTEE; ``` #### ps_setup_disable_background_threads @@ -4287,7 +4281,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_disable_background_threads(); +mariadb> CALL sys.ps_setup_disable_background_threads(); +--------------------------------+ | summary | +--------------------------------+ @@ -4318,7 +4312,7 @@ The following configuration option is supported: ##### Example ```SQL -mysql> CALL sys.execute_prepared_stmt('SELECT * FROM sys.sys_config'); +mariadb> CALL sys.execute_prepared_stmt('SELECT * FROM sys.sys_config'); +------------------------+-------+---------------------+--------+ | variable | value | set_time | set_by | +------------------------+-------+---------------------+--------+ @@ -4343,7 +4337,7 @@ Disables consumers within Performance Schema matching the input pattern. To disable all consumers: ```SQL -mysql> CALL sys.ps_setup_disable_consumer(''); +mariadb> CALL sys.ps_setup_disable_consumer(''); +--------------------------+ | summary | +--------------------------+ @@ -4354,7 +4348,7 @@ mysql> CALL sys.ps_setup_disable_consumer(''); To disable just the event_stage consumers: ```SQL -mysql> CALL sys.ps_setup_disable_consumer('stage'); +mariadb> CALL sys.ps_setup_disable_consumer('stage'); +------------------------+ | summary | +------------------------+ @@ -4377,7 +4371,7 @@ Disables instruments within Performance Schema matching the input pattern. To disable all mutex instruments: ```SQL -mysql> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); +mariadb> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); +--------------------------+ | summary | +--------------------------+ @@ -4387,7 +4381,7 @@ mysql> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); ``` To disable just a specific TCP/IP based network IO instrument: ```SQL -mysql> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_socket'); +mariadb> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_socket'); +------------------------+ | summary | +------------------------+ @@ -4397,7 +4391,7 @@ mysql> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_soc ``` To disable all instruments: ```SQL -mysql> CALL sys.ps_setup_disable_instrument(''); +mariadb> CALL sys.ps_setup_disable_instrument(''); +--------------------------+ | summary | +--------------------------+ @@ -4418,7 +4412,7 @@ Disable the given connection/thread in Performance Schema. ##### Example ```SQL -mysql> CALL sys.ps_setup_disable_thread(3); +mariadb> CALL sys.ps_setup_disable_thread(3); +-------------------+ | summary | +-------------------+ @@ -4428,7 +4422,7 @@ mysql> CALL sys.ps_setup_disable_thread(3); ``` To disable the current connection: ```SQL -mysql> CALL sys.ps_setup_disable_thread(CONNECTION_ID()); +mariadb> CALL sys.ps_setup_disable_thread(CONNECTION_ID()); +-------------------+ | summary | +-------------------+ @@ -4449,7 +4443,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_enable_background_threads(); +mariadb> CALL sys.ps_setup_enable_background_threads(); +-------------------------------+ | summary | +-------------------------------+ @@ -4472,7 +4466,7 @@ Enables consumers within Performance Schema matching the input pattern. To enable all consumers: ```SQL -mysql> CALL sys.ps_setup_enable_consumer(''); +mariadb> CALL sys.ps_setup_enable_consumer(''); +-------------------------+ | summary | +-------------------------+ @@ -4483,7 +4477,7 @@ mysql> CALL sys.ps_setup_enable_consumer(''); To enable just "waits" consumers: ```SQL -mysql> CALL sys.ps_setup_enable_consumer('waits'); +mariadb> CALL sys.ps_setup_enable_consumer('waits'); +-----------------------+ | summary | +-----------------------+ @@ -4507,7 +4501,7 @@ Enables instruments within Performance Schema matching the input pattern. To enable all mutex instruments: ```SQL -mysql> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); +mariadb> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); +-------------------------+ | summary | +-------------------------+ @@ -4517,7 +4511,7 @@ mysql> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); ``` To enable just a specific TCP/IP based network IO instrument: ```SQL -mysql> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_socket'); +mariadb> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_socket'); +-----------------------+ | summary | +-----------------------+ @@ -4527,7 +4521,7 @@ mysql> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_sock ``` To enable all instruments: ```SQL -mysql> CALL sys.ps_setup_enable_instrument(''); +mariadb> CALL sys.ps_setup_enable_instrument(''); +-------------------------+ | summary | +-------------------------+ @@ -4549,7 +4543,7 @@ Enable the given connection/thread in Performance Schema. ##### Example ```SQL -mysql> CALL sys.ps_setup_enable_thread(3); +mariadb> CALL sys.ps_setup_enable_thread(3); +------------------+ | summary | +------------------+ @@ -4559,7 +4553,7 @@ mysql> CALL sys.ps_setup_enable_thread(3); ``` To enable the current connection: ```SQL -mysql> CALL sys.ps_setup_enable_thread(CONNECTION_ID()); +mariadb> CALL sys.ps_setup_enable_thread(CONNECTION_ID()); +------------------+ | summary | +------------------+ @@ -4584,16 +4578,16 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_save(); +mariadb> CALL sys.ps_setup_save(); Query OK, 0 rows affected (0.08 sec) -mysql> UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +mariadb> UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; Query OK, 547 rows affected (0.40 sec) Rows matched: 784 Changed: 547 Warnings: 0 /* Run some tests that need more detailed instrumentation here */ -mysql> CALL sys.ps_setup_reload_saved(); +mariadb> CALL sys.ps_setup_reload_saved(); Query OK, 0 rows affected (0.32 sec) ``` @@ -4609,7 +4603,7 @@ Resets the Performance Schema setup to the default settings. ##### Example ```SQL -mysql> CALL sys.ps_setup_reset_to_default(true)\G +mariadb> CALL sys.ps_setup_reset_to_default(true)\G *************************** 1. row *************************** status: Resetting: setup_actors DELETE @@ -4624,7 +4618,7 @@ VALUES ('%', '%', '%') 1 row in set (0.00 sec) ... -mysql> CALL sys.ps_setup_reset_to_default(false)\G +mariadb> CALL sys.ps_setup_reset_to_default(false)\G Query OK, 0 rows affected (0.00 sec) ``` @@ -4648,17 +4642,17 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> CALL sys.ps_setup_save(-1); +mariadb> CALL sys.ps_setup_save(-1); Query OK, 0 rows affected (0.08 sec) -mysql> UPDATE performance_schema.setup_instruments +mariadb> UPDATE performance_schema.setup_instruments -> SET enabled = 'YES', timed = 'YES'; Query OK, 547 rows affected (0.40 sec) Rows matched: 784 Changed: 547 Warnings: 0 /* Run some tests that need more detailed instrumentation here */ -mysql> CALL sys.ps_setup_reload_saved(); +mariadb> CALL sys.ps_setup_reload_saved(); Query OK, 0 rows affected (0.32 sec) ``` @@ -4666,10 +4660,8 @@ Query OK, 0 rows affected (0.32 sec) ##### Description -Shows all currently disable Performance Schema configuration. +Shows all currently disabled Performance Schema configurations. -Disabled users is only available for MySQL 5.7.6 and later. -In earlier versions it was only possible to enable users. ##### Parameters @@ -4678,7 +4670,7 @@ In earlier versions it was only possible to enable users. ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled(TRUE, TRUE); +mariadb> CALL sys.ps_setup_show_disabled(TRUE, TRUE); +----------------------------+ | performance_schema_enabled | +----------------------------+ @@ -4761,7 +4753,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled_consumers(); +mariadb> CALL sys.ps_setup_show_disabled_consumers(); +---------------------------+ | disabled_consumers | @@ -4787,7 +4779,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled_instruments(); +mariadb> CALL sys.ps_setup_show_disabled_instruments(); ``` #### ps_setup_show_enabled @@ -4803,7 +4795,7 @@ Shows all currently enabled Performance Schema configuration. ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled(TRUE, TRUE); +mariadb> CALL sys.ps_setup_show_enabled(TRUE, TRUE); +----------------------------+ | performance_schema_enabled | +----------------------------+ @@ -4895,7 +4887,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled_consumers(); +mariadb> CALL sys.ps_setup_show_enabled_consumers(); +---------------------------+ | enabled_consumers | @@ -4921,7 +4913,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled_instruments(); +mariadb> CALL sys.ps_setup_show_enabled_instruments(); ``` #### ps_statement_avg_latency_histogram @@ -4938,7 +4930,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_statement_avg_latency_histogram()\G +mariadb> CALL sys.ps_statement_avg_latency_histogram()\G *************************** 1. row *************************** Performance Schema Statement Digest Average Latency Histogram: @@ -4996,7 +4988,7 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> call ps_analyze_statement_digest('891ec6860f98ba46d89dd20b0c03652c', 10, 0.1, true, true); +mariadb> call ps_analyze_statement_digest('891ec6860f98ba46d89dd20b0c03652c', 10, 0.1, true, true); +--------------------+ | SUMMARY STATISTICS | +--------------------+ @@ -5091,7 +5083,7 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> CALL sys.ps_trace_thread(25, CONCAT('/tmp/stack-', REPLACE(NOW(), ' ', '-'), '.dot'), NULL, NULL, TRUE, TRUE, TRUE); +mariadb> CALL sys.ps_trace_thread(25, CONCAT('/tmp/stack-', REPLACE(NOW(), ' ', '-'), '.dot'), NULL, NULL, TRUE, TRUE, TRUE); +-------------------+ | summary | +-------------------+ @@ -5147,7 +5139,7 @@ Truncates all summary tables within Performance Schema, resetting all aggregated ##### Example ```SQL -mysql> CALL sys.ps_truncate_all_tables(false); +mariadb> CALL sys.ps_truncate_all_tables(false); +---------------------+ | summary | +---------------------+ @@ -5252,22 +5244,22 @@ The following configuration options are supported: -- 6. Perform analyzis based on the new snapshot. -- 7. Perform analyzis based on the delta between the initial and new snapshots. -mysql> CALL sys.statement_performance_analyzer('create_tmp', 'mydb.tmp_digests_ini', NULL); +mariadb> CALL sys.statement_performance_analyzer('create_tmp', 'mydb.tmp_digests_ini', NULL); Query OK, 0 rows affected (0.08 sec) -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.02 sec) -mysql> CALL sys.statement_performance_analyzer('save', 'mydb.tmp_digests_ini', NULL); +mariadb> CALL sys.statement_performance_analyzer('save', 'mydb.tmp_digests_ini', NULL); Query OK, 0 rows affected (0.00 sec) -mysql> DO SLEEP(60); +mariadb> DO SLEEP(60); Query OK, 0 rows affected (1 min 0.00 sec) -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.02 sec) -mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +mariadb> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5277,7 +5269,7 @@ mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_i ... -mysql> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +mariadb> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5290,13 +5282,13 @@ mysql> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', -- To create an overall report of the 95th percentile queries and the top 10 queries with full table scans: -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.01 sec) -mysql> SET @sys.statement_performance_analyzer.limit = 10; +mariadb> SET @sys.statement_performance_analyzer.limit = 10; Query OK, 0 rows affected (0.00 sec) -mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile,with_full_table_scans'); +mariadb> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile,with_full_table_scans'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5319,7 +5311,7 @@ mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_i -- Use a custom view showing the top 10 query sorted by total execution time refreshing the view every minute using -- the watch command in Linux. -mysql> CREATE OR REPLACE VIEW mydb.my_statements AS +mariadb> CREATE OR REPLACE VIEW mydb.my_statements AS -> SELECT sys.format_statement(DIGEST_TEXT) AS query, -> SCHEMA_NAME AS db, -> COUNT_STAR AS exec_count, @@ -5333,10 +5325,10 @@ mysql> CREATE OR REPLACE VIEW mydb.my_statements AS -> ORDER BY SUM_TIMER_WAIT DESC; Query OK, 0 rows affected (0.01 sec) -mysql> CALL sys.statement_performance_analyzer('create_table', 'mydb.digests_prev', NULL); +mariadb> CALL sys.statement_performance_analyzer('create_table', 'mydb.digests_prev', NULL); Query OK, 0 rows affected (0.10 sec) -shell$ watch -n 60 "mysql sys --table -e \" +shell$ watch -n 60 "mariadb sys --table -e \" > SET @sys.statement_performance_analyzer.view = 'mydb.my_statements'; > SET @sys.statement_performance_analyzer.limit = 10; > CALL statement_performance_analyzer('snapshot', NULL, NULL); @@ -5344,7 +5336,7 @@ shell$ watch -n 60 "mysql sys --table -e \" > CALL statement_performance_analyzer('save', 'mydb.digests_prev', NULL); > \"" -Every 60.0s: mysql sys --table -e " ... Mon Dec 22 10:58:51 2014 +Every 60.0s: mariadb sys --table -e " ... Mon Dec 22 10:58:51 2014 +----------------------------------+ | Next Output | @@ -5379,24 +5371,24 @@ name, then 'TEMPORARY' will be returned. ##### Example ```SQL -mysql> CREATE DATABASE db1; +mariadb> CREATE DATABASE db1; Query OK, 1 row affected (0.07 sec) -mysql> use db1; +mariadb> use db1; Database changed -mysql> CREATE TABLE t1 (id INT PRIMARY KEY); +mariadb> CREATE TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.08 sec) -mysql> CREATE TABLE t2 (id INT PRIMARY KEY); +mariadb> CREATE TABLE t2 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.08 sec) -mysql> CREATE view v_t1 AS SELECT * FROM t1; +mariadb> CREATE view v_t1 AS SELECT * FROM t1; Query OK, 0 rows affected (0.00 sec) -mysql> CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); +mariadb> CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.00 sec) -mysql> CALL sys.table_exists('db1', 't1', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't1', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +------------+ @@ -5406,7 +5398,7 @@ Query OK, 0 rows affected (0.00 sec) +------------+ 1 row in set (0.00 sec) -mysql> CALL sys.table_exists('db1', 't2', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't2', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +------------+ @@ -5416,7 +5408,7 @@ Query OK, 0 rows affected (0.00 sec) +------------+ 1 row in set (0.01 sec) -mysql> CALL sys.table_exists('db1', 'v_t1', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 'v_t1', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +---------+ @@ -5426,7 +5418,7 @@ Query OK, 0 rows affected (0.00 sec) +---------+ 1 row in set (0.00 sec) -mysql> CALL sys.table_exists('db1', 't3', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't3', @exists); SELECT @exists; Query OK, 0 rows affected (0.01 sec) +---------+ From 4972f9fc0f8bc0d8e85be1291b2bcbc64d3dd6f1 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 5 Sep 2024 16:24:16 +0530 Subject: [PATCH 037/185] MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently - Remove the usage of alter_algorithm variable and disable the persistent statistics in alter_copy_bulk test case. --- .../suite/innodb/r/alter_copy_bulk,OFF.rdiff | 6 ++--- .../suite/innodb/r/alter_copy_bulk.result | 22 ++++++++++--------- .../suite/innodb/t/alter_copy_bulk.test | 22 ++++++++++--------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff b/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff index a644139ea78..6570c52def1 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff +++ b/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff @@ -1,9 +1,9 @@ --- bulk_copy_alter.result +++ bulk_copy_alter,non_bulk_alter_copy.result -@@ -5,7 +5,7 @@ +@@ -6,7 +6,7 @@ INSERT INTO t1 SELECT repeat('b', 200), seq FROM seq_3_to_65536; - ALTER TABLE t1 ADD INDEX(f2); - ALTER TABLE t1 ADD PRIMARY KEY(f1(2)); + ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); + ALTER TABLE t1 ALGORITHM=COPY, ADD PRIMARY KEY(f1(2)); -ERROR 23000: Duplicate entry 'bb' for key 'PRIMARY' +ERROR 23000: Duplicate entry 'aa' for key 'PRIMARY' INSERT INTO t1 VALUES(repeat('a', 200), 1); diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk.result b/mysql-test/suite/innodb/r/alter_copy_bulk.result index 53c7e8a812d..cd83e65a5f4 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk.result +++ b/mysql-test/suite/innodb/r/alter_copy_bulk.result @@ -1,10 +1,11 @@ -SET @@alter_algorithm=COPY; +SET @default_stats_persistent= @@global.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= 0; CREATE TABLE t1(f1 CHAR(200), f2 INT NOT NULL)engine=InnoDB; INSERT INTO t1 SELECT repeat('a', 200), seq FROM seq_1_to_2; -ALTER TABLE t1 FORCE; +ALTER TABLE t1 ALGORITHM=COPY, FORCE; INSERT INTO t1 SELECT repeat('b', 200), seq FROM seq_3_to_65536; -ALTER TABLE t1 ADD INDEX(f2); -ALTER TABLE t1 ADD PRIMARY KEY(f1(2)); +ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); +ALTER TABLE t1 ALGORITHM=COPY, ADD PRIMARY KEY(f1(2)); ERROR 23000: Duplicate entry 'bb' for key 'PRIMARY' INSERT INTO t1 VALUES(repeat('a', 200), 1); ALTER TABLE t1 ADD UNIQUE KEY(f2); @@ -13,14 +14,14 @@ ALTER IGNORE TABLE t1 MODIFY f1 CHAR(200) NOT NULL; CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2))ENGINE=InnoDB; INSERT INTO t2 VALUES(1); -ALTER TABLE t2 FORCE; +ALTER TABLE t2 ALGORITHM=COPY, FORCE; DROP TABLE t2, t1; CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2; INSERT INTO t1 VALUES(1, 1); INSERT INTO t1 SELECT seq, seq * 2 FROM seq_1_to_2; -ALTER TABLE t1 FORCE; +ALTER TABLE t1 ALGORITHM=COPY, FORCE; INSERT INTO t1 SELECT seq, seq * 2 FROM seq_3_to_65536; -ALTER TABLE t1 ADD INDEX(f2); +ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); DROP TABLE t1; # # MDEV-34756 Validation of new foreign key skipped @@ -39,13 +40,14 @@ ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`#sql-alter`, CONSTRAINT `#sql-alter_ibfk_2` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)) INSERT INTO t1 VALUES(3, 1); SET STATEMENT foreign_key_checks=0 FOR -ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); +ALTER TABLE t2 ALGORITHM=COPY, ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 FORCE; +ALTER TABLE t1 ALGORITHM=COPY, FORCE; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 0 -ALTER TABLE t2 FORCE; +ALTER TABLE t2 ALGORITHM=COPY, FORCE; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t2, t1; +SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/t/alter_copy_bulk.test b/mysql-test/suite/innodb/t/alter_copy_bulk.test index ae815cd4e30..2e8764578d5 100644 --- a/mysql-test/suite/innodb/t/alter_copy_bulk.test +++ b/mysql-test/suite/innodb/t/alter_copy_bulk.test @@ -1,21 +1,22 @@ --source include/have_innodb.inc --source include/have_partition.inc --source include/have_sequence.inc -SET @@alter_algorithm=COPY; +SET @default_stats_persistent= @@global.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= 0; CREATE TABLE t1(f1 CHAR(200), f2 INT NOT NULL)engine=InnoDB; INSERT INTO t1 SELECT repeat('a', 200), seq FROM seq_1_to_2; # Buffer fits in the memory -ALTER TABLE t1 FORCE; +ALTER TABLE t1 ALGORITHM=COPY, FORCE; # Insert more entries INSERT INTO t1 SELECT repeat('b', 200), seq FROM seq_3_to_65536; # Alter should use temporary file for sorting -ALTER TABLE t1 ADD INDEX(f2); +ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); # Error while buffering the insert operation --error ER_DUP_ENTRY -ALTER TABLE t1 ADD PRIMARY KEY(f1(2)); +ALTER TABLE t1 ALGORITHM=COPY, ADD PRIMARY KEY(f1(2)); INSERT INTO t1 VALUES(repeat('a', 200), 1); # Error while applying the bulk insert operation @@ -29,18 +30,18 @@ CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2))ENGINE=InnoDB; INSERT INTO t2 VALUES(1); # Bulk operation shouldn't happen because of foreign key constraints -ALTER TABLE t2 FORCE; +ALTER TABLE t2 ALGORITHM=COPY, FORCE; DROP TABLE t2, t1; CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2; INSERT INTO t1 VALUES(1, 1); INSERT INTO t1 SELECT seq, seq * 2 FROM seq_1_to_2; # Buffer fits in the memory -ALTER TABLE t1 FORCE; +ALTER TABLE t1 ALGORITHM=COPY, FORCE; # Insert more entries INSERT INTO t1 SELECT seq, seq * 2 FROM seq_3_to_65536; # Alter should use temporary file for sorting -ALTER TABLE t1 ADD INDEX(f2); +ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); DROP TABLE t1; --echo # @@ -62,8 +63,9 @@ ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); INSERT INTO t1 VALUES(3, 1); --enable_info SET STATEMENT foreign_key_checks=0 FOR -ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); -ALTER TABLE t1 FORCE; -ALTER TABLE t2 FORCE; +ALTER TABLE t2 ALGORITHM=COPY, ADD CONSTRAINT FOREIGN KEY(f2) REFERENCES t1(f1); +ALTER TABLE t1 ALGORITHM=COPY, FORCE; +ALTER TABLE t2 ALGORITHM=COPY, FORCE; --disable_info DROP TABLE t2, t1; +SET GLOBAL innodb_stats_persistent=@default_stats_persistent; From 19cea738342737503f47cfe6ff67d5248b0a0961 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 5 Sep 2024 13:24:22 +0200 Subject: [PATCH 038/185] Cleanup - make sure all members of table_load_params are initialized Alexey Botchkov complains there are problems with empty curly brackets initializer in old-ish gcc(4.9) Can't verify, but making all members are initialized by default constructor is easy enough. --- client/mysqlimport.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqlimport.cc b/client/mysqlimport.cc index b8c92b76950..be60bade00c 100644 --- a/client/mysqlimport.cc +++ b/client/mysqlimport.cc @@ -81,7 +81,7 @@ struct table_load_params CREATE VIEW */ std::string tablename; /* name of the table */ std::string dbname; /* name of the database */ - ulonglong size; /* size of the data file */ + ulonglong size= 0; /* size of the data file */ }; std::unordered_set ignore_databases; @@ -1017,7 +1017,7 @@ static void scan_backup_dir(const char *dir, } for (size_t j= 0; j < dir_info2->number_of_files; j++) { - table_load_params par{}; + table_load_params par; par.dbname= dbname; fi= &dir_info2->dir_entry[j]; if (has_extension(fi->name, ".sql") || has_extension(fi->name, ".txt")) From 2c3e07df473e26807f097e7a5905f004ef53e890 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 6 Sep 2024 11:34:31 +1000 Subject: [PATCH 039/185] MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 The memory leak happened on second execution of a prepared statement that runs UPDATE statement with correlated subquery in right hand side of the SET clause. In this case, invocation of the method table->stat_records() could return the zero value that results in going into the 'if' branch that handles impossible where condition. The issue is that this condition branch missed saving of leaf tables that has to be performed as first condition optimization activity. Later the PS statement memory root is marked as read only on finishing first time execution of the prepared statement. Next time the same statement is executed it hits the assertion on attempt to allocate a memory on the PS memory root marked as read only. This memory allocation takes place by the sequence of the following invocations: Prepared_statement::execute mysql_execute_command Sql_cmd_dml::execute Sql_cmd_update::execute_inner Sql_cmd_update::update_single_table st_select_lex::save_leaf_tables List::push_back To fix the issue, add the flag SELECT_LEX::leaf_tables_saved to control whether the method SELECT_LEX::save_leaf_tables() has to be called or it has been already invoked and no more invocation required. Similar issue could take place on running the DELETE statement with the LIMIT clause in PS/SP mode. The reason of memory leak is the same as for UPDATE case and be fixed in the same way. --- mysql-test/main/ps_mem_leaks.result | 30 ++++++++++++++++++++++++++ mysql-test/main/ps_mem_leaks.test | 33 +++++++++++++++++++++++++++++ sql/sql_delete.cc | 11 ++++++++-- sql/sql_insert.cc | 4 ++-- sql/sql_lex.cc | 1 + sql/sql_lex.h | 4 ++++ sql/sql_select.cc | 4 +++- sql/sql_update.cc | 11 ++++++++-- 8 files changed, 91 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index 2ddf47a992c..309433e1eb7 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -89,3 +89,33 @@ f DEALLOCATE PREPARE stmt; DROP TABLE t1; # End of 10.4 tests +# +# MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +# +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +id value +1 1 +2 1 +3 NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +# Memory leak also could take place on running the DELETE statement +# with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); +CREATE PROCEDURE p1(p1 INT) +DELETE FROM t1 LIMIT p1; +CALL p1(0); +CALL p1(1); +CALL p1(2); +# Clean up +DROP TABLE t1; +DROP PROCEDURE p1; +# End of 10.5 tests diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index dacb4ecabba..c0404687eb7 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -110,3 +110,36 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +--echo # +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); + +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +--echo # Memory leak also could take place on running the DELETE statement +--echo # with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); + +CREATE PROCEDURE p1(p1 INT) + DELETE FROM t1 LIMIT p1; + +CALL p1(0); +CALL p1(1); +CALL p1(2); + +--echo # Clean up +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # End of 10.5 tests diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 99da79c599b..ea6b5e6ff66 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -530,6 +530,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, */ if (unlikely(thd->is_error())) DBUG_RETURN(TRUE); + + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd, 0); DBUG_RETURN(0); // Nothing to delete } @@ -902,10 +909,10 @@ cleanup: query_cache_invalidate3(thd, table_list, 1); } - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } delete deltempfile; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index cf3ec929d09..46486e09a8b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1373,10 +1373,10 @@ values_loop_end: ::my_ok(thd, info.copied + info.deleted + updated, id, buff); } thd->abort_on_warning= 0; - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } my_free(readbuff); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2dc5d119fd5..fc39bd858f8 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3023,6 +3023,7 @@ void st_select_lex::init_query() olap= UNSPECIFIED_OLAP_TYPE; having_fix_field= 0; having_fix_field_for_pushed_cond= 0; + leaf_tables_saved= false; context.select_lex= this; context.init(); cond_count= between_count= with_wild= 0; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 0a88e92d723..e0cb336de5a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1182,6 +1182,10 @@ public: */ bool have_merged_subqueries; + /** + Flag to guard against double initialization of leaf tables list + */ + bool leaf_tables_saved; List leaf_tables; List leaf_tables_exec; List leaf_tables_prep; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 93b53699c9a..ea690422eac 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2054,12 +2054,14 @@ JOIN::optimize_inner() /* Convert all outer joins to inner joins if possible */ conds= simplify_joins(this, join_list, conds, TRUE, FALSE); - if (thd->is_error() || select_lex->save_leaf_tables(thd)) + if (thd->is_error() || + (!select_lex->leaf_tables_saved && select_lex->save_leaf_tables(thd))) { if (arena) thd->restore_active_arena(arena, &backup); DBUG_RETURN(1); } + select_lex->leaf_tables_saved= true; build_bitmap_for_nested_joins(join_list, 0); sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index adb209b7b56..c2868d8165e 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -598,6 +598,13 @@ int mysql_update(THD *thd, { DBUG_RETURN(1); // Error in where } + + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd); // No matching records DBUG_RETURN(0); } @@ -1366,10 +1373,10 @@ update_end: } thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ thd->abort_on_warning= 0; - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); - thd->lex->current_select->first_cond_optimization= 0; + thd->lex->current_select->leaf_tables_saved= true; } *found_return= found; *updated_return= updated; From 00cb3440858dd8462e0a8f847ae486d363fdb2d1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 16 Aug 2024 17:04:23 +1000 Subject: [PATCH 040/185] MDEV-33858 Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON Simply adding tests as the bug is fixed with a backport of MDEV-34447 --- mysql-test/main/ps_mem_leaks.result | 9 +++++++++ mysql-test/main/ps_mem_leaks.test | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index 309433e1eb7..da7fe3a3344 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -118,4 +118,13 @@ CALL p1(2); # Clean up DROP TABLE t1; DROP PROCEDURE p1; +# +# MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON +# +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +PREPARE stmt FROM "UPDATE t SET a = 0 LIMIT ?"; +EXECUTE stmt USING 0; +EXECUTE stmt USING 1; +DROP TABLE t; # End of 10.5 tests diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index c0404687eb7..1358ef7613e 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -142,4 +142,17 @@ CALL p1(2); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON +--echo # + +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); # Optional, fails either way +PREPARE stmt FROM "UPDATE t SET a = 0 LIMIT ?"; +EXECUTE stmt USING 0; +EXECUTE stmt USING 1; + +# CLeanup +DROP TABLE t; + --echo # End of 10.5 tests From e886c2ba02ac021c648f84aa8f910af4fb4fb4bb Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 21 Aug 2024 15:47:37 +1000 Subject: [PATCH 041/185] MDEV-34757 Check leaf_tables_saved in partition pruning in UPDATE and DELETE --- mysql-test/main/ps_mem_leaks.result | 198 ++++++++++++++++++++++++++++ mysql-test/main/ps_mem_leaks.test | 168 +++++++++++++++++++++++ sql/sql_delete.cc | 6 + sql/sql_update.cc | 6 + 4 files changed, 378 insertions(+) diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index da7fe3a3344..8acfb779bc5 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -119,6 +119,204 @@ CALL p1(2); DROP TABLE t1; DROP PROCEDURE p1; # +# MDEV-34757: assertion of (mem_root->flags & 4) == 0 fails in 2nd ps execution with partition pruning +# +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +id value +1 10 +2 10 +3 10 +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (null,1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +select * from t1; +a +1 +2 +1 +3 +deallocate prepare stmt; +drop table t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (null,1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Using buffer +2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +select * from t1; +a +1 +2 +3 +4 +deallocate prepare stmt; +drop table t1, t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +execute stmt using @var1, @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +deallocate prepare stmt; +DROP TABLE t1,t2; +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); +CREATE PROCEDURE p1(p1 INT) +EXPLAIN DELETE FROM t1 LIMIT p1; +CALL p1(0); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +CALL p1(1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +CALL p1(2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +# Clean up +DROP TABLE t1; +DROP PROCEDURE p1; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +select * from t1; +a +1 +2 +3 +deallocate prepare stmt; +drop table t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 where a = ?'; +execute stmt using @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +select * from t1; +a +1 +2 +3 +4 +deallocate prepare stmt; +drop table t1, t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +execute stmt using @var1, @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 3 Deleting all rows +deallocate prepare stmt; +DROP TABLE t1,t2; +# # MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON # CREATE TABLE t (a INT); diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index 1358ef7613e..907f0eb6bba 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -5,6 +5,7 @@ # The cmake option -DWITH_PROTECT_STATEMENT_MEMROOT is used only # for debug build --source include/have_debug.inc +--source include/have_partition.inc --echo # --echo # MDEV-32369: Memory leak when executing PS for query with IN subquery @@ -142,6 +143,173 @@ CALL p1(2); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # MDEV-34757: assertion of (mem_root->flags & 4) == 0 fails in 2nd ps execution with partition pruning +--echo # +# same as the first MDEV-34444 testcase but with explain +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); + +PREPARE stmt FROM 'EXPLAIN UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +# we are testing 2nd ps assertion failure, not explain output, which +# may vary from version to version +--disable_result_log +EXECUTE stmt; +--enable_result_log +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +--disable_result_log +EXECUTE stmt; +--enable_result_log +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +# 2nd ps mem leak; partition pruning +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (null,1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# same but with explain +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (null,1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# top level impossible where +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# top level impossible where, with explain +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# Now we do delete instead of update + +# same as the second MDEV-34447 testcase but with explain +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); + +CREATE PROCEDURE p1(p1 INT) + EXPLAIN DELETE FROM t1 LIMIT p1; + +CALL p1(0); +CALL p1(1); +CALL p1(2); + +--echo # Clean up +DROP TABLE t1; +DROP PROCEDURE p1; + +# partition pruning +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# same but with explain +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# top level impossible where +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# top level impossible where, with explain +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + --echo # --echo # MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON --echo # diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index ea6b5e6ff66..67d07c3ff44 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -500,6 +500,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (thd->lex->describe || thd->lex->analyze_stmt) goto produce_explain_and_leave; + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd, 0); DBUG_RETURN(0); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index c2868d8165e..e96af1a19bf 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -569,6 +569,12 @@ int mysql_update(THD *thd, if (thd->is_error()) DBUG_RETURN(1); + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd); // No matching records DBUG_RETURN(0); } From 024a18dbcb7f9c44094db03daa013fd8ba3c58b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Sep 2024 14:29:09 +0300 Subject: [PATCH 042/185] MDEV-34823 Invalid arguments in ib_push_warning() In the bug report MDEV-32817 it occurred that the function row_mysql_get_table_status() is outputting a fil_space_t* as if it were a numeric tablespace identifier. ib_push_warning(): Remove. Let us invoke push_warning_printf() directly. innodb_decryption_failed(): Report a decryption failure and set the dict_table_t::file_unreadable flag. This code was being duplicated in very many places. We return the constant value DB_DECRYPTION_FAILED in order to avoid code duplication in the callers and to allow tail calls. innodb_fk_error(): Report a FOREIGN KEY error. dict_foreign_def_get(), dict_foreign_def_get_fields(): Remove. This code was being used in dict_create_add_foreign_to_dictionary() in an apparently uncovered code path. That ib_push_warning() call would pass the integer i+1 instead of a pointer to NUL terminated string ("%s"), and therefore the call should have resulted in a crash. dict_print_info_on_foreign_key_in_create_format(), innobase_quote_identifier(): Add const qualifiers. row_mysql_get_table_error(): Replaces row_mysql_get_table_status(). Display no message on DB_CORRUPTION; it should be properly reported at the SQL layer anyway. --- .../suite/innodb/r/innodb-fk-warnings.result | 2 +- storage/innobase/btr/btr0btr.cc | 11 +- storage/innobase/btr/btr0cur.cc | 53 ++----- storage/innobase/dict/dict0crea.cc | 145 +----------------- storage/innobase/dict/dict0dict.cc | 11 +- storage/innobase/handler/ha_innodb.cc | 96 +++++------- storage/innobase/include/dict0crea.h | 10 -- storage/innobase/include/dict0dict.h | 16 +- storage/innobase/include/ha_prototypes.h | 38 +++-- storage/innobase/row/row0ins.cc | 9 +- storage/innobase/row/row0merge.cc | 10 +- storage/innobase/row/row0mysql.cc | 61 +++----- storage/innobase/row/row0sel.cc | 9 +- 13 files changed, 108 insertions(+), 363 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result index c85dcf22c06..b58d21b0914 100644 --- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result +++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result @@ -16,7 +16,7 @@ CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id) ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") show warnings; Level Code Message -Warning 121 Create or Alter table `test`.`t2` with foreign key constraint failed. Foreign key constraint `test`.`test` already exists on data dictionary. Foreign key constraint names need to be unique in database. Error in foreign key definition: CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `test`.`t2` (`id`). +Warning 121 CREATE or ALTER TABLE `test`.`t2` failed: duplicate name, CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `t2` (`id`) Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") Warning 1022 Can't write; duplicate key in table 't2' drop table t1; diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index db57d31dd15..104b3511fd0 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -228,16 +228,7 @@ btr_root_block_get( mtr); if (!block) { - index->table->file_unreadable = true; - - ib_push_warning( - static_cast(NULL), DB_DECRYPTION_FAILED, - "Table %s in file %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name, - UT_LIST_GET_FIRST(index->table->space->chain)->name); - + innodb_decryption_failed(nullptr, index->table); return NULL; } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index bfea89b1762..2cda73900f6 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1617,13 +1617,7 @@ retry_page_get: if (err != DB_SUCCESS) { ut_ad(block == NULL); if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, index->table); } goto func_exit; @@ -1729,13 +1723,8 @@ retry_page_get: if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, + index->table); } goto func_exit; @@ -1759,13 +1748,8 @@ retry_page_get: if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, + index->table); } goto func_exit; @@ -2634,13 +2618,8 @@ btr_cur_open_at_index_side_func( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, + index->table); } goto exit_loop; @@ -2976,13 +2955,8 @@ btr_cur_open_at_rnd_pos_func( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, + index->table); } break; @@ -6136,13 +6110,8 @@ btr_estimate_n_rows_in_range_on_level( if (!block) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning((void *)NULL, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(nullptr, + index->table); } mtr_commit(&mtr); diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index f5c852bb8d0..e904c2e3e86 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1726,104 +1726,6 @@ dict_create_add_foreign_field_to_dictionary( table_name, foreign->id, trx)); } -/********************************************************************//** -Construct foreign key constraint defintion from data dictionary information. -*/ -UNIV_INTERN -char* -dict_foreign_def_get( -/*=================*/ - dict_foreign_t* foreign,/*!< in: foreign */ - trx_t* trx) /*!< in: trx */ -{ - char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024); - const char* tbname; - char tablebuf[MAX_TABLE_NAME_LEN + 1] = ""; - unsigned i; - char* bufend; - - tbname = dict_remove_db_name(foreign->id); - bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN, - tbname, strlen(tbname), trx->mysql_thd); - tablebuf[bufend - tablebuf] = '\0'; - - sprintf(fk_def, - (char *)"CONSTRAINT %s FOREIGN KEY (", (char *)tablebuf); - - for(i = 0; i < foreign->n_fields; i++) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->foreign_col_names[i], - strlen(foreign->foreign_col_names[i]), - trx->mysql_thd); - strcat(fk_def, buf); - if (i < static_cast(foreign->n_fields-1)) { - strcat(fk_def, (char *)","); - } - } - - strcat(fk_def,(char *)") REFERENCES "); - - bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN, - foreign->referenced_table_name, - strlen(foreign->referenced_table_name), - trx->mysql_thd); - tablebuf[bufend - tablebuf] = '\0'; - - strcat(fk_def, tablebuf); - strcat(fk_def, " ("); - - for(i = 0; i < foreign->n_fields; i++) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->referenced_col_names[i], - strlen(foreign->referenced_col_names[i]), - trx->mysql_thd); - buf[bufend - buf] = '\0'; - strcat(fk_def, buf); - if (i < (uint)foreign->n_fields-1) { - strcat(fk_def, (char *)","); - } - } - strcat(fk_def, (char *)")"); - - return fk_def; -} - -/********************************************************************//** -Convert foreign key column names from data dictionary to SQL-layer. -*/ -static -void -dict_foreign_def_get_fields( -/*========================*/ - dict_foreign_t* foreign,/*!< in: foreign */ - trx_t* trx, /*!< in: trx */ - char** field, /*!< out: foreign column */ - char** field2, /*!< out: referenced column */ - ulint col_no) /*!< in: column number */ -{ - char* bufend; - char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1); - char* fieldbuf2 = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1); - - bufend = innobase_convert_name(fieldbuf, MAX_TABLE_NAME_LEN, - foreign->foreign_col_names[col_no], - strlen(foreign->foreign_col_names[col_no]), - trx->mysql_thd); - - fieldbuf[bufend - fieldbuf] = '\0'; - - bufend = innobase_convert_name(fieldbuf2, MAX_TABLE_NAME_LEN, - foreign->referenced_col_names[col_no], - strlen(foreign->referenced_col_names[col_no]), - trx->mysql_thd); - - fieldbuf2[bufend - fieldbuf2] = '\0'; - *field = fieldbuf; - *field2 = fieldbuf2; -} - /********************************************************************//** Add a foreign key definition to the data dictionary tables. @return error code or DB_SUCCESS */ @@ -1865,29 +1767,8 @@ dict_create_add_foreign_to_dictionary( , name, foreign->id, trx); if (error != DB_SUCCESS) { - - if (error == DB_DUPLICATE_KEY) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - char tablename[MAX_TABLE_NAME_LEN + 1] = ""; - char* fk_def; - - innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - name, strlen(name), trx->mysql_thd); - - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->id, strlen(foreign->id), trx->mysql_thd); - - fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx); - - ib_push_warning(trx, error, - "Create or Alter table %s with foreign key constraint" - " failed. Foreign key constraint %s" - " already exists on data dictionary." - " Foreign key constraint names need to be unique in database." - " Error in foreign key definition: %s.", - tablename, buf, fk_def); - } - +err_exit: + innodb_fk_error(trx, error, name, *foreign); DBUG_RETURN(error); } @@ -1896,27 +1777,7 @@ dict_create_add_foreign_to_dictionary( i, name, foreign, trx); if (error != DB_SUCCESS) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - char tablename[MAX_TABLE_NAME_LEN + 1] = ""; - char* field=NULL; - char* field2=NULL; - char* fk_def; - - innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - name, strlen(name), trx->mysql_thd); - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->id, strlen(foreign->id), trx->mysql_thd); - fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx); - dict_foreign_def_get_fields((dict_foreign_t*)foreign, trx, &field, &field2, i); - - ib_push_warning(trx, error, - "Create or Alter table %s with foreign key constraint" - " failed. Error adding foreign key constraint name %s" - " fields %s or %s to the dictionary." - " Error in foreign key definition: %s.", - tablename, buf, i+1, fk_def); - - DBUG_RETURN(error); + goto err_exit; } } diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index a4ddf35aba6..d44b017b32f 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -3949,15 +3949,10 @@ dict_index_calc_min_rec_len( return(sum); } -/**********************************************************************//** -Outputs info on a foreign key of a table in a format suitable for -CREATE TABLE. */ std::string -dict_print_info_on_foreign_key_in_create_format( -/*============================================*/ - trx_t* trx, /*!< in: transaction */ - dict_foreign_t* foreign, /*!< in: foreign key constraint */ - ibool add_newline) /*!< in: whether to add a newline */ +dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, + const dict_foreign_t *foreign, + bool add_newline) { const char* stripped_id; ulint i; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d249cb205f4..689cf76e1ce 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2921,7 +2921,7 @@ innobase_invalidate_query_cache( void innobase_quote_identifier( FILE* file, - trx_t* trx, + const trx_t* trx, const char* id) { const int q = trx != NULL && trx->mysql_thd != NULL @@ -2951,7 +2951,7 @@ innobase_quote_identifier( std::string innobase_quote_identifier( /*======================*/ - trx_t* trx, + const trx_t* trx, const char* id) { std::string quoted_identifier; @@ -21447,66 +21447,46 @@ static void innodb_remember_check_sysvar_funcs() check_sysvar_int = MYSQL_SYSVAR_NAME(flush_log_at_timeout).check; } -static const size_t MAX_BUF_SIZE = 4 * 1024; - -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -UNIV_INTERN -void -ib_push_warning( - trx_t* trx, /*!< in: trx */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...) +/** Report that a table cannot be decrypted. +@param thd connection context +@param table table that cannot be decrypted +@retval DB_DECRYPTION_FAILED (always) */ +ATTRIBUTE_COLD +dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table) { - if (trx && trx->mysql_thd) { - THD *thd = (THD *)trx->mysql_thd; - va_list args; - char *buf; - - va_start(args, format); - buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME)); - buf[MAX_BUF_SIZE - 1] = 0; - vsnprintf(buf, MAX_BUF_SIZE - 1, format, args); - - push_warning_printf( - thd, Sql_condition::WARN_LEVEL_WARN, - uint(convert_error_code_to_mysql(error, 0, thd)), buf); - my_free(buf); - va_end(args); - } + table->file_unreadable= true; + if (!thd) + thd= current_thd; + const int dblen= int(table->name.dblen()); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_DECRYPTION_FAILED, + "Table %`.*s.%`s in tablespace " UINT32PF + " (file %s) cannot be decrypted.", + dblen, table->name.m_name, + table->name.m_name + dblen + 1, + uint32_t(table->space_id), + UT_LIST_GET_FIRST(table->space->chain)->name); + return DB_DECRYPTION_FAILED; } -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -UNIV_INTERN -void -ib_push_warning( - void* ithd, /*!< in: thd */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...) +/** Report a foreign key error. +@param error error to report +@param name table name +@param foreign constraint */ +ATTRIBUTE_COLD +void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name, + const dict_foreign_t& foreign) { - va_list args; - THD *thd = (THD *)ithd; - char *buf; - - if (ithd == NULL) { - thd = current_thd; - } - - if (thd) { - va_start(args, format); - buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME)); - buf[MAX_BUF_SIZE - 1] = 0; - vsnprintf(buf, MAX_BUF_SIZE - 1, format, args); - - push_warning_printf( - thd, Sql_condition::WARN_LEVEL_WARN, - uint(convert_error_code_to_mysql(error, 0, thd)), buf); - my_free(buf); - va_end(args); - } + const int dblen= int(table_name_t(const_cast(name)).dblen()); + std::string fk= dict_print_info_on_foreign_key_in_create_format + (trx, &foreign, false); + push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN, + convert_error_code_to_mysql(err, 0, nullptr), + "CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s", + dblen, name, name + dblen + 1, + err == DB_DUPLICATE_KEY + ? ": duplicate name" : "", + int(fk.length()), fk.data()); } /** Helper function to push warnings from InnoDB internals to SQL-layer. diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 50f7f34a8e8..c82ab7d44db 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -209,16 +209,6 @@ dict_create_add_foreign_to_dictionary( trx_t* trx) /*!< in/out: dictionary transaction */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/********************************************************************//** -Construct foreign key constraint defintion from data dictionary information. -*/ -UNIV_INTERN -char* -dict_foreign_def_get( -/*=================*/ - dict_foreign_t* foreign,/*!< in: foreign */ - trx_t* trx); /*!< in: trx */ - /* Table create node structure */ struct tab_node_t{ que_common_t common; /*!< node type: QUE_NODE_TABLE_CREATE */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 65b88a65185..6bfd774b941 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -577,15 +577,15 @@ dict_print_info_on_foreign_keys( trx_t* trx, /*!< in: transaction */ dict_table_t* table); /*!< in: table */ -/**********************************************************************//** -Outputs info on a foreign key of a table in a format suitable for -CREATE TABLE. */ +/** Output info on a foreign key of a table in a format suitable for +CREATE TABLE. +@param trx transaction +@param foreign constraint +@param add_newline whether to add a newline */ std::string -dict_print_info_on_foreign_key_in_create_format( -/*============================================*/ - trx_t* trx, /*!< in: transaction */ - dict_foreign_t* foreign, /*!< in: foreign key constraint */ - ibool add_newline); /*!< in: whether to add a newline */ +dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, + const dict_foreign_t *foreign, + bool add_newline); /*********************************************************************//** Tries to find an index whose first fields are the columns in the array, diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 04e1ec96b73..c86e5e01c5c 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -37,6 +37,9 @@ simple headers. /* Forward declarations */ class THD; class Field; +struct dict_table_t; +struct dict_foreign_t; +struct table_name_t; // JAN: TODO missing features: #undef MYSQL_FT_INIT_EXT @@ -83,7 +86,7 @@ innobase_invalidate_query_cache( void innobase_quote_identifier( FILE* file, - trx_t* trx, + const trx_t* trx, const char* id); /** Quote an standard SQL identifier like tablespace, index or column name. @@ -93,7 +96,7 @@ Return the string as an std:string object. @return a std::string with id properly quoted. */ std::string innobase_quote_identifier( - trx_t* trx, + const trx_t* trx, const char* id); /*****************************************************************//** @@ -456,25 +459,20 @@ innobase_convert_to_filename_charset( const char* from, /* in: identifier to convert */ ulint len); /* in: length of 'to', in bytes */ -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -UNIV_INTERN -void -ib_push_warning( - trx_t* trx, /*!< in: trx */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...); +/** Report that a table cannot be decrypted. +@param thd connection context +@param table table that cannot be decrypted +@retval DB_DECRYPTION_FAILED (always) */ +ATTRIBUTE_COLD +dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table); -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -UNIV_INTERN -void -ib_push_warning( - void* ithd, /*!< in: thd */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...); +/** Report a foreign key error. +@param error error to report +@param name table name +@param foreign constraint */ +ATTRIBUTE_COLD +void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name, + const dict_foreign_t& foreign); /********************************************************************//** Helper function to push warnings from InnoDB internals to SQL-layer. */ diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 2fdd259e932..350a002f83f 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -3043,13 +3043,8 @@ row_ins_sec_index_entry_low( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning(thr_get_trx(thr)->mysql_thd, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(thr_get_trx(thr)->mysql_thd, + index->table); } goto func_exit; } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index defeb39d2f4..9a44bb7d314 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4473,13 +4473,9 @@ row_merge_build_indexes( /* Do not continue if we can't encrypt table pages */ if (!old_table->is_readable() || !new_table->is_readable()) { - error = DB_DECRYPTION_FAILED; - ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - !old_table->is_readable() ? old_table->name.m_name : - new_table->name.m_name); + error = innodb_decryption_failed(trx->mysql_thd, + !old_table->is_readable() + ? old_table : new_table); goto func_exit; } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index ba11bea75c4..4e7cd6b0b37 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -68,7 +68,7 @@ Created 9/17/2000 Heikki Tuuri #include #include #include - +#include "log.h" /** Provide optional 4.x backwards compatibility for 5.0 and above */ ibool row_rollback_on_timeout = FALSE; @@ -1257,51 +1257,26 @@ run_again: return(err); } -/** Determine is tablespace encrypted but decryption failed, is table corrupted -or is tablespace .ibd file missing. -@param[in] table Table -@param[in] trx Transaction -@param[in] push_warning true if we should push warning to user +/** Report an error for a failure to access a table. +@param table unreadable table +@param trx transaction @retval DB_DECRYPTION_FAILED table is encrypted but decryption failed @retval DB_CORRUPTION table is corrupted @retval DB_TABLESPACE_NOT_FOUND tablespace .ibd file not found */ -static -dberr_t -row_mysql_get_table_status( - const dict_table_t* table, - trx_t* trx, - bool push_warning = true) +ATTRIBUTE_COLD +static dberr_t row_mysql_get_table_error(trx_t *trx, dict_table_t *table) { - dberr_t err; - if (const fil_space_t* space = table->space) { - if (space->crypt_data && space->crypt_data->is_encrypted()) { - // maybe we cannot access the table due to failing - // to decrypt - if (push_warning) { - ib_push_warning(trx, DB_DECRYPTION_FAILED, - "Table %s in tablespace %lu encrypted." - "However key management plugin or used key_id is not found or" - " used encryption algorithm or method does not match.", - table->name.m_name, table->space); - } + if (const fil_space_t *space= table->space) + { + if (space->crypt_data && space->crypt_data->is_encrypted()) + return innodb_decryption_failed(trx->mysql_thd, table); + return DB_CORRUPTION; + } - err = DB_DECRYPTION_FAILED; - } else { - if (push_warning) { - ib_push_warning(trx, DB_CORRUPTION, - "Table %s in tablespace %lu corrupted.", - table->name.m_name, table->space); - } - - err = DB_CORRUPTION; - } - } else { - ib::error() << ".ibd file is missing for table " - << table->name; - err = DB_TABLESPACE_NOT_FOUND; - } - - return(err); + const int dblen= int(table->name.dblen()); + sql_print_error("InnoDB .ibd file is missing for table %`.*s.%`s", + dblen, table->name.m_name, table->name.m_name + dblen + 1); + return DB_TABLESPACE_NOT_FOUND; } /** Does an insert for MySQL. @@ -1339,7 +1314,7 @@ row_insert_for_mysql( return(DB_TABLESPACE_DELETED); } else if (!prebuilt->table->is_readable()) { - return(row_mysql_get_table_status(prebuilt->table, trx, true)); + return row_mysql_get_table_error(trx, prebuilt->table); } else if (high_level_read_only) { return(DB_READ_ONLY); } @@ -1726,7 +1701,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt) ut_ad(table->stat_initialized); if (!table->is_readable()) { - return(row_mysql_get_table_status(table, trx, true)); + return row_mysql_get_table_error(trx, table); } if (high_level_read_only) { diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 2a34685e7cc..d1ccedcbeca 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4753,13 +4753,8 @@ wait_table_again: if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning(trx->mysql_thd, - DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - prebuilt->table->name.m_name); - index->table->file_unreadable = true; + innodb_decryption_failed(trx->mysql_thd, + index->table); } rec = NULL; goto page_read_error; From f06060f5ed3f293763e034c011da6c6cf42ae3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Sep 2024 14:31:55 +0300 Subject: [PATCH 043/185] Cleanup: Remove the function dict_remove_db_name() --- storage/innobase/dict/dict0dict.cc | 15 --------------- storage/innobase/include/dict0dict.h | 12 +++--------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index d44b017b32f..1df848d259c 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -185,21 +185,6 @@ dict_tables_have_same_db( return(FALSE); } -/********************************************************************//** -Return the end of table name where we have removed dbname and '/'. -@return table name */ -const char* -dict_remove_db_name( -/*================*/ - const char* name) /*!< in: table name in the form - dbname '/' tablename */ -{ - const char* s = strchr(name, '/'); - ut_a(s); - - return(s + 1); -} - /** Open a persistent table. @param[in] table_id persistent table identifier @param[in] ignore_err errors to ignore diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 6bfd774b941..412c41d2188 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -101,15 +101,9 @@ dict_table_is_partition(const dict_table_t* table) return (strstr(table->name.m_name, "#p#") || strstr(table->name.m_name, "#P#")); } -/********************************************************************//** -Return the end of table name where we have removed dbname and '/'. -@return table name */ -const char* -dict_remove_db_name( -/*================*/ - const char* name) /*!< in: table name in the form - dbname '/' tablename */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); + +#define dict_remove_db_name(name) \ + (table_name_t{const_cast(name)}.dbend() + 1) /** Operation to perform when opening a table */ enum dict_table_op_t { From f0b2e76577a1b94d28671a3b6c53f08bce704821 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Sep 2024 14:58:45 +0300 Subject: [PATCH 044/185] Removed ctrl-l from the source --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 97193e3e47d..b185c62aea6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5242,7 +5242,7 @@ static bool get_quick_record_count(THD *thd, SQL_SELECT *select, if (unlikely(check_stack_overrun(thd, STACK_MIN_SIZE, buff))) DBUG_RETURN(false); // Fatal error flag is set if (select) - { + { select->head=table; table->reginfo.impossible_range=0; /* From 886d740ad77013d6d080c2907b632c817c9784c9 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Sep 2024 15:04:36 +0300 Subject: [PATCH 045/185] Optimized max_part_bit in sql_select.cc to use my_find_first_bit. --- sql/sql_select.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b185c62aea6..7dc76b3b35f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6967,12 +6967,13 @@ Item_equal::add_key_fields(JOIN *join, KEY_FIELD **key_fields, } -static uint +static inline uint max_part_bit(key_part_map bits) { - uint found; - for (found=0; bits & 1 ; found++,bits>>=1) ; - return found; + if (bits == 0) + return 0; + /* find first zero bit by reverting all bits and find first bit */ + return my_find_first_bit(~(ulonglong) bits); } From c41ab95a3899248059abe952725781fac32b51bf Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Sep 2024 15:05:23 +0300 Subject: [PATCH 046/185] Remove rows and cost from optimizer trace for not usable key parts --- mysql-test/main/opt_trace.result | 2 -- sql/sql_select.cc | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 54821377fe0..ff9797a7072 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -9417,8 +9417,6 @@ S { "access_type": "ref", "index": "PRIMARY", - "rows": 1.79769e308, - "cost": 1.79769e308, "chosen": false, "cause": "no predicate for first keypart" } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7dc76b3b35f..bf80b360ab2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8085,7 +8085,6 @@ best_access_path(JOIN *join, SplM_plan_info *spl_plan= 0; table_map spl_pd_boundary= 0; Range_rowid_filter_cost_info *filter= 0; - const char* cause= NULL; enum join_type best_type= JT_UNKNOWN, type= JT_UNKNOWN; disable_jbuf= disable_jbuf || idx == join->const_tables; @@ -8113,6 +8112,7 @@ best_access_path(JOIN *join, TABLE *table= s->table; double best_records= DBL_MAX; uint max_key_part=0; + const char *cause= NULL; /* Test how we can use keys */ rec= s->records/MATCHING_ROWS_IN_OTHER_TABLE; // Assumed records/key @@ -8661,7 +8661,9 @@ best_access_path(JOIN *join, table->key_info[filter->key_no].name); } } - trace_access_idx.add("rows", records).add("cost", tmp); + + if (!cause) + trace_access_idx.add("rows", records).add("cost", tmp); if (tmp + 0.0001 < best_time - records/TIME_FOR_COMPARE) { @@ -8680,7 +8682,6 @@ best_access_path(JOIN *join, trace_access_idx.add("chosen", false) .add("cause", cause ? cause : "cost"); } - cause= NULL; } /* for each key */ records= best_records; } From c630e23a186c7ecfe0afac21163cb4fa2cdc5f7a Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sat, 7 Sep 2024 17:17:44 +0300 Subject: [PATCH 047/185] MDEV-34894: Poor query plan, because range estimates are not reused for ref(const) (Variant 4, with @@optimizer_adjust_secondary_key_costs, reuse in two places, and conditions are replaced with equivalent simpler forms in two more) In best_access_path(), ReuseRangeEstimateForRef-3, the check for whether "all used key_part_i used key_part_i=const" was incorrect: it may produced a "NO" answer for cases when we had: key_part1= const // some key parts are usable key_part2= value_not_in_join_prefix //present but unusable key_part3= non_const_value // unusable due to gap in key parts. This caused the optimizer to fail to apply ReuseRangeEstimateForRef heuristics. The consequence is poor query plan choice when the index in question has very skewed data distribution. The fix is enabled if its @@optimizer_adjust_secondary_key_costs flag is set. --- mysql-test/main/join.result | 84 +++++++++++++++++++ mysql-test/main/join.test | 78 +++++++++++++++++ mysql-test/main/mysqld--help.result | 8 +- mysql-test/main/secondary_key_costs.result | 2 +- .../sys_vars/r/sysvars_server_embedded.result | 4 +- .../r/sysvars_server_notembedded.result | 4 +- sql/sql_priv.h | 1 + sql/sql_select.cc | 48 ++++++++--- sql/sys_vars.cc | 7 +- 9 files changed, 214 insertions(+), 22 deletions(-) diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index 34c58910f07..9f843a7e722 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -3495,3 +3495,87 @@ a b c SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp; DROP TABLE t1,t2; # End of 10.6 tests +# +# MDEV-34894: Poor query plan, because range estimates are not reused for ref(const) +# +create table t0 ( +a int, +b int, +dummy int +); +insert into t0 select seq,seq,seq from seq_1_to_10; +create table t1 ( +pk1 int, +pk2 int, +pk3 int, +key1 int, +key(key1), +filler char(100), +primary key(pk1,pk2,pk3) +); +insert into t1 +select +seq, seq, seq, +FLOOR(seq/2), +'filler-data' +from seq_1_to_10000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +update t1 set pk1=1 where pk1 between 1 and 200; +explain select * from t1 where pk1=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 231 +explain select * from t0,t1 where t1.pk1=t0.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t0.a 1 +create table t2 ( +col int +); +insert into t2 select seq from seq_1_to_10000; +set optimizer_adjust_secondary_key_costs='fix_reuse_range_for_ref'; +# This must use this good query plan: +# t0 - ALL +# t1 - ref, key=key1, not PRIMARY as pk1=1 is true for 20% of all rows +# t2 - ALL +explain select * from t0, t1, t2 +where +t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and +t1.key1=t0.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ref PRIMARY,key1 key1 5 test.t0.b 1 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using where; Using join buffer (flat, BNL join) +set optimizer_adjust_secondary_key_costs=''; +# Bad query: +# t0 - ALL +# t1 - ref, key=PRIMARY +# t2 - ALL +explain select * from t0, t1, t2 +where +t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and +t1.key1=t0.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 ref PRIMARY,key1 PRIMARY 4 const 1 Using index condition; Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using where; Using join buffer (flat, BNL join) +drop table t0,t1,t2; +set @@optimizer_adjust_secondary_key_costs="fix_reuse_range_for_ref"; +CREATE OR REPLACE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT, key(a,b,c)) ENGINE=Aria; +INSERT INTO t1 select seq/10,mod(seq,2),seq from seq_1_to_1000; +update t1 set a=10 WHERE c < 100; +update t1 set a=12 WHERE a=11; +insert into t1 values (11,1,11), (11,2,11); +create or replace table t2 select seq from seq_1_to_10; +explain select count(*) from t1, t2 as seq where a=10 and b=seq.seq; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE seq ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 ref a a 8 const,test.seq.seq 5 Using where; Using index +explain select count(*) from t1, t2 as seq where a=11 and b=seq.seq; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 4 const 2 Using index +1 SIMPLE seq ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +drop table t1,t2; +set @@optimizer_adjust_secondary_key_costs=default; diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index f8abc3fac22..6e037100ae5 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -1904,3 +1904,81 @@ SELECT * FROM SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp; DROP TABLE t1,t2; --echo # End of 10.6 tests + +--source include/have_sequence.inc + +--echo # +--echo # MDEV-34894: Poor query plan, because range estimates are not reused for ref(const) +--echo # +create table t0 ( + a int, + b int, + dummy int +); +insert into t0 select seq,seq,seq from seq_1_to_10; + +create table t1 ( + pk1 int, + pk2 int, + pk3 int, + key1 int, + key(key1), + filler char(100), + primary key(pk1,pk2,pk3) +); + +insert into t1 +select + seq, seq, seq, + FLOOR(seq/2), + 'filler-data' +from seq_1_to_10000; +analyze table t1; + +update t1 set pk1=1 where pk1 between 1 and 200; + +explain select * from t1 where pk1=1; + +explain select * from t0,t1 where t1.pk1=t0.a; + +create table t2 ( + col int +); +insert into t2 select seq from seq_1_to_10000; + +set optimizer_adjust_secondary_key_costs='fix_reuse_range_for_ref'; +--echo # This must use this good query plan: +--echo # t0 - ALL +--echo # t1 - ref, key=key1, not PRIMARY as pk1=1 is true for 20% of all rows +--echo # t2 - ALL +explain select * from t0, t1, t2 +where + t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and + t1.key1=t0.b; + +set optimizer_adjust_secondary_key_costs=''; +--echo # Bad query: +--echo # t0 - ALL +--echo # t1 - ref, key=PRIMARY +--echo # t2 - ALL +explain select * from t0, t1, t2 +where + t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and + t1.key1=t0.b; + +drop table t0,t1,t2; + +set @@optimizer_adjust_secondary_key_costs="fix_reuse_range_for_ref"; +CREATE OR REPLACE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT, key(a,b,c)) ENGINE=Aria; +INSERT INTO t1 select seq/10,mod(seq,2),seq from seq_1_to_1000; +update t1 set a=10 WHERE c < 100; +update t1 set a=12 WHERE a=11; +insert into t1 values (11,1,11), (11,2,11); +create or replace table t2 select seq from seq_1_to_10; + +explain select count(*) from t1, t2 as seq where a=10 and b=seq.seq; +# This will execute code in ReuseRangeEstimateForRef-4 +explain select count(*) from t1, t2 as seq where a=11 and b=seq.seq; +drop table t1,t2; + +set @@optimizer_adjust_secondary_key_costs=default; diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 08cd1202655..1e5fad44a5b 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -721,8 +721,10 @@ The following specify which files/extra groups are read (specified before remain disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary - keys. This variable will be deleted in MariaDB 11.0 as it - is not needed with the new 11.0 optimizer. + keys. fix_reuse_range_for_ref = Do a better job at + reusing range access estimates when estimating ref + access. This variable will be deleted in MariaDB 11.0 as + it is not needed with the new 11.0 optimizer. Use 'ALL' to set all combinations. --optimizer-join-limit-pref-ratio=# For queries with JOIN and ORDER BY LIMIT : make the @@ -1705,7 +1707,7 @@ old-alter-table DEFAULT old-mode UTF8_IS_UTF8MB3 old-passwords FALSE old-style-user-limits FALSE -optimizer-adjust-secondary-key-costs +optimizer-adjust-secondary-key-costs fix_reuse_range_for_ref optimizer-join-limit-pref-ratio 0 optimizer-max-sel-arg-weight 32000 optimizer-max-sel-args 16000 diff --git a/mysql-test/main/secondary_key_costs.result b/mysql-test/main/secondary_key_costs.result index b246b666115..3a5b883068c 100644 --- a/mysql-test/main/secondary_key_costs.result +++ b/mysql-test/main/secondary_key_costs.result @@ -82,7 +82,7 @@ json_detailed(json_extract(@trace, '$**.considered_access_paths')) drop table t1, name, flag2; select @@optimizer_adjust_secondary_key_costs; @@optimizer_adjust_secondary_key_costs - +fix_reuse_range_for_ref set @@optimizer_adjust_secondary_key_costs=7; select @@optimizer_adjust_secondary_key_costs; @@optimizer_adjust_secondary_key_costs diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 42b661bc448..850497191d0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2275,11 +2275,11 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality +ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index b626551a570..fcbe4f51fc5 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2435,11 +2435,11 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality +ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 0bcb09a80ad..8f7962fc6b6 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -275,6 +275,7 @@ #define OPTIMIZER_ADJ_DISABLE_MAX_SEEKS (2) #define OPTIMIZER_ADJ_DISABLE_FORCE_INDEX_GROUP_BY (4) #define OPTIMIZER_FIX_INNODB_CARDINALITY (8) +#define OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF (16) /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bf80b360ab2..57e391dc82d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8125,6 +8125,7 @@ best_access_path(JOIN *join, key_part_map notnull_part=0; // key parts which won't have NULL in lookup tuple. table_map found_ref= 0; uint key= keyuse->key; + uint max_const_parts; filter= 0; bool ft_key= (keyuse->keypart == FT_KEYPART); /* Bitmap of keyparts where the ref access is over 'keypart=const': */ @@ -8228,6 +8229,8 @@ best_access_path(JOIN *join, rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables Json_writer_object trace_access_idx(thd); + max_const_parts= max_part_bit(const_part); + /* full text keys require special treatment */ @@ -8344,9 +8347,7 @@ best_access_path(JOIN *join, in ReuseRangeEstimateForRef-3. */ if (table->opt_range_keys.is_set(key) && - (const_part & - (((key_part_map)1 << table->opt_range[key].key_parts)-1)) == - (((key_part_map)1 << table->opt_range[key].key_parts)-1) && + table->opt_range[key].key_parts <= max_const_parts && table->opt_range[key].ranges == 1 && records > (double) table->opt_range[key].rows) { @@ -8394,6 +8395,17 @@ best_access_path(JOIN *join, found_part == PREV_BITS(uint,keyinfo->user_defined_key_parts))) { max_key_part= max_part_bit(found_part); + bool all_used_equalities_are_const; + if ((thd->variables.optimizer_adjust_secondary_key_costs & + OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF)) + { + all_used_equalities_are_const= (max_key_part == max_const_parts); + } + else + { + // Old, incorrect check: + all_used_equalities_are_const= !found_ref; + } /* ReuseRangeEstimateForRef-3: We're now considering a ref[or_null] access via @@ -8408,7 +8420,7 @@ best_access_path(JOIN *join, create quick select over another index), so we can't compare them to (**). We'll make indirect judgements instead. The sufficient conditions for re-use are: - (C1) All e_i in (**) are constants, i.e. found_ref==FALSE. (if + (C1) All e_i in (**) are constants (if this is not satisfied we have no way to know which ranges will be actually scanned by 'ref' until we execute the join) @@ -8418,7 +8430,7 @@ best_access_path(JOIN *join, We also have a property that "range optimizer produces equal or tighter set of scan intervals than ref(const) optimizer". Each of the intervals in (**) are "tightest possible" intervals when - one limits itself to using keyparts 1..K (which we do in #2). + one limits itself to using keyparts 1..K (which we do in #2). From here it follows that range access used either one, or both of the (I1) and (I2) intervals: @@ -8433,7 +8445,8 @@ best_access_path(JOIN *join, (C3) "range optimizer used (have ref_or_null?2:1) intervals" */ - if (table->opt_range_keys.is_set(key) && !found_ref && //(C1) + if (table->opt_range_keys.is_set(key) && + all_used_equalities_are_const && // (C1) table->opt_range[key].key_parts == max_key_part && //(C2) table->opt_range[key].ranges == 1 + MY_TEST(ref_or_null_part)) //(C3) { @@ -8466,10 +8479,10 @@ best_access_path(JOIN *join, */ if (table->opt_range_keys.is_set(key)) { + double rows= (double) table->opt_range[key].rows; if (table->opt_range[key].key_parts >= max_key_part) // (2) { - double rows= (double) table->opt_range[key].rows; - if (!found_ref && // (1) + if (all_used_equalities_are_const && // (1) records < rows) // (3) { trace_access_idx.add("used_range_estimates", "clipped up"); @@ -8537,15 +8550,26 @@ best_access_path(JOIN *join, */ if (table->opt_range_keys.is_set(key) && table->opt_range[key].key_parts <= max_key_part && - const_part & - ((key_part_map)1 << table->opt_range[key].key_parts) && table->opt_range[key].ranges == (1 + MY_TEST(ref_or_null_part & const_part)) && records > (double) table->opt_range[key].rows) { - trace_access_idx.add("used_range_estimates", true); - records= (double) table->opt_range[key].rows; + bool all_parts_used; + if ((thd->variables.optimizer_adjust_secondary_key_costs & + OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF)) + { + all_parts_used= table->opt_range[key].key_parts <= max_const_parts; + } + else + all_parts_used= (bool) (const_part & + ((key_part_map)1 + << table->opt_range[key].key_parts)); + if (all_parts_used) + { + trace_access_idx.add("used_range_estimates", true); + records= (double) table->opt_range[key].rows; + } } } diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index c5b507b936d..77d0c2daf78 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2837,7 +2837,8 @@ static Sys_var_ulong Sys_optimizer_trace_max_mem_size( */ static const char *adjust_secondary_key_cost[]= { - "adjust_secondary_key_cost", "disable_max_seek", "disable_forced_index_in_group_by", "fix_innodb_cardinality",0 + "adjust_secondary_key_cost", "disable_max_seek", "disable_forced_index_in_group_by", + "fix_innodb_cardinality", "fix_reuse_range_for_ref", 0 }; @@ -2852,10 +2853,12 @@ static Sys_var_set Sys_optimizer_adjust_secondary_key_costs( "GROUP BY. " "fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB " "secondary keys. " + "fix_reuse_range_for_ref = Do a better job at reusing range access estimates " + "when estimating ref access. " "This variable will be deleted in MariaDB 11.0 as it is not needed with the " "new 11.0 optimizer.", SESSION_VAR(optimizer_adjust_secondary_key_costs), CMD_LINE(REQUIRED_ARG), - adjust_secondary_key_cost, DEFAULT(0)); + adjust_secondary_key_cost, DEFAULT(OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF)); static Sys_var_charptr_fscs Sys_pid_file( From 06ad31d4b679d9bd798e24af475464ef9191a113 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 9 Sep 2024 14:34:14 +0530 Subject: [PATCH 048/185] MDEV-34855 Bootstrap hangs while shrinking the system tablespace Reason: ======= - During bootstrap, InnoDB shrinks the system tablespace while purge is still active on system tablespace. This could lead to deadlock. Fix: ==== Avoid System tablespace shrinking during bootstrap. Move the shrinking logic of system tablespace after purge gets shutdown. --- storage/innobase/fsp/fsp0fsp.cc | 5 +++++ storage/innobase/handler/ha_innodb.cc | 6 ------ storage/innobase/srv/srv0srv.cc | 3 +++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 64f22c1cbe8..8cb2793e7b4 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -40,6 +40,9 @@ Created 11/29/1995 Heikki Tuuri #include "dict0mem.h" #include "fsp0types.h" #include "log.h" +#ifndef DBUG_OFF +# include "trx0purge.h" +#endif /** Returns the first extent descriptor for a segment. We think of the extent lists of the segment catenated in the order @@ -3576,6 +3579,8 @@ dberr_t fsp_sys_tablespace_validate() void fsp_system_tablespace_truncate() { + ut_ad(!purge_sys.enabled()); + ut_ad(!srv_undo_sources); uint32_t last_used_extent= 0; fil_space_t *space= fil_system.sys_space; mtr_t mtr; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e64c8af1698..cccfbef8824 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4283,12 +4283,6 @@ innobase_end(handlerton*, ha_panic_function) } } - /* Do system tablespace truncation during slow shutdown */ - if (!srv_fast_shutdown && !high_level_read_only - && srv_operation == SRV_OPERATION_NORMAL) { - fsp_system_tablespace_truncate(); - } - innodb_shutdown(); mysql_mutex_destroy(&log_requests.mutex); } diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 2ffdd45551c..db5dc5a4a3d 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1577,5 +1577,8 @@ void srv_purge_shutdown() } purge_sys.coordinator_shutdown(); srv_shutdown_purge_tasks(); + if (!srv_fast_shutdown && !high_level_read_only && srv_was_started && + !opt_bootstrap && srv_operation == SRV_OPERATION_NORMAL) + fsp_system_tablespace_truncate(); } } From 852d42e9933a2760b2542e977f2141d4e80dd8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 9 Sep 2024 16:47:35 +0300 Subject: [PATCH 049/185] MDEV-34483 Backup may copy unnecessarily much log In mariadb-backup --backup there are multiple mechanisms for ensuring that a sufficient amount of the InnoDB write-ahead log (ib_logfile0) is being copied at the end of the backup. The backup needs to include the latest committed transaction. While further transaction commits are blocked by BACKUP STAGE BLOCK_COMMIT, ongoing transactions may modify the database contents and write log records. We were unnecessarily copying such log, which would also cause further effort of rolling back incomplete transactions after the backup is restored. backup_wait_for_lsn(): Declare as static, and refactor some code to separate functions backup_wait_for_lsn_low() and backup_wait_timeout(). backup_wait_for_commit_lsn(): A new function to determine the current LSN (within BACKUP STAGE BLOCK_COMMIT) and to wait for the log to be copied until that. Invoked by BackupStages::stage_block_commit(). xtrabackup_backup_func(): Remove a condition that had already been checked by a caller of backup_wait_timeout(). server_lsn_after_lock: Declare as a local variable in BackupStages::stage_block_ddl(). log_copying_thread(), io_watching_thread(): Use metadata_last_lsn instead of metadata_to_lsn as the stop condition. BackupStages::stage_block_commit(): Ensure that the log tables (in particular, mysql.general_log) will have been copied before the BACKUP STAGE BLOCK_COMMIT is being followed by any further SQL statements. Reviewed by: Debarun Banerjee Tested by: Matthias Leich --- extra/mariabackup/backup_copy.cc | 3 - extra/mariabackup/xtrabackup.cc | 206 ++++++++++++------ .../suite/mariabackup/log_tables.result | 2 + mysql-test/suite/mariabackup/log_tables.test | 10 +- 4 files changed, 140 insertions(+), 81 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 3e97ef94835..c47c56d80d2 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1353,9 +1353,6 @@ out: return(ret); } -lsn_t server_lsn_after_lock; -extern void backup_wait_for_lsn(lsn_t lsn); - /** Release resources after backup_files() */ void backup_release() { diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 46b040d61bd..ca8891ca546 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3482,35 +3482,70 @@ static bool xtrabackup_copy_logfile() return false; } -/** -Wait until redo log copying thread processes given lsn -*/ -void backup_wait_for_lsn(lsn_t lsn) +static bool backup_wait_timeout(lsn_t lsn, lsn_t last_lsn) { - mysql_mutex_lock(&recv_sys.mutex); - for (lsn_t last_lsn{recv_sys.lsn}; last_lsn < lsn; ) + if (last_lsn >= lsn) + return true; + msg("Was only able to copy log from " LSN_PF " to " LSN_PF + ", not " LSN_PF "; try increasing innodb_log_file_size", + log_sys.next_checkpoint_lsn, last_lsn, lsn); + return false; +} + +/** +Wait for enough log to be copied. +@param lsn log sequence number target +@return the reached log sequence number (may be less or more than lsn) +*/ +static lsn_t backup_wait_for_lsn_low(lsn_t lsn) +{ + mysql_mutex_assert_owner(&recv_sys.mutex); + + lsn_t last_lsn{recv_sys.lsn}; + + if (last_lsn >= lsn) + return last_lsn; + + msg("Waiting for log copy thread to read lsn " LSN_PF, lsn); + + while (log_copying_running && last_lsn < lsn) { timespec abstime; set_timespec(abstime, 5); if (my_cond_timedwait(&scanned_lsn_cond, &recv_sys.mutex.m_mutex, &abstime) && last_lsn == recv_sys.lsn) - die("Was only able to copy log from " LSN_PF " to " LSN_PF - ", not " LSN_PF "; try increasing innodb_log_file_size", - log_sys.next_checkpoint_lsn, last_lsn, lsn); + break; last_lsn= recv_sys.lsn; } - mysql_mutex_unlock(&recv_sys.mutex); + + return last_lsn; +} + +/** +Wait for enough log to be copied after BACKUP STAGE BLOCK_DDL. +@param lsn log sequence number target +@return whether log_copying_thread() copied everything until the target lsn +*/ +static bool backup_wait_for_lsn(lsn_t lsn) +{ + if (!lsn) + return true; + mysql_mutex_lock(&recv_sys.mutex); + ut_ad(!metadata_to_lsn); + ut_ad(!metadata_last_lsn); + lsn_t last_lsn{backup_wait_for_lsn_low(lsn)}; + mysql_mutex_unlock(&recv_sys.mutex); + return backup_wait_timeout(lsn, last_lsn); } -extern lsn_t server_lsn_after_lock; static void log_copying_thread() { my_thread_init(); mysql_mutex_lock(&recv_sys.mutex); while (!xtrabackup_copy_logfile() && - (!metadata_to_lsn || metadata_to_lsn > recv_sys.lsn)) + (!metadata_last_lsn || metadata_last_lsn > recv_sys.lsn)) { timespec abstime; set_timespec_nsec(abstime, 1000000ULL * xtrabackup_log_copy_interval); @@ -3534,7 +3569,7 @@ static void io_watching_thread() mysql_mutex_lock(&recv_sys.mutex); ut_ad(have_io_watching_thread); - while (log_copying_running && !metadata_to_lsn) + while (log_copying_running && !metadata_last_lsn) { timespec abstime; set_timespec(abstime, 1); @@ -4685,6 +4720,7 @@ end: static void stop_backup_threads() { + ut_ad(metadata_last_lsn); mysql_cond_broadcast(&log_copying_stop); if (log_copying_running || have_io_watching_thread) @@ -4708,38 +4744,58 @@ static void stop_backup_threads() mysql_cond_destroy(&log_copying_stop); } +/** +Wait for enough log to be copied. +@return whether log_copying_thread() copied everything until the target lsn +*/ +static bool backup_wait_for_commit_lsn() +{ + lsn_t lsn= get_current_lsn(mysql_connection); + mysql_mutex_lock(&recv_sys.mutex); + ut_ad(!metadata_to_lsn); + ut_ad(!metadata_last_lsn); + + lsn_t last_lsn= recv_sys.lsn; + + /* read the latest checkpoint lsn */ + if (recv_sys.find_checkpoint() == DB_SUCCESS && log_sys.is_latest()) + { + if (log_sys.next_checkpoint_lsn > lsn) + lsn= log_sys.next_checkpoint_lsn; + metadata_to_lsn= log_sys.next_checkpoint_lsn; + msg("mariabackup: The latest check point (for incremental): '" + LSN_PF "'", metadata_to_lsn); + } + else + { + msg("Error: recv_sys.find_checkpoint() failed."); + metadata_last_lsn= 1; + stop_backup_threads(); + mysql_mutex_unlock(&recv_sys.mutex); + return false; + } + + recv_sys.lsn= last_lsn; + ut_ad(metadata_to_lsn); + metadata_last_lsn= lsn; + + last_lsn= backup_wait_for_lsn_low(LSN_MAX); + + metadata_last_lsn= last_lsn; + stop_backup_threads(); + mysql_mutex_unlock(&recv_sys.mutex); + return backup_wait_timeout(lsn, last_lsn); +} + /** Implement the core of --backup @return whether the operation succeeded */ bool Backup_datasinks::backup_low() { - mysql_mutex_lock(&recv_sys.mutex); - ut_ad(!metadata_to_lsn); - - /* read the latest checkpoint lsn */ - { - const lsn_t lsn = recv_sys.lsn; - if (recv_sys.find_checkpoint() == DB_SUCCESS - && log_sys.is_latest()) { - metadata_to_lsn = log_sys.next_checkpoint_lsn; - msg("mariabackup: The latest check point" - " (for incremental): '" LSN_PF "'", - metadata_to_lsn); - } else { - msg("Error: recv_sys.find_checkpoint() failed."); - } - - recv_sys.lsn = lsn; - stop_backup_threads(); - } - - if (metadata_to_lsn && xtrabackup_copy_logfile()) { - mysql_mutex_unlock(&recv_sys.mutex); - ds_close(dst_log_file); - dst_log_file = NULL; - return false; - } - - mysql_mutex_unlock(&recv_sys.mutex); + ut_d(mysql_mutex_lock(&recv_sys.mutex)); + ut_ad(metadata_last_lsn); + ut_ad(metadata_to_lsn); + ut_ad(!log_copying_running); + ut_d(mysql_mutex_unlock(&recv_sys.mutex)); if (ds_close(dst_log_file) || !metadata_to_lsn) { dst_log_file = NULL; @@ -4756,7 +4812,7 @@ bool Backup_datasinks::backup_low() for (uint32_t id : failed_ids) { msg("mariabackup: Failed to read undo log " - "tablespace space id %d and there is no undo " + "tablespace space id " UINT32PF " and there is no undo " "tablespace truncation redo record.", id); } @@ -4843,17 +4899,17 @@ private: // TODO: this came from the old code, where it was not thread-safe // too, use separate mysql connection per thread here DBUG_MARIABACKUP_EVENT("before_copy", node->space->name()); - DBUG_EXECUTE_FOR_KEY("wait_innodb_redo_before_copy", - node->space->name(), - backup_wait_for_lsn( - get_current_lsn(mysql_connection));); + DBUG_EXECUTE_FOR_KEY("wait_innodb_redo_before_copy", + node->space->name(), + backup_wait_for_lsn( + get_current_lsn(mysql_connection));); /* copy the datafile */ if(xtrabackup_copy_datafile(m_backup_datasinks.m_data, - m_backup_datasinks.m_meta, - node, thread_num, NULL, - xtrabackup_incremental - ? wf_incremental : wf_write_through, - m_corrupted_pages)) + m_backup_datasinks.m_meta, + node, thread_num, NULL, + xtrabackup_incremental + ? wf_incremental : wf_write_through, + m_corrupted_pages)) die("mariabackup: Error: failed to copy datafile."); // TODO: this came from the old code, where it was not thread-safe // too, use separate mysql connection per thread here @@ -4861,8 +4917,8 @@ private: m_tasks.finish_task(1); } - Backup_datasinks &m_backup_datasinks; - CorruptedPages &m_corrupted_pages; + Backup_datasinks &m_backup_datasinks; + CorruptedPages &m_corrupted_pages; TasksGroup m_tasks; }; @@ -5063,9 +5119,9 @@ class BackupStages { return false; } - msg("Waiting for log copy thread to read lsn %llu", - server_lsn_after_lock); - backup_wait_for_lsn(server_lsn_after_lock); + if (!backup_wait_for_lsn(server_lsn_after_lock)) { + return false; + } corrupted_pages.backup_fix_ddl(backup_datasinks.m_data, backup_datasinks.m_meta); @@ -5101,11 +5157,28 @@ class BackupStages { } // Copy log tables tail - if (!m_common_backup.copy_log_tables(true)) { + if (!m_common_backup.copy_log_tables(true) || + !m_common_backup.close_log_tables()) { msg("Error on copy log tables"); return false; } + // Copy just enough log to cover the latest commit. + // Meanwhile, there could be some active transactions + // that are modifying the database and writing more + // log. Not copying log for them will save busy work + // and avoid some rollback of the incomplete + // transactions after the backup has been restored. + // + // We find the current InnoDB LSN by executing + // SHOW ENGINE INNODB STATUS, which in the case of + // general_log=1, log_output='TABLES' + // would be written to the table mysql.general_log + // that we just finished copying above. + if (!backup_wait_for_commit_lsn()) { + return false; + } + // Copy stats tables if (!m_common_backup.copy_stats_tables()) { msg("Error on copy stats tables"); @@ -5123,11 +5196,6 @@ class BackupStages { return false; } - if (!m_common_backup.close_log_tables()) { - msg("Error on close log tables"); - return false; - } - if (!backup_files_from_datadir(backup_datasinks.m_data, fil_path_to_mysql_datadir, "aws-kms-key")) { @@ -5269,13 +5337,14 @@ static bool xtrabackup_backup_func() undo_space_trunc = backup_undo_trunc; first_page_init = backup_first_page_op; metadata_to_lsn = 0; + metadata_last_lsn = 0; /* initialize components */ if(innodb_init_param()) { fail: if (log_copying_running) { mysql_mutex_lock(&recv_sys.mutex); - metadata_to_lsn = 1; + metadata_last_lsn = 1; stop_backup_threads(); mysql_mutex_unlock(&recv_sys.mutex); } @@ -5460,14 +5529,9 @@ fail: xb_data_files_close(); - /* Make sure that the latest checkpoint was included */ - if (metadata_to_lsn > recv_sys.lsn) { - msg("Error: failed to copy enough redo log (" - "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").", - recv_sys.lsn, metadata_to_lsn); - goto fail; - } - + ut_ad(!log_copying_running); + ut_ad(metadata_to_lsn <= recv_sys.lsn); + ut_ad(metadata_last_lsn == recv_sys.lsn); innodb_shutdown(); log_file_op = NULL; undo_space_trunc = NULL; diff --git a/mysql-test/suite/mariabackup/log_tables.result b/mysql-test/suite/mariabackup/log_tables.result index 840efc718e9..2528691f1b4 100644 --- a/mysql-test/suite/mariabackup/log_tables.result +++ b/mysql-test/suite/mariabackup/log_tables.result @@ -1,5 +1,7 @@ CREATE TABLE t(i INT) ENGINE ARIA TRANSACTIONAL=1 ROW_FORMAT=PAGE PAGE_CHECKSUM=1; +SET GLOBAL general_log = 0; +TRUNCATE mysql.general_log; SET GLOBAL general_log = 1; SET GLOBAL log_output = 'TABLE'; INSERT INTO t VALUES (1); diff --git a/mysql-test/suite/mariabackup/log_tables.test b/mysql-test/suite/mariabackup/log_tables.test index fe540a1ca91..707057a80e6 100644 --- a/mysql-test/suite/mariabackup/log_tables.test +++ b/mysql-test/suite/mariabackup/log_tables.test @@ -7,9 +7,9 @@ CREATE TABLE t(i INT) ENGINE ARIA TRANSACTIONAL=1 ROW_FORMAT=PAGE PAGE_CHECKSUM=1; ---let $general_log_old = `SELECT @@global.general_log` ---let $log_output_old = `SELECT @@global.log_output` - +# Truncate the log in order to make the test ./mtr --repeat proof +SET GLOBAL general_log = 0; +TRUNCATE mysql.general_log; SET GLOBAL general_log = 1; SET GLOBAL log_output = 'TABLE'; @@ -43,7 +43,3 @@ SELECT * FROM mysql.general_log --rmdir $targetdir DROP TABLE t; ---disable_query_log ---eval SET GLOBAL general_log = $general_log_old ---eval SET GLOBAL log_output = $log_output_old ---enable_query_log From ccb4bc775498eae2efa4901d53083998bad7ef27 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 9 Sep 2024 14:05:02 +1000 Subject: [PATCH 050/185] MDEV-33894: Resurrect innodb_log_write_ahead_size (postfix) os_file_log_maybe_unbuffered is now Linux only. Aso the stat st structure only used in linux. This avoids unused function/structure errors on FreeBSD. --- storage/innobase/os/os0file.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index f37f61d77bf..fa3ccfb6b80 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1095,13 +1095,11 @@ static ATTRIBUTE_COLD void os_file_log_buffered() log_sys.log_maybe_unbuffered= false; log_sys.log_buffered= true; } -# endif /** @return whether the log file may work with unbuffered I/O. */ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) { MSAN_STAT_WORKAROUND(&st); -# ifdef __linux__ char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"]; if (snprintf(b, sizeof b, "/sys/dev/block/%u:%u/queue/physical_block_size", major(st.st_dev), minor(st.st_dev)) >= @@ -1133,13 +1131,11 @@ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) if (s > 4096 || s < 64 || !ut_is_2pow(s)) return false; log_sys.set_block_size(uint32_t(s)); -# else - constexpr unsigned long s= 4096; -# endif return !(st.st_size & (s - 1)); } -#endif +# endif /* __linux__ */ +#endif /* O_DIRECT */ /** NOTE! Use the corresponding macro os_file_create(), not directly this function! @@ -1192,7 +1188,9 @@ os_file_create_func( } #ifdef O_DIRECT +# ifdef __linux__ struct stat st; +# endif ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE || type == OS_DATA_FILE_NO_O_DIRECT); int direct_flag = 0; From 24d67aaf9c1a89b9ca64a6798af819b6417f47c9 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 9 Sep 2024 14:13:38 +1000 Subject: [PATCH 051/185] MDEV-34825 FreeBSD fails to build under clang natively (postfix) 10.5 added contents of cmake/os/FreeBSD.cmake in c991efd9c35eb3f2a90b2562071860a10a4cbaa2. in the merge to 10.11, d002b1f removed this file. In the past FreeBSD.cmake was removed in 5369df741b3a87d7b262aafe95438b33ed124295 in the 10.11 branch as no remaining code was needed. The combination of this and the merge lead to the the file being removed. My assumption is this was a non-stable branch at the time. The purpose of this patch is clang doesn't have /usr/local/lib in the path. As such there are various depedency linkages that will fail. For example pcre and libfmt. --- cmake/os/FreeBSD.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmake/os/FreeBSD.cmake diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake new file mode 100644 index 00000000000..4bcd844929f --- /dev/null +++ b/cmake/os/FreeBSD.cmake @@ -0,0 +1,19 @@ +# Copyright (C) 2024 MariaDB Foundation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA + +# This file includes FreeBSD specific options and quirks, related to system checks + +# For all userspace dependencies +LINK_DIRECTORIES(/usr/local/lib) From 05fafaf82d29310302de2072eddd54520b4665b5 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:22:59 +0800 Subject: [PATCH 052/185] MDEV-27646 remove SPIDER_HAS_HASH_VALUE_TYPE unifdef -DSPIDER_HAS_HASH_VALUE_TYPE -m storage/spider/spd_* storage/spider/ha_spider.* storage/spider/hs_client/* --- storage/spider/ha_spider.cc | 43 ----------------- storage/spider/spd_conn.cc | 55 --------------------- storage/spider/spd_conn.h | 2 - storage/spider/spd_db_conn.cc | 2 - storage/spider/spd_db_mysql.cc | 15 ------ storage/spider/spd_db_mysql.h | 2 - storage/spider/spd_db_oracle.cc | 15 ------ storage/spider/spd_db_oracle.h | 2 - storage/spider/spd_direct_sql.cc | 19 -------- storage/spider/spd_include.h | 26 ---------- storage/spider/spd_ping_table.cc | 22 --------- storage/spider/spd_table.cc | 82 -------------------------------- storage/spider/spd_table.h | 12 ----- storage/spider/spd_trx.cc | 16 ------- 14 files changed, 313 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index afa3732c577..fa6568a9f65 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -49,9 +49,7 @@ extern handlerton *spider_hton_ptr; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE extern HASH spider_open_tables; -#endif extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex; /* UTC time zone for timestamp columns */ @@ -10705,16 +10703,11 @@ int ha_spider::create( memset((void*)&tmp_share, 0, sizeof(SPIDER_SHARE)); tmp_share.table_name = (char*) name; tmp_share.table_name_length = strlen(name); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE tmp_share.table_name_hash_value = my_calc_hash(&trx->trx_alter_table_hash, (uchar*) tmp_share.table_name, tmp_share.table_name_length); tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( name, tmp_share.table_name_length, tmp_share.table_name_hash_value, FALSE, TRUE, &error_num); -#else - tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( - name, tmp_share.table_name_length, FALSE, TRUE, &error_num); -#endif if (!tmp_share.lgtm_tblhnd_share) { goto error; @@ -10787,16 +10780,10 @@ int ha_spider::create( spider_free_trx_alter_table(trx); trx->query_id = thd->query_id; } -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(alter_table = (SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value( &trx->trx_alter_table_hash, tmp_share.table_name_hash_value, (uchar*) tmp_share.table_name, tmp_share.table_name_length))) -#else - if (!(alter_table = - (SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash, - (uchar*) tmp_share.table_name, tmp_share.table_name_length))) -#endif { if ((error_num = spider_create_trx_alter_table(trx, &tmp_share, TRUE))) goto error; @@ -10921,12 +10908,10 @@ int ha_spider::rename_table( ) { int error_num, roop_count, old_link_count, from_len = strlen(from), to_len = strlen(to), tmp_error_num; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type from_hash_value = my_calc_hash(&spider_open_tables, (uchar*) from, from_len); my_hash_value_type to_hash_value = my_calc_hash(&spider_open_tables, (uchar*) to, to_len); -#endif THD *thd = ha_thd(); uint sql_command = thd_sql_command(thd); SPIDER_TRX *trx; @@ -11094,22 +11079,12 @@ int ha_spider::rename_table( } pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( from, from_len, from_hash_value, TRUE, FALSE, &error_num); -#else - from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( - from, from_len, TRUE, FALSE, &error_num); -#endif if (from_lgtm_tblhnd_share) { -#ifdef SPIDER_HAS_HASH_VALUE_TYPE to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( to, to_len, to_hash_value, TRUE, TRUE, &error_num); -#else - to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( - to, to_len, TRUE, TRUE, &error_num); -#endif if (!to_lgtm_tblhnd_share) { pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex); @@ -11135,13 +11110,8 @@ error: spider_close_sys_table(current_thd, table_tables, &open_tables_backup, need_lock); pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num); -#else - to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( - to, to_len, TRUE, FALSE, &tmp_error_num); -#endif if (to_lgtm_tblhnd_share) spider_free_lgtm_tblhnd_share_alloc(to_lgtm_tblhnd_share, TRUE); pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex); @@ -11189,22 +11159,14 @@ int ha_spider::delete_table( { SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share; int roop_count, old_link_count = 0, name_len = strlen(name); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) name, name_len); -#endif if ( sql_command == SQLCOM_ALTER_TABLE && -#ifdef SPIDER_HAS_HASH_VALUE_TYPE (alter_table = (SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value( &trx->trx_alter_table_hash, hash_value, (uchar*) name, name_len)) && -#else - (alter_table = - (SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash, - (uchar*) name, name_len)) && -#endif alter_table->now_create ) DBUG_RETURN(0); @@ -11255,13 +11217,8 @@ int ha_spider::delete_table( } pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( name, name_len, hash_value, TRUE, FALSE, &error_num); -#else - lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( - name, name_len, TRUE, FALSE, &error_num); -#endif if (lgtm_tblhnd_share) spider_free_lgtm_tblhnd_share_alloc(lgtm_tblhnd_share, TRUE); pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex); diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 5549b30caa4..5912a2336d0 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -484,9 +484,7 @@ SPIDER_CONN *spider_create_conn( conn->conn_key = tmp_name; memcpy(conn->conn_key, share->conn_keys[link_idx], share->conn_keys_lengths[link_idx]); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE conn->conn_key_hash_value = share->conn_keys_hash_value[link_idx]; -#endif spider_memcpy_or_null(&conn->tgt_host, tmp_host, share->tgt_hosts[link_idx], &conn->tgt_host_length, share->tgt_hosts_lengths[link_idx]); @@ -599,14 +597,9 @@ SPIDER_CONN *spider_create_conn( pthread_mutex_unlock(&spider_conn_id_mutex); pthread_mutex_lock(&spider_ipport_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value( &spider_ipport_conns, conn->conn_key_hash_value, (uchar*)conn->conn_key, conn->conn_key_length))) -#else - if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search( - &spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length))) -#endif { /* exists, +1 */ pthread_mutex_unlock(&spider_ipport_conn_mutex); pthread_mutex_lock(&ip_port_conn->mutex); @@ -679,7 +672,6 @@ SPIDER_CONN *spider_get_conn( #ifdef DBUG_TRACE spider_print_keys(conn_key, share->conn_keys_lengths[link_idx]); #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ( (another && !(conn = (SPIDER_CONN*) my_hash_search_using_hash_value( @@ -692,16 +684,6 @@ SPIDER_CONN *spider_get_conn( share->conn_keys_hash_value[link_idx], (uchar*) conn_key, share->conn_keys_lengths[link_idx]))) ) -#else - if ( - (another && - !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_another_conn_hash, - (uchar*) conn_key, share->conn_keys_lengths[link_idx]))) || - (!another && - !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash, - (uchar*) conn_key, share->conn_keys_lengths[link_idx]))) - ) -#endif { if ( !trx->thd || @@ -711,16 +693,10 @@ SPIDER_CONN *spider_get_conn( ) ) { pthread_mutex_lock(&spider_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value( &spider_open_connections, share->conn_keys_hash_value[link_idx], (uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx]))) -#else - if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections, - (uchar*) share->conn_keys[link_idx], - share->conn_keys_lengths[link_idx]))) -#endif { pthread_mutex_unlock(&spider_conn_mutex); if (spider_param_max_connections()) @@ -1140,16 +1116,10 @@ int spider_conn_queue_and_merge_loop_check( SPIDER_CONN_LOOP_CHECK *lcqptr, *lcrptr; DBUG_ENTER("spider_conn_queue_and_merge_loop_check"); DBUG_PRINT("info", ("spider conn=%p", conn)); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(lcqptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search_using_hash_value(&conn->loop_check_queue, lcptr->hash_value_to, (uchar *) lcptr->to_name.str, lcptr->to_name.length))) -#else - if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search( - &conn->loop_check_queue, - (uchar *) lcptr->to_name.str, lcptr->to_name.length)))) -#endif { /* Construct the right hand side: @@ -1196,9 +1166,7 @@ int spider_conn_queue_and_merge_loop_check( TODO: the new lcrptr has the same cur_name, to_name, full_name and from_value as lcqptr, but they do not seem to be relevant. */ -#ifdef SPIDER_HAS_HASH_VALUE_TYPE lcrptr->hash_value_to = lcqptr->hash_value_to; -#endif lcrptr->cur_name.str = cur_name; lcrptr->cur_name.length = lcqptr->cur_name.length; memcpy(cur_name, lcqptr->cur_name.str, lcqptr->cur_name.length + 1); @@ -1439,19 +1407,12 @@ int spider_conn_queue_loop_check( memcpy(tmp_name, to_str.str, to_str.length); tmp_name += to_str.length; *tmp_name = '\0'; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&conn->loop_checked, (uchar *) loop_check_buf, buf_sz - 1); -#endif pthread_mutex_lock(&conn->loop_check_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search_using_hash_value(&conn->loop_checked, hash_value, (uchar *) loop_check_buf, buf_sz - 1); -#else - lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search( - &conn->loop_checked, (uchar *) loop_check_buf, buf_sz - 1); -#endif if ( !lcptr || ( @@ -1506,10 +1467,8 @@ int spider_conn_queue_loop_check( spider_conn_queue_and_merge_loop_check() */ lcptr->merged_value.str = merged_value; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE lcptr->hash_value_to = my_calc_hash(&conn->loop_check_queue, (uchar *) to_str.str, to_str.length); -#endif /* Mark as checked. It will be added to loop_check_queue in spider_conn_queue_and_merge_loop_check() below for checking @@ -4240,15 +4199,9 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( set_timespec(abstime, 0); pthread_mutex_lock(&spider_ipport_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value( &spider_ipport_conns, share->conn_keys_hash_value[link_idx], (uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx]))) -#else - if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search( - &spider_ipport_conns, - (uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx]))) -#endif { /* exists */ pthread_mutex_unlock(&spider_ipport_conn_mutex); pthread_mutex_lock(&ip_port_conn->mutex); @@ -4287,16 +4240,10 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( } pthread_mutex_lock(&spider_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((conn = (SPIDER_CONN*) my_hash_search_using_hash_value( &spider_open_connections, share->conn_keys_hash_value[link_idx], (uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx]))) -#else - if ((conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections, - (uchar*) share->conn_keys[link_idx], - share->conn_keys_lengths[link_idx]))) -#endif { /* get conn from spider_open_connections, then delete conn in spider_open_connections */ #ifdef HASH_UPDATE_WITH_HASH_VALUE @@ -4389,9 +4336,7 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn) ret->conn_id = conn->conn_id; ret->ip_port_count = 1; // init -#ifdef SPIDER_HAS_HASH_VALUE_TYPE ret->key_hash_value = conn->conn_key_hash_value; -#endif DBUG_RETURN(ret); err_malloc_key: spider_my_free(ret, MYF(0)); diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index c9eeb9d66d4..ef0c304c89f 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -50,10 +50,8 @@ typedef struct st_spider_conn_loop_check SPIDER_LOP_CHK_IGNORED */ uint flag; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE /* hash value of to_name, used for the hash conn->loop_checked */ my_hash_value_type hash_value_to; -#endif /* The fully qualified name of the current spider table, which will also be used to construct the user var name to set in the data diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 401774ed508..7ecd356873b 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -60,9 +60,7 @@ extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; #define SPIDER_SQL_PING_TABLE_STR "spider_ping_table(" #define SPIDER_SQL_PING_TABLE_LEN (sizeof(SPIDER_SQL_PING_TABLE_STR) - 1) -#ifdef SPIDER_HAS_HASH_VALUE_TYPE extern HASH spider_open_connections; -#endif pthread_mutex_t spider_open_conn_mutex; const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 04f4bfd22ee..c41379e26d5 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -7139,9 +7139,7 @@ spider_mbase_share::spider_mbase_share( table_names_str(NULL), db_names_str(NULL), db_table_str(NULL), -#ifdef SPIDER_HAS_HASH_VALUE_TYPE db_table_str_hash_value(NULL), -#endif table_nm_max_length(0), db_nm_max_length(0), column_name_str(NULL), @@ -7228,10 +7226,8 @@ int spider_mbase_share::init() __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL), &key_select_pos, sizeof(int) * keys, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE &db_table_str_hash_value, sizeof(my_hash_value_type) * spider_share->all_link_count, -#endif NullS)) ) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -7511,10 +7507,8 @@ int spider_mbase_share::create_table_names_str() if ((error_num = append_table_name(str, roop_count))) goto error; } -#ifdef SPIDER_HAS_HASH_VALUE_TYPE db_table_str_hash_value[roop_count] = my_calc_hash( &spider_open_connections, (uchar*) str->ptr(), str->length()); -#endif } DBUG_RETURN(0); @@ -8358,10 +8352,8 @@ int spider_mbase_handler::init() link_for_hash[roop_count].link_idx = roop_count; link_for_hash[roop_count].db_table_str = &mysql_share->db_table_str[roop_count]; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE link_for_hash[roop_count].db_table_str_hash_value = mysql_share->db_table_str_hash_value[roop_count]; -#endif } DBUG_RETURN(0); } @@ -13153,7 +13145,6 @@ int spider_mbase_handler::append_lock_tables_list( &mysql_share->db_table_str[conn_link_idx]; DBUG_PRINT("info",("spider db_table_str=%s", tmp_link_for_hash2->db_table_str->c_ptr_safe())); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE tmp_link_for_hash2->db_table_str_hash_value = mysql_share->db_table_str_hash_value[conn_link_idx]; if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) @@ -13162,12 +13153,6 @@ int spider_mbase_handler::append_lock_tables_list( tmp_link_for_hash2->db_table_str_hash_value, (uchar*) tmp_link_for_hash2->db_table_str->ptr(), tmp_link_for_hash2->db_table_str->length()))) -#else - if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search( - &db_conn->lock_table_hash, - (uchar*) tmp_link_for_hash2->db_table_str->ptr(), - tmp_link_for_hash2->db_table_str->length()))) -#endif { if ((error_num = insert_lock_tables_list(conn, link_idx))) DBUG_RETURN(error_num); diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 0a133267e0e..9d86b837b32 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -622,9 +622,7 @@ public: spider_string *db_names_str; /* fixme: this field looks useless */ spider_string *db_table_str; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type *db_table_str_hash_value; -#endif uint table_nm_max_length; uint db_nm_max_length; spider_string *column_name_str; diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 362a77536ae..82216714a25 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -4475,9 +4475,7 @@ spider_oracle_share::spider_oracle_share( db_names_str(NULL), db_table_str(NULL), nextval_str(NULL), -#ifdef SPIDER_HAS_HASH_VALUE_TYPE db_table_str_hash_value(NULL), -#endif table_nm_max_length(0), db_nm_max_length(0), nextval_max_length(0), @@ -4530,10 +4528,8 @@ int spider_oracle_share::init() __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL), &key_select_pos, sizeof(int) * keys, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE &db_table_str_hash_value, sizeof(my_hash_value_type) * spider_share->all_link_count, -#endif NullS)) ) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -4811,10 +4807,8 @@ int spider_oracle_share::create_table_names_str() if ((error_num = append_table_name(str, roop_count))) goto error; } -#ifdef SPIDER_HAS_HASH_VALUE_TYPE db_table_str_hash_value[roop_count] = my_calc_hash( &spider_open_connections, (uchar*) str->ptr(), str->length()); -#endif } DBUG_RETURN(0); @@ -5498,10 +5492,8 @@ int spider_oracle_handler::init() link_for_hash[roop_count].link_idx = roop_count; link_for_hash[roop_count].db_table_str = &oracle_share->db_table_str[roop_count]; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE link_for_hash[roop_count].db_table_str_hash_value = oracle_share->db_table_str_hash_value[roop_count]; -#endif } DBUG_RETURN(0); } @@ -10357,7 +10349,6 @@ int spider_oracle_handler::append_lock_tables_list( tmp_link_for_hash2 = &link_for_hash[link_idx]; tmp_link_for_hash2->db_table_str = &oracle_share->db_table_str[conn_link_idx]; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE tmp_link_for_hash2->db_table_str_hash_value = oracle_share->db_table_str_hash_value[conn_link_idx]; if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) @@ -10366,12 +10357,6 @@ int spider_oracle_handler::append_lock_tables_list( tmp_link_for_hash2->db_table_str_hash_value, (uchar*) tmp_link_for_hash2->db_table_str->ptr(), tmp_link_for_hash2->db_table_str->length()))) -#else - if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search( - &db_conn->lock_table_hash, - (uchar*) tmp_link_for_hash2->db_table_str->ptr(), - tmp_link_for_hash2->db_table_str->length()))) -#endif { if ((error_num = insert_lock_tables_list(conn, link_idx))) DBUG_RETURN(error_num); diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h index 357fee35c67..f9eff649692 100644 --- a/storage/spider/spd_db_oracle.h +++ b/storage/spider/spd_db_oracle.h @@ -523,9 +523,7 @@ public: spider_string *db_names_str; spider_string *db_table_str; spider_string *nextval_str; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type *db_table_str_hash_value; -#endif uint table_nm_max_length; uint db_nm_max_length; uint nextval_max_length; diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 0a242787e8f..49a6edc6d26 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -275,10 +275,8 @@ int spider_udf_direct_sql_create_conn_key( spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_default_group); spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_dsn); tmp_name++; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE direct_sql->conn_key_hash_value = my_calc_hash(&spider_open_connections, (uchar*) direct_sql->conn_key, direct_sql->conn_key_length); -#endif DBUG_RETURN(0); } @@ -443,14 +441,9 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( pthread_mutex_unlock(&spider_conn_id_mutex); pthread_mutex_lock(&spider_ipport_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value( &spider_ipport_conns, conn->conn_key_hash_value, (uchar*)conn->conn_key, conn->conn_key_length))) -#else - if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search( - &spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length))) -#endif { /* exists, +1 */ pthread_mutex_unlock(&spider_ipport_conn_mutex); pthread_mutex_lock(&ip_port_conn->mutex); @@ -507,18 +500,11 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( SPIDER_CONN *conn = NULL; DBUG_ENTER("spider_udf_direct_sql_get_conn"); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ( !(conn = (SPIDER_CONN*) my_hash_search_using_hash_value( &trx->trx_conn_hash, direct_sql->conn_key_hash_value, (uchar*) direct_sql->conn_key, direct_sql->conn_key_length)) ) -#else - if ( - !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash, - (uchar*) direct_sql->conn_key, direct_sql->conn_key_length)) - ) -#endif { if ( ( @@ -527,14 +513,9 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( ) ) { pthread_mutex_lock(&spider_conn_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value( &spider_open_connections, direct_sql->conn_key_hash_value, (uchar*) direct_sql->conn_key, direct_sql->conn_key_length))) -#else - if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections, - (uchar*) direct_sql->conn_key, direct_sql->conn_key_length))) -#endif { pthread_mutex_unlock(&spider_conn_mutex); DBUG_PRINT("info",("spider create new conn")); diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 1d190ec2348..9190692223e 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -128,8 +128,6 @@ #define SPIDER_item_name_length(A) (A)->name.length const LEX_CSTRING SPIDER_empty_string = {"", 0}; -#define SPIDER_HAS_HASH_VALUE_TYPE - #define SPIDER_date_mode_t(A) date_mode_t(A) #define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E) #define SPIDER_get_linkage(A) A->get_linkage() @@ -498,9 +496,7 @@ typedef struct st_spider_link_for_hash ha_spider *spider; int link_idx; spider_string *db_table_str; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type db_table_str_hash_value; -#endif } SPIDER_LINK_FOR_HASH; /* alter table */ @@ -510,9 +506,7 @@ typedef struct st_spider_alter_table char *table_name; uint table_name_length; char *tmp_char; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type table_name_hash_value; -#endif longlong tmp_priority; uint link_count; uint all_link_count; @@ -606,9 +600,7 @@ typedef struct st_spider_conn uint conn_kind; char *conn_key; uint conn_key_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type conn_key_hash_value; -#endif int link_idx; spider_db_conn *db_conn; uint opened_handlers; @@ -817,9 +809,7 @@ typedef struct st_spider_lgtm_tblhnd_share { char *table_name; uint table_name_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type table_path_hash_value; -#endif pthread_mutex_t auto_increment_mutex; volatile bool auto_increment_init; volatile ulonglong auto_increment_lclval; @@ -842,9 +832,7 @@ typedef struct st_spider_wide_share { char *table_name; uint table_name_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type table_path_hash_value; -#endif uint use_count; THR_LOCK lock; pthread_mutex_t sts_mutex; @@ -951,9 +939,7 @@ typedef struct st_spider_transaction bool updated_in_this_trx; THD *thd; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type thd_hash_value; -#endif XID xid; HASH trx_conn_hash; uint trx_conn_hash_id; @@ -1048,11 +1034,9 @@ typedef struct st_spider_share pthread_mutex_t crd_mutex; TABLE_SHARE *table_share; SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type table_name_hash_value; #ifdef WITH_PARTITION_STORAGE_ENGINE my_hash_value_type table_path_hash_value; -#endif #endif volatile bool init; @@ -1227,9 +1211,7 @@ typedef struct st_spider_share char *bka_engine; int bka_engine_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type *conn_keys_hash_value; -#endif char **server_names; char **tgt_table_names; char **tgt_dbs; @@ -1390,9 +1372,7 @@ typedef struct st_spider_init_error_table { char *table_name; uint table_name_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type table_name_hash_value; -#endif bool init_error_with_message; char init_error_msg[MYSQL_ERRMSG_SIZE]; volatile int init_error; @@ -1469,9 +1449,7 @@ typedef struct st_spider_direct_sql uint tgt_dsn_length; uint conn_key_length; uint dbton_id; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type conn_key_hash_value; -#endif pthread_mutex_t *bg_mutex; pthread_cond_t *bg_cond; @@ -1510,9 +1488,7 @@ typedef struct st_spider_table_mon_list { char *key; uint key_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type key_hash_value; -#endif uint use_count; uint mutex_hash; @@ -1667,9 +1643,7 @@ char *spider_create_string( typedef struct st_spider_ip_port_conn { char *key; size_t key_len; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type key_hash_value; -#endif char *remote_ip_str; long remote_port; ulong ip_port_count; diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 8327a2c9fea..30f2814f8e1 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -105,9 +105,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( SPIDER_TABLE_MON_LIST *table_mon_list; MEM_ROOT mem_root; ulonglong mon_table_cache_version; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value; -#endif DBUG_ENTER("spider_get_ping_table_mon_list"); /* Reset the cache if the version does not match the requirement */ if (spider_mon_table_cache_version != spider_mon_table_cache_version_req) @@ -129,27 +127,17 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( spider_param_udf_table_mon_mutex_count()); DBUG_PRINT("info",("spider hash key=%s", str->c_ptr())); DBUG_PRINT("info",("spider hash key length=%u", str->length())); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value = my_calc_hash( &spider_udf_table_mon_list_hash[mutex_hash], (uchar*) str->c_ptr(), str->length()); -#endif pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]); mon_table_cache_version = (ulonglong) spider_mon_table_cache_version; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search_using_hash_value( &spider_udf_table_mon_list_hash[mutex_hash], hash_value, (uchar*) str->c_ptr(), str->length())) || table_mon_list->mon_table_cache_version != mon_table_cache_version ) -#else - if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search( - &spider_udf_table_mon_list_hash[mutex_hash], - (uchar*) str->c_ptr(), str->length())) || - table_mon_list->mon_table_cache_version != mon_table_cache_version - ) -#endif { /* If table_mon_list is found but the cache version does not match, remove it from the hash and free it. */ @@ -171,9 +159,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( table_mon_list->mon_table_cache_version = mon_table_cache_version; uint old_elements = spider_udf_table_mon_list_hash[mutex_hash].array.max_element; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE table_mon_list->key_hash_value = hash_value; -#endif #ifdef HASH_UPDATE_WITH_HASH_VALUE if (my_hash_insert_with_hash_value( &spider_udf_table_mon_list_hash[mutex_hash], @@ -280,22 +266,14 @@ int spider_release_ping_table_mon_list( mutex_hash = spider_udf_calc_hash(conv_name_str.c_ptr_safe(), spider_param_udf_table_mon_mutex_count()); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash( &spider_udf_table_mon_list_hash[mutex_hash], (uchar*) conv_name_str.c_ptr(), conv_name_str.length()); -#endif pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search_using_hash_value( &spider_udf_table_mon_list_hash[mutex_hash], hash_value, (uchar*) conv_name_str.c_ptr(), conv_name_str.length()))) -#else - if ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search( - &spider_udf_table_mon_list_hash[mutex_hash], - (uchar*) conv_name_str.c_ptr(), conv_name_str.length()))) -#endif spider_release_ping_table_mon_list_loop(mutex_hash, table_mon_list); pthread_mutex_unlock(&spider_udf_table_mon_mutexes[mutex_hash]); my_afree(buf); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index c1166c4e7d5..e6947fe3d6f 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -3938,10 +3938,8 @@ int spider_create_conn_keys( __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL), &share->conn_keys, sizeof(char *) * share->all_link_count, &share->conn_keys_lengths, length_base, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE &share->conn_keys_hash_value, sizeof(my_hash_value_type) * share->all_link_count, -#endif &tmp_name, sizeof(char) * share->conn_keys_charlen, &share->sql_dbton_ids, length_base, NullS)) @@ -4001,11 +3999,9 @@ int spider_create_conn_keys( spider_create_conn_key_add_one(&counter, &tmp_name, share->tgt_dsns[roop_count]); tmp_name++; tmp_name++; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE share->conn_keys_hash_value[roop_count] = my_calc_hash( &spider_open_connections, (uchar*) share->conn_keys[roop_count], share->conn_keys_lengths[roop_count]); -#endif } for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; roop_count2++) { @@ -4028,9 +4024,7 @@ SPIDER_SHARE *spider_create_share( #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *part_info, #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value, -#endif int *error_num ) { int bitmap_size, roop_count; @@ -4079,13 +4073,11 @@ SPIDER_SHARE *spider_create_share( share->table_mon_mutex_bitmap = tmp_table_mon_mutex_bitmap; share->bitmap_size = bitmap_size; share->table_share = table_share; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE share->table_name_hash_value = hash_value; #ifdef WITH_PARTITION_STORAGE_ENGINE share->table_path_hash_value = my_calc_hash(&spider_open_tables, (uchar*) table_share->path.str, table_share->path.length); #endif -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH share->table.s = table_share; share->table.field = table_share->field; @@ -4158,14 +4150,9 @@ SPIDER_SHARE *spider_create_share( goto error_init_crd_mutex; } -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(share->lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(tmp_name, length, hash_value, FALSE, TRUE, error_num))) -#else - if (!(share->lgtm_tblhnd_share = - spider_get_lgtm_tblhnd_share(tmp_name, length, FALSE, TRUE, error_num))) -#endif { goto error_get_lgtm_tblhnd_share; } @@ -4280,10 +4267,8 @@ SPIDER_SHARE *spider_get_share( DBUG_ENTER("spider_get_share"); top_share = spider->wide_handler->top_share; length = (uint) strlen(table_name); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) table_name, length); -#endif if (top_share) { lex_str.length = top_share->path.length + SPIDER_SQL_LOP_CHK_PRM_PRF_LEN; @@ -4328,22 +4313,15 @@ SPIDER_SHARE *spider_get_share( my_afree(loop_check_buf); } pthread_mutex_lock(&spider_tbl_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(share = (SPIDER_SHARE*) my_hash_search_using_hash_value( &spider_open_tables, hash_value, (uchar*) table_name, length))) -#else - if (!(share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables, - (uchar*) table_name, length))) -#endif { if (!(share = spider_create_share( table_name, table_share, #ifdef WITH_PARTITION_STORAGE_ENGINE table->part_info, #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif error_num ))) { goto error_alloc_share; @@ -5422,19 +5400,12 @@ void spider_update_link_status_for_share( SPIDER_SHARE *share; DBUG_ENTER("spider_update_link_status_for_share"); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) table_name, table_name_length); -#endif pthread_mutex_lock(&spider_tbl_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((share = (SPIDER_SHARE*) my_hash_search_using_hash_value( &spider_open_tables, hash_value, (uchar*) table_name, table_name_length))) -#else - if ((share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables, - (uchar*) table_name, table_name_length))) -#endif { DBUG_PRINT("info", ("spider share->link_status_init=%s", share->link_status_init ? "TRUE" : "FALSE")); @@ -5449,7 +5420,6 @@ void spider_update_link_status_for_share( DBUG_VOID_RETURN; } -#ifdef SPIDER_HAS_HASH_VALUE_TYPE SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( const char *table_name, uint table_name_length, @@ -5458,15 +5428,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( bool need_to_create, int *error_num ) -#else -SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( - const char *table_name, - uint table_name_length, - bool locked, - bool need_to_create, - int *error_num -) -#endif { SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share; char *tmp_name; @@ -5474,16 +5435,10 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( if (!locked) pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*) my_hash_search_using_hash_value( &spider_lgtm_tblhnd_share_hash, hash_value, (uchar*) table_name, table_name_length))) -#else - if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*) my_hash_search( - &spider_lgtm_tblhnd_share_hash, - (uchar*) table_name, table_name_length))) -#endif { DBUG_PRINT("info",("spider create new lgtm tblhnd share")); if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE *) @@ -5500,9 +5455,7 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( lgtm_tblhnd_share->table_name = tmp_name; memcpy(lgtm_tblhnd_share->table_name, table_name, lgtm_tblhnd_share->table_name_length); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE lgtm_tblhnd_share->table_path_hash_value = hash_value; -#endif if (mysql_mutex_init(spd_key_mutex_share_auto_increment, &lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST)) @@ -5578,16 +5531,10 @@ SPIDER_WIDE_SHARE *spider_get_wide_share( DBUG_ENTER("spider_get_wide_share"); pthread_mutex_lock(&spider_wide_share_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(wide_share = (SPIDER_WIDE_SHARE*) my_hash_search_using_hash_value( &spider_open_wide_share, share->table_path_hash_value, (uchar*) table_share->path.str, table_share->path.length))) -#else - if (!(wide_share = (SPIDER_WIDE_SHARE*) my_hash_search( - &spider_open_wide_share, - (uchar*) table_share->path.str, table_share->path.length))) -#endif { DBUG_PRINT("info",("spider create new wide share")); if (!(wide_share = (SPIDER_WIDE_SHARE *) @@ -5607,9 +5554,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share( wide_share->table_name = tmp_name; memcpy(wide_share->table_name, table_share->path.str, wide_share->table_name_length); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE wide_share->table_path_hash_value = share->table_path_hash_value; -#endif wide_share->cardinality = tmp_cardinality; wide_share->crd_get_time = wide_share->sts_get_time = @@ -7243,16 +7188,10 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table( char *tmp_name; DBUG_ENTER("spider_get_init_error_table"); pthread_mutex_lock(&spider_init_error_tbl_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search_using_hash_value( &spider_init_error_tables, share->table_name_hash_value, (uchar*) share->table_name, share->table_name_length))) -#else - if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search( - &spider_init_error_tables, - (uchar*) share->table_name, share->table_name_length))) -#endif { if (!create) { @@ -7271,10 +7210,8 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table( memcpy(tmp_name, share->table_name, share->table_name_length); spider_init_error_table->table_name = tmp_name; spider_init_error_table->table_name_length = share->table_name_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE spider_init_error_table->table_name_hash_value = share->table_name_hash_value; -#endif uint old_elements = spider_init_error_tables.array.max_element; #ifdef HASH_UPDATE_WITH_HASH_VALUE if (my_hash_insert_with_hash_value(&spider_init_error_tables, @@ -7305,20 +7242,13 @@ void spider_delete_init_error_table( ) { SPIDER_INIT_ERROR_TABLE *spider_init_error_table; uint length = strlen(name); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) name, length); -#endif DBUG_ENTER("spider_delete_init_error_table"); pthread_mutex_lock(&spider_init_error_tbl_mutex); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search_using_hash_value(&spider_init_error_tables, hash_value, (uchar*) name, length))) -#else - if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search( - &spider_init_error_tables, (uchar*) name, length))) -#endif { #ifdef HASH_UPDATE_WITH_HASH_VALUE my_hash_delete_with_hash_value(&spider_init_error_tables, @@ -8422,10 +8352,8 @@ int spider_discover_table_structure( #ifdef WITH_PARTITION_STORAGE_ENGINE str_len = str.length(); #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) table_name, table_name_length); -#endif if (!(trx = spider_get_trx(thd, TRUE, &error_num))) { DBUG_PRINT("info",("spider spider_get_trx error")); @@ -8442,9 +8370,7 @@ int spider_discover_table_structure( #ifdef WITH_PARTITION_STORAGE_ENGINE NULL, #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif &error_num ))) { DBUG_RETURN(error_num); @@ -8503,9 +8429,7 @@ int spider_discover_table_structure( DBUG_PRINT("info",("spider tmp_name=%s", tmp_name)); if (!(spider_share = spider_create_share(tmp_name, share, part_info, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif &error_num ))) { DBUG_RETURN(error_num); @@ -8531,9 +8455,7 @@ int spider_discover_table_structure( DBUG_PRINT("info",("spider tmp_name=%s", tmp_name)); if (!(spider_share = spider_create_share(tmp_name, share, part_info, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif &error_num ))) { DBUG_RETURN(error_num); @@ -8574,9 +8496,7 @@ int spider_discover_table_structure( DBUG_PRINT("info",("spider tmp_name=%s", tmp_name)); if (!(spider_share = spider_create_share(tmp_name, share, part_info, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif &error_num ))) { DBUG_RETURN(error_num); @@ -8612,9 +8532,7 @@ int spider_discover_table_structure( DBUG_PRINT("info",("spider tmp_name=%s", tmp_name)); if (!(spider_share = spider_create_share(tmp_name, share, part_info, -#ifdef SPIDER_HAS_HASH_VALUE_TYPE hash_value, -#endif &error_num ))) { DBUG_RETURN(error_num); diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index b444ba2d3d9..8bca3c047fa 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -175,7 +175,6 @@ int spider_create_conn_keys( SPIDER_SHARE *share ); -#ifdef SPIDER_HAS_HASH_VALUE_TYPE SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( const char *table_name, uint table_name_length, @@ -184,15 +183,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( bool need_to_create, int *error_num ); -#else -SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( - const char *table_name, - uint table_name_length, - bool locked, - bool need_to_create, - int *error_num -); -#endif void spider_free_lgtm_tblhnd_share_alloc( SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share, @@ -205,9 +195,7 @@ SPIDER_SHARE *spider_create_share( #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *part_info, #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value, -#endif int *error_num ); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index dabec76f4dd..05a6fead947 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -587,11 +587,9 @@ int spider_create_trx_alter_table( alter_table->table_name = tmp_name; memcpy(alter_table->table_name, share->table_name, share->table_name_length); alter_table->table_name_length = share->table_name_length; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE DBUG_PRINT("info",("spider table_name_hash_value=%u", share->table_name_hash_value)); alter_table->table_name_hash_value = share->table_name_hash_value; -#endif alter_table->tmp_priority = share->priority; alter_table->link_count = share->link_count; alter_table->all_link_count = share->all_link_count; @@ -1189,13 +1187,11 @@ SPIDER_TRX *spider_get_trx( trx->trx_ha_hash.array.size_of_element); trx->thd = (THD*) thd; -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if (thd) trx->thd_hash_value = my_calc_hash(&spider_allocated_thds, (uchar*) thd, sizeof(THD *)); else trx->thd_hash_value = 0; -#endif pthread_mutex_lock(&spider_thread_id_mutex); trx->spider_thread_id = spider_thread_id; ++spider_thread_id; @@ -1526,13 +1522,11 @@ static int spider_xa_lock( DBUG_ENTER("spider_xa_lock"); #ifdef SPIDER_XID_USES_xid_cache_iterate #else -#ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache, (uchar*) xid_state->xid.key(), xid_state->xid.key_length()); #ifdef XID_CACHE_IS_SPLITTED uint idx = hash_value % *spd_db_att_xid_cache_split_num; #endif -#endif #endif old_proc_info = thd_proc_info(thd, "Locking xid by Spider"); #ifdef SPIDER_XID_USES_xid_cache_iterate @@ -1548,17 +1542,12 @@ static int spider_xa_lock( #else pthread_mutex_lock(spd_db_att_LOCK_xid_cache); #endif -#ifdef SPIDER_HAS_HASH_VALUE_TYPE #ifdef XID_CACHE_IS_SPLITTED if (my_hash_search_using_hash_value(&spd_db_att_xid_cache[idx], hash_value, xid_state->xid.key(), xid_state->xid.key_length())) #else if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value, xid_state->xid.key(), xid_state->xid.key_length())) -#endif -#else - if (my_hash_search(spd_db_att_xid_cache, - xid_state->xid.key(), xid_state->xid.key_length())) #endif { error_num = ER_SPIDER_XA_LOCKED_NUM; @@ -3869,14 +3858,9 @@ SPIDER_TRX_HA *spider_check_trx_ha( link_bitmap_size, which is an indication of a share that has been freed. Delete the trx_ha and return NULL on mismatch. */ -#ifdef SPIDER_HAS_HASH_VALUE_TYPE if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search_using_hash_value( &trx->trx_ha_hash, share->table_name_hash_value, (uchar*) share->table_name, share->table_name_length))) -#else - if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search(&trx->trx_ha_hash, - (uchar*) share->table_name, share->table_name_length))) -#endif { if (trx_ha->share == share && trx_ha->link_count == share->link_count && trx_ha->link_bitmap_size == share->link_bitmap_size) From ba9bebd7194a6bf0145c2dba4dd243baa0826088 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:33:33 +0800 Subject: [PATCH 053/185] MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED arg_count was protected since 2015 in commit afa17734395f842f728e2539145854d3eb7cd9a8 --- storage/spider/spd_db_oracle.cc | 4 ---- storage/spider/spd_include.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 82216714a25..a4bccda1d71 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -3092,11 +3092,7 @@ int spider_db_oracle_util::open_item_func( { if ( !strncasecmp("rand", func_name, func_name_length) && -#ifdef SPIDER_Item_args_arg_count_IS_PROTECTED !item_func->argument_count() -#else - !item_func->arg_count -#endif ) { if (str) str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 9190692223e..a99dc7e96dd 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -90,8 +90,6 @@ #define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #define SPIDER_XID_USES_xid_cache_iterate -#define SPIDER_Item_args_arg_count_IS_PROTECTED - #define SPIDER_Item_func_conv_charset_conv_charset collation.collation #define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT From 64581c83e8c9414cfde39f9405285ba1c93604ab Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:34:30 +0800 Subject: [PATCH 054/185] MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD net has thd since 2015 in 56aa19989f5800df8a398173727558bfb3ea1251 for MDEV-6152 --- storage/spider/spd_db_mysql.cc | 2 -- storage/spider/spd_environ.h | 1 - 2 files changed, 3 deletions(-) diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index c41379e26d5..8fc3f8a6295 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -2032,9 +2032,7 @@ int spider_db_mbase::connect( connect_retry_count--; my_sleep((ulong) connect_retry_interval); } else { -#ifdef SPIDER_NET_HAS_THD db_conn->net.thd = NULL; -#endif if (connect_mutex) pthread_mutex_unlock(&spider_open_conn_mutex); break; diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 826362d24c4..356dffcb6da 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -23,7 +23,6 @@ #define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE -#define SPIDER_NET_HAS_THD #define HANDLER_HAS_TOP_TABLE_FIELDS #define HANDLER_HAS_DIRECT_UPDATE_ROWS From de3dd942c006a2e04f025716aaa2185be3957e64 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:35:05 +0800 Subject: [PATCH 055/185] MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN HA_EXTRA_STARTING_ORDERED_INDEX_SCAN was added latest 2018: 921c5e93145 --- storage/spider/ha_spider.cc | 4 ---- storage/spider/spd_environ.h | 1 - 2 files changed, 5 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index fa6568a9f65..f8e5efc0f55 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1436,10 +1436,7 @@ int ha_spider::extra( if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) DBUG_RETURN(error_num); break; -#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF) -#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: -#endif #ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF case HA_EXTRA_USE_CMP_REF: #endif @@ -1470,7 +1467,6 @@ int ha_spider::extra( } } break; -#endif default: break; } diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 356dffcb6da..a0810955a91 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -28,7 +28,6 @@ #define HANDLER_HAS_DIRECT_UPDATE_ROWS #define HANDLER_HAS_DIRECT_AGGREGATE #define PARTITION_HAS_GET_PART_SPEC -#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC #define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT From d5d65b948b608b5d1c041a03a4dde27b742e1ad9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:36:03 +0800 Subject: [PATCH 056/185] MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF HA_EXTRA_USE_CMP_REF is undefined, and remains so as of 11.5 c96b23f99409cad9c0dac5040561136211486995 --- storage/spider/ha_spider.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index f8e5efc0f55..24c4f26d732 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1437,9 +1437,6 @@ int ha_spider::extra( DBUG_RETURN(error_num); break; case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: -#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF - case HA_EXTRA_USE_CMP_REF: -#endif DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN")); if (table_share->primary_key != MAX_KEY) { From 0650c87d9bbf76bf4e34355979245dd4d738b86b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:36:48 +0800 Subject: [PATCH 057/185] MDEV-27647 Spider: remove HANDLER_HAS_DIRECT_UPDATE_ROWS --- storage/spider/ha_spider.cc | 75 -------------------------- storage/spider/ha_spider.h | 14 ----- storage/spider/spd_conn.cc | 2 - storage/spider/spd_db_conn.cc | 14 ----- storage/spider/spd_db_conn.h | 6 --- storage/spider/spd_db_include.cc | 2 - storage/spider/spd_db_include.h | 4 -- storage/spider/spd_db_mysql.cc | 8 --- storage/spider/spd_db_mysql.h | 4 -- storage/spider/spd_db_oracle.cc | 2 - storage/spider/spd_db_oracle.h | 2 - storage/spider/spd_environ.h | 1 - storage/spider/spd_group_by_handler.cc | 2 - storage/spider/spd_include.h | 4 -- storage/spider/spd_param.cc | 4 -- 15 files changed, 144 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 24c4f26d732..306e223a16e 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -96,9 +96,7 @@ ha_spider::ha_spider( dml_inited = FALSE; use_pre_call = FALSE; use_pre_action = FALSE; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif #ifdef HA_CAN_BULK_ACCESS is_bulk_access_clone = FALSE; synced_from_clone_source = FALSE; @@ -181,9 +179,7 @@ ha_spider::ha_spider( dml_inited = FALSE; use_pre_call = FALSE; use_pre_action = FALSE; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif #ifdef HA_CAN_BULK_ACCESS is_bulk_access_clone = FALSE; synced_from_clone_source = FALSE; @@ -793,22 +789,7 @@ void ha_spider::check_access_kind( wide_handler->sql_command = thd_sql_command(thd); DBUG_PRINT("info",("spider sql_command=%u", wide_handler->sql_command)); DBUG_PRINT("info",("spider thd->query_id=%lld", thd->query_id)); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS wide_handler->update_request = FALSE; -#else - if ( - wide_handler->sql_command == SQLCOM_UPDATE || - wide_handler->sql_command == SQLCOM_UPDATE_MULTI || - /* for triggers */ - wide_handler->sql_command == SQLCOM_INSERT || - wide_handler->sql_command == SQLCOM_INSERT_SELECT || - wide_handler->sql_command == SQLCOM_DELETE || - wide_handler->sql_command == SQLCOM_DELETE_MULTI - ) - wide_handler->update_request = TRUE; - else - wide_handler->update_request = FALSE; -#endif DBUG_VOID_RETURN; } @@ -1263,9 +1244,7 @@ int ha_spider::reset() wide_handler->condition = tmp_cond; } wide_handler->cond_check = FALSE; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS wide_handler->direct_update_fields = NULL; -#endif #ifdef INFO_KIND_FORCE_LIMIT_BEGIN wide_handler->info_limit = 9223372036854775807LL; #endif @@ -1343,9 +1322,7 @@ int ha_spider::reset() ft_count = 0; ft_init_without_index_init = FALSE; sql_kinds = 0; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif prev_index_rnd_init = SPD_NONE; result_list.have_sql_kind_backup = FALSE; result_list.direct_order_limit = FALSE; @@ -1421,11 +1398,9 @@ int ha_spider::extra( case HA_EXTRA_WRITE_CANNOT_REPLACE: wide_handler->write_can_replace = FALSE; break; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS case HA_EXTRA_INSERT_WITH_UPDATE: wide_handler->insert_with_update = TRUE; break; -#endif case HA_EXTRA_ATTACH_CHILDREN: DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN")); if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) @@ -1616,9 +1591,7 @@ int ha_spider::index_read_map_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ( find_flag >= HA_READ_MBR_CONTAIN && find_flag <= HA_READ_MBR_EQUAL @@ -2088,9 +2061,7 @@ int ha_spider::index_read_last_map_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = index_handler_init())) DBUG_RETURN(check_error_mode_eof(error_num)); if (is_clone) @@ -2546,9 +2517,7 @@ int ha_spider::index_first_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = index_handler_init())) DBUG_RETURN(check_error_mode_eof(error_num)); if (is_clone) @@ -2920,9 +2889,7 @@ int ha_spider::index_last_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = index_handler_init())) DBUG_RETURN(check_error_mode_eof(error_num)); if (is_clone) @@ -3347,9 +3314,7 @@ int ha_spider::read_range_first_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ( start_key && start_key->flag >= HA_READ_MBR_CONTAIN && @@ -3935,9 +3900,7 @@ int ha_spider::read_multi_range_first_internal( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = index_handler_init())) DBUG_RETURN(check_error_mode_eof(error_num)); if (is_clone) @@ -6809,9 +6772,7 @@ int ha_spider::rnd_next_internal( /* do not copy table data at alter table */ if (wide_handler->sql_command == SQLCOM_ALTER_TABLE) DBUG_RETURN(HA_ERR_END_OF_FILE); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if (rnd_scan_and_first) { @@ -9274,12 +9235,8 @@ int ha_spider::write_row( DBUG_RETURN(check_error_mode(error_num)); if (bulk_insert) bulk_size = -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS (wide_handler->insert_with_update && !result_list.insert_dup_update_pushdown) || -#else - wide_handler->insert_with_update || -#endif (!direct_dup_insert && wide_handler->ignore_dup_key) ? 0 : spider_param_bulk_size(wide_handler->trx->thd, share->bulk_size); else @@ -9318,7 +9275,6 @@ int ha_spider::pre_write_row( } #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS void ha_spider::direct_update_init( THD *thd, bool hs_request @@ -9328,7 +9284,6 @@ void ha_spider::direct_update_init( do_direct_update = TRUE; DBUG_VOID_RETURN; } -#endif bool ha_spider::start_bulk_update( ) { @@ -9424,9 +9379,7 @@ int ha_spider::update_row( #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_update_count); #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = spider_db_update(this, table, old_data))) DBUG_RETURN(check_error_mode(error_num)); if (table->found_next_number_field && @@ -9470,7 +9423,6 @@ int ha_spider::update_row( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool ha_spider::check_direct_update_sql_part( st_select_lex *select_lex, longlong select_limit, @@ -10006,7 +9958,6 @@ int ha_spider::pre_direct_update_rows() } #endif #endif -#endif bool ha_spider::start_bulk_delete( ) { @@ -10056,15 +10007,12 @@ int ha_spider::delete_row( #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_delete_count); #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif if ((error_num = spider_db_delete(this, table, buf))) DBUG_RETURN(check_error_mode(error_num)); DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool ha_spider::check_direct_delete_sql_part( st_select_lex *select_lex, longlong select_limit, @@ -10451,7 +10399,6 @@ int ha_spider::pre_direct_delete_rows() } #endif #endif -#endif int ha_spider::delete_all_rows() { @@ -10480,9 +10427,7 @@ int ha_spider::truncate() { DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; -#endif sql_kinds = SPIDER_SQL_KIND_SQL; for (roop_count = 0; roop_count < (int) share->link_count; roop_count++) sql_kind[roop_count] = SPIDER_SQL_KIND_SQL; @@ -11453,8 +11398,6 @@ int ha_spider::info_push( #endif #ifdef HA_CAN_BULK_ACCESS if ( -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS -#endif info_type != INFO_KIND_BULK_ACCESS_BEGIN && info_type != INFO_KIND_BULK_ACCESS_CURRENT && info_type != INFO_KIND_BULK_ACCESS_END @@ -11476,10 +11419,8 @@ int ha_spider::info_push( } #endif -#if defined(HANDLER_HAS_DIRECT_UPDATE_ROWS) || defined(HA_CAN_BULK_ACCESS) switch (info_type) { -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef INFO_KIND_UPDATE_FIELDS case INFO_KIND_UPDATE_FIELDS: DBUG_PRINT("info",("spider INFO_KIND_UPDATE_FIELDS")); @@ -11507,7 +11448,6 @@ int ha_spider::info_push( wide_handler->info_limit = 9223372036854775807LL; break; #endif -#endif #ifdef HA_CAN_BULK_ACCESS case INFO_KIND_BULK_ACCESS_BEGIN: DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN")); @@ -11570,7 +11510,6 @@ int ha_spider::info_push( default: break; } -#endif DBUG_RETURN(error_num); } @@ -12379,9 +12318,7 @@ int ha_spider::index_handler_init() roop_end = search_link_idx + 1; } sql_kinds = 0; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS direct_update_kinds = 0; -#endif for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -12467,9 +12404,7 @@ int ha_spider::rnd_handler_init() roop_end = search_link_idx + 1; } sql_kinds = 0; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS direct_update_kinds = 0; -#endif for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -12695,7 +12630,6 @@ void ha_spider::check_pre_call( DBUG_VOID_RETURN; } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS void ha_spider::check_insert_dup_update_pushdown() { THD *thd = wide_handler->trx->thd; @@ -12714,7 +12648,6 @@ void ha_spider::check_insert_dup_update_pushdown() } DBUG_VOID_RETURN; } -#endif #ifdef HA_CAN_BULK_ACCESS SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link() @@ -12848,8 +12781,6 @@ int ha_spider::sync_from_clone_source( external_lock_cnt = spider->external_lock_cnt; } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS -#endif DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", dbton_handler)); DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", @@ -13132,7 +13063,6 @@ int ha_spider::append_update_set_sql_part() DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int ha_spider::append_direct_update_set_sql_part() { int error_num; @@ -13153,9 +13083,7 @@ int ha_spider::append_direct_update_set_sql_part() DBUG_RETURN(0); } -#endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int ha_spider::append_dup_update_pushdown_sql_part( const char *alias, uint alias_length @@ -13221,7 +13149,6 @@ int ha_spider::check_update_columns_sql_part() } DBUG_RETURN(0); } -#endif int ha_spider::append_delete_sql_part() { @@ -15030,12 +14957,10 @@ int ha_spider::dml_init() conns[roop_count]->semi_trx_isolation = -1; } } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS if (wide_handler->insert_with_update) { check_insert_dup_update_pushdown(); } -#endif dml_inited = TRUE; DBUG_RETURN(0); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 1bde115de6c..da1e5fd2df4 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -175,10 +175,8 @@ public: corresponding m_handler_cid is t00003 */ char **m_handler_cid; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool do_direct_update; uint direct_update_kinds; -#endif spider_index_rnd_init prev_index_rnd_init; #ifdef HANDLER_HAS_DIRECT_AGGREGATE SPIDER_ITEM_HLD *direct_aggregate_item_first; @@ -494,12 +492,10 @@ public: uchar *buf ); #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS void direct_update_init( THD *thd, bool hs_request ); -#endif bool start_bulk_update() override; int exec_bulk_update( ha_rows *dup_key_found @@ -526,7 +522,6 @@ public: uchar *new_data ); #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool check_direct_update_sql_part( st_select_lex *select_lex, longlong select_limit, @@ -648,14 +643,12 @@ public: #else int pre_direct_update_rows(); #endif -#endif #endif bool start_bulk_delete() override; int end_bulk_delete() override; int delete_row( const uchar *buf ) override; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool check_direct_delete_sql_part( st_select_lex *select_lex, longlong select_limit, @@ -724,7 +717,6 @@ public: #else int pre_direct_delete_rows(); #endif -#endif #endif int delete_all_rows() override; int truncate() override; @@ -895,9 +887,7 @@ public: void check_pre_call( bool use_parallel ); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS void check_insert_dup_update_pushdown(); -#endif #ifdef HA_CAN_BULK_ACCESS SPIDER_BULK_ACCESS_LINK *create_bulk_access_link(); void delete_bulk_access_link( @@ -926,10 +916,7 @@ public: int append_insert_sql_part(); int append_update_sql_part(); int append_update_set_sql_part(); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int append_direct_update_set_sql_part(); -#endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int append_dup_update_pushdown_sql_part( const char *alias, uint alias_length @@ -939,7 +926,6 @@ public: uint alias_length ); int check_update_columns_sql_part(); -#endif int append_delete_sql_part(); int append_select_sql_part( ulong sql_type diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 5912a2336d0..6b3d90bea3d 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -4100,7 +4100,6 @@ bool spider_conn_use_handler( DBUG_PRINT("info",("spider use_handler=%d", use_handler)); DBUG_PRINT("info",("spider spider->conn_kind[link_idx]=%u", spider->conn_kind[link_idx])); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS if (spider->do_direct_update) { spider->sql_kinds |= SPIDER_SQL_KIND_SQL; @@ -4109,7 +4108,6 @@ bool spider_conn_use_handler( DBUG_PRINT("info",("spider FALSE by using direct_update")); DBUG_RETURN(FALSE); } -#endif if (spider->use_spatial_index) { DBUG_PRINT("info",("spider FALSE by use_spatial_index")); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 7ecd356873b..dd253822626 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -6908,7 +6908,6 @@ int spider_db_update( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int spider_db_direct_update( ha_spider *spider, @@ -6956,17 +6955,14 @@ int spider_db_direct_update( (spider->direct_update_kinds & SPIDER_SQL_KIND_HS) */ -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS if (!spider->do_direct_update) { -#endif if ( (spider->sql_kinds & SPIDER_SQL_KIND_SQL) && (error_num = spider->append_update_set_sql_part()) ) { DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS } else { if ( (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) && @@ -6975,7 +6971,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } } -#endif result_list->desc_flg = FALSE; result_list->sorted = TRUE; @@ -7171,17 +7166,14 @@ int spider_db_direct_update( spider->wide_handler->direct_update_fields */ -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS if (!spider->do_direct_update) { -#endif if ( (spider->sql_kinds & SPIDER_SQL_KIND_SQL) && (error_num = spider->append_update_set_sql_part()) ) { DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS } else { if ( (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) && @@ -7190,7 +7182,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } } -#endif result_list->desc_flg = FALSE; result_list->sorted = TRUE; @@ -7351,7 +7342,6 @@ int spider_db_direct_update( DBUG_RETURN(0); } #endif -#endif #ifdef HA_CAN_BULK_ACCESS int spider_db_bulk_direct_update( @@ -7491,7 +7481,6 @@ int spider_db_delete( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int spider_db_direct_delete( ha_spider *spider, @@ -7858,7 +7847,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num2); } #endif -#endif int spider_db_delete_all_rows( ha_spider *spider @@ -9506,7 +9494,6 @@ int spider_db_append_condition( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int spider_db_append_update_columns( ha_spider *spider, spider_string *str, @@ -9561,7 +9548,6 @@ int spider_db_append_update_columns( str->length(str->length() - SPIDER_SQL_COMMA_LEN); DBUG_RETURN(0); } -#endif #ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_db_check_select_colum_in_group( diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index bae4ee35439..5b8dc65b262 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -799,7 +799,6 @@ int spider_db_update( const uchar *old_data ); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int spider_db_direct_update( ha_spider *spider, @@ -817,7 +816,6 @@ int spider_db_direct_update( ha_rows *found_rows ); #endif -#endif #ifdef HA_CAN_BULK_ACCESS int spider_db_bulk_direct_update( @@ -838,7 +836,6 @@ int spider_db_delete( const uchar *buf ); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int spider_db_direct_delete( ha_spider *spider, @@ -854,7 +851,6 @@ int spider_db_direct_delete( ha_rows *delete_rows ); #endif -#endif int spider_db_delete_all_rows( ha_spider *spider @@ -1056,7 +1052,6 @@ int spider_db_append_condition( bool test_flg ); -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int spider_db_append_update_columns( ha_spider *spider, spider_string *str, @@ -1066,7 +1061,6 @@ int spider_db_append_update_columns( bool use_fields, spider_fields *fields ); -#endif #ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_db_check_select_colum_in_group( diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc index 4a422e0e1f2..16a449e94cc 100644 --- a/storage/spider/spd_db_include.cc +++ b/storage/spider/spd_db_include.cc @@ -154,7 +154,6 @@ int spider_db_handler::checksum_table( } #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool spider_db_handler::check_direct_update( st_select_lex *select_lex, longlong select_limit, @@ -188,4 +187,3 @@ bool spider_db_handler::check_direct_delete( } DBUG_RETURN(FALSE); } -#endif diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 32cefbaa258..0d080249d62 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1188,7 +1188,6 @@ public: virtual int append_update_part() = 0; virtual int append_delete_part() = 0; virtual int append_update_set_part() = 0; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS virtual int append_direct_update_set_part() = 0; virtual int append_dup_update_pushdown_part( const char *alias, @@ -1199,7 +1198,6 @@ public: uint alias_length ) = 0; virtual int check_update_columns_part() = 0; -#endif virtual int append_select_part( ulong sql_type ) = 0; @@ -1591,7 +1589,6 @@ public: ulong sql_type ) = 0; #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS virtual bool check_direct_update( st_select_lex *select_lex, longlong select_limit, @@ -1602,7 +1599,6 @@ public: longlong select_limit, longlong offset_limit ); -#endif }; class spider_db_copy_table diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 8fc3f8a6295..54ad30cebd2 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -9167,11 +9167,7 @@ int spider_mbase_handler::append_insert( spider->wide_handler->ignore_dup_key && spider->direct_dup_insert && !spider->wide_handler->write_can_replace && -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS (!spider->wide_handler->insert_with_update || !dup_update_sql.length()) && -#else - !spider->wide_handler->insert_with_update && -#endif /* for direct_dup_insert without patch for partition */ spider->wide_handler->sql_command != SQLCOM_REPLACE && spider->wide_handler->sql_command != SQLCOM_REPLACE_SELECT @@ -9329,7 +9325,6 @@ int spider_mbase_handler::append_update_set( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int spider_mbase_handler::append_direct_update_set_part() { int error_num; @@ -9406,7 +9401,6 @@ int spider_mbase_handler::append_update_columns( alias, alias_length, dbton_id, FALSE, NULL); DBUG_RETURN(error_num); } -#endif int spider_mbase_handler::append_select_part( ulong sql_type @@ -15721,7 +15715,6 @@ int spider_mbase_handler::append_order_by( } #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool spider_mbase_handler::check_direct_update( st_select_lex *select_lex, longlong select_limit, @@ -15741,7 +15734,6 @@ bool spider_mbase_handler::check_direct_delete( DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(FALSE); } -#endif spider_mbase_copy_table::spider_mbase_copy_table( spider_mbase_share *db_share diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 9d86b837b32..dcc35290103 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -858,7 +858,6 @@ public: int append_update_set( spider_string *str ); - #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int append_direct_update_set_part() override; int append_direct_update_set( spider_string *str @@ -877,7 +876,6 @@ public: const char *alias, uint alias_length ); - #endif int append_select_part( ulong sql_type ) override; @@ -1555,7 +1553,6 @@ public: spider_fields *fields ); #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS bool check_direct_update( st_select_lex *select_lex, longlong select_limit, @@ -1566,7 +1563,6 @@ public: longlong select_limit, longlong offset_limit ) override; -#endif }; class spider_mysql_handler: public spider_mbase_handler diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index a4bccda1d71..e0ef42793c2 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -6329,7 +6329,6 @@ int spider_oracle_handler::append_update_set( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int spider_oracle_handler::append_direct_update_set_part() { int error_num; @@ -6446,7 +6445,6 @@ int spider_oracle_handler::append_update_columns( DBUG_RETURN(error_num); */ } -#endif int spider_oracle_handler::append_select_part( ulong sql_type diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h index f9eff649692..8acffb5c150 100644 --- a/storage/spider/spd_db_oracle.h +++ b/storage/spider/spd_db_oracle.h @@ -743,7 +743,6 @@ public: int append_update_set( spider_string *str ); - #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int append_direct_update_set_part(); int append_direct_update_set( spider_string *str @@ -762,7 +761,6 @@ public: const char *alias, uint alias_length ); - #endif int append_select_part( ulong sql_type ); diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index a0810955a91..fbadb270f1f 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -25,7 +25,6 @@ #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define HANDLER_HAS_TOP_TABLE_FIELDS -#define HANDLER_HAS_DIRECT_UPDATE_ROWS #define HANDLER_HAS_DIRECT_AGGREGATE #define PARTITION_HAS_GET_PART_SPEC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 953802b7a5f..37bfc7ea8a7 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -1033,10 +1033,8 @@ static int spider_prepare_init_scan( for (link_idx = 0; link_idx < (int) share->link_count; ++link_idx) spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS spider->do_direct_update = FALSE; spider->direct_update_kinds = 0; -#endif spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); direct_order_limit = spider_param_direct_order_limit(thd, share->direct_order_limit); diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index a99dc7e96dd..12320f73742 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -880,10 +880,8 @@ typedef struct st_spider_wide_handler #ifdef WITH_PARTITION_STORAGE_ENGINE SPIDER_PARTITION_HANDLER *partition_handler; #endif -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS List *direct_update_fields; List *direct_update_values; -#endif TABLE_SHARE *top_share; enum thr_lock_type lock_type; uchar lock_table_type; @@ -892,11 +890,9 @@ typedef struct st_spider_wide_handler int cond_check_error; uint sql_command; uint top_table_fields; -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef INFO_KIND_FORCE_LIMIT_BEGIN longlong info_limit; #endif -#endif #ifdef HA_CAN_BULK_ACCESS ulonglong external_lock_cnt; #endif diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 12080cc2a27..371dd1215c9 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -109,7 +109,6 @@ extern volatile ulonglong spider_mon_table_cache_version_req; MYSQL_SYSVAR_NAME(param_name).def_val; \ } -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS static int spider_direct_update(THD *thd, SHOW_VAR *var, void *, system_status_var *, enum_var_type) { @@ -133,7 +132,6 @@ static int spider_direct_delete(THD *thd, SHOW_VAR *var, void *, var->value = (char *) &trx->direct_delete_count; DBUG_RETURN(error_num); } -#endif static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, void *, system_status_var *, enum_var_type) @@ -178,7 +176,6 @@ struct st_mysql_show_var spider_status_variables[] = (char *) &spider_mon_table_cache_version, SHOW_LONGLONG}, {"Spider_mon_table_cache_version_req", (char *) &spider_mon_table_cache_version_req, SHOW_LONGLONG}, -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC {"Spider_direct_update", (char *) &spider_direct_update, SHOW_SIMPLE_FUNC}, {"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_SIMPLE_FUNC}, @@ -186,7 +183,6 @@ struct st_mysql_show_var spider_status_variables[] = {"Spider_direct_update", (char *) &spider_direct_update, SHOW_FUNC}, {"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_FUNC}, #endif -#endif #ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC {"Spider_direct_order_limit", (char *) &spider_direct_order_limit, SHOW_SIMPLE_FUNC}, From f16c037753eb23a31ed56c3ff56c95192b481870 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:37:51 +0800 Subject: [PATCH 058/185] MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT handler has can_use_for_auto_inc_init() since at latest 2017: dc17ac1638ef67b5dc5956d7e4ef802b6b37fbe9 --- storage/spider/ha_spider.cc | 8 -------- storage/spider/ha_spider.h | 4 ---- storage/spider/spd_environ.h | 1 - 3 files changed, 13 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 306e223a16e..55e2f68edaa 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -7764,9 +7764,7 @@ int ha_spider::info( DBUG_ENTER("ha_spider::info"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider flag=%x", flag)); -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = FALSE; -#endif wide_handler->sql_command = thd_sql_command(thd); /* if ( @@ -7782,9 +7780,7 @@ int ha_spider::info( share->lgtm_tblhnd_share->auto_increment_value; else { stats.auto_increment_value = 1; -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = TRUE; -#endif } } if ( @@ -8059,9 +8055,7 @@ int ha_spider::info( } if (flag & HA_STATUS_AUTO) { -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = FALSE; -#endif if (share->wide_share && table->next_number_field) { ulonglong first_value, nb_reserved_values; @@ -8928,7 +8922,6 @@ bool ha_spider::need_info_for_auto_inc() } #endif -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool ha_spider::can_use_for_auto_inc_init() { DBUG_ENTER("ha_spider::can_use_for_auto_inc_init"); @@ -8940,7 +8933,6 @@ bool ha_spider::can_use_for_auto_inc_init() !auto_inc_temporary )); } -#endif int ha_spider::update_auto_increment() { diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index da1e5fd2df4..572d23af299 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -150,9 +150,7 @@ public: #ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC bool info_auto_called; #endif -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool auto_inc_temporary; -#endif int bulk_size= 0; int direct_dup_insert; int store_error_num; @@ -458,9 +456,7 @@ public: #ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC bool need_info_for_auto_inc() override; #endif -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool can_use_for_auto_inc_init() override; -#endif int update_auto_increment(); void get_auto_increment( ulonglong offset, diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index fbadb270f1f..8b6eac67e7a 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -28,7 +28,6 @@ #define HANDLER_HAS_DIRECT_AGGREGATE #define PARTITION_HAS_GET_PART_SPEC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC -#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT #define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA From aaba68ac1ec9c5bea70df4dcfa4f4d4c8cc3d09d Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:41:53 +0800 Subject: [PATCH 059/185] MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA new_data is const since at least 2017: a05a610d60a --- storage/spider/ha_spider.cc | 15 --------------- storage/spider/ha_spider.h | 12 ------------ storage/spider/spd_environ.h | 2 -- 3 files changed, 29 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 55e2f68edaa..90c004cfd0b 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -9311,19 +9311,11 @@ int ha_spider::end_bulk_update( DBUG_RETURN(0); } -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int ha_spider::bulk_update_row( const uchar *old_data, const uchar *new_data, ha_rows *dup_key_found ) -#else -int ha_spider::bulk_update_row( - const uchar *old_data, - uchar *new_data, - ha_rows *dup_key_found -) -#endif { DBUG_ENTER("ha_spider::bulk_update_row"); DBUG_PRINT("info",("spider this=%p", this)); @@ -9331,17 +9323,10 @@ int ha_spider::bulk_update_row( DBUG_RETURN(update_row(old_data, new_data)); } -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int ha_spider::update_row( const uchar *old_data, const uchar *new_data ) -#else -int ha_spider::update_row( - const uchar *old_data, - uchar *new_data -) -#endif { int error_num; THD *thd = ha_thd(); diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 572d23af299..535724606ff 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -497,7 +497,6 @@ public: ha_rows *dup_key_found ) override; int end_bulk_update() override; -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int bulk_update_row( const uchar *old_data, const uchar *new_data, @@ -507,17 +506,6 @@ public: const uchar *old_data, const uchar *new_data ) override; -#else - int bulk_update_row( - const uchar *old_data, - uchar *new_data, - ha_rows *dup_key_found - ); - int update_row( - const uchar *old_data, - uchar *new_data - ); -#endif bool check_direct_update_sql_part( st_select_lex *select_lex, longlong select_limit, diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 8b6eac67e7a..26da35b792f 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -29,8 +29,6 @@ #define PARTITION_HAS_GET_PART_SPEC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC -#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA - #define SPIDER_MDEV_16246 #define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM From 1cb75d9a33ad8d36832cdac4ebc0aec4448c6796 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:42:10 +0800 Subject: [PATCH 060/185] MDEV-27660 Remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS The flag argument was added to handler::start_bulk_insert() in the MDEV-539 commit ca2cdaad86750509764256ff8086e031b4870b24 --- storage/spider/ha_spider.cc | 6 ------ storage/spider/ha_spider.h | 6 ------ storage/spider/spd_environ.h | 2 -- 3 files changed, 14 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 90c004cfd0b..4296a00e196 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -9075,16 +9075,10 @@ void ha_spider::release_auto_increment() DBUG_VOID_RETURN; } -#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS void ha_spider::start_bulk_insert( ha_rows rows, uint flags ) -#else -void ha_spider::start_bulk_insert( - ha_rows rows -) -#endif { DBUG_ENTER("ha_spider::start_bulk_insert"); DBUG_PRINT("info",("spider this=%p", this)); diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 535724606ff..d2d6c911e3c 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -469,16 +469,10 @@ public: ulonglong value ) override; void release_auto_increment() override; -#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS void start_bulk_insert( ha_rows rows, uint flags ) override; -#else - void start_bulk_insert( - ha_rows rows - ); -#endif int end_bulk_insert() override; int write_row( const uchar *buf diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 26da35b792f..2501e55a2e9 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -20,8 +20,6 @@ #ifndef SPD_ENVIRON_INCLUDED -#define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS - #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define HANDLER_HAS_TOP_TABLE_FIELDS From 6d0d09ebc2a95c0adfa9baf494b1a456c697f27b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:42:25 +0800 Subject: [PATCH 061/185] MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS This macro is unused --- storage/spider/spd_environ.h | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 2501e55a2e9..6eb1313bb00 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -22,7 +22,6 @@ #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE -#define HANDLER_HAS_TOP_TABLE_FIELDS #define HANDLER_HAS_DIRECT_AGGREGATE #define PARTITION_HAS_GET_PART_SPEC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC From affcb0713d47b2603aaefbe746d89ce434b9ecb0 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:42:36 +0800 Subject: [PATCH 062/185] MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC This macro is unused, and not in 11.5 c96b23f99409cad9c0dac5040561136211486995 --- storage/spider/spd_environ.h | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 6eb1313bb00..4944aa268c9 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -23,7 +23,6 @@ #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define HANDLER_HAS_DIRECT_AGGREGATE -#define PARTITION_HAS_GET_PART_SPEC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC #define SPIDER_MDEV_16246 From 8c8684b17f40f613773daa69cb171181cd69d903 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:42:50 +0800 Subject: [PATCH 063/185] MDEV-28226 Remove HANDLER_HAS_NEED_INFO_FOR_AUTO_INC handler::need_info_for_auto_inc() was added in MDEV-7720 / MDEV-7726 in commit dc17ac1638ef67b5dc5956d7e4ef802b6b37fbe9 --- storage/spider/ha_spider.cc | 4 ---- storage/spider/ha_spider.h | 4 ---- storage/spider/spd_environ.h | 1 - 3 files changed, 9 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 4296a00e196..06a1f227771 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -7805,9 +7805,7 @@ int ha_spider::info( { tmp_auto_increment_mode = spider_param_auto_increment_mode(thd, share->auto_increment_mode); -#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC info_auto_called = TRUE; -#endif } if (!share->sts_init) { @@ -8899,7 +8897,6 @@ uint8 ha_spider::table_cache_type() DBUG_RETURN(HA_CACHE_TBL_NOCACHE); } -#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC bool ha_spider::need_info_for_auto_inc() { THD *thd = ha_thd(); @@ -8920,7 +8917,6 @@ bool ha_spider::need_info_for_auto_inc() ) )); } -#endif bool ha_spider::can_use_for_auto_inc_init() { diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index d2d6c911e3c..20db5349f68 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -147,9 +147,7 @@ public: bool use_pre_action; bool pre_bitmap_checked; bool bulk_insert; -#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC bool info_auto_called; -#endif bool auto_inc_temporary; int bulk_size= 0; int direct_dup_insert; @@ -453,9 +451,7 @@ public: uint max_supported_key_length() const override; uint max_supported_key_part_length() const override; uint8 table_cache_type() override; -#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC bool need_info_for_auto_inc() override; -#endif bool can_use_for_auto_inc_init() override; int update_auto_increment(); void get_auto_increment( diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 4944aa268c9..34670a32ee3 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -23,7 +23,6 @@ #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define HANDLER_HAS_DIRECT_AGGREGATE -#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC #define SPIDER_MDEV_16246 From 5e98471df131a327b027d4b5976c9ca4b1cf4684 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:43:05 +0800 Subject: [PATCH 064/185] MDEV-27811: remove SPIDER_MDEV_16246 MDEV-16246 was fixed long ago. And this macro was removed in other versions too --- storage/spider/ha_spider.cc | 57 ------------------------------------ storage/spider/ha_spider.h | 36 ----------------------- storage/spider/spd_environ.h | 2 -- 3 files changed, 95 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 06a1f227771..a1d734eced8 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -9413,7 +9413,6 @@ bool ha_spider::check_direct_update_sql_part( } #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -#ifdef SPIDER_MDEV_16246 int ha_spider::direct_update_rows_init( List *update_fields, uint mode, @@ -9422,15 +9421,6 @@ int ha_spider::direct_update_rows_init( bool sorted, uchar *new_data ) -#else -int ha_spider::direct_update_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data -) -#endif { st_select_lex *select_lex; longlong select_limit; @@ -9455,13 +9445,8 @@ int ha_spider::direct_update_rows_init( pre_direct_init_result)); DBUG_RETURN(pre_direct_init_result); } -#ifdef SPIDER_MDEV_16246 DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init( update_fields, mode, ranges, range_count, sorted, new_data)); -#else - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init( - mode, ranges, range_count, sorted, new_data)); -#endif } #endif if (!dml_inited) @@ -9538,7 +9523,6 @@ int ha_spider::direct_update_rows_init( DBUG_RETURN(HA_ERR_WRONG_COMMAND); } #else -#ifdef SPIDER_MDEV_16246 /** Perform initialization for a direct update request. @@ -9551,9 +9535,6 @@ int ha_spider::direct_update_rows_init( int ha_spider::direct_update_rows_init( List *update_fields ) -#else -int ha_spider::direct_update_rows_init() -#endif { st_select_lex *select_lex; longlong select_limit; @@ -9602,12 +9583,8 @@ int ha_spider::direct_update_rows_init() pre_direct_init_result)); DBUG_RETURN(pre_direct_init_result); } -#ifdef SPIDER_MDEV_16246 DBUG_RETURN(bulk_access_link_exec_tgt->spider-> direct_update_rows_init(update_fields)); -#else - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init()); -#endif } #endif if (!dml_inited) @@ -9682,7 +9659,6 @@ int ha_spider::direct_update_rows_init() #ifdef HA_CAN_BULK_ACCESS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -#ifdef SPIDER_MDEV_16246 int ha_spider::pre_direct_update_rows_init( List *update_fields, uint mode, @@ -9691,30 +9667,15 @@ int ha_spider::pre_direct_update_rows_init( bool sorted, uchar *new_data ) -#else -int ha_spider::pre_direct_update_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data -) -#endif { int error_num; DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); if (bulk_access_started) { -#ifdef SPIDER_MDEV_16246 error_num = bulk_access_link_current->spider-> pre_direct_update_rows_init( update_fields, mode, ranges, range_count, sorted, new_data); -#else - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init( - mode, ranges, range_count, sorted, new_data); -#endif bulk_access_link_current->spider->bulk_access_pre_called = TRUE; bulk_access_link_current->called = TRUE; DBUG_RETURN(error_num); @@ -9726,17 +9687,11 @@ int ha_spider::pre_direct_update_rows_init( DBUG_RETURN(error_num); } } -#ifdef SPIDER_MDEV_16246 pre_direct_init_result = direct_update_rows_init( update_fields, mode, ranges, range_count, sorted, new_data); -#else - pre_direct_init_result = direct_update_rows_init( - mode, ranges, range_count, sorted, new_data); -#endif DBUG_RETURN(pre_direct_init_result); } #else -#ifdef SPIDER_MDEV_16246 /** Do initialization for performing parallel direct update for a handlersocket update request. @@ -9750,22 +9705,14 @@ int ha_spider::pre_direct_update_rows_init( int ha_spider::pre_direct_update_rows_init( List *update_fields ) -#else -int ha_spider::pre_direct_update_rows_init() -#endif { int error_num; DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); if (bulk_access_started) { -#ifdef SPIDER_MDEV_16246 error_num = bulk_access_link_current->spider-> pre_direct_update_rows_init(update_fields); -#else - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init(); -#endif bulk_access_link_current->spider->bulk_access_pre_called = TRUE; bulk_access_link_current->called = TRUE; DBUG_RETURN(error_num); @@ -9777,11 +9724,7 @@ int ha_spider::pre_direct_update_rows_init() DBUG_RETURN(error_num); } } -#ifdef SPIDER_MDEV_16246 pre_direct_init_result = direct_update_rows_init(update_fields); -#else - pre_direct_init_result = direct_update_rows_init(); -#endif DBUG_RETURN(pre_direct_init_result); } #endif diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 20db5349f68..995a5f0281c 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -502,7 +502,6 @@ public: longlong offset_limit ); #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -#ifdef SPIDER_MDEV_16246 inline int direct_update_rows_init( List *update_fields ) { @@ -517,30 +516,12 @@ public: uchar *new_data ); #else - inline int direct_update_rows_init() - { - return direct_update_rows_init(2, NULL, 0, FALSE, NULL); - } - int direct_update_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data - ); -#endif -#else -#ifdef SPIDER_MDEV_16246 int direct_update_rows_init( List *update_fields ) override; -#else - int direct_update_rows_init(); -#endif #endif #ifdef HA_CAN_BULK_ACCESS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -#ifdef SPIDER_MDEV_16246 inline int pre_direct_update_rows_init( List *update_fields ) { @@ -555,26 +536,9 @@ public: uchar *new_data ); #else - inline int pre_direct_update_rows_init() - { - return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL); - } - int pre_direct_update_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data - ); -#endif -#else -#ifdef SPIDER_MDEV_16246 int pre_direct_update_rows_init( List *update_fields ); -#else - int pre_direct_update_rows_init(); -#endif #endif #endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 34670a32ee3..547a487af33 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -24,8 +24,6 @@ #define HANDLER_HAS_DIRECT_AGGREGATE -#define SPIDER_MDEV_16246 - #define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM #define SPIDER_SQL_CACHE_IS_IN_LEX #define SPIDER_LIKE_FUNC_HAS_GET_NEGATED From a1e5ee911170a608f2ad8ae94b7fef66640a0d3e Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:43:28 +0800 Subject: [PATCH 065/185] MDEV-27663 remove SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM {STRING|INT|REAL|DECIMAL|DATE}_ITEM were replaced with CONST_ITEM in MDEV-14630 c20cd68e60465f43266fe2bc2b2190e7c1cc4983 --- storage/spider/spd_db_conn.cc | 11 ----------- storage/spider/spd_environ.h | 1 - 2 files changed, 12 deletions(-) diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index dd253822626..48ac9264af8 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -8573,7 +8573,6 @@ int spider_db_print_item_type( case Item::ROW_ITEM: DBUG_RETURN(spider_db_open_item_row((Item_row *) item, spider, str, alias, alias_length, dbton_id, use_fields, fields)); -#ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM case Item::CONST_ITEM: { switch (item->cmp_type()) { @@ -8591,16 +8590,6 @@ int spider_db_print_item_type( DBUG_RETURN(spider_db_print_item_type_default(item, spider, str)); } } -#else - case Item::STRING_ITEM: - DBUG_RETURN(spider_db_open_item_string(item, field, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - case Item::INT_ITEM: - case Item::REAL_ITEM: - case Item::DECIMAL_ITEM: - DBUG_RETURN(spider_db_open_item_int(item, field, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); -#endif case Item::CACHE_ITEM: DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field, spider, str, alias, alias_length, dbton_id, use_fields, fields)); diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 547a487af33..2ca5c62a3e2 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -24,7 +24,6 @@ #define HANDLER_HAS_DIRECT_AGGREGATE -#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM #define SPIDER_SQL_CACHE_IS_IN_LEX #define SPIDER_LIKE_FUNC_HAS_GET_NEGATED #define HA_HAS_CHECKSUM_EXTENDED From ab49b46d0148640d843391e8acc811e51636c316 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:46:46 +0800 Subject: [PATCH 066/185] MDEV-27664 remove SPIDER_SQL_CACHE_IS_IN_LEX sql_cache was moved to lex in MDEV-11953 in de745ecf29721795710910a19bd0ea3389da804c --- storage/spider/ha_spider.cc | 4 ---- storage/spider/spd_db_mysql.cc | 13 ------------- storage/spider/spd_environ.h | 1 - 3 files changed, 18 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index a1d734eced8..ac383bbc4f2 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -12506,11 +12506,7 @@ void ha_spider::check_pre_call( ) || ( (skip_parallel_search & 2) && -#ifdef SPIDER_SQL_CACHE_IS_IN_LEX lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump -#else - select_lex && select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE // for mysqldump -#endif ) ) { use_pre_call = FALSE; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 54ad30cebd2..4d57a8d41de 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -9450,29 +9450,16 @@ int spider_mbase_handler::append_select( wide_handler->lock_mode < 1) { /* no lock */ -#ifdef SPIDER_SQL_CACHE_IS_IN_LEX LEX *lex = wide_handler->trx->thd->lex; -#else - st_select_lex *select_lex = - &wide_handler->trx->thd->lex->select_lex; -#endif if ( -#ifdef SPIDER_SQL_CACHE_IS_IN_LEX lex->sql_cache == LEX::SQL_CACHE && -#else - select_lex->sql_cache == SELECT_LEX::SQL_CACHE && -#endif (spider->share->query_cache_sync & 1) ) { if (str->reserve(SPIDER_SQL_SQL_CACHE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SQL_CACHE_STR, SPIDER_SQL_SQL_CACHE_LEN); } else if ( -#ifdef SPIDER_SQL_CACHE_IS_IN_LEX lex->sql_cache == LEX::SQL_NO_CACHE && -#else - select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE && -#endif (spider->share->query_cache_sync & 2) ) { if (str->reserve(SPIDER_SQL_SQL_NO_CACHE_LEN)) diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 2ca5c62a3e2..9de99b8f4b5 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -24,7 +24,6 @@ #define HANDLER_HAS_DIRECT_AGGREGATE -#define SPIDER_SQL_CACHE_IS_IN_LEX #define SPIDER_LIKE_FUNC_HAS_GET_NEGATED #define HA_HAS_CHECKSUM_EXTENDED From e8a5553cefd0c5c16939409633f5dec75baa6b08 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:47:07 +0800 Subject: [PATCH 067/185] MDEV-27808 remove SPIDER_LIKE_FUNC_HAS_GET_NEGATED get_negated() was introduced in MDEV-16707 --- storage/spider/spd_db_oracle.cc | 4 ---- storage/spider/spd_environ.h | 1 - 2 files changed, 5 deletions(-) diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index e0ef42793c2..f390e5d80fb 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -4094,7 +4094,6 @@ int spider_db_oracle_util::open_item_func( } break; case Item_func::LIKE_FUNC: -#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED if (str) { if (((Item_func_like *)item_func)->get_negated()) @@ -4109,9 +4108,6 @@ int spider_db_oracle_util::open_item_func( } } break; -#else - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); -#endif default: THD *thd = spider->wide_handler->trx->thd; SPIDER_SHARE *share = spider->share; diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 9de99b8f4b5..faf32019824 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -24,7 +24,6 @@ #define HANDLER_HAS_DIRECT_AGGREGATE -#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED #define HA_HAS_CHECKSUM_EXTENDED #define SPIDER_I_S_USE_SHOW_FOR_COLUMN From 6287fb6e1749cf471dec75f3cf2400bd879765f8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:47:18 +0800 Subject: [PATCH 068/185] MDEV-27652 remove #ifdef HA_HAS_CHECKSUM_EXTENDED handler::pre_calculate_checksum was added in MDEV-16249 be5c432a42eed10535354f31dfd6daa07095e555 --- storage/spider/ha_spider.cc | 2 -- storage/spider/ha_spider.h | 4 ---- storage/spider/spd_conn.h | 2 -- storage/spider/spd_db_conn.cc | 2 -- storage/spider/spd_db_include.cc | 4 ---- storage/spider/spd_db_include.h | 6 ------ storage/spider/spd_db_mysql.cc | 14 -------------- storage/spider/spd_db_mysql.h | 6 ------ storage/spider/spd_environ.h | 2 -- storage/spider/spd_table.cc | 6 ------ 10 files changed, 48 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index ac383bbc4f2..60371836683 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -8658,7 +8658,6 @@ ha_rows ha_spider::records() DBUG_RETURN(table_rows); } -#ifdef HA_HAS_CHECKSUM_EXTENDED int ha_spider::pre_calculate_checksum() { int error_num; @@ -8736,7 +8735,6 @@ int ha_spider::calculate_checksum() } DBUG_RETURN(0); } -#endif const char *ha_spider::table_type() const { diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 995a5f0281c..9ebf460623e 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -179,11 +179,9 @@ public: SPIDER_ITEM_HLD *direct_aggregate_item_current; #endif ha_rows table_rows; -#ifdef HA_HAS_CHECKSUM_EXTENDED ha_checksum checksum_val; bool checksum_null; uint action_flags; -#endif /* for fulltext search */ bool ft_init_and_first; @@ -430,10 +428,8 @@ public: int check_crd(); int pre_records() override; ha_rows records() override; -#ifdef HA_HAS_CHECKSUM_EXTENDED int pre_calculate_checksum() override; int calculate_checksum() override; -#endif const char *table_type() const; ulonglong table_flags() const override; ulong table_flags_for_partition(); diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index ef0c304c89f..405832a1e7b 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -22,9 +22,7 @@ #define SPIDER_SIMPLE_CONNECT 1 #define SPIDER_SIMPLE_DISCONNECT 2 #define SPIDER_SIMPLE_RECORDS 3 -#ifdef HA_HAS_CHECKSUM_EXTENDED #define SPIDER_SIMPLE_CHECKSUM_TABLE 4 -#endif /* The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 48ac9264af8..f98d1d0283f 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -5933,14 +5933,12 @@ int spider_db_simple_action( link_idx ); break; -#ifdef HA_HAS_CHECKSUM_EXTENDED case SPIDER_SIMPLE_CHECKSUM_TABLE: DBUG_PRINT("info",("spider simple checksum_table")); error_num = db_handler->checksum_table( link_idx ); break; -#endif default: DBUG_ASSERT(0); error_num = HA_ERR_CRASHED; diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc index 16a449e94cc..d5344066017 100644 --- a/storage/spider/spd_db_include.cc +++ b/storage/spider/spd_db_include.cc @@ -40,7 +40,6 @@ spider_db_result::spider_db_result( DBUG_VOID_RETURN; } -#ifdef HA_HAS_CHECKSUM_EXTENDED int spider_db_result::fetch_table_checksum( ha_spider *spider ) { @@ -48,7 +47,6 @@ int spider_db_result::fetch_table_checksum( DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(0); } -#endif uint spider_db_result::limit_mode() { @@ -137,7 +135,6 @@ uint spider_db_util::limit_mode() DBUG_RETURN(0); } -#ifdef HA_HAS_CHECKSUM_EXTENDED bool spider_db_share::checksum_support() { DBUG_ENTER("spider_db_share::checksum_support"); @@ -152,7 +149,6 @@ int spider_db_handler::checksum_table( DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(0); } -#endif bool spider_db_handler::check_direct_update( st_select_lex *select_lex, diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 0d080249d62..d6d1d514ac6 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -874,11 +874,9 @@ public: int mode, ha_rows &records ) = 0; -#ifdef HA_HAS_CHECKSUM_EXTENDED virtual int fetch_table_checksum( ha_spider *spider ); -#endif virtual int fetch_table_cardinality( int mode, TABLE *table, @@ -1119,9 +1117,7 @@ public: spider_string *str ) = 0; #endif -#ifdef HA_HAS_CHECKSUM_EXTENDED virtual bool checksum_support(); -#endif }; class spider_db_handler @@ -1463,11 +1459,9 @@ public: virtual int show_records( int link_idx ) = 0; -#ifdef HA_HAS_CHECKSUM_EXTENDED virtual int checksum_table( int link_idx ); -#endif virtual int show_last_insert_id( int link_idx, ulonglong &last_insert_id diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 4d57a8d41de..a676955d1fd 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -161,11 +161,9 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; #define SPIDER_SQL_SHOW_RECORDS_RECORDS_POS 0 #define SPIDER_SQL_EXPLAIN_SELECT_RECORDS_POS 8 -#ifdef HA_HAS_CHECKSUM_EXTENDED #define SPIDER_SQL_CHECKSUM_CHECKSUM_POS 1 #define SPIDER_SQL_CHECKSUM_TABLE_STR "checksum table " #define SPIDER_SQL_CHECKSUM_TABLE_LEN (sizeof(SPIDER_SQL_CHECKSUM_TABLE_STR) - 1) -#endif #define SPIDER_SQL_LIKE_STR " like " #define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1) @@ -1119,7 +1117,6 @@ int spider_db_mbase_result::fetch_simple_action( DBUG_PRINT("info", ("spider records=%lld", *records)); break; } -#ifdef HA_HAS_CHECKSUM_EXTENDED case SPIDER_SIMPLE_CHECKSUM_TABLE: { ha_spider *spider = (ha_spider *) param; @@ -1136,7 +1133,6 @@ int spider_db_mbase_result::fetch_simple_action( } break; } -#endif default: DBUG_ASSERT(0); break; @@ -1160,7 +1156,6 @@ int spider_db_mbase_result::fetch_table_records( } } -#ifdef HA_HAS_CHECKSUM_EXTENDED int spider_db_mbase_result::fetch_table_checksum( ha_spider *spider ) { @@ -1169,7 +1164,6 @@ int spider_db_mbase_result::fetch_table_checksum( DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, SPIDER_SQL_CHECKSUM_CHECKSUM_POS, spider)); } -#endif int spider_db_mbase_result::fetch_table_cardinality( int mode, @@ -8191,14 +8185,12 @@ int spider_mbase_share::discover_table_structure( } #endif -#ifdef HA_HAS_CHECKSUM_EXTENDED bool spider_mbase_share::checksum_support() { DBUG_ENTER("spider_mbase_share::checksum_support"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -#endif spider_mbase_handler::spider_mbase_handler( ha_spider *spider, @@ -14239,7 +14231,6 @@ int spider_mbase_handler::simple_action( DBUG_PRINT("info",("spider simple records")); str = &mysql_share->show_records[pos]; break; -#ifdef HA_HAS_CHECKSUM_EXTENDED case SPIDER_SIMPLE_CHECKSUM_TABLE: DBUG_PRINT("info",("spider simple checksum_table")); str = &spider->result_list.sqls[link_idx]; @@ -14269,7 +14260,6 @@ int spider_mbase_handler::simple_action( SPIDER_SQL_SQL_EXTENDED_LEN); } break; -#endif default: DBUG_ASSERT(0); DBUG_RETURN(0); @@ -14393,12 +14383,10 @@ int spider_mbase_handler::simple_action( DBUG_PRINT("info",("spider simple records")); error_num = res->fetch_table_records(1, spider->table_rows); break; -#ifdef HA_HAS_CHECKSUM_EXTENDED case SPIDER_SIMPLE_CHECKSUM_TABLE: DBUG_PRINT("info",("spider simple checksum_table")); error_num = res->fetch_table_checksum(spider); break; -#endif default: DBUG_ASSERT(0); break; @@ -14427,7 +14415,6 @@ int spider_mbase_handler::show_records( DBUG_RETURN(0); } -#ifdef HA_HAS_CHECKSUM_EXTENDED int spider_mbase_handler::checksum_table( int link_idx ) { @@ -14435,7 +14422,6 @@ int spider_mbase_handler::checksum_table( DBUG_RETURN(simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, link_idx)); DBUG_RETURN(0); } -#endif int spider_mbase_handler::show_last_insert_id( int link_idx, diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index dcc35290103..5124dc61180 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -318,11 +318,9 @@ public: int mode, ha_rows &records ) override; -#ifdef HA_HAS_CHECKSUM_EXTENDED int fetch_table_checksum( ha_spider *spider ) override; -#endif int fetch_table_cardinality( int mode, TABLE *table, @@ -669,9 +667,7 @@ public: spider_string *str ) override; #endif -#ifdef HA_HAS_CHECKSUM_EXTENDED bool checksum_support() override; -#endif protected: int create_table_names_str(); void free_table_names_str(); @@ -1402,11 +1398,9 @@ public: int show_records( int link_idx ) override; -#ifdef HA_HAS_CHECKSUM_EXTENDED int checksum_table( int link_idx ) override; -#endif int show_last_insert_id( int link_idx, ulonglong &last_insert_id diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index faf32019824..3f50cfa0cc8 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -24,7 +24,5 @@ #define HANDLER_HAS_DIRECT_AGGREGATE -#define HA_HAS_CHECKSUM_EXTENDED - #define SPIDER_I_S_USE_SHOW_FOR_COLUMN #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index e6947fe3d6f..41f0668bb24 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -4036,9 +4036,7 @@ SPIDER_SHARE *spider_create_share( uchar *tmp_cardinality_upd, *tmp_table_mon_mutex_bitmap; char buf[MAX_FIELD_WIDTH], *buf_pos; char link_idx_str[SPIDER_SQL_INT_LEN]; -#ifdef HA_HAS_CHECKSUM_EXTENDED bool checksum_support = TRUE; -#endif DBUG_ENTER("spider_create_share"); length = (uint) strlen(table_name); bitmap_size = spider_bitmap_size(table_share->fields); @@ -4175,24 +4173,20 @@ SPIDER_SHARE *spider_create_share( { goto error_init_dbton; } -#ifdef HA_HAS_CHECKSUM_EXTENDED if ( spider_dbton[roop_count].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL && !share->dbton_share[roop_count]->checksum_support() ) { checksum_support = FALSE; } -#endif } } -#ifdef HA_HAS_CHECKSUM_EXTENDED if (checksum_support) { share->additional_table_flags |= HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM; } -#endif DBUG_RETURN(share); /* From 84977868b1e57c6fcef9c7e48fb4367e17ed0dcb Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:50:20 +0800 Subject: [PATCH 069/185] MDEV-27809 remove SPIDER_I_S_USE_SHOW_FOR_COLUMN Show::Column() was added in MDEV-19772 4156b1a2602915d6adf983e5c8efaa4f41df3d21 --- storage/spider/spd_environ.h | 2 -- storage/spider/spd_i_s.cc | 33 --------------------------------- 2 files changed, 35 deletions(-) diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 3f50cfa0cc8..696d4cc8ae9 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -23,6 +23,4 @@ #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define HANDLER_HAS_DIRECT_AGGREGATE - -#define SPIDER_I_S_USE_SHOW_FOR_COLUMN #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc index 8f828939aeb..2db7bd0c374 100644 --- a/storage/spider/spd_i_s.cc +++ b/storage/spider/spd_i_s.cc @@ -41,7 +41,6 @@ static struct st_mysql_storage_engine spider_i_s_info = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; namespace Show { -#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] = { Column("ID", ULong(10), NOT_NULL, "id"), @@ -54,27 +53,6 @@ static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] = Column("FREE_MEM_COUNT", ULonglong(20), NULLABLE, "free_mem_count"), CEnd() }; -#else -static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] = -{ - {"ID", 10, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "id", SKIP_OPEN_TABLE}, - {"FUNC_NAME", 64, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "func_name", SKIP_OPEN_TABLE}, - {"FILE_NAME", 64, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "file_name", SKIP_OPEN_TABLE}, - {"LINE_NO", 10, MYSQL_TYPE_LONG, 0, - MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "line_no", SKIP_OPEN_TABLE}, - {"TOTAL_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "total_alloc_mem", SKIP_OPEN_TABLE}, - {"CURRENT_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_MAYBE_NULL, "current_alloc_mem", SKIP_OPEN_TABLE}, - {"ALLOC_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "alloc_mem_count", SKIP_OPEN_TABLE}, - {"FREE_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "free_mem_count", SKIP_OPEN_TABLE}, - {NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0} -}; -#endif } // namespace Show static int spider_i_s_alloc_mem_fill_table( @@ -183,7 +161,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria = extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; namespace Show { -#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] = { Column("WRAPPER_NAME", Varchar(NAME_CHAR_LEN), NOT_NULL, ""), @@ -192,16 +169,6 @@ static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] = Column("WRAPPER_MATURITY", Varchar(12), NOT_NULL, ""), CEnd() }; -#else -static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] = -{ - {"WRAPPER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"WRAPPER_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"WRAPPER_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"WRAPPER_MATURITY", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} -}; -#endif } // namespace Show static int spider_i_s_wrapper_protocols_fill_table( From 3a58291680cfd352276be4eca9a7588e1b6d2ce5 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:52:07 +0800 Subject: [PATCH 070/185] MDEV-27662 remove SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE --- storage/spider/ha_spider.cc | 2 -- storage/spider/spd_environ.h | 2 -- storage/spider/spd_table.cc | 12 ------------ 3 files changed, 16 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 60371836683..7f74d56cf6c 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -10597,7 +10597,6 @@ int ha_spider::create( ) { goto error; } -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE if ( thd->lex->create_info.or_replace() && (error_num = spider_delete_tables( @@ -10608,7 +10607,6 @@ int ha_spider::create( ) { goto error; } -#endif if ( (error_num = spider_insert_tables(table_tables, &tmp_share)) ) { diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 696d4cc8ae9..3ed95c168cd 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -20,7 +20,5 @@ #ifndef SPD_ENVIRON_INCLUDED -#define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE - #define HANDLER_HAS_DIRECT_AGGREGATE #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 41f0668bb24..ca23be650bc 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -8380,7 +8380,6 @@ int spider_discover_table_structure( SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE, &error_num)) ) { -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE if (thd->lex->create_info.or_replace()) { error_num = spider_delete_tables(table_tables, @@ -8388,11 +8387,8 @@ int spider_discover_table_structure( } if (!error_num) { -#endif error_num = spider_insert_tables(table_tables, spider_share); -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE } -#endif spider_close_sys_table(thd, table_tables, &open_tables_backup, FALSE); } @@ -8496,7 +8492,6 @@ int spider_discover_table_structure( DBUG_RETURN(error_num); } -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE if (thd->lex->create_info.or_replace()) { error_num = spider_delete_tables(table_tables, @@ -8504,11 +8499,8 @@ int spider_discover_table_structure( } if (!error_num) { -#endif error_num = spider_insert_tables(table_tables, spider_share); -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE } -#endif spider_free_share_resource_only(spider_share); if (error_num) @@ -8532,7 +8524,6 @@ int spider_discover_table_structure( DBUG_RETURN(error_num); } -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE if (thd->lex->create_info.or_replace()) { error_num = spider_delete_tables(table_tables, @@ -8540,11 +8531,8 @@ int spider_discover_table_structure( } if (!error_num) { -#endif error_num = spider_insert_tables(table_tables, spider_share); -#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE } -#endif spider_free_share_resource_only(spider_share); if (error_num) From 869c501ac363ba009a1a0b090eb56b95aeaab5e1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:52:29 +0800 Subject: [PATCH 071/185] MDEV-27644 Spider: remove HANDLER_HAS_DIRECT_AGGREGATE --- storage/spider/ha_spider.cc | 36 ------------------- storage/spider/ha_spider.h | 8 ----- storage/spider/spd_conn.cc | 2 -- storage/spider/spd_db_conn.cc | 48 ------------------------- storage/spider/spd_db_conn.h | 6 ---- storage/spider/spd_db_include.h | 10 ------ storage/spider/spd_db_mysql.cc | 64 --------------------------------- storage/spider/spd_db_mysql.h | 6 ---- storage/spider/spd_db_oracle.cc | 20 ----------- storage/spider/spd_db_oracle.h | 6 ---- storage/spider/spd_environ.h | 2 -- storage/spider/spd_table.cc | 16 --------- storage/spider/spd_table.h | 2 -- 13 files changed, 226 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 7f74d56cf6c..6f96da80ac5 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -26,9 +26,7 @@ #include "probes_mysql.h" #include "sql_class.h" #include "key.h" -#ifdef HANDLER_HAS_DIRECT_AGGREGATE #include "sql_select.h" -#endif #include "ha_partition.h" #include "spd_param.h" #include "spd_err.h" @@ -109,9 +107,7 @@ ha_spider::ha_spider( */ #endif prev_index_rnd_init = SPD_NONE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE direct_aggregate_item_first = NULL; -#endif result_link_idx = 0; result_list.have_sql_kind_backup = FALSE; result_list.sqls = NULL; @@ -125,10 +121,8 @@ ha_spider::ha_spider( result_list.set_split_read = FALSE; result_list.insert_dup_update_pushdown = FALSE; result_list.tmp_pos_row_first = NULL; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE result_list.direct_aggregate = FALSE; result_list.snap_direct_aggregate = FALSE; -#endif result_list.direct_distinct = FALSE; result_list.casual_read = NULL; result_list.use_both_key = FALSE; @@ -192,9 +186,7 @@ ha_spider::ha_spider( */ #endif prev_index_rnd_init = SPD_NONE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE direct_aggregate_item_first = NULL; -#endif result_link_idx = 0; result_list.have_sql_kind_backup = FALSE; result_list.sqls = NULL; @@ -208,10 +200,8 @@ ha_spider::ha_spider( result_list.set_split_read = FALSE; result_list.insert_dup_update_pushdown = FALSE; result_list.tmp_pos_row_first = NULL; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE result_list.direct_aggregate = FALSE; result_list.snap_direct_aggregate = FALSE; -#endif result_list.direct_distinct = FALSE; result_list.casual_read = NULL; result_list.use_both_key = FALSE; @@ -634,7 +624,6 @@ int ha_spider::close() } while (bulk_access_link_first); } #endif -#ifdef HANDLER_HAS_DIRECT_AGGREGATE while (direct_aggregate_item_first) { direct_aggregate_item_current = direct_aggregate_item_first->next; @@ -645,7 +634,6 @@ int ha_spider::close() spider_free(spider_current_trx, direct_aggregate_item_first, MYF(0)); direct_aggregate_item_first = direct_aggregate_item_current; } -#endif if (is_clone) { for (roop_count = 0; roop_count < (int) share->link_count; roop_count++) @@ -1191,7 +1179,6 @@ int ha_spider::reset() } while (bulk_access_link_first); } #endif -#ifdef HANDLER_HAS_DIRECT_AGGREGATE direct_aggregate_item_current = direct_aggregate_item_first; while (direct_aggregate_item_current) { @@ -1211,7 +1198,6 @@ int ha_spider::reset() } result_list.direct_aggregate = FALSE; result_list.snap_direct_aggregate = FALSE; -#endif result_list.direct_distinct = FALSE; store_error_num = 0; if (wide_handler) @@ -4784,10 +4770,8 @@ int ha_spider::read_multi_range_first_internal( DBUG_RETURN(error_num); result_list.use_union = TRUE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool direct_aggregate_backup = result_list.direct_aggregate; result_list.direct_aggregate = FALSE; -#endif if (result_list.direct_order_limit) { if ((error_num = @@ -4799,9 +4783,7 @@ int ha_spider::read_multi_range_first_internal( NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE result_list.direct_aggregate = direct_aggregate_backup; -#endif if ((error_num = append_limit_sql_part( result_list.internal_offset, result_list.limit_num, @@ -6199,10 +6181,8 @@ int ha_spider::read_multi_range_next( DBUG_RETURN(error_num); result_list.use_union = TRUE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool direct_aggregate_backup = result_list.direct_aggregate; result_list.direct_aggregate = FALSE; -#endif if (result_list.direct_order_limit) { if ((error_num = @@ -6214,9 +6194,7 @@ int ha_spider::read_multi_range_next( NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE result_list.direct_aggregate = direct_aggregate_backup; -#endif if ((error_num = append_limit_sql_part( result_list.internal_offset, result_list.limit_num, @@ -6844,14 +6822,12 @@ int ha_spider::rnd_next_internal( NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (result_list.direct_aggregate) { if ((error_num = append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#endif result_list.desc_flg = FALSE; result_list.sorted = FALSE; result_list.key_info = NULL; @@ -7476,14 +7452,12 @@ int ha_spider::ft_read_internal( SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (result_list.direct_aggregate) { if ((error_num = append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); } -#endif if (sql_kinds & SPIDER_SQL_KIND_SQL) { if ((error_num = append_limit_sql_part( @@ -11419,7 +11393,6 @@ int ha_spider::info_push( DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE void ha_spider::return_record_by_parent() { DBUG_ENTER("ha_spider::return_record_by_parent"); @@ -11427,7 +11400,6 @@ void ha_spider::return_record_by_parent() spider_db_refetch_for_item_sum_funcs(this); DBUG_VOID_RETURN; } -#endif TABLE *ha_spider::get_table() { @@ -13459,7 +13431,6 @@ int ha_spider::append_condition_sql_part( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int ha_spider::append_sum_select_sql_part( ulong sql_type, const char *alias, @@ -13483,7 +13454,6 @@ int ha_spider::append_sum_select_sql_part( } DBUG_RETURN(0); } -#endif int ha_spider::append_match_select_sql_part( ulong sql_type, @@ -13541,7 +13511,6 @@ void ha_spider::set_order_to_pos_sql( DBUG_VOID_RETURN; } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int ha_spider::append_group_by_sql_part( const char *alias, uint alias_length, @@ -13565,7 +13534,6 @@ int ha_spider::append_group_by_sql_part( } DBUG_RETURN(0); } -#endif int ha_spider::append_key_order_for_merge_with_alias_sql_part( const char *alias, @@ -13576,7 +13544,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part( uint roop_count, dbton_id; spider_db_handler *dbton_hdl; DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (result_list.direct_aggregate) { st_select_lex *select_lex = spider_get_select_lex(this); @@ -13587,7 +13554,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part( DBUG_RETURN(0); } } -#endif for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++) { dbton_id = share->use_sql_dbton_ids[roop_count]; @@ -13637,7 +13603,6 @@ int ha_spider::append_key_order_with_alias_sql_part( uint roop_count, dbton_id; spider_db_handler *dbton_hdl; DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (result_list.direct_aggregate) { st_select_lex *select_lex = spider_get_select_lex(this); @@ -13648,7 +13613,6 @@ int ha_spider::append_key_order_with_alias_sql_part( DBUG_RETURN(0); } } -#endif for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++) { dbton_id = share->use_sql_dbton_ids[roop_count]; diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 9ebf460623e..a57359ce025 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -174,10 +174,8 @@ public: bool do_direct_update; uint direct_update_kinds; spider_index_rnd_init prev_index_rnd_init; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE SPIDER_ITEM_HLD *direct_aggregate_item_first; SPIDER_ITEM_HLD *direct_aggregate_item_current; -#endif ha_rows table_rows; ha_checksum checksum_val; bool checksum_null; @@ -734,9 +732,7 @@ public: uint info_type, void *info ) override; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE void return_record_by_parent() override; -#endif TABLE *get_table(); void set_ft_discard_bitmap(); void set_searched_bitmap(); @@ -923,13 +919,11 @@ public: ulong sql_type, bool test_flg ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_sum_select_sql_part( ulong sql_type, const char *alias, uint alias_length ); -#endif int append_match_select_sql_part( ulong sql_type, const char *alias, @@ -941,13 +935,11 @@ public: void set_order_to_pos_sql( ulong sql_type ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_group_by_sql_part( const char *alias, uint alias_length, ulong sql_type ); -#endif int append_key_order_for_merge_with_alias_sql_part( const char *alias, uint alias_length, diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 6b3d90bea3d..3be95db5e42 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -928,9 +928,7 @@ int spider_check_and_init_casual_read( (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && ( result_list->direct_order_limit -#ifdef HANDLER_HAS_DIRECT_AGGREGATE || result_list->direct_aggregate -#endif ) ) { if (!result_list->casual_read[link_idx]) diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index f98d1d0283f..17ac2398e7a 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -26,9 +26,7 @@ #include "sql_base.h" #include "tztime.h" #include "errmsg.h" -#ifdef HANDLER_HAS_DIRECT_AGGREGATE #include "sql_select.h" -#endif #include "sql_common.h" #include #include "spd_err.h" @@ -1390,14 +1388,12 @@ int spider_db_append_select_columns( DBUG_ENTER("spider_db_append_select_columns"); if (spider->sql_kinds & SPIDER_SQL_KIND_SQL) { -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if ( result_list->direct_aggregate && (error_num = spider->append_sum_select_sql_part( SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0)) ) DBUG_RETURN(error_num); -#endif if ((error_num = spider->append_match_select_sql_part( SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0))) DBUG_RETURN(error_num); @@ -2536,7 +2532,6 @@ int spider_db_append_charset_name_before_string( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_refetch_for_item_sum_funcs( ha_spider *spider ) { @@ -2752,7 +2747,6 @@ int spider_db_fetch_for_item_sum_func( spider->wide_handler->trx->direct_aggregate_count++; DBUG_RETURN(0); } -#endif int spider_db_append_match_fetch( ha_spider *spider, @@ -2951,13 +2945,11 @@ int spider_db_fetch_table( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE DBUG_PRINT("info", ("spider direct_aggregate=%s", result_list->direct_aggregate ? "TRUE" : "FALSE")); result_list->snap_mrr_with_cnt = spider->mrr_with_cnt; result_list->snap_direct_aggregate = result_list->direct_aggregate; result_list->snap_row = row; -#endif /* for mrr */ if (spider->mrr_with_cnt) @@ -2967,32 +2959,26 @@ int spider_db_fetch_table( { if (!row->is_null()) spider->multi_range_hit_point = row->val_int(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (result_list->direct_aggregate) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); } -#endif else DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM); row->next(); } else { spider->multi_range_hit_point = 0; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE result_list->snap_mrr_with_cnt = FALSE; -#endif } } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (result_list->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif #ifdef SPIDER_HAS_GROUP_BY_HANDLER if (!spider->use_fields) @@ -3081,13 +3067,11 @@ int spider_db_fetch_key( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE DBUG_PRINT("info", ("spider direct_aggregate=%s", result_list->direct_aggregate ? "TRUE" : "FALSE")); result_list->snap_mrr_with_cnt = spider->mrr_with_cnt; result_list->snap_direct_aggregate = result_list->direct_aggregate; result_list->snap_row = row; -#endif /* for mrr */ if (spider->mrr_with_cnt) @@ -3095,26 +3079,22 @@ int spider_db_fetch_key( DBUG_PRINT("info", ("spider mrr_with_cnt")); if (!row->is_null()) spider->multi_range_hit_point = row->val_int(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (result_list->direct_aggregate) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); } -#endif else DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM); row->next(); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (result_list->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif if ((error_num = spider_db_append_match_fetch(spider, spider->ft_first, spider->ft_current, row))) @@ -3198,13 +3178,11 @@ int spider_db_fetch_minimum_columns( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE DBUG_PRINT("info", ("spider direct_aggregate=%s", result_list->direct_aggregate ? "TRUE" : "FALSE")); result_list->snap_mrr_with_cnt = spider->mrr_with_cnt; result_list->snap_direct_aggregate = result_list->direct_aggregate; result_list->snap_row = row; -#endif /* for mrr */ if (spider->mrr_with_cnt) @@ -3212,26 +3190,22 @@ int spider_db_fetch_minimum_columns( DBUG_PRINT("info", ("spider mrr_with_cnt")); if (!row->is_null()) spider->multi_range_hit_point = row->val_int(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (result_list->direct_aggregate) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); } -#endif else DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM); row->next(); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (result_list->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif if ((error_num = spider_db_append_match_fetch(spider, spider->ft_first, spider->ft_current, row))) @@ -5580,9 +5554,7 @@ void spider_db_create_position( current->use_position = TRUE; pos->use_position = TRUE; pos->mrr_with_cnt = spider->mrr_with_cnt; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE pos->direct_aggregate = result_list->direct_aggregate; -#endif pos->sql_kind = spider->sql_kind[spider->result_link_idx]; pos->position_bitmap = spider->wide_handler->position_bitmap; pos->ft_first = spider->ft_first; @@ -5648,7 +5620,6 @@ int spider_db_seek_tmp_table( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (!spider->result_list.in_cmp_ref) { DBUG_PRINT("info", ("spider direct_aggregate=%s", @@ -5657,7 +5628,6 @@ int spider_db_seek_tmp_table( spider->result_list.snap_direct_aggregate = pos->direct_aggregate; spider->result_list.snap_row = row; } -#endif /* for mrr */ if (pos->mrr_with_cnt) @@ -5667,20 +5637,16 @@ int spider_db_seek_tmp_table( { row->next(); } else { -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.snap_mrr_with_cnt = FALSE; -#endif } } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (pos->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif if ((error_num = spider_db_append_match_fetch(spider, pos->ft_first, pos->ft_current, row))) @@ -5740,7 +5706,6 @@ int spider_db_seek_tmp_key( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (!spider->result_list.in_cmp_ref) { DBUG_PRINT("info", ("spider direct_aggregate=%s", @@ -5749,7 +5714,6 @@ int spider_db_seek_tmp_key( spider->result_list.snap_direct_aggregate = pos->direct_aggregate; spider->result_list.snap_row = row; } -#endif /* for mrr */ if (pos->mrr_with_cnt) @@ -5758,14 +5722,12 @@ int spider_db_seek_tmp_key( row->next(); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (pos->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif if ((error_num = spider_db_append_match_fetch(spider, pos->ft_first, pos->ft_current, row))) @@ -5825,7 +5787,6 @@ int spider_db_seek_tmp_minimum_columns( } DBUG_PRINT("info", ("spider row=%p", row)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (!spider->result_list.in_cmp_ref) { DBUG_PRINT("info", ("spider direct_aggregate=%s", @@ -5834,7 +5795,6 @@ int spider_db_seek_tmp_minimum_columns( spider->result_list.snap_direct_aggregate = pos->direct_aggregate; spider->result_list.snap_row = row; } -#endif /* for mrr */ if (pos->mrr_with_cnt) @@ -5843,14 +5803,12 @@ int spider_db_seek_tmp_minimum_columns( row->next(); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE /* for direct_aggregate */ if (pos->direct_aggregate) { if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider))) DBUG_RETURN(error_num); } -#endif if ((error_num = spider_db_append_match_fetch(spider, pos->ft_first, pos->ft_current, row))) @@ -8554,11 +8512,9 @@ int spider_db_print_item_type( case Item::FUNC_ITEM: DBUG_RETURN(spider_db_open_item_func((Item_func *) item, spider, str, alias, alias_length, dbton_id, use_fields, fields)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE case Item::SUM_FUNC_ITEM: DBUG_RETURN(spider_db_open_item_sum_func((Item_sum *)item, spider, str, alias, alias_length, dbton_id, use_fields, fields)); -#endif case Item::COND_ITEM: DBUG_RETURN(spider_db_open_item_cond((Item_cond *) item, spider, str, alias, alias_length, dbton_id, use_fields, fields)); @@ -8731,7 +8687,6 @@ int spider_db_open_item_func( item_func, spider, str, alias, alias_length, use_fields, fields)); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -8746,7 +8701,6 @@ int spider_db_open_item_sum_func( DBUG_RETURN(spider_dbton[dbton_id].db_util->open_item_sum_func( item_sum, spider, str, alias, alias_length, use_fields, fields)); } -#endif int spider_db_open_item_ident( Item_ident *item_ident, @@ -9536,7 +9490,6 @@ int spider_db_append_update_columns( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_db_check_select_colum_in_group( st_select_lex *select_lex, Field *field @@ -9559,7 +9512,6 @@ bool spider_db_check_select_colum_in_group( } DBUG_RETURN(FALSE); } -#endif uint spider_db_check_ft_idx( Item_func *item_func, diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index 5b8dc65b262..aa451b861d2 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -496,7 +496,6 @@ int spider_db_append_charset_name_before_string( CHARSET_INFO *cs ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_refetch_for_item_sum_funcs( ha_spider *spider ); @@ -511,7 +510,6 @@ int spider_db_fetch_for_item_sum_func( Item_sum *item_sum, ha_spider *spider ); -#endif int spider_db_append_match_fetch( ha_spider *spider, @@ -940,7 +938,6 @@ int spider_db_open_item_func( spider_fields *fields ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -951,7 +948,6 @@ int spider_db_open_item_sum_func( bool use_fields, spider_fields *fields ); -#endif int spider_db_open_item_ident( Item_ident *item_ident, @@ -1062,12 +1058,10 @@ int spider_db_append_update_columns( spider_fields *fields ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_db_check_select_colum_in_group( st_select_lex *select_lex, Field *field ); -#endif uint spider_db_check_ft_idx( Item_func *item_func, diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index d6d1d514ac6..3946ea4911d 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -765,7 +765,6 @@ public: bool use_fields, spider_fields *fields ) = 0; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE virtual int open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -775,7 +774,6 @@ public: bool use_fields, spider_fields *fields ) = 0; -#endif virtual int append_escaped_util( spider_string *to, String *from @@ -1275,26 +1273,22 @@ public: const char *alias, uint alias_length ) = 0; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE virtual int append_sum_select_part( ulong sql_type, const char *alias, uint alias_length ) = 0; -#endif virtual void set_order_pos( ulong sql_type ) = 0; virtual void set_order_to_pos( ulong sql_type ) = 0; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE virtual int append_group_by_part( const char *alias, uint alias_length, ulong sql_type ) = 0; -#endif virtual int append_key_order_for_merge_with_alias_part( const char *alias, uint alias_length, @@ -1717,9 +1711,7 @@ typedef struct st_spider_position uint pos_mode; bool use_position; bool mrr_with_cnt; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool direct_aggregate; -#endif uint sql_kind; uchar *position_bitmap; st_spider_ft_info *ft_first; @@ -1822,12 +1814,10 @@ typedef struct st_spider_result_list /* the limit_offeset, without where condition */ bool direct_limit_offset; bool direct_distinct; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool direct_aggregate; bool snap_mrr_with_cnt; bool snap_direct_aggregate; SPIDER_DB_ROW *snap_row; -#endif bool in_cmp_ref; bool set_split_read; bool insert_dup_update_pushdown; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index a676955d1fd..848e484e454 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -25,9 +25,7 @@ #include "sql_analyse.h" #include "sql_base.h" #include "tztime.h" -#ifdef HANDLER_HAS_DIRECT_AGGREGATE #include "sql_select.h" -#endif #include "sql_common.h" #include #include @@ -6688,7 +6686,6 @@ int spider_db_mbase_util::print_item_func( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_mbase_util::open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -6804,7 +6801,6 @@ int spider_db_mbase_util::open_item_sum_func( } DBUG_RETURN(0); } -#endif int spider_db_mbase_util::append_escaped_util( spider_string *to, @@ -8643,14 +8639,12 @@ int spider_mbase_handler::append_tmp_table_and_sql_for_bka( SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#endif DBUG_RETURN(0); } @@ -8889,14 +8883,12 @@ int spider_mbase_handler::append_union_table_and_sql_for_bka( ) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#endif DBUG_RETURN(0); } @@ -9504,13 +9496,10 @@ int spider_mbase_handler::append_table_select_part( int spider_mbase_handler::append_table_select( spider_string *str ) { -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_table_select"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9549,13 +9538,10 @@ int spider_mbase_handler::append_table_select( } str->length(str->length() - SPIDER_SQL_COMMA_LEN); } else { -#endif table_name_pos = str->length() + mysql_share->table_select_pos; if (str->append(*(mysql_share->table_select))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif DBUG_RETURN(0); } @@ -9583,13 +9569,10 @@ int spider_mbase_handler::append_key_select( spider_string *str, uint idx ) { -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_key_select"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9633,13 +9616,10 @@ int spider_mbase_handler::append_key_select( } str->length(str->length() - SPIDER_SQL_COMMA_LEN); } else { -#endif table_name_pos = str->length() + mysql_share->key_select_pos[idx]; if (str->append(mysql_share->key_select[idx])) DBUG_RETURN(HA_ERR_OUT_OF_MEM); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif DBUG_RETURN(0); } @@ -9670,13 +9650,10 @@ int spider_mbase_handler::append_minimum_select( Field **field; int field_length; bool appended = FALSE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_minimum_select"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9686,7 +9663,6 @@ int spider_mbase_handler::append_minimum_select( select_lex = NULL; } } -#endif minimum_select_bitmap_create(); for (field = table->field; *field; field++) { @@ -9697,7 +9673,6 @@ int spider_mbase_handler::append_minimum_select( */ field_length = mysql_share->column_name_str[(*field)->field_index].length(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (select_lex && !spider_db_check_select_colum_in_group(select_lex, *field)) { @@ -9710,14 +9685,11 @@ int spider_mbase_handler::append_minimum_select( mysql_share->append_column_name(str, (*field)->field_index); str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); } else { -#endif if (str->reserve(field_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); mysql_share->append_column_name(str, (*field)->field_index); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); appended = TRUE; } @@ -9740,13 +9712,10 @@ int spider_mbase_handler::append_table_select_with_alias( TABLE *table = spider->get_table(); Field **field; int field_length; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_table_select_with_alias"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9756,12 +9725,10 @@ int spider_mbase_handler::append_table_select_with_alias( select_lex = NULL; } } -#endif for (field = table->field; *field; field++) { field_length = mysql_share->column_name_str[(*field)->field_index].length(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (select_lex && !spider_db_check_select_colum_in_group(select_lex, *field)) { @@ -9775,15 +9742,12 @@ int spider_mbase_handler::append_table_select_with_alias( mysql_share->append_column_name(str, (*field)->field_index); str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); } else { -#endif if (str->reserve(alias_length + field_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(alias, alias_length); mysql_share->append_column_name(str, (*field)->field_index); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } str->length(str->length() - SPIDER_SQL_COMMA_LEN); @@ -9800,13 +9764,10 @@ int spider_mbase_handler::append_key_select_with_alias( Field *field; uint part_num; int field_length; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_key_select_with_alias"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9816,13 +9777,11 @@ int spider_mbase_handler::append_key_select_with_alias( select_lex = NULL; } } -#endif for (key_part = key_info->key_part, part_num = 0; part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++) { field = key_part->field; field_length = mysql_share->column_name_str[field->field_index].length(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (select_lex && !spider_db_check_select_colum_in_group(select_lex, field)) { @@ -9836,15 +9795,12 @@ int spider_mbase_handler::append_key_select_with_alias( mysql_share->append_column_name(str, field->field_index); str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); } else { -#endif if (str->reserve(alias_length + field_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(alias, alias_length); mysql_share->append_column_name(str, field->field_index); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } str->length(str->length() - SPIDER_SQL_COMMA_LEN); @@ -9860,13 +9816,10 @@ int spider_mbase_handler::append_minimum_select_with_alias( Field **field; int field_length; bool appended = FALSE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE st_select_lex *select_lex = NULL; bool sgb = (spider->result_list.direct_aggregate && spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1); -#endif DBUG_ENTER("spider_mbase_handler::append_minimum_select_with_alias"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (sgb) { select_lex = spider_get_select_lex(spider); @@ -9876,7 +9829,6 @@ int spider_mbase_handler::append_minimum_select_with_alias( select_lex = NULL; } } -#endif minimum_select_bitmap_create(); for (field = table->field; *field; field++) { @@ -9887,7 +9839,6 @@ int spider_mbase_handler::append_minimum_select_with_alias( */ field_length = mysql_share->column_name_str[(*field)->field_index].length(); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (select_lex && !spider_db_check_select_colum_in_group(select_lex, *field)) { @@ -9901,15 +9852,12 @@ int spider_mbase_handler::append_minimum_select_with_alias( mysql_share->append_column_name(str, (*field)->field_index); str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); } else { -#endif if (str->reserve(alias_length + field_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(alias, alias_length); mysql_share->append_column_name(str, (*field)->field_index); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE } -#endif str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); appended = TRUE; } @@ -9932,13 +9880,11 @@ int spider_mbase_handler::append_select_columns_with_alias( int error_num; SPIDER_RESULT_LIST *result_list = &spider->result_list; DBUG_ENTER("spider_mbase_handler::append_select_columns_with_alias"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if ( result_list->direct_aggregate && (error_num = append_sum_select(str, alias, alias_length)) ) DBUG_RETURN(error_num); -#endif if ((error_num = append_match_select(str, alias, alias_length))) DBUG_RETURN(error_num); if (!spider->select_column_mode) @@ -11098,7 +11044,6 @@ int spider_mbase_handler::append_match_select( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_mbase_handler::append_sum_select_part( ulong sql_type, const char *alias, @@ -11145,7 +11090,6 @@ int spider_mbase_handler::append_sum_select( } DBUG_RETURN(0); } -#endif void spider_mbase_handler::set_order_pos( ulong sql_type @@ -11199,7 +11143,6 @@ void spider_mbase_handler::set_order_to_pos( DBUG_VOID_RETURN; } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_mbase_handler::append_group_by_part( const char *alias, uint alias_length, @@ -11262,7 +11205,6 @@ int spider_mbase_handler::append_group_by( } DBUG_RETURN(0); } -#endif int spider_mbase_handler::append_key_order_for_merge_with_alias_part( const char *alias, @@ -11308,14 +11250,12 @@ int spider_mbase_handler::append_key_order_for_merge_with_alias( uint key_name_length; DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { int error_num; if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif if (table->s->primary_key < MAX_KEY) { /* sort by primary key */ @@ -11424,13 +11364,11 @@ int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias( longlong offset_limit; DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); if (select_lex->order_list.first) @@ -11526,14 +11464,12 @@ int spider_mbase_handler::append_key_order_with_alias( uint key_name_length; DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { int error_num; if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif if (result_list->sorted == TRUE) { if (result_list->desc_flg == TRUE) diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 5124dc61180..7eeb5bed7fb 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -145,7 +145,6 @@ protected: spider_fields *fields ); public: -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -155,7 +154,6 @@ public: bool use_fields, spider_fields *fields ) override; -#endif int append_escaped_util( spider_string *to, String *from @@ -1068,7 +1066,6 @@ public: const char *alias, uint alias_length ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_sum_select_part( ulong sql_type, const char *alias, @@ -1079,14 +1076,12 @@ public: const char *alias, uint alias_length ); -#endif void set_order_pos( ulong sql_type ) override; void set_order_to_pos( ulong sql_type ) override; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_group_by_part( const char *alias, uint alias_length, @@ -1097,7 +1092,6 @@ public: const char *alias, uint alias_length ); -#endif int append_key_order_for_merge_with_alias_part( const char *alias, uint alias_length, diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index f390e5d80fb..34d0ff58fcc 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -22,9 +22,7 @@ #include "probes_mysql.h" #include "sql_partition.h" #include "sql_analyse.h" -#ifdef HANDLER_HAS_DIRECT_AGGREGATE #include "sql_select.h" -#endif #ifdef HAVE_ORACLE_OCI #if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS)) @@ -4221,7 +4219,6 @@ int spider_db_oracle_util::open_item_func( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_oracle_util::open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -4296,7 +4293,6 @@ int spider_db_oracle_util::open_item_sum_func( } DBUG_RETURN(0); } -#endif size_t spider_db_oracle_util::escape_string( char *to, @@ -5731,14 +5727,12 @@ int spider_oracle_handler::append_tmp_table_and_sql_for_bka( SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#endif DBUG_RETURN(0); } @@ -5971,14 +5965,12 @@ int spider_oracle_handler::append_union_table_and_sql_for_bka( &tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE else if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) DBUG_RETURN(error_num); } -#endif DBUG_RETURN(0); } @@ -6702,13 +6694,11 @@ int spider_oracle_handler::append_select_columns_with_alias( int error_num; SPIDER_RESULT_LIST *result_list = &spider->result_list; DBUG_ENTER("spider_oracle_handler::append_select_columns_with_alias"); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if ( result_list->direct_aggregate && (error_num = append_sum_select(str, alias, alias_length)) ) DBUG_RETURN(error_num); -#endif if ((error_num = append_match_select(str, alias, alias_length))) DBUG_RETURN(error_num); if (!spider->select_column_mode) @@ -7826,7 +7816,6 @@ int spider_oracle_handler::append_match_select( DBUG_RETURN(0); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_oracle_handler::append_sum_select_part( ulong sql_type, const char *alias, @@ -7873,7 +7862,6 @@ int spider_oracle_handler::append_sum_select( } DBUG_RETURN(0); } -#endif void spider_oracle_handler::set_order_pos( ulong sql_type @@ -7927,7 +7915,6 @@ void spider_oracle_handler::set_order_to_pos( DBUG_VOID_RETURN; } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_oracle_handler::append_group_by_part( const char *alias, uint alias_length, @@ -7990,7 +7977,6 @@ int spider_oracle_handler::append_group_by( } DBUG_RETURN(0); } -#endif int spider_oracle_handler::append_key_order_for_merge_with_alias_part( const char *alias, @@ -8036,14 +8022,12 @@ int spider_oracle_handler::append_key_order_for_merge_with_alias( uint key_name_length; DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { int error_num; if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif if ( spider->result_list.direct_order_limit || spider->result_list.internal_limit < 9223372036854775807LL || @@ -8266,13 +8250,11 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias( longlong offset_limit; DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); if ( @@ -8491,14 +8473,12 @@ int spider_oracle_handler::append_key_order_with_alias( uint key_name_length; DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) { int error_num; if ((error_num = append_group_by(str, alias, alias_length))) DBUG_RETURN(error_num); } -#endif if ( spider->result_list.direct_order_limit || spider->result_list.internal_limit < 9223372036854775807LL || diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h index 8acffb5c150..d47bc9f7ea6 100644 --- a/storage/spider/spd_db_oracle.h +++ b/storage/spider/spd_db_oracle.h @@ -125,7 +125,6 @@ public: bool use_fields, spider_fields *fields ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int open_item_sum_func( Item_sum *item_sum, ha_spider *spider, @@ -135,7 +134,6 @@ public: bool use_fields, spider_fields *fields ); -#endif size_t escape_string( char *to, const char *from, @@ -957,7 +955,6 @@ public: const char *alias, uint alias_length ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_sum_select_part( ulong sql_type, const char *alias, @@ -968,14 +965,12 @@ public: const char *alias, uint alias_length ); -#endif void set_order_pos( ulong sql_type ); void set_order_to_pos( ulong sql_type ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE int append_group_by_part( const char *alias, uint alias_length, @@ -986,7 +981,6 @@ public: const char *alias, uint alias_length ); -#endif int append_key_order_for_merge_with_alias_part( const char *alias, uint alias_length, diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 3ed95c168cd..8d6e7327919 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -19,6 +19,4 @@ */ #ifndef SPD_ENVIRON_INCLUDED - -#define HANDLER_HAS_DIRECT_AGGREGATE #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index ca23be650bc..05603a5dd7e 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7840,9 +7840,7 @@ bool spider_check_direct_order_limit( DBUG_PRINT("info",("spider with distinct")); spider->result_list.direct_distinct = TRUE; } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.direct_aggregate = spider_param_direct_aggregate(thd); -#endif DBUG_PRINT("info",("spider select_limit=%lld", select_limit)); DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit)); if ( @@ -7861,22 +7859,17 @@ bool spider_check_direct_order_limit( DBUG_PRINT("info",("spider first_check is FALSE")); first_check = FALSE; spider->result_list.direct_distinct = FALSE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.direct_aggregate = FALSE; -#endif } else if (spider_db_append_condition(spider, NULL, 0, TRUE)) { DBUG_PRINT("info",("spider FALSE by condition")); first_check = FALSE; spider->result_list.direct_distinct = FALSE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.direct_aggregate = FALSE; -#endif } else if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER) { DBUG_PRINT("info",("spider sql_kinds with SPIDER_SQL_KIND_HANDLER")); spider->result_list.direct_distinct = FALSE; -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.direct_aggregate = FALSE; } else if ( !select_lex->group_list.elements && @@ -7914,7 +7907,6 @@ bool spider_check_direct_order_limit( first_check = FALSE; spider->result_list.direct_distinct = FALSE; } -#endif } longlong direct_order_limit = spider_param_direct_order_limit(thd, @@ -7926,10 +7918,8 @@ bool spider_check_direct_order_limit( first_check ? "TRUE" : "FALSE")); DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s", select_lex && (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE")); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE DBUG_PRINT("info",("spider direct_aggregate=%s", spider->result_list.direct_aggregate ? "TRUE" : "FALSE")); -#endif DBUG_PRINT("info",("spider select_lex->group_list.elements=%u", select_lex ? select_lex->group_list.elements : 0)); DBUG_PRINT("info",("spider select_lex->with_sum_func=%s", @@ -7943,9 +7933,7 @@ bool spider_check_direct_order_limit( !select_lex->explicit_limit || (select_lex->options & OPTION_FOUND_ROWS) || ( -#ifdef HANDLER_HAS_DIRECT_AGGREGATE !spider->result_list.direct_aggregate && -#endif ( select_lex->group_list.elements || select_lex->with_sum_func @@ -7979,7 +7967,6 @@ bool spider_check_direct_order_limit( DBUG_RETURN(FALSE); } -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_all_part_in_order( ORDER *order, TABLE *table @@ -8056,7 +8043,6 @@ Field *spider_field_exchange( DBUG_PRINT("info",("spider out field=%p", field)); DBUG_RETURN(field); } -#endif int spider_set_direct_limit_offset( ha_spider *spider @@ -8089,9 +8075,7 @@ int spider_set_direct_limit_offset( if ( spider->wide_handler->sql_command != SQLCOM_SELECT || -#ifdef HANDLER_HAS_DIRECT_AGGREGATE spider->result_list.direct_aggregate || -#endif spider->result_list.direct_order_limit || spider->prev_index_rnd_init != SPD_RND // must be RND_INIT and not be INDEX_INIT ) diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index 8bca3c047fa..e6230110dd6 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -431,7 +431,6 @@ bool spider_check_direct_order_limit( ha_spider *spider ); -#ifdef HANDLER_HAS_DIRECT_AGGREGATE bool spider_all_part_in_order( ORDER *order, TABLE *table @@ -441,7 +440,6 @@ Field *spider_field_exchange( handler *handler, Field *field ); -#endif int spider_set_direct_limit_offset( ha_spider *spider From 5d54e86c22000244cc09bd1fffbfa0674f81fcb8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 17 Jun 2024 10:19:30 +0800 Subject: [PATCH 072/185] MDEV-26178 spider: delete spd_environ.h It's virtually empty now --- storage/spider/ha_spider.cc | 1 - storage/spider/spd_conn.cc | 1 - storage/spider/spd_copy_tables.cc | 1 - storage/spider/spd_db_conn.cc | 1 - storage/spider/spd_db_include.cc | 1 - storage/spider/spd_db_mysql.cc | 1 - storage/spider/spd_db_oracle.cc | 1 - storage/spider/spd_direct_sql.cc | 1 - storage/spider/spd_environ.h | 22 ---------------------- storage/spider/spd_group_by_handler.cc | 1 - storage/spider/spd_i_s.cc | 1 - storage/spider/spd_malloc.cc | 1 - storage/spider/spd_param.cc | 1 - storage/spider/spd_ping_table.cc | 1 - storage/spider/spd_sys_table.cc | 1 - storage/spider/spd_table.cc | 1 - storage/spider/spd_trx.cc | 1 - storage/spider/spd_udf.cc | 1 - 18 files changed, 39 deletions(-) delete mode 100644 storage/spider/spd_environ.h diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 6f96da80ac5..814eee073be 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -21,7 +21,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 3be95db5e42..29c8635e98d 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 2a3b848c3ce..d76c8e425ec 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 17ac2398e7a..046e024522f 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc index d5344066017..b082f2d3c8b 100644 --- a/storage/spider/spd_db_include.cc +++ b/storage/spider/spd_db_include.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 848e484e454..9118e3fb7c1 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 34d0ff58fcc..b06be249a4f 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_partition.h" diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 49a6edc6d26..e136c302126 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h deleted file mode 100644 index 8d6e7327919..00000000000 --- a/storage/spider/spd_environ.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 2008-2020 Kentoku Shiba - Copyright (C) 2017-2020 MariaDB corp - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Define functionality offered by MySQL or MariaDB -*/ - -#ifndef SPD_ENVIRON_INCLUDED -#endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 37bfc7ea8a7..9b71f5bc13f 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc index 2db7bd0c374..0b44c9440e3 100644 --- a/storage/spider/spd_i_s.cc +++ b/storage/spider/spd_i_s.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc index 395fde5fd8d..96fa4cf89b9 100644 --- a/storage/spider/spd_malloc.cc +++ b/storage/spider/spd_malloc.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 371dd1215c9..41a065bfd29 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -37,7 +37,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 30f2814f8e1..055501925b5 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index d4c453bba87..9e39ffc8d90 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -16,7 +16,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 05603a5dd7e..03ff98740b7 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "my_getopt.h" diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 05a6fead947..f04c3659d6f 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_udf.cc b/storage/spider/spd_udf.cc index 3f7cc65477f..023285cb4f1 100644 --- a/storage/spider/spd_udf.cc +++ b/storage/spider/spd_udf.cc @@ -15,7 +15,6 @@ #define MYSQL_SERVER 1 #include -#include "spd_environ.h" #include "mysql.h" #include "spd_udf.h" From a81f419b06df996e047d33c24db9a5cf695e6ded Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 13:55:02 +0800 Subject: [PATCH 073/185] MDEV-27648 remove #define HASH_UPDATE_WITH_HASH_VALUE The functions called in blocks protected by this macro remain undefined as of 11.5 c96b23f99409cad9c0dac5040561136211486995 --- storage/spider/spd_conn.cc | 197 ------------------------------- storage/spider/spd_db_include.h | 3 - storage/spider/spd_db_mysql.cc | 26 ---- storage/spider/spd_db_oracle.cc | 26 ---- storage/spider/spd_direct_sql.cc | 10 -- storage/spider/spd_ping_table.cc | 11 -- storage/spider/spd_table.cc | 79 ------------- storage/spider/spd_trx.cc | 57 --------- 8 files changed, 409 deletions(-) diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 29c8635e98d..7c65f1d02eb 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -309,12 +309,7 @@ void spider_free_conn_from_trx( if (another) { ha_spider *next_spider; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&trx->trx_another_conn_hash, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&trx->trx_another_conn_hash, (uchar*) conn); -#endif spider = (ha_spider*) conn->another_ha_first; while (spider) { @@ -329,12 +324,7 @@ void spider_free_conn_from_trx( conn->another_ha_first = NULL; conn->another_ha_last = NULL; } else { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&trx->trx_conn_hash, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&trx->trx_conn_hash, (uchar*) conn); -#endif } if ( @@ -354,12 +344,7 @@ void spider_free_conn_from_trx( } else { pthread_mutex_lock(&spider_conn_mutex); uint old_elements = spider_open_connections.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_open_connections, - conn->conn_key_hash_value, (uchar*) conn)) -#else if (my_hash_insert(&spider_open_connections, (uchar*) conn)) -#endif { pthread_mutex_unlock(&spider_conn_mutex); spider_free_conn(conn); @@ -721,12 +706,7 @@ SPIDER_CONN *spider_get_conn( } } } else { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_connections, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&spider_open_connections, (uchar*) conn); -#endif pthread_mutex_unlock(&spider_conn_mutex); DBUG_PRINT("info",("spider get global conn")); if (spider) @@ -756,13 +736,7 @@ SPIDER_CONN *spider_get_conn( if (another) { uint old_elements = trx->trx_another_conn_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&trx->trx_another_conn_hash, - share->conn_keys_hash_value[link_idx], - (uchar*) conn)) -#else if (my_hash_insert(&trx->trx_another_conn_hash, (uchar*) conn)) -#endif { spider_free_conn(conn); *error_num = HA_ERR_OUT_OF_MEM; @@ -777,13 +751,7 @@ SPIDER_CONN *spider_get_conn( } } else { uint old_elements = trx->trx_conn_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&trx->trx_conn_hash, - share->conn_keys_hash_value[link_idx], - (uchar*) conn)) -#else if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn)) -#endif { spider_free_conn(conn); *error_num = HA_ERR_OUT_OF_MEM; @@ -1133,12 +1101,7 @@ int spider_conn_queue_and_merge_loop_check( *tmp_name = '-'; ++tmp_name; memcpy(tmp_name, lcptr->from_value.str, lcptr->from_value.length + 1); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue, - lcptr->hash_value_to, (uchar *) lcptr))) -#else if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr))) -#endif { goto error_hash_insert_queue; } @@ -1196,33 +1159,16 @@ int spider_conn_queue_and_merge_loop_check( memcpy(merged_value, lcptr->from_value.str, lcptr->from_value.length + 1); DBUG_PRINT("info", ("spider free lcqptr")); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&conn->loop_checked, - lcqptr->hash_value_full, (uchar *) lcqptr); - my_hash_delete_with_hash_value(&conn->loop_check_queue, - lcqptr->hash_value_to, (uchar *) lcqptr); -#else my_hash_delete(&conn->loop_checked, (uchar*) lcqptr); my_hash_delete(&conn->loop_check_queue, (uchar*) lcqptr); -#endif spider_free(spider_current_trx, lcqptr, MYF(0)); lcptr = lcrptr; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked, - lcptr->hash_value_full, (uchar *) lcptr))) -#else if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr))) -#endif { goto error_hash_insert; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue, - lcptr->hash_value_to, (uchar *) lcptr))) -#else if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr))) -#endif { goto error_hash_insert_queue; } @@ -1232,12 +1178,7 @@ int spider_conn_queue_and_merge_loop_check( error_alloc_loop_check_replace: error_hash_insert_queue: -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&conn->loop_checked, - lcptr->hash_value_full, (uchar *) lcptr); -#else my_hash_delete(&conn->loop_checked, (uchar*) lcptr); -#endif error_hash_insert: spider_free(spider_current_trx, lcptr, MYF(0)); pthread_mutex_unlock(&conn->loop_check_mutex); @@ -1257,12 +1198,7 @@ int spider_conn_reset_queue_loop_check( if (!lcptr->flag) { DBUG_PRINT("info", ("spider free lcptr")); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&conn->loop_checked, - lcptr->hash_value_full, (uchar *) lcptr); -#else my_hash_delete(&conn->loop_checked, (uchar*) lcptr); -#endif spider_free(spider_current_trx, lcptr, MYF(0)); } ++l; @@ -1424,12 +1360,7 @@ int spider_conn_queue_loop_check( if (unlikely(lcptr)) { DBUG_PRINT("info", ("spider free lcptr")); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&conn->loop_checked, - lcptr->hash_value_full, (uchar *) lcptr); -#else my_hash_delete(&conn->loop_checked, (uchar*) lcptr); -#endif spider_free(spider_current_trx, lcptr, MYF(0)); } DBUG_PRINT("info", ("spider alloc_lcptr")); @@ -1466,16 +1397,7 @@ int spider_conn_queue_loop_check( lcptr->merged_value.str = merged_value; lcptr->hash_value_to = my_calc_hash(&conn->loop_check_queue, (uchar *) to_str.str, to_str.length); - /* - Mark as checked. It will be added to loop_check_queue in - spider_conn_queue_and_merge_loop_check() below for checking - */ -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked, - lcptr->hash_value_full, (uchar *) lcptr))) -#else if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr))) -#endif { my_afree(loop_check_buf); goto error_hash_insert; @@ -3154,32 +3076,6 @@ void *spider_bg_sts_action( trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, &error_num); conns[spider.search_link_idx]->error_mode = 0; -/* - if ( - error_num && - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } if (spider.search_link_idx != -1 && conns[spider.search_link_idx]) @@ -3197,31 +3093,6 @@ void *spider_bg_sts_action( 2, HA_STATUS_CONST | HA_STATUS_VARIABLE)) #endif { -/* - if ( - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } } @@ -3464,12 +3335,6 @@ void *spider_bg_crd_action( if (spider.search_link_idx < 0) { spider_trx_set_link_idx_for_all(&spider); -/* - spider.search_link_idx = spider_conn_next_link_idx( - thd, share->link_statuses, share->access_balances, - spider.conn_link_idx, spider.search_link_idx, share->link_count, - SPIDER_LINK_STATUS_OK); -*/ spider.search_link_idx = spider_conn_first_link_idx(thd, share->link_statuses, share->access_balances, spider.conn_link_idx, share->link_count, SPIDER_LINK_STATUS_OK); @@ -3486,32 +3351,6 @@ void *spider_bg_crd_action( trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, &error_num); conns[spider.search_link_idx]->error_mode = 0; -/* - if ( - error_num && - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } if (spider.search_link_idx != -1 && conns[spider.search_link_idx]) @@ -3529,31 +3368,6 @@ void *spider_bg_crd_action( 2)) #endif { -/* - if ( - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } } @@ -3858,17 +3672,11 @@ void *spider_bg_mon_action( share->monitoring_bg_interval[link_idx] * 1000); pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx], &share->bg_mon_mutexes[link_idx], &abstime); -/* - my_sleep((ulong) share->monitoring_bg_interval[link_idx]); -*/ } DBUG_PRINT("info",("spider bg mon roop start")); if (share->bg_mon_kill) { DBUG_PRINT("info",("spider bg mon kill start")); -/* - pthread_mutex_lock(&share->bg_mon_mutexes[link_idx]); -*/ pthread_cond_signal(&share->bg_mon_conds[link_idx]); pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]); spider_free_trx(trx, TRUE); @@ -4241,12 +4049,7 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( share->conn_keys_lengths[link_idx]))) { /* get conn from spider_open_connections, then delete conn in spider_open_connections */ -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_connections, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&spider_open_connections, (uchar*) conn); -#endif pthread_mutex_unlock(&spider_conn_mutex); DBUG_PRINT("info",("spider get global conn")); if (spider) diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 3946ea4911d..50974269e0c 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -26,9 +26,6 @@ #define SPIDER_DB_WRAPPER_MARIADB "mariadb" #define PLUGIN_VAR_CAN_MEMALLOC -/* -#define HASH_UPDATE_WITH_HASH_VALUE -*/ #define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE #define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 9118e3fb7c1..ed92a5d2e64 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -3630,12 +3630,7 @@ int spider_db_mbase::append_lock_tables( my_hash_reset(&lock_table_hash); DBUG_RETURN(error_num); } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&lock_table_hash, - tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash); -#else my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash); -#endif } if ((error_num = spider_db_mbase_utility->append_lock_table_tail(str))) { @@ -13012,15 +13007,8 @@ int spider_mbase_handler::insert_lock_tables_list( DBUG_PRINT("info",("spider this=%p", this)); uint old_elements = db_conn->lock_table_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash2->db_table_str_hash_value, - (uchar*) tmp_link_for_hash2)) -#else if (my_hash_insert(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash2)) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } @@ -13067,26 +13055,12 @@ int spider_mbase_handler::append_lock_tables_list( if (tmp_link_for_hash->spider->wide_handler->lock_type < spider->wide_handler->lock_type) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash->db_table_str_hash_value, - (uchar*) tmp_link_for_hash); -#else my_hash_delete(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash); -#endif uint old_elements = db_conn->lock_table_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash2->db_table_str_hash_value, - (uchar*) tmp_link_for_hash2)) -#else if (my_hash_insert(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash2)) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index b06be249a4f..e0eeaf2975b 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -2350,12 +2350,7 @@ int spider_db_oracle::append_lock_tables( my_hash_reset(&lock_table_hash); DBUG_RETURN(error_num); } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&lock_table_hash, - tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash); -#else my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash); -#endif if ((error_num = spider_db_oracle_utility.append_lock_table_tail(str))) { @@ -10282,15 +10277,8 @@ int spider_oracle_handler::insert_lock_tables_list( DBUG_PRINT("info",("spider this=%p", this)); uint old_elements = db_conn->lock_table_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash2->db_table_str_hash_value, - (uchar*) tmp_link_for_hash2)) -#else if (my_hash_insert(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash2)) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } @@ -10334,26 +10322,12 @@ int spider_oracle_handler::append_lock_tables_list( if (tmp_link_for_hash->spider->wide_handler->lock_type < spider->wide_handler->lock_type) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash->db_table_str_hash_value, - (uchar*) tmp_link_for_hash); -#else my_hash_delete(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash); -#endif uint old_elements = db_conn->lock_table_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash2->db_table_str_hash_value, - (uchar*) tmp_link_for_hash2)) -#else if (my_hash_insert(&db_conn->lock_table_hash, (uchar*) tmp_link_for_hash2)) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index e136c302126..0d12b3b25b3 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -522,12 +522,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( error_num))) goto error; } else { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_connections, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&spider_open_connections, (uchar*) conn); -#endif pthread_mutex_unlock(&spider_conn_mutex); DBUG_PRINT("info",("spider get global conn")); } @@ -541,12 +536,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( conn->priority = direct_sql->priority; uint old_elements = trx->trx_conn_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&trx->trx_conn_hash, - direct_sql->conn_key_hash_value, (uchar*) conn)) -#else if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn)) -#endif { spider_free_conn(conn); *error_num = HA_ERR_OUT_OF_MEM; diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 055501925b5..2795f8a3bb6 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -159,14 +159,8 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( uint old_elements = spider_udf_table_mon_list_hash[mutex_hash].array.max_element; table_mon_list->key_hash_value = hash_value; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value( - &spider_udf_table_mon_list_hash[mutex_hash], - hash_value, (uchar*) table_mon_list)) -#else if (my_hash_insert(&spider_udf_table_mon_list_hash[mutex_hash], (uchar*) table_mon_list)) -#endif { spider_ping_table_free_mon_list(table_mon_list); *error_num = HA_ERR_OUT_OF_MEM; @@ -215,13 +209,8 @@ void spider_release_ping_table_mon_list_loop( SPIDER_TABLE_MON_LIST *table_mon_list ) { DBUG_ENTER("spider_release_ping_table_mon_list_loop"); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_udf_table_mon_list_hash[mutex_hash], - table_mon_list->key_hash_value, (uchar*) table_mon_list); -#else my_hash_delete(&spider_udf_table_mon_list_hash[mutex_hash], (uchar*) table_mon_list); -#endif while (TRUE) { if (table_mon_list->use_count) diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 03ff98740b7..145d9dc9c40 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -4321,12 +4321,7 @@ SPIDER_SHARE *spider_get_share( } uint old_elements = spider_open_tables.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_open_tables, hash_value, - (uchar*) share)) -#else if (my_hash_insert(&spider_open_tables, (uchar*) share)) -#endif { *error_num = HA_ERR_OUT_OF_MEM; goto error_hash_insert; @@ -4479,14 +4474,9 @@ SPIDER_SHARE *spider_get_share( spider_free_share(share); goto error_sts_spider_init; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - share->sts_thread = &spider_table_sts_threads[ - hash_value % spider_param_table_sts_thread_count()]; -#else share->sts_thread = &spider_table_sts_threads[ my_calc_hash(&spider_open_tables, (uchar*) table_name, length) % spider_param_table_sts_thread_count()]; -#endif share->sts_spider_init = TRUE; } pthread_mutex_unlock(&share->mutex); @@ -4507,14 +4497,9 @@ SPIDER_SHARE *spider_get_share( spider_free_share(share); goto error_crd_spider_init; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - share->crd_thread = &spider_table_crd_threads[ - hash_value % spider_param_table_crd_thread_count()]; -#else share->crd_thread = &spider_table_crd_threads[ my_calc_hash(&spider_open_tables, (uchar*) table_name, length) % spider_param_table_crd_thread_count()]; -#endif share->crd_spider_init = TRUE; } pthread_mutex_unlock(&share->mutex); @@ -4973,14 +4958,9 @@ SPIDER_SHARE *spider_get_share( spider_free_share(share); goto error_sts_spider_init; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - share->sts_thread = &spider_table_sts_threads[ - hash_value % spider_param_table_sts_thread_count()]; -#else share->sts_thread = &spider_table_sts_threads[ my_calc_hash(&spider_open_tables, (uchar*) table_name, length) % spider_param_table_sts_thread_count()]; -#endif share->sts_spider_init = TRUE; } pthread_mutex_unlock(&share->mutex); @@ -4998,14 +4978,9 @@ SPIDER_SHARE *spider_get_share( spider_free_share(share); goto error_crd_spider_init; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE - share->crd_thread = &spider_table_crd_threads[ - hash_value % spider_param_table_crd_thread_count()]; -#else share->crd_thread = &spider_table_crd_threads[ my_calc_hash(&spider_open_tables, (uchar*) table_name, length) % spider_param_table_crd_thread_count()]; -#endif share->crd_spider_init = TRUE; } pthread_mutex_unlock(&share->mutex); @@ -5368,12 +5343,7 @@ int spider_free_share( } #endif spider_free_share_alloc(share); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_tables, - share->table_name_hash_value, (uchar*) share); -#else my_hash_delete(&spider_open_tables, (uchar*) share); -#endif pthread_mutex_destroy(&share->crd_mutex); pthread_mutex_destroy(&share->sts_mutex); pthread_mutex_destroy(&share->mutex); @@ -5458,13 +5428,8 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share( } uint old_elements = spider_lgtm_tblhnd_share_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_lgtm_tblhnd_share_hash, - hash_value, (uchar*) lgtm_tblhnd_share)) -#else if (my_hash_insert(&spider_lgtm_tblhnd_share_hash, (uchar*) lgtm_tblhnd_share)) -#endif { *error_num = HA_ERR_OUT_OF_MEM; goto error_hash_insert; @@ -5500,12 +5465,7 @@ void spider_free_lgtm_tblhnd_share_alloc( DBUG_ENTER("spider_free_lgtm_tblhnd_share"); if (!locked) pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_lgtm_tblhnd_share_hash, - lgtm_tblhnd_share->table_path_hash_value, (uchar*) lgtm_tblhnd_share); -#else my_hash_delete(&spider_lgtm_tblhnd_share_hash, (uchar*) lgtm_tblhnd_share); -#endif pthread_mutex_destroy(&lgtm_tblhnd_share->auto_increment_mutex); spider_free(spider_current_trx, lgtm_tblhnd_share, MYF(0)); if (!locked) @@ -5570,13 +5530,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share( thr_lock_init(&wide_share->lock); uint old_elements = spider_open_wide_share.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_open_wide_share, - share->table_path_hash_value, - (uchar*) wide_share)) -#else if (my_hash_insert(&spider_open_wide_share, (uchar*) wide_share)) -#endif { *error_num = HA_ERR_OUT_OF_MEM; goto error_hash_insert; @@ -5614,12 +5568,7 @@ int spider_free_wide_share( if (!--wide_share->use_count) { thr_lock_delete(&wide_share->lock); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_wide_share, - wide_share->table_path_hash_value, (uchar*) wide_share); -#else my_hash_delete(&spider_open_wide_share, (uchar*) wide_share); -#endif pthread_mutex_destroy(&wide_share->crd_mutex); pthread_mutex_destroy(&wide_share->sts_mutex); spider_free(spider_current_trx, wide_share, MYF(0)); @@ -6087,14 +6036,8 @@ int spider_db_done( while ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_element( &spider_udf_table_mon_list_hash[roop_count], 0))) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value( - &spider_udf_table_mon_list_hash[roop_count], - table_mon_list->key_hash_value, (uchar*) table_mon_list); -#else my_hash_delete(&spider_udf_table_mon_list_hash[roop_count], (uchar*) table_mon_list); -#endif spider_ping_table_free_mon_list(table_mon_list); } spider_free_mem_calc(spider_current_trx, @@ -6130,12 +6073,7 @@ int spider_db_done( pthread_mutex_lock(&spider_conn_mutex); while ((conn = (SPIDER_CONN*) my_hash_element(&spider_open_connections, 0))) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_open_connections, - conn->conn_key_hash_value, (uchar*) conn); -#else my_hash_delete(&spider_open_connections, (uchar*) conn); -#endif spider_free_conn(conn); } pthread_mutex_unlock(&spider_conn_mutex); @@ -6178,14 +6116,8 @@ int spider_db_done( while ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE*) my_hash_element(&spider_init_error_tables, 0))) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_init_error_tables, - spider_init_error_table->table_name_hash_value, - (uchar*) spider_init_error_table); -#else my_hash_delete(&spider_init_error_tables, (uchar*) spider_init_error_table); -#endif spider_free(NULL, spider_init_error_table, MYF(0)); } pthread_mutex_unlock(&spider_init_error_tbl_mutex); @@ -7206,13 +7138,8 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table( spider_init_error_table->table_name_hash_value = share->table_name_hash_value; uint old_elements = spider_init_error_tables.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_init_error_tables, - share->table_name_hash_value, (uchar*) spider_init_error_table)) -#else if (my_hash_insert(&spider_init_error_tables, (uchar*) spider_init_error_table)) -#endif { spider_free(trx, spider_init_error_table, MYF(0)); pthread_mutex_unlock(&spider_init_error_tbl_mutex); @@ -7243,14 +7170,8 @@ void spider_delete_init_error_table( my_hash_search_using_hash_value(&spider_init_error_tables, hash_value, (uchar*) name, length))) { -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_init_error_tables, - spider_init_error_table->table_name_hash_value, - (uchar*) spider_init_error_table); -#else my_hash_delete(&spider_init_error_tables, (uchar*) spider_init_error_table); -#endif spider_free(spider_current_trx, spider_init_error_table, MYF(0)); } pthread_mutex_unlock(&spider_init_error_tbl_mutex); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index f04c3659d6f..11dc7a81ad8 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -378,12 +378,7 @@ void spider_free_trx_alter_table_alloc( SPIDER_ALTER_TABLE *alter_table ) { DBUG_ENTER("spider_free_trx_alter_table_alloc"); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&trx->trx_alter_table_hash, - alter_table->table_name_hash_value, (uchar*) alter_table); -#else my_hash_delete(&trx->trx_alter_table_hash, (uchar*) alter_table); -#endif if (alter_table->tmp_char) spider_free(trx, alter_table->tmp_char, MYF(0)); spider_free(trx, alter_table, MYF(0)); @@ -799,12 +794,7 @@ int spider_create_trx_alter_table( share_alter->tmp_link_statuses_length; old_elements = trx->trx_alter_table_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&trx->trx_alter_table_hash, - alter_table->table_name_hash_value, (uchar*) alter_table)) -#else if (my_hash_insert(&trx->trx_alter_table_hash, (uchar*) alter_table)) -#endif { error_num = HA_ERR_OUT_OF_MEM; goto error; @@ -1277,12 +1267,7 @@ SPIDER_TRX *spider_get_trx( { pthread_mutex_lock(&spider_allocated_thds_mutex); uint old_elements = spider_allocated_thds.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&spider_allocated_thds, - trx->thd_hash_value, (uchar*) thd)) -#else if (my_hash_insert(&spider_allocated_thds, (uchar*) thd)) -#endif { pthread_mutex_unlock(&spider_allocated_thds_mutex); goto error_allocated_thds_insert; @@ -1388,12 +1373,7 @@ int spider_free_trx( { if (need_lock) pthread_mutex_lock(&spider_allocated_thds_mutex); -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&spider_allocated_thds, - trx->thd_hash_value, (uchar*) trx->thd); -#else my_hash_delete(&spider_allocated_thds, (uchar*) trx->thd); -#endif if (need_lock) pthread_mutex_unlock(&spider_allocated_thds_mutex); } @@ -1552,17 +1532,7 @@ static int spider_xa_lock( error_num = ER_SPIDER_XA_LOCKED_NUM; goto error; } -#ifdef HASH_UPDATE_WITH_HASH_VALUE -#ifdef XID_CACHE_IS_SPLITTED - if (my_hash_insert_with_hash_value(&spd_db_att_xid_cache[idx], hash_value, - (uchar*)xid_state)) -#else - if (my_hash_insert_with_hash_value(spd_db_att_xid_cache, hash_value, - (uchar*)xid_state)) -#endif -#else if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state)) -#endif { error_num = HA_ERR_OUT_OF_MEM; goto error; @@ -1597,13 +1567,6 @@ static int spider_xa_unlock( DBUG_ENTER("spider_xa_unlock"); #ifdef SPIDER_XID_USES_xid_cache_iterate #else -#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE) - my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache, - (uchar*) xid_state->xid.key(), xid_state->xid.key_length()); -#ifdef XID_CACHE_IS_SPLITTED - uint idx = hash_value % *spd_db_att_xid_cache_split_num; -#endif -#endif #endif old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider"); #ifdef SPIDER_XID_USES_xid_cache_iterate @@ -1614,17 +1577,7 @@ static int spider_xa_unlock( #else pthread_mutex_lock(spd_db_att_LOCK_xid_cache); #endif -#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE) -#ifdef XID_CACHE_IS_SPLITTED - my_hash_delete_with_hash_value(&spd_db_att_xid_cache[idx], - hash_value, (uchar *)xid_state); -#else - my_hash_delete_with_hash_value(spd_db_att_xid_cache, - hash_value, (uchar *)xid_state); -#endif -#else my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state); -#endif #ifdef XID_CACHE_IS_SPLITTED pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]); #else @@ -3785,12 +3738,7 @@ int spider_create_trx_ha( ) { DBUG_PRINT("info",("spider need recreate")); need_create = TRUE; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - my_hash_delete_with_hash_value(&trx->trx_ha_hash, - share->table_name_hash_value, (uchar*) trx_ha); -#else my_hash_delete(&trx->trx_ha_hash, (uchar*) trx_ha); -#endif spider_free(trx, trx_ha, MYF(0)); } else { DBUG_PRINT("info",("spider use this")); @@ -3820,12 +3768,7 @@ int spider_create_trx_ha( trx_ha->conn_can_fo = conn_can_fo; trx_ha->wait_for_reusing = FALSE; uint old_elements = trx->trx_ha_hash.array.max_element; -#ifdef HASH_UPDATE_WITH_HASH_VALUE - if (my_hash_insert_with_hash_value(&trx->trx_ha_hash, - share->table_name_hash_value, (uchar*) trx_ha)) -#else if (my_hash_insert(&trx->trx_ha_hash, (uchar*) trx_ha)) -#endif { spider_free(trx, trx_ha, MYF(0)); DBUG_RETURN(HA_ERR_OUT_OF_MEM); From e7570c7759ea5bb13b64e8dafec176cbbda97adb Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 17 Jun 2024 13:15:42 +0800 Subject: [PATCH 074/185] MDEV-31788 Remove spider_file_pos They are for unnecessary debugging purposes only. --- storage/spider/ha_spider.cc | 47 ---------- storage/spider/spd_conn.cc | 10 -- storage/spider/spd_db_conn.cc | 123 ------------------------ storage/spider/spd_db_mysql.cc | 124 ------------------------- storage/spider/spd_db_oracle.cc | 64 ------------- storage/spider/spd_direct_sql.cc | 1 - storage/spider/spd_group_by_handler.cc | 3 - storage/spider/spd_include.h | 14 --- storage/spider/spd_table.cc | 3 - 9 files changed, 389 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 814eee073be..8fff0c5b673 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1761,7 +1761,6 @@ int ha_spider::index_read_map_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if ( @@ -1771,7 +1770,6 @@ int ha_spider::index_read_map_internal( ) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { #endif @@ -1787,7 +1785,6 @@ int ha_spider::index_read_map_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -1884,7 +1881,6 @@ int ha_spider::index_read_map_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -2221,14 +2217,12 @@ int ha_spider::index_read_last_map_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { #endif @@ -2244,7 +2238,6 @@ int ha_spider::index_read_last_map_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -2341,7 +2334,6 @@ int ha_spider::index_read_last_map_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -2676,14 +2668,12 @@ int ha_spider::index_first_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { #endif @@ -2699,7 +2689,6 @@ int ha_spider::index_first_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -2796,7 +2785,6 @@ int ha_spider::index_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -3048,14 +3036,12 @@ int ha_spider::index_last_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { #endif @@ -3071,7 +3057,6 @@ int ha_spider::index_last_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -3168,7 +3153,6 @@ int ha_spider::index_last_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -3478,14 +3462,12 @@ int ha_spider::read_range_first_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { #endif @@ -3501,7 +3483,6 @@ int ha_spider::read_range_first_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -3598,7 +3579,6 @@ int ha_spider::read_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -4091,14 +4071,12 @@ int ha_spider::read_multi_range_first_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); #ifdef HA_MRR_USE_DEFAULT_IMPL *range_info = (char *) mrr_cur_range.ptr; @@ -4120,7 +4098,6 @@ int ha_spider::read_multi_range_first_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -4218,7 +4195,6 @@ int ha_spider::read_multi_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -4867,7 +4843,6 @@ int ha_spider::read_multi_range_first_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS @@ -4875,7 +4850,6 @@ int ha_spider::read_multi_range_first_internal( { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); #ifdef HA_MRR_USE_DEFAULT_IMPL *range_info = multi_range_keys[multi_range_hit_point]; @@ -4897,7 +4871,6 @@ int ha_spider::read_multi_range_first_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -5039,7 +5012,6 @@ int ha_spider::read_multi_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -5502,14 +5474,12 @@ int ha_spider::read_multi_range_next( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); #ifdef HA_MRR_USE_DEFAULT_IMPL *range_info = multi_range_keys[multi_range_hit_point]; @@ -5531,7 +5501,6 @@ int ha_spider::read_multi_range_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -5629,7 +5598,6 @@ int ha_spider::read_multi_range_next( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -6277,7 +6245,6 @@ int ha_spider::read_multi_range_next( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS @@ -6285,7 +6252,6 @@ int ha_spider::read_multi_range_next( { connection_ids[roop_count] = conn->connection_id; spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); #ifdef HA_MRR_USE_DEFAULT_IMPL *range_info = multi_range_keys[multi_range_hit_point]; @@ -6307,7 +6273,6 @@ int ha_spider::read_multi_range_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -6449,7 +6414,6 @@ int ha_spider::read_multi_range_next( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifdef HA_CAN_BULK_ACCESS @@ -6934,7 +6898,6 @@ int ha_spider::rnd_next_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); @@ -6948,7 +6911,6 @@ int ha_spider::rnd_next_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7045,7 +7007,6 @@ int ha_spider::rnd_next_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -7552,7 +7513,6 @@ int ha_spider::ft_read_internal( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7564,7 +7524,6 @@ int ha_spider::ft_read_internal( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7661,7 +7620,6 @@ int ha_spider::ft_read_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -10350,7 +10308,6 @@ void ha_spider::bulk_req_exec() spider_bg_conn_wait(conn); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10375,7 +10332,6 @@ void ha_spider::bulk_req_exec() DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } conn = conn->bulk_access_next; @@ -11998,7 +11954,6 @@ int ha_spider::drop_tmp_tables() DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -12010,7 +11965,6 @@ int ha_spider::drop_tmp_tables() DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -12077,7 +12031,6 @@ int ha_spider::drop_tmp_tables() DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 7c65f1d02eb..434a20e9e3e 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -276,7 +276,6 @@ int spider_free_conn_alloc( conn->db_conn = NULL; } spider_conn_done(conn); - DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name); pthread_mutex_destroy(&conn->mta_conn_mutex); conn->default_database.free(); DBUG_RETURN(0); @@ -1458,10 +1457,6 @@ void spider_conn_clear_queue( ) { DBUG_ENTER("spider_conn_clear_queue"); DBUG_PRINT("info", ("spider conn=%p", conn)); -/* - conn->queued_connect = FALSE; - conn->queued_ping = FALSE; -*/ conn->queued_trx_isolation = FALSE; conn->queued_semi_trx_isolation = FALSE; conn->queued_autocommit = FALSE; @@ -2593,7 +2588,6 @@ void *spider_bg_conn_action( } } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS @@ -2689,10 +2683,8 @@ void *spider_bg_conn_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } else { @@ -2770,7 +2762,6 @@ void *spider_bg_conn_action( spider = (ha_spider*) conn->bg_target; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[conn->link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2786,7 +2777,6 @@ void *spider_bg_conn_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); conn->bg_exec_sql = FALSE; continue; diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 046e024522f..7d786492bfe 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -179,7 +179,6 @@ int spider_db_ping_internal( int error_num; DBUG_ENTER("spider_db_ping_internal"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if (conn->server_lost || conn->queued_connect) { if ((error_num = spider_db_connect(share, conn, all_link_idx))) @@ -570,7 +569,6 @@ int spider_db_before_query( #endif conn->in_before_query = TRUE; pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ((error_num = spider_db_conn_queue_action(conn))) { conn->in_before_query = FALSE; @@ -676,7 +674,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -698,7 +695,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -711,7 +707,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY); @@ -737,7 +732,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -759,7 +753,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -767,7 +760,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(0); @@ -791,7 +783,6 @@ int spider_db_set_names_internal( ) { DBUG_ENTER("spider_db_set_names_internal"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); DBUG_ASSERT(conn->mta_conn_mutex_lock_already); DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); if ( @@ -944,7 +935,6 @@ int spider_db_query_for_bulk_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[link_idx] && @@ -1032,7 +1022,6 @@ int spider_db_query_for_bulk_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[link_idx] && @@ -1061,7 +1050,6 @@ int spider_db_query_for_bulk_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -3594,7 +3582,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -3611,7 +3598,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3643,7 +3629,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3688,7 +3673,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3729,7 +3713,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -3758,7 +3741,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -3766,7 +3748,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } current->record_num = current->result->num_rows(); @@ -3810,7 +3791,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } else { @@ -3835,7 +3815,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -3847,7 +3826,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -4760,7 +4738,6 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if (conn->db_conn->limit_mode() == 1) { conn->db_conn->set_limit(result_list->limit_num); @@ -4769,12 +4746,10 @@ int spider_db_seek_next( if ((error_num = spider_db_store_result_for_reuse_cursor( spider, link_idx, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { conn->need_mon = &spider->need_mons[link_idx]; @@ -4788,7 +4763,6 @@ int spider_db_seek_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( spider->need_mons[link_idx] @@ -4842,7 +4816,6 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, link_idx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -4872,7 +4845,6 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if (conn->db_conn->limit_mode() == 1) { conn->db_conn->set_limit(result_list->limit_num); @@ -4881,12 +4853,10 @@ int spider_db_seek_next( if ((error_num = spider_db_store_result_for_reuse_cursor( spider, link_idx, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { conn->need_mon = &spider->need_mons[roop_count]; @@ -4900,7 +4870,6 @@ int spider_db_seek_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -5001,7 +4970,6 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -5145,7 +5113,6 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); if (conn->db_conn->limit_mode() == 1) { @@ -5155,12 +5122,10 @@ int spider_db_seek_last( if ((error_num = spider_db_store_result_for_reuse_cursor( spider, roop_count, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { conn->need_mon = &spider->need_mons[roop_count]; @@ -5174,7 +5139,6 @@ int spider_db_seek_last( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -5272,7 +5236,6 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -5367,7 +5330,6 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); @@ -5380,7 +5342,6 @@ int spider_db_seek_last( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -5478,7 +5439,6 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -6138,7 +6098,6 @@ int spider_db_bulk_insert( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[roop_count2]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6152,7 +6111,6 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count2] && @@ -6197,7 +6155,6 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( error_num != ER_DUP_ENTRY && @@ -6234,7 +6191,6 @@ int spider_db_bulk_insert( insert_info = conn->db_conn->inserted_info(dbton_handler, copy_info); } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (first_insert_link_idx == -1) { @@ -6246,7 +6202,6 @@ int spider_db_bulk_insert( conn = first_insert_conn; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[first_insert_link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6275,7 +6230,6 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -6290,7 +6244,6 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -6299,7 +6252,6 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); spider->store_last_insert_id = 0; #ifdef HA_CAN_BULK_ACCESS @@ -6337,7 +6289,6 @@ int spider_db_bulk_bulk_insert( conn = spider->conns[roop_count2]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; @@ -6351,7 +6302,6 @@ int spider_db_bulk_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (first_insert_link_idx == -1) { @@ -6363,7 +6313,6 @@ int spider_db_bulk_bulk_insert( conn = first_insert_conn; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[first_insert_link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6397,7 +6346,6 @@ int spider_db_bulk_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); spider->store_last_insert_id = 0; DBUG_RETURN(error_num); @@ -6512,7 +6460,6 @@ int spider_db_bulk_update_size_limit( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, &dup_key_found))) { @@ -6596,7 +6543,6 @@ int spider_db_bulk_update_end( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -6635,7 +6581,6 @@ int spider_db_bulk_update_end( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -6715,7 +6660,6 @@ int spider_db_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6727,7 +6671,6 @@ int spider_db_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -6806,7 +6749,6 @@ int spider_db_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -6855,7 +6797,6 @@ int spider_db_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); result_list->update_sqls[roop_count].length(0); } @@ -6976,7 +6917,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -6995,7 +6935,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7078,7 +7017,6 @@ int spider_db_direct_update( #ifdef HA_CAN_BULK_ACCESS } #endif - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7187,7 +7125,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -7206,7 +7143,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7290,7 +7226,6 @@ int spider_db_direct_update( #ifdef HA_CAN_BULK_ACCESS } #endif - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7322,7 +7257,6 @@ int spider_db_bulk_direct_update( conn = spider->conns[roop_count]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; @@ -7344,7 +7278,6 @@ int spider_db_bulk_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -7405,7 +7338,6 @@ int spider_db_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; @@ -7417,7 +7349,6 @@ int spider_db_delete( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -7425,7 +7356,6 @@ int spider_db_delete( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); result_list->update_sqls[roop_count].length(0); } @@ -7517,7 +7447,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -7536,7 +7465,6 @@ int spider_db_direct_delete( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7611,7 +7539,6 @@ int spider_db_direct_delete( #ifdef HA_CAN_BULK_ACCESS } #endif - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -7696,7 +7623,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -7715,7 +7641,6 @@ int spider_db_direct_delete( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7790,7 +7715,6 @@ int spider_db_direct_delete( #ifdef HA_CAN_BULK_ACCESS } #endif - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -7833,7 +7757,6 @@ int spider_db_delete_all_rows( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7864,7 +7787,6 @@ int spider_db_delete_all_rows( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7895,7 +7817,6 @@ int spider_db_delete_all_rows( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7962,7 +7883,6 @@ int spider_db_delete_all_rows( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if ( share->monitoring_kind[roop_count] && @@ -7992,7 +7912,6 @@ int spider_db_delete_all_rows( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL))) @@ -9803,7 +9722,6 @@ int spider_db_udf_direct_sql( pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10034,7 +9952,6 @@ int spider_db_udf_direct_sql( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (need_trx_end && insert_start) { @@ -10068,7 +9985,6 @@ int spider_db_udf_direct_sql_select_db( if ( spider_dbton[conn->dbton_id].db_util->database_has_default_value() ) { - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ( !conn->default_database.length() || conn->default_database.length() != @@ -10111,7 +10027,6 @@ int spider_db_udf_direct_sql_set_names( int error_num, need_mon = 0; DBUG_ENTER("spider_db_udf_direct_sql_set_names"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ( !conn->access_charset || trx->udf_access_charset->cset != conn->access_charset->cset @@ -10198,7 +10113,6 @@ int spider_db_udf_ping_table( spider.db_request_id = &db_request_id; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10210,7 +10124,6 @@ int spider_db_udf_ping_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); @@ -10227,7 +10140,6 @@ int spider_db_udf_ping_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (!ping_only) { @@ -10273,7 +10185,6 @@ int spider_db_udf_ping_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10285,7 +10196,6 @@ int spider_db_udf_ping_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); @@ -10317,7 +10227,6 @@ int spider_db_udf_ping_table( conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; spider_db_discard_result(&spider, 0, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); } @@ -10536,7 +10445,6 @@ int spider_db_udf_ping_table_mon_next( pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10548,7 +10456,6 @@ int spider_db_udf_ping_table_mon_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); @@ -10561,7 +10468,6 @@ int spider_db_udf_ping_table_mon_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); DBUG_RETURN(error_num); @@ -10595,7 +10501,6 @@ int spider_db_udf_ping_table_mon_next( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); DBUG_RETURN(error_num); @@ -10613,7 +10518,6 @@ int spider_db_udf_ping_table_mon_next( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); error_num = res->fetch_table_mon_status(mon_table_result->result_status); @@ -10699,7 +10603,6 @@ int spider_db_udf_copy_tables( { pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); tmp_conn->need_mon = &tmp_spider->need_mons[0]; DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); @@ -10711,7 +10614,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); @@ -10727,7 +10629,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); goto error_start_transaction; } @@ -10735,7 +10636,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); } } @@ -10758,7 +10658,6 @@ int spider_db_udf_copy_tables( tmp_conn = tmp_spider->conns[0]; pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); tmp_conn->need_mon = &tmp_spider->need_mons[0]; DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); @@ -10770,7 +10669,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); @@ -10788,7 +10686,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); tmp_conn->table_lock = 0; if (error_num == HA_ERR_OUT_OF_MEM) @@ -10799,7 +10696,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); tmp_conn->table_lock = 1; } @@ -10810,7 +10706,6 @@ int spider_db_udf_copy_tables( copy_tables->trx->thd, src_tbl_conn->share); pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); tmp_conn->need_mon = &src_tbl_conn->need_mon; DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); @@ -10857,7 +10752,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); goto error_db_query; } @@ -10876,7 +10770,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); goto error_db_query; } @@ -10906,7 +10799,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); goto error_db_query; } @@ -10925,7 +10817,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); error_num = ER_OUT_OF_RESOURCES; goto error_db_query; @@ -10941,7 +10832,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); goto error_db_query; } @@ -10951,7 +10841,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn; dst_tbl_conn = dst_tbl_conn->next) @@ -10975,7 +10864,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, @@ -10988,7 +10876,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); } } @@ -11032,7 +10919,6 @@ int spider_db_udf_copy_tables( insert_ct = dst_tbl_conn->copy_table; pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); tmp_conn->need_mon = &dst_tbl_conn->need_mon; DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); @@ -11059,7 +10945,6 @@ int spider_db_udf_copy_tables( DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); tmp_conn->mta_conn_mutex_lock_already = FALSE; tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); } } @@ -11205,9 +11090,7 @@ int spider_db_open_handler( DBUG_ENTER("spider_db_open_handler"); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; @@ -11251,7 +11134,6 @@ int spider_db_open_handler( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); @@ -11260,7 +11142,6 @@ error: DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11292,7 +11173,6 @@ int spider_db_close_handler( DBUG_PRINT("info",("spider conn=%p", conn)); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11308,7 +11188,6 @@ int spider_db_close_handler( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11335,7 +11214,6 @@ int spider_db_close_handler( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); @@ -11344,7 +11222,6 @@ error: DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index ed92a5d2e64..62fb57c8724 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -2496,7 +2496,6 @@ int spider_db_mbase::consistent_snapshot( DBUG_PRINT("info",("spider this=%p", this)); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2519,7 +2518,6 @@ int spider_db_mbase::consistent_snapshot( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2558,7 +2556,6 @@ int spider_db_mbase::commit( DBUG_PRINT("info",("spider this=%p", this)); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2581,7 +2578,6 @@ int spider_db_mbase::commit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2595,7 +2591,6 @@ int spider_db_mbase::rollback( DBUG_PRINT("info",("spider this=%p", this)); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2620,7 +2615,6 @@ int spider_db_mbase::rollback( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -2629,7 +2623,6 @@ int spider_db_mbase::rollback( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2666,7 +2659,6 @@ int spider_db_mbase::xa_end( spider_db_append_xid_str(&sql_str, xid); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2689,7 +2681,6 @@ int spider_db_mbase::xa_end( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2709,7 +2700,6 @@ int spider_db_mbase::xa_prepare( spider_db_append_xid_str(&sql_str, xid); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2732,7 +2722,6 @@ int spider_db_mbase::xa_prepare( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2752,7 +2741,6 @@ int spider_db_mbase::xa_commit( spider_db_append_xid_str(&sql_str, xid); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2775,7 +2763,6 @@ int spider_db_mbase::xa_commit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2795,7 +2782,6 @@ int spider_db_mbase::xa_rollback( spider_db_append_xid_str(&sql_str, xid); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2818,7 +2804,6 @@ int spider_db_mbase::xa_rollback( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -2841,7 +2826,6 @@ int spider_db_mbase::set_trx_isolation( case ISO_READ_UNCOMMITTED: pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2864,13 +2848,11 @@ int spider_db_mbase::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; case ISO_READ_COMMITTED: pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2893,13 +2875,11 @@ int spider_db_mbase::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; case ISO_REPEATABLE_READ: pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2922,13 +2902,11 @@ int spider_db_mbase::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; case ISO_SERIALIZABLE: pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2951,7 +2929,6 @@ int spider_db_mbase::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; default: @@ -2977,7 +2954,6 @@ int spider_db_mbase::set_autocommit( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3000,12 +2976,10 @@ int spider_db_mbase::set_autocommit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3028,7 +3002,6 @@ int spider_db_mbase::set_autocommit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(0); @@ -3051,7 +3024,6 @@ int spider_db_mbase::set_sql_log_off( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3074,12 +3046,10 @@ int spider_db_mbase::set_sql_log_off( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3102,7 +3072,6 @@ int spider_db_mbase::set_sql_log_off( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(0); @@ -3135,7 +3104,6 @@ int spider_db_mbase::set_wait_timeout( sql_str.q_append(timeout_str, timeout_str_length); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3158,7 +3126,6 @@ int spider_db_mbase::set_wait_timeout( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -3200,7 +3167,6 @@ int spider_db_mbase::set_sql_mode( sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3223,7 +3189,6 @@ int spider_db_mbase::set_sql_mode( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -3254,7 +3219,6 @@ int spider_db_mbase::set_time_zone( sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3277,7 +3241,6 @@ int spider_db_mbase::set_time_zone( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -3295,7 +3258,6 @@ int spider_db_mbase::exec_simple_sql_with_result( DBUG_ENTER("spider_db_mbase::exec_simple_sql_with_result"); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3328,7 +3290,6 @@ int spider_db_mbase::exec_simple_sql_with_result( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); DBUG_RETURN(error_num); @@ -3340,7 +3301,6 @@ int spider_db_mbase::exec_simple_sql_with_result( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); DBUG_RETURN(error_num); @@ -3366,7 +3326,6 @@ int spider_db_mbase::exec_simple_sql_with_result( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); DBUG_RETURN(error_num); @@ -3380,7 +3339,6 @@ int spider_db_mbase::exec_simple_sql_with_result( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); DBUG_RETURN(error_num); @@ -3399,7 +3357,6 @@ int spider_db_mbase::exec_simple_sql_with_result( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -7955,7 +7912,6 @@ int spider_mbase_share::discover_table_structure( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7979,7 +7935,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8004,7 +7959,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8025,7 +7979,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8035,7 +7988,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8049,7 +8001,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), @@ -8067,7 +8018,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8081,7 +8031,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8091,7 +8040,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8105,7 +8053,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8118,7 +8065,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8132,7 +8078,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8142,7 +8087,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8156,7 +8100,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); continue; } @@ -8166,7 +8109,6 @@ int spider_mbase_share::discover_table_structure( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (!error_num) break; @@ -13473,7 +13415,6 @@ int spider_mbase_handler::show_table_status( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -13507,7 +13448,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13518,7 +13458,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13545,7 +13484,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13563,7 +13501,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -13576,7 +13513,6 @@ int spider_mbase_handler::show_table_status( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13596,7 +13532,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, @@ -13631,7 +13566,6 @@ int spider_mbase_handler::show_table_status( } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -13665,7 +13599,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13676,7 +13609,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13703,7 +13635,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13721,7 +13652,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -13742,7 +13672,6 @@ int spider_mbase_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, @@ -13822,7 +13751,6 @@ int spider_mbase_handler::show_index( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -13854,7 +13782,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13864,7 +13791,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13889,7 +13815,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13908,7 +13833,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -13918,7 +13842,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (res) { @@ -13972,7 +13895,6 @@ int spider_mbase_handler::show_index( } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14004,7 +13926,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14014,7 +13935,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14039,7 +13959,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14058,7 +13977,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14068,7 +13986,6 @@ int spider_mbase_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (res) { @@ -14175,7 +14092,6 @@ int spider_mbase_handler::simple_action( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14207,7 +14123,6 @@ int spider_mbase_handler::simple_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); DBUG_RETURN(error_num); @@ -14218,7 +14133,6 @@ int spider_mbase_handler::simple_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); DBUG_RETURN(error_num); @@ -14245,7 +14159,6 @@ int spider_mbase_handler::simple_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); DBUG_RETURN(error_num); @@ -14265,7 +14178,6 @@ int spider_mbase_handler::simple_action( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); DBUG_RETURN(error_num); @@ -14284,7 +14196,6 @@ int spider_mbase_handler::simple_action( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); switch (simple_action) { @@ -14364,7 +14275,6 @@ ha_rows spider_mbase_handler::explain_select( pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14398,7 +14308,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -14410,7 +14319,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -14431,7 +14339,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -14442,7 +14349,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -14463,7 +14369,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } else { @@ -14472,7 +14377,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -14481,7 +14385,6 @@ ha_rows spider_mbase_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 2, @@ -14513,7 +14416,6 @@ int spider_mbase_handler::lock_tables( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14525,7 +14427,6 @@ int spider_mbase_handler::lock_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14549,7 +14450,6 @@ int spider_mbase_handler::lock_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } if (!conn->table_locked) @@ -14584,7 +14484,6 @@ int spider_mbase_handler::unlock_tables( spider->share); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14607,7 +14506,6 @@ int spider_mbase_handler::unlock_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -14630,7 +14528,6 @@ int spider_mbase_handler::disable_keys( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14642,7 +14539,6 @@ int spider_mbase_handler::disable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14667,7 +14563,6 @@ int spider_mbase_handler::disable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14688,7 +14583,6 @@ int spider_mbase_handler::enable_keys( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14700,7 +14594,6 @@ int spider_mbase_handler::enable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14725,7 +14618,6 @@ int spider_mbase_handler::enable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14747,7 +14639,6 @@ int spider_mbase_handler::check_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14759,7 +14650,6 @@ int spider_mbase_handler::check_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14784,7 +14674,6 @@ int spider_mbase_handler::check_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14806,7 +14695,6 @@ int spider_mbase_handler::repair_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14818,7 +14706,6 @@ int spider_mbase_handler::repair_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14843,7 +14730,6 @@ int spider_mbase_handler::repair_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14864,7 +14750,6 @@ int spider_mbase_handler::analyze_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14876,7 +14761,6 @@ int spider_mbase_handler::analyze_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14901,7 +14785,6 @@ int spider_mbase_handler::analyze_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14922,7 +14805,6 @@ int spider_mbase_handler::optimize_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -14934,7 +14816,6 @@ int spider_mbase_handler::optimize_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -14959,7 +14840,6 @@ int spider_mbase_handler::optimize_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -14984,7 +14864,6 @@ int spider_mbase_handler::flush_tables( share); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -15008,7 +14887,6 @@ int spider_mbase_handler::flush_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -15026,7 +14904,6 @@ int spider_mbase_handler::flush_logs( share); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -15050,7 +14927,6 @@ int spider_mbase_handler::flush_logs( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index e0eeaf2975b..9ed1aa32a96 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -2011,7 +2011,6 @@ int spider_db_oracle::set_trx_isolation( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2034,7 +2033,6 @@ int spider_db_oracle::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; case ISO_REPEATABLE_READ: @@ -2046,7 +2044,6 @@ int spider_db_oracle::set_trx_isolation( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2069,7 +2066,6 @@ int spider_db_oracle::set_trx_isolation( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); break; default: @@ -2100,7 +2096,6 @@ int spider_db_oracle::set_autocommit( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2123,7 +2118,6 @@ int spider_db_oracle::set_autocommit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } else { if (conn->in_before_query) @@ -2133,7 +2127,6 @@ int spider_db_oracle::set_autocommit( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2156,7 +2149,6 @@ int spider_db_oracle::set_autocommit( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(0); @@ -10844,7 +10836,6 @@ int spider_oracle_handler::show_table_status( } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -10876,7 +10867,6 @@ int spider_oracle_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -10886,7 +10876,6 @@ int spider_oracle_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -10911,7 +10900,6 @@ int spider_oracle_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -10937,7 +10925,6 @@ int spider_oracle_handler::show_table_status( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, @@ -10996,7 +10983,6 @@ int spider_oracle_handler::show_index( } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11028,7 +11014,6 @@ int spider_oracle_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11038,7 +11023,6 @@ int spider_oracle_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11063,7 +11047,6 @@ int spider_oracle_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11082,7 +11065,6 @@ int spider_oracle_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11092,7 +11074,6 @@ int spider_oracle_handler::show_index( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (res) { @@ -11137,7 +11118,6 @@ int spider_oracle_handler::show_records( DBUG_ENTER("spider_oracle_handler::show_records"); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11169,7 +11149,6 @@ int spider_oracle_handler::show_records( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); DBUG_RETURN(error_num); @@ -11180,7 +11159,6 @@ int spider_oracle_handler::show_records( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); DBUG_RETURN(error_num); @@ -11207,7 +11185,6 @@ int spider_oracle_handler::show_records( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); DBUG_RETURN(error_num); @@ -11227,7 +11204,6 @@ int spider_oracle_handler::show_records( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); DBUG_RETURN(error_num); @@ -11246,7 +11222,6 @@ int spider_oracle_handler::show_records( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 1, @@ -11278,7 +11253,6 @@ int spider_oracle_handler::show_autoinc( pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11310,7 +11284,6 @@ int spider_oracle_handler::show_autoinc( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); DBUG_RETURN(error_num); @@ -11321,7 +11294,6 @@ int spider_oracle_handler::show_autoinc( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); DBUG_RETURN(error_num); @@ -11348,7 +11320,6 @@ int spider_oracle_handler::show_autoinc( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); DBUG_RETURN(error_num); @@ -11368,7 +11339,6 @@ int spider_oracle_handler::show_autoinc( conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); DBUG_RETURN(error_num); @@ -11387,7 +11357,6 @@ int spider_oracle_handler::show_autoinc( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 1, @@ -11496,7 +11465,6 @@ ha_rows spider_oracle_handler::explain_select( pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11530,7 +11498,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -11542,7 +11509,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -11563,7 +11529,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -11574,7 +11539,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -11595,7 +11559,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } else { @@ -11604,7 +11567,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(HA_POS_ERROR); } @@ -11613,7 +11575,6 @@ ha_rows spider_oracle_handler::explain_select( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 2, @@ -11646,7 +11607,6 @@ int spider_oracle_handler::lock_tables( { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11658,7 +11618,6 @@ int spider_oracle_handler::lock_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11682,7 +11641,6 @@ int spider_oracle_handler::lock_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } if (!conn->table_locked) @@ -11727,7 +11685,6 @@ int spider_oracle_handler::disable_keys( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11739,7 +11696,6 @@ int spider_oracle_handler::disable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11764,7 +11720,6 @@ int spider_oracle_handler::disable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -11786,7 +11741,6 @@ int spider_oracle_handler::enable_keys( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11798,7 +11752,6 @@ int spider_oracle_handler::enable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11823,7 +11776,6 @@ int spider_oracle_handler::enable_keys( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -11846,7 +11798,6 @@ int spider_oracle_handler::check_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11858,7 +11809,6 @@ int spider_oracle_handler::check_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11883,7 +11833,6 @@ int spider_oracle_handler::check_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -11906,7 +11855,6 @@ int spider_oracle_handler::repair_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11918,7 +11866,6 @@ int spider_oracle_handler::repair_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -11943,7 +11890,6 @@ int spider_oracle_handler::repair_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -11965,7 +11911,6 @@ int spider_oracle_handler::analyze_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -11977,7 +11922,6 @@ int spider_oracle_handler::analyze_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -12002,7 +11946,6 @@ int spider_oracle_handler::analyze_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -12024,7 +11967,6 @@ int spider_oracle_handler::optimize_table( } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -12036,7 +11978,6 @@ int spider_oracle_handler::optimize_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(error_num); } @@ -12061,7 +12002,6 @@ int spider_oracle_handler::optimize_table( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -12087,7 +12027,6 @@ int spider_oracle_handler::flush_tables( share); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -12111,7 +12050,6 @@ int spider_oracle_handler::flush_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } @@ -12129,7 +12067,6 @@ int spider_oracle_handler::flush_logs( share); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -12153,7 +12090,6 @@ int spider_oracle_handler::flush_logs( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); DBUG_RETURN(0); } diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 0d12b3b25b3..7c7f9aa7558 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -477,7 +477,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( DBUG_RETURN(conn); error: - DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name); error_too_many_ipport_count: spider_conn_done(conn); error_conn_init: diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 9b71f5bc13f..fa9f041c83b 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -1196,7 +1196,6 @@ static int spider_send_query( SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain))) DBUG_RETURN(error_num); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -1210,7 +1209,6 @@ static int spider_send_query( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); @@ -1268,7 +1266,6 @@ static int spider_send_query( } else { spider_db_discard_result(spider, link_idx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } #ifndef WITHOUT_SPIDER_BG_SEARCH diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 12320f73742..5627f15bd4f 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -453,11 +453,6 @@ enum spider_malloc_id { #define SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_TMP_ERROR_NUM \ if (thd && conn->error_mode) {SPIDER_RESTORE_DASTATUS; tmp_error_num = 0;} -#define SPIDER_SET_FILE_POS(A) \ - {(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;} -#define SPIDER_CLEAR_FILE_POS(A) \ - {DBUG_PRINT("info", ("spider thd=%p func_name=%s file_name=%s line_no=%lu", (A)->thd, (A)->func_name ? (A)->func_name : "NULL", (A)->file_name ? (A)->file_name : "NULL", (A)->line_no)); (A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;} - class ha_spider; typedef struct st_spider_share SPIDER_SHARE; typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST; @@ -481,14 +476,6 @@ typedef struct st_spider_thread } SPIDER_THREAD; #endif -typedef struct st_spider_file_pos -{ - THD *thd; - const char *func_name; - const char *file_name; - ulong line_no; -} SPIDER_FILE_POS; - typedef struct st_spider_link_for_hash { ha_spider *spider; @@ -610,7 +597,6 @@ typedef struct st_spider_conn pthread_mutex_t mta_conn_mutex; volatile bool mta_conn_mutex_lock_already; volatile bool mta_conn_mutex_unlock_later; - SPIDER_FILE_POS mta_conn_mutex_file_pos; uint join_trx; int trx_isolation; bool semi_trx_isolation_chk; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 145d9dc9c40..1503c61b1bb 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -5741,7 +5741,6 @@ int spider_open_all_tables( conn->error_mode &= spider_param_error_write_mode(thd, 0); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &mon_val; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5753,7 +5752,6 @@ int spider_open_all_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); spider_sys_index_end(table_tables); spider_close_sys_table(thd, table_tables, @@ -5767,7 +5765,6 @@ int spider_open_all_tables( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2) From f5b7c25e1e2ca9f86a4679422eff16d3e3db45f9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 18 Jun 2024 10:21:38 +0800 Subject: [PATCH 075/185] MDEV-27643 Spider: remove #ifdef HA_CAN_BULK_ACCESS --- storage/spider/ha_spider.cc | 1242 ------------------------------- storage/spider/ha_spider.h | 141 ---- storage/spider/spd_conn.cc | 14 - storage/spider/spd_db_conn.cc | 232 ------ storage/spider/spd_db_conn.h | 26 - storage/spider/spd_db_include.h | 2 - storage/spider/spd_db_mysql.cc | 4 - storage/spider/spd_db_oracle.cc | 4 - storage/spider/spd_include.h | 27 - storage/spider/spd_param.cc | 25 - storage/spider/spd_param.h | 5 - storage/spider/spd_table.cc | 28 - storage/spider/spd_trx.cc | 41 - storage/spider/spd_trx.h | 6 - 14 files changed, 1797 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 8fff0c5b673..e910ffcff56 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -94,17 +94,6 @@ ha_spider::ha_spider( use_pre_call = FALSE; use_pre_action = FALSE; do_direct_update = FALSE; -#ifdef HA_CAN_BULK_ACCESS - is_bulk_access_clone = FALSE; - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - bulk_access_link_first = NULL; -/* - init_ha_mem_root = FALSE; -*/ -#endif prev_index_rnd_init = SPD_NONE; direct_aggregate_item_first = NULL; result_link_idx = 0; @@ -173,17 +162,6 @@ ha_spider::ha_spider( use_pre_call = FALSE; use_pre_action = FALSE; do_direct_update = FALSE; -#ifdef HA_CAN_BULK_ACCESS - is_bulk_access_clone = FALSE; - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - bulk_access_link_first = NULL; -/* - init_ha_mem_root = FALSE; -*/ -#endif prev_index_rnd_init = SPD_NONE; direct_aggregate_item_first = NULL; result_link_idx = 0; @@ -514,9 +492,6 @@ int ha_spider::open( } else wide_handler->semi_table_lock = spider_param_semi_table_lock(thd, share->semi_table_lock); -#ifdef HA_CAN_BULK_ACCESS - external_lock_cnt = 0; -#endif if (reset()) { @@ -606,22 +581,6 @@ int ha_spider::close() delete [] mrr_key_buff; mrr_key_buff = NULL; } -#endif -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_link_first) - { - do { - DBUG_PRINT("info",("spider bulk_access_link->spider=%p", - bulk_access_link_first->spider)); - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=" - "%p", &bulk_access_link_first->spider->dbton_handler)); - bulk_access_link_current = bulk_access_link_first->next; - delete_bulk_access_link(bulk_access_link_first); - bulk_access_link_first = bulk_access_link_current; - } while (bulk_access_link_first); - } #endif while (direct_aggregate_item_first) { @@ -780,33 +739,6 @@ void ha_spider::check_access_kind( DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::additional_lock( - THD *thd, - enum thr_lock_type lock_type -) { - DBUG_ENTER("ha_spider::additional_lock"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_executing) - { - if (is_bulk_access_clone) - { - check_access_kind(thd); - DBUG_RETURN(check_access_kind_for_connection(thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))); - } else if (bulk_access_link_exec_tgt->called) - { - bulk_access_link_exec_tgt->spider->check_access_kind(thd); - DBUG_RETURN(bulk_access_link_exec_tgt->spider-> - check_access_kind_for_connection( - thd, (lock_type >= TL_WRITE_ALLOW_WRITE))); - } - } - check_access_kind(thd); - DBUG_RETURN(check_access_kind_for_connection(thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))); -} -#endif THR_LOCK_DATA **ha_spider::store_lock( THD *thd, @@ -1144,40 +1076,6 @@ int ha_spider::reset() backup_error_status(); DBUG_ENTER("ha_spider::reset"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_BULK_ACCESS_LINK *tmp_bulk_access_link = bulk_access_link_first; - while (tmp_bulk_access_link) - { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - tmp_bulk_access_link->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &tmp_bulk_access_link->spider->dbton_handler)); - if (!tmp_bulk_access_link->used) - break; - if ((error_num2 = tmp_bulk_access_link->spider->ha_reset())) - error_num = error_num2; - tmp_bulk_access_link->used = FALSE; - tmp_bulk_access_link = tmp_bulk_access_link->next; - } - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - if ( - bulk_access_link_first && - !spider_param_bulk_access_free(share->bulk_access_free) - ) { - do { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &bulk_access_link_first->spider->dbton_handler)); - bulk_access_link_current = bulk_access_link_first->next; - delete_bulk_access_link(bulk_access_link_first); - bulk_access_link_first = bulk_access_link_current; - } while (bulk_access_link_first); - } -#endif direct_aggregate_item_current = direct_aggregate_item_first; while (direct_aggregate_item_current) { @@ -1319,17 +1217,6 @@ int ha_spider::reset() use_fields = FALSE; #endif error_mode = 0; -#ifdef HA_CAN_BULK_ACCESS -#ifndef DBUG_OFF - if (bulk_access_link_first) - { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &bulk_access_link_first->spider->dbton_handler)); - } -#endif -#endif DBUG_RETURN(error_num); } @@ -1438,19 +1325,6 @@ int ha_spider::index_init( DBUG_ENTER("ha_spider::index_init"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider idx=%u", idx)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_index_init( - idx, sorted)); - } - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -1499,16 +1373,6 @@ int ha_spider::index_init( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_index_init( - uint idx, - bool sorted -) { - DBUG_ENTER("ha_spider::pre_index_init"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_index_init(idx, sorted)); -} -#endif int ha_spider::index_end() { @@ -1516,21 +1380,6 @@ int ha_spider::index_end() backup_error_status(); DBUG_ENTER("ha_spider::index_end"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->ha_index_end(); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif active_index = MAX_KEY; /* #ifdef INFO_KIND_FORCE_LIMIT_BEGIN @@ -1550,14 +1399,6 @@ int ha_spider::index_end() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_index_end() -{ - DBUG_ENTER("ha_spider::pre_index_end"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_index_end()); -} -#endif int ha_spider::index_read_map_internal( uchar *buf, @@ -1762,17 +1603,6 @@ int ha_spider::index_read_map_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if ( - is_bulk_access_clone && - !bulk_access_executing && - conn_kind[roop_count] != SPIDER_CONN_KIND_MYSQL - ) { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -1883,9 +1713,6 @@ int ha_spider::index_read_map_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -1901,42 +1728,13 @@ int ha_spider::pre_index_read_map( enum ha_rkey_function find_flag, bool use_parallel ) { -#ifdef HA_CAN_BULK_ACCESS - int error_num; -#endif DBUG_ENTER("ha_spider::pre_index_read_map"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider->pre_index_read_map(key, - keypart_map, find_flag, TRUE); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } else if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->pre_index_read_map(key, - keypart_map, find_flag, TRUE)); - } -#endif check_pre_call(use_parallel); if (use_pre_call) { store_error_num = index_read_map_internal(NULL, key, keypart_map, find_flag); -#ifdef HA_CAN_BULK_ACCESS - if ( - !store_error_num && - bulk_access_executing && - is_bulk_access_clone && - !bulk_access_pre_called - ) { - bulk_req_exec(); - } -#endif DBUG_RETURN(store_error_num); } DBUG_RETURN(0); @@ -1951,59 +1749,6 @@ int ha_spider::index_read_map( int error_num; DBUG_ENTER("ha_spider::index_read_map"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if (is_bulk_access_clone) - { - if (bulk_access_pre_called) - { - SPIDER_CONN *conn; - int roop_count, roop_start, roop_end, tmp_lock_mode, link_ok, - tmp_error_num; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } - for (roop_count = roop_start; roop_count < roop_end; - roop_count = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, roop_count, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - conn = conns[roop_count]; - if ((tmp_error_num = spider_db_bulk_store_result(this, conn, - roop_count, (roop_count != link_ok)))) - { - store_error_num = tmp_error_num; - } else { - result_link_idx = link_ok; - } - } - use_pre_call = TRUE; - bulk_access_pre_called = FALSE; - } else { - /* do access normally */ - } - } else if (bulk_access_link_exec_tgt->called) - { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->index_read_map(buf, key, - keypart_map, find_flag)); - } - } -#endif if (use_pre_call) { if (store_error_num) @@ -2218,14 +1963,6 @@ int ha_spider::index_read_last_map_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2336,9 +2073,6 @@ int ha_spider::index_read_last_map_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -2401,21 +2135,6 @@ int ha_spider::index_next( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_next(buf); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -2447,21 +2166,6 @@ int ha_spider::index_prev( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_prev(buf); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -2669,14 +2373,6 @@ int ha_spider::index_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2787,9 +2483,6 @@ int ha_spider::index_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -3037,14 +2730,6 @@ int ha_spider::index_last_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3155,9 +2840,6 @@ int ha_spider::index_last_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -3231,22 +2913,6 @@ int ha_spider::index_next_same( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_next_same(buf, key, - keylen); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -3463,14 +3129,6 @@ int ha_spider::read_range_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3581,9 +3239,6 @@ int ha_spider::read_range_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -4072,20 +3727,6 @@ int ha_spider::read_multi_range_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = (char *) mrr_cur_range.ptr; -#else - *found_range_p = multi_range_curr; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -4198,9 +3839,6 @@ int ha_spider::read_multi_range_first_internal( pthread_mutex_unlock(&conn->mta_conn_mutex); } } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -4845,20 +4483,6 @@ int ha_spider::read_multi_range_first_internal( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5014,9 +4638,6 @@ int ha_spider::read_multi_range_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -5475,20 +5096,6 @@ int ha_spider::read_multi_range_next( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5601,9 +5208,6 @@ int ha_spider::read_multi_range_next( pthread_mutex_unlock(&conn->mta_conn_mutex); } } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -6247,20 +5851,6 @@ int ha_spider::read_multi_range_next( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6416,9 +6006,6 @@ int ha_spider::read_multi_range_next( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -6655,15 +6242,6 @@ int ha_spider::rnd_init( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_rnd_init( - bool scan -) { - DBUG_ENTER("ha_spider::pre_rnd_init"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_init(scan)); -} -#endif int ha_spider::rnd_end() { @@ -6687,14 +6265,6 @@ int ha_spider::rnd_end() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_rnd_end() -{ - DBUG_ENTER("ha_spider::pre_rnd_end"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_end()); -} -#endif int ha_spider::rnd_next_internal( uchar *buf @@ -8700,8 +8270,6 @@ ulonglong ha_spider::table_flags() const #endif #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON HA_CAN_TABLE_CONDITION_PUSHDOWN | -#endif -#ifdef HA_CAN_BULK_ACCESS #endif SPIDER_CAN_BG_SEARCH | SPIDER_CAN_BG_INSERT | @@ -9046,30 +8614,6 @@ int ha_spider::write_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - ulonglong option_backup = 0; - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_bulk_insert(this)); - } - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_write_row(buf); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9156,35 +8700,9 @@ int ha_spider::write_row( if ((error_num = spider_db_bulk_insert(this, table, ©_info, FALSE))) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - /* bulk access disabled case (like using partitioning) */ - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_bulk_insert(this)); - } -#endif DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_write_row( - uchar *buf -) { - int error_num; - ulonglong option_backup = 0; - THD *thd = wide_handler->trx->thd; - DBUG_ENTER("ha_spider::pre_write_row"); - DBUG_PRINT("info",("spider this=%p", this)); - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_current->spider->ha_write_row(buf); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); -} -#endif void ha_spider::direct_update_init( THD *thd, @@ -9258,20 +8776,6 @@ int ha_spider::update_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - ulonglong option_backup = 0; - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_update_row( - old_data, new_data); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_update_count); #endif @@ -9357,27 +8861,6 @@ int ha_spider::direct_update_rows_init( THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_update_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_PRINT("info",("spider return pre_direct_init_result %d", - pre_direct_init_result)); - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data)); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9495,27 +8978,6 @@ int ha_spider::direct_update_rows_init( } } } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_PRINT("info",("spider return pre_direct_init_result %d", - pre_direct_init_result)); - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider-> - direct_update_rows_init(update_fields)); - } -#endif if (!dml_inited) { if (unlikely(dml_init())) @@ -9586,78 +9048,6 @@ int ha_spider::direct_update_rows_init( } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_update_rows_init( - List *update_fields, - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data -) -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data); - DBUG_RETURN(pre_direct_init_result); -} -#else -/** - Do initialization for performing parallel direct update - for a handlersocket update request. - - @param update fields Pointer to the list of fields to update. - - @return >0 Error. - 0 Success. -*/ - -int ha_spider::pre_direct_update_rows_init( - List *update_fields -) -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init(update_fields); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_update_rows_init(update_fields); - DBUG_RETURN(pre_direct_init_result); -} -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int ha_spider::direct_update_rows( @@ -9679,26 +9069,6 @@ int ha_spider::direct_update_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - ranges, range_count, sorted, new_data, update_rows, found_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -9707,13 +9077,6 @@ int ha_spider::direct_update_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } -#endif DBUG_RETURN(0); } #else @@ -9732,26 +9095,6 @@ int ha_spider::direct_update_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - update_rows, found_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -9759,44 +9102,10 @@ int ha_spider::direct_update_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } -#endif DBUG_RETURN(0); } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_update_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data, - ha_rows *update_rows, - ha_rows *found_rows -) { - DBUG_ENTER("ha_spider::pre_direct_update_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows(ranges, - range_count, sorted, new_data, update_rows, found_rows)); -} -#else -int ha_spider::pre_direct_update_rows() -{ - uint update_rows; - uint found_rows; - DBUG_ENTER("ha_spider::pre_direct_update_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows( - &update_rows, &found_rows)); -} -#endif -#endif bool ha_spider::start_bulk_delete( ) { @@ -9830,19 +9139,6 @@ int ha_spider::delete_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - ulonglong option_backup = 0; - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_delete_row(buf); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_delete_count); #endif @@ -9887,25 +9183,6 @@ int ha_spider::direct_delete_rows_init( THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_delete_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init( - mode, ranges, range_count, sorted)); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9980,24 +9257,6 @@ int ha_spider::direct_delete_rows_init() THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_delete_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init()); - } -#endif if (!dml_inited) { if (unlikely(dml_init())) @@ -10048,63 +9307,6 @@ int ha_spider::direct_delete_rows_init() } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_delete_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted -) { - int error_num; - DBUG_ENTER("ha_spider::pre_direct_delete_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_delete_rows_init( - mode, ranges, range_count, sorted); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_delete_rows_init( - mode, ranges, range_count, sorted); - DBUG_RETURN(pre_direct_init_result); -} -#else -int ha_spider::pre_direct_delete_rows_init() -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_delete_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_delete_rows_init(); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_delete_rows_init(); - DBUG_RETURN(pre_direct_init_result); -} -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int ha_spider::direct_delete_rows( @@ -10124,26 +9326,6 @@ int ha_spider::direct_delete_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows( - ranges, range_count, sorted, delete_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -10152,13 +9334,6 @@ int ha_spider::direct_delete_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } -#endif DBUG_RETURN(0); } #else @@ -10176,26 +9351,6 @@ int ha_spider::direct_delete_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows( - delete_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -10203,41 +9358,10 @@ int ha_spider::direct_delete_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } -#endif DBUG_RETURN(0); } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_delete_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - ha_rows *delete_rows -) { - DBUG_ENTER("ha_spider::pre_direct_delete_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows( - ranges, range_count, sorted, delete_rows)); -} -#else -int ha_spider::pre_direct_delete_rows() -{ - uint delete_rows; - DBUG_ENTER("ha_spider::pre_direct_delete_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows( - &delete_rows)); -} -#endif -#endif int ha_spider::delete_all_rows() { @@ -10289,57 +9413,6 @@ int ha_spider::truncate() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -void ha_spider::bulk_req_exec() -{ - int need_mon; - SPIDER_CONN *conn = wide_handler->trx->bulk_access_conn_first; - DBUG_ENTER("ha_spider::bulk_req_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider trx=%p", wide_handler->trx)); - DBUG_PRINT("info",("spider first_conn=%p", conn)); - while (conn) - { - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - if (conn->bulk_access_requests) - { - spider_bg_conn_wait(conn); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - /* currently only used for HS */ - conn->bulk_access_error_num = 0; - if (spider_db_query( - conn, - NULL, - 0, - -1, - &need_mon) - ) { - conn->bulk_access_error_num = spider_db_errorno(conn); - } -/* - conn->bulk_access_sended += conn->bulk_access_requests; -*/ - conn->bulk_access_requests = 0; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - conn = conn->bulk_access_next; - } - wide_handler->trx->bulk_access_conn_first = NULL; - DBUG_VOID_RETURN; -} -#endif double ha_spider::scan_time() { @@ -11148,12 +10221,6 @@ Field *ha_spider::field_exchange( Field *field ) { DBUG_ENTER("ha_spider::field_exchange"); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - DBUG_RETURN(pt_clone_source_handler->field_exchange(field)); - } -#endif DBUG_PRINT("info",("spider in field=%p", field)); DBUG_PRINT("info",("spider in field->table=%p", field->table)); DBUG_PRINT("info",("spider table=%p", table)); @@ -11231,28 +10298,6 @@ int ha_spider::info_push( wide_handler->stage = SPD_HND_STAGE_INFO_PUSH; wide_handler->stage_executor = this; #endif -#ifdef HA_CAN_BULK_ACCESS - if ( - info_type != INFO_KIND_BULK_ACCESS_BEGIN && - info_type != INFO_KIND_BULK_ACCESS_CURRENT && - info_type != INFO_KIND_BULK_ACCESS_END - ) { - if (!is_bulk_access_clone) - { - if ( - bulk_access_executing && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->info_push(info_type, - info)); - } else if (bulk_access_started) - { - DBUG_RETURN(bulk_access_link_current->spider->info_push(info_type, - info)); - } - } - } -#endif switch (info_type) { @@ -11282,65 +10327,6 @@ int ha_spider::info_push( DBUG_PRINT("info",("spider INFO_KIND_FORCE_LIMIT_END")); wide_handler->info_limit = 9223372036854775807LL; break; -#endif -#ifdef HA_CAN_BULK_ACCESS - case INFO_KIND_BULK_ACCESS_BEGIN: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - if ((error_num = handlers[roop_count]->bulk_access_begin(info))) - { - DBUG_RETURN(error_num); - } - } - } else { - if ((error_num = bulk_access_begin(info))) - { - DBUG_RETURN(error_num); - } - } - break; - case INFO_KIND_BULK_ACCESS_CURRENT: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_CURRENT")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - if ((error_num = handlers[roop_count]->bulk_access_current(info))) - { - DBUG_RETURN(error_num); - } - } - } else { - if ((error_num = bulk_access_current(info))) - { - DBUG_RETURN(error_num); - } - } - break; - case INFO_KIND_BULK_ACCESS_END: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_END")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - handlers[roop_count]->bulk_access_end(); - } - } else { - bulk_access_end(); - } - break; #endif default: break; @@ -12475,145 +11461,6 @@ void ha_spider::check_insert_dup_update_pushdown() DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link() -{ - uchar *ref; - ha_spider *spider; - SPIDER_BULK_ACCESS_LINK *bulk_access_link; - DBUG_ENTER("ha_spider::create_bulk_access_link"); - DBUG_PRINT("info",("spider this=%p", this)); -/* - if (!init_ha_mem_root) - { - SPD_INIT_ALLOC_ROOT(&ha_mem_root, sizeof(ha_spider) * 16, - sizeof(ha_spider) * 16, MYF(MY_WME)); - init_ha_mem_root = TRUE; - } -*/ - if (!(bulk_access_link = (SPIDER_BULK_ACCESS_LINK *) - spider_bulk_malloc(spider_current_trx, SPD_MID_HA_SPIDER_CREATE_BULK_ACCESS_LINK_1, MYF(MY_WME), - &bulk_access_link, (uint) (sizeof(SPIDER_BULK_ACCESS_LINK)), - &ref, (uint) (ALIGN_SIZE(ref_length) * 2), - NullS)) - ) { - goto error_bulk_malloc; - } - SPD_INIT_ALLOC_ROOT(&bulk_access_link->mem_root, sizeof(ha_spider), 0, - MYF(MY_WME)); -/* - if (!(spider = new ha_spider(spider_hton_ptr, table_share))) - if (!(spider = (ha_spider *) spider_create_handler( - spider_hton_ptr, table_share, &ha_mem_root))) -*/ - if (!(spider = (ha_spider *) spider_create_handler( - spider_hton_ptr, table_share, &bulk_access_link->mem_root))) - { - goto error_new_spider; - } - DBUG_PRINT("info",("spider spider=%p", spider)); - bulk_access_link->spider = spider; - spider->ref = ref; - bulk_access_link->next = NULL; - spider->is_clone = TRUE; - spider->is_bulk_access_clone = TRUE; - spider->pt_clone_source_handler = this; - if (spider->ha_open(table, share->table_name, table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - { - goto error_ha_open; - } - DBUG_RETURN(bulk_access_link); - -error_ha_open: - delete spider; -error_new_spider: - free_root(&bulk_access_link->mem_root, MYF(0)); - spider_free(spider_current_trx, bulk_access_link, MYF(0)); -error_bulk_malloc: - DBUG_RETURN(NULL); -} - -void ha_spider::delete_bulk_access_link( - SPIDER_BULK_ACCESS_LINK *bulk_access_link -) { - ha_spider *spider = bulk_access_link->spider; - DBUG_ENTER("ha_spider::delete_bulk_access_link"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &spider->dbton_handler)); - spider->close(); - delete spider; - free_root(&bulk_access_link->mem_root, MYF(0)); - spider_free(spider_current_trx, bulk_access_link, MYF(0)); - DBUG_VOID_RETURN; -} - -int ha_spider::sync_from_clone_source( - ha_spider *spider -) { - int error_num; - DBUG_ENTER("ha_spider::sync_from_clone_source"); - sync_from_clone_source_base(spider); - if (!synced_from_clone_source) - { - DBUG_PRINT("info",("spider synced from clone source all")); - wide_handler->trx = spider->wide_handler->trx; - sql_command = spider->sql_command; - wide_handler->external_lock_type = - spider->wide_handler->external_lock_type; - selupd_lock_mode = spider->selupd_lock_mode; - update_request = spider->update_request; - lock_mode = spider->lock_mode; - high_priority = spider->high_priority; - low_priority = spider->low_priority; - memcpy(conns, spider->conns, - sizeof(SPIDER_CONN *) * share->link_count); - spider_thread_id = spider->spider_thread_id; - trx_conn_adjustment = spider->trx_conn_adjustment; - search_link_idx = spider->search_link_idx; - external_lock_cnt = spider->external_lock_cnt; - uint roop_count, dbton_id; - spider_db_handler *dbton_hdl, *dbton_hdl2; - for (roop_count = 0; roop_count < share->use_dbton_count; roop_count++) - { - dbton_id = share->use_dbton_ids[roop_count]; - dbton_hdl = dbton_handler[dbton_id]; - dbton_hdl2 = spider->dbton_handler[dbton_id]; - dbton_hdl->sync_from_clone_source(dbton_hdl2); - } - synced_from_clone_source = TRUE; - } else if (external_lock_cnt != spider->external_lock_cnt) - { - DBUG_PRINT("info",("spider synced from clone source")); - sql_command = spider->sql_command; - wide_handler->external_lock_type = - spider->wide_handler->external_lock_type; - selupd_lock_mode = spider->selupd_lock_mode; - update_request = spider->update_request; - lock_mode = spider->lock_mode; - high_priority = spider->high_priority; - low_priority = spider->low_priority; - - if ((error_num = spider_check_trx_and_get_conn( - spider->wide_handler->trx->thd, - this, TRUE))) - { - DBUG_RETURN(error_num); - } - external_lock_cnt = spider->external_lock_cnt; - } - - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &dbton_handler)); - DBUG_RETURN(0); -} -#endif void ha_spider::sync_from_clone_source_base( ha_spider *spider @@ -14783,92 +13630,3 @@ int ha_spider::dml_init() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::bulk_access_begin( - void *info -) { - DBUG_ENTER("ha_spider::bulk_access_begin"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - if (!bulk_access_link_current->next) - { - if (!(bulk_access_link_current->next = create_bulk_access_link())) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - bulk_access_link_current->next->sequence_num = - bulk_access_link_current->sequence_num + 1; - } - bulk_access_link_current = bulk_access_link_current->next; - } else { - if (!bulk_access_link_first) - { - if (!(bulk_access_link_first = create_bulk_access_link())) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - bulk_access_link_first->sequence_num = 0; - } - bulk_access_link_current = bulk_access_link_first; - bulk_access_started = TRUE; - bulk_access_executing = FALSE; - } - bulk_access_link_current->spider-> - check_access_kind(wide_handler->trx->thd); - if ( - (error_num = bulk_access_link_current->spider-> - sync_from_clone_source(this)) || - (error_num = bulk_access_link_current->spider-> - check_access_kind_for_connection(wide_handler->trx->thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))) - ) { - DBUG_RETURN(error_num); - } - bulk_access_link_current->spider->bulk_access_executing = FALSE; - bulk_access_link_current->spider->bulk_access_pre_called = FALSE; - bulk_access_link_current->used = TRUE; - bulk_access_link_current->called = FALSE; - *((void **) info) = bulk_access_link_current; - DBUG_RETURN(0); -} - -int ha_spider::bulk_access_current( - void *info -) { - DBUG_ENTER("ha_spider::bulk_access_current"); - DBUG_PRINT("info",("spider this=%p", this)); - bulk_access_executing = TRUE; - bulk_access_link_exec_tgt = (SPIDER_BULK_ACCESS_LINK *) info; - if (bulk_access_link_exec_tgt->spider->pt_clone_source_handler != this) - { - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider pt_clone_source_handler=%p", - bulk_access_link_exec_tgt->spider->pt_clone_source_handler)); - /* partitioned */ - uint sequence_num = bulk_access_link_exec_tgt->sequence_num; - for ( - bulk_access_link_exec_tgt = bulk_access_link_first; - bulk_access_link_exec_tgt; - bulk_access_link_exec_tgt = bulk_access_link_exec_tgt->next - ) { - if (bulk_access_link_exec_tgt->sequence_num >= sequence_num) - { - DBUG_ASSERT( - bulk_access_link_exec_tgt->sequence_num == sequence_num); - break; - } - } - } - bulk_access_link_exec_tgt->spider->bulk_access_executing = TRUE; - DBUG_RETURN(0); -} - -void ha_spider::bulk_access_end() -{ - DBUG_ENTER("ha_spider::bulk_access_end"); - DBUG_PRINT("info",("spider this=%p", this)); - bulk_access_started = FALSE; - DBUG_VOID_RETURN; -} -#endif diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index a57359ce025..446bbbc4d94 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -88,21 +88,6 @@ public: bool wide_handler_owner = FALSE; SPIDER_WIDE_HANDLER *wide_handler = NULL; -#ifdef HA_CAN_BULK_ACCESS - int pre_direct_init_result; - bool is_bulk_access_clone; - bool synced_from_clone_source; - bool bulk_access_started; - bool bulk_access_executing; - bool bulk_access_pre_called; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_first; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_current; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_exec_tgt; -/* - bool init_ha_mem_root; - MEM_ROOT ha_mem_root; -*/ -#endif bool is_clone; ha_spider *pt_clone_source_handler; ha_spider *pt_clone_last_searcher; @@ -221,12 +206,6 @@ public: void check_access_kind( THD *thd ); -#ifdef HA_CAN_BULK_ACCESS - int additional_lock( - THD *thd, - enum thr_lock_type lock_type - ); -#endif THR_LOCK_DATA **store_lock( THD *thd, THR_LOCK_DATA **to, @@ -248,16 +227,7 @@ public: uint idx, bool sorted ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_index_init( - uint idx, - bool sorted - ); -#endif int index_end() override; -#ifdef HA_CAN_BULK_ACCESS - int pre_index_end(); -#endif int index_read_map( uchar *buf, const uchar *key, @@ -345,15 +315,7 @@ public: int rnd_init( bool scan ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_rnd_init( - bool scan - ); -#endif int rnd_end() override; -#ifdef HA_CAN_BULK_ACCESS - int pre_rnd_end(); -#endif int rnd_next( uchar *buf ) override; @@ -467,11 +429,6 @@ public: int write_row( const uchar *buf ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_write_row( - uchar *buf - ); -#endif void direct_update_init( THD *thd, bool hs_request @@ -514,27 +471,6 @@ public: List *update_fields ) override; #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_update_rows_init( - List *update_fields - ) { - return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL); - } - int pre_direct_update_rows_init( - List *update_fields, - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data - ); -#else - int pre_direct_update_rows_init( - List *update_fields - ); -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS inline int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) { @@ -553,28 +489,6 @@ public: ha_rows *update_rows, ha_rows *found_row ) override; -#endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_update_rows() - { - ha_rows update_rows; - ha_rows found_rows; - - return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows, - &found_rows); - } - int pre_direct_update_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data, - ha_rows *update_rows, - ha_rows *found_row - ); -#else - int pre_direct_update_rows(); -#endif #endif bool start_bulk_delete() override; int end_bulk_delete() override; @@ -600,22 +514,6 @@ public: #else int direct_delete_rows_init() override; #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_delete_rows_init() - { - return pre_direct_delete_rows_init(2, NULL, 0, FALSE); - } - int pre_direct_delete_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted - ); -#else - int pre_direct_delete_rows_init(); -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS inline int direct_delete_rows(ha_rows *delete_rows) { @@ -631,24 +529,6 @@ public: int direct_delete_rows( ha_rows *delete_rows ) override; -#endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_delete_rows() - { - ha_rows delete_rows; - - return pre_direct_delete_rows(NULL, 0, FALSE, &delete_rows); - } - int pre_direct_delete_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - ha_rows *delete_rows - ); -#else - int pre_direct_delete_rows(); -#endif #endif int delete_all_rows() override; int truncate() override; @@ -658,9 +538,6 @@ public: uint ranges, ha_rows rows ) override; -#ifdef HA_CAN_BULK_ACCESS - void bulk_req_exec(); -#endif const key_map *keys_to_use_for_scanning() override; ha_rows estimate_rows_upper_bound() override; void print_error( @@ -818,15 +695,6 @@ public: bool use_parallel ); void check_insert_dup_update_pushdown(); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_BULK_ACCESS_LINK *create_bulk_access_link(); - void delete_bulk_access_link( - SPIDER_BULK_ACCESS_LINK *bulk_access_link - ); - int sync_from_clone_source( - ha_spider *spider - ); -#endif void sync_from_clone_source_base( ha_spider *spider ); @@ -1044,15 +912,6 @@ public: int append_lock_tables_list(); int lock_tables(); int dml_init(); -#ifdef HA_CAN_BULK_ACCESS - int bulk_access_begin( - void *info - ); - int bulk_access_current( - void *info - ); - void bulk_access_end(); -#endif }; diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 434a20e9e3e..cc3a6b52719 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2590,13 +2590,6 @@ void *spider_bg_conn_action( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[conn->link_idx] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->trx, conn); - } -#endif if (!result_list->bgs_error) { conn->need_mon = &spider->need_mons[conn->link_idx]; @@ -2604,10 +2597,6 @@ void *spider_bg_conn_action( DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; conn->mta_conn_mutex_unlock_later = TRUE; -#ifdef HA_CAN_BULK_ACCESS - if (!spider->is_bulk_access_clone) - { -#endif if (!(result_list->bgs_error = spider_db_set_names(spider, conn, conn->link_idx))) { @@ -2676,9 +2665,6 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif DBUG_ASSERT(conn->mta_conn_mutex_lock_already); DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 7d786492bfe..4319616961b 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -4476,42 +4476,6 @@ void spider_db_discard_multiple_result( DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_store_result( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx, - bool discard_result -) { - int error_num, tmp_error_num; - DBUG_ENTER("spider_db_bulk_store_result"); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL) - { - /* already stored */ - DBUG_RETURN(0); - } - error_num = spider_db_bulk_open_handler(spider, conn, link_idx); - if (!discard_result) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_store_result(spider, link_idx, - spider->get_table()))) - { - error_num = tmp_error_num; - } - conn->mta_conn_mutex_unlock_later = FALSE; - } else { - if (spider->connection_ids[link_idx] == conn->connection_id) - spider_db_discard_result(spider, link_idx, conn); - } - DBUG_RETURN(error_num); -} -#endif int spider_db_fetch( uchar *buf, @@ -6070,10 +6034,6 @@ int spider_db_bulk_insert( spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); DBUG_RETURN(error_num); } -#ifdef HA_CAN_BULK_ACCESS - if (!spider->is_bulk_access_clone) - { -#endif bool insert_info = FALSE; for ( roop_count2 = spider_conn_link_idx_next(share->link_statuses, @@ -6254,9 +6214,6 @@ int spider_db_bulk_insert( conn->mta_conn_mutex_unlock_later = FALSE; pthread_mutex_unlock(&conn->mta_conn_mutex); spider->store_last_insert_id = 0; -#ifdef HA_CAN_BULK_ACCESS - } -#endif } if ( (bulk_end || !spider->bulk_insert) && @@ -6266,91 +6223,6 @@ int spider_db_bulk_insert( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_bulk_insert( - ha_spider *spider -) { - int error_num = 0, first_insert_link_idx = -1, tmp_error_num; - int roop_count2; - SPIDER_SHARE *share = spider->share; - SPIDER_CONN *conn, *first_insert_conn = NULL; - TABLE *table = spider->get_table(); - THD *thd = spider->wide_handler->trx->thd; - DBUG_ENTER("spider_db_bulk_bulk_insert"); - for ( - roop_count2 = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_count2 < (int) share->link_count; - roop_count2 = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, roop_count2, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - conn = spider->conns[roop_count2]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn, - roop_count2))) - { - error_num = tmp_error_num; - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - if (first_insert_link_idx == -1) - { - first_insert_link_idx = roop_count2; - first_insert_conn = conn; - } - } - - conn = first_insert_conn; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[first_insert_link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (table->next_number_field && - ( - !table->auto_increment_field_not_null || - ( - !table->next_number_field->val_int() && - !(thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) - ) - ) - ) { - ulonglong last_insert_id; - if (spider->store_last_insert_id) - last_insert_id = spider->store_last_insert_id; - else - last_insert_id = conn->db_conn->last_insert_id(); - table->next_number_field->set_notnull(); - if ( - (tmp_error_num = spider_db_update_auto_increment(spider, - first_insert_link_idx)) || - (tmp_error_num = table->next_number_field->store( - last_insert_id, TRUE)) - ) { - error_num = tmp_error_num; - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - spider->store_last_insert_id = 0; - DBUG_RETURN(error_num); -} -#endif int spider_db_update_auto_increment( ha_spider *spider, @@ -6917,13 +6789,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7014,9 +6879,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7125,13 +6987,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7223,9 +7078,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7233,56 +7085,6 @@ int spider_db_direct_update( } #endif -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_direct_update( - ha_spider *spider, - ha_rows *update_rows, - ha_rows *found_rows -) { - int error_num = 0, roop_count, tmp_error_num; - SPIDER_SHARE *share = spider->share; - SPIDER_CONN *conn; - bool counted = FALSE; - DBUG_ENTER("spider_db_bulk_direct_update"); - for ( - roop_count = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_count < (int) share->link_count; - roop_count = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, roop_count, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - DBUG_PRINT("info", ("spider exec sql")); - conn = spider->conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn, - roop_count))) - { - error_num = tmp_error_num; - } - if (!counted) - { - *update_rows = spider->conns[roop_count]->db_conn->affected_rows(); - DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); - *found_rows = spider->conns[roop_count]->db_conn->matched_rows(); - DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); - counted = TRUE; - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(error_num); -} -#endif int spider_db_bulk_delete( ha_spider *spider, @@ -7447,13 +7249,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7536,9 +7331,6 @@ int spider_db_direct_delete( DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -7623,13 +7415,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7712,9 +7497,6 @@ int spider_db_direct_delete( DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -11146,20 +10928,6 @@ error: DBUG_RETURN(error_num); } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_open_handler( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx -) { - int error_num = 0; - DBUG_ENTER("spider_db_bulk_open_handler"); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - DBUG_RETURN(error_num); -} -#endif int spider_db_close_handler( ha_spider *spider, diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index aa451b861d2..6e94e2d1517 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -634,14 +634,6 @@ void spider_db_discard_multiple_result( SPIDER_CONN *conn ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_store_result( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx, - bool discard_result -); -#endif int spider_db_fetch( uchar *buf, @@ -764,11 +756,6 @@ int spider_db_bulk_insert( bool bulk_end ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_bulk_insert( - ha_spider *spider -); -#endif int spider_db_update_auto_increment( ha_spider *spider, @@ -815,12 +802,6 @@ int spider_db_direct_update( ); #endif -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_direct_update( - ha_spider *spider, - ha_rows *update_rows -); -#endif int spider_db_bulk_delete( ha_spider *spider, @@ -1190,13 +1171,6 @@ int spider_db_open_handler( int link_idx ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_open_handler( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx -); -#endif int spider_db_close_handler( ha_spider *spider, diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 50974269e0c..ac031dfe64d 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1766,8 +1766,6 @@ typedef struct st_spider_result_list SPIDER_RESULT *current; KEY *key_info; int key_order; -#ifdef HA_CAN_BULK_ACCESS -#endif spider_string *sqls; int ha_read_kind; bool have_sql_kind_backup; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 62fb57c8724..8c8ed349d32 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -15005,11 +15005,7 @@ void spider_mbase_handler::minimum_select_bitmap_create() memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); if ( spider->use_index_merge || -#ifdef HA_CAN_BULK_ACCESS - (spider->is_clone && !spider->is_bulk_access_clone) -#else spider->is_clone -#endif ) { /* need preparing for cmp_ref */ TABLE_SHARE *table_share = table->s; diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 9ed1aa32a96..c5bf59b8df8 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -12167,11 +12167,7 @@ void spider_oracle_handler::minimum_select_bitmap_create() memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); if ( spider->use_index_merge || -#ifdef HA_CAN_BULK_ACCESS - (spider->is_clone && !spider->is_bulk_access_clone) -#else spider->is_clone -#endif ) { /* need preparing for cmp_ref */ TABLE_SHARE *table_share = table->s; diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 5627f15bd4f..d06d0d7be8b 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -745,12 +745,6 @@ typedef struct st_spider_conn Time_zone *queued_time_zone_val; XID *queued_xa_start_xid; -#ifdef HA_CAN_BULK_ACCESS - uint bulk_access_requests; - uint bulk_access_sended; - int bulk_access_error_num; - st_spider_conn *bulk_access_next; -#endif bool disable_connect_retry; /* TRUE if it is unnecessary to retry to connect after a @@ -878,9 +872,6 @@ typedef struct st_spider_wide_handler uint top_table_fields; #ifdef INFO_KIND_FORCE_LIMIT_BEGIN longlong info_limit; -#endif -#ifdef HA_CAN_BULK_ACCESS - ulonglong external_lock_cnt; #endif bool between_flg; bool idx_bitmap_is_set; @@ -954,10 +945,6 @@ typedef struct st_spider_transaction ulonglong direct_aggregate_count; ulonglong parallel_search_count; -#ifdef HA_CAN_BULK_ACCESS - SPIDER_CONN *bulk_access_conn_first; - SPIDER_CONN *bulk_access_conn_last; -#endif pthread_mutex_t *udf_table_mutexes; CHARSET_INFO *udf_access_charset; @@ -1175,9 +1162,6 @@ typedef struct st_spider_share int error_read_mode; int error_write_mode; int active_link_count; -#ifdef HA_CAN_BULK_ACCESS - int bulk_access_free; -#endif #ifdef HA_CAN_FORCE_BULK_UPDATE int force_bulk_update; #endif @@ -1583,17 +1567,6 @@ typedef struct st_spider_trx_ha bool wait_for_reusing; } SPIDER_TRX_HA; -#ifdef HA_CAN_BULK_ACCESS -typedef struct st_spider_bulk_access_link -{ - ha_spider *spider; - uint sequence_num; - bool used; - bool called; - MEM_ROOT mem_root; - st_spider_bulk_access_link *next; -} SPIDER_BULK_ACCESS_LINK; -#endif #define SPIDER_INT_HLD_TGT_SIZE 100 typedef struct st_spider_int_hld diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 41a065bfd29..55842682782 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2033,28 +2033,6 @@ static MYSQL_THDVAR_INT( SPIDER_THDVAR_OVERRIDE_VALUE_FUNC(int, read_only_mode) -#ifdef HA_CAN_BULK_ACCESS -static int spider_bulk_access_free; -/* - -1 :fallback to default - 0 :in reset - 1 :in close - */ -static MYSQL_SYSVAR_INT( - bulk_access_free, - spider_bulk_access_free, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, - "Free mode of bulk access resources", - NULL, - NULL, - 0, - -1, - 1, - 0 -); - -SPIDER_SYSVAR_OVERRIDE_VALUE_FUN(int, bulk_access_free) -#endif /* -1 :fallback to default @@ -2657,9 +2635,6 @@ static struct st_mysql_sys_var* spider_system_variables[] = { MYSQL_SYSVAR(skip_parallel_search), MYSQL_SYSVAR(direct_order_limit), MYSQL_SYSVAR(read_only_mode), -#ifdef HA_CAN_BULK_ACCESS - MYSQL_SYSVAR(bulk_access_free), -#endif MYSQL_SYSVAR(udf_ds_use_real_table), MYSQL_SYSVAR(general_log), MYSQL_SYSVAR(index_hint_pushdown), diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h index d7d35b17df5..c93d41022d5 100644 --- a/storage/spider/spd_param.h +++ b/storage/spider/spd_param.h @@ -337,11 +337,6 @@ int spider_param_read_only_mode( THD *thd, int read_only_mode ); -#ifdef HA_CAN_BULK_ACCESS -int spider_param_bulk_access_free( - int bulk_access_free -); -#endif int spider_param_udf_ds_use_real_table( THD *thd, int udf_ds_use_real_table diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 1503c61b1bb..dc30278e66c 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1834,9 +1834,6 @@ static void spider_minus_1(SPIDER_SHARE *share, TABLE_SHARE *table_share) share->error_read_mode = -1; share->error_write_mode = -1; share->active_link_count = -1; -#ifdef HA_CAN_BULK_ACCESS - share->bulk_access_free = -1; -#endif #ifdef HA_CAN_FORCE_BULK_UPDATE share->force_bulk_update = -1; #endif @@ -2160,9 +2157,6 @@ int spider_parse_connect_info( 2147483647); SPIDER_PARAM_INT_WITH_MAX("aim", auto_increment_mode, 0, 3); SPIDER_PARAM_INT("alc", active_link_count, 1); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_PARAM_INT_WITH_MAX("baf", bulk_access_free, 0, 1); -#endif SPIDER_PARAM_INT("bfz", buffer_size, 0); #ifndef WITHOUT_SPIDER_BG_SEARCH SPIDER_PARAM_LONGLONG("bfr", bgs_first_read, 0); @@ -2419,10 +2413,6 @@ int spider_parse_connect_info( net_read_timeouts, 0, 2147483647); SPIDER_PARAM_INT_WITH_MAX( "error_write_mode", error_write_mode, 0, 1); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_PARAM_INT_WITH_MAX( - "bulk_access_free", bulk_access_free, 0, 1); -#endif SPIDER_PARAM_INT_WITH_MAX( "query_cache_sync", query_cache_sync, 0, 3); error_num = parse.fail(true); @@ -4549,8 +4539,6 @@ SPIDER_SHARE *spider_get_share( sizeof(uchar) * share->link_bitmap_size, &result_list->tmp_table_created, sizeof(uchar) * share->link_bitmap_size, -#ifdef HA_CAN_BULK_ACCESS -#endif &result_list->sql_kind_backup, sizeof(uint) * share->link_count, &result_list->casual_read, sizeof(int) * share->link_count, &spider->dbton_handler, @@ -5027,8 +5015,6 @@ SPIDER_SHARE *spider_get_share( sizeof(uchar) * share->link_bitmap_size, &result_list->tmp_table_created, sizeof(uchar) * share->link_bitmap_size, -#ifdef HA_CAN_BULK_ACCESS -#endif &result_list->sql_kind_backup, sizeof(uint) * share->link_count, &result_list->casual_read, sizeof(int) * share->link_count, &spider->dbton_handler, @@ -7733,18 +7719,10 @@ bool spider_check_direct_order_limit( spider->use_index_merge ? "TRUE" : "FALSE")); DBUG_PRINT("info",("spider is_clone=%s", spider->is_clone ? "TRUE" : "FALSE")); -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider is_bulk_access_clone=%s", - spider->is_bulk_access_clone ? "TRUE" : "FALSE")); -#endif if ( spider->wide_handler->sql_command != SQLCOM_HA_READ && !spider->use_index_merge && -#ifdef HA_CAN_BULK_ACCESS - (!spider->is_clone || spider->is_bulk_access_clone) -#else !spider->is_clone -#endif ) { spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); bool first_check = TRUE; @@ -7946,12 +7924,6 @@ Field *spider_field_exchange( Field *field ) { DBUG_ENTER("spider_field_exchange"); -#ifdef HA_CAN_BULK_ACCESS - if (handler->is_bulk_access_clone) - { - handler = handler->pt_clone_source_handler; - } -#endif DBUG_PRINT("info",("spider in field=%p", field)); DBUG_PRINT("info",("spider in field->table=%p", field->table)); DBUG_PRINT("info",("spider table=%p", handler->get_table())); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 11dc7a81ad8..305d8fc7327 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -3097,11 +3097,6 @@ int spider_commit( if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr))) DBUG_RETURN(0); /* transaction is not started */ -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - trx->bulk_access_conn_first = NULL; -#endif /* We do (almost) nothing if the following two conditions are both met: @@ -3195,11 +3190,6 @@ int spider_rollback( if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr))) DBUG_RETURN(0); /* transaction is not started */ -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - trx->bulk_access_conn_first = NULL; -#endif /* In case the rollback happens due to failure of LOCK TABLE, we need to clear the list of tables to lock. */ @@ -3936,34 +3926,3 @@ int spider_trx_check_link_idx_failed( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -void spider_trx_add_bulk_access_conn( - SPIDER_TRX *trx, - SPIDER_CONN *conn -) { - DBUG_ENTER("spider_trx_add_bulk_access_conn"); - DBUG_PRINT("info",("spider trx=%p", trx)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - DBUG_PRINT("info",("spider conn->bulk_access_sended=%u", - conn->bulk_access_sended)); - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - if (!conn->bulk_access_requests && !conn->bulk_access_sended) - { - if (!trx->bulk_access_conn_first) - { - trx->bulk_access_conn_first = conn; - } else { - trx->bulk_access_conn_last->bulk_access_next = conn; - } - trx->bulk_access_conn_last = conn; - conn->bulk_access_next = NULL; - } - conn->bulk_access_requests++; - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - DBUG_VOID_RETURN; -} -#endif diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index 3bf93aada1a..2055a49717e 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -266,9 +266,3 @@ int spider_trx_check_link_idx_failed( ha_spider *spider ); -#ifdef HA_CAN_BULK_ACCESS -void spider_trx_add_bulk_access_conn( - SPIDER_TRX *trx, - SPIDER_CONN *conn -); -#endif From 84067291b4fe177a40754418a315ede7bf9536e8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 18 Jun 2024 19:14:42 +0800 Subject: [PATCH 076/185] MDEV-28360 Spider: remove #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name --- storage/spider/spd_db_conn.cc | 45 --------------------------------- storage/spider/spd_db_mysql.cc | 5 ---- storage/spider/spd_db_oracle.cc | 5 ---- storage/spider/spd_include.h | 1 - 4 files changed, 56 deletions(-) diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 4319616961b..a3113059143 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -1614,13 +1614,8 @@ int spider_db_append_key_where_internal( if (sql_kind == SPIDER_SQL_KIND_HANDLER) { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name const char *key_name = key_info->name.str; key_name_length = key_info->name.length; -#else - const char *key_name = key_info->name; - key_name_length = strlen(key_name); -#endif if (str->reserve(SPIDER_SQL_READ_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + key_name_length)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -8480,13 +8475,8 @@ int spider_db_open_item_ident( } if (str) { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if (item_ident->field_name.str) field_name_length = item_ident->field_name.length; -#else - if (item_ident->field_name) - field_name_length = strlen(item_ident->field_name); -#endif else field_name_length = 0; if (share->access_charset->cset == system_charset_info->cset) @@ -8497,14 +8487,9 @@ int spider_db_open_item_ident( DBUG_RETURN(HA_ERR_OUT_OF_MEM); } str->q_append(alias, alias_length); -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_dbton[dbton_id].db_util-> append_escaped_name(str, item_ident->field_name.str, field_name_length))) -#else - if ((error_num = spider_dbton[dbton_id].db_util-> - append_escaped_name(str, item_ident->field_name, field_name_length))) -#endif { DBUG_RETURN(error_num); } @@ -8512,15 +8497,9 @@ int spider_db_open_item_ident( if (str->reserve(alias_length)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(alias, alias_length); -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_dbton[dbton_id].db_util-> append_escaped_name_with_charset(str, item_ident->field_name.str, field_name_length, system_charset_info))) -#else - if ((error_num = spider_dbton[dbton_id].db_util-> - append_escaped_name_with_charset(str, item_ident->field_name, - field_name_length, system_charset_info))) -#endif { DBUG_RETURN(error_num); } @@ -8630,7 +8609,6 @@ int spider_db_open_item_ref( DBUG_ENTER("spider_db_open_item_ref"); if (item_ref->ref) { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ( (*(item_ref->ref))->type() != Item::CACHE_ITEM && item_ref->ref_type() != Item_ref::VIEW_REF && @@ -8638,34 +8616,16 @@ int spider_db_open_item_ref( item_ref->name.str && item_ref->alias_name_used ) -#else - if ( - (*(item_ref->ref))->type() != Item::CACHE_ITEM && - item_ref->ref_type() != Item_ref::VIEW_REF && - !item_ref->table_name && - item_ref->name && - item_ref->alias_name_used - ) -#endif { if (str) { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name uint length = item_ref->name.length; -#else - uint length = strlen(item_ref->name); -#endif if (str->reserve(length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_dbton[dbton_id].db_util-> append_name(str, item_ref->name.str, length))) -#else - if ((error_num = spider_dbton[dbton_id].db_util-> - append_name(str, item_ref->name, length))) -#endif { DBUG_RETURN(error_num); } @@ -10320,13 +10280,8 @@ int spider_db_udf_copy_key_row( ) { int error_num; DBUG_ENTER("spider_db_udf_copy_key_row"); -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_db_append_name_with_quote_str(str, (char *) field->field_name.str, dbton_id))) -#else - if ((error_num = spider_db_append_name_with_quote_str(str, - (char *) field->field_name, dbton_id))) -#endif DBUG_RETURN(error_num); if (str->reserve(joint_length + *length + SPIDER_SQL_AND_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 8c8ed349d32..f0d0a166ed3 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -3669,13 +3669,8 @@ void spider_db_mbase::set_dup_key_idx( key_name = spider->share->tgt_pk_names[all_link_idx]; key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx]; } else { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name key_name = table->key_info[roop_count].name.str; key_name_length = table->key_info[roop_count].name.length; -#else - key_name = table->key_info[roop_count].name; - key_name_length = strlen(key_name); -#endif } DBUG_PRINT("info",("spider key_name=%s", key_name)); if ( diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index c5bf59b8df8..455b52177dd 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -2431,13 +2431,8 @@ void spider_db_oracle::set_dup_key_idx( key_name = spider->share->tgt_pk_names[all_link_idx]; key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx]; } else { -#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name key_name = (char *) table->s->key_info[roop_count].name.str; key_name_length = table->s->key_info[roop_count].name.length; -#else - key_name = table->s->key_info[roop_count].name; - key_name_length = strlen(key_name); -#endif } memcpy(tmp_pos, key_name, key_name_length + 1); DBUG_PRINT("info",("spider key_name=%s", key_name)); diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index d06d0d7be8b..473bdc2c416 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -109,7 +109,6 @@ #define SPIDER_read_record_read_record(A) read_record() #define SPIDER_has_Item_with_subquery -#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name #define SPIDER_use_LEX_CSTRING_for_Field_blob_constructor #define SPIDER_use_LEX_CSTRING_for_database_tablename_alias #define SPIDER_THD_db_str(A) (A)->db.str From 9e1579788fcd7de5f79a7018869ba82977b2fe81 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 10 Sep 2024 11:52:22 +1000 Subject: [PATCH 077/185] MDEV-31788 Factor spider locking and unlocking code around sending queries --- storage/spider/ha_spider.cc | 360 +---- storage/spider/spd_conn.cc | 70 +- storage/spider/spd_conn.h | 10 + storage/spider/spd_db_conn.cc | 729 ++------- storage/spider/spd_db_mysql.cc | 1895 ++++-------------------- storage/spider/spd_group_by_handler.cc | 28 +- storage/spider/spd_table.cc | 20 +- 7 files changed, 528 insertions(+), 2584 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index e910ffcff56..2a49af4ee3b 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1381,18 +1381,6 @@ int ha_spider::index_end() DBUG_ENTER("ha_spider::index_end"); DBUG_PRINT("info",("spider this=%p", this)); active_index = MAX_KEY; -/* -#ifdef INFO_KIND_FORCE_LIMIT_BEGIN - info_limit = 9223372036854775807LL; -#endif - if ( - (error_num = drop_tmp_tables()) || - (error_num = check_and_end_bulk_update( - SPD_BU_START_BY_INDEX_OR_RND_INIT)) || - (error_num = spider_trx_check_link_idx_failed(this)) - ) - DBUG_RETURN(check_error_mode(error_num)); -*/ if ((error_num = drop_tmp_tables())) DBUG_RETURN(check_error_mode(error_num)); result_list.use_union = FALSE; @@ -1438,6 +1426,7 @@ int ha_spider::index_read_map_internal( start_key.key = key; start_key.keypart_map = keypart_map; start_key.flag = find_flag; + /* Query construction */ if ((error_num = reset_sql_sql( SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER))) DBUG_RETURN(error_num); @@ -1529,6 +1518,7 @@ int ha_spider::index_read_map_internal( } } + /* Query execution */ int roop_start, roop_end, lock_mode, link_ok; lock_mode = spider_conn_lock_mode(this); if (lock_mode) @@ -1596,26 +1586,16 @@ int ha_spider::index_read_map_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -1647,11 +1627,7 @@ int ha_spider::index_read_map_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -1676,13 +1652,9 @@ int ha_spider::index_read_map_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -1711,7 +1683,7 @@ int ha_spider::index_read_map_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -1956,26 +1928,16 @@ int ha_spider::index_read_last_map_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2007,11 +1969,7 @@ int ha_spider::index_read_last_map_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2036,13 +1994,9 @@ int ha_spider::index_read_last_map_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -2071,7 +2025,7 @@ int ha_spider::index_read_last_map_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -2365,27 +2319,17 @@ int ha_spider::index_first_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2417,11 +2361,7 @@ int ha_spider::index_first_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2446,13 +2386,9 @@ int ha_spider::index_first_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -2481,7 +2417,7 @@ int ha_spider::index_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -2722,27 +2658,17 @@ int ha_spider::index_last_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2774,11 +2700,7 @@ int ha_spider::index_last_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -2803,13 +2725,9 @@ int ha_spider::index_last_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -2838,7 +2756,7 @@ int ha_spider::index_last_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -3122,26 +3040,16 @@ int ha_spider::read_range_first_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -3173,11 +3081,7 @@ int ha_spider::read_range_first_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -3202,13 +3106,9 @@ int ha_spider::read_range_first_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -3237,7 +3137,7 @@ int ha_spider::read_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -3719,27 +3619,17 @@ int ha_spider::read_multi_range_first_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -3772,11 +3662,7 @@ int ha_spider::read_multi_range_first_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -3803,13 +3689,9 @@ int ha_spider::read_multi_range_first_internal( if (!error_num) { connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - error_num = spider_db_store_result(this, roop_count, table); + error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && error_num != HA_ERR_END_OF_FILE && @@ -3836,7 +3718,7 @@ int ha_spider::read_multi_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -4474,28 +4356,18 @@ int ha_spider::read_multi_range_first_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -4534,11 +4406,7 @@ int ha_spider::read_multi_range_first_internal( -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -4572,11 +4440,7 @@ int ha_spider::read_multi_range_first_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -4601,13 +4465,9 @@ int ha_spider::read_multi_range_first_internal( break; } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4636,7 +4496,7 @@ int ha_spider::read_multi_range_first_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -5088,27 +4948,17 @@ int ha_spider::read_multi_range_next( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -5141,11 +4991,7 @@ int ha_spider::read_multi_range_next( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -5172,13 +5018,9 @@ int ha_spider::read_multi_range_next( if (!error_num) { connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - error_num = spider_db_store_result(this, roop_count, table); + error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && error_num != HA_ERR_END_OF_FILE && @@ -5205,7 +5047,7 @@ int ha_spider::read_multi_range_next( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -5842,28 +5684,18 @@ int ha_spider::read_multi_range_next( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -5902,11 +5734,7 @@ int ha_spider::read_multi_range_next( -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -5940,11 +5768,7 @@ int ha_spider::read_multi_range_next( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -5969,13 +5793,9 @@ int ha_spider::read_multi_range_next( break; } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -6004,7 +5824,7 @@ int ha_spider::read_multi_range_next( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -6461,27 +6281,17 @@ int ha_spider::rnd_next_internal( sql_type = SPIDER_SQL_TYPE_HANDLER; } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -6513,11 +6323,7 @@ int ha_spider::rnd_next_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -6542,13 +6348,9 @@ int ha_spider::rnd_next_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -6577,7 +6379,7 @@ int ha_spider::rnd_next_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -7076,25 +6878,15 @@ int ha_spider::ft_read_internal( uint dbton_id = share->sql_dbton_ids[roop_count]; spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; SPIDER_CONN *conn = conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_SELECT_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -7126,11 +6918,7 @@ int ha_spider::ft_read_internal( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -7155,13 +6943,9 @@ int ha_spider::ft_read_internal( DBUG_RETURN(check_error_mode_eof(error_num)); } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -7190,7 +6974,7 @@ int ha_spider::ft_read_internal( result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } @@ -10933,25 +10717,15 @@ int ha_spider::drop_tmp_tables() uint dbton_id = share->sql_dbton_ids[roop_count]; spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; SPIDER_CONN *conn = conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_TMP_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((tmp_error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -10985,11 +10759,7 @@ int ha_spider::drop_tmp_tables() -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - tmp_error_num = spider_db_errorno(conn); + tmp_error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && need_mons[roop_count] @@ -11013,11 +10783,7 @@ int ha_spider::drop_tmp_tables() } error_num = tmp_error_num; } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } spider_clear_bit(result_list.tmp_table_created, roop_count); diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index cc3a6b52719..8cb55e8415f 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2568,7 +2568,6 @@ void *spider_bg_conn_action( } else { sql_type = SPIDER_SQL_TYPE_HANDLER; } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if (spider->use_fields) { if ((error_num = dbton_handler->set_sql_for_exec(sql_type, @@ -2587,16 +2586,12 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } } - pthread_mutex_lock(&conn->mta_conn_mutex); + /* todo: is it ok if the following statement is not locked? */ sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); if (!result_list->bgs_error) { - conn->need_mon = &spider->need_mons[conn->link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); if (!(result_list->bgs_error = spider_db_set_names(spider, conn, conn->link_idx))) { @@ -2665,13 +2660,7 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } else { spider->connection_ids[conn->link_idx] = conn->connection_id; @@ -2746,24 +2735,14 @@ void *spider_bg_conn_action( { DBUG_PRINT("info",("spider bg exec sql start")); spider = (ha_spider*) conn->bg_target; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[conn->link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); *conn->bg_error_num = spider_db_query_with_set_names( conn->bg_sql_type, spider, conn, conn->link_idx ); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); conn->bg_exec_sql = FALSE; continue; } @@ -4134,3 +4113,42 @@ void spider_free_ipport_conn(void *info) } DBUG_VOID_RETURN; } + +void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon) +{ + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); + conn->need_mon = need_mon; + DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = TRUE; + conn->mta_conn_mutex_unlock_later = TRUE; +} + +int spider_unlock_after_query(SPIDER_CONN *conn, int ret) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + pthread_mutex_unlock(&conn->mta_conn_mutex); + return ret; +} + +int spider_unlock_after_query_1(SPIDER_CONN *conn) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + return spider_db_errorno(conn); +} + +int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + return spider_db_store_result(spider, link_idx, table); +} diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index 405832a1e7b..59802b00712 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -24,6 +24,8 @@ #define SPIDER_SIMPLE_RECORDS 3 #define SPIDER_SIMPLE_CHECKSUM_TABLE 4 +struct TABLE; + /* The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to check for self-reference. @@ -454,3 +456,11 @@ SPIDER_CONN* spider_get_conn_from_idle_connection int *error_num ); void spider_free_ipport_conn(void *info); + +void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon); + +int spider_unlock_after_query(SPIDER_CONN *conn, int ret); + +int spider_unlock_after_query_1(SPIDER_CONN *conn); + +int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index a3113059143..8750e87237e 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -100,8 +100,6 @@ int spider_db_connect( } } - if (thd) - { conn->connect_timeout = spider_param_connect_timeout(thd, share->connect_timeouts[link_idx]); conn->net_read_timeout = spider_param_net_read_timeout(thd, @@ -113,16 +111,6 @@ int spider_db_connect( connect_retry_count = 0; else connect_retry_count = spider_param_connect_retry_count(thd); - } else { - conn->connect_timeout = spider_param_connect_timeout(NULL, - share->connect_timeouts[link_idx]); - conn->net_read_timeout = spider_param_net_read_timeout(NULL, - share->net_read_timeouts[link_idx]); - conn->net_write_timeout = spider_param_net_write_timeout(NULL, - share->net_write_timeouts[link_idx]); - connect_retry_interval = spider_param_connect_retry_interval(NULL); - connect_retry_count = spider_param_connect_retry_count(NULL); - } DBUG_PRINT("info",("spider connect_timeout=%u", conn->connect_timeout)); DBUG_PRINT("info",("spider net_read_timeout=%u", conn->net_read_timeout)); DBUG_PRINT("info",("spider net_write_timeout=%u", conn->net_write_timeout)); @@ -923,19 +911,10 @@ int spider_db_query_for_bulk_update( SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_db_query_for_bulk_update"); - pthread_mutex_assert_owner(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[link_idx] && spider->need_mons[link_idx] @@ -969,11 +948,7 @@ int spider_db_query_for_bulk_update( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -1018,11 +993,7 @@ int spider_db_query_for_bulk_update( } if (error_num > 0 && !conn->db_conn->is_dup_entry_error(error_num)) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[link_idx] && spider->need_mons[link_idx] @@ -1046,12 +1017,7 @@ int spider_db_query_for_bulk_update( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_unlock_after_query(conn, 0)); } size_t spider_db_real_escape_string( @@ -4689,16 +4655,16 @@ int spider_db_seek_next( link_idx = link_idx_holder->link_idx; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, link_idx))) { DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (fields->is_first_link_ok_chain(link_idx_chain)) { @@ -4711,18 +4677,10 @@ int spider_db_seek_next( } pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( spider->need_mons[link_idx] ) { @@ -4739,11 +4697,7 @@ int spider_db_seek_next( result_list->quick_mode, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( spider->need_mons[link_idx] ) { @@ -4753,14 +4707,9 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } spider->connection_ids[link_idx] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (fields->is_first_link_ok_chain(link_idx_chain)) { - if ((error_num = spider_db_store_result(spider, link_idx, - table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4775,7 +4724,7 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, link_idx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -4796,16 +4745,16 @@ int spider_db_seek_next( } spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (roop_count == link_ok) { @@ -4818,18 +4767,10 @@ int spider_db_seek_next( } pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4862,11 +4803,7 @@ int spider_db_seek_next( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4892,14 +4829,9 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, - table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4929,7 +4861,7 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -5066,15 +4998,15 @@ int spider_db_seek_last( } conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (roop_count == link_ok) { @@ -5087,18 +5019,10 @@ int spider_db_seek_last( } pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -5131,11 +5055,7 @@ int spider_db_seek_last( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -5160,13 +5080,9 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -5195,7 +5111,7 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -5283,25 +5199,15 @@ int spider_db_seek_last( } conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -5334,11 +5240,7 @@ int spider_db_seek_last( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -5363,13 +5265,9 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -5398,7 +5296,7 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } DBUG_RETURN(spider_db_fetch(buf, spider, table)); @@ -6044,7 +5942,6 @@ int spider_db_bulk_insert( sql_type = SPIDER_SQL_TYPE_INSERT_SQL; conn = spider->conns[roop_count2]; dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count2))) { @@ -6052,21 +5949,12 @@ int spider_db_bulk_insert( spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count2]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count2]); if ((error_num = spider_db_set_names(spider, conn, roop_count2))) { if (spider->sql_kinds & SPIDER_SQL_KIND_SQL) spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count2] && spider->need_mons[roop_count2] @@ -6106,11 +5994,7 @@ int spider_db_bulk_insert( { conn->db_conn->set_dup_key_idx(spider, roop_count2); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6137,16 +6021,12 @@ int spider_db_bulk_insert( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (!insert_info && copy_info) { insert_info = conn->db_conn->inserted_info(dbton_handler, copy_info); } - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (first_insert_link_idx == -1) { first_insert_link_idx = roop_count2; @@ -6155,13 +6035,7 @@ int spider_db_bulk_insert( } conn = first_insert_conn; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[first_insert_link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[first_insert_link_idx]); if (spider->sql_kinds & SPIDER_SQL_KIND_SQL) spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); if (table->next_number_field && @@ -6181,12 +6055,7 @@ int spider_db_bulk_insert( else if ((error_num = dbton_handler-> show_last_insert_id(first_insert_link_idx, last_insert_id))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } table->next_number_field->set_notnull(); if ( @@ -6195,19 +6064,10 @@ int spider_db_bulk_insert( (error_num = table->next_number_field->store( last_insert_id, TRUE)) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); spider->store_last_insert_id = 0; } if ( @@ -6520,25 +6380,15 @@ int spider_db_update( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; conn->ignore_dup_key = spider->wide_handler->ignore_dup_key; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_UPDATE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6571,11 +6421,7 @@ int spider_db_update( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6612,12 +6458,7 @@ int spider_db_update( if ((error_num = dbton_hdl->append_insert_for_recovery( SPIDER_SQL_TYPE_INSERT_SQL, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, spider->wide_handler->trx->thd, @@ -6628,11 +6469,7 @@ int spider_db_update( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6660,11 +6497,7 @@ int spider_db_update( DBUG_RETURN(error_num); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); result_list->update_sqls[roop_count].length(0); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -6778,24 +6611,14 @@ int spider_db_direct_update( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_UPDATE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_setup_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6831,11 +6654,7 @@ int spider_db_direct_update( ) && (error_num != HA_ERR_FOUND_DUPP_KEY || !spider->ignore_dup_key) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6870,11 +6689,7 @@ int spider_db_direct_update( DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); DBUG_RETURN(0); @@ -6976,24 +6791,14 @@ int spider_db_direct_update( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_UPDATE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7030,11 +6835,7 @@ int spider_db_direct_update( (error_num != HA_ERR_FOUND_DUPP_KEY || !spider->wide_handler->ignore_dup_key) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -7069,11 +6870,7 @@ int spider_db_direct_update( DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); DBUG_RETURN(0); @@ -7128,32 +6925,18 @@ int spider_db_delete( ) { conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_query_with_set_names( SPIDER_SQL_TYPE_DELETE_SQL, spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); result_list->update_sqls[roop_count].length(0); } if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL))) @@ -7238,24 +7021,14 @@ int spider_db_direct_delete( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_DELETE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_setup_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7288,11 +7061,7 @@ int spider_db_direct_delete( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7316,17 +7085,13 @@ int spider_db_direct_delete( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (!counted) { *delete_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } int error_num2 = 0; if (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) @@ -7404,24 +7169,14 @@ int spider_db_direct_delete( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_DELETE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7454,11 +7209,7 @@ int spider_db_direct_delete( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7482,17 +7233,13 @@ int spider_db_direct_delete( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (!counted) { *delete_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } int error_num2 = 0; if (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) @@ -7527,18 +7274,12 @@ int spider_db_delete_all_rows( uint dbton_id = share->sql_dbton_ids[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id]; conn = spider->conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); spider_conn_set_timeout_from_share(conn, roop_count, spider->wide_handler->trx->thd, share); @@ -7560,11 +7301,7 @@ int spider_db_delete_all_rows( /* retry */ if ((error_num = spider_db_ping(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7590,11 +7327,7 @@ int spider_db_delete_all_rows( } if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7627,11 +7360,7 @@ int spider_db_delete_all_rows( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7656,11 +7385,7 @@ int spider_db_delete_all_rows( DBUG_RETURN(error_num); } } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -7685,11 +7410,7 @@ int spider_db_delete_all_rows( DBUG_RETURN(error_num); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL))) DBUG_RETURN(error_num); @@ -9462,13 +9183,7 @@ int spider_db_udf_direct_sql( sql_command_backup = c_thd->lex->sql_command; c_thd->lex->sql_command = SQLCOM_INSERT; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ( !(error_num = spider_db_udf_direct_sql_set_names(direct_sql, trx, conn)) && !(error_num = spider_db_udf_direct_sql_select_db(direct_sql, conn)) @@ -9690,11 +9405,7 @@ int spider_db_udf_direct_sql( } while (status == 0); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (need_trx_end && insert_start) { if (error_num) @@ -9853,20 +9564,10 @@ int spider_db_udf_ping_table( spider.conn_link_idx = &tmp_conn_link_idx; spider.db_request_phase = &db_request_phase; spider.db_request_id = &db_request_id; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_ping(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); if (error_num == ER_CON_COUNT_ERROR) @@ -9878,11 +9579,7 @@ int spider_db_udf_ping_table( share->server_names[0]); DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (!ping_only) { int init_sql_alloc_size = @@ -9925,20 +9622,10 @@ int spider_db_udf_ping_table( my_afree(sql_buf); DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_set_names(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); DBUG_PRINT("info",("spider error_num=%d", error_num)); @@ -9953,23 +9640,15 @@ int spider_db_udf_ping_table( -1, &need_mon) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num = spider_unlock_after_query_1(conn); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); DBUG_PRINT("info",("spider error_num=%d", error_num)); my_afree(sql_buf); DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + spider_unlock_after_query(conn, 0); spider_db_discard_result(&spider, 0, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); } table_mon_list->last_mon_result = 0; @@ -10185,34 +9864,18 @@ int spider_db_udf_ping_table_mon_next( DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_ping(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); my_afree(sql_buf); - DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); + DBUG_RETURN(spider_unlock_after_query(conn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE)); } if ((error_num = spider_db_set_names(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } spider_conn_set_timeout_from_share(conn, 0, thd, share); if (spider_db_query( @@ -10222,12 +9885,8 @@ int spider_db_udf_ping_table_mon_next( -1, &need_mon) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; my_afree(sql_buf); - DBUG_RETURN(spider_db_errorno(conn)); + DBUG_RETURN(spider_unlock_after_query_1(conn)); } st_spider_db_request_key request_key; request_key.spider_thread_id = trx.spider_thread_id; @@ -10237,30 +9896,22 @@ int spider_db_udf_ping_table_mon_next( request_key.next = NULL; if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } - else if ((error_num = spider_db_errorno(conn))) + else if ((error_num = spider_unlock_after_query_1(conn))) { my_afree(sql_buf); DBUG_RETURN(error_num); } + spider_unlock_after_query(conn, 0); my_error(HA_ERR_OUT_OF_MEM, MYF(0)); my_afree(sql_buf); DBUG_RETURN(HA_ERR_OUT_OF_MEM); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); my_afree(sql_buf); error_num = res->fetch_table_mon_status(mon_table_result->result_status); res->free_result(); @@ -10338,20 +9989,10 @@ int spider_db_udf_copy_tables( spider_conn_clear_queue_at_commit(tmp_conn); if (!tmp_conn->trx_start) { - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - tmp_conn->need_mon = &tmp_spider->need_mons[0]; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &tmp_spider->need_mons[0]); if (spider_db_ping(tmp_spider, tmp_conn, 0)) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; @@ -10362,18 +10003,10 @@ int spider_db_udf_copy_tables( (error_num = spider_db_start_transaction(tmp_conn, tmp_spider->need_mons)) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_start_transaction; } - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } } else { @@ -10393,20 +10026,10 @@ int spider_db_udf_copy_tables( { tmp_spider = &spider[roop_count]; tmp_conn = tmp_spider->conns[0]; - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - tmp_conn->need_mon = &tmp_spider->need_mons[0]; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &tmp_spider->need_mons[0]); if (spider_db_ping(tmp_spider, tmp_conn, 0)) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; @@ -10419,21 +10042,13 @@ int spider_db_udf_copy_tables( (error_num = spider_db_lock_tables(tmp_spider, 0)) ) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); tmp_conn->table_lock = 0; if (error_num == HA_ERR_OUT_OF_MEM) my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); goto error_lock_tables; } - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); tmp_conn->table_lock = 1; } } @@ -10441,23 +10056,13 @@ int spider_db_udf_copy_tables( tmp_conn = src_tbl_conn->conn; spider_conn_set_timeout_from_share(tmp_conn, 0, copy_tables->trx->thd, src_tbl_conn->share); - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - tmp_conn->need_mon = &src_tbl_conn->need_mon; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &src_tbl_conn->need_mon); if (select_ct->exec_query( tmp_conn, -1, &src_tbl_conn->need_mon) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(tmp_conn); + error_num= spider_unlock_after_query_1(tmp_conn); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); @@ -10485,11 +10090,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } for (dst_tbl_conn = dst_tbl_conn->next; dst_tbl_conn; @@ -10503,11 +10104,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } } @@ -10532,11 +10129,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } if ( @@ -10550,12 +10143,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); - error_num = ER_OUT_OF_RESOURCES; + error_num= spider_unlock_after_query(tmp_conn, ER_OUT_OF_RESOURCES); goto error_db_query; } error_num = 0; @@ -10565,20 +10153,12 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn; dst_tbl_conn = dst_tbl_conn->next) { @@ -10597,11 +10177,7 @@ int spider_db_udf_copy_tables( } if (error_num) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); @@ -10609,31 +10185,12 @@ int spider_db_udf_copy_tables( } error_num = HA_ERR_END_OF_FILE; end_of_file = TRUE; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } if (!error_num && roop_count) { -/* - dst_tbl_conn = copy_tables->table_conn[1]; - spider_db_copy_table *source_ct = dst_tbl_conn->copy_table; - for (dst_tbl_conn = dst_tbl_conn->next; dst_tbl_conn; - dst_tbl_conn = dst_tbl_conn->next) - { - insert_ct = dst_tbl_conn->copy_table; - if (insert_ct->copy_insert_values(source_ct)) - { - my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); - error_num = ER_OUT_OF_RESOURCES; - goto error_db_query; - } - } -*/ #ifndef WITHOUT_SPIDER_BG_SEARCH if (copy_tables->bg_mode) { @@ -10654,13 +10211,7 @@ int spider_db_udf_copy_tables( { tmp_conn = dst_tbl_conn->conn; insert_ct = dst_tbl_conn->copy_table; - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - tmp_conn->need_mon = &dst_tbl_conn->need_mon; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &dst_tbl_conn->need_mon); spider_conn_set_timeout_from_share(tmp_conn, 0, copy_tables->trx->thd, dst_tbl_conn->share); if (insert_ct->exec_query( @@ -10668,21 +10219,13 @@ int spider_db_udf_copy_tables( -1, &dst_tbl_conn->need_mon) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(tmp_conn); + error_num= spider_unlock_after_query_1(tmp_conn); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); goto error_db_query; } else { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -10818,20 +10361,14 @@ int spider_db_open_handler( SPIDER_CONN *conn, int link_idx ) { - int error_num; + int error_num= 0; SPIDER_SHARE *share = spider->share; uint *handler_id_ptr = &spider->m_handler_id[link_idx] ; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; DBUG_ENTER("spider_db_open_handler"); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if (!spider->handler_opened(link_idx, conn->conn_kind)) *handler_id_ptr = conn->opened_handlers; if (!spider->handler_opened(link_idx, conn->conn_kind)) @@ -10867,20 +10404,9 @@ int spider_db_open_handler( } DBUG_PRINT("info",("spider conn=%p", conn)); DBUG_PRINT("info",("spider opened_handlers=%u", conn->opened_handlers)); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); error: - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } @@ -10890,31 +10416,17 @@ int spider_db_close_handler( int link_idx, uint tgt_conn_kind ) { - int error_num; + int error_num= 0; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; DBUG_ENTER("spider_db_close_handler"); DBUG_PRINT("info",("spider conn=%p", conn)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if (spider->handler_opened(link_idx, tgt_conn_kind)) { dbton_hdl->reset_sql(SPIDER_SQL_TYPE_HANDLER); if ((error_num = dbton_hdl->append_close_handler_part( SPIDER_SQL_TYPE_HANDLER, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - + goto error; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); @@ -10933,20 +10445,9 @@ int spider_db_close_handler( conn->opened_handlers--; DBUG_PRINT("info",("spider opened_handlers=%u", conn->opened_handlers)); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); error: - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index f0d0a166ed3..9ab15058253 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -2489,37 +2489,24 @@ int spider_db_mbase::select_db( DBUG_RETURN(mysql_select_db(db_conn, dbname)); } +static int spider_db_query_with_lock(SPIDER_CONN *conn, const char *query, + uint len, int *need_mon) +{ + int error_num= 0; + spider_lock_before_query(conn, need_mon); + if (spider_db_query(conn, query, len, -1, need_mon)) + error_num= spider_db_errorno(conn); + return spider_unlock_after_query(conn, error_num); +} + int spider_db_mbase::consistent_snapshot( int *need_mon ) { DBUG_ENTER("spider_db_mbase::consistent_snapshot"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_START_CONSISTENT_SNAPSHOT_STR, - SPIDER_SQL_START_CONSISTENT_SNAPSHOT_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_START_CONSISTENT_SNAPSHOT_STR, + SPIDER_SQL_START_CONSISTENT_SNAPSHOT_LEN, need_mon)); } bool spider_db_mbase::trx_start_in_bulk_sql() @@ -2554,77 +2541,30 @@ int spider_db_mbase::commit( ) { DBUG_ENTER("spider_db_mbase::commit"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_COMMIT_STR, - SPIDER_SQL_COMMIT_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, SPIDER_SQL_COMMIT_STR, + SPIDER_SQL_COMMIT_LEN, need_mon)); } int spider_db_mbase::rollback( int *need_mon ) { bool is_error; - int error_num; + int error_num= 0; DBUG_ENTER("spider_db_mbase::rollback"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ROLLBACK_STR, - SPIDER_SQL_ROLLBACK_LEN, - -1, - need_mon) - ) { - is_error = conn->thd->is_error(); - error_num = spider_db_errorno(conn); - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !is_error - ) + spider_lock_before_query(conn, need_mon); + if (spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, + SPIDER_SQL_ROLLBACK_LEN, -1, need_mon)) + { + is_error= conn->thd->is_error(); + error_num= spider_db_errorno(conn); + if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && !is_error) + { conn->thd->clear_error(); - else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + error_num= 0; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_db_mbase::xa_start( @@ -2657,32 +2597,8 @@ int spider_db_mbase::xa_end( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_END_STR, SPIDER_SQL_XA_END_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_prepare( @@ -2698,32 +2614,8 @@ int spider_db_mbase::xa_prepare( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_PREPARE_STR, SPIDER_SQL_XA_PREPARE_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_commit( @@ -2739,32 +2631,8 @@ int spider_db_mbase::xa_commit( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_COMMIT_STR, SPIDER_SQL_XA_COMMIT_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_rollback( @@ -2780,32 +2648,8 @@ int spider_db_mbase::xa_rollback( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_ROLLBACK_STR, SPIDER_SQL_XA_ROLLBACK_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } bool spider_db_mbase::set_trx_isolation_in_bulk_sql() @@ -2824,113 +2668,21 @@ int spider_db_mbase::set_trx_isolation( switch (trx_isolation) { case ISO_READ_UNCOMMITTED: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_READ_UNCOMMITTED_STR, - SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_READ_UNCOMMITTED_STR, + SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN, need_mon)); case ISO_READ_COMMITTED: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_READ_COMMITTED_STR, - SPIDER_SQL_ISO_READ_COMMITTED_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_READ_COMMITTED_STR, + SPIDER_SQL_ISO_READ_COMMITTED_LEN, need_mon)); case ISO_REPEATABLE_READ: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_REPEATABLE_READ_STR, - SPIDER_SQL_ISO_REPEATABLE_READ_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_REPEATABLE_READ_STR, + SPIDER_SQL_ISO_REPEATABLE_READ_LEN, need_mon)); case ISO_SERIALIZABLE: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_SERIALIZABLE_STR, - SPIDER_SQL_ISO_SERIALIZABLE_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_SERIALIZABLE_STR, + SPIDER_SQL_ISO_SERIALIZABLE_LEN, need_mon)); default: DBUG_RETURN(HA_ERR_UNSUPPORTED); } @@ -2951,60 +2703,12 @@ int spider_db_mbase::set_autocommit( DBUG_ENTER("spider_db_mbase::set_autocommit"); DBUG_PRINT("info",("spider this=%p", this)); if (autocommit) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_ON_STR, - SPIDER_SQL_AUTOCOMMIT_ON_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_OFF_STR, - SPIDER_SQL_AUTOCOMMIT_OFF_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_AUTOCOMMIT_ON_STR, + SPIDER_SQL_AUTOCOMMIT_ON_LEN, need_mon)); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_AUTOCOMMIT_OFF_STR, + SPIDER_SQL_AUTOCOMMIT_OFF_LEN, need_mon)); } bool spider_db_mbase::set_sql_log_off_in_bulk_sql() @@ -3021,60 +2725,12 @@ int spider_db_mbase::set_sql_log_off( DBUG_ENTER("spider_db_mbase::set_sql_log_off"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_log_off) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_SQL_LOG_ON_STR, - SPIDER_SQL_SQL_LOG_ON_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_SQL_LOG_OFF_STR, - SPIDER_SQL_SQL_LOG_OFF_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_SQL_LOG_ON_STR, + SPIDER_SQL_SQL_LOG_ON_LEN, need_mon)); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_SQL_LOG_OFF_STR, + SPIDER_SQL_SQL_LOG_OFF_LEN, need_mon)); } bool spider_db_mbase::set_wait_timeout_in_bulk_sql() @@ -3102,32 +2758,8 @@ int spider_db_mbase::set_wait_timeout( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql_str.q_append(SPIDER_SQL_WAIT_TIMEOUT_STR, SPIDER_SQL_WAIT_TIMEOUT_LEN); sql_str.q_append(timeout_str, timeout_str_length); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } bool spider_db_mbase::set_sql_mode_in_bulk_sql() @@ -3165,32 +2797,8 @@ int spider_db_mbase::set_sql_mode( } } sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } bool spider_db_mbase::set_time_zone_in_bulk_sql() @@ -3217,32 +2825,8 @@ int spider_db_mbase::set_time_zone( sql_str.q_append(SPIDER_SQL_TIME_ZONE_STR, SPIDER_SQL_TIME_ZONE_LEN); sql_str.q_append(tz_str->ptr(), tz_str->length()); sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } int spider_db_mbase::exec_simple_sql_with_result( @@ -3254,17 +2838,10 @@ int spider_db_mbase::exec_simple_sql_with_result( int *need_mon, SPIDER_DB_RESULT **res ) { - int error_num; + int error_num= 0; DBUG_ENTER("spider_db_mbase::exec_simple_sql_with_result"); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, - share); + spider_lock_before_query(conn, need_mon); + spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, share); if ( (error_num = spider_db_set_names_internal(trx, share, conn, all_link_idx, need_mon)) || @@ -3278,87 +2855,39 @@ int spider_db_mbase::exec_simple_sql_with_result( (error_num = spider_db_errorno(conn)) ) ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping_internal(share, conn, - all_link_idx, need_mon))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names_internal(trx, share, conn, - all_link_idx, need_mon))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, - share); - if (spider_db_query( - conn, - sql, - sql_length, - -1, - need_mon) + if ( + error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && + !conn->disable_reconnect ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); + if ((error_num = spider_db_ping_internal(share, conn, + all_link_idx, need_mon))) + goto unlock; + if ((error_num= spider_db_set_names_internal(trx, share, conn, + all_link_idx, need_mon))) + goto unlock; + spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, + share); + if (spider_db_query( + conn, + sql, + sql_length, + -1, + need_mon) + ) { + error_num= spider_db_errorno(conn); + goto unlock; + } + } else + goto unlock; } - } - if (!(*res = store_result(NULL, NULL, &error_num))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num) + if (!(*res = store_result(NULL, NULL, &error_num))) { - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); + if (error_num || (error_num= spider_db_errorno(conn)) || + (error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE)) + goto unlock; } - else if ((error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_db_mbase::show_master_status( @@ -3411,10 +2940,6 @@ int spider_db_mbase::show_master_status( spider_store_binlog_pos_gtid(table, NULL, 0, conn->access_charset); } } -/* - res->free_result(); - delete res; -*/ if (error_num) { DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); @@ -3480,10 +3005,6 @@ int spider_db_mbase::select_binlog_gtid_pos( { spider_store_binlog_pos_gtid(table, gtid_pos, strlen(gtid_pos), conn->access_charset); } -/* - res->free_result(); - delete res; -*/ if (error_num) { DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); @@ -4016,70 +3537,15 @@ int spider_db_mysql_util::append_column_value( ptr = tmp_str.get_str(); } else if (field->type() == MYSQL_TYPE_GEOMETRY) { -/* - uint mlength = SIZEOF_STORED_DOUBLE, lcnt; - uchar *dest = (uchar *) buf; - const uchar *source; - for (lcnt = 0; lcnt < 4; lcnt++) - { - mlength = SIZEOF_STORED_DOUBLE; - source = new_ptr + mlength + SIZEOF_STORED_DOUBLE * lcnt; - while (mlength--) - *dest++ = *--source; - } - tmp_str.length(SIZEOF_STORED_DOUBLE * lcnt); -*/ #ifdef DBUG_TRACE double xmin, xmax, ymin, ymax; -/* - float8store(buf,xmin); - float8store(buf+8,xmax); - float8store(buf+16,ymin); - float8store(buf+24,ymax); - memcpy(&xmin,new_ptr,sizeof(xmin)); - memcpy(&xmax,new_ptr + 8,sizeof(xmax)); - memcpy(&ymin,new_ptr + 16,sizeof(ymin)); - memcpy(&ymax,new_ptr + 24,sizeof(ymax)); - float8get(xmin, buf); - float8get(xmax, buf + 8); - float8get(ymin, buf + 16); - float8get(ymax, buf + 24); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - DBUG_PRINT("info", ("spider geo is %.14g %.14g %.14g %.14g", - xmin, xmax, ymin, ymax)); -*/ float8get(xmin, new_ptr); float8get(xmax, new_ptr + 8); float8get(ymin, new_ptr + 16); float8get(ymax, new_ptr + 24); DBUG_PRINT("info", ("spider geo is %f %f %f %f", xmin, xmax, ymin, ymax)); -/* - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 4); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 5); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 6); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 7); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 8); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 9); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 10); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 11); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 12); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 13); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 14); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 15); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); -*/ #endif -/* - tmp_str.set_quick((char *) new_ptr, SIZEOF_STORED_DOUBLE * 4, - &my_charset_bin); -*/ tmp_str.length(0); tmp_str.q_append((char *) SPIDER_SQL_LINESTRING_HEAD_STR, SPIDER_SQL_LINESTRING_HEAD_LEN); @@ -4108,27 +3574,6 @@ int spider_db_mysql_util::append_column_value( DBUG_PRINT("info", ("spider field->type() is %d", field->type())); DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length())); -/* - if ( - field->type() == MYSQL_TYPE_BIT || - (field->type() >= MYSQL_TYPE_TINY_BLOB && - field->type() <= MYSQL_TYPE_BLOB) - ) { - uchar *hex_ptr = (uchar *) ptr->ptr(), *end_ptr; - char *str_ptr; - DBUG_PRINT("info", ("spider HEX")); - if (str->reserve(SPIDER_SQL_HEX_LEN + ptr->length() * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HEX_STR, SPIDER_SQL_HEX_LEN); - str_ptr = (char *) str->ptr() + str->length(); - for (end_ptr = hex_ptr + ptr->length(); hex_ptr < end_ptr; hex_ptr++) - { - *str_ptr++ = spider_dig_upper[(*hex_ptr) >> 4]; - *str_ptr++ = spider_dig_upper[(*hex_ptr) & 0x0F]; - } - str->length(str->length() + ptr->length() * 2); - } else -*/ if (field->result_type() == STRING_RESULT) { DBUG_PRINT("info", ("spider STRING_RESULT")); @@ -7898,169 +7343,105 @@ int spider_mbase_share::discover_table_structure( sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); SPIDER_CONN *conn; - int need_mon; + int need_mon_deref; + int *need_mon= &need_mon_deref; if (!(conn = spider_get_conn( spider_share, 0, spider_share->conn_keys[roop_count], trx, NULL, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, &error_num)) ) { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, need_mon); if (!conn->disable_reconnect) { ha_spider tmp_spider; SPIDER_WIDE_HANDLER wide_handler; - int need_mon = 0; - uint tmp_conn_link_idx = 0; - tmp_spider.wide_handler = &wide_handler; - wide_handler.trx = trx; - tmp_spider.share = spider_share; - tmp_spider.need_mons = &need_mon; - tmp_spider.conn_link_idx = &tmp_conn_link_idx; - if ((error_num = spider_db_ping(&tmp_spider, conn, 0))) + int need_mon= 0; + uint tmp_conn_link_idx= 0; + tmp_spider.wide_handler= &wide_handler; + wide_handler.trx= trx; + tmp_spider.share= spider_share; + tmp_spider.need_mons= &need_mon; + tmp_spider.conn_link_idx= &tmp_conn_link_idx; + if ((error_num= spider_db_ping(&tmp_spider, conn, 0))) { - DBUG_PRINT("info",("spider spider_db_ping error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } } spider_conn_set_timeout_from_share(conn, roop_count, trx->thd, - spider_share); - if ( - (error_num = spider_db_set_names_internal(trx, spider_share, conn, - roop_count, &need_mon)) || - ( - spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - &need_mon) && - (error_num = spider_db_errorno(conn)) - ) - ) { - DBUG_PRINT("info",("spider spider_get_trx error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_share); + if ((error_num= spider_db_set_names_internal(trx, spider_share, conn, + roop_count, need_mon)) || + (spider_db_query(conn, sql_str.ptr(), sql_str.length(), -1, + need_mon) && + (error_num= spider_db_errorno(conn)))) + { + spider_unlock_after_query(conn, 0); continue; } st_spider_db_request_key request_key; - request_key.spider_thread_id = trx->spider_thread_id; - request_key.query_id = trx->thd->query_id; - request_key.handler = NULL; - request_key.request_id = 1; - request_key.next = NULL; - spider_db_result *res; + request_key.spider_thread_id= trx->spider_thread_id; + request_key.query_id= trx->thd->query_id; request_key.handler= NULL; + request_key.request_id= 1; request_key.next= NULL; + spider_db_result * res; /* get column list */ - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) + if (!(res= conn->db_conn->store_result(NULL, &request_key, + &error_num))) { + if (error_num || (error_num= spider_db_errorno(conn))) { - DBUG_PRINT("info",("spider column store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - /* no record */ - DBUG_PRINT("info",("spider column no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - if ((error_num = res->fetch_columns_for_discover_table_structure(str, - spider_share->access_charset))) - { - DBUG_PRINT("info",("spider column fetch error")); + if ((error_num= + res->fetch_columns_for_discover_table_structure( + str, spider_share->access_charset))) { + DBUG_PRINT("info", ("spider column fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), - db_names_str[roop_count].ptr(), - table_names_str[roop_count].ptr()); - error_num = ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM; + ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), + db_names_str[roop_count].ptr(), + table_names_str[roop_count].ptr()); + error_num= ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM; + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; if (conn->db_conn->next_result()) { - DBUG_PRINT("info",("spider single result error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } /* get index list */ - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) + if (!(res= conn->db_conn->store_result(NULL, &request_key, + &error_num))) { + if (error_num || (error_num= spider_db_errorno(conn))) { - DBUG_PRINT("info",("spider index store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - /* no record */ - DBUG_PRINT("info",("spider index no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - if ((error_num = res->fetch_index_for_discover_table_structure(str, - spider_share->access_charset))) - { - DBUG_PRINT("info",("spider index fetch error")); + if ((error_num= + res->fetch_index_for_discover_table_structure( + str, spider_share->access_charset))) { + DBUG_PRINT("info", ("spider index fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; - if (conn->db_conn->next_result()) - { - DBUG_PRINT("info",("spider dual result error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + if (conn->db_conn->next_result()) { + DBUG_PRINT("info", ("spider dual result error")); + spider_unlock_after_query(conn, 0); continue; } /* get table info */ @@ -8069,44 +7450,30 @@ int spider_mbase_share::discover_table_structure( if (error_num || (error_num = spider_db_errorno(conn))) { DBUG_PRINT("info",("spider table store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } /* no record */ DBUG_PRINT("info",("spider table no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } if ((error_num = res->fetch_table_for_discover_table_structure(str, - spider_share, spider_share->access_charset))) + spider_share, spider_share->access_charset))) { DBUG_PRINT("info",("spider table fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); if (!error_num) + { + spider_unlock_after_query(conn, 0); break; + } } DBUG_RETURN(error_num); } @@ -13401,20 +12768,12 @@ int spider_mbase_handler::show_table_status( SPIDER_CONN *conn = spider->conns[link_idx]; SPIDER_DB_RESULT *res; SPIDER_SHARE *share = spider->share; - uint pos = (2 * spider->conn_link_idx[link_idx]); + uint pos = 2 * spider->conn_link_idx[link_idx] + (sts_mode == 1 ? 0 : 1); ulonglong auto_increment_value = 0; DBUG_ENTER("spider_mbase_handler::show_table_status"); DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); - if (sts_mode == 1) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); conn->disable_connect_retry = TRUE; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, @@ -13424,8 +12783,8 @@ int spider_mbase_handler::show_table_status( ( spider_db_query( conn, - mysql_share->show_table_status[0 + pos].ptr(), - mysql_share->show_table_status[0 + pos].length(), + mysql_share->show_table_status[pos].ptr(), + mysql_share->show_table_status[pos].length(), -1, &spider->need_mons[link_idx]) && (error_num = spider_db_errorno(conn)) @@ -13438,51 +12797,29 @@ int spider_mbase_handler::show_table_status( /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + goto unlock; } if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + goto unlock; } spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); if (spider_db_query( conn, - mysql_share->show_table_status[0 + pos].ptr(), - mysql_share->show_table_status[0 + pos].length(), + mysql_share->show_table_status[pos].ptr(), + mysql_share->show_table_status[pos].length(), -1, &spider->need_mons[link_idx]) ) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); + goto unlock; } } else { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + goto unlock; } } + error_num= 0; st_spider_db_request_key request_key; request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; request_key.query_id = spider->wide_handler->trx->thd->query_id; @@ -13491,43 +12828,27 @@ int spider_mbase_handler::show_table_status( request_key.next = NULL; if (spider_param_dry_access()) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + goto unlock; } if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num) - { - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - else if ((error_num = spider_db_errorno(conn))) - DBUG_RETURN(error_num); - else { + if (error_num || (error_num = spider_db_errorno(conn))) + goto unlock; + else if (sts_mode == 1) { my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(), mysql_share->table_names_str[spider->conn_link_idx[ link_idx]].ptr()); - DBUG_RETURN(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM); + error_num= ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM; + goto unlock; + } + else /* sts_mode != 1 */ + { + error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE; + goto unlock; } } - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, share->stat @@ -13556,168 +12877,29 @@ int spider_mbase_handler::show_table_status( default: break; } - DBUG_RETURN(error_num); + goto unlock; } - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - conn->disable_connect_retry = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - mysql_share->show_table_status[1 + pos].ptr(), - mysql_share->show_table_status[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - mysql_share->show_table_status[1 + pos].ptr(), - mysql_share->show_table_status[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (spider_param_dry_access()) + if ((error_num = ((spider_db_mbase *) conn->db_conn)->fetch_and_print_warnings(NULL))) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + goto unlock; } - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) + if (share->static_records_for_status != -1) { - conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num || (error_num = spider_db_errorno(conn))) - DBUG_RETURN(error_num); - else - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + share->stat.records = (ha_rows) share->static_records_for_status; } + if (share->static_mean_rec_length != -1) + { + share->stat.mean_rec_length = (ulong) share->static_mean_rec_length; + } + if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value) + { + share->lgtm_tblhnd_share->auto_increment_value = auto_increment_value; + DBUG_PRINT("info",("spider auto_increment_value=%llu", + share->lgtm_tblhnd_share->auto_increment_value)); + } +unlock: conn->disable_connect_retry = FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_status( - sts_mode, - share->stat - ); - auto_increment_value = share->stat.auto_increment_value; - res->free_result(); - delete res; - if (error_num) - { - switch (error_num) - { - case ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM: - my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(), - mysql_share->table_names_str[spider->conn_link_idx[ - link_idx]].ptr()); - break; - case ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM: - my_printf_error(ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM, - ER_SPIDER_INVALID_REMOTE_TABLE_INFO_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(), - mysql_share->table_names_str[spider->conn_link_idx[ - link_idx]].ptr()); - break; - default: - break; - } - DBUG_RETURN(error_num); - } - } - if ((error_num = ((spider_db_mbase *) conn->db_conn)->fetch_and_print_warnings(NULL))) - { - DBUG_RETURN(error_num); - } - if (share->static_records_for_status != -1) - { - share->stat.records = (ha_rows) share->static_records_for_status; - } - if (share->static_mean_rec_length != -1) - { - share->stat.mean_rec_length = (ulong) share->static_mean_rec_length; - } - if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value) - { - share->lgtm_tblhnd_share->auto_increment_value = auto_increment_value; - DBUG_PRINT("info",("spider auto_increment_value=%llu", - share->lgtm_tblhnd_share->auto_increment_value)); - } - DBUG_RETURN(0); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::crd_mode_exchange( @@ -13739,18 +12921,10 @@ int spider_mbase_handler::show_index( SPIDER_DB_RESULT *res; int roop_count; longlong *tmp_cardinality; - uint pos = (2 * spider->conn_link_idx[link_idx]); + uint pos = 2 * spider->conn_link_idx[link_idx] + (crd_mode == 1 ? 0 : 1); DBUG_ENTER("spider_mbase_handler::show_index"); DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); - if (crd_mode == 1) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -13759,8 +12933,8 @@ int spider_mbase_handler::show_index( ( spider_db_query( conn, - mysql_share->show_index[0 + pos].ptr(), - mysql_share->show_index[0 + pos].length(), + mysql_share->show_index[pos].ptr(), + mysql_share->show_index[pos].length(), -1, &spider->need_mons[link_idx]) && (error_num = spider_db_errorno(conn)) @@ -13772,48 +12946,27 @@ int spider_mbase_handler::show_index( ) { /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); if (spider_db_query( conn, - mysql_share->show_index[0 + pos].ptr(), - mysql_share->show_index[0 + pos].length(), + mysql_share->show_index[pos].ptr(), + mysql_share->show_index[pos].length(), -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); + error_num= spider_db_errorno(conn); + goto unlock; } } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + goto unlock; } } + error_num= 0; st_spider_db_request_key request_key; request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; request_key.query_id = spider->wide_handler->trx->thd->query_id; @@ -13824,20 +12977,10 @@ int spider_mbase_handler::show_index( { if (error_num || (error_num = spider_db_errorno(conn))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + goto unlock; } /* no record is ok */ } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); if (res) { error_num = res->fetch_table_cardinality( @@ -13885,154 +13028,10 @@ int spider_mbase_handler::show_index( default: break; } - DBUG_RETURN(error_num); + goto unlock; } - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - mysql_share->show_index[1 + pos].ptr(), - mysql_share->show_index[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - mysql_share->show_index[1 + pos].ptr(), - mysql_share->show_index[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - /* no record is ok */ - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - if (res) - { - error_num = res->fetch_table_cardinality( - crd_mode, - table, - share->cardinality, - share->cardinality_upd, - share->bitmap_size - ); - } - for (roop_count = 0, tmp_cardinality = share->cardinality; - roop_count < (int) table->s->fields; - roop_count++, tmp_cardinality++) - { - if (!spider_bit_is_set(share->cardinality_upd, roop_count)) - { - DBUG_PRINT("info", - ("spider uninitialized column cardinality id=%d", roop_count)); - *tmp_cardinality = -1; - } - } - if (res) - { - res->free_result(); - delete res; - } - if (error_num) - { - switch (error_num) - { - case ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM: - my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(), - mysql_share->table_names_str[spider->conn_link_idx[ - link_idx]].ptr()); - break; - case ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM: - my_printf_error(ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM, - ER_SPIDER_INVALID_REMOTE_TABLE_INFO_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(), - mysql_share->table_names_str[spider->conn_link_idx[ - link_idx]].ptr()); - break; - default: - break; - } - DBUG_RETURN(error_num); - } - } - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::simple_action( @@ -14084,14 +13083,8 @@ int spider_mbase_handler::simple_action( default: DBUG_ASSERT(0); DBUG_RETURN(0); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + } + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14113,25 +13106,9 @@ int spider_mbase_handler::simple_action( ) { /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14142,23 +13119,14 @@ int spider_mbase_handler::simple_action( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); + error_num= spider_db_errorno(conn); + goto unlock; } } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); + goto unlock; } } + error_num= 0; st_spider_db_request_key request_key; request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; request_key.query_id = spider->wide_handler->trx->thd->query_id; @@ -14167,31 +13135,15 @@ int spider_mbase_handler::simple_action( request_key.next = NULL; if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) - { - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; else if ((error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + goto unlock; + else { + error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE; + goto unlock; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); switch (simple_action) { case SPIDER_SIMPLE_RECORDS: @@ -14208,12 +13160,8 @@ int spider_mbase_handler::simple_action( } res->free_result(); delete res; - if (error_num) - { - DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::show_records( @@ -14268,13 +13216,7 @@ ha_rows spider_mbase_handler::explain_select( DBUG_RETURN(HA_POS_ERROR); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); @@ -14299,23 +13241,15 @@ ha_rows spider_mbase_handler::explain_select( { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } if ((error_num = spider_db_set_names(spider, conn, link_idx))) { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, @@ -14330,22 +13264,14 @@ ha_rows spider_mbase_handler::explain_select( error_num = spider_db_errorno(conn); if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } else { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } st_spider_db_request_key request_key; @@ -14360,27 +13286,13 @@ ha_rows spider_mbase_handler::explain_select( { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } else { - my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 2, rows @@ -14390,8 +13302,10 @@ ha_rows spider_mbase_handler::explain_select( if (error_num) { my_errno = error_num; - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; } +unlock: + spider_unlock_after_query(conn, 0); DBUG_RETURN(rows); } @@ -14409,22 +13323,9 @@ int spider_mbase_handler::lock_tables( } if (str->length()) { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); @@ -14434,18 +13335,9 @@ int spider_mbase_handler::lock_tables( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + ) + DBUG_RETURN(spider_unlock_after_query_1(conn)); + spider_unlock_after_query(conn, 0); } if (!conn->table_locked) { @@ -14477,31 +13369,9 @@ int spider_mbase_handler::unlock_tables( spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + DBUG_RETURN(spider_db_query_with_lock( + conn, str->ptr(), str->length(), + &spider->need_mons[link_idx])); } } DBUG_RETURN(0); @@ -14521,22 +13391,9 @@ int spider_mbase_handler::disable_keys( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14546,20 +13403,10 @@ int spider_mbase_handler::disable_keys( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + ) error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::enable_keys( @@ -14576,22 +13423,9 @@ int spider_mbase_handler::enable_keys( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14601,20 +13435,10 @@ int spider_mbase_handler::enable_keys( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + ) error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::check_table( @@ -14632,22 +13456,9 @@ int spider_mbase_handler::check_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14658,19 +13469,10 @@ int spider_mbase_handler::check_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::repair_table( @@ -14688,22 +13490,9 @@ int spider_mbase_handler::repair_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14714,19 +13503,10 @@ int spider_mbase_handler::repair_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::analyze_table( @@ -14743,45 +13523,18 @@ int spider_mbase_handler::analyze_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); + error_num = spider_db_set_names(spider, conn, link_idx); + if (!error_num) + { + spider_conn_set_timeout_from_share(conn, link_idx, + spider->wide_handler->trx->thd, + share); + if (spider_db_query(conn, str->ptr(), str->length(), -1, + &spider->need_mons[link_idx])) + error_num = spider_db_errorno(conn); + } + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::optimize_table( @@ -14798,22 +13551,9 @@ int spider_mbase_handler::optimize_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14824,19 +13564,10 @@ int spider_mbase_handler::optimize_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::flush_tables( @@ -14857,73 +13588,23 @@ int spider_mbase_handler::flush_tables( spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, str->ptr(), str->length(), &spider->need_mons[link_idx])); } int spider_mbase_handler::flush_logs( SPIDER_CONN *conn, int link_idx ) { - int error_num; SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_mbase_handler::flush_logs"); DBUG_PRINT("info",("spider this=%p", this)); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_FLUSH_LOGS_STR, - SPIDER_SQL_FLUSH_LOGS_LEN, - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_FLUSH_LOGS_STR, + SPIDER_SQL_FLUSH_LOGS_LEN, &spider->need_mons[link_idx])); } int spider_mbase_handler::insert_opened_handler( diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index fa9f041c83b..481291ec6f0 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -1191,25 +1191,15 @@ static int spider_send_query( } } else { #endif - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain))) DBUG_RETURN(error_num); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); if ((error_num = spider->check_error_mode_eof(error_num)) == @@ -1227,11 +1217,7 @@ static int spider_send_query( spider->result_list.quick_mode, &spider->need_mons[link_idx])) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if (spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); if ((error_num = spider->check_error_mode_eof(error_num)) == @@ -1243,13 +1229,9 @@ static int spider_send_query( DBUG_RETURN(error_num); } spider->connection_ids[link_idx] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (fields->is_first_link_ok_chain(link_idx_chain)) { - if ((error_num = spider_db_store_result(spider, link_idx, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) { if (error_num != HA_ERR_END_OF_FILE && spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); @@ -1266,7 +1248,7 @@ static int spider_send_query( } else { spider_db_discard_result(spider, link_idx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } #ifndef WITHOUT_SPIDER_BG_SEARCH } diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index dc30278e66c..d41a957d436 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -5725,20 +5725,10 @@ int spider_open_all_tables( } conn->error_mode &= spider_param_error_read_mode(thd, 0); conn->error_mode &= spider_param_error_write_mode(thd, 0); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &mon_val; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &mon_val); if ((error_num = spider_db_before_query(conn, &mon_val))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); spider_sys_index_end(table_tables); spider_close_sys_table(thd, table_tables, &open_tables_backup, TRUE); @@ -5747,11 +5737,7 @@ int spider_open_all_tables( free_root(&mem_root, MYF(0)); DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2) { From 0ba97e4dc6209bfc109b33522719270543f0658d Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 11:29:57 +0800 Subject: [PATCH 078/185] MDEV-31788 Factor out calls to spider_ping_table_mon_from_table in ha_spider.cc --- storage/spider/ha_spider.cc | 1365 ++++------------------------------- 1 file changed, 140 insertions(+), 1225 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 2a49af4ee3b..140a5873034 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1387,6 +1387,58 @@ int ha_spider::index_end() DBUG_RETURN(0); } +static int spider_maybe_ping(ha_spider *spider, int link_idx, int error_num) +{ + if ( + spider->share->monitoring_kind[link_idx] && + spider->need_mons[link_idx] + ) { + error_num = spider_ping_table_mon_from_table( + spider->wide_handler->trx, + spider->wide_handler->trx->thd, + spider->share, + link_idx, + (uint32) spider->share->monitoring_sid[link_idx], + spider->share->table_name, + spider->share->table_name_length, + spider->conn_link_idx[link_idx], + NULL, + 0, + spider->share->monitoring_kind[link_idx], + spider->share->monitoring_limit[link_idx], + spider->share->monitoring_flag[link_idx], + TRUE + ); + } + return spider->check_error_mode_eof(error_num); +} + +static int spider_maybe_ping_1(ha_spider *spider, + int link_idx, int error_num) +{ + if ( + spider->share->monitoring_kind[link_idx] && + spider->need_mons[link_idx] + ) { + error_num = spider_ping_table_mon_from_table( + spider->wide_handler->trx, + spider->wide_handler->trx->thd, + spider->share, + link_idx, + (uint32) spider->share->monitoring_sid[link_idx], + spider->share->table_name, + spider->share->table_name_length, + spider->conn_link_idx[link_idx], + NULL, + 0, + spider->share->monitoring_kind[link_idx], + spider->share->monitoring_limit[link_idx], + spider->share->monitoring_flag[link_idx], + TRUE + ); + } + return error_num; +} int ha_spider::index_read_map_internal( uchar *buf, @@ -1552,26 +1604,9 @@ int ha_spider::index_read_map_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -1596,28 +1631,7 @@ int ha_spider::index_read_map_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -1628,28 +1642,7 @@ int ha_spider::index_read_map_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -1657,26 +1650,9 @@ int ha_spider::index_read_map_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -1894,26 +1870,9 @@ int ha_spider::index_read_last_map_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -1938,28 +1897,7 @@ int ha_spider::index_read_last_map_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -1970,28 +1908,7 @@ int ha_spider::index_read_last_map_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -1999,26 +1916,9 @@ int ha_spider::index_read_last_map_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -2285,26 +2185,9 @@ int ha_spider::index_first_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -2330,28 +2213,7 @@ int ha_spider::index_first_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -2362,28 +2224,7 @@ int ha_spider::index_first_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -2391,26 +2232,9 @@ int ha_spider::index_first_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -2624,26 +2448,9 @@ int ha_spider::index_last_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -2669,28 +2476,7 @@ int ha_spider::index_last_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -2701,28 +2487,7 @@ int ha_spider::index_last_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -2730,26 +2495,9 @@ int ha_spider::index_last_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -3006,26 +2754,9 @@ int ha_spider::read_range_first_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -3050,28 +2781,7 @@ int ha_spider::read_range_first_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -3082,28 +2792,7 @@ int ha_spider::read_range_first_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -3111,26 +2800,9 @@ int ha_spider::read_range_first_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -3587,26 +3259,9 @@ int ha_spider::read_multi_range_first_internal( TRUE, FALSE, (roop_count != link_ok)); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } else { #endif @@ -3630,27 +3285,7 @@ int ha_spider::read_multi_range_first_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); } if (!error_num) { @@ -3663,27 +3298,7 @@ int ha_spider::read_multi_range_first_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } if (!error_num) @@ -3694,26 +3309,9 @@ int ha_spider::read_multi_range_first_internal( error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } result_link_idx = link_ok; } else { @@ -4322,26 +3920,9 @@ int ha_spider::read_multi_range_first_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } @@ -4368,27 +3949,7 @@ int ha_spider::read_multi_range_first_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } if ( @@ -4407,27 +3968,7 @@ int ha_spider::read_multi_range_first_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } spider_db_discard_multiple_result(this, roop_count, conn); @@ -4441,27 +3982,7 @@ int ha_spider::read_multi_range_first_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } connection_ids[roop_count] = conn->connection_id; @@ -4470,26 +3991,9 @@ int ha_spider::read_multi_range_first_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } @@ -4916,26 +4420,9 @@ int ha_spider::read_multi_range_next( TRUE, FALSE, (roop_count != link_ok)); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } else { #endif @@ -4959,27 +4446,7 @@ int ha_spider::read_multi_range_next( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); } if (!error_num) { @@ -4992,27 +4459,7 @@ int ha_spider::read_multi_range_next( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } if (!error_num) @@ -5023,26 +4470,9 @@ int ha_spider::read_multi_range_next( error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } result_link_idx = link_ok; } else { @@ -5650,26 +5080,9 @@ int ha_spider::read_multi_range_next( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } @@ -5696,27 +5109,7 @@ int ha_spider::read_multi_range_next( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } if ( @@ -5735,27 +5128,7 @@ int ha_spider::read_multi_range_next( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } spider_db_discard_multiple_result(this, roop_count, conn); @@ -5769,27 +5142,7 @@ int ha_spider::read_multi_range_next( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } connection_ids[roop_count] = conn->connection_id; @@ -5798,26 +5151,9 @@ int ha_spider::read_multi_range_next( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); } break; } @@ -6247,26 +5583,9 @@ int ha_spider::rnd_next_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -6292,28 +5611,7 @@ int ha_spider::rnd_next_internal( roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -6324,28 +5622,7 @@ int ha_spider::rnd_next_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -6353,26 +5630,9 @@ int ha_spider::rnd_next_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -6850,26 +6110,9 @@ int ha_spider::ft_read_internal( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -6887,28 +6130,7 @@ int ha_spider::ft_read_internal( if ((error_num = spider_db_set_names(this, conn, roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -6919,28 +6141,7 @@ int ha_spider::ft_read_internal( &need_mons[roop_count]) ) { error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } connection_ids[roop_count] = conn->connection_id; if (roop_count == link_ok) @@ -6948,26 +6149,9 @@ int ha_spider::ft_read_internal( if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } DBUG_RETURN(check_error_mode_eof(error_num)); } @@ -7201,27 +6385,7 @@ int ha_spider::info( flag | (share->sts_init ? 0 : HA_STATUS_AUTO))) ) { pthread_mutex_unlock(&share->sts_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->sts_init) { if ( @@ -7488,27 +6652,7 @@ ha_rows ha_spider::records_in_range( share->crd_init ? 2 : 1))) { pthread_mutex_unlock(&share->crd_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->crd_init) { if ( @@ -7796,27 +6940,7 @@ int ha_spider::check_crd() share->crd_init ? 2 : 1))) { pthread_mutex_unlock(&share->crd_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->crd_init) { if ( @@ -10688,7 +9812,7 @@ int ha_spider::check_ha_range_eof() int ha_spider::drop_tmp_tables() { - int error_num = 0, tmp_error_num, need_mon; + int error_num = 0, need_mon; DBUG_ENTER("ha_spider::drop_tmp_tables"); DBUG_PRINT("info",("spider this=%p", this)); if (result_list.tmp_tables_created) @@ -10723,33 +9847,13 @@ int ha_spider::drop_tmp_tables() DBUG_RETURN(error_num); } spider_lock_before_query(conn, &need_mon); - if ((tmp_error_num = spider_db_set_names(this, conn, roop_count))) + /* todo: double check the logic here w.r.t. tmp_error_num vs error_num */ + if ((error_num = spider_db_set_names(this, conn, roop_count))) { spider_unlock_after_query(conn, 0); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - tmp_error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - error_num = tmp_error_num; + error_num= spider_maybe_ping_1(this, roop_count, error_num); } - if (!tmp_error_num) + if (!error_num) { spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -10759,29 +9863,8 @@ int ha_spider::drop_tmp_tables() -1, &need_mons[roop_count]) ) { - tmp_error_num= spider_unlock_after_query_1(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - tmp_error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - error_num = tmp_error_num; + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } else { spider_unlock_after_query(conn, 0); } @@ -10835,37 +9918,16 @@ int ha_spider::close_opened_handler( int link_idx, bool release_conn ) { - int error_num = 0, error_num2; + int error_num = 0; DBUG_ENTER("ha_spider::close_opened_handler"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_bit_is_set(m_handler_opened, link_idx)) { - if ((error_num2 = spider_db_close_handler(this, + if ((error_num = spider_db_close_handler(this, conns[link_idx], link_idx, SPIDER_CONN_KIND_MYSQL)) ) { - if ( - share->monitoring_kind[link_idx] && - need_mons[link_idx] - ) { - error_num2 = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - link_idx, - (uint32) share->monitoring_sid[link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[link_idx], - NULL, - 0, - share->monitoring_kind[link_idx], - share->monitoring_limit[link_idx], - share->monitoring_flag[link_idx], - TRUE - ); - } - error_num = error_num2; + error_num= spider_maybe_ping_1(this, link_idx, error_num); } spider_clear_bit(m_handler_opened, link_idx); if (release_conn && !conns[link_idx]->join_trx) @@ -10914,28 +9976,7 @@ int ha_spider::index_handler_init() conns[roop_count] , roop_count)) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(error_num); + DBUG_RETURN(spider_maybe_ping_1(this, roop_count, error_num)); } set_handler_opened(roop_count); } @@ -11000,28 +10041,7 @@ int ha_spider::rnd_handler_init() conns[roop_count] , roop_count)) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(error_num); + DBUG_RETURN(spider_maybe_ping_1(this, roop_count, error_num)); } set_handler_opened(roop_count); spider_db_handler *dbton_hdl= @@ -13185,28 +12205,7 @@ int ha_spider::lock_tables() conns[roop_count], roop_count))) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } reset_first_link_idx(); } @@ -13216,29 +12215,8 @@ int ha_spider::lock_tables() conns[roop_count]->db_conn->have_lock_table_list() && (error_num = spider_db_lock_tables(this, roop_count)) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } conns[roop_count]->table_lock = 0; - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } if (conns[roop_count]->table_lock == 2) conns[roop_count]->table_lock = 1; @@ -13252,28 +12230,7 @@ int ha_spider::lock_tables() conns[roop_count]->disable_reconnect = FALSE; if ((error_num = spider_db_unlock_tables(this, roop_count))) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } } } @@ -13323,28 +12280,7 @@ int ha_spider::dml_init() conns[roop_count], roop_count))) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - trx, - trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } reset_first_link_idx(); if ( @@ -13361,28 +12297,7 @@ int ha_spider::dml_init() if ((error_num = spider_check_and_set_trx_isolation( conns[roop_count], &need_mons[roop_count]))) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - trx, - trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } } conns[roop_count]->semi_trx_isolation = -1; From cc0faa1e3ea140135097bfc298d5a8b9d833dd9e Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 19 Jun 2024 12:05:09 +0800 Subject: [PATCH 079/185] MDEV-31788 Factor functions to reduce duplication around spider_check_and_init_casual_read in ha_spider.cc factored out static functions: - spider_prep_loop - spider_start_bg - spider_send_queries --- storage/spider/ha_spider.cc | 798 ++++++++---------------------------- 1 file changed, 160 insertions(+), 638 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 140a5873034..1eb0dc6e53f 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1440,15 +1440,117 @@ static int spider_maybe_ping_1(ha_spider *spider, return error_num; } +static void spider_prep_loop(ha_spider *spider, int *roop_start, int *roop_end, int *link_ok) +{ + int lock_mode = spider_conn_lock_mode(spider); + if (lock_mode) + { + /* "for update" or "lock in share mode" */ + *link_ok = spider_conn_link_idx_next(spider->share->link_statuses, + spider->conn_link_idx, -1, spider->share->link_count, + SPIDER_LINK_STATUS_OK); + *roop_start = spider_conn_link_idx_next(spider->share->link_statuses, + spider->conn_link_idx, -1, spider->share->link_count, + SPIDER_LINK_STATUS_RECOVERY); + *roop_end = spider->share->link_count; + } else { + *link_ok = spider->search_link_idx; + *roop_start = spider->search_link_idx; + *roop_end = spider->search_link_idx + 1; + } +} + +#ifndef WITHOUT_SPIDER_BG_SEARCH +/* Returns true if the caller should return *error_num */ +static bool spider_start_bg(ha_spider* spider, int roop_count, int roop_start, int link_ok, int *error_num) +{ + if ((*error_num = spider_check_and_init_casual_read( + spider->wide_handler->trx->thd, spider, + roop_count))) + return true; + if ((*error_num = spider_bg_conn_search(spider, roop_count, roop_start, + TRUE, FALSE, (roop_count != link_ok)))) + { + if ( + *error_num != HA_ERR_END_OF_FILE + ) { + *error_num= spider_maybe_ping(spider, roop_count, *error_num); + return true; + } + *error_num= spider->check_error_mode_eof(*error_num); + return true; + } + return false; +} +#endif + +/* Updates error_num. Returning true if the caller should return. */ +static bool spider_send_query(ha_spider *spider, TABLE *table, int link_idx, int link_ok, int *error_num) +{ + ulong sql_type; + SPIDER_CONN *conn = spider->conns[link_idx]; + if (spider->sql_kind[link_idx] == SPIDER_SQL_KIND_SQL) + { + sql_type = SPIDER_SQL_TYPE_SELECT_SQL; + } else { + sql_type = SPIDER_SQL_TYPE_HANDLER; + } + spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; + if ((*error_num = dbton_hdl->set_sql_for_exec(sql_type, link_idx))) + { + return true; + } + DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); + if ((*error_num = spider_db_set_names(spider, conn, + link_idx))) + { + spider_unlock_after_query(conn, 0); + *error_num= spider_maybe_ping(spider, link_idx, *error_num); + return true; + } + spider_conn_set_timeout_from_share(conn, link_idx, + spider->wide_handler->trx->thd, spider->share); + if (dbton_hdl->execute_sql( + sql_type, + conn, + spider->result_list.quick_mode, + &spider->need_mons[link_idx]) + ) { + *error_num= spider_unlock_after_query_1(conn); + *error_num= (spider_maybe_ping(spider, link_idx, *error_num)); + return true; + } + spider->connection_ids[link_idx] = conn->connection_id; + if (link_idx == link_ok) + { + if ((*error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) + { + if ( + *error_num != HA_ERR_END_OF_FILE + ) { + *error_num= spider_maybe_ping(spider, link_idx, *error_num); + return true; + } + *error_num= spider->check_error_mode_eof(*error_num); + return true; + } + spider->result_link_idx = link_ok; + } else { + spider_db_discard_result(spider, link_idx, conn); + spider_unlock_after_query(conn, 0); + } + return false; +} + int ha_spider::index_read_map_internal( uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag ) { - int error_num, roop_count; + int error_num; key_range start_key; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_read_map_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -1570,24 +1672,8 @@ int ha_spider::index_read_map_internal( } } - /* Query execution */ - int roop_start, roop_end, lock_mode, link_ok; - lock_mode = spider_conn_lock_mode(this); - if (lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -1596,71 +1682,12 @@ int ha_spider::index_read_map_internal( #ifndef WITHOUT_SPIDER_BG_SEARCH if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { #endif - ulong sql_type; - conn = conns[roop_count]; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -1726,7 +1753,6 @@ int ha_spider::index_read_last_map_internal( ) { int error_num; key_range start_key; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_read_last_map_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -1837,23 +1863,8 @@ int ha_spider::index_read_last_map_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -1862,71 +1873,12 @@ int ha_spider::index_read_last_map_internal( #ifndef WITHOUT_SPIDER_BG_SEARCH if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { #endif - ulong sql_type; - conn = conns[roop_count]; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -2043,7 +1995,6 @@ int ha_spider::index_first_internal( uchar *buf ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_first_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2152,97 +2103,22 @@ int ha_spider::index_first_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { #ifndef WITHOUT_SPIDER_BG_SEARCH - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { #endif - ulong sql_type; - conn = conns[roop_count]; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -2306,7 +2182,6 @@ int ha_spider::index_last_internal( uchar *buf ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_last_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2415,97 +2290,22 @@ int ha_spider::index_last_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { #ifndef WITHOUT_SPIDER_BG_SEARCH - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { #endif - ulong sql_type; - conn = conns[roop_count]; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -2606,7 +2406,6 @@ int ha_spider::read_range_first_internal( bool sorted ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::read_range_first_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2721,23 +2520,8 @@ int ha_spider::read_range_first_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -2746,71 +2530,12 @@ int ha_spider::read_range_first_internal( #ifndef WITHOUT_SPIDER_BG_SEARCH if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { #endif - ulong sql_type; - conn = conns[roop_count]; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -3226,23 +2951,8 @@ int ha_spider::read_multi_range_first_internal( } } - int roop_start, roop_end, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -3886,24 +3596,8 @@ int ha_spider::read_multi_range_first_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } - + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -4387,23 +4081,8 @@ int ha_spider::read_multi_range_next( } } - int roop_start, roop_end, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -5047,23 +4726,8 @@ int ha_spider::read_multi_range_next( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -5550,97 +5214,22 @@ int ha_spider::rnd_next_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { #ifndef WITHOUT_SPIDER_BG_SEARCH - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { #endif - SPIDER_CONN *conn = conns[roop_count]; - ulong sql_type; - if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL) - { - sql_type = SPIDER_SQL_TYPE_SELECT_SQL; - } else { - sql_type = SPIDER_SQL_TYPE_HANDLER; - } - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -6077,89 +5666,22 @@ int ha_spider::ft_read_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { #ifndef WITHOUT_SPIDER_BG_SEARCH - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { #endif - uint dbton_id = share->sql_dbton_ids[roop_count]; - spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; - SPIDER_CONN *conn = conns[roop_count]; - if ((error_num = dbton_hdl->set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL, roop_count))) - { - DBUG_RETURN(error_num); - } - spider_lock_before_query(conn, &need_mons[roop_count]); - if ((error_num = spider_db_set_names(this, conn, roop_count))) - { - spider_unlock_after_query(conn, 0); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - SPIDER_SQL_TYPE_SELECT_SQL, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - error_num= spider_unlock_after_query_1(conn); - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - connection_ids[roop_count] = conn->connection_id; - if (roop_count == link_ok) - { - if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE - ) { - DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - spider_unlock_after_query(conn, 0); - } + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif From 2496779d6939f6ef6257cf56689ae2d2b85729fe Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 23 Jul 2024 13:30:17 +1000 Subject: [PATCH 080/185] MDEV-34617 galera.galera_ist_mariabackup_verify_ca fails on FreeBSD Was failing because innodb-log-file-buffering is a Linux/Windows only variable. This was introduced in MDEV-33787 to enforce O_DIRECT on Linux. --- .../suite/galera/t/galera_ist_mariabackup_verify_ca.cnf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf index ffd2306bfb3..d1d3b4eb9cd 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf @@ -10,11 +10,11 @@ ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' -innodb-log-file-buffering +loose-innodb-log-file-buffering [sst] ssl-mode=VERIFY_CA From 02b30044aa36eb0d99752da3026d14fa21da1e44 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 11 Sep 2024 13:37:40 +1000 Subject: [PATCH 081/185] MDEV-34650 main.having_cond_pushdown test failure - crash server (s390x) The 10.5->10.6 merge commit 3bc98a4ec4e casts the arg to an int16 pointer in set_extraction_flag_processor(). This matched the previous commit c76eabfb5e3 where set_extraction_flag was changed to have int16 arg instead of int. The commit a5e4c34991e for MDEV-29363 added a call to set_extraction_flag_processor on IMMUTABLE_FL (MARKER_IMMUTABLE in 10.6). The subsequent 10.5->10.6 merge f071b7620b2 did not cast the flag to int16 when merging this change. The result is big-endian processors cleared the immutable flag rather than set the flag, resulting in MDEV-29363 being unfixed on big-endian processors. --- sql/item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item.cc b/sql/item.cc index 41fec9096f8..20289c317a3 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1295,7 +1295,7 @@ Item *Item::multiple_equality_transformer(THD *thd, uchar *arg) This flag will be removed at the end of the pushdown optimization by remove_immutable_flag_processor processor. */ - int new_flag= MARKER_IMMUTABLE; + int16 new_flag= MARKER_IMMUTABLE; this->walk(&Item::set_extraction_flag_processor, false, (void*)&new_flag); } From c6eadc40877f4b5d2d164a87db5b8b372926ea8d Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 11 Sep 2024 14:07:32 +0300 Subject: [PATCH 082/185] Fix main.order_by_join_limit on x86-debian-12: Mask the cost numbers. --- .../include/optimizer_trace_no_costs.inc | 11 ++++++++++ mysql-test/main/order_by_limit_join.result | 20 +++++++++---------- mysql-test/main/order_by_limit_join.test | 6 ++++++ 3 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 mysql-test/include/optimizer_trace_no_costs.inc diff --git a/mysql-test/include/optimizer_trace_no_costs.inc b/mysql-test/include/optimizer_trace_no_costs.inc new file mode 100644 index 00000000000..540ce06e685 --- /dev/null +++ b/mysql-test/include/optimizer_trace_no_costs.inc @@ -0,0 +1,11 @@ +# Mask the cost value from any field that looks like +# "xxx_cost" : double_number +# Print the +# "xxx_cost" : "REPLACED" +# instead +--replace_regex /(_cost": )[0-9.e-]+/\1"REPLACED"/ +#--replace_regex /(_cost": )[0-9.e-]+/"REPLACED"/ +#--replace_regex /[0-9]+/BBB/ + +#--replace_regex /("r_engine_stats":) {[^}]*}/\1 REPLACED/ + diff --git a/mysql-test/main/order_by_limit_join.result b/mysql-test/main/order_by_limit_join.result index 3f48aa3f65f..2b9fb6b97da 100644 --- a/mysql-test/main/order_by_limit_join.result +++ b/mysql-test/main/order_by_limit_join.result @@ -108,9 +108,9 @@ JS } ], "can_skip_filesort": true, - "full_join_cost": 46064.98442, + "full_join_cost": "REPLACED", "risk_ratio": 10, - "shortcut_join_cost": 97.28224614, + "shortcut_join_cost": "REPLACED", "shortcut_cost_with_risk": 972.8224614, "use_shortcut_cost": true } @@ -160,9 +160,9 @@ JS "test_if_skip_sort_order_early": [], "can_skip_filesort": false, - "full_join_cost": 46064.98442, + "full_join_cost": "REPLACED", "risk_ratio": 10, - "shortcut_join_cost": 2097.281246, + "shortcut_join_cost": "REPLACED", "shortcut_cost_with_risk": 20972.81246, "use_shortcut_cost": true } @@ -244,9 +244,9 @@ JS } ], "can_skip_filesort": false, - "full_join_cost": 46064.98442, + "full_join_cost": "REPLACED", "risk_ratio": 10, - "shortcut_join_cost": 24059.12698, + "shortcut_join_cost": "REPLACED", "shortcut_cost_with_risk": 240591.2698, "use_shortcut_cost": false } @@ -363,9 +363,9 @@ JS } ], "can_skip_filesort": true, - "full_join_cost": 47079.71684, + "full_join_cost": "REPLACED", "risk_ratio": 10, - "shortcut_join_cost": 98.29697856, + "shortcut_join_cost": "REPLACED", "shortcut_cost_with_risk": 982.9697856, "use_shortcut_cost": true } @@ -448,9 +448,9 @@ JS } ], "can_skip_filesort": true, - "full_join_cost": 46064.98442, + "full_join_cost": "REPLACED", "risk_ratio": 10, - "shortcut_join_cost": 97.28224614, + "shortcut_join_cost": "REPLACED", "shortcut_cost_with_risk": 972.8224614, "use_shortcut_cost": true } diff --git a/mysql-test/main/order_by_limit_join.test b/mysql-test/main/order_by_limit_join.test index da05cdc30c3..3b60581871c 100644 --- a/mysql-test/main/order_by_limit_join.test +++ b/mysql-test/main/order_by_limit_join.test @@ -68,6 +68,7 @@ set optimizer_join_limit_pref_ratio=10; eval $query; set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; --echo # @@ -95,6 +96,7 @@ set optimizer_join_limit_pref_ratio=10; eval $query; set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; --echo # @@ -121,6 +123,7 @@ set optimizer_join_limit_pref_ratio=10; eval $query; set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; --echo # @@ -140,6 +143,7 @@ limit 10; set @trace=(select trace from information_schema.optimizer_trace); --echo # This will show nothing as limit shortcut code figures that --echo # it's not possible to use t1 to construct shortcuts: +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; --echo # @@ -169,6 +173,7 @@ set optimizer_join_limit_pref_ratio=10; eval $query; set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; --echo # @@ -197,6 +202,7 @@ set optimizer_join_limit_pref_ratio=10; eval $query; set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; From 3ae4ecbfc5744625cba57a52d6ecc8d9af1f63b2 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 10 Sep 2024 15:52:13 +0300 Subject: [PATCH 083/185] MDEV-34867 engine S3 cause 500 error for huawei buckets Add support for removing the Content-Type header to the S3 engine. This is required for compatibility with some S3 providers. This also adds a provider option to the S3 engine which will turn on relevant compatibility options for specific providers. This was required for getting MariaDB S3 engine to work with "Huawei Cloud S3". To get Huawei S3 storage to work on has set one of the following S3 options: s3_provider=Huawei s3_ssl_no_verify=1 Author: Andrew Hutchings --- mysql-test/suite/s3/basic.result | 3 +++ mysql-test/suite/s3/my.cnf | 2 ++ mysql-test/suite/s3/slave.cnf | 2 ++ mysql-test/suite/s3/suite.pm | 13 +++++++++++++ storage/maria/aria_s3_copy.cc | 32 ++++++++++++++++++++++++++++++++ storage/maria/ha_s3.cc | 23 ++++++++++++++++++++++- storage/maria/libmarias3 | 2 +- storage/maria/s3_func.c | 23 +++++++++++++++++++++++ storage/maria/s3_func.h | 5 +++++ 9 files changed, 103 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/s3/basic.result b/mysql-test/suite/s3/basic.result index 790806ee43c..47c35d8cfbe 100644 --- a/mysql-test/suite/s3/basic.result +++ b/mysql-test/suite/s3/basic.result @@ -130,16 +130,19 @@ s3_block_size X s3_bucket X s3_debug X s3_host_name X +s3_no_content_type X s3_pagecache_age_threshold X s3_pagecache_buffer_size X s3_pagecache_division_limit X s3_pagecache_file_hash_size X s3_port X s3_protocol_version X +s3_provider X s3_region X s3_replicate_alter_as_create_select X s3_secret_key X s3_slave_ignore_updates X +s3_ssl_no_verify X s3_use_http X show variables like "s3_slave%"; Variable_name Value diff --git a/mysql-test/suite/s3/my.cnf b/mysql-test/suite/s3/my.cnf index f851aa18d6d..4f4049cf89b 100644 --- a/mysql-test/suite/s3/my.cnf +++ b/mysql-test/suite/s3/my.cnf @@ -12,6 +12,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY s3-region=@ENV.S3_REGION s3-port=@ENV.S3_PORT s3-use-http=@ENV.S3_USE_HTTP +s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY +s3-provider=@ENV.S3_PROVIDER #s3-host-name=s3.amazonaws.com #s3-protocol-version=Amazon diff --git a/mysql-test/suite/s3/slave.cnf b/mysql-test/suite/s3/slave.cnf index 4f4d3d39ac7..729a48c49eb 100644 --- a/mysql-test/suite/s3/slave.cnf +++ b/mysql-test/suite/s3/slave.cnf @@ -10,6 +10,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY s3-region=@ENV.S3_REGION s3-port=@ENV.S3_PORT s3-use-http=@ENV.S3_USE_HTTP +s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY +s3-provider=@ENV.S3_PROVIDER # You can change the following when running the tests against # your own S3 setup diff --git a/mysql-test/suite/s3/suite.pm b/mysql-test/suite/s3/suite.pm index cdefbc5e323..383bf4f7798 100644 --- a/mysql-test/suite/s3/suite.pm +++ b/mysql-test/suite/s3/suite.pm @@ -20,6 +20,8 @@ if(connect(SOCK, $paddr)) $ENV{'S3_REGION'} = ""; $ENV{'S3_PROTOCOL_VERSION'} = "Auto"; $ENV{'S3_USE_HTTP'} = "ON"; + $ENV{'S3_SSL_NO_VERIFY'} = "OFF"; + $ENV{'S3_PROVIDER'} = "Default"; } else { @@ -62,6 +64,17 @@ else { $ENV{'S3_USE_HTTP'} = "OFF"; } + + if (!$ENV{'S3_SSL_NO_VERIFY'}) + { + $ENV{'S3_SSL_NO_VERIFY'} = "OFF"; + } + + if (!$ENV{'S3_PROVIDER'}) + { + $ENV{'S3_PROVIDER'} = "Default"; + } + } bless { }; diff --git a/storage/maria/aria_s3_copy.cc b/storage/maria/aria_s3_copy.cc index b8a0f5b7921..1b0063c21f8 100644 --- a/storage/maria/aria_s3_copy.cc +++ b/storage/maria/aria_s3_copy.cc @@ -41,7 +41,10 @@ static const char *opt_database; static const char *opt_s3_bucket="MariaDB"; static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug; static my_bool opt_s3_use_http; +static my_bool opt_s3_ssl_no_verify; +static my_bool opt_s3_no_content_type; static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1; +static ulong opt_provider= 0; static ulong opt_block_size; static ulong opt_s3_port; static char **default_argv=0; @@ -73,6 +76,13 @@ static struct my_option my_long_options[] = {"s3_use_http", 'P', "If true, force use of HTTP protocol", (char**) &opt_s3_use_http, (char**) &opt_s3_use_http, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_ssl_no_verify", 's', "If true, verification of the S3 endpoint SSL " + "certificate is disabled", + (char**) &opt_s3_ssl_no_verify, (char**) &opt_s3_ssl_no_verify, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_no_content_type", 'n', "If true, disables the Content-Type header", + (char**) &opt_s3_no_content_type, (char**) &opt_s3_no_content_type, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'c', "Use compression", &opt_compression, &opt_compression, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or " @@ -92,6 +102,10 @@ static struct my_option my_long_options[] = "Note: \"Legacy\", \"Original\" and \"Amazon\" are deprecated.", &opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_provider", 'R', "Enable S3 provider specific compatibility tweaks " + "\"Default\", \"Amazon\", or \"Huawei\".", + &opt_provider, &opt_provider, &s3_provider_typelib, + GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force copy even if target exists", &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Write more information", &opt_verbose, &opt_verbose, @@ -220,6 +234,19 @@ int main(int argc, char** argv) ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size); + /* Provider specific overrides */ + switch (opt_provider) + { + case 0: /* Default */ + break; + case 1: /* Amazon */ + opt_protocol_version = 5; + break; + case 2: /* Huawei */ + opt_s3_no_content_type = 1; + break; + } + if (opt_protocol_version > 2) { uint8_t protocol_version; @@ -245,6 +272,11 @@ int main(int argc, char** argv) if (opt_s3_use_http) ms3_set_option(global_s3_client, MS3_OPT_USE_HTTP, NULL); + if (opt_s3_ssl_no_verify) + ms3_set_option(global_s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL); + + if (opt_s3_no_content_type) + ms3_set_option(global_s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL); for (; *argv ; argv++) { diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 276703cfaea..e911bdbe242 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -78,7 +78,7 @@ #define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com" static PAGECACHE s3_pagecache; -static ulong s3_block_size, s3_protocol_version; +static ulong s3_block_size, s3_protocol_version, s3_provider; static ulong s3_pagecache_division_limit, s3_pagecache_age_threshold; static ulong s3_pagecache_file_hash_size; static ulonglong s3_pagecache_buffer_size; @@ -86,6 +86,8 @@ static char *s3_bucket, *s3_access_key=0, *s3_secret_key=0, *s3_region; static char *s3_host_name; static int s3_port; static my_bool s3_use_http; +static my_bool s3_ssl_no_verify; +static my_bool s3_no_content_type; static char *s3_tmp_access_key=0, *s3_tmp_secret_key=0; static my_bool s3_debug= 0, s3_slave_ignore_updates= 0; static my_bool s3_replicate_alter_as_create_select= 0; @@ -222,6 +224,10 @@ static MYSQL_SYSVAR_BOOL(use_http, s3_use_http, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "If true, force use of HTTP protocol", NULL /*check*/, NULL /*update*/, 0 /*default*/); +static MYSQL_SYSVAR_BOOL(ssl_no_verify, s3_ssl_no_verify, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "If true, SSL certificate verifiction for the S3 endpoint is disabled", + NULL, NULL, 0); static MYSQL_SYSVAR_STR(access_key, s3_tmp_access_key, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, "AWS access key", @@ -234,6 +240,15 @@ static MYSQL_SYSVAR_STR(region, s3_region, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "AWS region", 0, 0, ""); +static MYSQL_SYSVAR_BOOL(no_content_type, s3_no_content_type, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "If true, disables the Content-Type header, required for some providers", + NULL, NULL, 0); +static MYSQL_SYSVAR_ENUM(provider, s3_provider, + PLUGIN_VAR_RQCMDARG, + "Enable S3 provider specific compatibility tweaks " + "\"Default\", \"Amazon\", or \"Huawei\". ", + NULL, NULL, 0, &s3_provider_typelib); ha_create_table_option s3_table_option_list[]= { @@ -319,6 +334,9 @@ static my_bool s3_info_init(S3_INFO *info) lex_string_set(&info->host_name, s3_host_name); info->port= s3_port; info->use_http= s3_use_http; + info->ssl_no_verify= s3_ssl_no_verify; + info->no_content_type = s3_no_content_type; + info->provider= s3_provider; lex_string_set(&info->access_key, s3_access_key); lex_string_set(&info->secret_key, s3_secret_key); lex_string_set(&info->region, s3_region); @@ -1120,12 +1138,15 @@ static struct st_mysql_sys_var* system_variables[]= { MYSQL_SYSVAR(host_name), MYSQL_SYSVAR(port), MYSQL_SYSVAR(use_http), + MYSQL_SYSVAR(ssl_no_verify), MYSQL_SYSVAR(bucket), MYSQL_SYSVAR(access_key), MYSQL_SYSVAR(secret_key), MYSQL_SYSVAR(region), MYSQL_SYSVAR(slave_ignore_updates), MYSQL_SYSVAR(replicate_alter_as_create_select), + MYSQL_SYSVAR(no_content_type), + MYSQL_SYSVAR(provider), NULL }; diff --git a/storage/maria/libmarias3 b/storage/maria/libmarias3 index a81724ab07b..5e6aa32f96e 160000 --- a/storage/maria/libmarias3 +++ b/storage/maria/libmarias3 @@ -1 +1 @@ -Subproject commit a81724ab07bd28e16bf431419c24b6362d5894fc +Subproject commit 5e6aa32f96ebdbcaf32b90d6182685156f8198b5 diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c index d85dc8a0b40..b8918c48d4b 100644 --- a/storage/maria/s3_func.c +++ b/storage/maria/s3_func.c @@ -43,6 +43,9 @@ static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "P TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"", protocol_types, NULL}; +static const char *providers[]= {"Default", "Amazon", "Huawei", NullS}; +TYPELIB s3_provider_typelib = {array_elements(providers)-1,"",providers, NULL}; + /****************************************************************************** Allocations handler for libmarias3 To be removed when we do the init allocation in mysqld.cc @@ -154,6 +157,20 @@ ms3_st *s3_open_connection(S3_INFO *s3) errno, ms3_error(errno)); my_errno= HA_ERR_NO_SUCH_TABLE; } + + /* Provider specific overrides */ + switch (s3->provider) + { + case 0: /* Default */ + break; + case 1: /* Amazon */ + s3->protocol_version = 5; + break; + case 2: /* Huawei */ + s3->no_content_type = 1; + break; + } + if (s3->protocol_version > 2) { uint8_t protocol_version; @@ -177,6 +194,12 @@ ms3_st *s3_open_connection(S3_INFO *s3) if (s3->use_http) ms3_set_option(s3_client, MS3_OPT_USE_HTTP, NULL); + if (s3->ssl_no_verify) + ms3_set_option(s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL); + + if (s3->no_content_type) + ms3_set_option(s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL); + return s3_client; } diff --git a/storage/maria/s3_func.h b/storage/maria/s3_func.h index f73a95dea24..9c0831b158d 100644 --- a/storage/maria/s3_func.h +++ b/storage/maria/s3_func.h @@ -38,6 +38,7 @@ extern struct s3_func { } s3f; extern TYPELIB s3_protocol_typelib; +extern TYPELIB s3_provider_typelib; /* Store information about a s3 connection */ @@ -47,6 +48,8 @@ struct s3_info LEX_CSTRING access_key, secret_key, region, bucket, host_name; int port; // 0 means 'Use default' my_bool use_http; + my_bool ssl_no_verify; + my_bool no_content_type; /* Will be set by caller or by ma_open() */ LEX_CSTRING database, table; @@ -63,6 +66,8 @@ struct s3_info /* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */ uint8_t protocol_version; + + uint8_t provider; }; From fafcd24e023c059b4f93453bf00d7429b76de4ce Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 10 Sep 2024 19:57:51 +0300 Subject: [PATCH 084/185] Fixed compiler warning from strncpy in mysql_plugin.c --- client/mysql_plugin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 27ec0bc55e9..d025de60c62 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -738,8 +738,8 @@ static int check_options(int argc, char **argv, char *operation) { int i= 0; /* loop counter */ int num_found= 0; /* number of options found (shortcut loop) */ - char config_file[FN_REFLEN]; /* configuration file name */ - char plugin_name[FN_REFLEN]; /* plugin name */ + char config_file[FN_REFLEN+1]; /* configuration file name */ + char plugin_name[FN_REFLEN+1]; /* plugin name */ /* Form prefix strings for the options. */ const char *basedir_prefix = "--basedir="; @@ -787,8 +787,8 @@ static int check_options(int argc, char **argv, char *operation) /* read the plugin config file and check for match against argument */ else { - if (safe_strcpy_truncated(plugin_name, sizeof plugin_name, argv[i]) || - safe_strcpy_truncated(config_file, sizeof config_file, argv[i]) || + if (safe_strcpy_truncated(plugin_name, sizeof(plugin_name)-1, argv[i]) || + safe_strcpy_truncated(config_file, sizeof(config_file)-1, argv[i]) || safe_strcat(config_file, sizeof(config_file), ".ini")) { fprintf(stderr, "ERROR: argument is too long.\n"); From f168050e900c834f7ae1ac13d47983e79bf9a517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Sep 2024 10:52:12 +0300 Subject: [PATCH 085/185] MDEV-34791 fixup: Avoid an infinite loop with ROW_FORMAT=COMPRESSED buf_pool_t::page_fix(): If a change buffer merge may be needed on a ROW_FORMAT=COMPRESSED page that exists in compressed-only format in the buffer pool, go ahead to decompress the block. This fixes an infinite loop. Reviewed by: Debarun Banerjee --- storage/innobase/buf/buf0buf.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 580e004ab3b..99143e810ed 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2608,7 +2608,10 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, return reinterpret_cast(-1); } - if (UNIV_UNLIKELY(!b->frame)) + if (UNIV_LIKELY(b->frame != nullptr)); + else if (state < buf_page_t::READ_FIX) + goto unzip; + else { wait_for_unzip: b->unfix(); @@ -2629,6 +2632,7 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, if (UNIV_UNLIKELY(!b->frame)) { + unzip: if (b->lock.x_lock_try()); else if (c == FIX_NOWAIT) goto would_block; From a74bea7ba99a8c215cf085ff7a9dd4bdabab51e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Sep 2024 10:52:55 +0300 Subject: [PATCH 086/185] MDEV-34879 InnoDB fails to merge the change buffer to ROW_FORMAT=COMPRESSED tables buf_page_t::read_complete(): Fix an incorrect condition that had been added in commit aaef2e1d8c843d1e40b1ce0c5199c3abb3c5da28 (MDEV-27058). Also for compressed-only pages we must remember that buffered changes may exist. buf_read_page(): Correct the function comment; this is for a synchronous and not asynchronous read. Pass the parameter unzip=true to buf_read_page_low(), because each of our callers will be interested in the uncompressed page frame. This will cause the test encryption.innodb-compressed-blob to emit more errors when the correct keys for decrypting the clustered index root page are unavailable. Reviewed by: Debarun Banerjee --- .../r/innodb-compressed-blob.result | 4 +++- .../encryption/t/innodb-compressed-blob.test | 4 +++- storage/innobase/buf/buf0buf.cc | 2 +- storage/innobase/buf/buf0rea.cc | 22 ++++++------------- storage/innobase/include/buf0rea.h | 6 ++--- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result index 0dc873b99ab..f1b75b05219 100644 --- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result +++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result @@ -1,6 +1,8 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted; key_version=1"); call mtr.add_suppression("InnoDB: Recovery failed to read page"); -call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[12]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test/t[12]\\.ibd' page \\[page id: space=[1-9][0-9]*, page number=3\\]"); +call mtr.add_suppression("InnoDB: File '.*test/t[12]\\.ibd' is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); # Restart mysqld --file-key-management-filename=keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test index 12d061a852f..a47db8e64e2 100644 --- a/mysql-test/suite/encryption/t/innodb-compressed-blob.test +++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test @@ -6,7 +6,9 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted; key_version=1"); call mtr.add_suppression("InnoDB: Recovery failed to read page"); -call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[12]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test/t[12]\\.ibd' page \\[page id: space=[1-9][0-9]*, page number=3\\]"); +call mtr.add_suppression("InnoDB: File '.*test/t[12]\\.ibd' is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); --echo # Restart mysqld --file-key-management-filename=keys2.txt diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 99143e810ed..7796d1dfa00 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3769,7 +3769,7 @@ release_page: if (recovery && !recv_recover_page(node.space, this)) return DB_PAGE_CORRUPTED; - const bool ibuf_may_exist= frame && !recv_no_ibuf_operations && + const bool ibuf_may_exist= !recv_no_ibuf_operations && (!expected_id.space() || !is_predefined_tablespace(expected_id.space())) && fil_page_get_type(read_frame) == FIL_PAGE_INDEX && page_is_leaf(read_frame); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index f05bb96aaa0..6e509b77141 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -449,30 +449,22 @@ read_ahead: return count; } -/** High-level function which reads a page from a file to buf_pool -if it is not already there. Sets the io_fix and an exclusive lock -on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. -@param[in] page_id page id -@retval DB_SUCCESS if the page was read and is not corrupted -@retval DB_SUCCESS_LOCKED_REC if the page was not read -@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted -@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ dberr_t buf_read_page(const page_id_t page_id) { fil_space_t *space= fil_space_t::get(page_id.space()); - if (!space) + if (UNIV_UNLIKELY(!space)) { - ib::info() << "trying to read page " << page_id - << " in nonexisting or being-dropped tablespace"; + sql_print_information("InnoDB: trying to read page " + "[page id: space=" UINT32PF + ", page number=" UINT32PF "]" + " in nonexisting or being-dropped tablespace", + page_id.space(), page_id.page_no()); return DB_TABLESPACE_DELETED; } buf_LRU_stat_inc_io(); /* NOT protected by buf_pool.mutex */ return buf_read_page_low(space, true, BUF_READ_ANY_PAGE, - page_id, space->zip_size(), false); + page_id, space->zip_size(), true); } /** High-level function which reads a page asynchronously from a file to the diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 32296720c79..36d1bb132d7 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -29,10 +29,8 @@ Created 11/5/1995 Heikki Tuuri #include "buf0buf.h" -/** High-level function which reads a page asynchronously from a file to the -buffer buf_pool if it is not already there. Sets the io_fix flag and sets -an exclusive lock on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. +/** Read a page synchronously from a file. buf_page_t::read_complete() +will be invoked on read completion. @param page_id page id @retval DB_SUCCESS if the page was read and is not corrupted @retval DB_SUCCESS_LOCKED_REC if the page was not read From 242b67f1ded480ba97384fdd2a5e36340e402b82 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Fri, 12 Jul 2024 09:15:19 -0400 Subject: [PATCH 087/185] MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-condition Emit a warning in the event that we finished processing input files before reaching the boundary indicated by --stop-position. --- client/mysqlbinlog.cc | 20 +++++++++++--- ...nlog_mysqlbinlog_warn_stop_position.result | 13 ++++++++++ ...binlog_mysqlbinlog_warn_stop_position.test | 26 +++++++++++++++++++ 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_position.result create mode 100644 mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_position.test diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 3621a3dfef5..ba40e7d597b 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -142,6 +142,7 @@ static char *charset= 0; static uint verbose= 0; static ulonglong start_position, stop_position; +static const longlong stop_position_default= (longlong)(~(my_off_t)0); #define start_position_mot ((my_off_t)start_position) #define stop_position_mot ((my_off_t)stop_position) @@ -1684,8 +1685,8 @@ static struct my_option my_options[] = "Stop reading the binlog at position N. Applies to the last binlog " "passed on the command line.", &stop_position, &stop_position, 0, GET_ULL, - REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE, - (ulonglong)(~(my_off_t)0), 0, 0, 0}, + REQUIRED_ARG, stop_position_default, BIN_LOG_HEADER_SIZE, + (ulonglong)stop_position_default, 0, 0, 0}, {"table", 'T', "List entries for just this table (affects only row events).", &table, &table, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -2937,7 +2938,20 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, llstr(old_off,llbuff)); goto err; } - // file->error == 0 means EOF, that's OK, we break in this case + // else file->error == 0 means EOF, that's OK, we break in this case + + /* + Emit a warning in the event that we finished processing input + before reaching the boundary indicated by --stop-position. + */ + if (((longlong)stop_position != stop_position_default) && + stop_position > my_b_tell(file)) + { + retval = OK_STOP; + warning("Did not reach stop position %llu before " + "end of input", stop_position); + } + goto end; } if ((retval= process_event(print_event_info, ev, old_off, logname)) != diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_position.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_position.result new file mode 100644 index 00000000000..5b99d30bd84 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_position.result @@ -0,0 +1,13 @@ + +# MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-condition + +Case: Default stop position, WARNING must not appear +# MYSQL_BINLOG --short-form --start-position=4 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +Case: Stop position before EOF, WARNING must not appear +# MYSQL_BINLOG --short-form --start-position=4 --stop-position=97 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +Case: Stop position at EOF, WARNING must not appear +# MYSQL_BINLOG --short-form --start-position=4 --stop-position=98 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +Case: Stop position after EOF, WARNING must appear +# MYSQL_BINLOG --short-form --start-position=4 --stop-position=99 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +WARNING: Did not reach stop position 99 before end of input +# End of binlog_mysqlbinlog_warn_stop_position.test diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_position.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_position.test new file mode 100644 index 00000000000..97fabfc6513 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_position.test @@ -0,0 +1,26 @@ +--echo +--echo # MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-condition +--echo + +--let assert_file= $MYSQLTEST_VARDIR/tmp/warn_pos_test_file.out +--let data_file= $MYSQLTEST_VARDIR/std_data/master-bin.000001 + +--echo Case: Default stop position, WARNING must not appear +--echo # MYSQL_BINLOG --short-form --start-position=4 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +--exec $MYSQL_BINLOG --short-form --start-position=4 $data_file --result-file=$assert_file 2>&1 + +--echo Case: Stop position before EOF, WARNING must not appear +--echo # MYSQL_BINLOG --short-form --start-position=4 --stop-position=97 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +--exec $MYSQL_BINLOG --short-form --start-position=4 --stop-position=97 $data_file --result-file=$assert_file 2>&1 + +--echo Case: Stop position at EOF, WARNING must not appear +--echo # MYSQL_BINLOG --short-form --start-position=4 --stop-position=98 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +--exec $MYSQL_BINLOG --short-form --start-position=4 --stop-position=98 $data_file --result-file=$assert_file 2>&1 + +--echo Case: Stop position after EOF, WARNING must appear +--echo # MYSQL_BINLOG --short-form --start-position=4 --stop-position=99 mysql-test/std_data/master-bin.000001 --result-file=warn_pos_test_file.out 2>&1 +--exec $MYSQL_BINLOG --short-form --start-position=4 --stop-position=99 $data_file --result-file=$assert_file 2>&1 + +--remove_file $assert_file + +--echo # End of binlog_mysqlbinlog_warn_stop_position.test From 95885261f0ff70e563140f5fb94da134b84d79b4 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Mon, 22 Jul 2024 11:13:06 -0400 Subject: [PATCH 088/185] MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-datetime Emit a warning in the event that we finished processing input files before reaching the boundary indicated by --stop-datetime. --- client/mysqlbinlog.cc | 14 +++++++ ...nlog_mysqlbinlog_warn_stop_datetime.result | 23 ++++++++++ ...binlog_mysqlbinlog_warn_stop_datetime.test | 42 +++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result create mode 100644 mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index ba40e7d597b..5762e3965b5 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2847,6 +2847,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, IO_CACHE cache,*file= &cache; uchar tmp_buff[BIN_LOG_HEADER_SIZE]; Exit_status retval= OK_CONTINUE; + my_time_t last_ev_when= MY_TIME_T_MAX; if (logname && strcmp(logname, "-") != 0) { @@ -2952,8 +2953,21 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, "end of input", stop_position); } + /* + Emit a warning in the event that we finished processing input + before reaching the boundary indicated by --stop-datetime. + */ + if (stop_datetime != MY_TIME_T_MAX && + stop_datetime > last_ev_when) + { + retval = OK_STOP; + warning("Did not reach stop datetime '%s' " + "before end of input", stop_datetime_str); + } + goto end; } + last_ev_when= ev->when; if ((retval= process_event(print_event_info, ev, old_off, logname)) != OK_CONTINUE) goto end; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result new file mode 100644 index 00000000000..6ce0f2d63e5 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result @@ -0,0 +1,23 @@ + +# MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-datetime + +set timestamp=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +set timestamp=1000000010; +INSERT INTO t1 VALUES ("abirvalg"); +set timestamp=1000000020; +INSERT INTO t1 SELECT * FROM t1; +flush logs; +Case: Default, must not see warning. +# MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime before EOF, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime between records, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime at EOF, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime after EOF, must see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +WARNING: Did not reach stop datetime '2035-01-19 03:14:05' before end of input +DROP TABLE t1; +# End of binlog_mysqlbinlog_warn_stop_datetime.test diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test new file mode 100644 index 00000000000..9d30544c5f4 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test @@ -0,0 +1,42 @@ +--echo +--echo # MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-datetime +--echo + +--source include/have_binlog_format_statement.inc + +--let ignored_output_file= $MYSQLTEST_VARDIR/tmp/warn_pos_test_file.out + +set timestamp=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +set timestamp=1000000010; +INSERT INTO t1 VALUES ("abirvalg"); +set timestamp=1000000020; +INSERT INTO t1 SELECT * FROM t1; +--let MYSQLD_DATADIR= `select @@datadir;` +flush logs; + +--echo Case: Default, must not see warning. +--echo # MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime before EOF, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime between records, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime at EOF, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime after EOF, must see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +DROP TABLE t1; + +--remove_file $ignored_output_file + +--echo # End of binlog_mysqlbinlog_warn_stop_datetime.test From 7fd73f9ac9da2f3d703b80edb93a81ec4ffc06b2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 6 Sep 2024 01:57:50 +0200 Subject: [PATCH 089/185] mariadb-import, multithreading - improve error handling In case of error in one connection, issue KILL CONNECTION for all others, or server will still do LOAD FILE, possibly for hours, after we exited. --- client/mysqlimport.cc | 78 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/client/mysqlimport.cc b/client/mysqlimport.cc index be60bade00c..1443cb1560c 100644 --- a/client/mysqlimport.cc +++ b/client/mysqlimport.cc @@ -45,6 +45,9 @@ #include tpool::thread_pool *thread_pool; +static std::vector all_tp_connections; +std::atomic aborting{false}; +static void kill_tp_connections(MYSQL *mysql); static void db_error_with_table(MYSQL *mysql, char *table); static void db_error(MYSQL *mysql); @@ -479,9 +482,12 @@ static int exec_sql(MYSQL *mysql, const std::string& s) { if (mysql_query(mysql, s.c_str())) { - fprintf(stdout,"Error: %d, %s, when using statement: %s\n", - mysql_errno(mysql), mysql_error(mysql), s.c_str()); - db_error(mysql); + if (!aborting) + { + fprintf(stdout, "Error: %d, %s, when using statement: %s\n", + mysql_errno(mysql), mysql_error(mysql), s.c_str()); + db_error(mysql); + } return 1; } return 0; @@ -582,6 +588,8 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql) DBUG_ENTER("handle_one_table"); DBUG_PRINT("enter",("datafile: %s",params->data_file.c_str())); + if (aborting) + return 1; if (verbose && !params->sql_file.empty()) { fprintf(stdout, "Executing SQL script %s\n", params->sql_file.c_str()); @@ -828,20 +836,34 @@ static void db_disconnect(char *host, MYSQL *mysql) static void safe_exit(int error, MYSQL *mysql) { + if (error && ignore_errors) return; - if (mysql) - mysql_close(mysql); + bool expected= false; + if (!aborting.compare_exchange_strong(expected, true)) + return; if (thread_pool) { /* dirty exit. some threads are running, - memory is not freed, openssl not deinitialized */ + memory is not freed, openssl not deinitialized */ DBUG_ASSERT(error); + if (mysql) + { + /* + We still need tell server to kill all connections + so it does not keep busy with load. + */ + kill_tp_connections(mysql); + } + _exit(error); } - + if (mysql) + { + mysql_close(mysql); + } mysql_library_end(); free_defaults(argv_to_free); my_free(opt_password); @@ -853,6 +875,8 @@ static void safe_exit(int error, MYSQL *mysql) static void db_error_with_table(MYSQL *mysql, char *table) { + if (aborting) + return; my_printf_error(0,"Error: %d, %s, when using table: %s", MYF(0), mysql_errno(mysql), mysql_error(mysql), table); safe_exit(1, mysql); @@ -947,16 +971,48 @@ void load_single_table(void *arg) set_exitcode(error); } +static void init_tp_connections(size_t n) +{ + for (size_t i= 0; i < n; i++) + { + MYSQL *mysql= + db_connect(current_host, current_db, current_user, opt_password); + all_tp_connections.push_back(mysql); + } +} + +static void close_tp_connections() +{ + for (auto &conn : all_tp_connections) + { + db_disconnect(current_host, conn); + } + all_tp_connections.clear(); +} + +/* + If we end with an error, in one connection, + we need to kill all others. + + Otherwise, server will still be busy with load, + when we already exited. +*/ +static void kill_tp_connections(MYSQL *mysql) +{ + for (auto &conn : all_tp_connections) + mysql_kill(mysql, mysql_thread_id(conn)); +} + static void tpool_thread_init(void) { mysql_thread_init(); - thread_local_mysql= db_connect(current_host,current_db,current_user,opt_password); + static std::atomic next_connection(0); + assert(next_connection < all_tp_connections.size()); + thread_local_mysql= all_tp_connections[next_connection++]; } static void tpool_thread_exit(void) { - if (thread_local_mysql) - db_disconnect(current_host,thread_local_mysql); mysql_thread_end(); } @@ -1144,6 +1200,7 @@ int main(int argc, char **argv) fatal_error("Too many connections, max value for --parallel is %d\n", MAX_THREADS); } + init_tp_connections(opt_use_threads); thread_pool= tpool::create_thread_pool_generic(opt_use_threads,opt_use_threads); thread_pool->set_thread_callbacks(tpool_thread_init,tpool_thread_exit); @@ -1155,6 +1212,7 @@ int main(int argc, char **argv) thread_pool->submit_task(&t); delete thread_pool; + close_tp_connections(); thread_pool= nullptr; files_to_load.clear(); } From 45d99ea105e4db70cd7f5ad7ef10de7a0398c8a3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 10 Sep 2024 20:35:03 +0200 Subject: [PATCH 090/185] Workaround MDEV-34890 --- client/mysqlimport.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysqlimport.cc b/client/mysqlimport.cc index 1443cb1560c..fe89ebf526f 100644 --- a/client/mysqlimport.cc +++ b/client/mysqlimport.cc @@ -652,6 +652,9 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql) if (exec_sql(mysql, sql_statement)) DBUG_RETURN(1); } + if (exec_sql(mysql, "SET collation_database=binary")) + DBUG_RETURN(1); + to_unix_path(hard_path); if (verbose) { From b331cde26be8d6db73f530a8689fe5b79dec9d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 13 Sep 2024 14:34:08 +0300 Subject: [PATCH 091/185] MDEV-34921 MemorySanitizer reports errors for non-debug builds my_b_encr_write(): Initialize also block_length, and at the same time last_block_length, so that all 128 bits can be initialized with fewer writes. This fixes an error that was caught in the test encryption.tempfiles_encrypted. test_my_safe_print_str(): Skip a test that would attempt to display uninitialized data in the test unit.stacktrace. Previously, our CI did not build unit tests with MemorySanitizer. handle_delayed_insert(): Remove a redundant call to pthread_exit(0), which would for some reason cause MemorySanitizer in clang-19 to report a stack overflow in a RelWithDebInfo build. This fixes a failure of several tests. Reviewed by: Vladislav Vaintroub --- sql/mf_iocache_encr.cc | 4 ++-- sql/sql_insert.cc | 1 - unittest/mysys/stacktrace-t.c | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc index 63830ec620a..3175226a3d1 100644 --- a/sql/mf_iocache_encr.cc +++ b/sql/mf_iocache_encr.cc @@ -175,8 +175,8 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count) DBUG_RETURN(info->error= -1); } crypt_data->counter= 0; - - IF_DBUG(crypt_data->block_length= 0,); + crypt_data->block_length= 0; + crypt_data->last_block_length= 0; } do diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 46486e09a8b..875ae9f9c63 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3498,7 +3498,6 @@ pthread_handler_t handle_delayed_insert(void *arg) DBUG_LEAVE; } my_thread_end(); - pthread_exit(0); return 0; } diff --git a/unittest/mysys/stacktrace-t.c b/unittest/mysys/stacktrace-t.c index d8408f80d76..c8b699ca696 100644 --- a/unittest/mysys/stacktrace-t.c +++ b/unittest/mysys/stacktrace-t.c @@ -30,7 +30,7 @@ void test_my_safe_print_str() memcpy(b_bss, "LEGAL", 6); #ifdef HAVE_STACKTRACE -#ifndef __SANITIZE_ADDRESS__ +# if !defined __SANITIZE_ADDRESS__ && !__has_feature(memory_sanitizer) fprintf(stderr, "\n===== stack =====\n"); my_safe_print_str(b_stack, 65535); fprintf(stderr, "\n===== heap =====\n"); @@ -40,15 +40,15 @@ void test_my_safe_print_str() fprintf(stderr, "\n===== data =====\n"); my_safe_print_str("LEGAL", 65535); fprintf(stderr, "\n===== Above is a junk, but it is expected. =====\n"); -#endif /*__SANITIZE_ADDRESS__*/ +# endif fprintf(stderr, "\n===== Nornal length test =====\n"); my_safe_print_str("LEGAL", 5); fprintf(stderr, "\n===== NULL =====\n"); my_safe_print_str(0, 5); -#ifndef __SANITIZE_ADDRESS__ +# ifndef __SANITIZE_ADDRESS__ fprintf(stderr, "\n===== (const char*) 1 =====\n"); my_safe_print_str((const char*)1, 5); -#endif /*__SANITIZE_ADDRESS__*/ +# endif /*__SANITIZE_ADDRESS__*/ #endif /*HAVE_STACKTRACE*/ free(b_heap); From e3f653ca66a31b0179edb5f59298572cc0505be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 14 Sep 2024 10:35:28 +0300 Subject: [PATCH 092/185] MDEV-34750 fixup: -Wconversion on 32-bit log_t::resize_write_buf(): If d<0 and d>-length, d will fit in ssize_t, which is a signed 32-bit or 64-bit integer. Cast from int64_t to ssize_t to make this clear and to silence a compiler warning. --- storage/innobase/log/log0log.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index d7aae556ce0..683b5853944 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -787,13 +787,13 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept ut_ad(length <= resize_target); int64_t d= int64_t(write_lsn - resize_in_progress()); - if (UNIV_UNLIKELY(d <= 0)) + if (UNIV_UNLIKELY(d < 0)) { d&= ~int64_t(block_size_1); if (int64_t(d + length) <= 0) return; - length+= d; - b-= d; + length+= ssize_t(d); + b-= ssize_t(d); d= 0; } lsn_t offset= START_OFFSET + (lsn_t(d) & ~lsn_t{block_size_1}) % From 4010dff058d8fc88d602e3bc231a6558599b89f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 14 Sep 2024 11:05:44 +0300 Subject: [PATCH 093/185] mtr_t::log_file_op(): Fix -Wnonnull GCC 12.2.0 could issue -Wnonnull for an unreachable call to strlen(new_path). Let us prevent that by replacing the condition (type == FILE_RENAME) with the equivalent (new_path). This should also optimize the generated code, because the life time of the parameter "type" will be reduced. --- storage/innobase/fil/fil0fil.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index ba4fbc49204..514d6f51fff 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1554,17 +1554,18 @@ inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id, m_last= nullptr; const size_t len= strlen(path); - const size_t new_len= type == FILE_RENAME ? 1 + strlen(new_path) : 0; + const size_t new_len= new_path ? 1 + strlen(new_path) : 0; ut_ad(len > 0); byte *const log_ptr= m_log.open(1 + 3/*length*/ + 5/*space_id*/ + 1/*page_no=0*/); + *log_ptr= type; byte *end= log_ptr + 1; end= mlog_encode_varint(end, space_id); *end++= 0; - if (UNIV_LIKELY(end + len + new_len >= &log_ptr[16])) + const byte *const final_end= end + len + new_len; + if (UNIV_LIKELY(final_end >= &log_ptr[16])) { - *log_ptr= type; - size_t total_len= len + new_len + end - log_ptr - 15; + size_t total_len= final_end - log_ptr - 15; if (total_len >= MIN_3BYTE) total_len+= 2; else if (total_len >= MIN_2BYTE) @@ -1575,13 +1576,13 @@ inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id, } else { - *log_ptr= static_cast(type | (end + len + new_len - &log_ptr[1])); + *log_ptr= static_cast(*log_ptr | (final_end - &log_ptr[1])); ut_ad(*log_ptr & 15); } m_log.close(end); - if (type == FILE_RENAME) + if (new_path) { ut_ad(strchr(new_path, OS_PATH_SEPARATOR)); m_log.push(reinterpret_cast(path), uint32_t(len + 1)); From 7ee0e60bbb861715b8d943683cc89ddf57b73f2e Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 3 Sep 2024 07:39:30 +0200 Subject: [PATCH 094/185] galera mtr tests: minor fixes to make tests more reliable --- mysql-test/suite/galera/r/GCF-939.result | 6 +++++- mysql-test/suite/galera/t/GCF-939.test | 6 +++++- mysql-test/suite/galera/t/galera_fk_lock_wait.cnf | 11 +++++++++++ mysql-test/suite/galera/t/galera_fk_lock_wait.test | 1 + mysql-test/suite/galera_3nodes/r/GCF-354.result | 9 +++------ .../galera_3nodes/r/galera_safe_to_bootstrap.result | 2 ++ mysql-test/suite/galera_3nodes/t/GCF-354.test | 10 ++++++---- .../galera_3nodes/t/galera_safe_to_bootstrap.test | 2 ++ 8 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 mysql-test/suite/galera/t/galera_fk_lock_wait.cnf diff --git a/mysql-test/suite/galera/r/GCF-939.result b/mysql-test/suite/galera/r/GCF-939.result index f9b65bced42..2e94fc4a1b0 100644 --- a/mysql-test/suite/galera/r/GCF-939.result +++ b/mysql-test/suite/galera/r/GCF-939.result @@ -5,7 +5,11 @@ DROP TABLE t1; ERROR 42S02: Unknown table 'test.t1' CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); -GRA_.log +connection node_2; +SELECT * FROM t1; +f1 +1 +connection node_1; GRA_.log DROP TABLE t1; CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test index 62bcdb818c7..a9b9077d5ef 100644 --- a/mysql-test/suite/galera/t/GCF-939.test +++ b/mysql-test/suite/galera/t/GCF-939.test @@ -13,6 +13,11 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +--connection node_2 +SELECT * FROM t1; + +--connection node_1 + # Expect only one GRA_*.log file # TODO replace_regex is somehow broken, it will filter out # result totally if replacement string is already in result @@ -20,7 +25,6 @@ INSERT INTO t1 VALUES (1); # to get GRA_.log two times, this works for some reason # --replace_regex /GRA_.+\.log/GRA_.log/ ---list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log --replace_regex /GRA_.+\.log/GRA_.log/ --list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log diff --git a/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf b/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf new file mode 100644 index 00000000000..7df8ed28a4d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-debug=1 +auto_increment_offset=1 +auto_increment_increment=2 + +[mysqld.2] +wsrep-debug=1 +auto_increment_offset=2 +auto_increment_increment=2 diff --git a/mysql-test/suite/galera/t/galera_fk_lock_wait.test b/mysql-test/suite/galera/t/galera_fk_lock_wait.test index 150c7397f7e..0d731e154f2 100644 --- a/mysql-test/suite/galera/t/galera_fk_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_fk_lock_wait.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc CREATE TABLE parent(parent_id int not null AUTO_INCREMENT PRIMARY KEY, parent_name varchar(80)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result index c69de54747f..3fdd44fe9d3 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-354.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -1,20 +1,17 @@ connection node_2; connection node_1; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; connection node_2; connection node_3; connection node_2; -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; DROP SCHEMA test; connection node_3; -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; connection node_1; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE -1 +INSERT INTO test.t1 values (1); SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status Primary diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result index 2aefefaad00..e966a36fb79 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -45,6 +45,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); connection node_3; @@ -58,6 +59,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test index 372f6329e8e..44dfa3deeb7 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.test +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test @@ -2,7 +2,9 @@ --source include/have_innodb.inc --source include/force_restart.inc ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc # Save original auto_increment_offset values. --let $node_1=node_1 @@ -14,11 +16,11 @@ # 1. Create different inconsistencies on nodes 2 and 3 # --connection node_2 -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; DROP SCHEMA test; --connection node_3 -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; # # 2. The following should generate different errors on nodes 2 and 3 and @@ -27,10 +29,10 @@ CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; # --connection node_1 CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO test.t1 values (1); --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' --source include/wait_condition.inc SHOW STATUS LIKE 'wsrep_cluster_status'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index 80482151518..eb41137b8b3 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -193,6 +193,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); @@ -207,6 +208,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); From 5cb436e07b0fa46ae935c58519c044293b54f66b Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 10 Sep 2024 02:44:46 +0200 Subject: [PATCH 095/185] MDEV-30822 preparation: refactoring galera sst scripts This commit makes the SST script for mariabackup more resilient to unexpected terminations or hangs while mariabackup or when SST scripts in a previous session are still running (in reality they were hung while waiting for something). --- scripts/wsrep_sst_backup.sh | 2 +- scripts/wsrep_sst_mariabackup.sh | 55 +++++++++++++++++--------------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index 6f8c658135a..a28dcf494b2 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -33,7 +33,7 @@ export PATH="/usr/sbin:/sbin:$PATH" . $(dirname "$0")/wsrep_sst_common MAGIC_FILE="$WSREP_SST_OPT_DATA/backup_sst_complete" -rm -rf "$MAGIC_FILE" +rm -r "$MAGIC_FILE" WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} # if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 6eea14df5d2..de219283d15 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -106,6 +106,7 @@ DATA="$WSREP_SST_OPT_DATA" INFO_FILE='xtrabackup_galera_info' DONOR_INFO_FILE='donor_galera_info' IST_FILE='xtrabackup_ist' + MAGIC_FILE="$DATA/$INFO_FILE" DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" @@ -919,9 +920,6 @@ monitor_process() done } -[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" -[ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE" - read_cnf setup_ports @@ -1071,6 +1069,24 @@ get_transfer findopt='-L' [ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" +SST_PID="$DATA/wsrep_sst.pid" + +# give some time for previous SST to complete: +check_round=0 +while check_pid "$SST_PID" 0; do + wsrep_log_info "previous SST is not completed, waiting for it to exit" + check_round=$(( check_round+1 )) + if [ $check_round -eq 30 ]; then + wsrep_log_error "previous SST script still running." + exit 114 # EALREADY + fi + sleep 1 +done + +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" +[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" +[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" + if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then trap cleanup_at_exit EXIT @@ -1319,33 +1335,12 @@ else # joiner impts="--parallel=$backup_threads${impts:+ }$impts" fi - SST_PID="$DATA/wsrep_sst.pid" - - # give some time for previous SST to complete: - check_round=0 - while check_pid "$SST_PID" 0; do - wsrep_log_info "previous SST is not completed, waiting for it to exit" - check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "previous SST script still running." - exit 114 # EALREADY - fi - sleep 1 - done - trap simple_cleanup EXIT echo $$ > "$SST_PID" stagemsg='Joiner-Recv' MODULE="${WSREP_SST_OPT_MODULE:-xtrabackup_sst}" - - [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" - - # May need xtrabackup_checkpoints later on - [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" - [ -f "$DATA/xtrabackup_galera_info" ] && rm -f "$DATA/xtrabackup_galera_info" - ADDR="$WSREP_SST_OPT_HOST" if [ "${tmode#VERIFY}" != "$tmode" ]; then @@ -1376,6 +1371,7 @@ else # joiner STATDIR="$(mktemp -d)" MAGIC_FILE="$STATDIR/$INFO_FILE" + DONOR_MAGIC_FILE="$STATDIR/$DONOR_INFO_FILE" recv_joiner "$STATDIR" "$stagemsg-gtid" $stimeout 1 1 @@ -1449,6 +1445,13 @@ else # joiner "$DATA" -mindepth 1 -prune -regex "$cpat" \ -o -exec rm -rf {} >&2 \+ + # Deleting files from previous SST and legacy files from old versions: + [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" + [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" + [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" + [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" + [ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb" + TDATA="$DATA" DATA="$DATA/.sst" MAGIC_FILE="$DATA/$INFO_FILE" @@ -1562,6 +1565,7 @@ else # joiner fi MAGIC_FILE="$TDATA/$INFO_FILE" + DONOR_MAGIC_FILE="$TDATA/$DONOR_INFO_FILE" wsrep_log_info "Moving the backup to $TDATA" timeit 'mariadb-backup move stage' "$INNOMOVE" @@ -1586,7 +1590,8 @@ else # joiner fi if [ ! -r "$MAGIC_FILE" ]; then - wsrep_log_error "SST magic file '$MAGIC_FILE' not found/readable" + wsrep_log_error "Internal error: SST magic file '$MAGIC_FILE'" \ + "not found or not readable" exit 2 fi From fbd882914928c3cd06823993f031403d54c6c8c0 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 10 Sep 2024 03:45:19 +0200 Subject: [PATCH 096/185] galera SST scripts: removing obsolete xtrabackup_pid support Removed handling of the long-unsupported xtrabackup_pid file, as it is not even created by modern versions of mariabackup. Instead, added stopping of the asynchronous process that mariabackup runs (if it is still active) to the exception handler. --- scripts/wsrep_sst_mariabackup.sh | 31 +++++++++++++++---------------- scripts/wsrep_sst_rsync.sh | 13 ++++++------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index de219283d15..c607cb7d7eb 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -687,16 +687,16 @@ cleanup_at_exit() fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then + if [ -n "$BACKUP_PID" ]; then + if ps -p $BACKUP_PID >/dev/null 2>&1; then + wsrep_log_error \ + "mariadb-backup process is still running. Killing..." + cleanup_pid $CHECK_PID + fi + fi wsrep_log_info "Removing the sst_in_progress file" wsrep_cleanup_progress_file else - if [ -n "$BACKUP_PID" ]; then - if check_pid "$BACKUP_PID" 1; then - wsrep_log_error \ - "mariadb-backup process is still running. Killing..." - cleanup_pid $CHECK_PID "$BACKUP_PID" - fi - fi [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi @@ -906,14 +906,14 @@ monitor_process() local sst_stream_pid=$1 while :; do - if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then + if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then wsrep_log_error \ "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ "terminated unexpectedly." - kill -- -"$WSREP_SST_OPT_PARENT" + kill -- -$WSREP_SST_OPT_PARENT exit 32 fi - if ! ps -p "$sst_stream_pid" >/dev/null 2>&1; then + if ! ps -p $sst_stream_pid >/dev/null 2>&1; then break fi sleep 0.1 @@ -1073,7 +1073,7 @@ SST_PID="$DATA/wsrep_sst.pid" # give some time for previous SST to complete: check_round=0 -while check_pid "$SST_PID" 0; do +while check_pid "$SST_PID"; do wsrep_log_info "previous SST is not completed, waiting for it to exit" check_round=$(( check_round+1 )) if [ $check_round -eq 30 ]; then @@ -1220,9 +1220,6 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then exit 22 fi - # mariadb-backup implicitly writes PID to fixed location in $xtmpdir - BACKUP_PID="$xtmpdir/xtrabackup_pid" - else # BYPASS FOR IST wsrep_log_info "Bypassing the SST for IST" @@ -1402,7 +1399,7 @@ else # joiner fi mkdir -p "$DATA/.sst" (recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) & - jpid=$! + BACKUP_PID=$! wsrep_log_info "Proceeding with SST" get_binlog @@ -1447,6 +1444,7 @@ else # joiner # Deleting files from previous SST and legacy files from old versions: [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" + [ -f "$DATA/xtrabackup_pid" ] && rm -f "$DATA/xtrabackup_pid" [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" @@ -1457,7 +1455,8 @@ else # joiner MAGIC_FILE="$DATA/$INFO_FILE" wsrep_log_info "Waiting for SST streaming to complete!" - monitor_process $jpid + monitor_process $BACKUP_PID + BACKUP_PID="" if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then wsrep_log_error "xtrabackup_checkpoints missing," \ diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index b05f4bc2efd..55b94ff6009 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -351,7 +351,7 @@ SST_PID="$DATA/wsrep_sst.pid" # give some time for previous SST to complete: check_round=0 -while check_pid "$SST_PID" 0; do +while check_pid "$SST_PID"; do wsrep_log_info "Previous SST is not completed, waiting for it to exit" check_round=$(( check_round+1 )) if [ $check_round -eq 20 ]; then @@ -866,19 +866,18 @@ EOF echo "ready $ADDR:$RSYNC_PORT/$MODULE" - MYSQLD_PID="$WSREP_SST_OPT_PARENT" - # wait for SST to complete by monitoring magic file while [ ! -r "$MAGIC_FILE" ] && check_pid "$TRANSFER_PID" && \ - ps -p $MYSQLD_PID >/dev/null 2>&1 + ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1 do sleep 1 done - if ! ps -p $MYSQLD_PID >/dev/null 2>&1; then + if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then wsrep_log_error \ - "Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly." - kill -- -$MYSQLD_PID + "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ + "terminated unexpectedly." + kill -- -$WSREP_SST_OPT_PARENT sleep 1 exit 32 fi From 4cb73f49bc2b247e3f3674940b861989a3c9302a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 10 Sep 2024 22:57:51 +0200 Subject: [PATCH 097/185] galera SST scripts: unification of wsrep_sst_backup with the other scripts --- scripts/wsrep_sst_backup.sh | 42 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index a28dcf494b2..6cf17fe7228 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -21,50 +21,32 @@ set -ue # This is a reference script for rsync-based state snapshot transfer -RSYNC_REAL_PID=0 # rsync process id -STUNNEL_REAL_PID=0 # stunnel process id - OS="$(uname)" [ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH -# Setting the path for lsof on CentOS -export PATH="/usr/sbin:/sbin:$PATH" - . $(dirname "$0")/wsrep_sst_common +wsrep_check_datadir -MAGIC_FILE="$WSREP_SST_OPT_DATA/backup_sst_complete" -rm -r "$MAGIC_FILE" +DATA="$WSREP_SST_OPT_DATA" -WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} -# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mysqld innodb-log-group-home-dir '') -fi +MAGIC_FILE="$DATA/backup_sst_complete" -if [ -n "$WSREP_LOG_DIR" ]; then - # handle both relative and absolute paths - WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P) -else - # default to datadir - WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P) -fi +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" if [ "$WSREP_SST_OPT_ROLE" = 'donor' ] then - [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" - RC=0 if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then - FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" - ERROR="$WSREP_SST_OPT_DATA/sst_error" + FLUSHED="$DATA/tables_flushed" + ERROR="$DATA/sst_error" [ -f "$FLUSHED" ] && rm -f "$FLUSHED" [ -f "$ERROR" ] && rm -f "$ERROR" - echo "flush tables" + echo 'flush tables' # Wait for : # (a) Tables to be flushed, AND @@ -77,19 +59,23 @@ then # Check whether ERROR file exists. if [ -f "$ERROR" ]; then # Flush tables operation failed. - rm -f "$ERROR" + rm "$ERROR" exit 255 fi sleep 0.2 done STATE=$(cat "$FLUSHED") - rm -f "$FLUSHED" - + rm "$FLUSHED" else # BYPASS wsrep_log_info "Bypassing state dump." + + # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id + # (separated by a space). + STATE="$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" + fi echo 'continue' # now server can resume updating data From 606c867e7fec4507bd1225f9abf2d0aa664b6ab6 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 11 Sep 2024 18:53:24 +0200 Subject: [PATCH 098/185] galera SST scripts: moving common code to wsrep_sst_common file --- scripts/wsrep_sst_backup.sh | 5 +- scripts/wsrep_sst_common.sh | 102 +++++++++++++++- scripts/wsrep_sst_mariabackup.sh | 89 +------------- scripts/wsrep_sst_rsync.sh | 198 +++++++++++-------------------- 4 files changed, 172 insertions(+), 222 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index 6cf17fe7228..af2e396641b 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -21,14 +21,13 @@ set -ue # This is a reference script for rsync-based state snapshot transfer -OS="$(uname)" -[ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH - . $(dirname "$0")/wsrep_sst_common wsrep_check_datadir DATA="$WSREP_SST_OPT_DATA" +create_data + MAGIC_FILE="$DATA/backup_sst_complete" [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index b6b8c0501c8..4766d82181d 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -20,8 +20,13 @@ trap 'exit 32' HUP PIPE trap 'exit 3' INT QUIT TERM -# Setting the path for some utilities on CentOS -export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin" +OS="$(uname)" + +# Setting the paths for some utilities on CentOS +export PATH="${PATH:+$PATH:}/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" +if [ "$OS" != 'Darwin' ]; then + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/local/lib:/usr/lib:/lib:/opt/lib" +fi commandex() { @@ -1724,4 +1729,97 @@ simple_cleanup() exit $estatus } +create_data() +{ + OLD_PWD="$(pwd)" + + if [ -n "$DATA" -a "$DATA" != '.' ]; then + [ ! -d "$DATA" ] && mkdir -p "$DATA" + cd "$DATA" + fi + DATA_DIR="$(pwd)" + + cd "$OLD_PWD" +} + +create_dirs() +{ + local simplify=${1:-0} + + # if no command line argument and INNODB_DATA_HOME_DIR environment + # variable is not set, try to get it from the my.cnf: + if [ -z "$INNODB_DATA_HOME_DIR" ]; then + INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') + INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") + fi + + if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ + "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" + cd "$INNODB_DATA_HOME_DIR" + ib_home_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir="" + fi + + # if no command line argument and INNODB_LOG_GROUP_HOME is not set, + # then try to get it from the my.cnf: + if [ -z "$INNODB_LOG_GROUP_HOME" ]; then + INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') + INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") + fi + + if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ + "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" + cd "$INNODB_LOG_GROUP_HOME" + ib_log_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir="" + fi + + # if no command line argument and INNODB_UNDO_DIR is not set, + # then try to get it from the my.cnf: + if [ -z "$INNODB_UNDO_DIR" ]; then + INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') + INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") + fi + + if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ + "$INNODB_UNDO_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" + cd "$INNODB_UNDO_DIR" + ib_undo_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir="" + fi + + # if no command line argument then try to get it from the my.cnf: + if [ -z "$ARIA_LOG_DIR" ]; then + ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') + ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") + fi + + if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ + "$ARIA_LOG_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" + cd "$ARIA_LOG_DIR" + ar_log_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" + fi +} + wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE started on $WSREP_SST_OPT_ROLE" diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index c607cb7d7eb..75c1e846c76 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -23,8 +23,6 @@ set -ue # https://mariadb.com/kb/en/mariabackup-overview/ # Make sure to read that before proceeding! -OS="$(uname)" - . $(dirname "$0")/wsrep_sst_common wsrep_check_datadir @@ -935,15 +933,7 @@ if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -F -- '--version-check'; then disver=' --no-version-check' fi -OLD_PWD="$(pwd)" - -if [ -n "$DATA" -a "$DATA" != '.' ]; then - [ ! -d "$DATA" ] && mkdir -p "$DATA" - cd "$DATA" -fi -DATA_DIR="$(pwd)" - -cd "$OLD_PWD" +create_data if [ $ssyslog -eq 1 ]; then if [ -n "$(commandex logger)" ]; then @@ -1249,85 +1239,12 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then else # joiner + create_dirs 1 + [ -e "$SST_PROGRESS_FILE" ] && \ wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" [ -n "$SST_PROGRESS_FILE" ] && touch "$SST_PROGRESS_FILE" - # if no command line argument and INNODB_DATA_HOME_DIR environment - # variable is not set, try to get it from the my.cnf: - if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') - INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") - fi - - if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ - "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" - cd "$INNODB_DATA_HOME_DIR" - ib_home_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir="" - fi - - # if no command line argument and INNODB_LOG_GROUP_HOME is not set, - # then try to get it from the my.cnf: - if [ -z "$INNODB_LOG_GROUP_HOME" ]; then - INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') - INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") - fi - - if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ - "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" - cd "$INNODB_LOG_GROUP_HOME" - ib_log_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir="" - fi - - # if no command line argument and INNODB_UNDO_DIR is not set, - # then try to get it from the my.cnf: - if [ -z "$INNODB_UNDO_DIR" ]; then - INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') - INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") - fi - - if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ - "$INNODB_UNDO_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" - cd "$INNODB_UNDO_DIR" - ib_undo_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir="" - fi - - # if no command line argument then try to get it from the my.cnf: - if [ -z "$ARIA_LOG_DIR" ]; then - ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') - ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") - fi - - if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ - "$ARIA_LOG_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" - cd "$ARIA_LOG_DIR" - ar_log_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" - fi - if [ -n "$backup_threads" ]; then impts="--parallel=$backup_threads${impts:+ }$impts" fi diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 55b94ff6009..c22d0b3e494 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -21,17 +21,14 @@ set -ue # This is a reference script for rsync-based state snapshot transfer -RSYNC_REAL_PID=0 # rsync process id -STUNNEL_REAL_PID=0 # stunnel process id - -OS="$(uname)" -[ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH - . $(dirname "$0")/wsrep_sst_common wsrep_check_datadir wsrep_check_programs rsync +RSYNC_REAL_PID=0 # rsync process id +STUNNEL_REAL_PID=0 # stunnel process id + cleanup_joiner() { # Since this is invoked just after exit NNN @@ -162,15 +159,7 @@ if [ -n "$WSREP_SST_OPT_BINLOG" ]; then binlog_base=$(basename "$WSREP_SST_OPT_BINLOG") fi -OLD_PWD="$(pwd)" - -if [ -n "$DATA" -a "$DATA" != '.' ]; then - [ ! -d "$DATA" ] && mkdir -p "$DATA" - cd "$DATA" -fi -DATA_DIR="$(pwd)" - -cd "$OLD_PWD" +create_data BINLOG_TAR_FILE="$DATA_DIR/wsrep_sst_binlog.tar" @@ -179,77 +168,6 @@ ib_log_dir="$DATA_DIR" ib_home_dir="$DATA_DIR" ib_undo_dir="$DATA_DIR" -# if no command line argument and INNODB_LOG_GROUP_HOME is not set, -# then try to get it from the my.cnf: -if [ -z "$INNODB_LOG_GROUP_HOME" ]; then - INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') - INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") -fi - -if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ - "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" - cd "$INNODB_LOG_GROUP_HOME" - ib_log_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument and INNODB_DATA_HOME_DIR environment -# variable is not set, try to get it from the my.cnf: -if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') - INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") -fi - -if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ - "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" - cd "$INNODB_DATA_HOME_DIR" - ib_home_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument and INNODB_UNDO_DIR is not set, -# then try to get it from the my.cnf: -if [ -z "$INNODB_UNDO_DIR" ]; then - INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') - INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") -fi - -if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ - "$INNODB_UNDO_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" - cd "$INNODB_UNDO_DIR" - ib_undo_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument then try to get it from the my.cnf: -if [ -z "$ARIA_LOG_DIR" ]; then - ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') - ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") -fi - -if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ - "$ARIA_LOG_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" - cd "$ARIA_LOG_DIR" - ar_log_dir="$(pwd)" - cd "$OLD_PWD" -fi - encgroups='--mysqld|sst' check_server_ssl_config @@ -598,66 +516,82 @@ FILTER="-f '- /lost+found' wsrep_log_info "Transfer of normal directories done" - # Transfer InnoDB data files - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /ibdata*' -f '+ /ib_lru_dump' \ - -f '- **' "$ib_home_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-data_dir" >&2 || RC=$? + if [ -d "$ib_home_dir" ]; then + + # Transfer InnoDB data files + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /ibdata*' -f '+ /ib_lru_dump' \ + -f '- **' "$ib_home_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-data_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_data_home_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB data files done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_data_home_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB data files done" + if [ -d "$ib_log_dir" ]; then - # second, we transfer InnoDB log files - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' \ - -f '- **' "$ib_log_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$? + # second, we transfer InnoDB log files + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' \ + -f '- **' "$ib_log_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB log files done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB log files done" + if [ "$ib_undo_dir" ]; then - # third, we transfer InnoDB undo logs - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /undo*' \ - -f '- **' "$ib_undo_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? + # third, we transfer InnoDB undo logs + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /undo*' \ + -f '- **' "$ib_undo_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_undo_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB undo logs done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_undo_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB undo logs done" + if [ "$ar_log_dir" ]; then - # fourth, we transfer Aria logs - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \ - -f '- **' "$ar_log_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$? + # fourth, we transfer Aria logs + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \ + -f '- **' "$ar_log_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync aria_log_dir_path returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of Aria logs done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync aria_log_dir_path returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of Aria logs done" - # then, we parallelize the transfer of database directories, # use '.' so that path concatenation works: @@ -744,6 +678,8 @@ else # joiner check_sockets_utils + create_dirs + ADDR="$WSREP_SST_OPT_HOST" RSYNC_PORT="$WSREP_SST_OPT_PORT" RSYNC_ADDR="$WSREP_SST_OPT_HOST" From 202fd502cf31f5120c5361641a47e8cd4830984c Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 12 Sep 2024 17:29:24 +0200 Subject: [PATCH 099/185] galera SST scripts: fixes for error logging in non-linux systems --- scripts/wsrep_sst_common.sh | 59 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 4766d82181d..581f804d2d3 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -39,11 +39,45 @@ commandex() fi } +with_bash_42=0 with_printf=1 if [ -z "$BASH_VERSION" ]; then [ -z "$(commandex printf)" ] && with_printf=0 +else + [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 -o \ + "${BASH_VERSINFO[0]}" -gt 4 ] && with_bash_42=1 fi +wsrep_log() +{ + local t + # echo everything to stderr so that it gets into common error log + # deliberately made to look different from the rest of the log + if [ "$OS" = 'Linux' ]; then + t=$(date '+%Y%m%d %H:%M:%S.%3N') + elif [ $with_bash_42 -ne 0 ]; then + printf -v t '%(%Y%m%d %H:%M:%S)T.000' + else + t=$(date '+%Y%m%d %H:%M:%S.000') + fi + echo "WSREP_SST: $* ($t)" >&2 +} + +wsrep_log_error() +{ + wsrep_log "[ERROR] $*" +} + +wsrep_log_warning() +{ + wsrep_log "[WARNING] $*" +} + +wsrep_log_info() +{ + wsrep_log "[INFO] $*" +} + trim_string() { if [ -n "$BASH_VERSION" ]; then @@ -844,29 +878,6 @@ else MYSQLDUMP=$(commandex 'mysqldump') fi -wsrep_log() -{ - # echo everything to stderr so that it gets into common error log - # deliberately made to look different from the rest of the log - local readonly tst=$(date "+%Y%m%d %H:%M:%S.%N" | cut -b -21) - echo "WSREP_SST: $* ($tst)" >&2 -} - -wsrep_log_error() -{ - wsrep_log "[ERROR] $*" -} - -wsrep_log_warning() -{ - wsrep_log "[WARNING] $*" -} - -wsrep_log_info() -{ - wsrep_log "[INFO] $*" -} - if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults" elif [ -x "$EXTRA_DIR/my_print_defaults" ]; then @@ -1090,7 +1101,7 @@ wsrep_check_program() local prog="$1" local cmd=$(commandex "$prog") if [ -z "$cmd" ]; then - echo "'$prog' not found in PATH" + wsrep_log_error "'$prog' not found in path" return 2 # no such file or directory fi } From 642195d255619854d13f20b9937b604dbbe2a5fb Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 12 Sep 2024 19:00:26 +0200 Subject: [PATCH 100/185] MDEV-34234: SST hangs when running on unprivileged containers on RHEL9 The lsof utility is prone to blocking on system calls that it uses to obtain information about sockets (or files, devices, etc.). This behavior is described in its own documentation. It has a '-b' option (in combination with warnings suppression via '-w') that reduces the probability of blocking, introducing new problems (luckily probably not relevant for our use case). However, there is no guarantee that it will not hang on some distributions, with some TCP/IP stack implementations, or with some filesystems, etc. Also, of the three utilities that are suitable for our purposes, lsof is the slowest. So if there are other utilities that we use during SST, such as 'ss' or 'sockstat', it is reasonable to use them instead of lsof. This commit changes the prioritization of utilities, it does not need additional tests (besides the numerous SST tests already available in the galera suites). If the system still need to use lsof, this commit adds the '-b' and '-w' options to it command line - to reduce the likelihood of blocking. --- scripts/wsrep_sst_common.sh | 40 +++++++++++++++++++++++-------------- scripts/wsrep_sst_rsync.sh | 32 +++++++++++++++++------------ 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 581f804d2d3..43732d7b49f 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1224,14 +1224,18 @@ check_sockets_utils() sockstat_available=0 ss_available=0 - [ -n "$(commandex lsof)" ] && lsof_available=1 - [ -n "$(commandex sockstat)" ] && sockstat_available=1 - [ -n "$(commandex ss)" ] && ss_available=1 - - if [ $lsof_available -eq 0 -a \ - $sockstat_available -eq 0 -a \ - $ss_available -eq 0 ] - then + # The presence of any of these utilities is enough for us: + if [ -n "$(commandex ss)" ]; then + ss_available=1 + elif [ -n "$(commandex sockstat)" ]; then + sockstat_available=1 + elif [ -n "$(commandex lsof)" ]; then + lsof_available=1 + # Let's check that lsof has an option to bypass blocking: + if lsof -h 2>&1 | grep -qw -F -- '-b'; then + lsof_available=2 + fi + else wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in" \ "the PATH. Make sure you have it installed." exit 2 # ENOENT @@ -1258,9 +1262,9 @@ check_port() local rc=1 - if [ $lsof_available -ne 0 ]; then - lsof -Pnl -i ":$port" 2>/dev/null | \ - grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*\\(LISTEN\\)" && rc=0 + if [ $ss_available -ne 0 ]; then + ss -nlpH "( sport = :$port )" 2>/dev/null | \ + grep -q -E "users:\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 elif [ $sockstat_available -ne 0 ]; then local opts='-p' if [ "$OS" = 'FreeBSD' ]; then @@ -1268,11 +1272,17 @@ check_port() # to display the connection state: opts='-sp' fi - sockstat "$opts" "$port" 2>/dev/null | \ + sockstat $opts "$port" 2>/dev/null | \ grep -q -E "[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*[[:space:]]LISTEN" && rc=0 - elif [ $ss_available -ne 0 ]; then - ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -q -E "users:\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 + elif [ $lsof_available -ne 0 ]; then + local lsof_opts='-Pnl' + if [ $lsof_available -gt 1 ]; then + lsof_opts="$lsof_opts -b -w" + else + lsof_opts="$lsof_opts -S 15" + fi + lsof $lsof_opts -i ":$port" 2>/dev/null | \ + grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*\\(LISTEN\\)" && rc=0 else wsrep_log_error "Unknown sockets utility" exit 2 # ENOENT diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index c22d0b3e494..c5640d2a22c 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -96,29 +96,35 @@ check_pid_and_port() local port_info local busy=0 - if [ $lsof_available -ne 0 ]; then - port_info=$(lsof -Pnl -i ":$port" 2>/dev/null | grep -F '(LISTEN)') - echo "$port_info" | \ - grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port[[:space:]]" && busy=1 - else - local filter='([^[:space:]]+[[:space:]]+){4}[^[:space:]]+' - if [ $sockstat_available -ne 0 ]; then + if [ $ss_available -ne 0 -o $sockstat_available -ne 0 ]; then + if [ $ss_available -ne 0 ]; then + port_info=$(ss -nlpH "( sport = :$port )" 2>/dev/null | \ + grep -F 'users:(' | grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+") + else local opts='-p' + local terms=4 if [ "$OS" = 'FreeBSD' ]; then # sockstat on FreeBSD requires the "-s" option # to display the connection state: opts='-sp' # in addition, sockstat produces an additional column: - filter='([^[:space:]]+[[:space:]]+){5}[^[:space:]]+' + terms=5 fi - port_info=$(sockstat "$opts" "$port" 2>/dev/null | \ - grep -E '[[:space:]]LISTEN' | grep -o -E "$filter") - else - port_info=$(ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -F 'users:(' | grep -o -E "$filter") + port_info=$(sockstat $opts "$port" 2>/dev/null | \ + grep -E '[[:space:]]LISTEN' | grep -o -E "([^[:space:]]+[[:space:]]+){$terms}[^[:space:]]+") fi echo "$port_info" | \ grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port\$" && busy=1 + else + local lsof_opts='-Pnl' + if [ $lsof_available -gt 1 ]; then + lsof_opts="$lsof_opts -b -w" + else + lsof_opts="$lsof_opts -S 15" + fi + port_info=$(lsof $lsof_opts -i ":$port" 2>/dev/null | grep -F '(LISTEN)' || :) + echo "$port_info" | \ + grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port[[:space:]]" && busy=1 fi if [ $busy -eq 0 ]; then From 7742cc9ff98ef7253c355e19b52d9f06287e0ee7 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 13 Sep 2024 16:46:12 +0200 Subject: [PATCH 101/185] galera SST scripts: more robust port checking --- scripts/wsrep_sst_common.sh | 86 +++++++++++++++++++++----------- scripts/wsrep_sst_mariabackup.sh | 2 +- scripts/wsrep_sst_rsync.sh | 73 +++++++++++++-------------- 3 files changed, 93 insertions(+), 68 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 43732d7b49f..148aa87f791 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1220,26 +1220,55 @@ is_local_ip() check_sockets_utils() { + # The presence of any of these utilities is enough for us: lsof_available=0 sockstat_available=0 ss_available=0 - # The presence of any of these utilities is enough for us: - if [ -n "$(commandex ss)" ]; then + socket_utility="$(commandex ss)" + if [ -n "$socket_utility" ]; then + socket_uname='ss' ss_available=1 - elif [ -n "$(commandex sockstat)" ]; then - sockstat_available=1 - elif [ -n "$(commandex lsof)" ]; then - lsof_available=1 - # Let's check that lsof has an option to bypass blocking: - if lsof -h 2>&1 | grep -qw -F -- '-b'; then - lsof_available=2 + ss_opts='-nlp' + # Let's check that ss has an option to skip headers: + if $socket_utility -h 2>&1 | grep -qw -F -- '-H'; then + ss_available=2 + ss_opts="${ss_opts}H" fi else - wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in" \ - "the PATH. Make sure you have it installed." - exit 2 # ENOENT + socket_utility="$(commandex sockstat)" + if [ -n "$socket_utility" ]; then + socket_uname='sockstat' + sockstat_available=1 + sockstat_opts='-p' + if [ "$OS" = 'FreeBSD' ]; then + # sockstat in FreeBSD is different from other systems, + # let's denote it with a different value: + sockstat_available=2 + fi + else + socket_utility="$(commandex lsof)" + if [ -n "$socket_utility" ]; then + socket_uname='lsof' + lsof_available=1 + lsof_opts='-Pnl' + # Let's check that lsof has an option to bypass blocking: + if $socket_utility -h 2>&1 | grep -qw -F -- '-b'; then + lsof_available=2 + lsof_opts="$lsof_opts -b -w" + else + lsof_opts="$lsof_opts -S 10" + fi + else + wsrep_log_error "Neither lsof, nor sockstat, nor ss tool" \ + "were found in the path. Make sure you have" \ + "at least one of them installed." + exit 2 # ENOENT + fi + fi fi + wsrep_log_info "'$socket_uname' is selected as a socket" \ + "information utility." } # @@ -1263,26 +1292,23 @@ check_port() local rc=1 if [ $ss_available -ne 0 ]; then - ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -q -E "users:\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 + $socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ + grep -q -E "[[:space:]]users:[[:space:]]?\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 elif [ $sockstat_available -ne 0 ]; then - local opts='-p' - if [ "$OS" = 'FreeBSD' ]; then - # sockstat on FreeBSD requires the "-s" option - # to display the connection state: - opts='-sp' - fi - sockstat $opts "$port" 2>/dev/null | \ - grep -q -E "[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*[[:space:]]LISTEN" && rc=0 - elif [ $lsof_available -ne 0 ]; then - local lsof_opts='-Pnl' - if [ $lsof_available -gt 1 ]; then - lsof_opts="$lsof_opts -b -w" + if [ $sockstat_available -gt 1 ]; then + # sockstat on FreeBSD does not return the connection + # state without special option that cancel filtering + # by the port, so we ignore the connection state for + # this system: + $socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -q -E "^[^[:space:]]+[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]]|\$)" && rc=0 else - lsof_opts="$lsof_opts -S 15" + $socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -q -E "^[^[:space:]]+[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]].+)?[[:space:]]LISTEN([[:space:]]|\$)" && rc=0 fi - lsof $lsof_opts -i ":$port" 2>/dev/null | \ - grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*\\(LISTEN\\)" && rc=0 + elif [ $lsof_available -ne 0 ]; then + $socket_utility $lsof_opts -i ":$port" 2>/dev/null | \ + grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]].+)?[[:space:]]\\(LISTEN\\)([[:space:]]|\$)" && rc=0 else wsrep_log_error "Unknown sockets utility" exit 2 # ENOENT @@ -1553,7 +1579,7 @@ get_proc() if [ -z "$nproc" ]; then set +e if [ "$OS" = 'Linux' ]; then - nproc=$(grep -cw -E '^processor' /proc/cpuinfo 2>/dev/null) + nproc=$(grep -cw -E '^processor' /proc/cpuinfo 2>/dev/null || :) elif [ "$OS" = 'Darwin' -o "$OS" = 'FreeBSD' ]; then nproc=$(sysctl -n hw.ncpu) fi diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 75c1e846c76..7f6de68eba9 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -751,7 +751,7 @@ setup_ports() wait_for_listen() { for i in {1..150}; do - if check_port "" "$SST_PORT" 'socat|nc'; then + if check_port "" "$SST_PORT" 'socat|nc|netcat'; then break fi sleep 0.2 diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index c5640d2a22c..0ebe8063823 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -92,53 +92,52 @@ check_pid_and_port() local utils='rsync|stunnel' - if ! check_port $pid "$port" "$utils"; then - local port_info - local busy=0 + local port_info + local final + if ! check_port $pid "$port" "$utils"; then if [ $ss_available -ne 0 -o $sockstat_available -ne 0 ]; then if [ $ss_available -ne 0 ]; then - port_info=$(ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -F 'users:(' | grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+") + port_info=$($socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ + grep -E '[[:space:]]users:[[:space:]]?(' | \ + grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+" || :) else - local opts='-p' - local terms=4 - if [ "$OS" = 'FreeBSD' ]; then - # sockstat on FreeBSD requires the "-s" option - # to display the connection state: - opts='-sp' - # in addition, sockstat produces an additional column: - terms=5 + if [ $sockstat_available -gt 1 ]; then + # sockstat on FreeBSD does not return the connection + # state without special option that cancel filtering + # by the port, so we ignore the connection state for + # this system, also on the FreeBSD sockstat utility + # produces an additional column: + port_info=$($socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -o -E "([^[:space:]]+[[:space:]]+){5}[^[:space:]]+" || :) + else + port_info=$($socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -E '[[:space:]]LISTEN([[:space:]]|$)' | \ + grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+" || :) fi - port_info=$(sockstat $opts "$port" 2>/dev/null | \ - grep -E '[[:space:]]LISTEN' | grep -o -E "([^[:space:]]+[[:space:]]+){$terms}[^[:space:]]+") fi - echo "$port_info" | \ - grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port\$" && busy=1 + final='$' else - local lsof_opts='-Pnl' - if [ $lsof_available -gt 1 ]; then - lsof_opts="$lsof_opts -b -w" - else - lsof_opts="$lsof_opts -S 15" - fi - port_info=$(lsof $lsof_opts -i ":$port" 2>/dev/null | grep -F '(LISTEN)' || :) - echo "$port_info" | \ - grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port[[:space:]]" && busy=1 + port_info=$($socket_utility $lsof_opts -i ":$port" 2>/dev/null | \ + grep -w -F '(LISTEN)' || :) + final='[[:space:]]' + fi + + local busy=0 + if [ -n "$port_info" ]; then + local address='(\*|[0-9a-fA-F]*(:[0-9a-fA-F]*){1,7}|[0-9]+(\.[0-9]+){3})' + local filter="[[:space:]]($address|\\[$address\\])(%[^:]+)?:$port$final" + echo "$port_info" | grep -q -E "$filter" && busy=1 fi if [ $busy -eq 0 ]; then - if ! echo "$port_info" | grep -qw -F "[$addr]:$port" && \ - ! echo "$port_info" | grep -qw -F -- "$addr:$port" - then - if ! ps -p $pid >/dev/null 2>&1; then - wsrep_log_error \ - "rsync or stunnel daemon (PID: $pid)" \ - "terminated unexpectedly." - exit 16 # EBUSY - fi - return 1 + if ! ps -p $pid >/dev/null 2>&1; then + wsrep_log_error \ + "the rsync or stunnel daemon (PID: $pid)" \ + "terminated unexpectedly." + exit 16 # EBUSY fi + return 1 fi if ! check_port $pid "$port" "$utils"; then @@ -244,7 +243,7 @@ if [ "${SSLMODE#VERIFY}" != "$SSLMODE" ]; then elif [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then # check if the address is an ip-address (v4 or v6): if echo "$WSREP_SST_OPT_HOST_UNESCAPED" | \ - grep -q -E '^([0-9]+(\.[0-9]+){3}|[0-9a-fA-F]*(\:[0-9a-fA-F]*)+)$' + grep -q -E '^([0-9]+(\.[0-9]+){3}|[0-9a-fA-F]*(:[0-9a-fA-F]*){1,7})$' then CHECK_OPT="checkIP = $WSREP_SST_OPT_HOST_UNESCAPED" else From 46a5d2f1cfe9bca9e00731394095f5b79592608d Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 15 Sep 2024 04:12:27 +0200 Subject: [PATCH 102/185] galera SST scripts: unification of the previous SST completion check --- scripts/wsrep_sst_backup.sh | 7 +-- scripts/wsrep_sst_common.sh | 27 ++++++++++- scripts/wsrep_sst_mariabackup.sh | 79 ++++++++++++-------------------- scripts/wsrep_sst_mysqldump.sh | 2 + scripts/wsrep_sst_rsync.sh | 50 ++++++-------------- 5 files changed, 74 insertions(+), 91 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index af2e396641b..e1a8b541cc8 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -22,14 +22,11 @@ set -ue # This is a reference script for rsync-based state snapshot transfer . $(dirname "$0")/wsrep_sst_common -wsrep_check_datadir - -DATA="$WSREP_SST_OPT_DATA" - -create_data MAGIC_FILE="$DATA/backup_sst_complete" +wait_previous_sst + [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" if [ "$WSREP_SST_OPT_ROLE" = 'donor' ] diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 148aa87f791..e6b48c4b6a6 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1769,7 +1769,7 @@ simple_cleanup() if [ $estatus -ne 0 ]; then wsrep_log_error "Cleanup after exit with status: $estatus" fi - if [ -n "${SST_PID:-}" ]; then + if [ -n "$SST_PID" ]; then [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" [ -f "$SST_PID" ] && rm -f "$SST_PID" || : fi @@ -1869,4 +1869,29 @@ create_dirs() fi } +wait_previous_sst() +{ + # give some time for previous SST to complete: + check_round=0 + while check_pid "$SST_PID" 1; do + wsrep_log_info "Previous SST is not completed, waiting for it to exit" + check_round=$(( check_round+1 )) + if [ $check_round -eq 30 ]; then + wsrep_log_error "previous SST script still running..." + exit 114 # EALREADY + fi + sleep 1 + done + + trap simple_cleanup EXIT + echo $$ > "$SST_PID" +} + +DATA="$WSREP_SST_OPT_DATA" + +wsrep_check_datadir +create_data + +SST_PID="$DATA/wsrep_sst.pid" + wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE started on $WSREP_SST_OPT_ROLE" diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 7f6de68eba9..c2d4752f3f2 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -24,7 +24,21 @@ set -ue # Make sure to read that before proceeding! . $(dirname "$0")/wsrep_sst_common -wsrep_check_datadir + +BACKUP_BIN=$(commandex 'mariadb-backup') +if [ -z "$BACKUP_BIN" ]; then + wsrep_log_error 'mariadb-backup binary not found in path' + exit 42 +fi + +BACKUP_PID="" + +INFO_FILE='xtrabackup_galera_info' +DONOR_INFO_FILE='donor_galera_info' +IST_FILE='xtrabackup_ist' + +MAGIC_FILE="$DATA/$INFO_FILE" +DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" ealgo="" eformat="" @@ -33,7 +47,6 @@ ekeyfile="" encrypt=0 ssyslog="" ssystag="" -BACKUP_PID="" tcert="" tcap="" tpem="" @@ -62,10 +75,10 @@ tcmd="" payload=0 pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p'" pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE" -STATDIR="" uextra=0 disver="" +STATDIR="" tmpopts="" itmpdir="" xtmpdir="" @@ -91,23 +104,6 @@ readonly TOTAL_TAG='total' # For backup locks it is 1 sent by joiner sst_ver=1 -declare -a RC - -BACKUP_BIN=$(commandex 'mariadb-backup') -if [ -z "$BACKUP_BIN" ]; then - wsrep_log_error 'mariadb-backup binary not found in path' - exit 42 -fi - -DATA="$WSREP_SST_OPT_DATA" - -INFO_FILE='xtrabackup_galera_info' -DONOR_INFO_FILE='donor_galera_info' -IST_FILE='xtrabackup_ist' - -MAGIC_FILE="$DATA/$INFO_FILE" -DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" - INNOAPPLYLOG="$DATA/mariabackup.prepare.log" INNOMOVELOG="$DATA/mariabackup.move.log" INNOBACKUPLOG="$DATA/mariabackup.backup.log" @@ -713,7 +709,7 @@ cleanup_at_exit() fi # Final cleanup - pgid=$(ps -o 'pgid=' $$ 2>/dev/null | grep -o -E '[0-9]+' || :) + local pgid=$(ps -o 'pgid=' $$ 2>/dev/null | grep -o -E '[0-9]+' || :) # This means no setsid done in mysqld. # We don't want to kill mysqld here otherwise. @@ -727,7 +723,7 @@ cleanup_at_exit() fi fi - if [ -n "${SST_PID:-}" ]; then + if [ -n "$SST_PID" ]; then [ -f "$SST_PID" ] && rm -f "$SST_PID" || : fi @@ -933,7 +929,17 @@ if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -F -- '--version-check'; then disver=' --no-version-check' fi -create_data +get_stream +get_transfer + +findopt='-L' +[ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" + +wait_previous_sst + +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" +[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" +[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" if [ $ssyslog -eq 1 ]; then if [ -n "$(commandex logger)" ]; then @@ -1053,30 +1059,6 @@ send_magic() fi } -get_stream -get_transfer - -findopt='-L' -[ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" - -SST_PID="$DATA/wsrep_sst.pid" - -# give some time for previous SST to complete: -check_round=0 -while check_pid "$SST_PID"; do - wsrep_log_info "previous SST is not completed, waiting for it to exit" - check_round=$(( check_round+1 )) - if [ $check_round -eq 30 ]; then - wsrep_log_error "previous SST script still running." - exit 114 # EALREADY - fi - sleep 1 -done - -[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" -[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" -[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" - if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then trap cleanup_at_exit EXIT @@ -1249,9 +1231,6 @@ else # joiner impts="--parallel=$backup_threads${impts:+ }$impts" fi - trap simple_cleanup EXIT - echo $$ > "$SST_PID" - stagemsg='Joiner-Recv' MODULE="${WSREP_SST_OPT_MODULE:-xtrabackup_sst}" diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index a06231424b5..88b7d13cf5b 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -23,6 +23,8 @@ set -ue . $(dirname "$0")/wsrep_sst_common +wait_previous_sst + EINVAL=22 if test -z "$WSREP_SST_OPT_HOST"; then wsrep_log_error "HOST cannot be nil"; exit $EINVAL; fi diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 0ebe8063823..6bf5ba83fd2 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -22,13 +22,22 @@ set -ue # This is a reference script for rsync-based state snapshot transfer . $(dirname "$0")/wsrep_sst_common -wsrep_check_datadir wsrep_check_programs rsync RSYNC_REAL_PID=0 # rsync process id STUNNEL_REAL_PID=0 # stunnel process id +MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}" + +RSYNC_PID="$DATA/$MODULE.pid" +RSYNC_CONF="$DATA/$MODULE.conf" + +STUNNEL_CONF="$DATA/stunnel.conf" +STUNNEL_PID="$DATA/stunnel.pid" + +MAGIC_FILE="$DATA/rsync_sst_complete" + cleanup_joiner() { # Since this is invoked just after exit NNN @@ -150,13 +159,6 @@ check_pid_and_port() check_pid "$pid_file" && [ $CHECK_PID -eq $pid ] } -DATA="$WSREP_SST_OPT_DATA" - -STUNNEL_CONF="$DATA/stunnel.conf" -STUNNEL_PID="$DATA/stunnel.pid" - -MAGIC_FILE="$DATA/rsync_sst_complete" - get_binlog if [ -n "$WSREP_SST_OPT_BINLOG" ]; then @@ -164,8 +166,6 @@ if [ -n "$WSREP_SST_OPT_BINLOG" ]; then binlog_base=$(basename "$WSREP_SST_OPT_BINLOG") fi -create_data - BINLOG_TAR_FILE="$DATA_DIR/wsrep_sst_binlog.tar" ar_log_dir="$DATA_DIR" @@ -270,22 +270,7 @@ fi readonly SECRET_TAG='secret' readonly BYPASS_TAG='bypass' -SST_PID="$DATA/wsrep_sst.pid" - -# give some time for previous SST to complete: -check_round=0 -while check_pid "$SST_PID"; do - wsrep_log_info "Previous SST is not completed, waiting for it to exit" - check_round=$(( check_round+1 )) - if [ $check_round -eq 20 ]; then - wsrep_log_error "previous SST script still running." - exit 114 # EALREADY - fi - sleep 1 -done - -trap simple_cleanup EXIT -echo $$ > "$SST_PID" +wait_previous_sst # give some time for stunnel from the previous SST to complete: check_round=0 @@ -293,26 +278,21 @@ while check_pid "$STUNNEL_PID" 1 "$STUNNEL_CONF"; do wsrep_log_info "Lingering stunnel daemon found at startup," \ "waiting for it to exit" check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "stunnel daemon still running." + if [ $check_round -eq 30 ]; then + wsrep_log_error "stunnel daemon still running..." exit 114 # EALREADY fi sleep 1 done -MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}" - -RSYNC_PID="$DATA/$MODULE.pid" -RSYNC_CONF="$DATA/$MODULE.conf" - # give some time for rsync from the previous SST to complete: check_round=0 while check_pid "$RSYNC_PID" 1 "$RSYNC_CONF"; do wsrep_log_info "Lingering rsync daemon found at startup," \ "waiting for it to exit" check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "rsync daemon still running." + if [ $check_round -eq 30 ]; then + wsrep_log_error "rsync daemon still running..." exit 114 # EALREADY fi sleep 1 From 228cb073ad5e85e7444152b581413143aee58568 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 15 Sep 2024 04:27:23 +0200 Subject: [PATCH 103/185] galera SST scripts: comments update --- scripts/wsrep_sst_backup.sh | 4 ++-- scripts/wsrep_sst_common.sh | 5 +++-- scripts/wsrep_sst_mariabackup.sh | 4 +++- scripts/wsrep_sst_mysqldump.sh | 4 ++-- scripts/wsrep_sst_rsync.sh | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index e1a8b541cc8..6f72064abd5 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2021 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2010-2014 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for rsync-based state snapshot transfer +# This is a reference script for backup recovery state snapshot transfer. . $(dirname "$0")/wsrep_sst_common diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index e6b48c4b6a6..9ea539a4e99 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2012-2015 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -15,7 +15,8 @@ # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a common command line parser to be sourced by other SST scripts +# This is a common command line parser and common functions to +# be sourced by other SST scripts. trap 'exit 32' HUP PIPE trap 'exit 3' INT QUIT TERM diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index c2d4752f3f2..4db299f7670 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2013 Percona Inc # # This program is free software; you can redistribute it and/or modify @@ -19,6 +19,8 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. +# This is a reference script for mariadb-backup-based state snapshot transfer. + # Documentation: # https://mariadb.com/kb/en/mariabackup-overview/ # Make sure to read that before proceeding! diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 88b7d13cf5b..fa896bf5bb1 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -3,7 +3,7 @@ set -ue # Copyright (C) 2009-2015 Codership Oy -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 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 @@ -19,7 +19,7 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for mysqldump-based state snapshot tansfer +# This is a reference script for mysqldump-based state snapshot tansfer. . $(dirname "$0")/wsrep_sst_common diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 6bf5ba83fd2..8acca6f1171 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2010-2022 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for rsync-based state snapshot transfer +# This is a reference script for rsync-based state snapshot transfer. . $(dirname "$0")/wsrep_sst_common From 64356509afbbe0f1292fb5fd46849a6e735a83f1 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 15 Sep 2024 04:34:33 +0200 Subject: [PATCH 104/185] galera SST scripts: moving mysqldump-specific code out of the wsrep_sst_common --- scripts/wsrep_sst_common.sh | 13 ------------- scripts/wsrep_sst_mysqldump.sh | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 9ea539a4e99..9a89689ede6 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -865,19 +865,6 @@ readonly WSREP_SST_OPT_ADDR_PORT script_binary=$(dirname "$0") SCRIPTS_DIR=$(cd "$script_binary"; pwd) EXTRA_DIR="$SCRIPTS_DIR/../extra" -CLIENT_DIR="$SCRIPTS_DIR/../client" - -if [ -x "$CLIENT_DIR/mysql" ]; then - MYSQL_CLIENT="$CLIENT_DIR/mysql" -else - MYSQL_CLIENT=$(commandex 'mysql') -fi - -if [ -x "$CLIENT_DIR/mysqldump" ]; then - MYSQLDUMP="$CLIENT_DIR/mysqldump" -else - MYSQLDUMP=$(commandex 'mysqldump') -fi if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults" diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index fa896bf5bb1..f8fbda24356 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -23,6 +23,20 @@ set -ue . $(dirname "$0")/wsrep_sst_common +CLIENT_DIR="$SCRIPTS_DIR/../client" + +if [ -x "$CLIENT_DIR/mysql" ]; then + MYSQL_CLIENT="$CLIENT_DIR/mysql" +else + MYSQL_CLIENT=$(commandex 'mysql') +fi + +if [ -x "$CLIENT_DIR/mysqldump" ]; then + MYSQLDUMP="$CLIENT_DIR/mysqldump" +else + MYSQLDUMP=$(commandex 'mysqldump') +fi + wait_previous_sst EINVAL=22 @@ -37,7 +51,8 @@ if is_local_ip "$WSREP_SST_OPT_HOST_UNESCAPED" && \ [ "$WSREP_SST_OPT_PORT" = "$WSREP_SST_OPT_LPORT" ] then wsrep_log_error \ - "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT' matches source address." + "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT'" \ + "matches source address." exit $EINVAL fi From 45be538cf4704e8e9306b4abe9def43d3d375dc6 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 15 Sep 2024 06:46:53 +0200 Subject: [PATCH 105/185] galera SST scripts: added missing 'datadir' parameter for mysqldump method --- sql/wsrep_sst.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 13500a83f43..34eda4e286d 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1522,11 +1522,13 @@ static int sst_donate_mysqldump (const char* addr, WSREP_SST_OPT_PORT " '%u' " WSREP_SST_OPT_LPORT " '%u' " WSREP_SST_OPT_SOCKET " '%s' " + WSREP_SST_OPT_DATA " '%s' " "%s" WSREP_SST_OPT_GTID " '%s:%lld,%d-%d-%llu' " WSREP_SST_OPT_GTID_DOMAIN_ID " '%d'" "%s", addr, port, mysqld_port, mysqld_unix_port, + mysql_real_data_home, wsrep_defaults_file, uuid_oss.str().c_str(), gtid.seqno().get(), wsrep_gtid_server.domain_id, wsrep_gtid_server.server_id, From 222744c54e0b9ec6cf4b74cbbd9a81ae6436ee85 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 16 Sep 2024 04:57:56 +0200 Subject: [PATCH 106/185] galera SST scripts: fixing glitchy sockstat issues for FreeBSD --- scripts/wsrep_sst_common.sh | 20 ++++++++++++++------ scripts/wsrep_sst_rsync.sh | 19 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 9a89689ede6..f9e563c2a95 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1233,6 +1233,7 @@ check_sockets_utils() # sockstat in FreeBSD is different from other systems, # let's denote it with a different value: sockstat_available=2 + sockstat_opts='-46lq -P tcp -p' fi else socket_utility="$(commandex lsof)" @@ -1277,18 +1278,25 @@ check_port() [ $pid -le 0 ] && pid='[0-9]+' - local rc=1 + local rc=2 # ENOENT if [ $ss_available -ne 0 ]; then $socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ grep -q -E "[[:space:]]users:[[:space:]]?\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 elif [ $sockstat_available -ne 0 ]; then if [ $sockstat_available -gt 1 ]; then - # sockstat on FreeBSD does not return the connection - # state without special option that cancel filtering - # by the port, so we ignore the connection state for - # this system: - $socket_utility $sockstat_opts "$port" 2>/dev/null | \ + # The sockstat command on FreeBSD does not return + # the connection state without special option, but + # it supports filtering by connection state: + local out + out=$($socket_utility $sockstat_opts "$port" 2>/dev/null) || rc=16 # EBUSY + # On FreeBSD, the sockstat utility may exit without + # any output due to locking issues in certain versions; + # let's return a special exit code in such cases: + if [ $rc -eq 16 -o -z "$out" ]; then + return 16 # EBUSY + fi + echo "$out" | \ grep -q -E "^[^[:space:]]+[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]]|\$)" && rc=0 else $socket_utility $sockstat_opts "$port" 2>/dev/null | \ diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 8acca6f1171..eb68d134eff 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -112,11 +112,11 @@ check_pid_and_port() grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+" || :) else if [ $sockstat_available -gt 1 ]; then - # sockstat on FreeBSD does not return the connection - # state without special option that cancel filtering - # by the port, so we ignore the connection state for - # this system, also on the FreeBSD sockstat utility - # produces an additional column: + # The sockstat command on FreeBSD does not return + # the connection state without special option, but + # it supports filtering by connection state. + # Additionally, the sockstat utility on FreeBSD + # produces an one extra column: port_info=$($socket_utility $sockstat_opts "$port" 2>/dev/null | \ grep -o -E "([^[:space:]]+[[:space:]]+){5}[^[:space:]]+" || :) else @@ -149,7 +149,14 @@ check_pid_and_port() return 1 fi - if ! check_port $pid "$port" "$utils"; then + local rc=0 + check_port $pid "$port" "$utils" || rc=$? + if [ $rc -eq 16 ]; then + # We will ignore the return code EBUSY, which indicates + # a failed attempt to run the utility for retrieving + # socket information (on some systems): + return 1 + elif [ $rc -ne 0 ]; then wsrep_log_error "rsync or stunnel daemon port '$port'" \ "has been taken by another program" exit 16 # EBUSY From a1adabdd5cd46e58040626136a4d45b9ebafd772 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 17 Sep 2024 08:44:20 +0400 Subject: [PATCH 107/185] MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata A CHAR column cannot be longer than 1024, because Binlog_type_info_fixed_string::Binlog_type_info_fixed_string replies on this fact - it cannot store binlog metadata for longer columns. In case of the filename character set mbmaxlen is equal to 5, so only 1024/5=204 characters can fit into the 1024 limit. - In strict mode: Disallowing creation of a CHAR column with octet length grater than 1024. - In non-strict mode: Automatically convert CHAR with octet length>1024 into VARCHAR. --- mysql-test/main/ctype_filename.result | 27 +++++++++++++++++++++++++++ mysql-test/main/ctype_filename.test | 22 ++++++++++++++++++++++ sql/sql_table.cc | 27 +++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result index aaccea91793..9cf1c07e00d 100644 --- a/mysql-test/main/ctype_filename.result +++ b/mysql-test/main/ctype_filename.result @@ -132,4 +132,31 @@ a c @002d1 @002d1 DROP TABLE t1; SET NAMES utf8; +# +# MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +# +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(204) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +Warnings: +Note 1246 Converting column 'a' from CHAR to VARCHAR +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(205) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index bfafe4d437f..185d4ca641a 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -141,4 +141,26 @@ SET NAMES utf8; --enable_ps_protocol +--echo # +--echo # MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +--echo # + +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; + +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +--error ER_TOO_BIG_FIELDLENGTH +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +DROP TABLE t1; + --echo # End of 10.5 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ef0a6e3bef..0a0ea7acb2e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4734,6 +4734,33 @@ bool Column_definition::prepare_blob_field(THD *thd) { DBUG_ENTER("Column_definition::prepare_blob_field"); + if (real_field_type() == FIELD_TYPE_STRING && length > 1024) + { + DBUG_ASSERT(charset->mbmaxlen > 4); + /* + Convert long CHAR columns to VARCHAR. + CHAR has an octet length limit of 1024 bytes. + The code in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string + relies on this limit. If octet length of a CHAR column is greater + than 1024, then it cannot write its metadata to binlog properly. + In case of the filename character set with mbmaxlen=5, + the maximum possible character length is 1024/5=204 characters. + Upgrade to VARCHAR if octet length is greater than 1024. + */ + char warn_buff[MYSQL_ERRMSG_SIZE]; + if (thd->is_strict_mode()) + { + my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), field_name.str, + static_cast(1024 / charset->mbmaxlen)); + DBUG_RETURN(1); + } + set_handler(&type_handler_varchar); + my_snprintf(warn_buff, sizeof(warn_buff), ER_THD(thd, ER_AUTO_CONVERT), + field_name.str, "CHAR", "VARCHAR"); + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, + warn_buff); + } + if (length > MAX_FIELD_VARCHARLENGTH && !(flags & BLOB_FLAG)) { /* Convert long VARCHAR columns to TEXT or BLOB */ From 68938d2b42474a6ff1fced3b1495ec45de2f5c47 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Mon, 9 Sep 2024 08:50:02 -0600 Subject: [PATCH 108/185] MDEV-33500 (part 2): rpl.rpl_parallel_sbm can still fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The failing test case validates Seconds_Behind_Master for a delayed slave, while STOP SLAVE is executed during a delay. The test fixes initially added to the test (commit b04c8575967) added a table lock to ensure a transaction could not finish before validating the Seconds_Behind_Master field after SLAVE START, but did not address a possibility that the transaction could finish before running the STOP SLAVE command, which invalidates the validations for the rest of the test case. Specifically, this would result in 1) a timeout in “Waiting for table metadata lock†on the replica, which expects the transaction to retry after slave restart and hit a lock conflict on the locked tables (added in b04c8575967), and 2) that Seconds_Behind_Master should have increased, but did not. The failure can be reproduced by synchronizing the slave to the master before the MDEV-32265 echo statement (i.e. before the SLAVE STOP). This patch fixes the test by adding a mechanism to use DEBUG_SYNC to synchronize a MASTER_DELAY, rather than continually increase the duration of the delay each time the test fails on buildbot. This is to ensure that on slow machines, a delay does not pass before the test gets a chance to validate results. Additionally, it decreases overall test time because the test can continue immediately after validation, thereby bypassing the remainder of a full delay for each transaction. --- .../sync_with_master_sql_delay_debug_sync.inc | 82 +++++++++++++++++++ .../suite/rpl/r/rpl_parallel_sbm.result | 38 ++++++++- mysql-test/suite/rpl/t/rpl_parallel_sbm.test | 50 +++++++++-- sql/slave.cc | 19 ++++- 4 files changed, 177 insertions(+), 12 deletions(-) create mode 100644 mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc diff --git a/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc new file mode 100644 index 00000000000..7f3602d6979 --- /dev/null +++ b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc @@ -0,0 +1,82 @@ +# ==== Purpose ==== +# +# If using DEBUG_SYNC to coordinate a slave's SQL DELAY via the DEBUG_DBUG +# identifier "sql_delay_by_debug_sync", this helper file will help synchronize +# a slave with the master for statements which don't need to be delayed. This +# can be helpful, for example, for setup/cleanup statements, if they must be +# run in the same lifetime as the statements used for the test. +# +# The actual synchronization will take place based on the input parameter +# slave_sync_method, which can be "gtid", "file_coord", or "none"; and will use +# the helper files sync_with_master_gtid.inc or sync_with_master.inc (or none +# at all), respectively. +# +# +# ==== Requirements ==== +# +# --source include/have_debug.inc +# --source include/have_debug_sync.inc +# set @@GLOBAL.debug_dbug= "+d,sql_delay_by_debug_sync"; +# +# +# ==== Usage ==== +# +# --let $slave_sync_method= gtid|file_coord|none +# [--let $num_event_groups= NUMBER] +# --source include/sync_with_master_sql_delay_debug_sync.inc +# +# +# Parameters: +# $slave_sync_method +# Value can be gtid, file_coord, or none; and will synchronize the slave +# with the master via this method (i.e. using sync_with_master_gtid.inc +# or sync_with_master.inc, respectively), after synchronizing the SQL +# delay +# +# $num_event_groups +# Number of event groups to synchronize the SQL delay for. If unset, will +# be default to 1. +# + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/begin_include_file.inc + +if (!$slave_sync_method) +{ + --die Parameter slave_sync_method must be set +} + +if (`select "$slave_sync_method" not like "gtid" and "$slave_sync_method" not like "file_coord" and "$slave_sync_method" not like "none"`) +{ + --die Parameter slave_sync_method must have value "gtid", "file_coord" or "none" +} + +if (`select "$slave_sync_method" not like "none" and strcmp("$master_pos", "") = 0`) +{ + --die sync_with_master.inc or sync_with_master_gtid.inc was not called to populate variable master_pos +} + +if (!$num_event_groups) +{ + --let $num_event_groups= 1 +} + +while ($num_event_groups) +{ + set debug_sync= "now WAIT_FOR at_sql_delay"; + set debug_sync= "now SIGNAL continue_sql_thread"; + --dec $num_event_groups +} + +if (`select "$slave_sync_method" LIKE "gtid"`) +{ + --source include/sync_with_master_gtid.inc +} + +if (`select "$slave_sync_method" LIKE "file_coord"`) +{ + --source include/sync_with_master.inc +} + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result index 75012c93f3b..59a6955aa1b 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result @@ -5,14 +5,20 @@ include/master-slave.inc # connection slave; include/stop_slave.inc -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; -change master to master_delay=3, master_use_gtid=Slave_Pos; +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; +change master to master_delay=1, master_use_gtid=Slave_Pos; include/start_slave.inc connection master; create table t1 (a int); create table t2 (a int); -include/sync_slave_sql_with_master.inc +include/save_master_gtid.inc +connection slave; +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # # Pt 1) Ensure SBM is updated immediately upon arrival of the next event connection master; @@ -21,12 +27,23 @@ insert into t1 values (0); include/save_master_gtid.inc connection slave; # Waiting for transaction to arrive on slave and begin SQL Delay.. +set debug_sync= "now WAIT_FOR at_sql_delay"; # Validating SBM is updated on event arrival.. # ..done # MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently # delaying a transaction; then when the reciprocal START SLAVE occurs, # if the event is still to be delayed, SBM should resume accordingly -include/stop_slave.inc +connection server_2; +# Ensure the kill from STOP SLAVE will be received before continuing the +# SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +STOP SLAVE; +connection slave; +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; +connection server_2; +include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; # Lock t1 on slave to ensure the event can't finish (and thereby update # Seconds_Behind_Master) so slow running servers don't accidentally # catch up to the master before checking SBM. @@ -34,6 +51,10 @@ connection server_2; LOCK TABLES t1 WRITE; include/start_slave.inc connection slave; +# SQL delay has no impact for the rest of the test case, so ignore it +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Waiting for replica to get blocked by the table lock # Sleeping 1s to increment SBM # Ensuring Seconds_Behind_Master increases after sleeping.. @@ -54,6 +75,13 @@ insert into t1 values (2); include/save_master_pos.inc connection slave; # Wait for first transaction to complete SQL delay and begin execution.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +# Wait for second transaction to complete SQL delay.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. # ..and that SBM wasn't calculated using prior committed transactions # ..done @@ -63,6 +91,8 @@ include/wait_for_slave_param.inc [Relay_Master_Log_File] include/wait_for_slave_param.inc [Exec_Master_Log_Pos] # Cleanup include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; CHANGE MASTER TO master_delay=0; include/start_slave.inc # diff --git a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test index 90753caf143..6941a88f4d0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test @@ -3,6 +3,7 @@ # --source include/have_log_bin.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/master-slave.inc --echo # @@ -16,14 +17,23 @@ # Seconds_Behind_Master is based on the timestamp of the new transaction, # rather than the last committed transaction. # +# Note that the test doesn't actually use the value of MASTER_DELAY, but +# rather uses debug_sync to coordinate the end of the delay. This is to ensure +# that on slow machines, a delay doesn't pass before the test gets a chance to +# validate results. Additionally, it lets us continue testing after validation +# so we don't have to wait out a full delay unnecessarily. The debug_sync point +# is enabled via sql_delay_by_debug_sync, which will delay transactions based +# only on GTID events, so only one synchronization is needed per transaction. +# --connection slave --source include/stop_slave.inc --let $save_dbug= `SELECT @@GLOBAL.debug_dbug` --let $save_parallel_mode= `SELECT @@GLOBAL.slave_parallel_mode` -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; ---let $master_delay= 3 +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; + +--let $master_delay= 1 --eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos --source include/start_slave.inc @@ -31,7 +41,11 @@ set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; --let insert_ctr= 0 create table t1 (a int); create table t2 (a int); ---source include/sync_slave_sql_with_master.inc +--source include/save_master_gtid.inc +--connection slave +--let $slave_sync_method= gtid +--let $num_event_groups= 2 +--source include/sync_with_master_sql_delay_debug_sync.inc --echo # --echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event @@ -48,8 +62,7 @@ sleep 2; --connection slave --echo # Waiting for transaction to arrive on slave and begin SQL Delay.. ---let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; ---source include/wait_condition.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; --echo # Validating SBM is updated on event arrival.. --let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) @@ -66,7 +79,20 @@ if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`) --echo # delaying a transaction; then when the reciprocal START SLAVE occurs, --echo # if the event is still to be delayed, SBM should resume accordingly ---source include/stop_slave.inc +--connection server_2 +--echo # Ensure the kill from STOP SLAVE will be received before continuing the +--echo # SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +--send STOP SLAVE + +--connection slave +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; + +--connection server_2 +--reap +--source include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; --echo # Lock t1 on slave to ensure the event can't finish (and thereby update --echo # Seconds_Behind_Master) so slow running servers don't accidentally @@ -77,6 +103,11 @@ LOCK TABLES t1 WRITE; --source include/start_slave.inc --connection slave + +--echo # SQL delay has no impact for the rest of the test case, so ignore it +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Waiting for replica to get blocked by the table lock --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock'; --source include/wait_condition.inc @@ -120,9 +151,14 @@ sleep 3; --connection slave --echo # Wait for first transaction to complete SQL delay and begin execution.. +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker'; --source include/wait_condition.inc +--echo # Wait for second transaction to complete SQL delay.. +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. --let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) --let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()` @@ -147,6 +183,8 @@ UNLOCK TABLES; --echo # Cleanup --source include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; --eval CHANGE MASTER TO master_delay=0 --source include/start_slave.inc diff --git a/sql/slave.cc b/sql/slave.cc index f258f9f3595..1a6a5a6efdb 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1088,6 +1088,8 @@ terminate_slave_thread(THD *thd, mysql_mutex_unlock(&thd->LOCK_thd_kill); mysql_mutex_unlock(&thd->LOCK_thd_data); + DEBUG_SYNC(current_thd, "after_thd_awake_kill"); + /* There is a small chance that slave thread might miss the first alarm. To protect againts it, resend the signal until it reacts @@ -3794,13 +3796,26 @@ sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi) sql_delay, (long)ev->when, rli->mi->clock_diff_with_master, (long)now, (ulonglong)sql_delay_end, (long)nap_time)); - - if (sql_delay_end > now) + /* if using debug_sync for sql_delay, only delay once per event group */ + if (DBUG_EVALUATE_IF("sql_delay_by_debug_sync", type == GTID_EVENT, + sql_delay_end > now)) { DBUG_PRINT("info", ("delaying replication event %lu secs", nap_time)); rli->start_sql_delay(sql_delay_end); mysql_mutex_unlock(&rli->data_lock); + +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sql_delay_by_debug_sync", { + DBUG_ASSERT(!debug_sync_set_action( + thd, STRING_WITH_LEN( + "now SIGNAL at_sql_delay WAIT_FOR continue_sql_thread"))); + + // Skip the actual sleep if using DEBUG_SYNC to coordinate SQL_DELAY + DBUG_RETURN(0); + };); +#endif + DBUG_RETURN(slave_sleep(thd, nap_time, sql_slave_killed, rgi)); } } From 64b75865d587aa925d7c95fc63800bb36859d8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 18 Sep 2024 07:06:35 +0300 Subject: [PATCH 109/185] MDEV-34823 after-merge fix btr_cur_t::search_leaf(): Remove a redundant condition. This fixes up the merge commit cfa9784edb137ab1357a33cac3eee53c893eb3e7 --- storage/innobase/btr/btr0cur.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 4284b84c22b..53ed85f4bda 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1196,8 +1196,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, buf_page_get_gen(page_id, zip_size, rw_latch, guess, BUF_GET, mtr, &err); if (!block) { - if (err != DB_SUCCESS) - btr_read_failed(err, *index()); + btr_read_failed(err, *index()); goto func_exit; } From 391c9db4862ab50a7c074a27b46cd686f09f4dd2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 18 Sep 2024 16:41:57 +1000 Subject: [PATCH 110/185] MDEV-34952 main.log_slow test failure on opensuse builder The loose regex for the MDEV-34539 test ended up matching the opensuse in the path in buildbot. Adjust to more complete regex including space, backtick and \n, which becomes much less common as a path name. --- mysql-test/main/log_slow.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 085f15f752a..b11bc00ace9 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -214,7 +214,7 @@ set log_slow_filter=default; set timestamp=default; let SEARCH_FILE=`select @@slow_query_log_file`; -let SEARCH_PATTERN=use.*2; +let SEARCH_PATTERN= use \`a\n.*2; let SEARCH_OUTPUT=matches; source include/search_pattern_in_file.inc; From 450040e0dad4448be6a3e8d330af7d2d943f4773 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 18 Sep 2024 16:41:57 +1000 Subject: [PATCH 111/185] MDEV-34952 main.log_slow test failure on opensuse builder The loose regex for the MDEV-34539 test ended up matching the opensuse in the path in buildbot. Adjust to more complete regex including space, backtick and \n, which becomes much less common as a path name. --- mysql-test/main/log_slow.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 9e21f9d3890..8997b95d72c 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -213,7 +213,7 @@ set log_slow_filter=default; set timestamp=default; let SEARCH_FILE=`select @@slow_query_log_file`; -let SEARCH_PATTERN=use.*2; +let SEARCH_PATTERN= use \`a\n.*2; let SEARCH_OUTPUT=matches; source include/search_pattern_in_file.inc; From ab569524dc73ed17cc0c8f142b23e228d7c89726 Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Tue, 21 May 2024 17:46:29 +0700 Subject: [PATCH 112/185] MDEV-31005: Make working cursor-protocol Added ability to disable/enable (--disable_cursor_protocol/ --enable_cursor_protocol) cursor-protocol in tests. If "--disable_cursor_protocol" is used then ps-protocol is also disabled. With cursor-protocol prepare statement is executed only once. For "--cursor-protocol" added filter for queries: it is executed only for "SELECT" queries. --- client/mysqltest.cc | 61 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 7a31c6d6802..b687ea416c3 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -165,6 +165,7 @@ static struct property prop_list[] = { { &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" }, { &ps2_protocol_enabled, 0, 0, 0, "$ENABLED_PS2_PROTOCOL" }, { &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"}, + { &cursor_protocol_enabled, 0, 0, 0, "$ENABLED_CURSOR_PROTOCOL"}, { &service_connection_enabled, 0, 1, 0, "$ENABLED_SERVICE_CONNECTION"}, { &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" }, { &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" }, @@ -182,6 +183,7 @@ enum enum_prop { P_PS, P_PS2, P_VIEW, + P_CURSOR, P_CONN, P_QUERY, P_RESULT, @@ -274,6 +276,7 @@ static regex_t ps_re; /* the query can be run using PS protocol */ static regex_t ps2_re; /* the query can be run using PS protocol with second execution*/ static regex_t sp_re; /* the query can be run as a SP */ static regex_t view_re; /* the query can be run as a view*/ +static regex_t cursor_re; /* the query can be run with cursor protocol*/ static void init_re(void); static int match_re(regex_t *, char *); @@ -392,6 +395,7 @@ enum enum_commands { Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_DISABLE_PS2_PROTOCOL, Q_ENABLE_PS2_PROTOCOL, Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL, + Q_DISABLE_CURSOR_PROTOCOL, Q_ENABLE_CURSOR_PROTOCOL, Q_DISABLE_SERVICE_CONNECTION, Q_ENABLE_SERVICE_CONNECTION, Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, @@ -488,6 +492,8 @@ const char *command_names[]= "enable_ps2_protocol", "disable_view_protocol", "enable_view_protocol", + "disable_cursor_protocol", + "enable_cursor_protocol", "disable_service_connection", "enable_service_connection", "enable_non_blocking_api", @@ -8575,13 +8581,22 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, #if MYSQL_VERSION_ID >= 50000 if (cursor_protocol_enabled) { + ps2_protocol_enabled = 0; + /* - Use cursor when retrieving result + Use cursor for queries matching the filter, + else reset cursor type */ - ulong type= CURSOR_TYPE_READ_ONLY; - if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) - die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", - mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + if (match_re(&cursor_re, query)) + { + /* + Use cursor when retrieving result + */ + ulong type= CURSOR_TYPE_READ_ONLY; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } } #endif @@ -8623,9 +8638,10 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, /* When running in cursor_protocol get the warnings from execute here - and keep them in a separate string for later. + and keep them in a separate string for later. Cursor_protocol is used + only for queries matching the filter "cursor_re". */ - if (cursor_protocol_enabled && !disable_warnings) + if (cursor_protocol_enabled && match_re(&cursor_re, query) && !disable_warnings) append_warnings(&ds_execute_warnings, mysql); @@ -8767,6 +8783,16 @@ end: var_set_errno(mysql_stmt_errno(stmt)); + #if MYSQL_VERSION_ID >= 50000 + if (cursor_protocol_enabled) + { + ulong type= CURSOR_TYPE_NO_CURSOR; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } + #endif + revert_properties(); /* Close the statement if reconnect, need new prepare */ @@ -9609,10 +9635,19 @@ void init_re(void) "^(" "[[:space:]]*SELECT[[:space:]])"; + /* + Filter for queries that can be run with + cursor protocol + */ + const char *cursor_re_str = + "^(" + "[[:space:]]*SELECT[[:space:]])"; + init_re_comp(&ps_re, ps_re_str); init_re_comp(&ps2_re, ps2_re_str); init_re_comp(&sp_re, sp_re_str); init_re_comp(&view_re, view_re_str); + init_re_comp(&cursor_re, cursor_re_str); } @@ -9650,6 +9685,7 @@ void free_re(void) regfree(&ps2_re); regfree(&sp_re); regfree(&view_re); + regfree(&cursor_re); } /****************************************************************************/ @@ -10443,6 +10479,17 @@ int main(int argc, char **argv) case Q_ENABLE_VIEW_PROTOCOL: set_property(command, P_VIEW, view_protocol); break; + case Q_DISABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, 0); + if (cursor_protocol) + set_property(command, P_PS, 0); + /* Close any open statements */ + close_statements(); + break; + case Q_ENABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, cursor_protocol); + set_property(command, P_PS, ps_protocol); + break; case Q_DISABLE_SERVICE_CONNECTION: set_property(command, P_CONN, 0); /* Close only util connections */ From 0a5e4a0191ecedff7d57867b01864225615af430 Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Thu, 23 May 2024 08:54:14 +0700 Subject: [PATCH 113/185] MDEV-31005: Make working cursor-protocol Updated tests: cases with bugs or which cannot be run with the cursor-protocol were excluded with "--disable_cursor_protocol"/"--enable_cursor_protocol" Fix for v.10.5 --- mysql-test/include/commit.inc | 4 + mysql-test/include/ctype_like_range_f1f2.inc | 5 +- mysql-test/include/ctype_numconv.inc | 3 + mysql-test/include/diff_tables.inc | 2 + mysql-test/include/explain_utils.inc | 2 + mysql-test/include/function_defaults.inc | 4 + mysql-test/include/grant_cache.inc | 2 + mysql-test/include/ps_conv.inc | 2 + mysql-test/include/query_cache.inc | 4 + mysql-test/include/query_cache_partitions.inc | 6 ++ mysql-test/include/test_outfile.inc | 2 + .../include/type_temporal_zero_default.inc | 2 + mysql-test/include/write_var_to_file.inc | 2 + mysql-test/main/alter_table.test | 2 + mysql-test/main/alter_user.test | 2 + .../main/auto_increment_ranges_innodb.test | 2 + mysql-test/main/bootstrap.test | 2 + mysql-test/main/bug12427262.test | 4 + mysql-test/main/count_distinct2.test | 2 + mysql-test/main/ctype_big5.test | 2 + mysql-test/main/ctype_binary.test | 10 +++ mysql-test/main/ctype_filename.test | 3 + mysql-test/main/ctype_gbk.test | 2 + mysql-test/main/ctype_ucs.test | 4 + mysql-test/main/ctype_utf16.test | 3 + mysql-test/main/ctype_utf16le.test | 3 + mysql-test/main/ctype_utf32.test | 6 ++ mysql-test/main/ctype_utf8.test | 6 ++ mysql-test/main/ctype_utf8mb4.test | 5 ++ mysql-test/main/derived.test | 3 + mysql-test/main/derived_view.test | 10 +++ mysql-test/main/distinct.test | 2 + mysql-test/main/empty_table.test | 3 + mysql-test/main/events_bugs.test | 4 + mysql-test/main/explain.test | 4 + .../main/fast_prefix_index_fetch_innodb.test | 20 +++++ mysql-test/main/flush_ssl.test | 2 + mysql-test/main/func_analyse.test | 3 + mysql-test/main/func_des_encrypt.test | 6 ++ mysql-test/main/func_digest.test | 3 + mysql-test/main/func_gconcat.test | 6 ++ mysql-test/main/func_group_innodb.test | 2 + mysql-test/main/func_json.test | 34 +++++++- mysql-test/main/func_math.test | 3 + mysql-test/main/func_misc.test | 2 + mysql-test/main/func_str.test | 59 +++++++++++--- mysql-test/main/func_time.test | 13 +++ mysql-test/main/func_time_round.test | 6 ++ mysql-test/main/get_diagnostics.test | 4 + mysql-test/main/gis.test | 6 ++ mysql-test/main/grant.test | 2 + mysql-test/main/grant2.test | 7 ++ mysql-test/main/grant_4332.test | 6 ++ mysql-test/main/group_by.test | 7 +- mysql-test/main/group_min_max.test | 12 +++ mysql-test/main/handler_read_last.test | 2 + mysql-test/main/information_schema.test | 4 + mysql-test/main/init_file.test | 2 + mysql-test/main/innodb_ext_key.test | 4 + mysql-test/main/insert.test | 2 + mysql-test/main/invisible_field.test | 4 + mysql-test/main/join.test | 4 + mysql-test/main/join_outer.test | 9 ++- mysql-test/main/key_cache.test | 2 + mysql-test/main/last_value.test | 3 + mysql-test/main/limit_rows_examined.test | 5 ++ mysql-test/main/loaddata.test | 38 +++++++++ mysql-test/main/log_slow.test | 4 + mysql-test/main/log_tables.test | 5 ++ mysql-test/main/long_unique_bugs.test | 8 ++ mysql-test/main/lowercase_table_qcache.test | 2 + mysql-test/main/mdev-21101.test | 2 + mysql-test/main/myisam_debug.test | 2 + mysql-test/main/mysqldump-max.test | 2 + mysql-test/main/null.test | 3 + mysql-test/main/null_key.test | 2 + mysql-test/main/order_by.test | 8 ++ mysql-test/main/order_by_pack_big.test | 6 ++ mysql-test/main/outfile.test | 24 ++++++ mysql-test/main/outfile_loaddata.test | 36 +++++++++ mysql-test/main/parser.test | 2 + mysql-test/main/partition.test | 4 + mysql-test/main/partition_csv.test | 2 + mysql-test/main/partition_explicit_prune.test | 2 + mysql-test/main/plugin.test | 2 + mysql-test/main/processlist.test | 3 + mysql-test/main/ps.test | 11 +++ mysql-test/main/query_cache.test | 2 + mysql-test/main/query_cache_debug.test | 2 + mysql-test/main/query_cache_innodb.test | 6 ++ mysql-test/main/query_cache_merge.test | 4 + mysql-test/main/query_cache_notembedded.test | 6 ++ mysql-test/main/query_cache_with_views.test | 4 + mysql-test/main/range_vs_index_merge.test | 2 + mysql-test/main/select.test | 12 +++ mysql-test/main/select_found.test | 7 +- mysql-test/main/shutdown_not_windows.test | 2 + mysql-test/main/single_delete_update.test | 2 + mysql-test/main/sp-error.test | 2 + mysql-test/main/sp-no-valgrind.test | 6 ++ mysql-test/main/sp.test | 6 ++ mysql-test/main/sp_trans.test | 2 + mysql-test/main/statistics.test | 2 + mysql-test/main/status2.test | 2 + mysql-test/main/strict.test | 3 + mysql-test/main/subselect.test | 35 +++++++- mysql-test/main/subselect3.inc | 17 ++++ mysql-test/main/subselect_cache.test | 12 +++ .../main/subselect_exists2in_costmat.test | 2 + mysql-test/main/subselect_mat_cost.test | 2 + mysql-test/main/subselect_sj.test | 2 + mysql-test/main/tmp_table_count-7586.test | 2 + mysql-test/main/trigger-compat.test | 2 + mysql-test/main/trigger.test | 3 + mysql-test/main/type_binary.test | 3 + mysql-test/main/type_bit.test | 3 + mysql-test/main/type_date.test | 3 + mysql-test/main/type_enum.test | 3 + mysql-test/main/type_float.test | 5 ++ mysql-test/main/type_newdecimal.test | 7 +- mysql-test/main/type_timestamp.test | 5 ++ mysql-test/main/type_year.test | 3 + mysql-test/main/udf.test | 6 ++ mysql-test/main/union.test | 2 + mysql-test/main/update.test | 4 + mysql-test/main/user_var.test | 6 ++ mysql-test/main/userstat-badlogin-4824.test | 2 + mysql-test/main/userstat.test | 7 +- mysql-test/main/variables.test | 13 ++- mysql-test/main/view.test | 9 ++- mysql-test/main/view_grant.test | 4 + mysql-test/main/wl4435_generated.inc | 3 + mysql-test/suite/archive/rnd_pos.test | 4 + mysql-test/suite/binlog/include/database.test | 2 + .../suite/binlog/t/binlog_commit_wait.test | 2 + .../binlog/t/binlog_mysqlbinlog_row_frag.test | 2 + .../suite/compat/oracle/t/update_innodb.test | 2 + .../t/innodb_encrypt_temporary_tables.test | 2 + mysql-test/suite/engines/funcs/t/ld_null.test | 4 + .../suite/engines/funcs/t/ld_quote.test | 2 + .../suite/engines/iuds/t/insert_calendar.test | 45 +++++++++++ .../suite/engines/iuds/t/insert_decimal.test | 18 +++++ .../suite/engines/iuds/t/insert_time.test | 3 + .../federated/federatedx_create_handlers.test | 5 ++ .../suite/funcs_1/datadict/datadict.pre | 2 + .../suite/funcs_1/datadict/datadict_load.inc | 2 + .../suite/funcs_1/datadict/is_tables.inc | 4 + .../suite/funcs_1/storedproc/param_check.inc | 4 + .../suite/funcs_1/t/is_basics_mixed.test | 4 + .../suite/funcs_1/t/row_count_func.test | 4 + .../suite/funcs_1/triggers/triggers_08.inc | 7 +- .../suite/funcs_1/triggers/triggers_09.inc | 14 ++++ mysql-test/suite/gcol/inc/gcol_ins_upd.inc | 2 + mysql-test/suite/gcol/inc/gcol_keys.inc | 2 + mysql-test/suite/gcol/t/gcol_bugfixes.test | 6 ++ .../gcol/t/innodb_virtual_debug_purge.test | 4 + mysql-test/suite/handler/ps.test | 4 + .../innodb/t/alter_inplace_perfschema.test | 4 + mysql-test/suite/innodb/t/group_commit.test | 2 + .../t/group_commit_no_optimize_thread.test | 2 + .../t/innodb-page_compression_none.test | 3 +- .../innodb/t/innodb-system-table-view.test | 2 + .../innodb/t/innodb_buffer_pool_load_now.test | 2 + .../suite/innodb/t/innodb_bug51920.test | 2 + mysql-test/suite/innodb/t/innodb_mysql.test | 2 + .../innodb/t/innodb_stats_persistent.test | 2 + mysql-test/suite/innodb/t/instant_alter.test | 6 ++ .../suite/innodb/t/instant_alter_bugs.test | 2 + mysql-test/suite/innodb/t/restart.test | 2 + .../suite/innodb/t/temp_table_savepoint.test | 2 + mysql-test/suite/innodb_fts/t/opt.test | 2 + mysql-test/suite/innodb_gis/t/1.test | 3 + mysql-test/suite/innodb_gis/t/gis.test | 5 ++ mysql-test/suite/json/t/json_no_table.test | 79 ++++++++++++++++++- mysql-test/suite/parts/inc/partition.pre | 4 + .../suite/parts/inc/partition_alter3.inc | 2 + .../suite/parts/inc/partition_check.inc | 26 ++++++ .../suite/parts/inc/partition_check_read.inc | 6 ++ .../suite/parts/inc/partition_check_read1.inc | 6 ++ .../suite/parts/inc/partition_check_read2.inc | 6 ++ .../parts/inc/partition_layout_check2.inc | 2 + .../suite/parts/inc/partition_trigg1.inc | 4 + .../suite/parts/inc/partition_trigg3.inc | 2 + .../perfschema/t/alter_table_progress.test | 4 + .../suite/perfschema/t/dml_handler.test | 4 + .../perfschema/t/hostcache_ipv4_blocked.test | 2 + .../perfschema/t/hostcache_ipv4_max_con.test | 2 + .../perfschema/t/hostcache_ipv6_blocked.test | 2 + .../suite/perfschema/t/query_cache.test | 4 + .../suite/perfschema/t/rpl_threads.test | 6 ++ .../suite/perfschema/t/socket_connect.test | 2 + .../perfschema/t/socket_instances_func.test | 20 +++++ .../t/socket_instances_func_win.test | 12 +++ .../t/socket_summary_by_event_name_func.test | 5 +- .../suite/perfschema/t/table_schema.test | 8 ++ .../suite/perfschema/t/thread_cache.test | 8 ++ .../suite/perfschema/t/threads_mysql.test | 2 + mysql-test/suite/period/t/overlaps.test | 4 + mysql-test/suite/period/t/versioning.test | 6 ++ .../suite/plugins/t/feedback_plugin_load.test | 2 + mysql-test/suite/plugins/t/qc_info.test | 2 + mysql-test/suite/plugins/t/qc_info_init.inc | 4 + .../suite/roles/grant_revoke_current.test | 3 + .../suite/roles/set_default_role_ps-6960.test | 2 + mysql-test/suite/rpl/include/check_type.inc | 2 + .../rpl/include/rpl_innodb_rows_counters.inc | 2 + .../rpl/include/rpl_stop_middle_group.test | 6 ++ mysql-test/suite/rpl/t/rpl_binlog_errors.test | 4 + .../suite/rpl/t/rpl_checksum_cache.test | 4 + mysql-test/suite/rpl/t/rpl_do_grant.test | 2 + mysql-test/suite/rpl/t/rpl_drop_db.test | 2 + .../rpl/t/rpl_filter_tables_not_exist.test | 6 ++ mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test | 2 + .../suite/rpl/t/rpl_innodb_bug68220.test | 2 + .../suite/rpl/t/rpl_loaddata_local.test | 14 ++++ mysql-test/suite/rpl/t/rpl_loaddata_map.test | 2 + mysql-test/suite/rpl/t/rpl_loadfile.test | 2 + mysql-test/suite/rpl/t/rpl_mdev12179.test | 2 + .../suite/rpl/t/rpl_misc_functions.test | 6 ++ mysql-test/suite/rpl/t/rpl_parallel_seq.test | 2 + .../suite/rpl/t/rpl_stm_found_rows.test | 8 ++ mysql-test/suite/rpl/t/rpl_temporary.test | 2 + mysql-test/suite/rpl/t/rpl_xa.inc | 5 +- .../t/innodb_buffer_pool_dump_now_basic.test | 2 + ...nnodb_fil_make_page_dirty_debug_basic.test | 2 + .../t/innodb_log_optimize_ddl_basic.test | 2 + .../innodb_saved_page_number_debug_basic.test | 2 + .../t/log_slow_disabled_statements_func.test | 8 ++ .../sys_vars/t/query_cache_limit_func.test | 4 + .../sys_vars/t/query_cache_type_func.test | 4 + .../suite/sys_vars/t/secure_file_priv.test | 3 + .../sys_vars/t/sql_buffer_result_func.test | 6 ++ mysql-test/suite/vcol/t/load_data.test | 2 + mysql-test/suite/vcol/t/vcol_keys_myisam.test | 2 + mysql-test/suite/versioning/common.inc | 2 + mysql-test/suite/versioning/t/alter.test | 2 + mysql-test/suite/versioning/t/commit_id.test | 14 ++++ mysql-test/suite/versioning/t/create.test | 8 ++ mysql-test/suite/versioning/t/cte.test | 4 + mysql-test/suite/versioning/t/delete.test | 2 + mysql-test/suite/versioning/t/foreign.test | 10 +++ mysql-test/suite/versioning/t/insert.test | 2 + mysql-test/suite/versioning/t/insert2.test | 2 + mysql-test/suite/versioning/t/load_data.test | 2 + mysql-test/suite/versioning/t/partition.test | 4 + mysql-test/suite/versioning/t/select.test | 12 +++ mysql-test/suite/versioning/t/select2.test | 4 + mysql-test/suite/versioning/t/simple.test | 4 + mysql-test/suite/versioning/t/trx_id.test | 12 +++ mysql-test/suite/versioning/t/update.test | 10 +++ mysql-test/suite/versioning/t/view.test | 4 + .../mysql-test/type_inet/type_inet6.test | 6 ++ .../mysql-test/connect/t/bson_udf.test | 3 + .../mysql-test/connect/t/json_udf.test | 6 ++ .../alter_table_add_column_flags_comment.test | 3 + ...lter_table_add_column_flags_parameter.test | 3 + ...table_add_column_groonga_type_comment.test | 3 + ...ble_add_column_groonga_type_parameter.test | 3 + ...lter_table_add_column_multibyte_cp932.test | 3 + ...alter_table_add_column_multibyte_utf8.test | 3 + .../alter_table_add_column_type_comment.test | 3 + ..._index_token_filters_one_token_filter.test | 3 + .../t/alter_table_change_token_filter.test | 3 + ...ter_table_disable_keys_fulltext_table.test | 3 + ...lter_table_enable_keys_fulltext_table.test | 3 + ...nga_index_fulltext_vector_other_table.test | 3 + .../column_groonga_index_int_other_table.test | 3 + .../storage/t/column_multibyte_cp932.test | 3 + .../storage/t/column_multibyte_utf8.test | 3 + .../t/create_table_column_flags_comment.test | 3 + .../create_table_column_flags_parameter.test | 3 + ...ate_table_column_groonga_type_comment.test | 3 + ...e_table_column_groonga_type_parameter.test | 3 + .../t/create_table_column_type_comment.test | 3 + .../t/create_table_default_tokenizer.test | 3 + ...eate_table_index_normalizer_index_bin.test | 3 + ..._token_filters_multiple_token_filters.test | 3 + ..._index_token_filters_one_token_filter.test | 3 + ...e_table_index_token_filters_parameter.test | 3 + ..._token_filters_multiple_token_filters.test | 3 + ..._table_token_filters_one_token_filter.test | 3 + .../t/foreign_key_delete_existent.test | 3 + .../t/foreign_key_delete_nonexistent.test | 3 + .../t/foreign_key_insert_existent.test | 3 + .../t/foreign_key_insert_nonexistent.test | 3 + .../t/foreign_key_update_existent.test | 3 + .../t/foreign_key_update_nonexistent.test | 3 + .../t/function_command_auto-escape.test | 3 + ...unction_command_special-database-name.test | 3 + ...nction_highlight_html_dynamic_keyword.test | 3 + ...tion_highlight_html_multiple_keywords.test | 3 + .../t/function_highlight_html_normalizer.test | 3 + .../storage/t/function_normalize_default.test | 3 + .../t/function_normalize_normalizer.test | 3 + ...function_snippet_html_dynamic_keyword.test | 3 + ...nction_snippet_html_multiple_keywords.test | 3 + ...lter_table_add_column_multibyte_cp932.test | 3 + ...alter_table_add_column_multibyte_utf8.test | 3 + .../wrapper/t/column_multibyte_cp932.test | 3 + .../wrapper/t/column_multibyte_utf8.test | 3 + .../t/create_table_comment_combined.test | 3 + ..._filters_index_multiple_token_filters.test | 3 + ..._token_filters_index_one_token_filter.test | 3 + ...e_table_token_filters_index_parameter.test | 3 + .../rocksdb/include/group_min_max.inc | 2 + .../rocksdb/t/2pc_group_commit.test | 12 +++ .../mysql-test/rocksdb/t/autoinc_debug.test | 8 ++ .../rocksdb/t/autoinc_vars_thread_2.test | 2 + .../mysql-test/rocksdb/t/bloomfilter3.test | 18 +++++ .../rocksdb/t/bloomfilter_bulk_load.test | 4 + .../mysql-test/rocksdb/t/cardinality.test | 6 ++ .../mysql-test/rocksdb/t/drop_table3.inc | 2 + .../mysql-test/rocksdb/t/handler_basic.test | 4 + .../mysql-test/rocksdb/t/hermitage.inc | 2 + .../mysql-test/rocksdb/t/no_merge_sort.test | 2 + .../mysql-test/rocksdb/t/perf_context.test | 4 + .../rocksdb/t/prefix_extractor_override.test | 10 +++ .../mysql-test/rocksdb/t/read_only_tx.test | 2 + .../mysql-test/rocksdb/t/rocksdb_qcache.test | 2 + .../rocksdb/t/rocksdb_row_stats.test | 2 + .../rocksdb/mysql-test/rocksdb/t/select.test | 2 + .../rocksdb/t/show_table_status.test | 6 ++ .../mysql-test/rocksdb/t/singledelete.test | 10 +++ .../mysql-test/rocksdb/t/ttl_primary.test | 4 + .../rocksdb/t/ttl_primary_read_filtering.test | 18 +++++ .../mysql-test/rocksdb/t/ttl_secondary.test | 4 + .../t/ttl_secondary_read_filtering.test | 4 + .../t/type_char_indexes_collation.test | 4 + .../mysql-test/rocksdb/t/type_float.inc | 3 + .../spider/regression/e1121/t/load_data.inc | 4 + .../regression/e112122/t/load_data_part.inc | 4 + .../rpl_tests/rpl_parallel_load_tokudb.test | 2 + .../r/rpl_tokudb_update_pk_uc1_lookup1.result | 2 + .../rpl/t/rpl_parallel_tokudb_delete_pk.test | 4 + .../rpl/t/rpl_tokudb_delete_pk.test | 4 + .../rpl/t/rpl_tokudb_delete_pk_lookup1.test | 4 + .../rpl/t/rpl_tokudb_read_only_ff.test | 2 + .../rpl/t/rpl_tokudb_read_only_ft.test | 2 + .../rpl/t/rpl_tokudb_read_only_tf.test | 2 + .../rpl/t/rpl_tokudb_read_only_tt.test | 2 + .../t/rpl_tokudb_update_pk_uc0_lookup0.test | 4 + .../t/rpl_tokudb_update_pk_uc0_lookup1.test | 4 + .../t/rpl_tokudb_update_pk_uc1_lookup0.test | 4 + .../t/rpl_tokudb_update_pk_uc1_lookup1.test | 4 + .../rpl_tokudb_update_unique_uc0_lookup0.test | 4 + .../rpl_tokudb_update_unique_uc0_lookup1.test | 4 + .../mysql-test/rpl/t/rpl_tokudb_write_pk.test | 2 + .../rpl/t/rpl_tokudb_write_pk_uc1.test | 2 + .../rpl/t/rpl_tokudb_write_unique.test | 2 + .../rpl/t/rpl_tokudb_write_unique_uc1.test | 2 + .../mysql-test/tokudb/t/ext_key_1_innodb.test | 3 + .../mysql-test/tokudb/t/ext_key_1_tokudb.test | 3 + .../mysql-test/tokudb/t/ext_key_2_innodb.test | 3 + .../mysql-test/tokudb/t/ext_key_2_tokudb.test | 3 + .../mysql-test/tokudb/t/rows-32m-0.test | 2 + .../mysql-test/tokudb/t/rows-32m-1.test | 2 + .../tokudb/t/rows-32m-rand-insert.test | 2 + .../tokudb/t/rows-32m-seq-insert.test | 2 + .../tokudb/mysql-test/tokudb/t/type_date.test | 3 + .../mysql-test/tokudb/t/type_float.test | 2 + .../mysql-test/tokudb/t/type_newdecimal.test | 6 ++ .../tokudb/t/type_temporal_fractional.test | 6 ++ .../tokudb/mysql-test/tokudb/t/type_year.test | 3 + .../t/falcon_bug_23818_A.test | 2 + .../t/falcon_bug_23818_B.test | 2 + .../t/falcon_bug_23818_C.test | 2 + 366 files changed, 1799 insertions(+), 30 deletions(-) diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 132fdcff7bd..dbbd7459b52 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -258,8 +258,10 @@ select * from t2; insert into t2 (a) values (1025); --replace_result $MYSQLTEST_VARDIR .. +--disable_cursor_protocol --error ER_DUP_ENTRY eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1; +--enable_cursor_protocol select * from t2; rollback; select * from t2; @@ -279,8 +281,10 @@ select * from t2; --echo ======================================================================= insert into t2 (a) values (1027); +--disable_cursor_protocol --error ER_DUP_ENTRY select f2(27) into @foo; +--enable_cursor_protocol select * from t2; rollback; select * from t2; diff --git a/mysql-test/include/ctype_like_range_f1f2.inc b/mysql-test/include/ctype_like_range_f1f2.inc index def341e8d5e..59f668bfbba 100644 --- a/mysql-test/include/ctype_like_range_f1f2.inc +++ b/mysql-test/include/ctype_like_range_f1f2.inc @@ -17,6 +17,8 @@ INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +#enable after fix MDEV-31512 +--disable_cursor_protocol #check after fix MDEV-29290 --disable_view_protocol # Check pattern (important for ucs2, utf16, utf32) @@ -24,5 +26,6 @@ SELECT hex(concat(repeat(0xF1F2, 10), '%')); --echo 3 rows expected SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); -DROP TABLE t1; +--enable_cursor_protocol --enable_view_protocol +DROP TABLE t1; diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index ee60c9196e2..254868e1fd7 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1646,7 +1646,10 @@ SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol --echo # All columns must be VARCHAR(9) with the same length: diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index a566a4d79c2..331f5c18a02 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -168,7 +168,9 @@ while ($_dt_tables) --disable_ps2_protocol --let $_dt_outfile= `SELECT @@datadir` --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table + --disable_cursor_protocol eval SELECT * INTO OUTFILE '$_dt_outfile' FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list`; + --enable_cursor_protocol --enable_ps2_protocol # Compare files. diff --git a/mysql-test/include/explain_utils.inc b/mysql-test/include/explain_utils.inc index d729be94f49..eb0558da3c8 100644 --- a/mysql-test/include/explain_utils.inc +++ b/mysql-test/include/explain_utils.inc @@ -28,6 +28,7 @@ --echo # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol if ($select) { --disable_query_log --eval $select INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/before_explain.txt' @@ -160,5 +161,6 @@ SHOW STATUS WHERE (Variable_name LIKE 'Sort%' OR --enable_query_log --echo +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/include/function_defaults.inc b/mysql-test/include/function_defaults.inc index e8e1059f4be..86ccb697d28 100644 --- a/mysql-test/include/function_defaults.inc +++ b/mysql-test/include/function_defaults.inc @@ -824,6 +824,7 @@ eval CREATE TABLE t2 ( i $datetime DEFAULT $current_timestamp ON UPDATE $current_timestamp NOT NULL ); +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE 't3.dat' FROM dual; @@ -833,6 +834,7 @@ FROM dual; SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.918273; @@ -931,11 +933,13 @@ remove_file $MYSQLD_DATADIR/test/t5.dat; --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.089786; +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE "file1.dat" FROM dual; SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL INTO OUTFILE "file2.dat" FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Too short row diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc index 69c520c3e61..5a9fa8f0ec0 100644 --- a/mysql-test/include/grant_cache.inc +++ b/mysql-test/include/grant_cache.inc @@ -55,6 +55,7 @@ set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; --disable_ps2_protocol +--disable_cursor_protocol reset query cache; flush status; @@ -173,6 +174,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; +--enable_cursor_protocol --enable_ps2_protocol # Cleanup diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index 2b7af82907c..9facff43ec9 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -206,6 +206,7 @@ execute full_info ; --error 1064 prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +--disable_cursor_protocol --disable_query_log select '------ select column, .. into @parm,.. ------' as test_sequence ; --enable_query_log @@ -243,6 +244,7 @@ into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 from t9 where c1= ?" ; +--enable_cursor_protocol set @my_key= 1 ; execute stmt1 using @my_key ; # get as much information about the parameters as possible diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index 0f52b70b7f2..ba9c256005a 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -28,6 +28,7 @@ drop table if exists t1,t2,t3; set @save_query_cache_size = @@global.query_cache_size; set GLOBAL query_cache_size = 1355776; +--disable_cursor_protocol # # Without auto_commit. # @@ -86,6 +87,7 @@ show status like "Qcache_hits"; commit; show status like "Qcache_queries_in_cache"; drop table t3,t2,t1; +--enable_cursor_protocol eval CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id))$partitions_id; select count(*) from t1; @@ -128,6 +130,7 @@ connection default; # This should be 'YES'. SHOW VARIABLES LIKE 'have_query_cache'; +--disable_cursor_protocol SET GLOBAL query_cache_size = 204800; flush status; SET @@autocommit=1; @@ -190,6 +193,7 @@ disconnect connection1; connection default; set @@global.query_cache_size = @save_query_cache_size; drop table t2; +--enable_cursor_protocol SET global query_cache_type=default; --enable_view_protocol diff --git a/mysql-test/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc index 6c51300a5d5..3e861b5fe29 100644 --- a/mysql-test/include/query_cache_partitions.inc +++ b/mysql-test/include/query_cache_partitions.inc @@ -45,9 +45,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -81,9 +83,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -118,6 +122,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol BEGIN; UPDATE `t1` SET `cool` = 1 WHERE `id` = 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; @@ -127,6 +132,7 @@ BEGIN; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; ROLLBACK; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; diff --git a/mysql-test/include/test_outfile.inc b/mysql-test/include/test_outfile.inc index e50847b67a3..af64cc6ba5f 100644 --- a/mysql-test/include/test_outfile.inc +++ b/mysql-test/include/test_outfile.inc @@ -1,3 +1,5 @@ +--disable_cursor_protocol --disable_ps2_protocol eval select "Outfile OK" into outfile "$MYSQLTEST_VARDIR/tmp/outfile.test"; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/include/type_temporal_zero_default.inc b/mysql-test/include/type_temporal_zero_default.inc index 6553bfb6d86..4cc36ad572c 100644 --- a/mysql-test/include/type_temporal_zero_default.inc +++ b/mysql-test/include/type_temporal_zero_default.inc @@ -35,7 +35,9 @@ SET sql_mode=DEFAULT; --eval INSERT INTO t1 VALUES (DEFAULT,DEFAULT); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol +--disable_cursor_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1 +--enable_cursor_protocol DELETE FROM t1; --enable_ps2_protocol SET sql_mode=TRADITIONAL; diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc index 58bdac6f09e..1579b5b21e7 100644 --- a/mysql-test/include/write_var_to_file.inc +++ b/mysql-test/include/write_var_to_file.inc @@ -46,9 +46,11 @@ if (`SELECT LENGTH(@@secure_file_priv) > 0`) --let $_wvtf_suffix= `SELECT UUID()` --let $_wvtf_tmp_file= $MYSQLTEST_VARDIR/_wvtf_$_wvtf_suffix + --disable_cursor_protocol --disable_ps2_protocol --eval SELECT '$write_var' INTO DUMPFILE '$_wvtf_tmp_file' --enable_ps2_protocol + --enable_cursor_protocol --copy_file $_wvtf_tmp_file $write_to_file --remove_file $_wvtf_tmp_file } diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index d3d588149e0..f6755ada733 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -985,6 +985,7 @@ while ($count) commit; --enable_query_log +--disable_cursor_protocol select index_length into @unpaked_keys_size from information_schema.tables where table_name='t1'; alter table t1 pack_keys=1; @@ -998,6 +999,7 @@ alter table t1 max_rows=100; select max_data_length into @changed_max_data_length from information_schema.tables where table_name='t1'; select (@orig_max_data_length > @changed_max_data_length); +--enable_cursor_protocol drop table t1; diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test index 95e6d732907..6f4f9fb1e1e 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -1,6 +1,8 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol select * from mysql.user where user = 'root' and host = 'localhost'; --echo # Test syntax diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test index 3abd8d4d482..927954216c7 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.test +++ b/mysql-test/main/auto_increment_ranges_innodb.test @@ -11,9 +11,11 @@ set default_storage_engine=innodb; # create table t1 (pk int auto_increment primary key, f varchar(20)); insert t1 (f) values ('a'), ('b'), ('c'), ('d'); +--disable_cursor_protocol --disable_ps2_protocol select null, f into outfile 'load.data' from t1 limit 1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'load.data' into table t1; insert t1 (f) values ('<==='); select * from t1; diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index b334db504f9..b3c0494fc2b 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -45,9 +45,11 @@ remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql; --echo # --disable_query_log create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --source include/kill_mysqld.inc --error 1 diff --git a/mysql-test/main/bug12427262.test b/mysql-test/main/bug12427262.test index aca37a651c4..e1917aaa201 100644 --- a/mysql-test/main/bug12427262.test +++ b/mysql-test/main/bug12427262.test @@ -20,6 +20,7 @@ create table t9 (c1 int); create table t10 (c1 int); --enable_warnings +--disable_cursor_protocol # Query PS to know initial read count for frm file. select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' @@ -32,16 +33,19 @@ show tables; select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; show full tables; +--disable_cursor_protocol # Query PS to know read count for frm file after above query. COUNT_READ # will be incremented by 1 as FRM file will be opened for above query. select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; diff --git a/mysql-test/main/count_distinct2.test b/mysql-test/main/count_distinct2.test index f5d16527af3..0ab8169098f 100644 --- a/mysql-test/main/count_distinct2.test +++ b/mysql-test/main/count_distinct2.test @@ -62,6 +62,7 @@ while ($1) commit; --enable_query_log +--disable_cursor_protocol flush status; select count(distinct n) from t1; show status like 'Created_tmp_disk_tables'; @@ -83,6 +84,7 @@ flush status; select count(distinct s) from t1; show status like 'Created_tmp_disk_tables'; drop table t1; +--enable_cursor_protocol --enable_ps2_protocol # End of 4.1 tests diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test index adea12eb6d0..4b6203a2577 100644 --- a/mysql-test/main/ctype_big5.test +++ b/mysql-test/main/ctype_big5.test @@ -77,9 +77,11 @@ select hex(convert(_big5 0xC84041 using ucs2)); set names big5; create table t1 (a blob); insert into t1 values (0xEE00); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'test/t1.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index 26618ec235b..756c96fcf60 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -1,3 +1,4 @@ + set names binary; --source include/ctype_numconv.inc @@ -232,8 +233,11 @@ SELECT DATE_FORMAT('2004-02-02','%W'); SELECT HEX(DATE_FORMAT('2004-02-02','%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01','%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); +--enable_cursor_protocol --enable_view_protocol --echo # latin1 format, binary result @@ -241,8 +245,11 @@ SELECT DATE_FORMAT('2004-02-02',_latin1'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # Binary format, latin1 result @@ -251,8 +258,11 @@ SELECT DATE_FORMAT('2004-02-02',_binary'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # --echo # End of 10.4 tests diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index 185d4ca641a..83d1a7a5d5b 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -20,10 +20,13 @@ drop table com1; create table `clock$` (a int); drop table `clock$`; +# Enable after fix MDEV-31553 +--disable_cursor_protocol # Enable after fix MDEV-29295 --disable_view_protocol select convert(convert(',' using filename) using binary); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test index ba41b177b44..9f6f6672952 100644 --- a/mysql-test/main/ctype_gbk.test +++ b/mysql-test/main/ctype_gbk.test @@ -64,8 +64,10 @@ CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, INSERT INTO t1 VALUES (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); +--disable_cursor_protocol SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; +--enable_cursor_protocol DROP TABLES t1; diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index 708af6baf8a..7144f0af5cc 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -75,9 +75,11 @@ DROP TABLE t1; --echo # Problem # 1 (original report): wrong parsing of ucs2 data SET character_set_connection=ucs2; +--disable_cursor_protocol --disable_ps2_protocol SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 (@b) SET a=REVERSE(@b); @@ -90,7 +92,9 @@ remove_file $MYSQLD_DATADIR/test/tmpp.txt; --disable_ps2_protocol --echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +--disable_cursor_protocol SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +--enable_cursor_protocol --enable_ps2_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 diff --git a/mysql-test/main/ctype_utf16.test b/mysql-test/main/ctype_utf16.test index 529b737fcfb..9f23f02b0fa 100644 --- a/mysql-test/main/ctype_utf16.test +++ b/mysql-test/main/ctype_utf16.test @@ -741,6 +741,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16, s4 LONGTEXT CHARACTER SET utf16 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -751,6 +753,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf16le.test b/mysql-test/main/ctype_utf16le.test index 537a456f7db..d0ccb2e8509 100644 --- a/mysql-test/main/ctype_utf16le.test +++ b/mysql-test/main/ctype_utf16le.test @@ -703,6 +703,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16le, s4 LONGTEXT CHARACTER SET utf16le ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -713,6 +715,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index 0e49302c776..f35a94e909c 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -795,6 +795,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf32, s4 LONGTEXT CHARACTER SET utf32 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8mb4, @@character_set_results=NULL; @@ -805,6 +807,7 @@ SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -1131,8 +1134,11 @@ SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); --echo # utf8 format, utf32 result SELECT DATE_FORMAT('2004-02-02',_utf8'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_utf8'%W')); +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_utf8'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h')); +--enable_cursor_protocol --echo # utf32 format, utf8 result SET NAMES utf8; diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 074a536f0f0..4bc01142b4c 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -1501,8 +1501,11 @@ SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20)); SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)); #Enable view-protocol after fix MDEV-33942 --disable_view_protocol +#Enable after fix MDEV-31512 +--disable_cursor_protocol SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI @@ -1581,12 +1584,15 @@ CREATE TABLE t1 ( ); --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test index 6361252ab80..3c6eab86126 100644 --- a/mysql-test/main/ctype_utf8mb4.test +++ b/mysql-test/main/ctype_utf8mb4.test @@ -1798,12 +1798,15 @@ CREATE TABLE t1 ( s4 LONGTEXT CHARACTER SET utf8mb4 ); --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8mb4, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; @@ -1953,7 +1956,9 @@ DROP TABLE t1; SET NAMES utf8mb4; SELECT COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--disable_cursor_protocol SELECT COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--enable_cursor_protocol SELECT COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E as int); diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 41ede6b440a..179cdd427d3 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -859,6 +859,8 @@ INSERT INTO example1463 VALUES ('David', 'Unknown', 100); INSERT INTO example1463 VALUES ('Edward', 'Success', 150); INSERT INTO example1463 VALUES ('Edward', 'Pending', 150); +#Enable after fix MDEV-31720 +--disable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, @@ -866,6 +868,7 @@ SELECT Customer, Success, SUM(OrderSize) FROM example1463) as subQ GROUP BY Success, Customer WITH ROLLUP; +--enable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test index 9747f1df61f..d26d2d6c535 100644 --- a/mysql-test/main/derived_view.test +++ b/mysql-test/main/derived_view.test @@ -42,6 +42,7 @@ explain extended select * from (select * from t1 where f1 in (2,3)) tt join (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; explain extended @@ -51,6 +52,7 @@ flush status; select * from (select * from t1 where f1 in (2,3)) tt where f11=2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo for merged views create view v1 as select * from t1; @@ -72,12 +74,14 @@ explain extended select * from v3 join v4 on f1=f2; --disable_ps2_protocol +--disable_cursor_protocol flush status; explain extended select * from v4 where f2 in (1,3); show status like 'Handler_read%'; flush status; select * from v4 where f2 in (1,3); show status like 'Handler_read%'; +--enable_cursor_protocol --echo for materialized derived tables --echo explain for simple derived @@ -92,8 +96,10 @@ flush status; explain select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; flush status; +--disable_cursor_protocol select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo for materialized views @@ -110,6 +116,7 @@ explain extended select * from t1 join v2 on f1=f2; select * from t1 join v2 on f1=f2; explain extended select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; @@ -122,6 +129,7 @@ flush status; select * from t1 join v2 on f1=f2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol explain extended select * from v1 join v4 on f1=f2; explain format=json select * from v1 join v4 on f1=f2; @@ -165,6 +173,7 @@ join (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z on x.f1 = z.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from @@ -175,6 +184,7 @@ join show status like 'Handler_read%'; flush status; --enable_ps2_protocol +--enable_cursor_protocol --echo merged in merged derived join merged in merged derived explain extended select * from diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test index 0658949597c..8935147e579 100644 --- a/mysql-test/main/distinct.test +++ b/mysql-test/main/distinct.test @@ -460,6 +460,7 @@ INSERT INTO t1 VALUES (2,2,'APPLE'); INSERT INTO t1 VALUES (3,2,'APPLE'); INSERT INTO t1 VALUES (4,3,'PEAR'); +--disable_cursor_protocol SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = 'APPLE'; SELECT @v1, @v2; @@ -508,6 +509,7 @@ SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE --enable_ps2_protocol LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2; --remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp +--enable_cursor_protocol SELECT @v19, @v20; SELECT * FROM t2; diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test index 85638bc290b..3c6f418ccd4 100644 --- a/mysql-test/main/empty_table.test +++ b/mysql-test/main/empty_table.test @@ -6,6 +6,8 @@ drop table if exists t1; --enable_warnings +# Enable after fix MDEV-31721 +--disable_cursor_protocol create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); --disable_ps2_protocol select count(*) from t1; @@ -24,6 +26,7 @@ drop table t1; select * from t2; --enable_ps2_protocol show status like "Empty_queries"; +--enable_cursor_protocol --echo # End of 4.1 tests diff --git a/mysql-test/main/events_bugs.test b/mysql-test/main/events_bugs.test index fe744de86c9..3c4836af9e5 100644 --- a/mysql-test/main/events_bugs.test +++ b/mysql-test/main/events_bugs.test @@ -966,7 +966,9 @@ DROP USER evtest1@localhost; # scheduler to detect that --echo Sleep 4 seconds sleep 4; +--disable_cursor_protocol SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log; +--enable_cursor_protocol # Give the event mechanism ~ 4 seconds to do something wrong # (execute the event of the dropped user -> inser rows). --echo Sleep 4 seconds @@ -1186,9 +1188,11 @@ drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); create event e1 on schedule every 1 day do select 1; +--disable_cursor_protocol select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.event where name = 'e1' and sql_mode = @full_mode; drop event e1; diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index a546242d6aa..74459ce7bc3 100644 --- a/mysql-test/main/explain.test +++ b/mysql-test/main/explain.test @@ -48,7 +48,9 @@ set names latin1; # # Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line) # +--disable_cursor_protocol select 3 into @v1; +--enable_cursor_protocol explain select 3 into @v1; # @@ -154,7 +156,9 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INT not null); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; # EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE. diff --git a/mysql-test/main/fast_prefix_index_fetch_innodb.test b/mysql-test/main/fast_prefix_index_fetch_innodb.test index 03b7275a1e3..98b1e4887c0 100644 --- a/mysql-test/main/fast_prefix_index_fetch_innodb.test +++ b/mysql-test/main/fast_prefix_index_fetch_innodb.test @@ -39,10 +39,12 @@ let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); --disable_ps2_protocol +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -56,10 +58,12 @@ select id, bigfield from prefixinno where bigfield = repeat('d', 31); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -73,10 +77,12 @@ select id, bigfield from prefixinno where fake_id = 1031; let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -90,10 +96,12 @@ select id, bigfield from prefixinno where fake_id = 1033; let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -107,10 +115,12 @@ select id, bigfield from prefixinno where bigfield = repeat('x', 32); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -124,10 +134,12 @@ select id, bigfield from prefixinno where bigfield = repeat('y', 33); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -141,10 +153,12 @@ select id, bigfield from prefixinno where bigfield = repeat('b', 8); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -158,10 +172,12 @@ select id, bigfield from prefixinno where bigfield = repeat('c', 24); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -175,10 +191,12 @@ select id, bigfield from prefixinno where bigfield = repeat('z', 128); let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--disable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; @@ -193,10 +211,12 @@ select id, bigfield from prefixinno where fake_id = 1033; let $count = query_get_value($show_count_statement, Value, 1); let $opt = query_get_value($show_opt_statement, Value, 1); +--disable_cursor_protocol --disable_query_log eval select $count - $base_count into @cluster_lookups; eval select $opt - $base_opt into @cluster_lookups_avoided; --enable_query_log +--enable_cursor_protocol select @cluster_lookups; select @cluster_lookups_avoided; diff --git a/mysql-test/main/flush_ssl.test b/mysql-test/main/flush_ssl.test index e7bd57b156a..c8be2896815 100644 --- a/mysql-test/main/flush_ssl.test +++ b/mysql-test/main/flush_ssl.test @@ -23,7 +23,9 @@ let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; --source include/start_mysqld.inc connect ssl_con,localhost,root,,,,,SSL; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +--enable_cursor_protocol let $ssl_not_after=`SELECT @ssl_not_after`; remove_file $ssl_cert; diff --git a/mysql-test/main/func_analyse.test b/mysql-test/main/func_analyse.test index 17b6b49decc..8afc2ab34a6 100644 --- a/mysql-test/main/func_analyse.test +++ b/mysql-test/main/func_analyse.test @@ -24,7 +24,10 @@ EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); create table t1 (v varchar(128)); insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd'); +#Enable after fix MDEV-31538 +--disable_cursor_protocol select * from t1 procedure analyse(); +--enable_cursor_protocol drop table t1; #decimal-related test diff --git a/mysql-test/main/func_des_encrypt.test b/mysql-test/main/func_des_encrypt.test index 44fc30ff00f..b1e2a7f42ff 100644 --- a/mysql-test/main/func_des_encrypt.test +++ b/mysql-test/main/func_des_encrypt.test @@ -54,7 +54,13 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT t1 VALUES (1),(2); +# There is a problem with cursor-protocol and DES_DECRYPT(), +# but DES_DECRYPT has been deprecated from MariaDB 10.10.0, +# and will be removed in a future release. That's why this +# case is excluded without bug +--disable_cursor_protocol SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2; +--enable_cursor_protocol DROP TABLE t1; --Echo End of 10.5 tests diff --git a/mysql-test/main/func_digest.test b/mysql-test/main/func_digest.test index afc3941e1b3..9043f6534b9 100644 --- a/mysql-test/main/func_digest.test +++ b/mysql-test/main/func_digest.test @@ -489,6 +489,8 @@ SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; --echo # Bug#54661 sha2() returns BINARY result --echo # +#Check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES binary; @@ -499,6 +501,7 @@ SET NAMES latin1; SELECT sha2('1',224); --disable_metadata --disable_view_protocol +--enable_cursor_protocol --echo # --echo # Start of 10.1 tests diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index 09703db334a..5694c245033 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -409,11 +409,14 @@ drop table t1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # End of 4.1 tests @@ -499,11 +502,14 @@ set names latin1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 6db7fdc2ad7..2f6935ec4a6 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -170,8 +170,10 @@ DROP TABLE t1; --echo # MDEV-4269: crash when grouping by values() --echo # +--disable_cursor_protocol SELECT @@default_storage_engine INTO @old_engine; set default_storage_engine=innodb; +--enable_cursor_protocol create table y select 1 b; select 1 from y group by b; diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index a1ac2368014..e0fcd192ca6 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -24,7 +24,10 @@ select json_array(1); --disable_view_protocol select json_array(1, "text", false, null); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('["a", "b"]', '$', FALSE); +--enable_cursor_protocol --enable_view_protocol select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); @@ -87,12 +90,18 @@ select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp; select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp; select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp; +--enable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; +--enable_cursor_protocol select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp; @@ -134,11 +143,14 @@ select json_merge('a','b'); select json_merge('{"a":"b"}','{"c":"d"}'); SELECT JSON_MERGE('[1, 2]', '{"id": 47}'); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_type('{"k1":123, "k2":345}'); select json_type('[123, "k2", 345]'); select json_type("true"); select json_type('123'); select json_type('123.12'); +--enable_cursor_protocol select json_keys('{"a":{"c":1, "d":2}, "b":2}'); select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); @@ -166,21 +178,30 @@ insert into t1 values select json_search( json_col, 'all', 'foot' ) as ex from t1; drop table t1; - +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote('"abc"'); select json_unquote('abc'); +--enable_cursor_protocol + # # MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument. # create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1; insert into t1 values ('abc'),('def'); - + +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1; +--enable_cursor_protocol drop table t1; select json_object("a", json_object("b", "abcd")); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object("a", '{"b": "abcd"}'); +--enable_cursor_protocol select json_object("a", json_compact('{"b": "abcd"}')); select json_compact(NULL); @@ -257,8 +278,11 @@ select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ; select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ; select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +--enable_cursor_protocol # # MDEV-11856 json_search doesn't search for values with double quotes character (") @@ -450,9 +474,12 @@ drop table t1; --echo # MDEV-16750 JSON_SET mishandles unicode every second pair of arguments. --echo # +#enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp; +--enable_cursor_protocol --echo # --echo # MDEV-17121 JSON_ARRAY_APPEND @@ -1029,12 +1056,15 @@ create table t1 (a varchar(254)); insert into t1 values (concat('x64-', repeat('a', 60))); insert into t1 values (concat('x64-', repeat('b', 60))); insert into t1 values (concat('x64-', repeat('c', 60))); +#enable after fix MDEV-31554 +--disable_cursor_protocol #enable after MDEV-32454 fix --disable_view_protocol --disable_ps2_protocol select json_arrayagg(a) from t1; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t1; SET group_concat_max_len= default; diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index dbeefa94d59..d16fc3bc37b 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -567,11 +567,14 @@ select (1.175494351E-37 div 1.7976931348623157E+308); select round(999999999, -9); select round(999999999.0, -9); +#enable after fix MDEV-31555 +--disable_cursor_protocol #enable after fix MDEV-29526 --disable_view_protocol select round(999999999999999999, -18); select round(999999999999999999.0, -18); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#12537160 ASSERTION FAILED: diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index d0f622421bd..498c8a94df9 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -248,6 +248,7 @@ SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; # # Bug #35848: UUID() returns UUIDs with the wrong time # +--disable_cursor_protocol select @@session.time_zone into @save_tz; # make sure all times are UTC so the DayNr won't differ @@ -259,6 +260,7 @@ select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day; select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate; select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date; select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic; +--enable_cursor_protocol # these should be identical; date part of UUID should be current date select @my_uuid_date - @my_uuid_synthetic; diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 39957aabe70..3c9360a9c40 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -92,9 +92,12 @@ SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),r select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c'); --disable_view_protocol +#chaeck after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select replace('aaaa','a','bbbb'); --disable_metadata +--enable_cursor_protocol --enable_view_protocol select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') as exp; select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); @@ -145,7 +148,10 @@ select length(unhex(md5("abrakadabra"))); # # Bug #6564: QUOTE(NULL # +#enable after fix MDEV-31587 +--disable_cursor_protocol select concat('a', quote(NULL)); +--enable_cursor_protocol # # Wrong usage of functions @@ -741,8 +747,11 @@ create table t1 (i int); insert into t1 values (1000000000),(1); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select lpad(i, 7, ' ') as t from t1; select rpad(i, 7, ' ') as t from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -893,6 +902,8 @@ select format(NULL, NULL); select format(pi(), NULL); select format(NULL, 2); +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(NULL, NULL); @@ -900,16 +911,20 @@ select benchmark(0, NULL); select benchmark(100, NULL); select benchmark(NULL, 1+1); --enable_view_protocol +--enable_cursor_protocol # # Bug #20752: BENCHMARK with many iterations returns too quickly # # not a string, but belongs with the above Bug#22684 +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(-1, 1); --enable_view_protocol +--enable_cursor_protocol # # Please note: # 1) The collation of the password is irrelevant, the encryption uses @@ -977,26 +992,26 @@ select left('hello', -1); select left('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 4294967295); ---enable_view_protocol select left('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967296); ---enable_view_protocol select left('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select left('hello', -18446744073709551615); select left('hello', 18446744073709551615); select left('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 18446744073709551616); select left('hello', -18446744073709551617); select left('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select right('hello', 10); @@ -1005,26 +1020,26 @@ select right('hello', -1); select right('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 4294967295); ---enable_view_protocol select right('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967296); ---enable_view_protocol select right('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select right('hello', -18446744073709551615); select right('hello', 18446744073709551615); select right('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 18446744073709551616); select right('hello', -18446744073709551617); select right('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', 2, -1); @@ -1049,6 +1064,8 @@ select substring('hello', 18446744073709551617, 1); #enable after fix MDEV-28652 --disable_view_protocol select substring('hello', 1, -1); +#check after fix MDEV-31587 +--disable_cursor_protocol select substring('hello', 1, -4294967295); select substring('hello', 1, 4294967295); select substring('hello', 1, -4294967296); @@ -1064,6 +1081,7 @@ select substring('hello', 1, -18446744073709551616); select substring('hello', 1, 18446744073709551616); select substring('hello', 1, -18446744073709551617); select substring('hello', 1, 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', -1, -1); select substring('hello', -4294967295, -4294967295); @@ -1395,7 +1413,10 @@ create table t1(a float); insert into t1 values (1.33); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select format(a, 2) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -1510,9 +1531,11 @@ SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); --echo # CREATE TABLE t1 ( a TEXT ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt'; --enable_ps2_protocol +--enable_cursor_protocol SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1; @@ -1595,11 +1618,17 @@ SELECT format(12345678901234567890.123, 3, 'ar_AE'); SELECT format(12345678901234567890.123, 3, 'ar_SA'); SELECT format(12345678901234567890.123, 3, 'be_BY'); SELECT format(12345678901234567890.123, 3, 'de_DE'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'en_IN'); SELECT format(12345678901234567890.123, 3, 'en_US'); +--enable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'it_CH'); SELECT format(12345678901234567890.123, 3, 'ru_RU'); +#checkafter fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'ta_IN'); +--enable_cursor_protocol CREATE TABLE t1 (fmt CHAR(5) NOT NULL); INSERT INTO t1 VALUES ('ar_AE'); @@ -1611,6 +1640,8 @@ INSERT INTO t1 VALUES ('en_US'); INSERT INTO t1 VALUES ('it_CH'); INSERT INTO t1 VALUES ('ru_RU'); INSERT INTO t1 VALUES ('ta_IN'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; @@ -1618,6 +1649,7 @@ SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +--enable_cursor_protocol DROP TABLE t1; SELECT format(123, 1, 'Non-existent-locale'); @@ -2062,7 +2094,10 @@ DROP TABLE t1; --disable_view_protocol CREATE TABLE t1 (a INT, b TIME, c TIME); INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +--enable_cursor_protocol DROP TABLE t1; --enable_view_protocol diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 4b046ac166a..51b2722d7a0 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -1294,7 +1294,10 @@ SET TIME_ZONE='+02:00'; --echo # CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 AS f2 FROM t1; +--enable_cursor_protocol SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0; DROP TABLE t1; @@ -1608,7 +1611,10 @@ SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DAT --echo # --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -2241,11 +2247,13 @@ SET @sav_slow_query_log= @@session.slow_query_log; --disable_ps2_protocol # @@slow_query_log ON check SET @@session.slow_query_log= ON; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @ts_func; --enable_ps2_protocol SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -2257,10 +2265,12 @@ DELETE FROM t_trig; --disable_ps2_protocol # @@slow_query_log OFF check SET @@session.slow_query_log= OFF; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @func_ts; --enable_ps2_protocol SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -3196,7 +3206,10 @@ SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); #enable after fix MDEV-29534 --disable_view_protocol SET time_zone='+00:00'; +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); +--enable_cursor_protocol SET time_zone=DEFAULT; --enable_view_protocol diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test index 79f9ec289a0..fa13e7cb461 100644 --- a/mysql-test/main/func_time_round.test +++ b/mysql-test/main/func_time_round.test @@ -181,7 +181,10 @@ SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; @@ -219,7 +222,10 @@ SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index 6b4227887b5..68b58a32e2b 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -282,6 +282,7 @@ GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN; +--disable_cursor_protocol # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; @@ -301,6 +302,7 @@ GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN; # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol DELIMITER |; CREATE PROCEDURE p1() @@ -367,7 +369,9 @@ GET DIAGNOSTICS @var = NUMBER; SELECT @var; --enable_view_protocol +--disable_cursor_protocol SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol GET DIAGNOSTICS @var = NUMBER; SELECT @var; diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index f160d8f1a10..6bac1e0c906 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -403,9 +403,12 @@ select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as e --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol create table t1 (g GEOMETRY); select * from t1; select asbinary(g) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -3245,6 +3248,8 @@ CREATE TABLE t1 ( g GEOMETRY ) CHARACTER SET utf8; +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT * FROM t1; @@ -3350,6 +3355,7 @@ FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index c9c74d7b877..c75da4f76a8 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -10,7 +10,9 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol connect (master,localhost,root,,); connection master; diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index 7efd9bdde78..19ad2d37472 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -4,7 +4,10 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol + set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -655,8 +658,10 @@ DROP DATABASE db1; # work out who we are. USE mysql; +--disable_cursor_protocol SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; +--enable_cursor_protocol # show current privs. SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; @@ -838,9 +843,11 @@ SHOW CREATE TABLE t1; --echo # INSERT INTO t1 VALUES (1), (2), (3); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' INTO TABLE t1 --remove_file $MYSQLTEST_VARDIR/tmp/bug27480.txt diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 4a228b5c1a1..69566cb5e2e 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -21,7 +21,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -43,7 +46,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 340a6473eb7..6c2b99c90be 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -284,6 +284,7 @@ drop table t1; CREATE TABLE t1 (a char(1)); INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -292,11 +293,13 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol # Do the same tests with on-disk temporary tables set tmp_memory_table_size=0; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -305,6 +308,7 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol @@ -1666,7 +1670,7 @@ DROP TABLE t1, t2; # an additional util connection and other statistics data --disable_ps2_protocol --disable_view_protocol - +--disable_cursor_protocol FLUSH STATUS; # this test case *must* use Aria temp tables CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob); @@ -1676,6 +1680,7 @@ DROP TABLE t1; --echo the value below *must* be 1 show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index ec4c5705b23..97de775f4c8 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -1726,6 +1726,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1733,6 +1735,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1764,6 +1767,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1771,6 +1776,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; @@ -1897,6 +1903,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1904,6 +1912,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1935,6 +1944,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1942,6 +1953,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; diff --git a/mysql-test/main/handler_read_last.test b/mysql-test/main/handler_read_last.test index 390d5f092fc..56e0b091e67 100644 --- a/mysql-test/main/handler_read_last.test +++ b/mysql-test/main/handler_read_last.test @@ -9,6 +9,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT, INDEX (a)); INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a FROM t1 ORDER BY a LIMIT 1; @@ -26,6 +27,7 @@ FLUSH STATUS; SELECT a FROM t1 ORDER BY a DESC LIMIT 3; SHOW STATUS LIKE 'HANDLER_READ%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index cd118a17961..d3af60a32fb 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -1811,14 +1811,18 @@ drop database mysqltest; --disable_result_log SELECT * FROM INFORMATION_SCHEMA.TABLES; --enable_result_log +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --disable_result_log SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES; --enable_result_log --echo # The below SELECT query should give same output as above SELECT query. +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --echo # The below select should return '1' SELECT @val1 = @val2; diff --git a/mysql-test/main/init_file.test b/mysql-test/main/init_file.test index 65e54db43ea..57acf7ce6e2 100644 --- a/mysql-test/main/init_file.test +++ b/mysql-test/main/init_file.test @@ -10,8 +10,10 @@ # Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time # INSERT INTO init_file.startup VALUES ( NOW() ); +--disable_cursor_protocol SELECT * INTO @X FROM init_file.startup limit 0,1; SELECT * INTO @Y FROM init_file.startup limit 1,1; +--enable_cursor_protocol SELECT YEAR(@X)-YEAR(@Y); --echo ok diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index a37677411ad..fb47da1ccfb 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -29,6 +29,7 @@ ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS() INDEXES(); --enable_result_log --enable_query_log +--disable_cursor_protocol --disable_ps2_protocol explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; @@ -153,6 +154,7 @@ select o_orderkey, p_partkey and o_orderkey=l_orderkey and p_partkey=l_partkey; show /*d*/ status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug mdev-3851: ref access used instead of expected eq_ref access @@ -326,7 +328,9 @@ from t1 A, t1 B; explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; +--disable_cursor_protocol select * from t1, t2 where t2.a=t1.a and t2.b < 2; +--enable_cursor_protocol show /*e*/ status like 'handler_read%'; --enable_ps2_protocol diff --git a/mysql-test/main/insert.test b/mysql-test/main/insert.test index 0a1e63765a4..4b5a5181f09 100644 --- a/mysql-test/main/insert.test +++ b/mysql-test/main/insert.test @@ -596,9 +596,11 @@ CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as REPLACE INTO v1 SET f2 = 1; SELECT * from t1; drop view v1; +--disable_cursor_protocol --disable_ps2_protocol SELECT 0,0 INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION; --error ER_TRUNCATED_WRONG_VALUE LOAD DATA INFILE 't1.txt' INTO TABLE v1; diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test index 0731c393399..67a5e62337a 100644 --- a/mysql-test/main/invisible_field.test +++ b/mysql-test/main/invisible_field.test @@ -251,9 +251,11 @@ DROP TABLE t1; create or replace table t1 (a int, b int invisible); insert into t1 values (1),(2); +--disable_cursor_protocol --disable_ps2_protocol select * from t1 into outfile 'f'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'f' into table t1; select a,b from t1; load data infile 'f' into table t1 (a,@v) SET b=@v; @@ -263,9 +265,11 @@ select a,b from t1; truncate table t1; insert into t1(a,b) values (1,1),(2,2); +--disable_cursor_protocol --disable_ps2_protocol select a,b from t1 into outfile 'a'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'a' into table t1(a,b); select a,b from t1; load data infile 'a' into table t1 (a,@v) SET b=@v; diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index f8abc3fac22..ac30e14f7ad 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -658,6 +658,7 @@ insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t3 (a int not null, primary key(a)); insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +--disable_cursor_protocol flush status; --disable_ps2_protocol select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; @@ -665,6 +666,7 @@ select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; --echo We expect rnd_next=5, and read_key must be 0 because of short-cutting: show status like 'Handler_read%'; +--enable_cursor_protocol drop table t1, t2, t3; # @@ -959,11 +961,13 @@ INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), (8,'dd'),(9,'e'),(10,'ee'); INSERT INTO t2 VALUES (2,NULL); ANALYZE TABLE t1,t2; +--disable_cursor_protocol FLUSH STATUS; --disable_ps2_protocol SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; --enable_ps2_protocol SHOW STATUS LIKE 'Handler_read_%'; +--enable_cursor_protocol DROP TABLE t1, t2; --echo End of 5.1 tests diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index 83bb7fdeef3..d370a11967e 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -885,9 +885,11 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; +--disable_cursor_protocol flush status; SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; show status like 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1,t2; --enable_ps2_protocol @@ -1371,7 +1373,6 @@ drop table t1,t2,t3,t4; --echo # table is used in the on condition of an outer join --echo # --disable_ps2_protocol ---disable_view_protocol create table t1 (a int); insert into t1 values (NULL), (NULL), (NULL), (NULL); insert into t1 select * from t1; @@ -1403,16 +1404,18 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101); insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101); analyze table t1,t2,t3; - +--disable_view_protocol +--disable_cursor_protocol flush status; select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null; show status like "handler_read%"; flush status; select sum(t3.b) from t2 left join t3 on t3.a=t2.a and t2.a <> 10; show status like "handler_read%"; +--enable_cursor_protocol +--enable_view_protocol drop table t1,t2,t3; ---enable_view_protocol --enable_ps2_protocol --echo # diff --git a/mysql-test/main/key_cache.test b/mysql-test/main/key_cache.test index 0829719a442..b25ff58bd1e 100644 --- a/mysql-test/main/key_cache.test +++ b/mysql-test/main/key_cache.test @@ -303,7 +303,9 @@ update t1 set p=3 where p=1; update t2 set i=2 where i=1; select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +--disable_cursor_protocol select variable_value into @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; +--enable_cursor_protocol --replace_column 7 # select * from information_schema.key_caches where segment_number is null; diff --git a/mysql-test/main/last_value.test b/mysql-test/main/last_value.test index 41cfdb5482d..9e90a8a25bb 100644 --- a/mysql-test/main/last_value.test +++ b/mysql-test/main/last_value.test @@ -33,6 +33,8 @@ DROP TABLE t1; SELECT LAST_VALUE(@last_a:=1,@last_b:=1); select @last_b; --enable_ps_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="hello"); @@ -41,6 +43,7 @@ SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03")); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL); select @last_b; +--enable_cursor_protocol --disable_metadata --error ER_PARSE_ERROR SELECT LAST_VALUE(); diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 16831a0cf5c..94bbf8e819a 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -23,6 +23,8 @@ insert into t2i values ('bb'), ('cc'), ('dd'), ('ff'); --echo Simple joins --echo ========================================================================= +#Check after fix MDEV-31522 +--disable_cursor_protocol --echo Simple nested loops join without blocking set @@join_cache_level=0; explain @@ -457,6 +459,7 @@ SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16; +--enable_cursor_protocol drop table t1,t2,t3; @@ -489,6 +492,7 @@ WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 LIMIT ROWS EXAMINED 120; +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 @@ -508,6 +512,7 @@ LIMIT ROWS EXAMINED 124; SHOW STATUS LIKE 'Handler_read%'; SHOW STATUS LIKE 'Handler_tmp%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1, t2; diff --git a/mysql-test/main/loaddata.test b/mysql-test/main/loaddata.test index 9c1a583831b..ef1496787d4 100644 --- a/mysql-test/main/loaddata.test +++ b/mysql-test/main/loaddata.test @@ -41,7 +41,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; create table t1(id integer not null auto_increment primary key); insert into t1 values(0); disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' from t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1; enable_query_log; @@ -49,9 +51,11 @@ select * from t1; remove_file $MYSQLTEST_VARDIR/tmp/t1; disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; @@ -94,9 +98,11 @@ INSERT INTO t1 (c1) VALUES SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -184,9 +190,11 @@ create table t1(f1 int); insert into t1 values(1),(null); create table t2(f2 int auto_increment primary key); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1; --enable_ps2_protocol +--enable_cursor_protocol SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2; enable_query_log; @@ -203,20 +211,24 @@ create table t1(f1 int, f2 timestamp not null default current_timestamp); create table t2(f1 int); insert into t2 values(1),(2); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1; enable_query_log; select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; remove_file $MYSQLTEST_VARDIR/tmp/t2; delete from t1; disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; enable_query_log; @@ -235,9 +247,11 @@ INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1 SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; echo EOF; @@ -376,8 +390,10 @@ SET sql_mode = ''; --disable_ps2_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM; @@ -389,17 +405,21 @@ SELECT * FROM t1; # show we can write this with OUTFILE, forcing the parameters for now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 # now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 @@ -432,9 +452,11 @@ INSERT INTO t1 (id, val1) VALUES (3, '\tx'); --echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -451,9 +473,11 @@ eval SELECT LOAD_FILE("$file") as exp; --echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ' @@ -475,9 +499,11 @@ SET sql_mode = ''; --echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -500,9 +526,11 @@ SET sql_mode = ''; --echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ' @@ -544,9 +572,11 @@ INSERT INTO t1 VALUES (1); SET NAMES latin1; SET character_set_filesystem=filename; select @@character_set_filesystem; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't-1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 't-1' INTO TABLE t1; SELECT * FROM t1; @@ -568,9 +598,11 @@ select @@character_set_filesystem; --echo # CREATE TABLE t1(col0 LONGBLOB); +--disable_cursor_protocol --disable_ps2_protocol SELECT 'test' INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0; SELECT * FROM t1; @@ -639,9 +671,11 @@ disconnect con1; --echo # CREATE TABLE t1(f1 INT); +--disable_cursor_protocol --disable_ps2_protocol EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; --enable_ps2_protocol +--enable_cursor_protocol --disable_warnings LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; --enable_warnings @@ -658,7 +692,9 @@ remove_file $MYSQLD_DATADIR/test/t1.dat; --disable_ps2_protocol --let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1\n' INTO DUMPFILE '$file' +--enable_cursor_protocol --enable_ps2_protocol create table t1(a point); @@ -745,9 +781,11 @@ CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b)); INSERT INTO t1 VALUES (1,1); CREATE TABLE t2 (c INT); CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2; +--disable_cursor_protocol --disable_ps2_protocol SELECT a, b INTO OUTFILE '15645.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_WRONG_USAGE LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b); --error ER_WRONG_USAGE diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 8997b95d72c..1f33cff9f25 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -74,10 +74,12 @@ SET long_query_time=0.1; --echo # Although this query is disallowed by slow_query_log, it should still increment Slow_queries +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM @@ -88,11 +90,13 @@ SELECT --echo # Although this query is disallowed by log_slow_filter, it should still increment Slow_queries SET log_slow_filter=filesort; +--disable_cursor_protocol SELECT sleep(0.2) INTO @tmp FROM DUAL; SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test index 1169f2b094c..88211efa111 100644 --- a/mysql-test/main/log_tables.test +++ b/mysql-test/main/log_tables.test @@ -836,7 +836,9 @@ SET GLOBAL slow_query_log = @old_slow_query_log; --echo # Bug#21557 entries in the general query log truncated at 1000 characters. --echo # +--disable_cursor_protocol select CONNECTION_ID() into @thread_id; +--enable_cursor_protocol --disable_ps_protocol truncate table mysql.general_log; --enable_ps_protocol @@ -1006,9 +1008,12 @@ INSERT INTO t1 VALUES (3,3,3); INSERT INTO t1 VALUES (4,4,4); --disable_ps2_protocol +#Enable after fix MDEV-31522 +--disable_cursor_protocol SELECT SQL_NO_CACHE 'Bug#31700 - SCAN',f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f3=4; SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f2=3; SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2; +--enable_cursor_protocol --replace_column 1 TIMESTAMP SELECT start_time, rows_examined, rows_sent, sql_text FROM mysql.slow_log WHERE sql_text LIKE '%Bug#31700%' ORDER BY start_time; diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index aa89a78e0bd..2f85328bda3 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -12,9 +12,11 @@ insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol create temporary table tmp (a varchar(1024), b int, c int, d int, e linestring, unique (e)); load data infile 'load.data' into table tmp; delete from tmp; @@ -226,9 +228,11 @@ drop table t1; --echo # CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY LOAD DATA INFILE 'load.data' INTO TABLE t1; select * from t1; @@ -242,9 +246,11 @@ DROP TABLE t1; CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (data); SELECT * FROM t1; @@ -509,9 +515,11 @@ drop table t2; --echo # create table t1 (pk int primary key, f blob, unique(f)) engine=innodb; insert t1 values (1, null); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.data' replace into table t1; select * from t1; drop table t1; diff --git a/mysql-test/main/lowercase_table_qcache.test b/mysql-test/main/lowercase_table_qcache.test index b6047a98c74..ceff2719353 100644 --- a/mysql-test/main/lowercase_table_qcache.test +++ b/mysql-test/main/lowercase_table_qcache.test @@ -13,6 +13,7 @@ set LOCAL query_cache_type=ON; drop database if exists MySQLtesT; --enable_warnings +--disable_cursor_protocol create database MySQLtesT; create table MySQLtesT.t1 (a int); select * from MySQLtesT.t1; @@ -30,6 +31,7 @@ disable_result_log; select * from MySQL.db; enable_result_log; show status like "Qcache_queries_in_cache"; +--enable_cursor_protocol set GLOBAL query_cache_size=@save_query_cache_size; set GLOBAL query_cache_type=default; diff --git a/mysql-test/main/mdev-21101.test b/mysql-test/main/mdev-21101.test index 543b587c5e6..99a8c3006e5 100644 --- a/mysql-test/main/mdev-21101.test +++ b/mysql-test/main/mdev-21101.test @@ -10,12 +10,14 @@ # different connections simultaneously, to force queueing occurs. # Verify connections are intact, even if queueing time exceeds wait_timeout +--disable_cursor_protocol SELECT @@global.wait_timeout, @@global.thread_pool_max_threads, @@global.thread_pool_size, @@global.thread_pool_oversubscribe, @@global.thread_pool_stall_limit INTO @_wait_timeout,@_thread_pool_max_threads,@_thread_pool_size, @_thread_pool_oversubscribe,@_thread_pool_stall_limit; +--enable_cursor_protocol SET @@global.wait_timeout=1, @@global.thread_pool_max_threads=2, diff --git a/mysql-test/main/myisam_debug.test b/mysql-test/main/myisam_debug.test index fcb134c0400..3e73e0c7345 100644 --- a/mysql-test/main/myisam_debug.test +++ b/mysql-test/main/myisam_debug.test @@ -48,10 +48,12 @@ let $wait_condition= INFO = "INSERT INTO t1(id) SELECT id FROM t2"; --source include/wait_condition.inc +--disable_cursor_protocol SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'wait_in_enable_indexes' AND INFO = "INSERT INTO t1(id) SELECT id FROM t2" INTO @thread_id; +--enable_cursor_protocol KILL QUERY @thread_id; CHECK TABLE t1; diff --git a/mysql-test/main/mysqldump-max.test b/mysql-test/main/mysqldump-max.test index 49e54d542b8..6ff2f6733c7 100644 --- a/mysql-test/main/mysqldump-max.test +++ b/mysql-test/main/mysqldump-max.test @@ -81,8 +81,10 @@ drop table t6; # type to avoid Inno's column-number limits (~1000 columns) etc. # Here because it needs Inno-engine. +--disable_cursor_protocol SELECT @@global.default_storage_engine INTO @old_engine; SET GLOBAL default_storage_engine=InnoDB; +--enable_cursor_protocol --disable_query_log CREATE TABLE `t1` ( diff --git a/mysql-test/main/null.test b/mysql-test/main/null.test index 35ffb01d3c7..824be41739f 100644 --- a/mysql-test/main/null.test +++ b/mysql-test/main/null.test @@ -326,7 +326,10 @@ SELECT NOT NOT NULLIF(2,3); CREATE TABLE t1 (a YEAR(2)); INSERT INTO t1 VALUES (0); SELECT a,NULLIF(a,2000),NULLIF(2000,a) FROM t1; +# Enable after fix MDEV-31722 +--disable_cursor_protocol SELECT a,NULLIF(a,2001),NULLIF(2001,a) FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/null_key.test b/mysql-test/main/null_key.test index 0759e99b524..e1a3784afb2 100644 --- a/mysql-test/main/null_key.test +++ b/mysql-test/main/null_key.test @@ -234,11 +234,13 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; FLUSH STATUS ; --disable_ps2_protocol +--disable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; --disable_view_protocol SELECT FOUND_ROWS(); +--enable_cursor_protocol SHOW STATUS LIKE "handler_read%"; --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 47ead9e9e5e..9165a2e5beb 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -832,7 +832,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; +--enable_cursor_protocol # this query creates one temporary table in itself, which we are not # interested in. @@ -854,7 +857,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; +--enable_cursor_protocol --disable_query_log --let $q = `show status like 'Created_tmp_tables';` @@ -1884,6 +1890,7 @@ insert into t1 analyze table t1; --enable_result_log +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol explain @@ -1907,6 +1914,7 @@ select b, count(*) num_cnt from t1 show status like '%Handler_read%'; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t0, t1; diff --git a/mysql-test/main/order_by_pack_big.test b/mysql-test/main/order_by_pack_big.test index b83a5416e91..717027e3e5a 100644 --- a/mysql-test/main/order_by_pack_big.test +++ b/mysql-test/main/order_by_pack_big.test @@ -145,16 +145,20 @@ set sort_buffer_size= 2097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file2' FROM t3 FORCE INDEX(idx) ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol diff_files $file1 $file2; @@ -171,9 +175,11 @@ set sort_buffer_size= 1097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; diff --git a/mysql-test/main/outfile.test b/mysql-test/main/outfile.test index 7f8f31bc748..f9bd76dcd95 100644 --- a/mysql-test/main/outfile.test +++ b/mysql-test/main/outfile.test @@ -21,29 +21,41 @@ drop table if exists t1; create table t1 (`a` blob); insert into t1 values("hello world"),("Hello mars"),(NULL); disable_query_log; +--disable_cursor_protocol eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.1")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.2")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.3")); # the following should give errors disable_query_log; +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.2" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.3" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 @@ -53,7 +65,9 @@ drop table t1; # Bug#8191 SELECT INTO OUTFILE insists on FROM clause disable_query_log; +--disable_cursor_protocol eval select 1 into outfile "../../tmp/outfile-test.4"; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.4")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 @@ -76,17 +90,21 @@ DROP TABLE t1; # Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM information_schema.schemata LIMIT 0, 5; +--enable_cursor_protocol # enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use information_schema; # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM schemata LIMIT 0, 5; +--enable_cursor_protocol enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use test; @@ -97,8 +115,10 @@ use test; # It should not be possible to write to a file outside of vardir create table t1(a int); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--disable_cursor_protocol --error ER_OPTION_PREVENTS_STATEMENT eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1; +--enable_cursor_protocol drop table t1; # @@ -110,6 +130,7 @@ create user user_1@localhost; grant all on mysqltest.* to user_1@localhost; connect (con28181_1,localhost,user_1,,mysqltest); +--disable_cursor_protocol --error ER_ACCESS_DENIED_ERROR eval select schema_name into outfile "../../tmp/outfile-test.4" @@ -117,18 +138,21 @@ fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_1; grant file on *.* to user_1@localhost; connect (con28181_2,localhost,user_1,,mysqltest); +--disable_cursor_protocol eval select schema_name into outfile "../../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_2; diff --git a/mysql-test/main/outfile_loaddata.test b/mysql-test/main/outfile_loaddata.test index 64a40714b5a..f308aadecc4 100644 --- a/mysql-test/main/outfile_loaddata.test +++ b/mysql-test/main/outfile_loaddata.test @@ -15,7 +15,9 @@ INSERT INTO t1 VALUES (101, 202, '-r-', '=raker='); --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -30,7 +32,9 @@ DROP TABLE t2; --echo # Only numeric fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -45,7 +49,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -60,7 +66,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -75,7 +83,9 @@ DROP TABLE t2; --echo # Only string fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -98,7 +108,9 @@ SELECT HEX(c1) FROM t1; --let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1 +--enable_cursor_protocol TRUNCATE t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -133,13 +145,17 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # Error on multi-character ENCLOSED/ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345' +--enable_cursor_protocol --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345' +--enable_cursor_protocol --remove_file $file @@ -147,21 +163,27 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # LOAD DATA rises error or has unpredictable result -- to be fixed later --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ÑŠ' +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY 'ÑŠ' +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS TERMINATED BY 'ÑŠ' +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -174,7 +196,9 @@ SELECT * FROM t1; SELECT * FROM t2; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ÑŠ' +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -185,7 +209,9 @@ TRUNCATE t2; SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * FROM t1 INTO OUTFILE '$file' LINES TERMINATED BY 'ÑŠ' +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -200,7 +226,9 @@ SELECT * FROM t2; --echo # Default (binary) charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -214,7 +242,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # latin1 charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -228,7 +258,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # KOI8-R charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -242,7 +274,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # UTF-8 charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -274,7 +308,9 @@ let $length= 800; --eval INSERT INTO t1 VALUES (REPEAT('.', $length)) --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo # should be greater than $length --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index 8565667acdb..008e0c74bc1 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -896,6 +896,7 @@ SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; --echo # "INTO" clause tests +--disable_cursor_protocol SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM DUAL INTO @var17727401; SELECT 1 INTO @var17727401; @@ -940,6 +941,7 @@ SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE(); --error ER_PARSE_ERROR SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401; +--enable_cursor_protocol --echo # ORDER and LIMIT clause combinations diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index cc23286b794..b3ea7f5c274 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -474,6 +474,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); @@ -486,6 +487,7 @@ SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol # Bug#37329 Range scan on partitioned tables shows higher Handler_read_next # (marked as duplicate of Bug#35931) @@ -507,6 +509,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); @@ -531,6 +534,7 @@ SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED create table t1 (a int) partition by list ((a/3)*10 div 1) diff --git a/mysql-test/main/partition_csv.test b/mysql-test/main/partition_csv.test index 44013dd4b0a..2057d8cac3b 100644 --- a/mysql-test/main/partition_csv.test +++ b/mysql-test/main/partition_csv.test @@ -57,7 +57,9 @@ ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10; ALTER TABLE general_log RENAME TO gl_nonpartitioned; ALTER TABLE gl_partitioned RENAME TO general_log; +--disable_cursor_protocol SELECT @@global.log_output INTO @old_glo; +--enable_cursor_protocol SET GLOBAL log_output='table'; SET GLOBAL general_log =1; diff --git a/mysql-test/main/partition_explicit_prune.test b/mysql-test/main/partition_explicit_prune.test index 610bdf4435b..3136cab4443 100644 --- a/mysql-test/main/partition_explicit_prune.test +++ b/mysql-test/main/partition_explicit_prune.test @@ -9,6 +9,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; --echo # --echo # Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS --echo # +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol CREATE TABLE t1 (a int) @@ -623,6 +624,7 @@ SELECT * FROM t3 PARTITION (pNeg); DROP TABLE t1, t2, t3; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol --echo # Test from superseeded WL# 2682 # Partition select tests. # diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 9151a6e905c..6d03f0fd8f8 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -87,7 +87,9 @@ UNINSTALL PLUGIN example; # INSTALL PLUGIN example SONAME 'ha_example'; +--disable_cursor_protocol select @@session.sql_mode into @old_sql_mode; +--enable_cursor_protocol # first, try normal sql_mode (no error, send OK) set session sql_mode=''; diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test index 7e60f196f65..1d3827fd7a2 100644 --- a/mysql-test/main/processlist.test +++ b/mysql-test/main/processlist.test @@ -66,7 +66,10 @@ set debug_sync='reset'; SET NAMES utf8; --vertical_results +#Check after fix MDEV-31514 +--disable_cursor_protocol SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'; +--enable_cursor_protocol --horizontal_results --echo # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 99a479f854c..160c471154b 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -2002,7 +2002,10 @@ prepare stmt from "create view v1 as select * from `t1` `b`"; prepare stmt from "select ?"; set @arg= 123456789.987654321; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; set @arg= "string"; select @arg; @@ -2011,7 +2014,10 @@ set @arg= 123456; select @arg; execute stmt using @arg; set @arg= cast(-12345.54321 as decimal(20, 10)); +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; deallocate prepare stmt; @@ -3335,6 +3341,8 @@ SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; --echo --echo -- Testing decs... +#Enable after fix MDEV-31495 +--disable_cursor_protocol --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; @@ -3342,6 +3350,7 @@ SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +--enable_cursor_protocol --echo DEALLOCATE PREPARE stmt_str; @@ -3574,7 +3583,9 @@ execute st; show status like '%Handler_read%'; flush status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1 use index() where a=3; +--enable_cursor_protocol show status like '%Handler_read%'; --enable_ps2_protocol flush status; diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index 88d226cdcc4..2a9f34c7cf1 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -21,6 +21,7 @@ SET LOCAL query_cache_type= ON; # Reset query cache variables. +--disable_cursor_protocol flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; @@ -1802,6 +1803,7 @@ SELECT foo( LAST_INSERT_ID() ) from t1; show status like "Qcache_queries_in_cache"; DROP FUNCTION foo; drop table t1; +--enable_cursor_protocol --echo # --echo # MDEV-33861: main.query_cache fails with embedded after diff --git a/mysql-test/main/query_cache_debug.test b/mysql-test/main/query_cache_debug.test index 5942e6f42aa..d9c6cb1c94f 100644 --- a/mysql-test/main/query_cache_debug.test +++ b/mysql-test/main/query_cache_debug.test @@ -94,7 +94,9 @@ connection con1; --reap SHOW STATUS LIKE "Qcache_queries_in_cache"; --echo # Test that it's cacheable +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol SHOW STATUS LIKE "Qcache_queries_in_cache"; disconnect con1; diff --git a/mysql-test/main/query_cache_innodb.test b/mysql-test/main/query_cache_innodb.test index 7ac96220c11..143cc5ee6d6 100644 --- a/mysql-test/main/query_cache_innodb.test +++ b/mysql-test/main/query_cache_innodb.test @@ -20,7 +20,9 @@ create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), for --disable_view_protocol insert into t1 values (1); insert into t2 values (1,1); +--disable_cursor_protocol select * from t2; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from t1; @@ -41,7 +43,9 @@ create table `t2$Ñ—` ( t2id int unsigned, id int unsigned, primary key(t2id, id) insert into `t1$Ñ—` values (1); insert into `t2$Ñ—`values (1,1); +--disable_cursor_protocol select * from `t2$Ñ—`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `t1$Ñ—`; @@ -63,7 +67,9 @@ create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2 insert into `#mysql50#t-1` values (1); insert into `#mysql50#t-2`values (1,1); +--disable_cursor_protocol select * from `#mysql50#t-2`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `#mysql50#t-1`; diff --git a/mysql-test/main/query_cache_merge.test b/mysql-test/main/query_cache_merge.test index c3267d628b9..bca3fb352d1 100644 --- a/mysql-test/main/query_cache_merge.test +++ b/mysql-test/main/query_cache_merge.test @@ -40,6 +40,7 @@ while ($1) # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol set @save_table_definition_cache= @@global.table_definition_cache; set @@global.table_definition_cache=512; create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; @@ -54,6 +55,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t2 SET @@global.query_cache_size=0; set @@global.table_definition_cache=@save_table_definition_cache; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -88,8 +90,10 @@ eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str); SET GLOBAL query_cache_size = 1048576; FLUSH STATUS; --disable_view_protocol +--disable_cursor_protocol SELECT a FROM t0 WHERE a = 1; SHOW STATUS LIKE "Qcache_queries_in_cache"; +--enable_cursor_protocol --enable_view_protocol let $c= 255; diff --git a/mysql-test/main/query_cache_notembedded.test b/mysql-test/main/query_cache_notembedded.test index 5f97dc5c00d..73fc4340bf1 100644 --- a/mysql-test/main/query_cache_notembedded.test +++ b/mysql-test/main/query_cache_notembedded.test @@ -26,6 +26,7 @@ drop table if exists t1, t2, t3, t11, t21; # # FLUSH QUERY CACHE # +--disable_cursor_protocol create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); @@ -85,6 +86,7 @@ flush query cache; show status like "Qcache_total_blocks"; show status like "Qcache_free_blocks"; drop table t1, t2, t3, t11, t21; +--enable_cursor_protocol # # do not use QC if tables locked (Bug#12385) @@ -114,6 +116,7 @@ disconnect root2; # improved to also test Bug#3583 and Bug#12990 # --disable_ps2_protocol +--disable_cursor_protocol flush query cache; reset query cache; flush status; @@ -186,6 +189,7 @@ call f1(); call f3(); call f3(); call f1(); +--enable_cursor_protocol drop procedure f1; drop procedure f2; @@ -248,6 +252,7 @@ SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creat # # Bug #30269 Query cache eats memory # +--disable_cursor_protocol --disable_warnings DROP DATABASE IF EXISTS bug30269; --enable_warnings @@ -269,6 +274,7 @@ SELECT id FROM test1 WHERE id>2; show status like 'Qcache_queries_in_cache'; SELECT id FROM view1 WHERE id>2; show status like 'Qcache_queries_in_cache'; +--enable_cursor_protocol connection default; USE test; diff --git a/mysql-test/main/query_cache_with_views.test b/mysql-test/main/query_cache_with_views.test index 6740c70883e..c1e3ed96cd3 100644 --- a/mysql-test/main/query_cache_with_views.test +++ b/mysql-test/main/query_cache_with_views.test @@ -18,6 +18,7 @@ set GLOBAL query_cache_size=1355776; flush status; create table t1 (a int, b int); +--disable_cursor_protocol # queries with following views should not be in query cache create view v1 (c,d) as select sql_no_cache a,b from t1; create view v2 (c,d) as select a+rand(),b from t1; @@ -66,6 +67,7 @@ show status like "Qcache_hits"; drop view v1; set query_cache_type=default; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; @@ -110,6 +112,7 @@ drop table t1; # # BUG#15119: returning temptable view from the query cache. # +--disable_cursor_protocol --disable_ps2_protocol flush status; create table t1 (a int, b int); @@ -137,6 +140,7 @@ show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index c71811fa74d..6b480e327dc 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -698,6 +698,7 @@ DROP INDEX CityName on City; CREATE INDEX Name ON City(Name); CREATE INDEX Population ON City(Population); +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol --replace_column 9 # @@ -761,6 +762,7 @@ ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test index 14035f81590..ecded18dc76 100644 --- a/mysql-test/main/select.test +++ b/mysql-test/main/select.test @@ -1845,10 +1845,15 @@ select wss_type from t1 where wss_type ='102935229216544104'; select wss_type from t1 where wss_type ='102935229216544093'; select wss_type from t1 where wss_type =102935229216544093; drop table t1; +--disable_cursor_protocol select 1+2,"aaaa",3.13*2.0 into @a,@b,@c; +--enable_cursor_protocol select @a; select @b; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @c; +--enable_cursor_protocol # # Test of removing redundant braces in the FROM part @@ -2198,7 +2203,10 @@ INSERT INTO t1 (SELECT * FROM t1 WHERE a = 50 AND b = 3); select found_rows(); SELECT * FROM t1; +# Check after fix MDEV-31522 +--disable_cursor_protocol select count(*) from t1; +--enable_cursor_protocol select found_rows(); select count(*) from t1 limit 2,3; select found_rows(); @@ -3727,6 +3735,7 @@ DROP TABLE t1; # # Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" # +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol CREATE TABLE t1 (a INT, b INT); @@ -3744,6 +3753,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol # # Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error @@ -3820,10 +3830,12 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (2),(3); --echo # Should not crash +--disable_cursor_protocol --error ER_SUBQUERY_NO_1_ROW SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/select_found.test b/mysql-test/main/select_found.test index dac16fdb727..abbfd6cc3ef 100644 --- a/mysql-test/main/select_found.test +++ b/mysql-test/main/select_found.test @@ -178,14 +178,19 @@ DROP TABLE t1; # # Bug #6089: queries which don't use any tables # - +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT 'foo'; +--enable_cursor_protocol SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo'; SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0; +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT FOUND_ROWS(); SELECT FOUND_ROWS(); +--enable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0; SELECT FOUND_ROWS(); diff --git a/mysql-test/main/shutdown_not_windows.test b/mysql-test/main/shutdown_not_windows.test index 43063ced494..9e5246cc3f8 100644 --- a/mysql-test/main/shutdown_not_windows.test +++ b/mysql-test/main/shutdown_not_windows.test @@ -9,7 +9,9 @@ source include/have_debug.inc; call mtr.add_suppression('Thread .* did not exit'); set @old_dbug=@@global.debug_dbug; set global debug_dbug='+d,CONNECT_wait'; +--disable_cursor_protocol select variable_value into @cons from information_schema.global_status where variable_name='connections'; +--enable_cursor_protocol exec $MYSQL -e 'select sleep(3600)' >/dev/null 2>&1 &; let $wait_condition= select variable_value>@cons from information_schema.global_status where variable_name='connections'; source include/wait_condition.inc; diff --git a/mysql-test/main/single_delete_update.test b/mysql-test/main/single_delete_update.test index 0f2dc189e94..49a1b6b758d 100644 --- a/mysql-test/main/single_delete_update.test +++ b/mysql-test/main/single_delete_update.test @@ -12,6 +12,7 @@ --echo # limit efficiently --echo # +--disable_cursor_protocol CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), (20),(21),(22),(23),(24),(25); @@ -457,3 +458,4 @@ SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; DROP TABLE t1, t2; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/main/sp-error.test b/mysql-test/main/sp-error.test index 800a9b503b6..c471ffae99f 100644 --- a/mysql-test/main/sp-error.test +++ b/mysql-test/main/sp-error.test @@ -11,7 +11,9 @@ drop table if exists t1, t2; --disable_ps2_protocol # Backup the mysql.proc table --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; +--enable_cursor_protocol --enable_ps2_protocol # Make sure we don't have any procedures left. diff --git a/mysql-test/main/sp-no-valgrind.test b/mysql-test/main/sp-no-valgrind.test index 6bacc7b150c..10a238f9871 100644 --- a/mysql-test/main/sp-no-valgrind.test +++ b/mysql-test/main/sp-no-valgrind.test @@ -5,18 +5,24 @@ --echo # Warmup round, this might allocate some memory for session variable --echo # and the output +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp0() SELECT 1; SHOW CREATE PROCEDURE sp0; DROP PROCEDURE sp0; #Check that CREATE/SHOW does not use memory in caches. +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp1() SELECT 1; SHOW CREATE PROCEDURE sp1; +--disable_cursor_protocol SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol # FIXME: MDEV-26754 main.sp test fails for embedded server #SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; DROP PROCEDURE sp1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index d417bc636d4..c1e107b69e1 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -3019,8 +3019,10 @@ create procedure bug5251() begin end| +--disable_cursor_protocol select created into @c1 from mysql.proc where db='test' and name='bug5251'| +--enable_cursor_protocol --sleep 2 alter procedure bug5251 comment 'foobar'| select count(*) from mysql.proc @@ -8256,12 +8258,16 @@ drop procedure if exists p; --enable_warnings set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); +--disable_cursor_protocol select @@sql_mode into @full_mode; +--enable_cursor_protocol create procedure p() as begin end; call p(); set @@sql_mode= @old_mode; # Rename SQL modes that differ in name between the server and the table definition. +--disable_cursor_protocol select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.proc where name = 'p' and sql_mode = @full_mode; drop procedure p; diff --git a/mysql-test/main/sp_trans.test b/mysql-test/main/sp_trans.test index b991cd49f70..bb71c195a08 100644 --- a/mysql-test/main/sp_trans.test +++ b/mysql-test/main/sp_trans.test @@ -610,9 +610,11 @@ drop table t3| # BUG#11758414: Default default_storage_engine not honored when set # from within a stored procedure # +--disable_cursor_protocol SELECT @@GLOBAL.default_storage_engine INTO @old_engine| SET @@GLOBAL.default_storage_engine=InnoDB| SET @@SESSION.default_storage_engine=InnoDB| +--enable_cursor_protocol # show defaults at define-time SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'| SHOW SESSION VARIABLES LIKE 'default_storage_engine'| diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index e6b300b5db2..c690d2bb3ca 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -318,6 +318,7 @@ SELECT * FROM mysql.column_stats; --sorted_result SELECT * FROM mysql.index_stats; +--disable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol eval @@ -330,6 +331,7 @@ SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/save_index_stats' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM mysql.index_stats WHERE index_name IN ('idx1', 'idx4'); --enable_ps2_protocol +--enable_cursor_protocol ALTER TABLE t1 CHANGE COLUMN b x varchar(30); SHOW CREATE TABLE t1; diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test index 339e853f2fc..bf35890722e 100644 --- a/mysql-test/main/status2.test +++ b/mysql-test/main/status2.test @@ -27,6 +27,7 @@ CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); +--disable_cursor_protocol --echo Assert Questions == 7 SHOW STATUS LIKE 'Questions'; SELECT testQuestion(); @@ -38,6 +39,7 @@ SHOW STATUS LIKE 'Questions'; SELECT 1; --echo Assert Questions == 13 SHOW STATUS LIKE 'Questions'; +--enable_cursor_protocol connect (con1,localhost,root,,); connection con1; SELECT 1; diff --git a/mysql-test/main/strict.test b/mysql-test/main/strict.test index 830f051a5f6..90afdd1c854 100644 --- a/mysql-test/main/strict.test +++ b/mysql-test/main/strict.test @@ -60,7 +60,10 @@ INSERT INTO t1 VALUES ('2004-2-30'); set @@sql_mode='ansi,traditional'; INSERT IGNORE INTO t1 VALUES('2004-02-29'),('2004-13-15'),('0000-00-00'); +#Enable after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol drop table t1; # Test difference in behaviour with InnoDB and MyISAM tables diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 3f01e984125..89e7d18b2b2 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -71,10 +71,13 @@ SELECT ROW(1,2,3) = (SELECT 1,2,3); SELECT ROW(1,2,3) = (SELECT 1,2,1); SELECT ROW(1,2,3) < (SELECT 1,2,1); SELECT ROW(1,2,3) > (SELECT 1,2,1); +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol SELECT ROW(1,2,3) = (SELECT 1,2,NULL); --enable_view_protocol +--enable_cursor_protocol SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; @@ -507,8 +510,11 @@ select 1 IN (SELECT * from t1); select 3 IN (SELECT * from t1); select 10 IN (SELECT * from t1); select 1 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10 > ALL (SELECT * from t1); select 1 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10 > ANY (SELECT * from t1); drop table t1; create table t1 (a varchar(20)); @@ -521,8 +527,11 @@ select 'A' IN (SELECT * from t1); select 'DEF' IN (SELECT * from t1); select 'XYZS' IN (SELECT * from t1); select 'A' > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 'XYZS' > ALL (SELECT * from t1); select 'A' > ANY (SELECT * from t1); +--enable_cursor_protocol select 'XYZS' > ANY (SELECT * from t1); drop table t1; create table t1 (a float); @@ -535,15 +544,21 @@ select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol update t1 set a=NULL where a=2.5; select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10.5 > ANY (SELECT * from t1); --enable_view_protocol explain extended select (select a+1) from t1; @@ -1177,7 +1192,9 @@ let $outfile_rel= ../../tmp/subselect.out.file.1; --error 0,1 --remove_file $outfile_abs --enable_warnings +--disable_cursor_protocol eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1; +--enable_cursor_protocol delete from t1; eval load data infile "$outfile_rel" into table t1; --remove_file $outfile_abs @@ -3583,7 +3600,9 @@ DROP TABLE t1,t2; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -3621,7 +3640,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -3642,7 +3663,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5018,7 +5041,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -5035,7 +5060,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5427,8 +5454,10 @@ DROP TABLE t1,t2,t3; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); - + +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -5855,10 +5884,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; --disable_ps2_protocol flush status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -5873,10 +5904,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; flush status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; diff --git a/mysql-test/main/subselect3.inc b/mysql-test/main/subselect3.inc index 2258456f355..6516c6a6ef0 100644 --- a/mysql-test/main/subselect3.inc +++ b/mysql-test/main/subselect3.inc @@ -57,9 +57,11 @@ select a, oref, a in ( create table t3 (a int); insert into t3 values (NULL), (NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol select a in (select max(ie) from t1 where oref=4 group by grp) from t3; --enable_ps2_protocol +--enable_cursor_protocol show status like 'Handler_read_rnd_next'; select ' ^ This must show 11' Z; @@ -96,7 +98,9 @@ select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; --disable_ps2_protocol flush status; +--disable_cursor_protocol select oref, a from t2 where a in (select a from t1 where oref=t2.oref); +--enable_cursor_protocol # This will only show access to t2: show status like '%Handler_read_rnd_next'; @@ -106,7 +110,9 @@ insert into t2 values (NULL, 0),(NULL, 0), (NULL, 0), (NULL, 0); set optimizer_switch='subquery_cache=off'; flush status; +--disable_cursor_protocol select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; +--enable_cursor_protocol show status like '%Handler_read%'; select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z; set @@optimizer_switch=@save_optimizer_switch; @@ -641,9 +647,11 @@ DROP TABLE t1, t2; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); +--disable_cursor_protocol --disable_ps2_protocol select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; load data infile "../../tmp/subselect.out.file.1" into table t1; select * from t1; @@ -695,6 +703,8 @@ SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), DROP TABLE t1; +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol --echo # both columns should be same @@ -705,6 +715,7 @@ SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1); SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); --enable_view_protocol +--enable_cursor_protocol # # Bug #37362 Crash in do_field_eq @@ -812,11 +823,13 @@ set @save_optimizer_switch2=@@optimizer_switch; set optimizer_switch='subquery_cache=off'; --disable_ps2_protocol +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Check that the subquery only has to be evaluated once @@ -828,11 +841,13 @@ SHOW STATUS LIKE '%Handler_read_rnd_next'; INSERT INTO t1 VALUES (NULL, NULL); FLUSH STATUS; +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Handler_read_rnd_next should be one more than baseline @@ -978,9 +993,11 @@ set @@max_heap_table_size= 16384; explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); flush status; --disable_ps2_protocol +--disable_cursor_protocol select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); --enable_ps2_protocol show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol set @save_max_heap_table_size=@@max_heap_table_size; set @@optimizer_switch=@save_optimizer_switch; drop table t0, t1; diff --git a/mysql-test/main/subselect_cache.test b/mysql-test/main/subselect_cache.test index 1af2825791e..6e63273cdcb 100644 --- a/mysql-test/main/subselect_cache.test +++ b/mysql-test/main/subselect_cache.test @@ -24,7 +24,9 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1); --echo #single value subquery test (SELECT list) --disable_ps2_protocol flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -42,6 +44,7 @@ select a, (select d from t2 where b=c), (select d from t2 where b=c union select set optimizer_switch='subquery_cache=off'; flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; show status like "subquery_cache%"; @@ -172,6 +175,7 @@ select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c); show status like "subquery_cache%"; show status like '%Handler_read%'; set optimizer_switch='subquery_cache=on'; +--enable_cursor_protocol --echo #single value subquery test (PS) prepare stmt1 from 'select a, (select d from t2 where b=c) + 1 from t1'; @@ -192,6 +196,7 @@ drop procedure p1; --echo #IN subquery test flush status; +--disable_cursor_protocol show status like "subquery_cache%"; select a, b , b in (select d from t2) as SUBS from t1; show status like "subquery_cache%"; @@ -342,6 +347,7 @@ flush status; select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1; show status like "subquery_cache%"; show status like '%Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo #clean up @@ -426,12 +432,14 @@ DROP TABLE t1; flush status; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); +--disable_cursor_protocol select a, a in (select a from t1) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < rand()) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext; show status like "subquery_cache%"; +--enable_cursor_protocol drop table t1; --enable_ps2_protocol @@ -459,6 +467,7 @@ insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5), (3,5), (100,3), (200,3), (10,6), (20,6), (20,7), (100,8), (200,8); insert into t2 values (1,1),(3,3),(20,20); +--disable_cursor_protocol --disable_ps2_protocol --echo aggregate function as parameter of subquery set optimizer_switch='subquery_cache=off'; @@ -485,6 +494,7 @@ select max(a), (select a from t2 where a=c) from t1 group by b; show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1,t2; @@ -499,6 +509,7 @@ insert into t1 values create table t2 (pk int, a int, primary key(pk)); insert into t2 select a,a from t0; +--disable_cursor_protocol --disable_ps2_protocol set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on'; flush status; @@ -532,6 +543,7 @@ select * from t1 where a in (select pk from t2); show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t0,t1,t2; diff --git a/mysql-test/main/subselect_exists2in_costmat.test b/mysql-test/main/subselect_exists2in_costmat.test index 5d5eeaee268..02e61e983b1 100644 --- a/mysql-test/main/subselect_exists2in_costmat.test +++ b/mysql-test/main/subselect_exists2in_costmat.test @@ -47,7 +47,9 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol select max(id) from City into @max_city_id; +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_mat_cost.test b/mysql-test/main/subselect_mat_cost.test index 73ba717a8dc..41010da7cb0 100644 --- a/mysql-test/main/subselect_mat_cost.test +++ b/mysql-test/main/subselect_mat_cost.test @@ -53,7 +53,9 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol select max(id) from City into @max_city_id; +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test index e4d02ed666c..e2edc31fa9c 100644 --- a/mysql-test/main/subselect_sj.test +++ b/mysql-test/main/subselect_sj.test @@ -2679,8 +2679,10 @@ CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam; INSERT INTO t3 VALUES (0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1); +--disable_cursor_protocol select @@max_heap_table_size into @tmp_max_heap_table_size; select @@join_buffer_size into @tmp_join_buffer_size; +--enable_cursor_protocol set max_heap_table_size=16*1024; --disable_query_log diff --git a/mysql-test/main/tmp_table_count-7586.test b/mysql-test/main/tmp_table_count-7586.test index 0629e27f164..71eb5c37d0d 100644 --- a/mysql-test/main/tmp_table_count-7586.test +++ b/mysql-test/main/tmp_table_count-7586.test @@ -11,6 +11,7 @@ create table t2 (a int); insert into t2 values (1),(2),(3); create view v2 as select a from t2; +--disable_cursor_protocol flush status; select * from v2; --disable_ps_protocol @@ -23,6 +24,7 @@ select * from (select * from t2) T1; --disable_ps_protocol show status like '%Created_tmp%'; --enable_ps_protocol +--enable_cursor_protocol explain select * from (select * from t2) T1; diff --git a/mysql-test/main/trigger-compat.test b/mysql-test/main/trigger-compat.test index 9c102993a6f..a8ad20073d6 100644 --- a/mysql-test/main/trigger-compat.test +++ b/mysql-test/main/trigger-compat.test @@ -68,11 +68,13 @@ let $MYSQLD_DATADIR = `select @@datadir`; eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch; # remove original t1.TRG file so SELECT INTO OUTFILE won't fail --remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG +--disable_cursor_protocol --disable_ps2_protocol eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' FROM patch; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE patch; --connection wl2818_definer_con --enable_query_log diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index ae4ee2e04bc..5086215f751 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -634,7 +634,10 @@ set sql_mode=""; create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00'; set sql_mode="traditional"; insert into t1 values ('2004-01-01'); +#Check after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol set sql_mode=default; show create table t1; --replace_column 6 # diff --git a/mysql-test/main/type_binary.test b/mysql-test/main/type_binary.test index 04cdc94e6d8..d9b07563a28 100644 --- a/mysql-test/main/type_binary.test +++ b/mysql-test/main/type_binary.test @@ -135,6 +135,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a VARCHAR(39)); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT @@ -155,4 +157,5 @@ SELECT FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index ad7b6fbbd72..6c8be397938 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -461,7 +461,10 @@ SHOW CREATE TABLE t2; DROP TABLE t2; --enable_metadata --disable_view_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT COALESCE(val, 1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata DROP TABLE t1; diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test index 3566e427d50..3e136e56a5a 100644 --- a/mysql-test/main/type_date.test +++ b/mysql-test/main/type_date.test @@ -211,12 +211,15 @@ CREATE TABLE t2 (a DATE); CREATE INDEX i ON t1 (a); INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00'); INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00'); +#Check after fix MDEV-31516 +--disable_cursor_protocol SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; +--enable_cursor_protocol --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('1000-00-00'); SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test index bcbc4cc520e..cd157bae178 100644 --- a/mysql-test/main/type_enum.test +++ b/mysql-test/main/type_enum.test @@ -237,7 +237,10 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (1),(2); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT AVG(f1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index 1cc5cc94267..ebf1883d301 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -320,8 +320,10 @@ let $nine_65= select format(-1.7976931348623157E+307,256) as foo; select least(-1.1111111111111111111111111, - group_concat(1.7976931348623157E+308)) as foo; +--disable_cursor_protocol eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), ($nine_65)) into @a; +--enable_cursor_protocol --enable_result_log --echo End of 5.0 tests @@ -337,6 +339,8 @@ select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; --echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --echo # +#enable after fix MDEV-34213 +--disable_cursor_protocol #enable after fix MDEV-29552 --disable_view_protocol SELECT LEFT('a',EXP(50)); @@ -347,6 +351,7 @@ CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (1e30); SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; DROP TABLE t1; +--enable_cursor_protocol PREPARE stmt FROM 'SELECT LEFT(111,?)'; SET @a=1e30; diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index 33e56da7da8..babfb4e1db8 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -609,12 +609,15 @@ select round(99999999999999999.999,3); select round(-99999999999999999.999,3); #-- should return -100000000000000000.000 # +#enable after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28660 --disable_view_protocol select truncate(99999999999999999999999999999999999999,49); #-- should return 99999999999999999999999999999999999999.000 # --enable_view_protocol +--enable_cursor_protocol select truncate(99.999999999999999999999999999999999999,49); #-- should return 99.9999999999999999999999999999999 # @@ -1266,11 +1269,12 @@ DROP TABLE t1; let $nine_81= 999999999999999999999999999999999999999999999999999999999999999999999999999999999; - #view protocol generates additional warning --disable_view_protocol eval SELECT substring(('M') FROM ($nine_81)) AS foo; --enable_view_protocol +#check after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28661 --disable_view_protocol eval SELECT min($nine_81) AS foo; @@ -1284,6 +1288,7 @@ eval SELECT date_sub(($nine_81), day_minute) AS foo; eval SELECT truncate($nine_81, 28) AS foo; +--enable_cursor_protocol --enable_view_protocol --echo End of 5.0 tests diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index 3f17f347a22..82193ee709a 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -742,9 +742,11 @@ FLUSH TABLES; # 0xFF - record flags # 0x77777777 - TIMESTAMP integer part # 0xFFFFFF - TIMESTAMP bad fractional part +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY '' --enable_ps2_protocol +--enable_cursor_protocol --eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD --enable_query_log SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1; @@ -859,7 +861,10 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM; INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01'),('2003-01-01'); SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a; +#Enable after fix MDEV-31730 +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1) - a FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index 1e72fc08886..0f0af9c8b0c 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -158,7 +158,10 @@ DROP TABLE t1; CREATE TABLE t1(c1 YEAR(4)); INSERT INTO t1 VALUES (1901),(2155),(0000); SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +--enable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1; DROP TABLE t1; --enable_view_protocol diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index d87d446f733..11717eb43b1 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -250,6 +250,8 @@ DROP FUNCTION avgcost; #enable view prtotocol after fix MDEV-28677 --disable_view_protocol +#check after fix MDEV-31587 +--disable_cursor_protocol select * from mysql.func; --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; @@ -262,6 +264,7 @@ select * from mysql.func; --error 1305 select is_const(3); +--enable_cursor_protocol --enable_view_protocol # @@ -270,6 +273,8 @@ select is_const(3); --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; +#check after fix MDEV-31587 +--disable_cursor_protocol select is_const(3) as const, is_const(3.14) as const, @@ -297,6 +302,7 @@ select from bug18761; drop table bug18761; +--enable_cursor_protocol --error 1241 select is_const((1,2,3)); diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index 278958d800c..f1ffbf41ca2 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -1114,6 +1114,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); +--disable_cursor_protocol -- echo # Tests fix in parser rule select_derived_union. SELECT a INTO @v FROM ( SELECT a FROM t1 @@ -1153,6 +1154,7 @@ SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO @v FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1; +--enable_cursor_protocol DROP TABLE t1; remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*; diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 0dbc3c333ee..144f89b0053 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -236,9 +236,11 @@ insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0); # the view protocol creates an additional statistics data --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol flush status; select a from t1 order by a limit 1; show status like 'handler_read%'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -346,6 +348,7 @@ INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; +--disable_cursor_protocol --disable_ps2_protocol flush status; SELECT user_id FROM t1 WHERE request_id=9999999999999; @@ -357,6 +360,7 @@ show status like '%Handler_read%'; UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/user_var.test b/mysql-test/main/user_var.test index e69718243ed..135dd92fd29 100644 --- a/mysql-test/main/user_var.test +++ b/mysql-test/main/user_var.test @@ -290,7 +290,9 @@ drop table t1; # CREATE TABLE t1(a INT, b INT); INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20); +--disable_cursor_protocol SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; +--enable_cursor_protocol SELECT @a, @b; SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; DROP TABLE t1; @@ -384,7 +386,9 @@ DROP TABLE t1; # SAME USER VARIABLE = CRASH # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol --echo End of 5.1 tests @@ -459,7 +463,9 @@ DROP TABLE t1; --echo # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol # # MDEV-616 LP BUG#1002126 diff --git a/mysql-test/main/userstat-badlogin-4824.test b/mysql-test/main/userstat-badlogin-4824.test index 0a7490bc29c..f9d3e22bff0 100644 --- a/mysql-test/main/userstat-badlogin-4824.test +++ b/mysql-test/main/userstat-badlogin-4824.test @@ -14,7 +14,9 @@ set global userstat=1; --disable_ps2_protocol connect(foo, localhost, foo, foo); +--disable_cursor_protocol select 1; +--enable_cursor_protocol disconnect foo; connection default; diff --git a/mysql-test/main/userstat.test b/mysql-test/main/userstat.test index 4aa10819d33..686165223a5 100644 --- a/mysql-test/main/userstat.test +++ b/mysql-test/main/userstat.test @@ -8,7 +8,9 @@ -- source include/have_perfschema.inc --disable_ps2_protocol +--disable_cursor_protocol select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; +--enable_cursor_protocol show columns from information_schema.client_statistics; show columns from information_schema.user_statistics; show columns from information_schema.index_statistics; @@ -26,6 +28,7 @@ update t1 set b=1; update t1 set b=5 where a=2; delete from t1 where a=3; +--disable_cursor_protocol /* Empty query */ select * from t1 where a=999; @@ -35,11 +38,11 @@ drop table t1; --connect (ssl_con,localhost,root,,,,,SSL) SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --connection default +--enable_cursor_protocol # # Test the commit and rollback are counted # - create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; insert into t1 values(1,1); @@ -52,11 +55,13 @@ insert into t1 values(3,3); rollback; drop table t1; +--disable_cursor_protocol select sleep(1); show status like "rows%"; show status like "ha%"; select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key"; +--enable_cursor_protocol --disconnect ssl_con diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test index 2f145a77d74..1e5302e6d42 100644 --- a/mysql-test/main/variables.test +++ b/mysql-test/main/variables.test @@ -65,7 +65,10 @@ set @test_int=null,@test_double=null,@test_string=null,@test_string2=null; select @test_int,@test_double,@test_string,@test_string2; select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @t5; +--enable_cursor_protocol # # Test problem with WHERE and variables @@ -372,7 +375,9 @@ select @@key_buffer_size; select * from t1 where a=2; select * from t2 where a=3; check table t1,t2; +--disable_cursor_protocol select max(a) +1, max(a) +2 into @xx,@yy from t1; +--enable_cursor_protocol drop table t1,t2; # @@ -594,7 +599,9 @@ set global sql_mode=repeat('a',80); # create table t1 (a int); +--disable_cursor_protocol select a into @x from t1; +--enable_cursor_protocol show warnings; drop table t1; @@ -1129,7 +1136,9 @@ SET @@global.thread_stack= 7; # Bug #40657 - assertion with out of range variables and traditional sql_mode # +--disable_cursor_protocol SELECT @@global.expire_logs_days INTO @old_eld; +--enable_cursor_protocol SET GLOBAL expire_logs_days = -1; --echo needs to've been adjusted (0) @@ -1165,10 +1174,12 @@ SET GLOBAL auto_increment_offset=0; # # Bug#41030 Wrong meta data (incorrect fieldlen) # - +#Check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select @@default_storage_engine; --disable_metadata +--enable_cursor_protocol # # Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 16f752ecc41..6730e7f7111 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -2043,7 +2043,9 @@ drop view abc; flush status; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -2054,9 +2056,11 @@ set @tmp=@@optimizer_switch; set @@optimizer_switch='derived_merge=OFF'; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol --disable_ps2_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -3107,12 +3111,13 @@ DROP VIEW IF EXISTS v1; let $query = SELECT * FROM (SELECT 1) AS t into @w; +--disable_cursor_protocol eval $query; --error ER_PARSE_ERROR eval CREATE VIEW v1 AS $query; --echo # Previously the following would fail. eval $query; - +--enable_cursor_protocol # # Bug#24532 The return data type of IS TRUE is different from similar operations @@ -4150,6 +4155,7 @@ INSERT INTO t2 VALUES (9,90), (16, 160), (11,110), (1,10), (18,180), (2,20), (14,140), (15, 150), (12,120), (3,30), (17,170), (19,190); +--disable_cursor_protocol EXPLAIN EXTENDED SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8; FLUSH STATUS; @@ -4163,6 +4169,7 @@ FLUSH STATUS; SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8; SHOW STATUS LIKE 'Handler_read_%'; DROP VIEW v; +--enable_cursor_protocol DROP TABLE t1, t2; --enable_ps2_protocol diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index 686a9428bf6..fc0521933cc 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -686,15 +686,19 @@ use test; create view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def1 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; create definer=`test14256`@`%` view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def2 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; select @v1def1, @v1def2, @v1def1=@v1def2; diff --git a/mysql-test/main/wl4435_generated.inc b/mysql-test/main/wl4435_generated.inc index 5ea05a89402..df039c6347e 100644 --- a/mysql-test/main/wl4435_generated.inc +++ b/mysql-test/main/wl4435_generated.inc @@ -288,7 +288,10 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; +#Enable after fix MDEV-31495 +--disable_cursor_protocol SELECT @a, @a = 123.456789; +--enable_cursor_protocol DROP TEMPORARY TABLE tmp1; DROP PROCEDURE p1; diff --git a/mysql-test/suite/archive/rnd_pos.test b/mysql-test/suite/archive/rnd_pos.test index f0a8c9ad2f3..4ceb8a93656 100644 --- a/mysql-test/suite/archive/rnd_pos.test +++ b/mysql-test/suite/archive/rnd_pos.test @@ -11,9 +11,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; @@ -24,9 +26,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; diff --git a/mysql-test/suite/binlog/include/database.test b/mysql-test/suite/binlog/include/database.test index e61198b2da2..a55cd7c5002 100644 --- a/mysql-test/suite/binlog/include/database.test +++ b/mysql-test/suite/binlog/include/database.test @@ -44,9 +44,11 @@ CREATE TABLE t2(c1 INT); let $prefix= `SELECT UUID()`; --echo # Create a file in the database directory --replace_result $prefix FAKE_FILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix'; --enable_ps2_protocol +--enable_cursor_protocol --echo --echo # 'DROP DATABASE' will fail if there is any other file in the the diff --git a/mysql-test/suite/binlog/t/binlog_commit_wait.test b/mysql-test/suite/binlog/t/binlog_commit_wait.test index 7d7af2a90e2..dbd0e41407f 100644 --- a/mysql-test/suite/binlog/t/binlog_commit_wait.test +++ b/mysql-test/suite/binlog/t/binlog_commit_wait.test @@ -15,6 +15,7 @@ connect(con3,localhost,root,,test); # Get Initial status measurements --connection default +--disable_cursor_protocol SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status @@ -23,6 +24,7 @@ SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema WHERE variable_name = 'binlog_group_commit_trigger_timeout'; SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; +--enable_cursor_protocol # Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is # counted near when the groups its finalised. diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test index 3e18ef1e351..420a00462ee 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test @@ -7,7 +7,9 @@ CREATE TABLE t (a TEXT); # events of interest are guaranteed to stay in 000001 log RESET MASTER; --eval INSERT INTO t SET a=repeat('a', 1024) +--disable_cursor_protocol SELECT a into @a from t; +--enable_cursor_protocol FLUSH LOGS; DELETE FROM t; diff --git a/mysql-test/suite/compat/oracle/t/update_innodb.test b/mysql-test/suite/compat/oracle/t/update_innodb.test index 8af219584d6..d1ae0864dc2 100644 --- a/mysql-test/suite/compat/oracle/t/update_innodb.test +++ b/mysql-test/suite/compat/oracle/t/update_innodb.test @@ -8,7 +8,9 @@ SET sql_mode='ORACLE'; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb; INSERT INTO t1 VALUES (1); START TRANSACTION; +--disable_cursor_protocol SELECT a AS a_con1 FROM t1 INTO @a FOR UPDATE; +--enable_cursor_protocol --connect(con2,localhost,root,,) SET sql_mode='ORACLE'; diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test index 83abb783c9e..c48e5cf5c73 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test @@ -2,6 +2,7 @@ --source include/have_innodb.inc --source include/have_file_key_management_plugin.inc +--disable_cursor_protocol SELECT CAST(variable_value AS INT) INTO @old_encrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; @@ -9,6 +10,7 @@ WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; SELECT CAST(variable_value AS INT) INTO @old_decrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted'; +--enable_cursor_protocol CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB; INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192; diff --git a/mysql-test/suite/engines/funcs/t/ld_null.test b/mysql-test/suite/engines/funcs/t/ld_null.test index 50cbce78044..e01c473baf3 100644 --- a/mysql-test/suite/engines/funcs/t/ld_null.test +++ b/mysql-test/suite/engines/funcs/t/ld_null.test @@ -3,7 +3,9 @@ DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '../../tmp/t1.dat' FROM t1; +--enable_cursor_protocol SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; --disable_query_log @@ -15,7 +17,9 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null2.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ESCAPED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1-2.dat' FIELDS ESCAPED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/ld_quote.test b/mysql-test/suite/engines/funcs/t/ld_quote.test index 89636fff2bb..b66a5e24ed8 100644 --- a/mysql-test/suite/engines/funcs/t/ld_quote.test +++ b/mysql-test/suite/engines/funcs/t/ld_quote.test @@ -4,7 +4,9 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10)); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_quote.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.dat' FIELDS ENCLOSED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/iuds/t/insert_calendar.test b/mysql-test/suite/engines/iuds/t/insert_calendar.test index 5d8380a1496..f957891bb1e 100644 --- a/mysql-test/suite/engines/iuds/t/insert_calendar.test +++ b/mysql-test/suite/engines/iuds/t/insert_calendar.test @@ -78,8 +78,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -152,8 +155,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -868,8 +874,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24 09:15:28'; @@ -942,8 +951,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26 00:00:00'; @@ -1016,8 +1028,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28 00:00:00'; @@ -2070,8 +2085,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2144,8 +2162,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -2864,8 +2885,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2938,8 +2962,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -3012,8 +3039,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; @@ -4067,8 +4097,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4141,8 +4174,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -4854,8 +4890,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4928,8 +4967,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -5002,8 +5044,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; diff --git a/mysql-test/suite/engines/iuds/t/insert_decimal.test b/mysql-test/suite/engines/iuds/t/insert_decimal.test index c75fa19506e..d6e1b43d0bf 100644 --- a/mysql-test/suite/engines/iuds/t/insert_decimal.test +++ b/mysql-test/suite/engines/iuds/t/insert_decimal.test @@ -60,8 +60,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -134,8 +137,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -388,8 +394,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -462,8 +471,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -711,8 +723,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -785,8 +800,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; diff --git a/mysql-test/suite/engines/iuds/t/insert_time.test b/mysql-test/suite/engines/iuds/t/insert_time.test index 0e5e21507a9..8a7a822b934 100644 --- a/mysql-test/suite/engines/iuds/t/insert_time.test +++ b/mysql-test/suite/engines/iuds/t/insert_time.test @@ -77,8 +77,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2009-01-17'; diff --git a/mysql-test/suite/federated/federatedx_create_handlers.test b/mysql-test/suite/federated/federatedx_create_handlers.test index 8e504590282..9cf08a34931 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.test +++ b/mysql-test/suite/federated/federatedx_create_handlers.test @@ -7,6 +7,9 @@ connection default; set global federated_pushdown=1; +#Enable after fix MDEV-31846 or in v. 10.5 and later +--disable_cursor_protocol + connection slave; DROP TABLE IF EXISTS federated.t1; @@ -433,5 +436,7 @@ DEALLOCATE PREPARE stmt; set global federated_pushdown=0; +--enable_cursor_protocol + source include/federated_cleanup.inc; diff --git a/mysql-test/suite/funcs_1/datadict/datadict.pre b/mysql-test/suite/funcs_1/datadict/datadict.pre index cedc24aad13..4082ab7be31 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict.pre +++ b/mysql-test/suite/funcs_1/datadict/datadict.pre @@ -21,11 +21,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index 9e3b87660f8..e3358588654 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -16,11 +16,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc index b3d0ef4cca5..12257cad1ce 100644 --- a/mysql-test/suite/funcs_1/datadict/is_tables.inc +++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc @@ -337,9 +337,11 @@ WHERE table_name = 't1_my_tablex'; ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1; SELECT table_name, checksum IS NOT NULL FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--disable_cursor_protocol SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # Enforce a time difference bigger than the smallest unit (1 second). --real_sleep 1.1 INSERT INTO db_datadict.t1_my_tablex SET f1 = 3; @@ -354,8 +356,10 @@ FROM information_schema.tables WHERE table_name = 't1_my_tablex'; # # Information is used later +--disable_cursor_protocol SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # # Check impact of DROP TABLE SELECT table_name FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/storedproc/param_check.inc b/mysql-test/suite/funcs_1/storedproc/param_check.inc index 203187f92b1..72c5ce15bc1 100644 --- a/mysql-test/suite/funcs_1/storedproc/param_check.inc +++ b/mysql-test/suite/funcs_1/storedproc/param_check.inc @@ -32,12 +32,16 @@ eval UPDATE t1_aux SET f1 = NULL; # Enforce that all user variables have the same data type and initial value. +--disable_cursor_protocol SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval UPDATE t1_aux SET f1 = $test_value; --enable_warnings +--disable_cursor_protocol SELECT f1 INTO @v1_tab FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval CALL sproc_1($test_value, @v1_proc); eval SET @v1_func = func_1($test_value); diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index 591a5ca566b..dd0aa78d0f1 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -175,9 +175,11 @@ SELECT 1 AS my_col FROM information_schema.tables WHERE table_name = 't1_third'; # # SELECT INTO USER VARIABLE +--disable_cursor_protocol SELECT table_name,table_schema INTO @table_name,@table_schema FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1; +--enable_cursor_protocol SELECT @table_name,@table_schema; # # SELECT INTO OUTFILE @@ -185,6 +187,7 @@ let $OUTFILE = $MYSQLTEST_VARDIR/tmp/datadict.out; --error 0,1 remove_file $OUTFILE; --replace_result $OUTFILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT table_name,table_schema INTO OUTFILE '$OUTFILE' @@ -193,6 +196,7 @@ LINES TERMINATED BY '\n' FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name; --enable_ps2_protocol +--enable_cursor_protocol cat_file $OUTFILE; remove_file $OUTFILE; # diff --git a/mysql-test/suite/funcs_1/t/row_count_func.test b/mysql-test/suite/funcs_1/t/row_count_func.test index fb207681bc6..4c3466f7a13 100644 --- a/mysql-test/suite/funcs_1/t/row_count_func.test +++ b/mysql-test/suite/funcs_1/t/row_count_func.test @@ -18,9 +18,11 @@ INSERT INTO t1 VALUES (1), (2), (3); --enable_info --echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt"; --disable_query_log # to avoid $MYSQL_TMP_DIR in query log +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * FROM t1 INTO OUTFILE "$MYSQL_TMP_DIR/bug21818.txt" --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --disable_info @@ -32,9 +34,11 @@ SELECT ROW_COUNT(); --echo --echo # -- Check 2. +--disable_cursor_protocol --enable_info SELECT a FROM t1 LIMIT 1 INTO @a; --disable_info +--enable_cursor_protocol --echo --disable_ps2_protocol diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc index 0aeb46896a6..e1c56cacf20 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc @@ -123,8 +123,10 @@ let $message= 3.5.8.4 - multiple SQL; select * from db_test.t1_u; --sorted_result select * from db_test.t1_d; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; - +--enable_cursor_protocol let $message= 3.5.8.4 - single SQL - insert; --source include/show_msg.inc @@ -201,7 +203,10 @@ let $message= 3.5.8.3/4 - single SQL - select; f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; +--enable_cursor_protocol #Cleanup connection default; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_09.inc b/mysql-test/suite/funcs_1/triggers/triggers_09.inc index 93762b363df..92ea70240fc 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_09.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_09.inc @@ -93,10 +93,13 @@ let $message= Testcase 3.5.9.3:; Update tb3 Set f136=8 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -112,10 +115,14 @@ let $message= Testcase 3.5.9.3:; delete from tb3 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg2_a; @@ -167,10 +174,13 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4%' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -188,10 +198,14 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg3_a; diff --git a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc index f025752b5b1..7b6538a3085 100644 --- a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc +++ b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc @@ -626,9 +626,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc index 473086f6e04..61116781a70 100644 --- a/mysql-test/suite/gcol/inc/gcol_keys.inc +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -776,9 +776,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test index 1edc9779d41..7ec4b3d4e35 100644 --- a/mysql-test/suite/gcol/t/gcol_bugfixes.test +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -674,9 +674,11 @@ DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -689,9 +691,11 @@ DROP TABLE t1; CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -711,9 +715,11 @@ CREATE TABLE t1 (id INT PRIMARY KEY, ts TIMESTAMP DEFAULT '1971-01-01 00:00:00', c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED); INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar'); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error 0,ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); INSERT IGNORE INTO t1 (id) VALUES (2); diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 9184902a7d0..4f38e1a62a4 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -258,10 +258,14 @@ disconnect truncate; connection default; DROP TABLE t1, t2; +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol --source include/wait_until_count_sessions.inc set debug_sync=reset; diff --git a/mysql-test/suite/handler/ps.test b/mysql-test/suite/handler/ps.test index 783d862435e..87f4cddf525 100644 --- a/mysql-test/suite/handler/ps.test +++ b/mysql-test/suite/handler/ps.test @@ -7,6 +7,10 @@ flush status; handler handler_a read first; # handler...read must be prepared in --ps-protocol mode --replace_result $PS_PROTOCOL OK +if($CURSOR_PROTOCOL) +{ + --replace_result $CURSOR_PROTOCOL OK +} --disable_ps_protocol show status like 'Com_stmt_prepare%'; --enable_ps_protocol diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test index e0451e121a6..9abc198843b 100644 --- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test +++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test @@ -4,7 +4,9 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +--disable_cursor_protocol select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol connect (ddl, localhost, root,,); update performance_schema.setup_instruments set enabled='yes'; update performance_schema.setup_consumers set enabled='yes'; @@ -26,7 +28,9 @@ send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE; connection default; SET DEBUG_SYNC = 'now WAIT_FOR go'; +--disable_cursor_protocol select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol SELECT @final_count - @init_count; diff --git a/mysql-test/suite/innodb/t/group_commit.test b/mysql-test/suite/innodb/t/group_commit.test index 692e06f38b8..24d7d1ee1fa 100644 --- a/mysql-test/suite/innodb/t/group_commit.test +++ b/mysql-test/suite/innodb/t/group_commit.test @@ -11,10 +11,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test index 85c0e295424..f7e1a5c0150 100644 --- a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test @@ -11,10 +11,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_none.test b/mysql-test/suite/innodb/t/innodb-page_compression_none.test index e4eaae8bcb2..3ca0e1afe32 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_none.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_none.test @@ -6,8 +6,9 @@ SET @save_compression_algorithm=@@GLOBAL.innodb_compression_algorithm; SET GLOBAL innodb_compression_algorithm=0; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @compress_errors FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error'; - +--enable_cursor_protocol CREATE TABLE t (c INT) page_compressed=1 page_compression_level=4 ENGINE=InnoDB; INSERT INTO t VALUES (1); diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test index ea620b398e5..e783deff4b7 100644 --- a/mysql-test/suite/innodb/t/innodb-system-table-view.test +++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test @@ -12,10 +12,12 @@ LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; # The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats may # vary depending on whether the tables have been rebuilt # by previously run tests. +--disable_cursor_protocol SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_table_stats'; SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_index_stats'; +--enable_cursor_protocol SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index baced6e9e11..1697c69d6e4 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -30,8 +30,10 @@ ENGINE=INNODB; SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`'; +--disable_cursor_protocol SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +--enable_cursor_protocol let SPACE=`SELECT @space`; diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test index c83e00db22a..8037b20e592 100644 --- a/mysql-test/suite/innodb/t/innodb_bug51920.test +++ b/mysql-test/suite/innodb/t/innodb_bug51920.test @@ -22,9 +22,11 @@ let $wait_condition = WHERE INFO="UPDATE bug51920 SET i=2"; -- source include/wait_condition.inc +--disable_cursor_protocol SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO="UPDATE bug51920 SET i=2" INTO @thread_id; +--enable_cursor_protocol KILL @thread_id; let $wait_condition = diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index d495186db25..50ab6e8c1a8 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -625,7 +625,9 @@ CREATE TABLE t2 (a INT, b INT, --echo # set up our data elements INSERT INTO t1 (d) VALUES (1); INSERT INTO t2 (a,b) VALUES (1,1); +--disable_cursor_protocol SELECT SECOND(c) INTO @bug47453 FROM t2; +--enable_cursor_protocol SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test index cfcd7c2128d..4f952f2b3b8 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test +++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test @@ -102,8 +102,10 @@ ANALYZE TABLE bug12429573; # innodb_index_stats have been updated to the same value. If the bug is # present this check will fail. +--disable_cursor_protocol SELECT last_update INTO @last FROM mysql.innodb_table_stats WHERE table_name = 'bug12429573'; +--enable_cursor_protocol SELECT * FROM mysql.innodb_index_stats WHERE table_name = 'bug12429573' AND last_update!=@last; diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 8e333e3bb72..bd0018f6173 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -807,18 +807,24 @@ SELECT * FROM t1; DROP TABLE t1; eval CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) $engine; +--disable_cursor_protocol SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol INSERT INTO t1 VALUES (-42, -123456); --enable_info ALTER TABLE t1 CHANGE t s SMALLINT; +--disable_cursor_protocol SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; ALTER TABLE t1 CHANGE m i INT; +--disable_cursor_protocol SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --disable_info SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; INSERT IGNORE INTO t1 VALUES (0, -123456); diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index c1b999dbc74..c5f16736656 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -129,9 +129,11 @@ INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3); ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT ''; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol UPDATE IGNORE t1 SET pk = 0; LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; HANDLER t1 OPEN AS h; diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 859d9325985..dba2c1e500b 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -93,8 +93,10 @@ let $wait_condition = FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; +--disable_cursor_protocol SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; +--enable_cursor_protocol --error ER_WRONG_VALUE_FOR_VAR EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); diff --git a/mysql-test/suite/innodb/t/temp_table_savepoint.test b/mysql-test/suite/innodb/t/temp_table_savepoint.test index fd1d06b48f7..185fb252e93 100644 --- a/mysql-test/suite/innodb/t/temp_table_savepoint.test +++ b/mysql-test/suite/innodb/t/temp_table_savepoint.test @@ -141,9 +141,11 @@ update ignore t5 set c1 = 20 where c1 = 140 ; select count(*) from t5 where c1 = 140; --replace_result $MYSQLTEST_VARDIR VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t5.outfile" from t5; --enable_ps2_protocol +--enable_cursor_protocol create temporary table temp_1 engine = innodb as select * from t5 where 1=2; diff --git a/mysql-test/suite/innodb_fts/t/opt.test b/mysql-test/suite/innodb_fts/t/opt.test index 19dfdcad8fd..efcc47af4a7 100644 --- a/mysql-test/suite/innodb_fts/t/opt.test +++ b/mysql-test/suite/innodb_fts/t/opt.test @@ -30,6 +30,7 @@ ANALYZE TABLE t1; SET STATEMENT use_stat_tables=never FOR ANALYZE TABLE wp; +--disable_cursor_protocol --disable_ps2_protocol # @@ -549,6 +550,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE wp, t1; --enable_ps2_protocol +--enable_cursor_protocol # Tests for FT hints. diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index 3a5103860e1..411cb10602b 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -408,7 +408,10 @@ select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))) --enable_metadata create table t1 (g GEOMETRY); select * from t1; +#Check after fix MDEV-31540 +--disable_cursor_protocol select ST_asbinary(g) from t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol drop table t1; diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index ea9de7edfff..fbf7c93840a 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -400,11 +400,14 @@ select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))) select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val; --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata create table t1 (g GEOMETRY); select * from t1; select ST_asbinary(g) from t1; --disable_metadata +--enable_cursor_protocol --enable_view_protocol drop table t1; @@ -1442,7 +1445,9 @@ SELECT ST_Union('', ''), md5(1); --echo # fields after MDEV-25459 --echo # CREATE TABLE t1(l LINESTRING NOT NULL, SPATIAL INDEX(l))ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(CONCAT(seq, ' ', seq) SEPARATOR ',') INTO @g FROM seq_0_to_190; +--enable_cursor_protocol INSERT INTO t1 SET l=ST_GeomFromText(CONCAT('LINESTRING(',@g,',0 0)')); SELECT COUNT(*) FROM t1 WHERE MBRIntersects(GeomFromText('Polygon((0 0,0 10,10 10,10 0,0 0))'), l); DROP TABLE t1; diff --git a/mysql-test/suite/json/t/json_no_table.test b/mysql-test/suite/json/t/json_no_table.test index d7b302c98a6..4e4c6c842c4 100644 --- a/mysql-test/suite/json/t/json_no_table.test +++ b/mysql-test/suite/json/t/json_no_table.test @@ -330,8 +330,11 @@ SELECT JSON_DEPTH( json_compact( '"abc"') ); --echo error ER_INVALID_TYPE_FOR_JSON SELECT JSON_DEPTH( 1 ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH( 'abc' ); +--enable_cursor_protocol # returns 1 SELECT JSON_DEPTH( json_compact( 1) ); @@ -372,11 +375,14 @@ SELECT JSON_DEPTH '[ "a", true, "b" , { "e" : false }, "c" , null ]' ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH ( '[ "a", true, "b" , { "e" : false }, "c" , null' ); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_REMOVE function. @@ -585,6 +591,8 @@ SELECT JSON_MERGE --echo error ER_INVALID_JSON_TEXT_IN_PARAM select json_type('abc'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol #select i, json_type(j) from t1; select json_type('{"a": 2}'); select json_type('[1,2]'); @@ -651,6 +659,7 @@ select json_type(json_compact(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0) select json_type(json_compact(null)); select json_type(json_compact(null)) is null; # check that it is an SQL NULL select json_type(null) is null; # is an SQL NULL +--enable_cursor_protocol # # same, but now show the printable value: @@ -882,7 +891,10 @@ select json_extract( '[1]', '$**[0]' ); # should have same result select json_extract( '{ "a": 1 }', '$.a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -890,7 +902,10 @@ select json_extract( '{ "a": 1 }', '$**.a' ); # should have same result select json_extract( '{ "a": 1 }', '$[0].a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have the same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -998,7 +1013,10 @@ select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc # NULLs select json_array_append(NULL, '$.b', json_compact(1)); select json_array_append('[1,2,3]', NULL, json_compact(1)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('[1,2,3]', '$', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1019,9 +1037,12 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6); --echo # Auto-wrapping, since because the paths identify scalars. --echo # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]} +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}', '$.b', json_compact(4), '$.c', json_compact('"grape"')); +--enable_cursor_protocol --echo # should return {"a": "foo", "b": [1, 2, 3, 4], --echo # "c": ["apple", "pear", "grape"]} @@ -1089,7 +1110,10 @@ select json_insert('[1,2,3]', '$[3]', 4); select json_insert('[1,2,3]', '$[10]', 4); select json_insert('{"c":4}', '$.c', 4); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"c":4}', '$.a', 4); +--enable_cursor_protocol select json_insert('1', '$', 4); select json_insert('1', '$[0]', 4); @@ -1297,9 +1321,12 @@ select json_set(NULL, NULL); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select json_set(NULL, NULL, NULL, NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # Detect errors in nested function calls. --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$')); +--enable_cursor_protocol # positive test cases @@ -1308,7 +1335,10 @@ select json_set('[1,2,3]', '$[3]', 4); select json_set('[1,2,3]', '$[10]', 4); select json_set('{"c":4}', '$.c', 5); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{"c":4}', '$.a', 5); +--enable_cursor_protocol select json_set('1', '$', 4); select json_set('1', '$[0]', 4); @@ -1355,10 +1385,13 @@ select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', json_compact('{}')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] } select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', json_compact('[true, false]')); +--enable_cursor_protocol # returns [ 1, null, null, 2 ] select json_set('1', '$[3]', 2); @@ -1376,6 +1409,8 @@ SELECT JSON_SET JSON_OBJECT() ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]} SELECT JSON_SET ( @@ -1391,6 +1426,7 @@ SELECT JSON_SET '$.c', JSON_ARRAY( json_compact( 'true'), json_compact( 'false') ) ); +--enable_cursor_protocol # returns [1, 2] SELECT JSON_SET @@ -1473,6 +1509,8 @@ select json_array('[1,2,3]', NULL, json_compact(1)); select json_array('[1,2,3]', '$[3]', NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive test cases select json_array(); select json_array(3.14); @@ -1483,6 +1521,7 @@ select json_array(b'0', b'1', b'10'); # returns the empty array: [] SELECT JSON_ARRAY(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_OBJECT function. @@ -1498,9 +1537,12 @@ select json_object( 'a', 1, 'b' ); --echo error ER_JSON_DOCUMENT_NULL_KEY select json_object( null, 1 ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive tests select json_object(); select json_object( 'a', null ); +--enable_cursor_protocol select json_object( 'a', 1 ); select json_object( 'a', 1, 'b', 'foo' ); select json_object( 'a', 1, 'b', 'foo', 'c', json_compact( '{ "d": "wibble" }') ); @@ -1517,8 +1559,11 @@ select json_object( cast(json_array() as char), json_array()); select json_object( 1, json_array()); select json_object( cast(1 as char), json_array()); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the empty object: {} SELECT JSON_OBJECT(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_SEARCH function. @@ -1710,17 +1755,23 @@ select json_type(case (null is null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type(case (null is not null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +--enable_cursor_protocol select json_type( if(null is null, json_compact('null'), json_compact('[1,2,3]')) ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type( if(null is not null, json_compact('null'), json_compact('[1,2,3]'))); +--enable_cursor_protocol select cast(json_extract(json_compact(concat('[', json_compact('["A",2]'), ']')), '$[0][1]') as char) = 2; @@ -1765,8 +1816,11 @@ select json_quote(convert('abc' using utf8mb4)); select json_unquote('abc'); # should do nothing select json_unquote('"abc"'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(convert('"abc"' using ascii)); select json_unquote(convert('"abc"' using latin1)); +--enable_cursor_protocol select json_unquote(convert('"abc"' using utf8)); select json_unquote(convert('"abc"' using utf8mb4)); @@ -1775,8 +1829,11 @@ select json_unquote('"'); # should do nothing --echo error ER_INCORRECT_TYPE select json_quote(123); # integer not allowed +# Enable after fix MDEV-31554 +--disable_cursor_protocol --echo error ER_INCORRECT_TYPE select json_unquote(123); # integer not allowed +--enable_cursor_protocol select json_unquote('""'); # empty string select char_length(json_unquote('""')); # verify empty string @@ -1810,21 +1867,30 @@ select json_unquote(json_unquote(json_unquote( # long round trip of it # DATE/TIME will lose their quotes, too: select json_compact(cast('2015-01-15 23:24:25' as datetime)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(cast('2015-01-15 23:24:25' as datetime))); +--enable_cursor_protocol # as well as opaque values: select json_compact(st_geomfromtext('point(1 1)')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(st_geomfromtext('point(1 1)'))); +--enable_cursor_protocol # examples from the wl7909 spec # returns the SQL string literal abc SELECT JSON_UNQUOTE( '"abc"' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the SQL string literal "abc SELECT JSON_UNQUOTE( '"abc' ); --echo error ER_INCORRECT_TYPE SELECT JSON_UNQUOTE( 123 ); +--enable_cursor_protocol # returns the SQL string literal abc SELECT JSON_UNQUOTE @@ -1966,7 +2032,10 @@ SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]'); select json_object("a", ifnull(json_quote('test'), json_compact('null'))); select json_compact(concat('[', json_quote('ab'), ']')); select json_compact(concat('[', json_unquote('"12"'), ']')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_compact(concat('["', json_type( json_compact(1)), '"]')); +--enable_cursor_protocol --echo # --echo # Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED @@ -2125,7 +2194,10 @@ select json_quote( json_type( json_compact('{}') ) ); --echo # WHEN EXECUTED IN A VIEW OR JOIN --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_TYPE(JSON_OBJECT()); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT()); SELECT * FROM v1; drop view v1; @@ -2158,8 +2230,11 @@ SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not --echo # FOR BOOL WHEN USED VIA VIEW --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT JSON_ARRAY('key1', false, 'key2', true); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT * FROM v1; CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true); @@ -2282,7 +2357,9 @@ SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100); # LEAST and GREATEST treat JSON arguments as strings for now. They used to hit # an assertion if used in a JSON context and all arguments were JSON values, or # a mix of NULLs and JSON values. +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL), GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j FROM (SELECT json_compact('1') AS j1, json_compact('2') AS j2) t; - +--enable_cursor_protocol diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre index fba909687a0..96e1afbb5a5 100644 --- a/mysql-test/suite/parts/inc/partition.pre +++ b/mysql-test/suite/parts/inc/partition.pre @@ -57,7 +57,9 @@ let $ER_NO_PARTITION_FOR_GIVEN_VALUE= 1526; # Set the variable $engine_other to a storage engine <> $engine --disable_query_log +--disable_cursor_protocol eval SELECT UPPER($engine) = 'MEMORY' INTO @aux; +--enable_cursor_protocol let $aux= `SELECT @aux`; if ($aux) { @@ -69,6 +71,7 @@ if (!$aux) } --enable_query_log +--disable_cursor_protocol # Numbers used for # - partitioning Example: ... PARTITION part1 VALUES LESS THAN ($max_row_div2) # - INSERT/SELECT/UPDATE/DELETE Example: ... WHERE f_int1 > @max_row_div3 @@ -102,6 +105,7 @@ WHERE f_int1 BETWEEN 2 * @max_row_div3 AND @max_row; # let $insert_all= INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +--enable_cursor_protocol # Column list with definition for all tables to be checked let $column_list= f_int1 INTEGER DEFAULT 0, diff --git a/mysql-test/suite/parts/inc/partition_alter3.inc b/mysql-test/suite/parts/inc/partition_alter3.inc index 395f93f44f6..feebcf4ffaa 100644 --- a/mysql-test/suite/parts/inc/partition_alter3.inc +++ b/mysql-test/suite/parts/inc/partition_alter3.inc @@ -28,8 +28,10 @@ SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR) FROM t0_template WHERE f_int1 + 999 BETWEEN 1000 AND 9999; # 3. Calculate the number of inserted records. +--disable_cursor_protocol SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1) INTO @exp_row_count; +--enable_cursor_protocol # DEBUG SELECT @exp_row_count; # 4. Print the layout, check Readability --source suite/parts/inc/partition_layout.inc diff --git a/mysql-test/suite/parts/inc/partition_check.inc b/mysql-test/suite/parts/inc/partition_check.inc index ed323dfa245..4dad6bff16f 100644 --- a/mysql-test/suite/parts/inc/partition_check.inc +++ b/mysql-test/suite/parts/inc/partition_check.inc @@ -64,6 +64,7 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol let $my_stmt= SELECT COUNT(*) <> 0 INTO @aux FROM t1 WHERE f_int1 <> f_int2 OR f_char1 <> CAST(f_int1 AS CHAR) OR f_char1 <> f_char2 OR f_charbig <> CONCAT('===',f_char1,'===') @@ -148,6 +149,7 @@ if ($run) --echo # Sorry, have to abort. exit; } +--enable_cursor_protocol # Give a success message like in the other following tests --echo # check MIN/MAX(f_int2) success: 1 @@ -368,17 +370,21 @@ AND (MIN(f_int1) = 1) AND (MAX(f_int1) = @max_row) AS "" FROM t1; if ($any_unique) { # Calculate the number of records, where we will try INSERT ..... or REPLACE + --disable_cursor_protocol SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol # # Calculate the number of records, where we will get DUPLICATE KEY # f_int1 is sufficient for calculating this, because 1.1 # checks, that f_int1 = f_int2 is valid for all rows. + --disable_cursor_protocol SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol if ($debug) { SELECT @try_count, @clash_count; @@ -390,7 +396,9 @@ if ($any_unique) # 4 Some operations with single records # 4.1 Insert one record with a value for f_int1 which is lower than in all # existing records. +--disable_cursor_protocol SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -408,7 +416,9 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # # 4.2 Insert one record with a value for f_int1 which is higher than in all # existing records. +--disable_cursor_protocol SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -428,8 +438,10 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # the highest value of all existing records. # If f_int1 is used for the partitioning expression a movement of the # record to another partition/subpartition might appear. +--disable_cursor_protocol SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +--enable_cursor_protocol UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # Check of preceding statement via Select @@ -447,7 +459,9 @@ WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # record to another partition/subpartition might appear. # f_int1 gets the delicate value '-1'. SET @cur_value1= -1; +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +--enable_cursor_protocol # Bug#15968: Partitions: crash when INSERT with f_int1 = -1 into PARTITION BY HASH(f_int1) UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; @@ -461,7 +475,9 @@ WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; --enable_query_log # # 4.5 Delete the record with the highest value of f_int1. +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value FROM t1; +--enable_cursor_protocol DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # Check of preceding statements via Select if ($no_debug) @@ -751,8 +767,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(f_int1) INTO @start_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @start_count <> 0`; if ($run) @@ -770,7 +788,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol --enable_query_log # 7.1 Successful INSERT + COMMIT INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -839,8 +859,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-6 success: ' AS "", @my_count IN (0,@exp_inserted_rows) AS ""; let $run= `SELECT @my_count = 0`; @@ -872,7 +894,9 @@ COMMIT WORK; # 7.3 Failing INSERT (in mid of statement processing) + COMMIT SET @@session.sql_mode = 'traditional'; # Number of records where a INSERT has to be tried +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol # --disable_abort_on_error INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -890,8 +914,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-8 success: ' AS "", @my_count IN (@max_row_div2 - 1 - @max_row_div4 + 1,0) AS ""; let $run= `SELECT @my_count = @max_row_div2 - 1 - @max_row_div4 + 1`; diff --git a/mysql-test/suite/parts/inc/partition_check_read.inc b/mysql-test/suite/parts/inc/partition_check_read.inc index e42bb9c90ab..280580d67a6 100644 --- a/mysql-test/suite/parts/inc/partition_check_read.inc +++ b/mysql-test/suite/parts/inc/partition_check_read.inc @@ -27,7 +27,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE $col_to_check = $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -46,7 +48,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = @max_row + $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -64,7 +68,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = 1 - $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read1.inc b/mysql-test/suite/parts/inc/partition_check_read1.inc index 0b8b800a371..cb6b839130a 100644 --- a/mysql-test/suite/parts/inc/partition_check_read1.inc +++ b/mysql-test/suite/parts/inc/partition_check_read1.inc @@ -26,7 +26,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = '1000-02-10'; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -43,7 +45,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @exp_row_count INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -63,8 +67,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = CONCAT(CAST(999 + $num AS CHAR),'-02-10'); + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read2.inc b/mysql-test/suite/parts/inc/partition_check_read2.inc index 60964355d14..36421dec115 100644 --- a/mysql-test/suite/parts/inc/partition_check_read2.inc +++ b/mysql-test/suite/parts/inc/partition_check_read2.inc @@ -22,7 +22,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -39,7 +41,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @max_row INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -59,8 +63,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 23e4a9e1e95..6e98eb16223 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -58,11 +58,13 @@ eval INSERT INTO t0_definition SET state = 'new', file_list = @aux; # Print the old and new table layout, if they differ +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t0_definition tab1, t0_definition tab2 WHERE tab1.state = 'old' AND tab2.state = 'new' AND tab1.create_command = tab2.create_command AND tab1.file_list = tab2.file_list; +--enable_cursor_protocol let $run= `SELECT @aux`; if ($run) { diff --git a/mysql-test/suite/parts/inc/partition_trigg1.inc b/mysql-test/suite/parts/inc/partition_trigg1.inc index 7bb5aa162a9..c0d6ba4e867 100644 --- a/mysql-test/suite/parts/inc/partition_trigg1.inc +++ b/mysql-test/suite/parts/inc/partition_trigg1.inc @@ -24,7 +24,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','DELETE') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) @@ -72,7 +74,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','INSERT') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) diff --git a/mysql-test/suite/parts/inc/partition_trigg3.inc b/mysql-test/suite/parts/inc/partition_trigg3.inc index 34dbf4e2cd1..4d461a8a755 100644 --- a/mysql-test/suite/parts/inc/partition_trigg3.inc +++ b/mysql-test/suite/parts/inc/partition_trigg3.inc @@ -46,7 +46,9 @@ delimiter ;| # Additional statements because of Bug(limitation)#17704 SET @counter = 1; # Bug#18730 Partitions: crash on SELECT MIN() +--disable_cursor_protocol SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +--enable_cursor_protocol # Additional statements end eval $statement; DROP TRIGGER trg_3; diff --git a/mysql-test/suite/perfschema/t/alter_table_progress.test b/mysql-test/suite/perfschema/t/alter_table_progress.test index d0a4055ad0e..d132ed53fa5 100644 --- a/mysql-test/suite/perfschema/t/alter_table_progress.test +++ b/mysql-test/suite/perfschema/t/alter_table_progress.test @@ -34,9 +34,11 @@ update performance_schema.threads truncate table performance_schema.events_statements_history_long; truncate table performance_schema.events_stages_history_long; +--disable_cursor_protocol --disable_query_log eval select $con1_THREAD_ID into @con1_thread_id; --enable_query_log +--enable_cursor_protocol --connection con1 @@ -52,8 +54,10 @@ SET DEBUG_SYNC='copy_data_between_tables_before SIGNAL found_row WAIT_FOR wait_r SET DEBUG_SYNC='now WAIT_FOR found_row'; # Find the statement id of the ALTER TABLE +--disable_cursor_protocol select event_id from performance_schema.events_statements_current where thread_id = @con1_thread_id into @con1_stmt_id; +--enable_cursor_protocol # completed 0 select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED diff --git a/mysql-test/suite/perfschema/t/dml_handler.test b/mysql-test/suite/perfschema/t/dml_handler.test index 16810fcba82..791d2274598 100644 --- a/mysql-test/suite/perfschema/t/dml_handler.test +++ b/mysql-test/suite/perfschema/t/dml_handler.test @@ -21,7 +21,9 @@ CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS WHERE TABLE_SCHEMA='performance_schema' ORDER BY TABLE_NAME; +--disable_cursor_protocol SELECT COUNT(*) FROM table_list INTO @table_count; +--enable_cursor_protocol let $count=`SELECT @table_count`; @@ -32,7 +34,9 @@ let $count=`SELECT @table_count`; while ($count > 0) { + --disable_cursor_protocol eval SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=$count; + --enable_cursor_protocol let $table_name = `SELECT @table_name`; --error ER_ILLEGAL_HA eval HANDLER performance_schema.$table_name OPEN; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test index d304cc5a1b8..58077973248 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index 6420b8b5300..ab3fd73ab45 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -17,8 +17,10 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connections into @saved_max_connections; select @@global.max_user_connections into @saved_max_user_connections; +--enable_cursor_protocol create user 'quota'@'santa.claus.ipv4.example.com'; grant select on test.* to 'quota'@'santa.claus.ipv4.example.com'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test index 6da99e02444..9d845b5e296 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index 045c4628e9e..43c408a075f 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -23,13 +23,17 @@ reset query cache; flush status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; show global status like "Qcache_hits"; +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; diff --git a/mysql-test/suite/perfschema/t/rpl_threads.test b/mysql-test/suite/perfschema/t/rpl_threads.test index 984939c21f8..f8438649cf0 100644 --- a/mysql-test/suite/perfschema/t/rpl_threads.test +++ b/mysql-test/suite/perfschema/t/rpl_threads.test @@ -29,9 +29,11 @@ connection master; # Read the ID of the binlog dump connection, # as exposed in PROCESSLIST. +--disable_cursor_protocol select ID from INFORMATION_SCHEMA.PROCESSLIST where COMMAND = "Binlog Dump" into @master_dump_pid; +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -47,9 +49,11 @@ sync_slave_with_master; # Read the ID of the SLAVE IO thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Waiting for master to send event%" into @slave_io_pid; +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -62,9 +66,11 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE # Read the ID of the SLAVE SQL thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Slave has read all relay log%" into @slave_sql_pid; +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST diff --git a/mysql-test/suite/perfschema/t/socket_connect.test b/mysql-test/suite/perfschema/t/socket_connect.test index 4ae9608cd0e..6b84ada964a 100644 --- a/mysql-test/suite/perfschema/t/socket_connect.test +++ b/mysql-test/suite/perfschema/t/socket_connect.test @@ -16,6 +16,7 @@ let $my_socket_debug_dbug=0; --echo #============================================================================== --source ../include/socket_ipv6.inc +--disable_cursor_protocol --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== @@ -291,3 +292,4 @@ WHERE EVENT_NAME LIKE '%client_connection%' AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin; --source include/wait_condition.inc exit; +--enable_cursor_protocol diff --git a/mysql-test/suite/perfschema/t/socket_instances_func.test b/mysql-test/suite/perfschema/t/socket_instances_func.test index 4cf58d42185..1541a402289 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func.test @@ -47,9 +47,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -67,14 +69,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -95,14 +101,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port= `SELECT @port`; @@ -123,14 +133,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 3 (unix domain) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 3 (unix domain) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con3_port= `SELECT @port`; let $con3_thread_id= `SELECT @thread_id`; @@ -232,9 +246,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; @@ -265,9 +281,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; # Store the thread id of 'server_unix_socket' --echo # Get the 'server_unix_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; +--enable_cursor_protocol let $server_unix_thread_id= `SELECT @thread_id`; @@ -301,7 +319,9 @@ WHERE THREAD_ID = @thread_id; --echo #Compare server listener socket thread ids --disable_query_log ONCE +--disable_cursor_protocol eval SELECT ($server_tcpip_thread_id = $server_unix_thread_id) into @match_thread_id; +--disable_cursor_protocol select @match_thread_id; diff --git a/mysql-test/suite/perfschema/t/socket_instances_func_win.test b/mysql-test/suite/perfschema/t/socket_instances_func_win.test index 5faf0d24ec4..24774a51fa2 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func_win.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func_win.test @@ -47,9 +47,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -70,14 +72,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -102,14 +108,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port = `SELECT @port`; @@ -216,9 +226,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test index 4a6ee2b6277..aebe64e3f59 100644 --- a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test +++ b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test @@ -41,8 +41,10 @@ let $my_socket_debug_dbug= 0; --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== +--disable_cursor_protocol SELECT @@hostname INTO @MY_HOSTNAME; SELECT @@port INTO @MY_MASTER_PORT; +--enable_cursor_protocol if ($my_socket_debug) { @@ -145,7 +147,7 @@ WHERE t_inst.event_name LIKE '%client%' --connection default UPDATE performance_schema.threads SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID(); - +--disable_cursor_protocol --echo # --echo # 1.2 Get the default THREAD_ID; --echo # @@ -161,6 +163,7 @@ let $default_object_instance_begin= `SELECT @my_object_instance_begin`; --disable_query_log SELECT @my_object_instance_begin INTO @default_object_instance_begin; --enable_query_log +--enable_cursor_protocol if ($my_socket_debug) { diff --git a/mysql-test/suite/perfschema/t/table_schema.test b/mysql-test/suite/perfschema/t/table_schema.test index 935bd667f2d..6abbd403837 100644 --- a/mysql-test/suite/perfschema/t/table_schema.test +++ b/mysql-test/suite/perfschema/t/table_schema.test @@ -16,9 +16,11 @@ select * from information_schema.columns where table_schema="performance_schema" # Count the number of NUMBER_OF_BYTES columns. +--disable_cursor_protocol select count(*) into @count_byte_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%number_of_bytes"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -26,10 +28,12 @@ select @count_byte_columns > 0; # Confirm that all NUMBER_OF_BYTES columns are BIGINT signed. +--disable_cursor_protocol select count(*) into @count_byte_signed from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%number_of_bytes" and column_type not like "%unsigned"; +--enable_cursor_protocol select (@count_byte_columns - @count_byte_signed) = 0; @@ -38,9 +42,11 @@ select (@count_byte_columns - @count_byte_signed) = 0; # # Count the number of OBJECT_INSTANCE_BEGIN columns. +--disable_cursor_protocol select count(*) into @count_object_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%object_instance_begin"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -48,10 +54,12 @@ select @count_object_columns > 0; # Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned. +--disable_cursor_protocol select count(*) into @count_object_unsigned from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%object_instance_begin" and column_type like "%unsigned"; +--enable_cursor_protocol select (@count_object_columns - @count_object_unsigned) = 0; diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test index 92309bb9ca1..1bd52afbd01 100644 --- a/mysql-test/suite/perfschema/t/thread_cache.test +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -36,8 +36,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # Expect 1, connection_id() is incremented for each new connection @@ -82,8 +84,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -110,8 +114,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -154,8 +160,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # When caching threads, the pthread that executed con2 was parked in the diff --git a/mysql-test/suite/perfschema/t/threads_mysql.test b/mysql-test/suite/perfschema/t/threads_mysql.test index e19b3664f21..cf0a1386b5f 100644 --- a/mysql-test/suite/perfschema/t/threads_mysql.test +++ b/mysql-test/suite/perfschema/t/threads_mysql.test @@ -64,7 +64,9 @@ TRUNCATE t1; INSERT INTO t1 SELECT thread_id FROM performance_schema.threads WHERE name LIKE 'thread/sql%'; +--disable_cursor_protocol SELECT COUNT(*) INTO @aux FROM t1; +--enable_cursor_protocol # Attention: # Just waiting for some new thread showing up is not sufficient because diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test index b762743be24..aca1a9150de 100644 --- a/mysql-test/suite/period/t/overlaps.test +++ b/mysql-test/suite/period/t/overlaps.test @@ -253,18 +253,22 @@ insert into t values (1, '2020-03-03', '2020-03-10') on duplicate key update x = 2; select * from t; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'tmp_t.txt' into table t; --error ER_NOT_SUPPORTED_YET load data infile 'tmp_t.txt' replace into table t; remove_file $MYSQLD_DATADIR/test/tmp_t.txt; insert into t values (1, '2020-03-01', '2020-03-05'); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY load data infile 'tmp_t.txt' into table t; diff --git a/mysql-test/suite/period/t/versioning.test b/mysql-test/suite/period/t/versioning.test index 5d38d81349e..45ca12469df 100644 --- a/mysql-test/suite/period/t/versioning.test +++ b/mysql-test/suite/period/t/versioning.test @@ -12,7 +12,9 @@ eval create table t ( insert into t values('1999-01-01', '2018-12-12'), ('1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -28,7 +30,9 @@ insert into t values('1999-01-01', '2018-12-12'), --let $trig_table=t --source suite/period/create_triggers.inc +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -47,7 +51,9 @@ eval create or replace table t (x int, s date, e date, insert into t values(1, '1999-01-01', '2018-12-12'), (2, '1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol --sorted_result select * from t; diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test index f67397afdfe..cb154cae7ad 100644 --- a/mysql-test/suite/plugins/t/feedback_plugin_load.test +++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test @@ -18,7 +18,9 @@ select plugin_status from information_schema.plugins where plugin_name='feedback # so lets get back to it if it ever happens. # Lets say the plugin was used X times before this SELECT +--disable_cursor_protocol SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used'; +--enable_cursor_protocol # Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used'; diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test index de3e9d59b01..5345bac12ff 100644 --- a/mysql-test/suite/plugins/t/qc_info.test +++ b/mysql-test/suite/plugins/t/qc_info.test @@ -4,10 +4,12 @@ set @save_query_cache_size=@@global.query_cache_size; # test that hits are correctly incremented reset query cache; +--disable_cursor_protocol --disable_ps2_protocol select * from t1; select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select hits, statement_text from information_schema.query_cache_info; drop table t1; diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc index c69ffa07ca8..8c2d4b6e227 100644 --- a/mysql-test/suite/plugins/t/qc_info_init.inc +++ b/mysql-test/suite/plugins/t/qc_info_init.inc @@ -9,11 +9,14 @@ set global query_cache_size=1355776; create table t1 (a int not null); insert into t1 values (1),(2),(3); +--disable_cursor_protocol --disable_ps2_protocol select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +--disable_cursor_protocol select @@time_zone into @time_zone; select @@default_week_format into @default_week_format; select @@character_set_client into @character_set_client; @@ -32,6 +35,7 @@ select * from t1; --enable_ps2_protocol --enable_result_log set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; +--enable_cursor_protocol --sorted_result --replace_column 5 # 20 # 24 # diff --git a/mysql-test/suite/roles/grant_revoke_current.test b/mysql-test/suite/roles/grant_revoke_current.test index fda55358b20..1c7bb0402df 100644 --- a/mysql-test/suite/roles/grant_revoke_current.test +++ b/mysql-test/suite/roles/grant_revoke_current.test @@ -1,5 +1,8 @@ --source include/not_embedded.inc + +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol --error ER_MALFORMED_DEFINER grant select on *.* to current_role; diff --git a/mysql-test/suite/roles/set_default_role_ps-6960.test b/mysql-test/suite/roles/set_default_role_ps-6960.test index fd965c2aa75..ce7bb96b5bb 100644 --- a/mysql-test/suite/roles/set_default_role_ps-6960.test +++ b/mysql-test/suite/roles/set_default_role_ps-6960.test @@ -4,7 +4,9 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol create role r1; prepare stmt from "set password = '11111111111111111111111111111111111111111'"; diff --git a/mysql-test/suite/rpl/include/check_type.inc b/mysql-test/suite/rpl/include/check_type.inc index c72754cad4f..26276391a63 100644 --- a/mysql-test/suite/rpl/include/check_type.inc +++ b/mysql-test/suite/rpl/include/check_type.inc @@ -43,7 +43,9 @@ connection master; eval INSERT INTO t1 VALUES(1, $source_value); if ($can_convert) { sync_slave_with_master; + --disable_cursor_protocol eval SELECT a = $target_value into @compare FROM t1; + --enable_cursor_protocol eval INSERT INTO type_conversions SET Source = "$source_type", Target = "$target_type", diff --git a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc index cb51058f0ae..9e4d468bb16 100644 --- a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc +++ b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc @@ -5,6 +5,7 @@ # Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created ######################################### +--disable_cursor_protocol --connection master select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; @@ -46,3 +47,4 @@ select variable_value into @system_rows_inserted from information_schema.global_ select @system_rows_inserted - @slave_system_rows_inserted; --connection master +--enable_cursor_protocol diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test index 6bc872cabe5..0a436b28b20 100644 --- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test +++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test @@ -37,9 +37,11 @@ source include/wait_for_slave_sql_to_stop.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read = $exec into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as one from ti; @@ -91,9 +93,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as zero from ti; @@ -130,9 +134,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select max(a) as two from tm; select max(a) as one from ti; diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test index a5988efcb21..1c80f4f4b53 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -58,9 +58,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' --enable_ps2_protocol +--enable_cursor_protocol ### ACTION: create a small file (< 4096 bytes) that will be later used ### in LOAD DATA INFILE to check for absence of binlog errors @@ -69,9 +71,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' --enable_ps2_protocol +--enable_cursor_protocol RESET MASTER; diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test index e04f618b81e..63c40ac05da 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -119,7 +119,9 @@ let $1=100; begin; while ($1) { + --disable_cursor_protocol eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + --enable_cursor_protocol set @data = repeat('a', @act_size); insert into t2 set data = @data; dec $1; @@ -162,7 +164,9 @@ let $1= 300; begin; while ($1) { + --disable_cursor_protocol eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + --enable_cursor_protocol insert into t3 set data= repeat('a', @act_size); dec $1; } diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 1350585ff93..2b757f57692 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -343,7 +343,9 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; --connection master DROP USER user_bug27606@localhost; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1'; +--enable_cursor_protocol update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 68d2ec46e4e..31da31f1c91 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -10,9 +10,11 @@ drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); insert into mysqltest1.t1 values (1); +--disable_cursor_protocol --disable_ps2_protocol select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; --enable_ps2_protocol +--enable_cursor_protocol create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); --replace_result \\ / 66 39 93 39 17 39 247 39 41 39 "File exists" "Directory not empty" diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index ee6daac71ea..1b93ddc3f0a 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -229,15 +229,19 @@ SET INSERT_ID=2; SET @c=2; SET @@rand_seed1=10000000, @@rand_seed2=1000000; INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored +--disable_cursor_protocol SELECT b into @b FROM test.t5; +--enable_cursor_protocol --let $b_master=`select @b` UPDATE test.t1 SET a=2; # to run trigger on slave --sync_slave_with_master # The proof: +--disable_cursor_protocol SELECT a AS 'ONE' into @a FROM test.t_slave; SELECT c AS 'NULL' into @c FROM test.t_slave; +--enable_cursor_protocol let $count= 1; let $table= test.t_slave; @@ -249,7 +253,9 @@ if (`SELECT @a != 2 and @c != NULL`) --die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context. } +--disable_cursor_protocol SELECT b into @b FROM test.t_slave; +--enable_cursor_protocol --let $b_slave=`select @b` --let $assert_text= Random values from master and slave must be different diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test index 5c17653da8a..cc32220f5d7 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test @@ -67,8 +67,10 @@ EOF # Since we injected error in the cleanup code, the rows should remain in # mysql.gtid_slave_pos. Check that we have at least 20 (more robust against # non-deterministic cleanup and future changes than checking for exact number). +--disable_cursor_protocol SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no FROM mysql.gtid_slave_pos; +--disable_cursor_protocol SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count)); SET GLOBAL debug_dbug= @old_dbug; diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test index 1e4f40a0019..c63db427f7f 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test @@ -7,6 +7,7 @@ # # created all the base variables at the beginning at the test +--disable_cursor_protocol --connection master select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; @@ -26,6 +27,7 @@ select variable_value into @slave_system_rows_read from information_schema.globa select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +--enable_cursor_protocol --connection master CREATE DATABASE testdb; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_local.test b/mysql-test/suite/rpl/t/rpl_loaddata_local.test index 01f5607ba0b..975bd110739 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_local.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_local.test @@ -27,9 +27,11 @@ set SQL_LOG_BIN=1; enable_query_log; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol #This will generate a 20KB file, now test LOAD DATA LOCAL truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -52,9 +54,11 @@ connection master; create table t1(a int); insert into t1 values (1), (2), (2), (3); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; create table t1(a int primary key); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -83,9 +87,11 @@ SET sql_mode='ignore_space'; CREATE TABLE t1(a int); insert into t1 values (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; @@ -109,7 +115,9 @@ sync_slave_with_master; connection master; let $MYSQLD_DATADIR= `select @@datadir`; +--disable_cursor_protocol SELECT @@SESSION.sql_mode INTO @old_mode; +--enable_cursor_protocol SET sql_mode='ignore_space'; @@ -117,9 +125,11 @@ CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -167,9 +177,11 @@ sync_slave_with_master; connection master; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -214,9 +226,11 @@ CREATE VIEW v1 AS SELECT * FROM t2 WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 0df424aa1ac..24477fa0230 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -37,9 +37,11 @@ while($rows) eval insert into t1 values (null); dec $rows; } +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; SET @@sql_log_bin= 1; diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index a49b3c30b87..edb72dc9925 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -69,9 +69,11 @@ connection master; let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT repeat('x',20) INTO OUTFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol disable_warnings; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test index fc3457252e1..0154cee3e81 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev12179.test +++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test @@ -277,7 +277,9 @@ EOF --connection server_2 --enable_reconnect --source include/wait_until_connected_again.inc +--disable_cursor_protocol SELECT max(seq_no) FROM mysql.gtid_slave_pos_InnoDB into @seq_no; +--enable_cursor_protocol --connection server_1 INSERT INTO t2(a) SELECT 1+MAX(a) FROM t2; diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index 7211acd508c..714488a3c3c 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -26,9 +26,11 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?')); --disable_warnings insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); --enable_warnings +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'rpl_misc_functions.outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol let $MYSQLD_DATADIR= `select @@datadir`; sync_slave_with_master; create temporary table t2 like t1; @@ -92,9 +94,11 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --sync_slave_with_master # Dump table on slave +--disable_cursor_protocol --disable_ps2_protocol select * from t1 into outfile "../../tmp/t1_slave.txt"; --enable_ps2_protocol +--enable_cursor_protocol # Load data from slave into temp table on master connection master; @@ -106,8 +110,10 @@ load data infile '../../tmp/t1_slave.txt' into table t1_slave; # Compare master and slave temp table, use subtraction # for floating point comparison of "double" +--disable_cursor_protocol select count(*) into @aux from t1 join t1_slave using (id) where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +--enable_cursor_protocol SELECT @aux; if (`SELECT @aux <> 12 OR @aux IS NULL`) { diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test index cc361a7b35b..9522a976b89 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_seq.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -147,7 +147,9 @@ if (`select $iter = 1`) --connection master CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; # select may return non-deterministically, don't print its result +--disable_cursor_protocol SELECT NEXT VALUE FOR s3 into @tmpvar; +--enable_cursor_protocol --source include/save_master_gtid.inc --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test index c1b7e02319b..5ca2f4edb8f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test @@ -35,18 +35,22 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 1, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,1,@a); SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 2, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,2,@a); SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test; @@ -82,9 +86,11 @@ END $$ --delimiter ; SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @found_rows; --enable_ps2_protocol +--enable_cursor_protocol CALL just_log(2,3,@found_rows); SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test; @@ -105,7 +111,9 @@ END $$ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; --disable_ps2_protocol +--disable_cursor_protocol SELECT FOUND_ROWS() INTO @found_rows; +--enable_cursor_protocol SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows); --enable_ps2_protocol diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 729f275bb0d..a2b21982a36 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -342,7 +342,9 @@ GRANT PROCESS ON *.* TO user43748@127.0.0.1; connect (cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,); connection cont43748; +--disable_cursor_protocol SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; +--enable_cursor_protocol --error ER_KILL_DENIED_ERROR,ER_NO_SUCH_THREAD KILL @id; diff --git a/mysql-test/suite/rpl/t/rpl_xa.inc b/mysql-test/suite/rpl/t/rpl_xa.inc index d22d2d2ef3d..5925de24f44 100644 --- a/mysql-test/suite/rpl/t/rpl_xa.inc +++ b/mysql-test/suite/rpl/t/rpl_xa.inc @@ -94,7 +94,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc + --enable_cursor_protocol --let $complete=`select if(floor(rand()*10)%2,'COMMIT','ROLLBACK')` --error 0 --disable_query_log @@ -117,8 +119,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc - + --enable_cursor_protocol --disconnect master_$xid --source include/wait_until_disconnected.inc diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test index 8c5f8fa7bf0..c33eb057cc6 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test @@ -11,8 +11,10 @@ SELECT @@global.innodb_buffer_pool_dump_now; -- error 0,1 -- remove_file $file +--disable_cursor_protocol SELECT variable_value INTO @old_dump_status FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +--enable_cursor_protocol # A previous test could have run buffer pool dump already; # in this case we want to make sure that the current time is different diff --git a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test index 23d9fcdddb2..e5b37d1bc63 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test @@ -23,8 +23,10 @@ set innodb_fil_make_page_dirty_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_log_optimize_ddl_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_optimize_ddl_basic.test index b8983093414..36490e55bcb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_log_optimize_ddl_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_optimize_ddl_basic.test @@ -21,7 +21,9 @@ SELECT COUNT(@@GLOBAL.innodb_log_optimize_ddl); SELECT COUNT(@@SESSION.innodb_log_optimize_ddl); --echo Expected error 'Variable is a GLOBAL variable' +--disable_cursor_protocol SELECT @@GLOBAL.innodb_log_optimize_ddl INTO @innodb_log_optimize_ddl_save; +--enable_cursor_protocol #### Check if the value can be set SET @@GLOBAL.innodb_log_optimize_ddl = ON; SET @@GLOBAL.innodb_log_optimize_ddl = OFF; diff --git a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test index aa36010d810..ca8be38ddad 100644 --- a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test @@ -23,8 +23,10 @@ set innodb_saved_page_number_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test index db9bc8fb48f..1be82f5380e 100644 --- a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test +++ b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test @@ -43,7 +43,9 @@ SELECT @@log_slow_disabled_statements; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -53,7 +55,9 @@ SET SESSION log_slow_disabled_statements="call,admin"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra2 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -63,7 +67,9 @@ SET SESSION log_slow_disabled_statements=""; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra3 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -73,7 +79,9 @@ SET SESSION log_slow_disabled_statements="call,admin,slave,sp"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra4 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part5'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test index e0105c89866..27b19934162 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test @@ -76,6 +76,8 @@ SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_size = 131072; SET GLOBAL query_cache_type = ON; +--disable_cursor_protocol + --echo '#---------------------FN_DYNVARS_132_01----------------------#' # #Check if results are cacheing on default value # @@ -168,6 +170,8 @@ SHOW STATUS LIKE 'Qcache_not_cached'; SHOW STATUS LIKE 'Qcache_queries_in_cache'; --echo 1 Expected +--enable_cursor_protocol + # # Cleanup # diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test index e1b5f4d1a12..e31c949fef0 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_type_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test @@ -62,6 +62,8 @@ SET @@GLOBAL.query_cache_size = 65536; --echo ** TESTING SESSION SCOPE ** +--disable_cursor_protocol + --echo '#--------------------FN_DYNVARS_135_01-------------------------#' # # Testing default value it should be ON by default @@ -284,6 +286,8 @@ connection con3; SELECT @@query_cache_type; --echo ON Expected +--enable_cursor_protocol + --echo --echo ** Cleanup ** --echo diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test index 74c07d160f1..e7f7043a0eb 100644 --- a/mysql-test/suite/sys_vars/t/secure_file_priv.test +++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test @@ -17,6 +17,7 @@ SHOW VARIABLES LIKE 'secure_file_priv'; # If we run tests with --mem, it will be /dev/shm. # If we run tests with --parallel, it will be mysql-test/var # (because MYSQLTEST_VARDIR in this case is mysql-test/var/N). +--disable_cursor_protocol --perl use File::Basename; @@ -39,6 +40,8 @@ EOF --remove_file $MYSQL_TMP_DIR/bug50373.inc --enable_query_log +--enable_cursor_protocol + DROP TABLE t1; --perl diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test index 77f947c9913..d398f711ad5 100644 --- a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test @@ -51,18 +51,22 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 0. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 1. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; @@ -81,7 +85,9 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 2. +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; diff --git a/mysql-test/suite/vcol/t/load_data.test b/mysql-test/suite/vcol/t/load_data.test index 1b662818cd2..be247d106b9 100644 --- a/mysql-test/suite/vcol/t/load_data.test +++ b/mysql-test/suite/vcol/t/load_data.test @@ -5,9 +5,11 @@ create table t1 ( c1 varchar(10), c2 varchar(10), c3 int ); insert into t1 values ("a" , "b", 1), ("a" , "b", 2); create table t2 like t1 ; alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.csv' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.csv' ignore into table t2 ; select * from t2; insert into t2 (c1,c2,c3) values ("a" , "b", 4); diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test index bc8fcbd29c0..e9207d3bcdd 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test +++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test @@ -281,9 +281,11 @@ drop table t1; CREATE TABLE t1 (i INT, d1 DATE, d2 DATE NOT NULL, t TIMESTAMP, KEY(t)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'2023-03-16','2023-03-15','2012-12-12 12:12:12'); ALTER TABLE t1 MODIFY t FLOAT AS (i) PERSISTENT; +--disable_cursor_protocol --disable_ps2_protocol SELECT i, d1, d2 INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2); SELECT * FROM t1 WHERE d2 < d1; diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index f18f2d298f6..b09fc36319f 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -6,7 +6,9 @@ source include/have_innodb.inc; --disable_query_log set @@session.time_zone='+00:00'; +--disable_cursor_protocol select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; +--enable_cursor_protocol set @test_start=now(6); delimiter ~~; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 736cccb9cfb..4b484eb47a2 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -139,7 +139,9 @@ select * from t; update t set a=3 where a=1; select * from t; select * from t for system_time all; +--disable_cursor_protocol select row_start from t where a=3 into @tm; +--enable_cursor_protocol alter table t add column b int; select @tm=row_start from t where a=3; show create table t; diff --git a/mysql-test/suite/versioning/t/commit_id.test b/mysql-test/suite/versioning/t/commit_id.test index 0f9cf1eb391..646672bae76 100644 --- a/mysql-test/suite/versioning/t/commit_id.test +++ b/mysql-test/suite/versioning/t/commit_id.test @@ -17,19 +17,25 @@ insert into t1 values (); --real_sleep 0.01 set @ts0= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx0; +--enable_cursor_protocol select transaction_id = @tx0 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts1= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx1; +--enable_cursor_protocol select transaction_id = @tx1 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts2= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx2; +--enable_cursor_protocol select transaction_id = @tx2 from mysql.transaction_registry order by transaction_id desc limit 1; @@ -69,22 +75,30 @@ select trt_trx_sees(0, @tx2); set transaction isolation level read uncommitted; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx3; +--enable_cursor_protocol select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3; set transaction isolation level read committed; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx4; +--enable_cursor_protocol select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4; set transaction isolation level serializable; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx5; +--enable_cursor_protocol select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5; set transaction isolation level repeatable read; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx6; +--enable_cursor_protocol select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6; diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index f50d75ded9e..1506ffaa378 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -212,9 +212,11 @@ show create table t3; --echo ## For versioned table insert into t1 values (1); +--disable_cursor_protocol select row_start from t1 into @row_start; insert into t0 (y) values (2); select st from t0 into @st; +--enable_cursor_protocol create or replace table t2 with system versioning as select * from t1; --replace_result $default_engine DEFAULT_ENGINE @@ -253,10 +255,12 @@ create or replace table t3 with system versioning select x23, row_start from t1; create or replace table t3 with system versioning select x23, row_end from t1; --echo # Prepare checking for historical row +--disable_cursor_protocol delete from t1; select row_end from t1 for system_time all into @row_end; delete from t0; select en from t0 for system_time all into @en; +--enable_cursor_protocol --echo ## Combinations of versioned + non-versioned create or replace table t2 (y int); @@ -272,9 +276,13 @@ insert into t2 (y) values (1), (2); delete from t2 where y = 2; create or replace table t3 select * from t2 for system_time all; +--disable_cursor_protocol select st, en from t3 where y = 1 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; +--disable_cursor_protocol select st, en from t3 where y = 2 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; --echo ## Default engine detection diff --git a/mysql-test/suite/versioning/t/cte.test b/mysql-test/suite/versioning/t/cte.test index 5a8fb1f8211..7d4e10ead9d 100644 --- a/mysql-test/suite/versioning/t/cte.test +++ b/mysql-test/suite/versioning/t/cte.test @@ -31,7 +31,9 @@ insert into emp (emp_id, name, salary, dept_id, mgr) values (20, "john", 500, 10, 1), (30, "jane", 750, 10,1 ); +--disable_cursor_protocol select row_start into @ts_1 from emp where name="jane"; +--enable_cursor_protocol update emp set mgr=30 where name ="john"; @@ -42,7 +44,9 @@ with ancestors as ( select e.emp_id, e.name, e.mgr, e.salary from emp as e ) select * from ancestors for system_time as of @ts_1; +--disable_cursor_protocol select row_start into @ts_2 from emp where name="john"; +--enable_cursor_protocol let $q= /* All report to 'Bill' */ diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index 9debdcfec8c..ded6f46762b 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -42,7 +42,9 @@ eval create or replace table t1( with system versioning; insert into t1(x) values (1); +--disable_cursor_protocol select sys_start into @sys_start from t1; +--disable_cursor_protocol delete from t1; select * from t1; select x = 1 as A, sys_start = @sys_start as B, sys_end > sys_start as C from t1 for system_time all; diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index 9489d90c55a..599a6a81298 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -314,7 +314,9 @@ create or replace table subchild ( ) engine=innodb; insert into parent (value) values (23); +--disable_cursor_protocol select id, value from parent into @id, @value; +--enable_cursor_protocol insert into child values (default, @id, @value); insert into subchild values (default, @id, @value); @@ -396,21 +398,27 @@ INSERT INTO t2 VALUES (1,'against'),(2,'q'); SET SQL_MODE= ''; SET timestamp = 2; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 3; UPDATE t1 SET f13 = 'q'; SET timestamp = 4; LOAD DATA INFILE 't1.data' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data.2' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 5; LOAD DATA INFILE 't1.data.2' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't2.data' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 6; LOAD DATA INFILE 't2.data' REPLACE INTO TABLE t2; SET FOREIGN_KEY_CHECKS = OFF; @@ -553,9 +561,11 @@ delete from t0; --error ER_ROW_IS_REFERENCED_2 replace t0 values (1); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load_t0' from t0 ; --enable_ps2_protocol +--enable_cursor_protocol --error ER_ROW_IS_REFERENCED_2 load data infile 'load_t0' replace into table t0; diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index 0324df64d0c..5e3d85423a7 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -52,7 +52,9 @@ drop view vt1_1; replace_result $sys_datatype_expl SYS_DATATYPE; eval create or replace table t1( id bigint primary key, a int, b int) with system versioning; insert into t1 values(1, 1, 1); +--disable_cursor_protocol select row_start, row_end from t1 into @sys_start, @sys_end; +--enable_cursor_protocol select id, a, b from t1; insert into t1 values(2, 2, 2); select id, a, b, row_start > @sys_start as C, row_end = @sys_end as D from t1 where id = 2; diff --git a/mysql-test/suite/versioning/t/insert2.test b/mysql-test/suite/versioning/t/insert2.test index 1e7d2166064..527a66e5f21 100644 --- a/mysql-test/suite/versioning/t/insert2.test +++ b/mysql-test/suite/versioning/t/insert2.test @@ -48,7 +48,9 @@ insert into t1 (row_start) select row_end from t1; set sql_mode=''; insert into t1 (row_start, row_end) values (DEFAULT, 1); set sql_mode=default; +--disable_cursor_protocol select @@sql_mode into @saved_mode; +--enable_cursor_protocol set sql_mode= ''; insert into t1 (x, row_start, row_end) values (3, 4, 5); set sql_mode= @saved_mode; diff --git a/mysql-test/suite/versioning/t/load_data.test b/mysql-test/suite/versioning/t/load_data.test index 6668a4ff9f7..aa4e2192113 100644 --- a/mysql-test/suite/versioning/t/load_data.test +++ b/mysql-test/suite/versioning/t/load_data.test @@ -4,9 +4,11 @@ CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING; INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3); +--disable_cursor_protocol --disable_ps2_protocol SELECT a, b, c FROM t1 INTO OUTFILE '15330.data'; --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE '15330.data' IGNORE INTO TABLE t1 (a,b,c); LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c); diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index a4f487aae29..840af2d6cec 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -995,6 +995,7 @@ create or replace table t1 ( insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load.data' from t1; --enable_ps2_protocol @@ -1003,6 +1004,7 @@ load data infile 'load.data' replace into table t1; load data infile 'load.data' replace into table t1; --error ER_RECORD_FILE_FULL load data infile 'load.data' replace into table t1; +--enable_cursor_protocol # Cleanup --let $datadir= `select @@datadir` @@ -1339,9 +1341,11 @@ partition by system_time limit 100 ( partition pn current); insert into t1 select seq from seq_0_to_49; +--disable_cursor_protocol --disable_ps2_protocol select x into outfile 'MDEV-20077.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'MDEV-20077.data' replace into table t1 (x); load data infile 'MDEV-20077.data' replace into table t1 (x); diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test index f28a3dddd89..27ff2ca35f6 100644 --- a/mysql-test/suite/versioning/t/select.test +++ b/mysql-test/suite/versioning/t/select.test @@ -29,7 +29,9 @@ set @t0= now(6); if ($MTR_COMBINATION_TRX_ID) { --disable_query_log +--disable_cursor_protocol select sys_trx_start from t1 limit 1 into @x0; +--enable_cursor_protocol --enable_query_log } @@ -37,12 +39,16 @@ delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol select sys_trx_start from t1 where x = 3 and y = 33 into @t1; +--enable_cursor_protocol if ($MTR_COMBINATION_TRX_ID) { --disable_query_log set @x1= @t1; +--disable_cursor_protocol select trt_commit_ts(@x1) into @t1; +--enable_cursor_protocol --enable_query_log } @@ -118,12 +124,14 @@ delete from t1; insert into t1 values (3); delete from t1; +--disable_cursor_protocol select row_start into @start1 from t1 for system_time all where x = 1; select row_end into @end1 from t1 for system_time all where x = 1; select row_start into @start2 from t1 for system_time all where x = 2; select row_end into @end2 from t1 for system_time all where x = 2; select row_start into @start3 from t1 for system_time all where x = 3; select row_end into @end3 from t1 for system_time all where x = 3; +--enable_cursor_protocol select x as ASOF_x from t1 for system_time as of @start2; select x as ASOF_x from t1 for system_time as of @end2; @@ -254,7 +262,9 @@ create or replace table t1 ( insert into t1 values (1); set @ts= now(6); delete from t1; +--disable_cursor_protocol select sys_trx_start from t1 for system_time all into @trx_start; +--enable_cursor_protocol --echo ## ensure @trx_start is much lower than unix timestamp select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good; @@ -382,8 +392,10 @@ eval create or replace table t1 ( ) with system versioning; insert into t1 values (1); delete from t1; +--disable_cursor_protocol select row_start from t1 for system_time all into @t1; select row_end from t1 for system_time all into @t2; +--enable_cursor_protocol --disable_query_log if($MTR_COMBINATION_TRX_ID) { set @t1= trt_begin_ts(@t1); diff --git a/mysql-test/suite/versioning/t/select2.test b/mysql-test/suite/versioning/t/select2.test index 1ab7bcf27c1..a557f10501b 100644 --- a/mysql-test/suite/versioning/t/select2.test +++ b/mysql-test/suite/versioning/t/select2.test @@ -22,17 +22,21 @@ insert into t1 (x, y) values (8, 108), (9, 109); set @t0= now(6); +--disable_cursor_protocol select sys_start from t1 limit 1 into @x0; +--enable_cursor_protocol delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol select sys_start from t1 where x = 3 and y = 33 into @t1; if($MTR_COMBINATION_TRX_ID) { set @x1= @t1; select trt_commit_ts(@x1) into @t1; } +--enable_cursor_protocol select x, y from t1; select x as ASOF_x, y from t1 for system_time as of timestamp @t0; diff --git a/mysql-test/suite/versioning/t/simple.test b/mysql-test/suite/versioning/t/simple.test index b550b3967d9..6f0e52f4f5d 100644 --- a/mysql-test/suite/versioning/t/simple.test +++ b/mysql-test/suite/versioning/t/simple.test @@ -18,6 +18,7 @@ create or replace table emp ( ) with system versioning; +--disable_cursor_protocol select now() into @ts_0; insert into dept (dept_id, name) values (10, "accounting"); @@ -29,13 +30,16 @@ insert into emp (emp_id, name, salary, dept_id) values (1, "bill", 1000, 10); commit; select row_start into @ts_2 from emp where name="bill"; +--enable_cursor_protocol select * from emp; update emp set salary=2000 where name="bill"; commit; +--disable_cursor_protocol select row_start into @ts_3 from emp where name="bill"; +--enable_cursor_protocol select * from emp; select * from emp for system_time as of timestamp @ts_2; diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index a0da7714f50..098d85da999 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -38,11 +38,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=inplace; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -59,11 +63,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=copy; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -118,9 +126,11 @@ commit; --sleep 0.01 set @ts3= sysdate(6); +--disable_cursor_protocol select sys_start from t1 where x = 1 into @trx_id1; select sys_start from t1 where x = 2 into @trx_id2; select sys_start from t1 where x = 3 into @trx_id3; +--enable_cursor_protocol select @trx_id1 < @trx_id2, @trx_id2 < @trx_id3; select @ts1 < @ts2, @ts2 < @ts3; @@ -261,7 +271,9 @@ set @ts1= now(6); insert into t1 values (1); commit; +--disable_cursor_protocol select row_start from t1 into @trx_id; +--enable_cursor_protocol select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD; drop table t1; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 046a4ac149d..3c5e7c4315e 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -28,11 +28,15 @@ eval create table t1 ( with system versioning; set timestamp= unix_timestamp('2000-01-01 00:00:00'); insert into t1 values(1, 1, 1); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 01:00:00'); update t1 set x= 11, y= 11 where id = 1; select @tmp1 < sys_trx_start as A1, x, y from t1; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 02:00:00'); update t1 set y= 1 where id = 1; select @tmp1 = sys_trx_start as A2, x from t1; @@ -135,14 +139,18 @@ create table t2 like t1; insert into t1 values (1, "Jeremy", 3000); insert into t2 values (1, "Jeremy", 4000); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.name= "Jerry", t2.name= "Jerry" where t1.id = t2.id and t1.name = "Jeremy"; select @tmp1 < sys_trx_start as A1, name from t1; select @tmp2 < sys_trx_start as A2, name from t2; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.salary= 2500, t2.salary= 2500 where t1.id = t2.id and t1.name = "Jerry"; select @tmp1 = sys_trx_start as B1, salary from t1; select @tmp2 = sys_trx_start as B2, salary from t2; @@ -335,7 +343,9 @@ drop tables t1, t2, t3; create or replace table t1 (x int) with system versioning; insert t1 values (1); update t1 set x= 1; +--disable_cursor_protocol select row_start into @r from t1; +--enable_cursor_protocol select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r; drop table t1; diff --git a/mysql-test/suite/versioning/t/view.test b/mysql-test/suite/versioning/t/view.test index 9bb915f7b77..e4c688fa859 100644 --- a/mysql-test/suite/versioning/t/view.test +++ b/mysql-test/suite/versioning/t/view.test @@ -5,10 +5,14 @@ create or replace table t1 (x int) with system versioning; insert into t1 values (1); +--disable_cursor_protocol select now(6) into @t1; +--enable_cursor_protocol update t1 set x= 2; +--disable_cursor_protocol select now(6) into @t2; +--enable_cursor_protocol delete from t1; set @vt1= concat("create or replace view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'"); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index 41cfa0b06ae..41fe8bd840e 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -19,7 +19,10 @@ CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('::1'); --enable_metadata SELECT * FROM t1; +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT CAST('::' AS INET6) AS a; +--enable_cursor_protocol --disable_metadata DROP TABLE t1; @@ -1431,6 +1434,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INET6); +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1449,6 +1454,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/storage/connect/mysql-test/connect/t/bson_udf.test b/storage/connect/mysql-test/connect/t/bson_udf.test index 0da2de38864..584f8f25554 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf.test +++ b/storage/connect/mysql-test/connect/t/bson_udf.test @@ -19,7 +19,10 @@ SELECT BsonValue(9223372036854775807); SELECT BsonValue(NULL); SELECT BsonValue(TRUE); SELECT BsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT BsonValue(); +--enable_cursor_protocol SELECT BsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Bson_Make_Array(); diff --git a/storage/connect/mysql-test/connect/t/json_udf.test b/storage/connect/mysql-test/connect/t/json_udf.test index 96fe836e60b..82afd030f75 100644 --- a/storage/connect/mysql-test/connect/t/json_udf.test +++ b/storage/connect/mysql-test/connect/t/json_udf.test @@ -19,7 +19,10 @@ SELECT JsonValue(9223372036854775807); SELECT JsonValue(NULL); SELECT JsonValue(TRUE); SELECT JsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT JsonValue(); +--enable_cursor_protocol SELECT JsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Json_Make_Array(); @@ -60,7 +63,10 @@ SELECT Json_Make_Object(56, 3.1416, 'foo', NULL); SELECT Json_Make_Object(56 qty, 3.1416 price, 'foo' truc, NULL garanty); SELECT Json_Make_Object(); SELECT Json_Make_Object(Json_Make_Array(56, 3.1416, 'foo'), NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT Json_Make_Array(Json_Make_Object(56 "qty", 3.1416 "price", 'foo') ,NULL); +--enable_cursor_protocol SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty', NULL); --error ER_CANT_INITIALIZE_UDF SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test index ec9e3c9d4b9..1cd840a9690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test index e3b7df72cf9..b1276755a40 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test @@ -33,7 +33,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR'; SHOW CREATE TABLE tags; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test index 964426b44bf..dbad49d67d2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test @@ -35,7 +35,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test index 0f92c024b7c..1f83d5d2df7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags'; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test index 0516186ba17..8377e9c5690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test index 0ed92333e29..ec185295891 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test index 54fb986a24f..19879bc57f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test @@ -34,7 +34,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test index 8a63885a8e7..d68fb7c7362 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -34,7 +34,10 @@ CREATE TABLE memos ( ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test index 8efaad2a4ce..00a09f952ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -37,6 +37,8 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; @@ -47,6 +49,7 @@ ALTER TABLE memos DISABLE KEYS; ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test index 83ce2ca786e..8237f2d83fb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test @@ -35,9 +35,12 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test index 424e51adaaa..27071e82c1d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test @@ -35,10 +35,13 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test index c23f35eef9a..11e524482be 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test @@ -39,7 +39,10 @@ CREATE TABLE bugs ( INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT *, MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test index 9e128a005bb..710b922d9da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -40,7 +40,10 @@ INSERT INTO bugs (id, priority) VALUES (1, 10); INSERT INTO bugs (id, priority) VALUES (2, 3); INSERT INTO bugs (id, priority) VALUES (3, -2); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT * FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test index be26045ab89..5c94e43e2c8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test index efbaf31fae5..4734d6d71bb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test index 6bafebd8b9c..c3e4280390d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test @@ -29,7 +29,10 @@ CREATE TABLE bugs ( tags TEXT COMMENT 'flags "COLUMN_VECTOR"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test index 3baa576a9ea..3dd9bd81a08 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test @@ -30,7 +30,10 @@ CREATE TABLE bugs ( tags TEXT FLAGS='COLUMN_VECTOR' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test index 28f0f214935..aa2270d4926 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'groonga_type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test index a664287289b..6b1bd629337 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test index bd4b268b081..4b308c196eb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test index ade4099a8d5..d1d4654460a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( COLLATE=utf8_bin COMMENT='default_tokenizer "TokenDelimit"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test index 4997dbf75f7..b2bc719d683 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test @@ -29,7 +29,10 @@ CREATE TABLE diaries ( INDEX (content) COMMENT 'normalizer "NormalizerAuto"' ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test index f7add5dbd60..5b2dcf00001 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test index 2fc98e6103e..4f40cca47c0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test index aaf60b02dc4..a4c844ba435 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE memos ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test index dc0996d279c..a9de0b1101d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test index ee1da6d09c3..30a21540c62 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test index 37405696697..e9ab751dc0b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 100; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test index 9322876badb..64a75843bfc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 200; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test index 283efbd3a48..a0e27ea5618 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test index 4b873f50cf0..ea9820ac6a6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test index fc3590f36ff..24cba6110fa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test index bcba6e75736..756c26bbfc2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test index e40a703b0a5..db2ee2b2203 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test @@ -31,9 +31,12 @@ CREATE TABLE diaries ( INSERT INTO diaries VALUES('It is Groonga'); INSERT INTO diaries VALUES('It is Mroonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('select', 'table', 'diaries', 'filter', 'title @ "Groonga"'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test index 720c547c0f7..1dcb143de29 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test @@ -30,7 +30,10 @@ CREATE TABLE diaries ( FULLTEXT KEY (title) ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test index 3958782a4bc..8f9013bc87b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', keyword) AS highlighted FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test index 98643876058..bac040e69b3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test index 83e5966d39e..a774f361fe3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'mroonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test index aa2eee53b53..108f28ce952 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘'); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test index bb9199f012f..bcaec1fe4da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘', "NormalizerAuto"); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test index a92e651cfd4..69297ed3152 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', keyword) as snippet FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test index 54953ebea59..a968c7b924e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') as snippet; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test index 21e80a74fd6..ac828ddb1ac 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test index f98d0e0da2c..d6d17396760 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test index 5898e3772c6..f06f6cfe94e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test index c646a1d2eba..a61382949fe 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test index e6dd9908002..c609df9d03d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -27,7 +27,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test index 45c758173d4..920fa63a46c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test index 64732efd8ec..55e31124c18 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test index 3fb0caeadf8..e6b56bae1e0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE memos ( ) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc index 40fabce0517..492343f2e47 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc @@ -1428,10 +1428,12 @@ INSERT INTO t1(c1,c2) VALUES (4,14), (4,15), (4,16), (4,17), (4,18), (4,19), (4,20),(5,5); ANALYZE TABLE t1; +--disable_cursor_protocol EXPLAIN SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; FLUSH STATUS; SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test index aeadf5381b0..64d38a5e571 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test @@ -35,9 +35,11 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1; --echo ## --echo ## 2PC + durability + single thread --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; @@ -63,9 +65,11 @@ set debug_dbug='-d,rocksdb_enable_delay_commits'; --echo ## --echo ## 2PC + durability + group commit --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -90,9 +94,11 @@ set debug_dbug='-d,rocksdb_disable_delay_commits'; SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=0; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits @@ -106,9 +112,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo # 2PC enabled, MyRocks durability disabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -132,9 +140,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_flush_log_at_trx_commit=1; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -148,9 +158,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC disabled, MyRocks durability enabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select variable_value - @b1 as Binlog_commits diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test index 99e28f3b55e..280c59a6a1d 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test @@ -67,7 +67,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After engine prepare @@ -83,7 +85,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After binlog @@ -99,7 +103,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After everything @@ -115,7 +121,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; drop table t; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test index b64af16411b..83ef7c0ff29 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test @@ -99,10 +99,12 @@ while ($i > 0) # smallest value in the sequence for thread 'thr' that is greater than # the pk in the previous row. let $file = `SELECT CONCAT(@@datadir, "test_export.txt")`; +--disable_cursor_protocol --disable_query_log --echo SELECT * FROM t1 ORDER BY pk INTO OUTFILE ; eval SELECT * FROM t1 ORDER BY pk INTO OUTFILE "$file"; --enable_query_log +--enable_cursor_protocol let ROCKSDB_OUTFILE = $file; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test index dc2a0da506d..41909a584ff 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test @@ -29,7 +29,9 @@ while ($i <= 10000) { ## HA_READ_PREFIX_LAST_OR_PREV # BF len 21 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -47,7 +49,9 @@ explain select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol # MariaDB: no support for optimizer_force_index_for_range: #set @tmp_force_index_for_range=@@optimizer_force_index_for_range; #set optimizer_force_index_for_range=on; @@ -56,34 +60,46 @@ select case when variable_value-@c > 0 then 'true' else 'false' end from informa #set global optimizer_force_index_for_range=@tmp_force_index_for_range; # BF len 13 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; ## HA_READ_PREFIX_LAST_OR_PREV (no end range) # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 and time >= 0 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo ## HA_READ_PREFIX_LAST --echo # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 12 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -125,7 +141,9 @@ explain select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; --echo # The following MUST show TRUE: diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test index 09d9d734f9e..e159cab2f0c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test @@ -21,12 +21,16 @@ while ($t <= 2) { set session rocksdb_bulk_load=0; # bloom filter should be useful on insert (calling GetForUpdate) +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r1 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; # cf2 has no bloo filter in the bottommost level +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r2 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test index 1dcb176e4fa..6dcea5ccc4e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test @@ -21,8 +21,10 @@ column_name="a"; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -35,8 +37,10 @@ SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -111,8 +115,10 @@ while ($i<100) # Cardinality of key c should be 1 for c, 10 for b, 100 for a and the other fields. SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t2; +--disable_cursor_protocol --echo cardinality of the columns after 'a' must be equal to the cardinality of column 'a' SELECT CARDINALITY INTO @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND COLUMN_NAME='a'; +--enable_cursor_protocol SELECT COLUMN_NAME, CARDINALITY = @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND SEQ_IN_INDEX > 3; drop table t1, t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc index 1a044384a45..dd9a19a29cb 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc @@ -29,7 +29,9 @@ let $max = 50000; let $table = t1; --source drop_table3_repopulate_table.inc +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_compact_read_bytes'; +--enable_cursor_protocol if ($truncate_table) { truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test index 22b5d69780d..21ee4b9b3ba 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test @@ -8,6 +8,8 @@ DROP TABLE IF EXISTS t1; --enable_warnings +--disable_cursor_protocol + FLUSH STATUS; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(100), b INT, INDEX b(b)) ENGINE=rocksdb; @@ -49,5 +51,7 @@ FLUSH STATUS; SELECT * FROM t1 WHERE id < 8 ORDER BY id; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol + # Cleanup DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc index 17baf5b6c57..ba88c603568 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc @@ -111,7 +111,9 @@ commit; connection con1; update test set value = value + 10; connection con2; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; +--enable_cursor_protocol select * from test; send delete from test where value = 20; connection con1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test index ccef7182c11..cde1d4ef1fc 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test @@ -21,8 +21,10 @@ while ($i < 30) { inc $j; } + --disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='Sort_merge_passes'; eval SELECT a, b, c FROM ti_nk ORDER BY a,b,c INTO OUTFILE '$datadir/select.out'; + --enable_cursor_protocol --remove_file $datadir/select.out select case when variable_value-@s = 0 then 'true' else 'false' end as skip_merge_sort from information_schema.global_status where variable_name='Sort_merge_passes'; inc $i; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test index ee41324a34d..26bea857ed3 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test @@ -72,8 +72,10 @@ AND VALUE > 0; SELECT COUNT(*) from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @a from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol # Single statement writes do show up in per-table stats INSERT INTO t2 VALUES (5), (6), (7), (8); @@ -83,8 +85,10 @@ WHERE TABLE_NAME = 't2' AND STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @b from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol SELECT CASE WHEN @b - @a > 0 THEN 'true' ELSE 'false' END; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test index 8fa43e15827..ffad670a0bf 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test @@ -22,7 +22,9 @@ set global rocksdb_force_flush_memtable_now = 1; SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%'; # BF used (4+8+8+8) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -48,7 +50,9 @@ SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%pre # Satisfies can_use_bloom_filter (4+8+8+8), but can't use because the old SST # files have old prefix extractor +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -67,7 +71,9 @@ set global rocksdb_force_flush_memtable_now = 1; # BF used w/ new prefix extractor (4+8+8+8) (still increments once because it # needs to check the new SST file, but doesnt increment for SST file with old # extractor) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -81,7 +87,9 @@ set global rocksdb_force_flush_memtable_now = 1; # should have 3 sst files, one with old prefix extractor and two with new SELECT COUNT(*) FROM information_schema.rocksdb_index_file_map WHERE COLUMN_FAMILY != 1; +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -89,7 +97,9 @@ SET @@global.rocksdb_update_cf_options = ''; set global rocksdb_compact_cf='cf1'; # Select the updated, make sure bloom filter is checked now +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=30 AND id3=30; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test index 3a1025a3623..dfd119a0a8c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test @@ -18,8 +18,10 @@ CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=Rock INSERT INTO t1 VALUES (1,1); # Read-only, long-running transaction. SingleDelete/Put shouldn't increase much. +--disable_cursor_protocol select variable_value into @p from information_schema.global_status where variable_name='rocksdb_number_sst_entry_put'; select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; +--enable_cursor_protocol #-- replace_result $uuid uuid START TRANSACTION WITH CONSISTENT SNAPSHOT; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test index 0369e758f5d..e2c13748386 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test @@ -11,6 +11,7 @@ set @@global.query_cache_size=1024*1024; --enable_connect_log +--disable_cursor_protocol create table t1 (pk int primary key, c char(8)) engine=RocksDB; insert into t1 values (1,'new'),(2,'new'); @@ -35,6 +36,7 @@ show status like 'Qcache_not_cached'; show global status like 'Qcache_hits'; drop table t1; +--enable_cursor_protocol # # Cleanup diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test index ebcc741fc17..ec99aa98278 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test @@ -1,6 +1,7 @@ source include/have_rocksdb.inc; create table t1 (a int primary key) engine=rocksdb; +--disable_cursor_protocol -- echo Verify rocksdb_rows_inserted select variable_value into @old_rows_inserted from information_schema.global_status where variable_name = 'rocksdb_rows_inserted'; insert into t1 values(1); @@ -51,6 +52,7 @@ select variable_value into @old_system_rows_deleted from information_schema.glob delete from t1; select variable_value into @new_system_rows_deleted from information_schema.global_status where variable_name = 'rocksdb_system_rows_deleted'; select @new_system_rows_deleted - @old_system_rows_deleted; +--enable_cursor_protocol drop table t1; use test; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/select.test b/storage/rocksdb/mysql-test/rocksdb/t/select.test index 3d9bdc7b4b8..fc6cd7c5d10 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/select.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/select.test @@ -68,6 +68,7 @@ SELECT * FROM t2 WHERE a>0 PROCEDURE ANALYSE(); # SELECT INTO let $datadir = `SELECT @@datadir`; +--disable_cursor_protocol --replace_result $datadir eval SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a @@ -94,6 +95,7 @@ SELECT t1.*, t2.* FROM t1, t2 ORDER BY t2.b, t1.a, t2.a, t1.b, t1.pk, t2.pk LIMI SELECT MIN(a), MAX(a) FROM t1 INTO @min, @max; SELECT @min, @max; +--enable_cursor_protocol # Joins diff --git a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test index 55854710c31..5fc52a5142c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test @@ -81,9 +81,11 @@ flush tables; select create_time is not null, update_time is not null, check_time from information_schema.tables where table_schema=database() and table_name='t1'; +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(3); insert into t1 values (2); @@ -109,9 +111,11 @@ where table_schema=database() and table_name='t1'; insert into t1 values (5,5); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol --echo # Then, an in-place ALTER TABLE: select sleep(2); @@ -126,9 +130,11 @@ where table_schema=database() and table_name='t1'; --echo # Check TRUNCATE TABLE insert into t1 values (10,10); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(2); truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test index 5a9d17e0255..9de2a899eda 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test @@ -3,8 +3,10 @@ # only SingleDelete increases CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t1 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -21,8 +23,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # both SingleDelete and Delete increases CREATE TABLE t2 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t2 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -38,8 +42,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only Delete increases CREATE TABLE t3 (id INT, value int, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t3 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -55,8 +61,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only SingleDelete increases CREATE TABLE t4 (id INT, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t4 VALUES (1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -72,8 +80,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # only SingleDelete increases CREATE TABLE t5 (id1 INT, id2 INT, PRIMARY KEY (id1, id2), INDEX(id2)) ENGINE=RocksDB; INSERT INTO t5 VALUES (1, 1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test index 38bfb2eef8f..d8f17a7cbb9 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test @@ -516,7 +516,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -537,7 +539,9 @@ INSERT INTO t1 values (1); INSERT INTO t1 values (2); INSERT INTO t1 values (3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test index 7a7609f456e..a452e932bb5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test @@ -24,7 +24,9 @@ set global rocksdb_force_flush_memtable_now=1; --sorted_result SELECT * FROM t1; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; @@ -78,7 +80,9 @@ INSERT INTO t1 values (7); set global rocksdb_debug_ttl_rec_ts = 0; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -87,7 +91,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=0; # should return everything +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -96,7 +102,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=1; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -125,7 +133,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; @@ -301,27 +311,35 @@ set global rocksdb_compact_cf='default'; # this connection the records have 'expired' already so they are filtered out # even though they have not yet been removed by compaction +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; --echo # Switching to connection 1 connection con1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; UPDATE t1 set a = a + 1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; COMMIT; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result # <= filtered out here because time has passed. SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test index fb439e109e7..49d097b1056 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test @@ -582,7 +582,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -604,7 +606,9 @@ INSERT INTO t1 values (1, 1); INSERT INTO t1 values (2, 2); INSERT INTO t1 values (3, 3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test index f6042cc517e..0e83a0f003e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test @@ -29,7 +29,9 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY); --sorted_result SELECT * FROM t1 FORCE INDEX (kb); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_debug_ttl_ignore_pk = 1; set global rocksdb_compact_cf='default'; set global rocksdb_debug_ttl_ignore_pk = 0; @@ -145,7 +147,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test index d231236bd92..f5134b841aa 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test @@ -45,8 +45,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --let $file1=$MYSQLTEST_VARDIR/tmp/filesort_order --let $file2=$MYSQLTEST_VARDIR/tmp/sk_order --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c1)) INTO OUTFILE '$file1' from t order by c1 --eval select hex(weight_string(c1)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c1 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 @@ -54,8 +56,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --remove_file $file2 --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c2)) INTO OUTFILE '$file1' from t order by c2 --eval select hex(weight_string(c2)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c2 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc index ff58b73a91b..032a81a80cc 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc @@ -56,6 +56,8 @@ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10,pk) VALUES (-9999 --sorted_result --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 +#Enable after fix MDEV-34624 +--disable_cursor_protocol --sorted_result query_vertical SELECT @@ -69,6 +71,7 @@ SELECT CONCAT('', MAX(d10_10)), CONCAT('', MAX(d53)), CONCAT('', MAX(d53_10)) FROM t1; +--enable_cursor_protocol # Invalid values diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc index 080ba735a32..325a7523974 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc @@ -41,9 +41,11 @@ eval CREATE TABLE tbl_a ( INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -56,9 +58,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc index fd31047ab58..f52d415a032 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc @@ -54,9 +54,11 @@ eval CREATE TABLE tbl_a ( INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -72,9 +74,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/tokudb/mysql-test/rpl/extra/rpl_tests/rpl_parallel_load_tokudb.test b/storage/tokudb/mysql-test/rpl/extra/rpl_tests/rpl_parallel_load_tokudb.test index f354d49190a..c1be155b70b 100644 --- a/storage/tokudb/mysql-test/rpl/extra/rpl_tests/rpl_parallel_load_tokudb.test +++ b/storage/tokudb/mysql-test/rpl/extra/rpl_tests/rpl_parallel_load_tokudb.test @@ -272,6 +272,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; use test; let $benchmark_file= `select replace(concat("benchmark_",uuid(),".out"),"-","_")`; --replace_regex /benchmark_.*.out/benchmark.out/ +--disable_cursor_protocol --disable_ps2_protocol eval select * from test1.benchmark into outfile '$benchmark_file'; --enable_ps2_protocol @@ -289,6 +290,7 @@ eval select time_to_sec(@m_1) - time_to_sec(@m_0) as 'delta_m', time_to_sec(@s_1) - time_to_sec(@s_0) as 'delta_s', time_to_sec(@s_m1) - time_to_sec(@s_m0) as 'delta_sm' into outfile '$delta_file'; --enable_ps2_protocol +--enable_cursor_protocol # # Consistency verification diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_update_pk_uc1_lookup1.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_update_pk_uc1_lookup1.result index bfd640e52e9..b5d1251efef 100644 --- a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_update_pk_uc1_lookup1.result +++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_update_pk_uc1_lookup1.result @@ -21,8 +21,10 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; @tend-@tstart <= 5 0 diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk.test b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk.test index bedeb9513be..2f776730506 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk.test @@ -39,14 +39,18 @@ source include/diff_tables.inc; # delete a row connection master; delete from t where a=2; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time # diff tables diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk.test index bedeb9513be..2f776730506 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk.test @@ -39,14 +39,18 @@ source include/diff_tables.inc; # delete a row connection master; delete from t where a=2; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time # diff tables diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk_lookup1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk_lookup1.test index 9e9aaede416..076590696aa 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk_lookup1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_delete_pk_lookup1.test @@ -40,7 +40,9 @@ source include/diff_tables.inc; # delete a row connection master; delete from t where a=2; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; @@ -48,7 +50,9 @@ sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart > 5; # assert big delay in the delete time # diff tables diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test index 7b3e8f0c0d3..5b76669c4d1 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ff.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test index 7b3e8f0c0d3..5b76669c4d1 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_ft.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test index 7b3e8f0c0d3..5b76669c4d1 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tf.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test index 7b3e8f0c0d3..5b76669c4d1 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_read_only_tt.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup0.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup0.test index 6dd9b660eed..38965783651 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup0.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup0.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup1.test index 6dd9b660eed..38965783651 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc0_lookup1.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup0.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup0.test index 6dd9b660eed..38965783651 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup0.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup0.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup1.test index 6dd9b660eed..38965783651 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_pk_uc1_lookup1.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup0.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup0.test index 93fef3699d9..ab012da4aaa 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup0.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup0.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup1.test index c8976db8ccd..3d6eeb9f4ef 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_update_unique_uc0_lookup1.test @@ -42,14 +42,18 @@ update t set b=b+2 where a=1; update t set b=b+3 where a=4; update t set b=b+4 where a=3; update t set b=b+1 where 1<=a and a<=3; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol # wait for the delete to finish on the slave connection master; sync_slave_with_master; # source include/sync_slave_sql_with_master.inc; connection master; +--disable_cursor_protocol select unix_timestamp() into @tend; +--enable_cursor_protocol select @tend-@tstart <= 5; # assert no delay in the delete time connection slave; diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk.test index 0ed12b34e1f..4bb41c7fba7 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk_uc1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk_uc1.test index 0ed12b34e1f..4bb41c7fba7 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk_uc1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_pk_uc1.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, primary key(a)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1); insert into t values (2),(3); insert into t values (4); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique.test index fc4c9597dac..7ccaf72cdb7 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1,2); insert into t values (2,3),(3,4); insert into t values (4,5); diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique_uc1.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique_uc1.test index fc4c9597dac..7ccaf72cdb7 100644 --- a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique_uc1.test +++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_write_unique_uc1.test @@ -22,7 +22,9 @@ connection master; # select @@autocommit; eval create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=$engine; # show create table t; +--disable_cursor_protocol select unix_timestamp() into @tstart; +--enable_cursor_protocol insert into t values (1,2); insert into t values (2,3),(3,4); insert into t values (4,5); diff --git a/storage/tokudb/mysql-test/tokudb/t/ext_key_1_innodb.test b/storage/tokudb/mysql-test/tokudb/t/ext_key_1_innodb.test index 535f887c929..6b895578de6 100644 --- a/storage/tokudb/mysql-test/tokudb/t/ext_key_1_innodb.test +++ b/storage/tokudb/mysql-test/tokudb/t/ext_key_1_innodb.test @@ -9,7 +9,9 @@ create table t (id int not null, x int not null, y int not null, primary key(id) insert into t values (0,0,0),(1,1,1),(2,2,2),(3,2,3),(4,2,4); +--disable_cursor_protocol --disable_ps2_protocol + explain select x,id from t force index (x) where x=0 and id=0; flush status; select x,id from t force index (x) where x=0 and id=0; @@ -40,5 +42,6 @@ flush status; select x,id from t force index (x) where x=2 and id=0; show status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/t/ext_key_1_tokudb.test b/storage/tokudb/mysql-test/tokudb/t/ext_key_1_tokudb.test index e9c82405262..e6e6d114698 100644 --- a/storage/tokudb/mysql-test/tokudb/t/ext_key_1_tokudb.test +++ b/storage/tokudb/mysql-test/tokudb/t/ext_key_1_tokudb.test @@ -8,7 +8,9 @@ create table t (id int not null, x int not null, y int not null, primary key(id) insert into t values (0,0,0),(1,1,1),(2,2,2),(3,2,3),(4,2,4); +--disable_cursor_protocol --disable_ps2_protocol + explain select x,id from t force index (x) where x=0 and id=0; flush status; select x,id from t force index (x) where x=0 and id=0; @@ -39,5 +41,6 @@ flush status; select x,id from t force index (x) where x=2 and id=0; show status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/t/ext_key_2_innodb.test b/storage/tokudb/mysql-test/tokudb/t/ext_key_2_innodb.test index e5722dce563..89b021cbf34 100644 --- a/storage/tokudb/mysql-test/tokudb/t/ext_key_2_innodb.test +++ b/storage/tokudb/mysql-test/tokudb/t/ext_key_2_innodb.test @@ -9,7 +9,9 @@ create table t (a int not null, b int not null, c int not null, d int not null, insert into t values (0,0,0,0),(0,1,0,1); +--disable_cursor_protocol --disable_ps2_protocol + explain select c,a,b from t where c=0 and a=0 and b=1; flush status; select c,a,b from t where c=0 and a=0 and b=1; @@ -20,5 +22,6 @@ flush status; select c,a,b from t force index (c) where c=0 and a=0 and b=1; show status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/t/ext_key_2_tokudb.test b/storage/tokudb/mysql-test/tokudb/t/ext_key_2_tokudb.test index d68a1bcf7f7..162a1cf624e 100644 --- a/storage/tokudb/mysql-test/tokudb/t/ext_key_2_tokudb.test +++ b/storage/tokudb/mysql-test/tokudb/t/ext_key_2_tokudb.test @@ -8,7 +8,9 @@ create table t (a int not null, b int not null, c int not null, d int not null, insert into t values (0,0,0,0),(0,1,0,1); +--disable_cursor_protocol --disable_ps2_protocol + explain select c,a,b from t where c=0 and a=0 and b=1; flush status; select c,a,b from t where c=0 and a=0 and b=1; @@ -19,5 +21,6 @@ flush status; select c,a,b from t force index (c) where c=0 and a=0 and b=1; show status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/t/rows-32m-0.test b/storage/tokudb/mysql-test/tokudb/t/rows-32m-0.test index 58a5ac1b8e3..b3317f0c666 100644 --- a/storage/tokudb/mysql-test/tokudb/t/rows-32m-0.test +++ b/storage/tokudb/mysql-test/tokudb/t/rows-32m-0.test @@ -12,7 +12,9 @@ drop table if exists t; create table t (id int not null primary key, v longblob not null); +--disable_cursor_protocol select @@max_allowed_packet into @my_max_allowed_packet; +--enable_cursor_protocol --disable_warnings set global max_allowed_packet=100000000; --enable_warnings diff --git a/storage/tokudb/mysql-test/tokudb/t/rows-32m-1.test b/storage/tokudb/mysql-test/tokudb/t/rows-32m-1.test index 39feddf77be..8c2f29687d3 100644 --- a/storage/tokudb/mysql-test/tokudb/t/rows-32m-1.test +++ b/storage/tokudb/mysql-test/tokudb/t/rows-32m-1.test @@ -12,7 +12,9 @@ drop table if exists t; create table t (id int not null primary key, v0 longblob not null,v1 longblob not null); +--disable_cursor_protocol select @@max_allowed_packet into @my_max_allowed_packet; +--enable_cursor_protocol --disable_warnings set global max_allowed_packet=100000000; --enable_warnings diff --git a/storage/tokudb/mysql-test/tokudb/t/rows-32m-rand-insert.test b/storage/tokudb/mysql-test/tokudb/t/rows-32m-rand-insert.test index c26e79913d0..4c03852d280 100644 --- a/storage/tokudb/mysql-test/tokudb/t/rows-32m-rand-insert.test +++ b/storage/tokudb/mysql-test/tokudb/t/rows-32m-rand-insert.test @@ -10,7 +10,9 @@ drop table if exists t; create table t (id int not null primary key, v longblob not null); +--disable_cursor_protocol select @@max_allowed_packet into @my_max_allowed_packet; +--enable_cursor_protocol --disable_warnings set global max_allowed_packet=100000000; --enable_warnings diff --git a/storage/tokudb/mysql-test/tokudb/t/rows-32m-seq-insert.test b/storage/tokudb/mysql-test/tokudb/t/rows-32m-seq-insert.test index 7ee84c69eca..184ecdf26c4 100644 --- a/storage/tokudb/mysql-test/tokudb/t/rows-32m-seq-insert.test +++ b/storage/tokudb/mysql-test/tokudb/t/rows-32m-seq-insert.test @@ -10,7 +10,9 @@ drop table if exists t; create table t (id int not null auto_increment primary key, v longblob not null); +--disable_cursor_protocol select @@max_allowed_packet into @my_max_allowed_packet; +--enable_cursor_protocol --disable_warnings set global max_allowed_packet=100000000; --enable_warnings diff --git a/storage/tokudb/mysql-test/tokudb/t/type_date.test b/storage/tokudb/mysql-test/tokudb/t/type_date.test index ed330a2d748..9799dcebade 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_date.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_date.test @@ -203,12 +203,15 @@ CREATE TABLE t2 (a DATE); CREATE INDEX i ON t1 (a); INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00'); INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00'); +#Check after fix MDEV-31516 +--disable_cursor_protocol SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; +--enable_cursor_protocol --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('1000-00-00'); SET SQL_MODE=DEFAULT; diff --git a/storage/tokudb/mysql-test/tokudb/t/type_float.test b/storage/tokudb/mysql-test/tokudb/t/type_float.test index 8c83913f1c8..7cd7f7cbe50 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_float.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_float.test @@ -324,8 +324,10 @@ let $nine_65= select format(-1.7976931348623157E+307,256) as foo; select least(-1.1111111111111111111111111, - group_concat(1.7976931348623157E+308)) as foo; +--disable_cursor_protocol eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), ($nine_65)) into @a; +--enable_cursor_protocol --enable_result_log --echo End of 5.0 tests diff --git a/storage/tokudb/mysql-test/tokudb/t/type_newdecimal.test b/storage/tokudb/mysql-test/tokudb/t/type_newdecimal.test index 3d44a5b78f4..bb5e7fd5568 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_newdecimal.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_newdecimal.test @@ -611,7 +611,10 @@ select round(99999999999999999.999,3); select round(-99999999999999999.999,3); #-- should return -100000000000000000.000 # +#enable after fix MDEV-31729 +--disable_cursor_protocol select truncate(99999999999999999999999999999999999999,49); +--enable_cursor_protocol #-- should return 99999999999999999999999999999999999999.000 # select truncate(99.999999999999999999999999999999999999,49); @@ -1268,6 +1271,8 @@ let $nine_81= 999999999999999999999999999999999999999999999999999999999999999999999999999999999; eval SELECT substring(('M') FROM ($nine_81)) AS foo; +#enable after fix MDEV-31729 +--disable_cursor_protocol eval SELECT min($nine_81) AS foo; eval SELECT multipolygonfromtext(('4294967294.1'),($nine_81)) AS foo; eval SELECT convert(($nine_81), decimal(30,30)) AS foo; @@ -1279,6 +1284,7 @@ eval SELECT date_sub(($nine_81), day_minute) AS foo; eval SELECT truncate($nine_81, 28) AS foo; +--enable_cursor_protocol --echo End of 5.0 tests diff --git a/storage/tokudb/mysql-test/tokudb/t/type_temporal_fractional.test b/storage/tokudb/mysql-test/tokudb/t/type_temporal_fractional.test index 06794257969..00b3094f4dd 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_temporal_fractional.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_temporal_fractional.test @@ -1907,7 +1907,9 @@ SELECT * FROM t1 WHERE a=@a; SET @a=112233.123456e0; SELECT * FROM t1 WHERE a=@a; SET @a=NULL; +--disable_cursor_protocol SELECT a INTO @a FROM t1 LIMIT 1; +--enable_cursor_protocol SELECT @a; DROP TABLE t1; @@ -3896,7 +3898,9 @@ SELECT * FROM t1 WHERE a=@a; SET @a=0.123456e0; SELECT * FROM t1 WHERE a=@a; SET @a=NULL; +--disable_cursor_protocol SELECT a INTO @a FROM t1 LIMIT 1; +--enable_cursor_protocol SELECT @a; DROP TABLE t1; # MEMORY does not support BLOB @@ -5716,7 +5720,9 @@ SELECT @a; # Nothing is found, not enough precision for DOUBLE SELECT * FROM t1 WHERE a=@a; SET @a=NULL; +--disable_cursor_protocol SELECT a INTO @a FROM t1 LIMIT 1; +--enable_cursor_protocol SELECT @a; DROP TABLE t1; # MEMORY does not support BLOB diff --git a/storage/tokudb/mysql-test/tokudb/t/type_year.test b/storage/tokudb/mysql-test/tokudb/t/type_year.test index 048758268c8..6abb53156cf 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_year.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_year.test @@ -158,7 +158,10 @@ DROP TABLE t1; CREATE TABLE t1(c1 YEAR(4)); INSERT INTO t1 VALUES (1901),(2155),(0000); SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_A.test b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_A.test index f4a931dbe81..72b7aadf898 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_A.test +++ b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_A.test @@ -19,9 +19,11 @@ set @a = 32710; let $k = 200; while ($k) { + --disable_cursor_protocol SELECT @a + 1 into @a; SELECT rand(@a) * DEGREES(@a) into @b; SELECT FLOOR(MOD(@b,255)) into @c; + --enable_cursor_protocol SELECT @a, @b, @c; UPDATE t1 SET a = a + 1; UPDATE t1 SET b = repeat(hex(@c), rand(@c) * 550); diff --git a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_B.test b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_B.test index 96612a99804..725db98799b 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_B.test +++ b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_B.test @@ -19,9 +19,11 @@ set @a = 5510; let $k = 200; while ($k) { + --disable_cursor_protocol SELECT @a + 1 into @a; SELECT rand(@a) * DEGREES(@a) into @b; SELECT FLOOR(MOD(@b,255)) into @c; + --enable_cursor_protocol SELECT @a, @b, @c; UPDATE t1 SET a = a + 1; UPDATE t1 SET b = repeat(hex(@c), rand(@c) * 550); diff --git a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_C.test b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_C.test index 79f19c54d39..72fd4adfc9d 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_C.test +++ b/storage/tokudb/mysql-test/tokudb_add_index/t/falcon_bug_23818_C.test @@ -19,9 +19,11 @@ set @a = 28410; let $k = 200; while ($k) { + --disable_cursor_protocol SELECT @a + 1 into @a; SELECT rand(@a) * DEGREES(@a) into @b; SELECT FLOOR(MOD(@b,255)) into @c; + --enable_cursor_protocol SELECT @a, @b, @c; UPDATE t1 SET a = a + 1; UPDATE t1 SET b = repeat(hex(@c), rand(@c) * 550); From cb83ae210c2fbbaf25a85c1582e53b28d25a9590 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 19 Sep 2024 09:02:46 +0200 Subject: [PATCH 114/185] galera mtr suite: fixes for unstable tests --- mysql-test/suite/galera/t/MW-329.test | 2 +- mysql-test/suite/galera/t/galera_as_slave.test | 1 - mysql-test/suite/galera/t/galera_backup_stage.test | 2 +- mysql-test/suite/galera/t/galera_bf_kill_debug.test | 2 +- mysql-test/suite/galera/t/galera_parallel_simple.test | 2 +- mysql-test/suite/galera/t/galera_sst_mariabackup.cnf | 2 +- mysql-test/suite/galera/t/galera_var_reject_queries.test | 6 +----- ...l_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf | 6 +++--- mysql-test/suite/galera_sr/r/galera_sr_cc_master.result | 2 +- mysql-test/suite/galera_sr/t/galera_sr_cc_master.test | 6 +----- 10 files changed, 11 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test index 14e28a42df4..c70662e16b4 100644 --- a/mysql-test/suite/galera/t/MW-329.test +++ b/mysql-test/suite/galera/t/MW-329.test @@ -87,7 +87,7 @@ while ($count) --enable_query_log --connection node_1b ---error 0,2013,1317,2026 +--error 0,1317,2013,2026 --reap --enable_query_log --enable_result_log diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test index 859fe19c9bb..7a5bc1e204c 100644 --- a/mysql-test/suite/galera/t/galera_as_slave.test +++ b/mysql-test/suite/galera/t/galera_as_slave.test @@ -55,7 +55,6 @@ INSERT INTO t1 VALUES (4,1); --connection node_3 DROP TABLE t1; - --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test index 20ce6036d0d..9647d78a094 100644 --- a/mysql-test/suite/galera/t/galera_backup_stage.test +++ b/mysql-test/suite/galera/t/galera_backup_stage.test @@ -87,7 +87,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State = 'Commit' OR State='Waiting for certification') +--let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State = 'Commit' OR State='Waiting for certification') --source include/wait_condition.inc # nothing after BLOCK_DDL is applied diff --git a/mysql-test/suite/galera/t/galera_bf_kill_debug.test b/mysql-test/suite/galera/t/galera_bf_kill_debug.test index 1b7b3f40ac8..b8978cea11d 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill_debug.test +++ b/mysql-test/suite/galera/t/galera_bf_kill_debug.test @@ -131,7 +131,7 @@ SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached"; SET DEBUG_SYNC = "now SIGNAL bwoc_continue"; SET DEBUG_SYNC='RESET'; --connection node_2a ---error 0,1213 +--error 0,1213,2013,2026 --reap --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index 89adaf8cbd2..48171a1777e 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -51,7 +51,7 @@ SET SESSION wsrep_sync_wait = 0; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Commit'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE 'Commit' or STATE = 'Waiting for certification'); --source include/wait_condition.inc UNLOCK TABLES; diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 6cb80831d1f..8cb962cb95b 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -14,7 +14,7 @@ innodb_undo_tablespaces=0 wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' innodb_fast_shutdown=0 innodb_undo_tablespaces=3 -innodb_log_file_buffering +loose_innodb_log_file_buffering [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test index fb86b69d95a..6584eb1f736 100644 --- a/mysql-test/suite/galera/t/galera_var_reject_queries.test +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -5,10 +5,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -if (`select version() not like '10.10.3-%'`) { - skip disabled until new C/C; -} - CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 @@ -26,7 +22,7 @@ SELECT * FROM t1; # Original behavior was lost connection, # but since 10.1, we allow controlling connection to remain alive # ---error 0,2013 +--error 0,2013,2026 SET GLOBAL wsrep_reject_queries = ALL_KILL; --connection node_1a diff --git a/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf b/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf index ebe1d47f200..4c74375114f 100644 --- a/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf +++ b/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf @@ -1,10 +1,10 @@ !include ../galera_2nodes_as_master.cnf [mysqld.1] -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.2] -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.3] -innodb-log-file-buffering +loose-innodb-log-file-buffering diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result index 9b3d7a9e201..433cfa4e459 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result @@ -27,7 +27,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; connection node_2; INSERT INTO t1 VALUES (6); -ERROR HY000: Lost connection to server during query +Got one of the listed errors connection node_1; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test index 0db36165e59..563f115ecf1 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test @@ -1,10 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -if (`select version() not like '10.10.3-%'`) { - skip disabled until new C/C; -} - # # Test the effect of Cluster Configuration Change on a concurrently-running SR transaction # We use SET GLOBAL wsrep_cluster_address = '' to cause the master (node_2) to temporarily @@ -55,7 +51,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; --connection node_2 ---error 2013 # CR_SERVER_LOST +--error 2013,2026 INSERT INTO t1 VALUES (6); --connection node_1 From 68e968bc98074378bd5d14846f517954410dee19 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 19 Sep 2024 11:15:38 +0200 Subject: [PATCH 115/185] MDEV-30822: Adjust wsrep_sst_mariabackup.sh to understand both pre-MDEV-18931 and post-MDEV-18931 file naming This commit adds support for legacy names for files such as mariadb_backup_galera_info, mariadb_backup_checkpoints and mariabackup_binlog_info to allow upgrading from old to new server versions without stopping the galera cluster. --- scripts/wsrep_sst_mariabackup.sh | 67 ++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index ef5749419dd..73bcee75362 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -843,7 +843,13 @@ recv_joiner() done if [ $checkf -eq 1 ]; then - if [ ! -r "$MAGIC_FILE" ]; then + if [ -r "$MAGIC_FILE" ]; then + : + elif [ -r "$dir/xtrabackup_galera_info" ]; then + mv "$dir/xtrabackup_galera_info" "$MAGIC_FILE" + wsrep_log_info "the SST donor uses an old version" \ + "of mariabackup or xtrabackup" + else # this message should cause joiner to abort: wsrep_log_error "receiving process ended without creating" \ "magic file ($MAGIC_FILE)" @@ -1334,15 +1340,22 @@ else # joiner "$DATA" -mindepth 1 -prune -regex "$cpat" \ -o -exec rm -rf {} >&2 \+ - # Deleting files from previous SST and legacy files from old versions: + # Deleting legacy files from old versions: [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" [ -f "$DATA/xtrabackup_pid" ] && rm -f "$DATA/xtrabackup_pid" [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" - [ -f "$DATA/mariadb_backup_checkpoints" ] && rm -f "$DATA/mariadb_backup_checkpoints" [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" + [ -f "$DATA/xtrabackup_binlog_info" ] && rm -f "$DATA/xtrabackup_binlog_info" [ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb" + # Deleting files from previous SST: + [ -f "$DATA/mariadb_backup_checkpoints" ] && rm -f "$DATA/mariadb_backup_checkpoints" + [ -f "$DATA/mariadb_backup_info" ] && rm -f "$DATA/mariadb_backup_info" + [ -f "$DATA/mariadb_backup_slave_info" ] && rm -f "$DATA/mariadb_backup_slave_info" + [ -f "$DATA/mariadb_backup_binlog_info" ] && rm -f "$DATA/mariadb_backup_binlog_info" + [ -f "$DATA/mariadb_backup_binlog_pos_innodb" ] && rm -f "$DATA/mariadb_backup_binlog_pos_innodb" + TDATA="$DATA" DATA="$DATA/.sst" MAGIC_FILE="$DATA/$INFO_FILE" @@ -1351,6 +1364,44 @@ else # joiner monitor_process $BACKUP_PID BACKUP_PID="" + # It is possible that the old version of the galera + # information file will be transferred second time: + if [ ! -f "$DATA/$INFO_FILE" -a \ + -f "$DATA/xtrabackup_galera_info" ] + then + mv "$DATA/xtrabackup_galera_info" "$DATA/$INFO_FILE" + fi + + # Correcting the name of the common information file + # if the donor has an old version: + if [ ! -f "$DATA/mariadb_backup_info" -a \ + -f "$DATA/xtrabackup_info" ] + then + mv "$DATA/xtrabackup_info" "$DATA/mariadb_backup_info" + wsrep_log_info "general information file with a legacy" \ + "name has been renamed" + fi + + # Correcting the name for the file with the binlog position + # for the master if the donor has an old version: + if [ ! -f "$DATA/mariadb_backup_slave_info" -a \ + -f "$DATA/xtrabackup_slave_info" ] + then + mv "$DATA/xtrabackup_slave_info" "$DATA/mariadb_backup_slave_info" + wsrep_log_info "binlog position file with a legacy" \ + "name has been renamed" + fi + + # An old version of the donor may send a checkpoints + # list file under an outdated name: + if [ ! -f "$DATA/mariadb_backup_checkpoints" -a \ + -f "$DATA/xtrabackup_checkpoints" ] + then + mv "$DATA/xtrabackup_checkpoints" "$DATA/mariadb_backup_checkpoints" + wsrep_log_info "list of checkpoints with a legacy" \ + "name has been renamed" + fi + if [ ! -s "$DATA/mariadb_backup_checkpoints" ]; then wsrep_log_error "mariadb_backup_checkpoints missing," \ "failed mariadb-backup/SST on donor" @@ -1410,6 +1461,16 @@ else # joiner fi fi + # An old version of the donor may send a binary logs + # list file under an outdated name: + if [ ! -f "$DATA/mariadb_backup_binlog_info" -a \ + -f "$DATA/xtrabackup_binlog_info" ] + then + mv "$DATA/xtrabackup_binlog_info" "$DATA/mariadb_backup_binlog_info" + wsrep_log_info "list of binary logs with a legacy" \ + "name has been renamed" + fi + wsrep_log_info "Preparing the backup at $DATA" setup_commands timeit 'mariadb-backup prepare stage' "$INNOAPPLY" From 841dc07ee112cc7a7a790690e94f4ea119af9c1e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 20 Sep 2024 09:23:33 +0400 Subject: [PATCH 116/185] MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT The code in my_strntoull_8bit() and my_strntoull_mb2_or_mb4() could hit undefinite behavior by negating of LONGLONG_MIN. Fixing the code to avoid this. --- mysql-test/main/ctype_ucs.result | 9 +++++++++ mysql-test/main/ctype_ucs.test | 9 +++++++++ mysql-test/main/func_str.result | 13 +++++++++++++ mysql-test/main/func_str.test | 13 +++++++++++++ strings/ctype-simple.c | 5 ++++- strings/ctype-ucs2.c | 5 ++++- 6 files changed, 52 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 887c01df7e9..a603d07b08a 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -6540,5 +6540,14 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +DROP TABLE t1; +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index 7144f0af5cc..bf967ba7619 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -1217,6 +1217,15 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.5 tests diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 52bfd3f0e3e..7aa248bffd4 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5317,5 +5317,18 @@ SELECT SUBSTR(0,@a) FROM t; SUBSTR(0,@a) DROP TABLE t; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +SELECT BIN(c) FROM t1; +BIN(c) +1000000000000000000000000000000000000000000000000000000000000000 +DROP TABLE t1; +DO OCT(-9223372036854775808); +# # End of 10.5 tests # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 3c9360a9c40..952d061c30f 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -2358,6 +2358,19 @@ CREATE TABLE t (c1 INT,c2 CHAR); SELECT SUBSTR(0,@a) FROM t; DROP TABLE t; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +SELECT BIN(c) FROM t1; +DROP TABLE t1; + +DO OCT(-9223372036854775808); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index a50c570ec6b..d40e3abdcc5 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -758,7 +758,10 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, return (~(ulonglong) 0); } - return (negative ? -((longlong) i) : (longlong) i); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) i != LONGLONG_MIN ? + -((longlong) i) : + (longlong) i; noconv: err[0]= EDOM; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d1ca32a8e62..fb33d8cc764 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -616,7 +616,10 @@ bs: return (~(ulonglong) 0); } - return (negative ? -((longlong) res) : (longlong) res); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) res != LONGLONG_MIN ? + -((longlong) res) : + (longlong) res; } From 9ac8172ac386c6506be3624121d672ec042c4ce2 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 20 Sep 2024 11:47:56 +0400 Subject: [PATCH 117/185] MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 The code in my_strtoll10_mb2 and my_strtoll10_utf32 could hit undefinite behavior by negation of LONGLONG_MIN. Fixing to avoid this. Also, fixing my_strtoll10() in the same style. The previous reduction produced a redundant warning on CAST(_latin1'-9223372036854775808' AS SIGNED) --- mysql-test/main/ctype_latin1.result | 6 ++++++ mysql-test/main/ctype_latin1.test | 7 +++++++ mysql-test/main/ctype_ucs.result | 6 ++++++ mysql-test/main/ctype_ucs.test | 5 +++++ mysql-test/main/ctype_utf32.result | 9 +++++++++ mysql-test/main/ctype_utf32.test | 11 +++++++++++ strings/ctype-ucs2.c | 4 ++++ strings/my_strtoll10.c | 4 +++- 8 files changed, 51 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 4548c076c1b..7ebfcea6e90 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -8975,5 +8975,11 @@ CAST(_latin1 0x61FF62 AS INT) Warnings: Warning 1292 Truncated incorrect INTEGER value: 'aÿb' # +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test index b00dc374a05..6b3d2dd744f 100644 --- a/mysql-test/main/ctype_latin1.test +++ b/mysql-test/main/ctype_latin1.test @@ -501,6 +501,13 @@ SELECT CAST(_latin1 0x617E62 AS INT); SELECT CAST(_latin1 0x61FF62 AS INT); +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index a603d07b08a..de73f41c5a7 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -6549,5 +6549,11 @@ OCT(c) 1000000000000000000000 DROP TABLE t1; # +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index bf967ba7619..84ee8c5387c 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -1226,6 +1226,11 @@ INSERT INTO t1 VALUES ('-9223372036854775808.5'); SELECT OCT(c) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; --echo # --echo # End of 10.5 tests diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 46a8a5fed0f..546a7415603 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -3024,3 +3024,12 @@ HEX(DATE_FORMAT(TIME'11:22:33',@format)) # # End of 10.4 tests # +# +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# +# End of 10.5 tests +# diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index f35a94e909c..4a1f27260c6 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -1162,3 +1162,14 @@ SELECT HEX(DATE_FORMAT(TIME'11:22:33',@format)); --echo # --enable_service_connection + + +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index fb33d8cc764..99f4f73ff78 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1011,6 +1011,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; @@ -2574,6 +2576,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 74baef080eb..6c4ccea0b21 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -241,8 +241,10 @@ end4: *endptr= (char*) s; if (negative) { - if (li >= MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; From 607fc153939fd6314dcde60d565cfd20676a01f9 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 20 Sep 2024 14:10:27 +0400 Subject: [PATCH 118/185] MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) The code erroneously called sec_since_epoch() for dates with zeros, e.g. '2024-00-01'. Fixi: adding a test that the date does not have zeros before calling TIME_to_native(). --- mysql-test/main/func_time.result | 11 +++++++++++ mysql-test/main/func_time.test | 11 +++++++++++ sql/sql_type.cc | 1 + 3 files changed, 23 insertions(+) diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index eaf30f5f925..3982342b4c5 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6425,5 +6425,16 @@ Warning 1292 Truncated incorrect time value: '8390000' Warning 1292 Truncated incorrect time value: '8390000' SET @@timestamp= DEFAULT; # +# MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +# +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +a +NULL +SET @@time_zone=DEFAULT; +DROP TABLE t1; +# # End of 10.5 tests # diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 51b2722d7a0..25a7e31b54d 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -3262,6 +3262,17 @@ SELECT SET @@timestamp= DEFAULT; +--echo # +--echo # MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +--echo # + +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +SET @@time_zone=DEFAULT; +DROP TABLE t1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 44475e29bcc..98abf154db4 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -9182,6 +9182,7 @@ Type_handler_timestamp_common::Item_val_native_with_conversion(THD *thd, Datetime dt(thd, item, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)); return !dt.is_valid_datetime() || + dt.check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE) || TIME_to_native(thd, dt.get_mysql_time(), to, item->datetime_precision(thd)); } From 681609d8a045d98a5458dd72e7a6ef87d4298ccb Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 20 Sep 2024 15:07:39 +0400 Subject: [PATCH 119/185] MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal Fixing the wrong assert. --- mysql-test/main/func_extract.result | 8 ++++++++ mysql-test/main/func_extract.test | 7 +++++++ sql-common/my_time.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result index dc71f6ae27a..7c1fd5009ca 100644 --- a/mysql-test/main/func_extract.result +++ b/mysql-test/main/func_extract.result @@ -1470,5 +1470,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; # +# MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +# +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); +EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1') +NULL +Warnings: +Warning 1292 Incorrect interval value: '42949672955000x1' +# # End of 10.5 tests # diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test index dd808443f58..6167780b9bf 100644 --- a/mysql-test/main/func_extract.test +++ b/mysql-test/main/func_extract.test @@ -511,6 +511,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; +--echo # +--echo # MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +--echo # + +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql-common/my_time.c b/sql-common/my_time.c index eff39cd5eae..2f74235614c 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -961,7 +961,7 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length, { /* String given as one number; assume HHMMSS format */ date[0]= 0; - DBUG_ASSERT(value <= ((ulonglong) UINT_MAX32) * 10000ULL); + DBUG_ASSERT(value / 10000 <= ((ulonglong) UINT_MAX32)); date[1]= (ulong) (value/10000); date[2]= (ulong) (value/100 % 100); date[3]= (ulong) (value % 100); From 9ea7f7129a568049fa54131cc790350a19f4bd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Sep 2024 15:29:56 +0300 Subject: [PATCH 120/185] MDEV-34909 DDL hang during SET GLOBAL innodb_log_file_size on PMEM log_t::persist(): Add a parameter holding_latch to specify whether the caller is already holding exclusive log_sys.latch, like log_write_and_flush() always is. --- storage/innobase/include/log0log.h | 5 +++-- storage/innobase/log/log0log.cc | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 17743baceb0..cb45f931262 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -452,8 +452,9 @@ public: #ifdef HAVE_PMEM /** Persist the log. - @param lsn desired new value of flushed_to_disk_lsn */ - inline void persist(lsn_t lsn) noexcept; + @param lsn desired new value of flushed_to_disk_lsn + @param holding_latch whether the caller is holding exclusive latch */ + void persist(lsn_t lsn, bool holding_latch) noexcept; #endif bool check_for_checkpoint() const diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 683b5853944..4ec43a81531 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -730,21 +730,22 @@ static size_t log_pad(lsn_t lsn, size_t pad, byte *begin, byte *extra) #endif #ifdef HAVE_PMEM -/** Persist the log. -@param lsn desired new value of flushed_to_disk_lsn */ -inline void log_t::persist(lsn_t lsn) noexcept +void log_t::persist(lsn_t lsn, bool holding_latch) noexcept { ut_ad(is_pmem()); ut_ad(!write_lock.is_owner()); ut_ad(!flush_lock.is_owner()); +#ifdef LOG_LATCH_DEBUG + ut_ad(holding_latch == latch_have_wr()); +#endif lsn_t old= flushed_to_disk_lsn.load(std::memory_order_relaxed); if (old >= lsn) return; - const lsn_t resizing{resize_in_progress()}; - if (UNIV_UNLIKELY(resizing)) + const bool latching{!holding_latch && resize_in_progress()}; + if (UNIV_UNLIKELY(latching)) latch.rd_lock(SRW_LOCK_CALL); const size_t start(calc_lsn_offset(old)); const size_t end(calc_lsn_offset(lsn)); @@ -771,7 +772,7 @@ inline void log_t::persist(lsn_t lsn) noexcept DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE();); } - if (UNIV_UNLIKELY(resizing)) + if (UNIV_UNLIKELY(latching)) latch.rd_unlock(); } #endif @@ -976,7 +977,7 @@ void log_write_up_to(lsn_t lsn, bool durable, { ut_ad(!callback); if (durable) - log_sys.persist(lsn); + log_sys.persist(lsn, false); return; } #endif @@ -1043,7 +1044,7 @@ ATTRIBUTE_COLD void log_write_and_flush() } #ifdef HAVE_PMEM else - log_sys.persist(log_sys.get_lsn()); + log_sys.persist(log_sys.get_lsn(), true); #endif } From 35d477dd1dff464bd80dff9efe83884ce1c38e4c Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Wed, 18 Sep 2024 21:56:28 +0530 Subject: [PATCH 121/185] MDEV-34453 Trying to read 16384 bytes at 70368744161280 outside the bounds of the file: ./ibdata1 The issue is caused by a race between buf_page_create_low getting the page from buffer pool hash and buf_LRU_free_page evicting it from LRU. The issue is introduced in 10.6 by MDEV-27058 commit aaef2e1d8c843d1e40b1ce0c5199c3abb3c5da28 MDEV-27058: Reduce the size of buf_block_t and buf_page_t The solution is buffer fix the page before releasing buffer pool mutex in buf_page_create_low when x_lock_try fails to acquire the page latch. --- mysql-test/suite/stress/t/ddl_innodb.test | 14 ++++++++++ storage/innobase/buf/buf0buf.cc | 31 ++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test index d5e23124b4b..79414a36a2a 100644 --- a/mysql-test/suite/stress/t/ddl_innodb.test +++ b/mysql-test/suite/stress/t/ddl_innodb.test @@ -1,4 +1,5 @@ --source include/no_valgrind_without_big.inc +--source include/maybe_debug.inc ######## t/ddl_innodb.test ###### # # Stress the storage engine InnoDB with CREATE/DROP TABLE/INDEX @@ -34,6 +35,13 @@ if (!$run) ##### Some preparations needed for the ddl*.inc scripts --source suite/stress/include/ddl.pre +if ($have_debug) { + --disable_query_log + SET @old_debug_dbug = @@global.debug_dbug; + SET DEBUG_DBUG="+d,ib_buf_create_intermittent_wait"; + --enable_query_log +} + --source suite/stress/include/ddl1.inc --source suite/stress/include/ddl2.inc --source suite/stress/include/ddl3.inc @@ -43,5 +51,11 @@ if (!$run) --source suite/stress/include/ddl7.inc --source suite/stress/include/ddl8.inc +if ($have_debug) { + --disable_query_log + SET @@global.debug_dbug = @old_debug_dbug; + --enable_query_log +} + ##### Cleanup --source suite/stress/include/ddl.cln diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 7796d1dfa00..dcebd9414ba 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3289,22 +3289,47 @@ retry: if (!mtr->have_x_latch(reinterpret_cast(*bpage))) { - const bool got= bpage->lock.x_lock_try(); - if (!got) + /* Buffer-fix the block to prevent the block being concurrently freed + after we release the buffer pool mutex. It should work fine with + concurrent load of the page (free on disk) to buffer pool due to + possible read ahead. After we find a zero filled page during load, we + call buf_pool_t::corrupted_evict, where we try to wait for all buffer + fixes to go away only after resetting the page ID and releasing the + page latch. */ + auto state= bpage->fix(); + DBUG_EXECUTE_IF("ib_buf_create_intermittent_wait", { + static bool need_to_wait = false; + need_to_wait = !need_to_wait; + /* Simulate try lock failure in every alternate call. */ + if (need_to_wait) { + goto must_wait; + } + }); + + if (!bpage->lock.x_lock_try()) + { +#ifndef DBUG_OFF + must_wait: +#endif mysql_mutex_unlock(&buf_pool.mutex); + bpage->lock.x_lock(); const page_id_t id{bpage->id()}; if (UNIV_UNLIKELY(id != page_id)) { ut_ad(id.is_corrupted()); + ut_ad(bpage->is_freed()); + bpage->unfix(); bpage->lock.x_unlock(); goto retry; } mysql_mutex_lock(&buf_pool.mutex); + state= bpage->state(); + ut_ad(!bpage->is_io_fixed(state)); + ut_ad(bpage->buf_fix_count(state)); } - auto state= bpage->fix(); ut_ad(state >= buf_page_t::FREED); ut_ad(state < buf_page_t::READ_FIX); From ac5cbaff669359f8271d3892da6d220f69da7383 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 13 Sep 2024 13:07:47 +1000 Subject: [PATCH 122/185] Aria - correct type Aria transaction ids are uint16 rather than uint. Change the type to be more accurate. --- storage/maria/ma_loghandler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index ffbcfecae95..9596be54179 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -6392,7 +6392,7 @@ my_bool translog_write_record(LSN *lsn, struct st_translog_parts parts; LEX_CUSTRING *part; int rc; - uint short_trid= trn->short_id; + SHORT_TRANSACTION_ID short_trid= trn->short_id; DBUG_ENTER("translog_write_record"); DBUG_PRINT("enter", ("type: %u (%s) ShortTrID: %u rec_len: %lu", (uint) type, log_record_type_descriptor[type].name, From 71649b93cf87fbd56371fb466ff4b85298938af0 Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Fri, 20 Sep 2024 19:53:56 +0700 Subject: [PATCH 123/185] MDEV-31933: Make working view-protocol + ps-protocol (running two protocols together) Fix for v. 10.6 --- mysql-test/main/subselect.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 1d42bcb3a84..4c33b9b06ef 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -5780,9 +5780,12 @@ DROP TABLE t1; CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM; INSERT INTO t1 VALUES ('u1'),('u2'); +#Check and enable after fix MDEV-34895 +--disable_ps2_protocol SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) ); FLUSH TABLES; SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) ); +--enable_ps2_protocol # Cleanup DROP TABLE t1; From 638c62acac25200aa87f1a10f4b146e9c1fe9ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 23 Sep 2024 12:51:27 +0300 Subject: [PATCH 124/185] MDEV-34983: Remove x86 asm from InnoDB Starting with GCC 7 and clang 15, single-bit operations such as fetch_or(1) & 1 are translated into 80386 instructions such as LOCK BTS, instead of using the generic translation pattern of emitting a loop around LOCK CMPXCHG. Given that the oldest currently supported GNU/Linux distributions ship GCC 7, and that older versions of GCC are out of support, let us remove some work-arounds that are not strictly necessary. If someone compiles the code using an older compiler, it will work but possibly less efficiently. srw_mutex_impl::HOLDER: Changed from 1U<<31 to 1 in order to work around https://github.com/llvm/llvm-project/issues/37322 which is specific to setting the most significant bit. srw_mutex_impl::WAITER: A multiplier of waiting requests. This used to be 1, which would now collide with HOLDER. fil_space_t::set_stopping(): Remove this unused function. In MSVC we need _interlockedbittestandset() for LOCK BTS. --- storage/innobase/include/fil0fil.h | 36 --------------- storage/innobase/include/rw_lock.h | 8 ---- storage/innobase/include/srw_lock.h | 27 +++++++---- storage/innobase/include/trx0rseg.h | 14 ------ storage/innobase/include/trx0trx.h | 16 ------- storage/innobase/sync/srw_lock.cc | 71 ++++++++++------------------- 6 files changed, 42 insertions(+), 130 deletions(-) diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 1be1126f071..ecdd386ffc1 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -528,9 +528,6 @@ public: /** Close each file. Only invoked on fil_system.temp_space. */ void close(); - /** Note that operations on the tablespace must stop. */ - inline void set_stopping(); - /** Drop the tablespace and wait for any pending operations to cease @param id tablespace identifier @param detached_handle pointer to file to be closed later, or nullptr @@ -589,32 +586,14 @@ public: /** Clear the NEEDS_FSYNC flag */ void clear_flush() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - __asm__ __volatile__("lock btrl $28, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 28); -#else n_pending.fetch_and(~NEEDS_FSYNC, std::memory_order_release); -#endif } private: /** Clear the CLOSING flag */ void clear_closing() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(CLOSING == 1U << 29, "compatibility"); - __asm__ __volatile__("lock btrl $29, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(CLOSING == 1U << 29, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 29); -#else n_pending.fetch_and(~CLOSING, std::memory_order_relaxed); -#endif } /** @return pending operations (and flags) */ @@ -1605,21 +1584,6 @@ inline void fil_space_t::reacquire() #endif /* SAFE_MUTEX */ } -/** Note that operations on the tablespace must stop. */ -inline void fil_space_t::set_stopping() -{ - mysql_mutex_assert_owner(&fil_system.mutex); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&n_pending), 30); -#else - n_pending.fetch_or(STOPPING_WRITES, std::memory_order_relaxed); -#endif -} - /** Flush pending writes from the file system cache to the file. */ template inline void fil_space_t::flush() { diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index 4881f2f1d35..ecd994dbbcb 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -39,15 +39,7 @@ protected: /** Start waiting for an exclusive lock. */ void write_lock_wait_start() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (lock)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&lock), 30); -#else lock.fetch_or(WRITER_WAITING, std::memory_order_relaxed); -#endif } /** Start waiting for an exclusive lock. @return current value of the lock word */ diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 3f0fc997fbf..a601d09c91a 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -92,11 +92,13 @@ template class srw_mutex_impl final { friend ssux_lock_impl; - /** The lock word, containing HOLDER + 1 if the lock is being held, - plus the number of waiters */ + /** The lock word, containing HOLDER + WAITER if the lock is being held, + plus WAITER times the number of waiters */ std::atomic lock; /** Identifies that the lock is being held */ - static constexpr uint32_t HOLDER= 1U << 31; + static constexpr uint32_t HOLDER= 1; + /** Identifies a lock waiter */ + static constexpr uint32_t WAITER= 2; #ifdef SUX_LOCK_GENERIC public: @@ -144,7 +146,7 @@ public: bool wr_lock_try() { uint32_t lk= 0; - return lock.compare_exchange_strong(lk, HOLDER + 1, + return lock.compare_exchange_strong(lk, HOLDER + WAITER, std::memory_order_acquire, std::memory_order_relaxed); } @@ -152,8 +154,9 @@ public: void wr_lock() { if (!wr_lock_try()) wait_and_lock(); } void wr_unlock() { - const uint32_t lk= lock.fetch_sub(HOLDER + 1, std::memory_order_release); - if (lk != HOLDER + 1) + const uint32_t lk= + lock.fetch_sub(HOLDER + WAITER, std::memory_order_release); + if (lk != HOLDER + WAITER) { DBUG_ASSERT(lk & HOLDER); wake(); @@ -269,10 +272,14 @@ public: { writer.wr_lock(); #if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 - /* On IA-32 and AMD64, this type of fetch_or() can only be implemented - as a loop around LOCK CMPXCHG. In this particular case, setting the - most significant bit using fetch_add() is equivalent, and is - translated into a simple LOCK XADD. */ + /* On IA-32 and AMD64, a fetch_XXX() that needs to return the + previous value of the word state can only be implemented + efficiently for fetch_add() or fetch_sub(), both of which + translate into a 80486 LOCK XADD instruction. Anything else would + translate into a loop around LOCK CMPXCHG. In this particular + case, we know that the bit was previously clear, and therefore + setting (actually toggling) the most significant bit using + fetch_add() or fetch_sub() is equivalent. */ static_assert(WRITER == 1U << 31, "compatibility"); if (uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire)) wr_wait(lk); diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 24ba845271d..96f8d64eb66 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -85,26 +85,12 @@ private: /** Set the SKIP bit */ void ref_set_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandset(reinterpret_cast(&ref), 0); -#else ref.fetch_or(SKIP, std::memory_order_relaxed); -#endif } /** Clear a bit in ref */ void ref_reset_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset(reinterpret_cast(&ref), 0); -#else ref.fetch_and(~SKIP, std::memory_order_relaxed); -#endif } public: diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 361d58f5663..8cd5996136f 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -345,15 +345,7 @@ struct trx_lock_t /** Flag the lock owner as a victim in Galera conflict resolution. */ void set_wsrep_victim() { -# if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - /* There is no 8-bit version of the 80386 BTS instruction. - Technically, this is the wrong addressing mode (16-bit), but - there are other data members stored after the byte. */ - __asm__ __volatile__("lock btsw $1, %0" - : "+m" (was_chosen_as_deadlock_victim)); -# else was_chosen_as_deadlock_victim.fetch_or(2); -# endif } #else /* defined(UNIV_DEBUG) || !defined(DBUG_OFF) */ @@ -1038,15 +1030,7 @@ public: void reset_skip_lock_inheritance() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__("lock btrl $31, %0" : : "m"(skip_lock_inheritance_and_n_ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset( - reinterpret_cast(&skip_lock_inheritance_and_n_ref), - 31); -#else skip_lock_inheritance_and_n_ref.fetch_and(~1U << 31); -#endif } /** @return whether the table has lock on diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index eac3db19152..71e3303736d 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -269,44 +269,10 @@ template void ssux_lock_impl::wake(); template void srw_mutex_impl::wake(); template void ssux_lock_impl::wake(); -/* - -Unfortunately, compilers targeting IA-32 or AMD64 currently cannot -translate the following single-bit operations into Intel 80386 instructions: - - m.fetch_or(1<(&mem), bit)) \ - goto label; -# define IF_NOT_FETCH_OR_GOTO(mem, bit, label) \ - if (!_interlockedbittestandset(reinterpret_cast(&mem), bit))\ - goto label; -#endif - template void srw_mutex_impl::wait_and_lock() { - uint32_t lk= 1 + lock.fetch_add(1, std::memory_order_relaxed); + uint32_t lk= WAITER + lock.fetch_add(WAITER, std::memory_order_relaxed); if (spinloop) { @@ -318,10 +284,16 @@ void srw_mutex_impl::wait_and_lock() lk= lock.load(std::memory_order_relaxed); if (!(lk & HOLDER)) { -#ifdef IF_NOT_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_NOT_FETCH_OR_GOTO(*this, 31, acquired); - lk|= HOLDER; +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 + lk |= HOLDER; +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (!_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (!(lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER)) +# endif + goto acquired; #else if (!((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER)) goto acquired; @@ -339,16 +311,22 @@ void srw_mutex_impl::wait_and_lock() if (lk & HOLDER) { wait(lk); -#ifdef IF_FETCH_OR_GOTO +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 reload: #endif lk= lock.load(std::memory_order_relaxed); } else { -#ifdef IF_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_FETCH_OR_GOTO(*this, 31, reload); +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER) +# endif + goto reload; #else if ((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER) continue; @@ -416,7 +394,8 @@ void ssux_lock_impl::rd_wait() /* Subscribe to writer.wake() or write.wake_all() calls by concurrently executing rd_wait() or writer.wr_unlock(). */ - uint32_t wl= 1 + writer.lock.fetch_add(1, std::memory_order_acquire); + uint32_t wl= writer.WAITER + + writer.lock.fetch_add(writer.WAITER, std::memory_order_acquire); for (;;) { @@ -440,13 +419,13 @@ void ssux_lock_impl::rd_wait() } /* Unsubscribe writer.wake() and writer.wake_all(). */ - wl= writer.lock.fetch_sub(1, std::memory_order_release); + wl= writer.lock.fetch_sub(writer.WAITER, std::memory_order_release); ut_ad(wl); /* Wake any other threads that may be blocked in writer.wait(). All other waiters than this rd_wait() would end up acquiring writer.lock and waking up other threads on unlock(). */ - if (wl > 1) + if (wl > writer.WAITER) writer.wake_all(); } From 99837b6df676665f27f758efec740966e1acd30c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 18 Sep 2024 20:54:38 +0200 Subject: [PATCH 125/185] restore --clent-rr after 7d86751de56 --- mysql-test/mysql-test-run.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7127bedffdc..83d5fe088f8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5531,11 +5531,12 @@ sub start_check_testcase ($$$) { } my $errfile= "$opt_vardir/tmp/$name.err"; - My::Debugger::setup_client_args(\$args, \$exe_mysqltest); + my $exe= $exe_mysqltest; + My::Debugger::setup_client_args(\$args, \$exe); my $proc= My::SafeProcess->new ( name => $name, - path => $exe_mysqltest, + path => $exe, error => $errfile, output => $errfile, args => \$args, From bbc62b1b9ee93cd54301b6762aed31805691057b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 6 Sep 2024 19:09:02 +0200 Subject: [PATCH 126/185] clarify --thread-pool-mode usage --- mysql-test/main/mysqld--help,win.rdiff | 25 ++++++++++++++----------- sql/sys_vars.cc | 3 ++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index bcfefbab1a8..07b7c87b5d4 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,4 +1,6 @@ -@@ -180,6 +180,7 @@ +--- a/mysql-test/main/mysqld--help.result ++++ b/mysql-test/main/mysqld--help.result +@@ -180,6 +180,7 @@ The following specify which files/extra groups are read (specified before remain --console Write error output on screen; don't remove the console window on windows. --core-file Write core on crashes @@ -6,7 +8,7 @@ -h, --datadir=name Path to the database root directory --date-format=name The DATE format (ignored) --datetime-format=name -@@ -650,6 +651,7 @@ +@@ -649,6 +650,7 @@ The following specify which files/extra groups are read (specified before remain Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -14,7 +16,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1281,6 +1283,10 @@ +@@ -1280,6 +1282,10 @@ The following specify which files/extra groups are read (specified before remain Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -25,7 +27,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1305,6 +1311,7 @@ +@@ -1304,6 +1310,7 @@ The following specify which files/extra groups are read (specified before remain deleting or updating every row in a table. --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) @@ -33,19 +35,20 @@ --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1380,6 +1387,11 @@ +@@ -1379,6 +1386,12 @@ The following specify which files/extra groups are read (specified before remain --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool + --thread-pool-min-threads=# + Minimum number of threads in the thread pool. + --thread-pool-mode=name -+ Chose implementation of the threadpool. One of: windows, -+ generic ++ Chose implementation of the threadpool. Use 'windows' ++ unless you have a workload with a lot of concurrent ++ connections and minimal contention --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed. -@@ -1418,8 +1430,8 @@ +@@ -1417,8 +1430,8 @@ The following specify which files/extra groups are read (specified before remain automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -56,7 +59,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1634,6 +1646,7 @@ +@@ -1633,6 +1646,7 @@ myisam-sort-buffer-size 134216704 myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -64,7 +67,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1788,6 +1801,7 @@ +@@ -1787,6 +1801,7 @@ slave-transaction-retry-interval 0 slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -72,7 +75,7 @@ sort-buffer-size 2097152 sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-safe-updates FALSE -@@ -1814,6 +1828,8 @@ +@@ -1813,6 +1828,8 @@ thread-pool-dedicated-listener FALSE thread-pool-exact-stats FALSE thread-pool-idle-timeout 60 thread-pool-max-threads 65536 diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 2a6d0a52cfd..0af4b5e27fc 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3947,7 +3947,8 @@ static Sys_var_on_access_global Sys_threadpool_mode( "thread_pool_mode", - "Chose implementation of the threadpool", + "Chose implementation of the threadpool. Use 'windows' unless you have a " + "workload with a lot of concurrent connections and minimal contention", READ_ONLY GLOBAL_VAR(threadpool_mode), CMD_LINE(REQUIRED_ARG), threadpool_mode_names, DEFAULT(TP_MODE_WINDOWS) ); From c9f54e20d4f25f80724c5254898004d6760b0f6b Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 19 Sep 2024 10:55:25 +0200 Subject: [PATCH 127/185] MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as Connection_errors_internal Bring info about cause of closing connection in the place where we increment statistics to do it correctly. --- mysql-test/main/connect.result | 30 +++++++++++++++++++++++++++++ mysql-test/main/connect.test | 35 ++++++++++++++++++++++++++++++++++ sql/sql_connect.cc | 16 +++++++++++----- sql/sql_connect.h | 2 +- sql/threadpool_common.cc | 4 ++-- 5 files changed, 79 insertions(+), 8 deletions(-) diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index 229c2d9dafe..fb63b2d5175 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -444,3 +444,33 @@ FOUND 2 /This connection closed normally without authentication/ in mysqld.1.err SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; # End of 10.4 tests +# +# MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +# Connection_errors_internal +# +flush status; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 0 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set @max_con.save= @@max_connections; +set global max_connections= 10; +# ERROR 1040 +# ERROR 1040 +connection default; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 2 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set global max_connections= @max_con.save; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index b115e0620ec..9a121384d6e 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -508,3 +508,38 @@ SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +--echo # Connection_errors_internal +--echo # + +flush status; + +show global status like 'Connection_errors%'; + +set @max_con.save= @@max_connections; +set global max_connections= 10; + +--disable_result_log +--disable_query_log +--let $n= 12 +while ($n) +{ + --error 0,ER_CON_COUNT_ERROR + --connect (con$n,localhost,root) + if ($mysql_errno) { + --echo # ERROR $mysql_errno + } + --dec $n +} + +--enable_result_log +--enable_query_log +--connection default +show global status like 'Connection_errors%'; +set global max_connections= @max_con.save; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index b371e27eb3a..824f68890c0 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1362,7 +1362,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) THD *thd; if (!(thd= connect->create_thd(NULL))) { - connect->close_and_delete(); + connect->close_and_delete(0); return; } @@ -1437,7 +1437,7 @@ end_thread: if (!(connect->create_thd(thd))) { /* Out of resources. Free thread to get more resources */ - connect->close_and_delete(); + connect->close_and_delete(0); break; } delete connect; @@ -1466,9 +1466,11 @@ end_thread: Close connection without error and delete the connect object This and close_with_error are only called if we didn't manage to create a new thd object. + + Note: err can be 0 if unknown/not inportant */ -void CONNECT::close_and_delete() +void CONNECT::close_and_delete(uint err) { DBUG_ENTER("close_and_delete"); @@ -1482,7 +1484,11 @@ void CONNECT::close_and_delete() vio_type= VIO_CLOSED; --*scheduler->connection_count; - statistic_increment(connection_errors_internal, &LOCK_status); + + if (err == ER_CON_COUNT_ERROR) + statistic_increment(connection_errors_max_connection, &LOCK_status); + else + statistic_increment(connection_errors_internal, &LOCK_status); statistic_increment(aborted_connects,&LOCK_status); delete this; @@ -1506,7 +1512,7 @@ void CONNECT::close_with_error(uint sql_errno, delete thd; set_current_thd(0); } - close_and_delete(); + close_and_delete(close_error); } diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 8be6c1aecc0..ed8c0fb8753 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -61,7 +61,7 @@ public: count--; DBUG_ASSERT(vio_type == VIO_CLOSED); } - void close_and_delete(); + void close_and_delete(uint err); void close_with_error(uint sql_errno, const char *message, uint close_error); THD *create_thd(THD *thd); diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 68875fb3a44..7c800696344 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -241,7 +241,7 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) if (!mysys_var ||!(thd= connect->create_thd(NULL))) { /* Out of memory? */ - connect->close_and_delete(); + connect->close_and_delete(0); if (mysys_var) my_thread_end(); return NULL; @@ -417,7 +417,7 @@ static void tp_add_connection(CONNECT *connect) if (c) pool->add(c); else - connect->close_and_delete(); + connect->close_and_delete(0); } int tp_get_idle_thread_count() From 231900e5bb15e5d6d90b8a6daf38a0b21d1a19e7 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 9 Sep 2024 13:30:42 +0300 Subject: [PATCH 128/185] MDEV-34836: TOI on parent table must BF abort SR in progress on a child Applied SR transaction on the child table was not BF aborted by TOI running on the parent table for several reasons: Although SR correctly collected FK-referenced keys to parent, TOI in Galera disregards common certification index and simply sets itself to depend on the latest certified write set seqno. Since this write set was the fragment of SR transaction, TOI was allowed to run in parallel with SR presuming it would BF abort the latter. At the same time, DML transactions in the server don't grab MDL locks on FK-referenced tables, thus parent table wasn't protected by an MDL lock from SR and it couldn't provoke MDL lock conflict for TOI to BF abort SR transaction. In InnoDB, DDL transactions grab shared MDL locks on child tables, which is not enough to trigger MDL conflict in Galera. InnoDB-level Wsrep patch didn't contain correct conflict resolution logic due to the fact that it was believed MDL locking should always produce conflicts correctly. The fix brings conflict resolution rules similar to MDL-level checks to InnoDB, thus accounting for the problematic case. Apart from that, wsrep_thd_is_SR() is patched to return true only for executing SR transactions. It should be safe as any other SR state is either the same as for any single write set (thus making the two logically equivalent), or it reflects an SR transaction as being aborting or prepared, which is handled separately in BF-aborting logic, and for regular execution path it should not matter at all. Signed-off-by: Julius Goryavsky --- include/mysql/service_wsrep.h | 2 +- .../suite/galera_sr/r/MDEV-34836.result | 23 +++ mysql-test/suite/galera_sr/t/MDEV-34836.test | 56 ++++++ sql/service_wsrep.cc | 3 +- storage/innobase/lock/lock0lock.cc | 160 ++++++++++-------- 5 files changed, 171 insertions(+), 73 deletions(-) create mode 100644 mysql-test/suite/galera_sr/r/MDEV-34836.result create mode 100644 mysql-test/suite/galera_sr/t/MDEV-34836.test diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index a0d0a338a0e..cf94364c1cf 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -209,7 +209,7 @@ extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd); extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd); /* Return true if thd is in BF mode, either high_priority or TOI */ extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync); -/* Return true if thd is streaming */ +/* Return true if thd is streaming in progress */ extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd); extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd); /* Return thd retry counter */ diff --git a/mysql-test/suite/galera_sr/r/MDEV-34836.result b/mysql-test/suite/galera_sr/r/MDEV-34836.result new file mode 100644 index 00000000000..10d302c415f --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-34836.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk +FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); +connection node_1; +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +COUNT(*) +0 +ALTER TABLE parent AUTO_INCREMENT = 100; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE child, parent; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-34836.test b/mysql-test/suite/galera_sr/t/MDEV-34836.test new file mode 100644 index 00000000000..840ebaede4c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-34836.test @@ -0,0 +1,56 @@ +# +# MDEV-34836: TOI transaction on FK-referenced parent table must BF abort +# SR transaction in progress on a child table. +# +# Applied SR transaction on the child table was not BF aborted by TOI running +# on the parent table for several reasons: +# Although SR correctly collected FK-referenced keys to parent, TOI in Galera +# disregards common certification index and simply sets itself to depend on the +# latest certified write set seqno. +# Since this write set was the fragment of SR transaction, TOI was allowed to run in +# parallel with SR presuming it would BF abort the latter. +# +# At the same time, DML transactions in the server don't grab MDL locks on FK-referenced +# tables, thus parent table wasn't protected by an MDL lock from SR and it couldn't +# provoke MDL lock conflict for TOI to BF abort SR transaction. +# In InnoDB, DDL transactions grab shared MDL locks on child tables, which is not enough +# to trigger MDL conflict in Galera. +# InnoDB-level Wsrep patch didn't contain correct conflict resolution logic due to the +# fact that it was believed MDL locking should always produce conflicts correctly. +# +# The fix brings conflict resolution rules similar to MDL-level checks to InnoDB, thus +# accounting for the problematic case. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); + +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk + FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; + +--connection node_2 +# Start SR transaction and make it lock both parent and child tales. +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); + +--connection node_1 +# Sync wait for SR transaction to replicate and apply fragments, thus +# locking parent table as well. +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +# Now run TOI on the parent, which BF-aborts the SR-transaction in progress. +ALTER TABLE parent AUTO_INCREMENT = 100; + +--connection node_2 +# Check that SR is BF-aborted. +--error ER_LOCK_DEADLOCK +COMMIT; + +# Cleanup +DROP TABLE child, parent; +--source include/galera_end.inc diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 22ae84aa353..0a26951b47e 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -183,7 +183,8 @@ extern "C" my_bool wsrep_thd_is_BF(const THD *thd, my_bool sync) extern "C" my_bool wsrep_thd_is_SR(const THD *thd) { - return thd && thd->wsrep_cs().transaction().is_streaming(); + return thd && thd->wsrep_cs().transaction().is_streaming() && + thd->wsrep_cs().transaction().state() == wsrep::transaction::s_executing; } extern "C" void wsrep_handle_SR_rollback(THD *bf_thd, diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index c267e45ebe6..ecca8901c40 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -496,15 +496,13 @@ void lock_sys_t::close() #ifdef WITH_WSREP # ifdef UNIV_DEBUG -/** Check if both conflicting lock transaction and other transaction -requesting record lock are brute force (BF). If they are check is -this BF-BF wait correct and if not report BF wait and assert. +/** Check if this BF-BF wait is correct and if not report and abort. @param lock other waiting lock @param trx transaction requesting conflicting lock */ -static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, - const unsigned type_mode = LOCK_NONE) +static void wsrep_assert_valid_bf_bf_wait(const lock_t *lock, const trx_t *trx, + const unsigned type_mode) { ut_ad(!lock->is_table()); lock_sys.assert_locked(*lock); @@ -514,12 +512,8 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, not acquire THD::LOCK_thd_data mutex below to avoid latching order violation. */ - if (!trx->is_wsrep() || !lock_trx->is_wsrep()) - return; - if (UNIV_LIKELY(!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) - || UNIV_LIKELY(!wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE))) - return; - + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, FALSE)); + ut_ad(wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE)); ut_ad(trx->state == TRX_STATE_ACTIVE); switch (lock_trx->state) { @@ -536,16 +530,6 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, ut_ad("invalid state" == 0); } - /* If BF - BF order is honored, i.e. trx already holding - record lock should be ordered before this new lock request - we can keep trx waiting for the lock. If conflicting - transaction is already aborting or rolling back for replaying - we can also let new transaction waiting. */ - if (wsrep_thd_order_before(lock_trx->mysql_thd, trx->mysql_thd) - || wsrep_thd_is_aborting(lock_trx->mysql_thd)) { - return; - } - if (type_mode != LOCK_NONE) ib::error() << " Requested lock " << ((type_mode & LOCK_TABLE) ? "on table " : " on record ") @@ -573,8 +557,81 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, /* BF-BF wait is a bug */ ut_error; } + +void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx); # endif /* UNIV_DEBUG */ +/** Check if a high priority (BF) trx has to wait for the current +lock holder based on Wsrep transaction state relations. + +This code resembles the one in `wsrep_handle_mdl_conflict()`, but +it's specific to the storage engine and it doesn't perform any +BF aborts by itself. +The decision whether to BF abort a victim may depend on other conditions +like lock compatibility between InnoDB transactions. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF trx has to wait for the lock to be removed +*/ +static bool wsrep_BF_has_to_wait(const lock_t *lock, const trx_t *trx, + bool report_bf_bf_wait, + const unsigned type_mode = LOCK_NONE) +{ + THD *request_thd= trx->mysql_thd; + THD *granted_thd= lock->trx->mysql_thd; + + ut_ad(wsrep_thd_is_BF(request_thd, false)); + ut_ad(lock->trx->is_wsrep()); + + /* Granted is aborting, let it complete. */ + if (wsrep_thd_is_aborting(granted_thd)) + return true; + + /* Granted is not BF, may BF abort it. */ + if (!wsrep_thd_is_BF(granted_thd, false)) + return false; + + /* Applying SR cannot BF abort other high priority (BF). */ + if (wsrep_thd_is_SR(request_thd)) + return true; + + /* Requester is truly BF and granted is applying SR in progress. */ + if (wsrep_thd_is_SR(granted_thd)) + return false; + +#ifdef UNIV_DEBUG + if (report_bf_bf_wait) + wsrep_report_error(lock, trx); + /* We very well can let BF to wait normally as other + BF will be replayed in case of conflict. For debug + builds we will do additional sanity checks to catch + unsupported BF wait if any. */ + ut_d(wsrep_assert_valid_bf_bf_wait(lock, trx, type_mode)); +#endif + return true; +} + +/** Determine whether BF abort on the lock holder is needed. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF abort is needed +*/ +static bool wsrep_will_BF_abort(const lock_t *lock, const trx_t *trx) +{ + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, false)); + + /* Don't BF abort system transactions. */ + if (!lock->trx->is_wsrep()) + return false; + + /* BF trx will wait for the lock, but it doesn't have to according + to Wsrep rules, meaning it must BF abort the lock holder. */ + return lock_has_to_wait(trx->lock.wait_lock, lock) && + !wsrep_BF_has_to_wait(lock, trx, true); +} + /** check if lock timeout was for priority thread, as a side effect trigger lock monitor @param trx transaction owning the lock @@ -648,19 +705,9 @@ bool lock_rec_has_to_wait_wsrep(const trx_t *trx, return false; } - if (wsrep_thd_order_before(trx->mysql_thd, trx2->mysql_thd)) - { - /* If two high priority threads have lock conflict, we look at the - order of these transactions and honor the earlier transaction. */ - - return false; - } - - /* We very well can let bf to wait normally as other - BF will be replayed in case of conflict. For debug - builds we will do additional sanity checks to catch - unsupported bf wait if any. */ - ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx, type_mode)); + /* If two high priority threads have lock conflict, we check if + new lock request has to wait for the transaction holding the lock. */ + return wsrep_BF_has_to_wait(lock2, trx, false, type_mode); } return true; @@ -997,14 +1044,13 @@ void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx) lock_rec_print(stderr, bf_trx->lock.wait_lock, mtr); WSREP_ERROR("victim holding lock: "); lock_rec_print(stderr, victim_lock, mtr); - wsrep_assert_no_bf_bf_wait(victim_lock, bf_trx); } #endif /* WITH_DEBUG */ /** Kill the holders of conflicting locks. @param trx brute-force applier transaction running in the current thread */ ATTRIBUTE_COLD ATTRIBUTE_NOINLINE -static void lock_wait_wsrep(trx_t *trx) +static void wsrep_handle_lock_conflict(trx_t *trx) { DBUG_ASSERT(wsrep_on(trx->mysql_thd)); if (!wsrep_thd_is_BF(trx->mysql_thd, false)) @@ -1030,8 +1076,8 @@ func_exit: for (lock_t *lock= UT_LIST_GET_FIRST(table->locks); lock; lock= UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) { - /* Victim trx needs to be different from BF trx and it has to have a - THD so that we can kill it. Victim might not have THD in two cases: + /* Victim trx has to have a THD so that we can kill it. + Victim might not have THD in two cases: (1) An incomplete transaction that was recovered from undo logs on server startup (and not yet rolled back). @@ -1039,8 +1085,8 @@ func_exit: (2) Transaction that is in XA PREPARE state and whose client connection was disconnected. - Neither of these can complete before lock_wait_wsrep() releases - lock_sys.latch. + Neither of these can complete before wsrep_handle_lock_conflict() + releases lock_sys.latch. (1) trx_t::commit_in_memory() is clearing both trx_t::state and trx_t::is_recovered before it invokes @@ -1051,24 +1097,9 @@ func_exit: (2) If is in XA PREPARE state, it would eventually be rolled back and the lock conflict would be resolved when an XA COMMIT or XA ROLLBACK statement is executed in some other connection. - - If victim has also BF status, but has earlier seqno, we have to wait. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } @@ -1090,21 +1121,8 @@ func_exit: record-locks instead of table locks. See details from comment above. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } while ((lock= lock_rec_get_next(heap_no, lock))); @@ -2015,7 +2033,7 @@ dberr_t lock_wait(que_thr_t *thr) ut_ad(!trx->dict_operation_lock_mode); - IF_WSREP(if (trx->is_wsrep()) lock_wait_wsrep(trx),); + IF_WSREP(if (trx->is_wsrep()) wsrep_handle_lock_conflict(trx),); const auto type_mode= wait_lock->type_mode; #ifdef HAVE_REPLICATION From dd1cad7e5f0e0f1924f34063600381ed565cb310 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 22 Sep 2024 08:45:26 +0200 Subject: [PATCH 129/185] galera_3nodes.MDEV-29171 fails set transferfmt in .cnf file like other galera tests do. otherwise it defaults to socat when mtr detected that only nc is available --- mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index abd778c482c..f23e1c65008 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -48,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' [sst] sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log +transferfmt=@ENV.MTR_GALERA_TFMT [ENV] NODE_MYPORT_1= @mysqld.1.port From 8fd1b060f870f0936d87c40d9b030f465abf6212 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 22 Sep 2024 08:46:35 +0200 Subject: [PATCH 130/185] reformat galera sst error messages put the command line at the end. so that when a very long command line is truncated, it doesn't take the actual error message with it --- sql/wsrep_sst.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 34eda4e286d..e9d2e158e39 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -597,8 +597,8 @@ static void* sst_joiner_thread (void* a) if (!tmp || strlen(tmp) < (magic_len + 2) || strncasecmp (tmp, magic, magic_len)) { - WSREP_ERROR("Failed to read '%s ' from: %s\n\tRead: '%s'", - magic, arg->cmd, tmp); + WSREP_ERROR("Failed to read '%s ' (got '%s') from: %s", + magic, tmp, arg->cmd); proc.wait(); if (proc.error()) err= proc.error(); } @@ -610,8 +610,8 @@ static void* sst_joiner_thread (void* a) else { err= proc.error(); - WSREP_ERROR("Failed to execute: %s : %d (%s)", - arg->cmd, err, strerror(err)); + WSREP_ERROR("Failed to execute (%M): %s", + err, arg->cmd); } /* From 53f5ee7929545c745f950c18fdc8cbadd945ecdf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 24 Sep 2024 08:44:52 +0200 Subject: [PATCH 131/185] MDEV-34994: sql/mysqld: stop accept() loop after the first EAGAIN Each time a listener socket becomes ready, MariaDB calls accept() ten times (MAX_ACCEPT_RETRY), even if all but the first one return EAGAIN because there are no more connections. This causes unnecessary CPU usage - on our server, the CPU load of that thread, which does nothing but accept(), saturates one CPU core by ~45%. The loop should stop after the first EAGAIN. Perf report: 11.01% mariadbd libc.so.6 [.] accept4 6.42% mariadbd [kernel.kallsyms] [k] finish_task_switch.isra.0 5.50% mariadbd [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore 5.50% mariadbd [kernel.kallsyms] [k] syscall_enter_from_user_mode 4.59% mariadbd [kernel.kallsyms] [k] __fget_light 3.67% mariadbd [kernel.kallsyms] [k] kmem_cache_alloc 2.75% mariadbd [kernel.kallsyms] [k] fput 2.75% mariadbd [kernel.kallsyms] [k] mod_objcg_state 1.83% mariadbd [kernel.kallsyms] [k] __inode_wait_for_writeback 1.83% mariadbd [kernel.kallsyms] [k] __sys_accept4 1.83% mariadbd [kernel.kallsyms] [k] _raw_spin_unlock_irq 1.83% mariadbd [kernel.kallsyms] [k] alloc_inode 1.83% mariadbd [kernel.kallsyms] [k] call_rcu --- sql/mysqld.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d874a115bce..39d7f60527b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6360,7 +6360,9 @@ void handle_connections_sockets() &length); if (mysql_socket_getfd(new_sock) != INVALID_SOCKET) handle_accepted_socket(new_sock, sock); - else if (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN) + else if (socket_errno == SOCKET_EAGAIN || socket_errno == SOCKET_EWOULDBLOCK) + break; + else if (socket_errno != SOCKET_EINTR) { /* accept(2) failed on the listening port. From ad5b9c207c60d78a55ab0514432ef0421d017c1a Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Mon, 23 Sep 2024 17:53:11 +0700 Subject: [PATCH 132/185] MDEV-27944: View-protocol fails if database was changed This is a limitation of the view protocol. Tests were fixed with workaround (via disable/enable service connection) --- mysql-test/main/cte_nonrecursive.test | 12 ++++++------ mysql-test/main/ctype_recoding.test | 5 ++--- mysql-test/main/lowercase_table.test | 5 ++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index bebf02eafd9..a56b89cf3c8 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1048,14 +1048,14 @@ drop table t1; --echo # MDEV-16473: query with CTE when no database is set --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db_mdev_16473; use db_mdev_16473; drop database db_mdev_16473; +--disable_service_connection --echo # Now no default database is set select database(); +--enable_service_connection with cte as (select 1 as a) select * from cte; @@ -1073,7 +1073,6 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a; drop database db_mdev_16473; use test; ---enable_view_protocol --echo # --echo # MDEV-17154: using parameter markers for PS within CTEs more than once @@ -1220,8 +1219,6 @@ DROP TABLE test.t; --echo # MDEV-22781: create view with CTE without default database --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db; use db; drop database db; @@ -1231,7 +1228,9 @@ insert into db1.t1 values (3),(7),(1); create view db1.v1 as with t as (select * from db1.t1) select * from t; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; prepare stmt from " @@ -1240,14 +1239,15 @@ create view db1.v1 as with t as (select * from db1.t1) select * from t; execute stmt; deallocate prepare stmt; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; drop table db1.t1; drop database db1; use test; ---enable_view_protocol --echo # --echo # MDEV-24597: CTE with union used multiple times in query diff --git a/mysql-test/main/ctype_recoding.test b/mysql-test/main/ctype_recoding.test index 9b5f74d0b93..5c25d854137 100644 --- a/mysql-test/main/ctype_recoding.test +++ b/mysql-test/main/ctype_recoding.test @@ -74,13 +74,12 @@ SHOW TABLES IN SET CHARACTER SET koi8r; DROP DATABASE ÔÅÓÔ; -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol +--disable_service_connection SET NAMES koi8r; SELECT hex('ÔÅÓÔ'); SET character_set_connection=cp1251; SELECT hex('ÔÅÓÔ'); ---enable_view_protocol +--enable_service_connection USE test; # Bug#4417 diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index 8d493fff5cd..6af80f1c339 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -2,9 +2,6 @@ # Test of --lower-case-table-names # -#remove this include after fix MDEV-27944 ---source include/no_view_protocol.inc - create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -36,8 +33,10 @@ drop table t1; create database mysqltest; use MYSQLTEST; create table t1 (a int); +--disable_service_connection select T1.a from MYSQLTEST.T1; select t1.a from MYSQLTEST.T1; +--enable_service_connection select mysqltest.t1.* from MYSQLTEST.t1; select MYSQLTEST.t1.* from MYSQLTEST.t1; select MYSQLTEST.T1.* from MYSQLTEST.T1; From 42eb64e64df0961c77e57111b18f44589be2d5c8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 24 Sep 2024 17:47:34 +1000 Subject: [PATCH 133/185] MDEV-34996 Buildbot MSAN options should be in server All the options that where in buildbot, should be in the server making it accessible to all without any special invocation. If WITH_MSAN=ON, we want to make sure that the compiler options are supported and it will result in an error if not supported. We make the -WITH_MSAN=ON append -stdlib=libc++ to the CXX_FLAGS if supported. With SECURITY_HARDENING options the bootstrap currently crashes, so for now, we disable SECRUITY_HARDENING if there is MSAN enable. Option WITH_DBUG_TRACE has no effect in MSAN builds. --- CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6897fee02af..36b6a91068d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,6 +244,19 @@ ENDIF() OPTION(WITH_MSAN "Enable memory sanitizer" OFF) IF (WITH_MSAN) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE + AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE)) + MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags") + ENDIF() + MY_CHECK_CXX_COMPILER_FLAG("-stdlib=libc++") + IF(NOT have_CXX__stdlib_libc__) + MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++") + ENDIF() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO) + IF(NOT HAVE_LINK_FLAG__fsanitize_memory) + MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") + ENDIF() ENDIF() OPTION(WITH_GPROF "Enable profiling with gprof" OFF) @@ -257,7 +270,7 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO) # enable security hardening features, like most distributions do # in our benchmarks that costs about ~1% of performance, depending on the load OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) -IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF) +IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF AND NOT WITH_MSAN) # security-enhancing flags MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now") From d67c88946f1624ba1af45b2728442c1fb5d96e24 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 22 Sep 2024 21:35:19 +0300 Subject: [PATCH 134/185] Debugging: add dbug_print_join_prefix() to use in best_access_path A call to dbug_print_join_prefix(join_positions, idx, s) returns a const char* ponter to string with current join prefix, including the table being added to it. --- sql/sql_select.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ea690422eac..b995beb53e3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7550,6 +7550,30 @@ double adjust_quick_cost(double quick_cost, ha_rows records) } +#ifndef DBUG_OFF + +char dbug_join_prefix_buf[256]; + +const char* dbug_print_join_prefix(const POSITION *join_positions, + uint idx, + JOIN_TAB *s) +{ + char *buf= dbug_join_prefix_buf; + String str(buf, sizeof(dbug_join_prefix_buf), &my_charset_bin); + str.length(0); + for (uint i=0; i!=idx; i++) + { + str.append(join_positions[i].table->table->alias); + str.append(','); + } + str.append(s->table->alias); + if (str.c_ptr_safe() == buf) + return buf; + else + return "Couldn't fit into buffer"; +} +#endif + /** Find the best access path for an extension of a partial execution plan and add this path to the plan. @@ -7573,6 +7597,14 @@ double adjust_quick_cost(double quick_cost, ha_rows records) @param pos OUT Table access plan @param loose_scan_pos OUT Table plan that uses loosescan, or set cost to DBL_MAX if not possible. + @detail + Use this to print the current join prefix: + + dbug_print_join_prefix(join_positions, idx, s) + + Use this as breakpoint condition to stop at join prefix "t1,t2,t3": + + $_streq(dbug_print_join_prefix(join_positions, idx, s), "t1,t2,t3") @return None From f7c5182b7cb413455a0fbbfbb8b773e12139c0a6 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Wed, 18 Sep 2024 16:38:11 -0400 Subject: [PATCH 135/185] MDEV-31636 Memory leak in Sys_var_gtid_binlog_state::do_check() Move memory allocations performed during Sys_var_gtid_binlog_state::do_check to Sys_var_gtid_binlog_state::global_update where they will be freed before the latter method returns. --- mysql-test/main/mdev-31636.result | 8 +++++ mysql-test/main/mdev-31636.test | 7 ++++ sql/sys_vars.cc | 58 +++++++++++++++---------------- 3 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 mysql-test/main/mdev-31636.result create mode 100644 mysql-test/main/mdev-31636.test diff --git a/mysql-test/main/mdev-31636.result b/mysql-test/main/mdev-31636.result new file mode 100644 index 00000000000..82dcd03027c --- /dev/null +++ b/mysql-test/main/mdev-31636.result @@ -0,0 +1,8 @@ +RESET MASTER; +SET +@@global.gtid_binlog_state='1-1-101,2-1-2002', +@@global.slave_parallel_mode=x; +ERROR 42000: Variable 'slave_parallel_mode' can't be set to the value of 'x' +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state + diff --git a/mysql-test/main/mdev-31636.test b/mysql-test/main/mdev-31636.test new file mode 100644 index 00000000000..b5affaef60c --- /dev/null +++ b/mysql-test/main/mdev-31636.test @@ -0,0 +1,7 @@ +--source include/have_log_bin.inc +RESET MASTER; +--error ER_WRONG_VALUE_FOR_VAR +SET + @@global.gtid_binlog_state='1-1-101,2-1-2002', + @@global.slave_parallel_mode=x; +SELECT @@global.gtid_binlog_state; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 0af4b5e27fc..44302b3a507 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2016,15 +2016,6 @@ struct gtid_binlog_state_data { rpl_gtid *list; uint32 list_len; }; bool Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) { - String str, *res; - struct gtid_binlog_state_data *data; - rpl_gtid *list; - uint32 list_len; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!(res= var->value->val_str(&str))) - return true; if (thd->in_active_multi_stmt_transaction()) { my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0)); @@ -2040,6 +2031,31 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) my_error(ER_BINLOG_MUST_BE_EMPTY, MYF(0)); return true; } + return false; +} + + +bool +Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) +{ + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!var->value) + { + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); + return true; + } + + bool result; + String str, *res; + struct gtid_binlog_state_data *data; + rpl_gtid *list; + uint32 list_len; + + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!(res= var->value->val_str(&str))) + return true; if (res->length() == 0) { list= NULL; @@ -2061,31 +2077,13 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) data->list= list; data->list_len= list_len; var->save_result.ptr= data; - return false; -} - - -bool -Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) -{ - bool res; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!var->value) - { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); - return true; - } - - struct gtid_binlog_state_data *data= - (struct gtid_binlog_state_data *)var->save_result.ptr; + mysql_mutex_unlock(&LOCK_global_system_variables); - res= (reset_master(thd, data->list, data->list_len, 0) != 0); + result= (reset_master(thd, data->list, data->list_len, 0) != 0); mysql_mutex_lock(&LOCK_global_system_variables); my_free(data->list); my_free(data); - return res; + return result; } From b2429e20252beaa500dc109b12f730dccaf3dd23 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Fri, 20 Sep 2024 18:06:38 +0300 Subject: [PATCH 136/185] MDEV-34976 Server crash report broken if Galera is not loaded The crash report terminates prematurely when Galera library was not loaded. As a fix, check whether the provider is loaded before shutting down Galera connections. Signed-off-by: Julius Goryavsky --- sql/wsrep_server_state.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index a936d9dd79d..3ed26d3381c 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -87,7 +87,7 @@ void Wsrep_server_state::destroy() void Wsrep_server_state::handle_fatal_signal() { - if (m_instance) + if (m_instance && m_instance->is_provider_loaded()) { /* Galera background threads are still running and the logging may be relatively verbose in case of networking error. Silence all wsrep From 0ce5603b86c2bd526c2b00af448b94f72bf8d1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 3 Sep 2024 09:07:19 +0300 Subject: [PATCH 137/185] MDEV-33035 : Galera test case MDEV-16509 unstable Stabilize test by reseting DEBUG_SYNC and add wait_condition for expected table contents. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-16509.result | 10 ++++++++++ mysql-test/suite/galera/t/MDEV-16509.test | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/mysql-test/suite/galera/r/MDEV-16509.result b/mysql-test/suite/galera/r/MDEV-16509.result index b56622da2c0..fecb397994c 100644 --- a/mysql-test/suite/galera/r/MDEV-16509.result +++ b/mysql-test/suite/galera/r/MDEV-16509.result @@ -28,6 +28,11 @@ wsrep_last_seen_gtid_do_not_match 1 SET DEBUG_SYNC = "now SIGNAL after_group_continue"; connection node_1; +SELECT * from t1; +f1 +1 +connection ctrl; +SET DEBUG_SYNC = "RESET"; SET SESSION wsrep_sync_wait = 0; connection ctrl; connection node_1; @@ -69,6 +74,11 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; connection node_1a; connection ctrl; SET DEBUG_SYNC = "RESET"; +SELECT * from t1; +f1 +1 +2 +3 DROP TABLE t1; disconnect ctrl; disconnect node_1a; diff --git a/mysql-test/suite/galera/t/MDEV-16509.test b/mysql-test/suite/galera/t/MDEV-16509.test index 078f1e95a99..3f3e2d88f1b 100644 --- a/mysql-test/suite/galera/t/MDEV-16509.test +++ b/mysql-test/suite/galera/t/MDEV-16509.test @@ -58,6 +58,12 @@ SET DEBUG_SYNC = "now SIGNAL after_group_continue"; --connection node_1 --reap +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + +--connection ctrl +SET DEBUG_SYNC = "RESET"; # # Scenario 2: Verify that two INSERTs from two different connections @@ -137,6 +143,10 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; --connection ctrl SET DEBUG_SYNC = "RESET"; +--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + DROP TABLE t1; --disconnect ctrl From 024e95128ba59a365c7b30858bd207bb59504662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 3 Sep 2024 12:11:05 +0300 Subject: [PATCH 138/185] MDEV-32996 : galera.galera_var_ignore_apply_errors -> [ERROR] WSREP: Inconsistency detected Add wait_until_ready waits after wsrep_on is set on again to make sure that node is ready for next step before continuing. Signed-off-by: Julius Goryavsky --- .../r/galera_var_ignore_apply_errors.result | 5 ++++- .../galera/t/galera_var_ignore_apply_errors.cnf | 2 +- .../galera/t/galera_var_ignore_apply_errors.test | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result index ea8510581bb..17b06017287 100644 --- a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result +++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result @@ -208,7 +208,9 @@ DROP TABLE t1; connection node_2; SELECT * FROM t1; ERROR 42S02: Table 'test.t1' doesn't exist -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; +Warnings: +Warning 1292 Truncated incorrect wsrep_ignore_apply_errors value: '10' CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test\\.t1'' on query\\. Default database: 'test'\\. Query: 'DROP TABLE t1', Error_code: 1051"); @@ -217,3 +219,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf index 1d02401decc..fdb73f1f052 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf @@ -2,5 +2,5 @@ [mysqld] wsrep_debug=1 -wsrep_sync_wait=15 +wsrep_sync_wait=0 loose-galera-var-ignore-apply-errors=1 diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test index d5c6521add4..e5c13dddd29 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test @@ -17,6 +17,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 1; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP TABLE t1; --connection node_2 @@ -27,6 +28,7 @@ SHOW TABLES; SET GLOBAL wsrep_on = OFF; CREATE SCHEMA s1; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP SCHEMA s1; --connection node_2 @@ -38,6 +40,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP INDEX idx1 ON t1; --connection node_2 @@ -50,6 +53,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP INDEX idx1; --connection node_2 @@ -62,6 +66,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP COLUMN f2; --connection node_2 @@ -82,6 +87,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DELETE FROM t1 WHERE f1 = 1; SELECT COUNT(*) AS expect_0 FROM t1; @@ -96,6 +102,7 @@ INSERT INTO t1 VALUES (2); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc START TRANSACTION; INSERT INTO t1 VALUES (3); DELETE FROM t1 WHERE f1 = 1; @@ -121,6 +128,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM t1; @@ -147,6 +155,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 SET AUTOCOMMIT=OFF; @@ -185,6 +194,7 @@ SET SESSION wsrep_on = OFF; DELETE FROM t2 WHERE f1 = 2; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; @@ -214,6 +224,7 @@ INSERT INTO child VALUES (1,1),(2,2),(3,3); SET SESSION wsrep_on = OFF; DELETE FROM child WHERE parent_id = 2; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM parent; @@ -240,6 +251,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 4; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); @@ -248,7 +260,7 @@ DROP TABLE t1; --connection node_2 --error ER_NO_SUCH_TABLE SELECT * FROM t1; -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); @@ -258,3 +270,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); From 9f61aa4f8aeb3cf828b765855af80eac2543e7c2 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Fri, 16 Aug 2024 11:58:06 +0300 Subject: [PATCH 139/185] MDEV-34822 pre-fix: Make wsrep_ready flag read lock-free It's read for every command execution, and during slave replication for every applied event. It's also planned to be used during write set applying, so it means mostly every server thread is going to compete for the mutex covering this variable, especially considering how rarely it changes. Converting wsrep_ready to atomic relaxes the things. Signed-off-by: Julius Goryavsky --- sql/wsrep_mysqld.cc | 11 ++++++----- sql/wsrep_mysqld.h | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 83de938aa13..bc6c185c8d0 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -269,8 +269,8 @@ static char provider_vendor[256]= { 0, }; * Wsrep status variables. LOCK_status must be locked When modifying * these variables, */ +std::atomic wsrep_ready(false); my_bool wsrep_connected = FALSE; -my_bool wsrep_ready = FALSE; const char* wsrep_cluster_state_uuid= cluster_uuid_str; long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED; const char* wsrep_cluster_status = "Disconnected"; @@ -565,10 +565,7 @@ void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid, */ my_bool wsrep_ready_get (void) { - if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); - my_bool ret= wsrep_ready; - mysql_mutex_unlock (&LOCK_wsrep_ready); - return ret; + return wsrep_ready; } int wsrep_show_ready(THD *thd, SHOW_VAR *var, void *buff, @@ -3452,6 +3449,10 @@ bool wsrep_consistency_check(THD *thd) // Wait until wsrep has reached ready state void wsrep_wait_ready(THD *thd) { + // First check not locking the mutex. + if (wsrep_ready) + return; + mysql_mutex_lock(&LOCK_wsrep_ready); while(!wsrep_ready) { diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index ad2fede8922..d67f1fdf479 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -135,7 +135,6 @@ extern const char *wsrep_SR_store_types[]; // MySQL status variables extern my_bool wsrep_connected; -extern my_bool wsrep_ready; extern const char* wsrep_cluster_state_uuid; extern long long wsrep_cluster_conf_id; extern const char* wsrep_cluster_status; From be164fc401343ed81b9ebd1f6a3cbb31e364a016 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Wed, 4 Sep 2024 00:58:59 +0000 Subject: [PATCH 140/185] ssl_cipher parameter cannot configure TLSv1.3 and TLSv1.2 ciphers at the same time SSL_CTX_set_ciphersuites() sets the TLSv1.3 cipher suites. SSL_CTX_set_cipher_list() sets the ciphers for TLSv1.2 and below. The current TLS configuration logic will not perform SSL_CTX_set_cipher_list() to configure TLSv1.2 ciphers if the call to SSL_CTX_set_ciphersuites() was successful. The call to SSL_CTX_set_ciphersuites() is successful if any TLSv1.3 cipher suite is passed into `--ssl-cipher`. This is a potential security vulnerability because users trying to restrict specific secure ciphers for TLSv1.3 and TLSv1.2, would unknowingly still have the database support insecure TLSv1.2 ciphers. For example: If setting `--ssl_cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256`, the database would still support all possible TLSv1.2 ciphers rather than only ECDHE-RSA-AES128-GCM-SHA256. The solution is to execute both SSL_CTX_set_ciphersuites() and SSL_CTX_set_cipher_list() even if the first call succeeds. This allows the configuration of exactly which TLSv1.3 and TLSv1.2 ciphers to support. Note that there is 1 behavior change with this. When specifying only TLSv1.3 ciphers to `--ssl-cipher`, the database will not support any TLSv1.2 cipher. However, this does not impose a security risk and considering TLSv1.3 is the modern protocol, this behavior should be fine. All TLSv1.3 ciphers are still supported if only TLSv1.2 ciphers are specified through `--ssl-cipher`. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysql-test/include/have_tlsv13.inc | 10 +++++++ mysql-test/main/tlsv13.result | 18 +++++++++++++ mysql-test/main/tlsv13.test | 43 ++++++++++++++++++++++++++++++ mysql-test/suite.pm | 3 +++ vio/viosslfactories.c | 20 +++++++++----- 5 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 mysql-test/include/have_tlsv13.inc create mode 100644 mysql-test/main/tlsv13.result create mode 100644 mysql-test/main/tlsv13.test diff --git a/mysql-test/include/have_tlsv13.inc b/mysql-test/include/have_tlsv13.inc new file mode 100644 index 00000000000..ef897d92f97 --- /dev/null +++ b/mysql-test/include/have_tlsv13.inc @@ -0,0 +1,10 @@ +--disable_query_log +connect (ssl_connection,localhost,root,,,,,SSL); + +if (`SELECT VARIABLE_VALUE NOT LIKE 'TLSv1.3' FROM information_schema.SESSION_STATUS WHERE VARIABLE_NAME = 'ssl_version'`) { + skip Needs TLSv1.3; +} + +disconnect ssl_connection; +connection default; +--enable_query_log diff --git a/mysql-test/main/tlsv13.result b/mysql-test/main/tlsv13.result new file mode 100644 index 00000000000..772cfd85eae --- /dev/null +++ b/mysql-test/main/tlsv13.result @@ -0,0 +1,18 @@ +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +# restart: --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256 diff --git a/mysql-test/main/tlsv13.test b/mysql-test/main/tlsv13.test new file mode 100644 index 00000000000..f90b6849a86 --- /dev/null +++ b/mysql-test/main/tlsv13.test @@ -0,0 +1,43 @@ +--source include/have_ssl_communication.inc +--source include/require_openssl_client.inc +--source include/have_tlsv13.inc + +# +# BUG - SSL_CIPHER SYSTEM VARIABLE CANNOT CONFIGURE TLSV1.3 AND TLSV1.2 CIPHERS AT THE SAME TIME +# +# If users specify TLSv1.3 and TLSv1.2 ciphers, it will only configure the +# TLSv1.3 ciphers correctly but then it will keep all TLSv1.2 ciphers enabled. +# +# This is a potential security vulnerability because users trying to restrict +# secure TLSv1.3 and TLSv1.2 ciphers will unintentionally have insecure TLSv1.2 +# ciphers enabled on the database. +# +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; + +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher%';" + +# Check that other ciphers are correctly not supported by the server +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_256_GCM_SHA384 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +# TLSv1.3 ciphers are still supported if only TLSv1.2 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" + +# TLSv1.2 ciphers are not supported if only TLSv1.3 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index d5c4855ce6e..3270c62b37d 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -71,6 +71,9 @@ sub skip_combinations { $skip{'main/ssl_7937.combinations'} = [ 'x509v3' ] unless $ssl_lib =~ /WolfSSL/ or $openssl_ver ge "1.0.2"; + $skip{'main/tlsv13.test'} = 'does not work with OpenSSL <= 1.1.1' + unless $ssl_lib =~ /WolfSSL/ or $openssl_ver ge "3.0.0"; + $skip{'main/ssl_verify_ip.test'} = 'x509v3 support required' unless $openssl_ver ge "1.0.2"; diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 3d007cdd1d8..38dabba822a 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -295,16 +295,22 @@ new_VioSSLFd(const char *key_file, const char *cert_file, /* Set the ciphers that can be used - NOTE: SSL_CTX_set_cipher_list will return 0 if + NOTE: SSL_CTX_set_ciphersuites/SSL_CTX_set_cipher_list will return 0 if none of the provided ciphers could be selected */ - if (cipher && - SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher) == 0 && - SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0) + if (cipher) { - *error= SSL_INITERR_CIPHERS; - DBUG_PRINT("error", ("%s", sslGetErrString(*error))); - goto err2; + int cipher_result= 0; + + cipher_result|= SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher); + cipher_result|= SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher); + + if (cipher_result == 0) + { + *error= SSL_INITERR_CIPHERS; + DBUG_PRINT("error", ("%s", sslGetErrString(*error))); + goto err2; + } } /* Load certs from the trusted ca */ From 6acada713a95a605b3aa65bd519fbd4532ad23e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 26 Sep 2024 18:47:12 +0300 Subject: [PATCH 141/185] MDEV-34062: Implement innodb_log_file_mmap on 64-bit systems When using the default innodb_log_buffer_size=2m, mariadb-backup --backup would spend a lot of time re-reading and re-parsing the log. For reads, it would be beneficial to memory-map the entire ib_logfile0 to the address space (typically 48 bits or 256 TiB) and read it from there, both during --backup and --prepare. We will introduce the Boolean read-only parameter innodb_log_file_mmap that will be OFF by default on most platforms, to avoid aggressive read-ahead of the entire ib_logfile0 in when only a tiny portion would be accessed. On Linux and FreeBSD the default is innodb_log_file_mmap=ON, because those platforms define a specific mmap(2) option for enabling such read-ahead and therefore it can be assumed that the default would be on-demand paging. This parameter will only have impact on the initial InnoDB startup and recovery. Any writes to the log will use regular I/O, except when the ib_logfile0 is stored in a specially configured file system that is backed by persistent memory (Linux "mount -o dax"). We also experimented with allowing writes of the ib_logfile0 via a memory mapping and decided against it. A fundamental problem would be unnecessary read-before-write in case of a major page fault, that is, when a new, not yet cached, virtual memory page in the circular ib_logfile0 is being written to. There appears to be no way to tell the operating system that we do not care about the previous contents of the page, or that the page fault handler should just zero it out. Many references to HAVE_PMEM have been replaced with references to HAVE_INNODB_MMAP. The predicate log_sys.is_pmem() has been replaced with log_sys.is_mmap() && !log_sys.is_opened(). Memory-mapped regular files differ from MAP_SYNC (PMEM) mappings in the way that an open file handle to ib_logfile0 will be retained. In both code paths, log_sys.is_mmap() will hold. Holding a file handle open will allow log_t::clear_mmap() to disable the interface with fewer operations. It should be noted that ever since commit 685d958e38b825ad9829be311f26729cccf37c46 (MDEV-14425) most 64-bit Linux platforms on our CI platforms (s390x a.k.a. IBM System Z being a notable exception) read and write /dev/shm/*/ib_logfile0 via a memory mapping, pretending that it is persistent memory (mount -o dax). So, the memory mapping based log parsing that this change is enabling by default on Linux and FreeBSD has already been extensively tested on Linux. ::log_mmap(): If a log cannot be opened as PMEM and the desired access is read-only, try to open a read-only memory mapping. xtrabackup_copy_mmap_snippet(), xtrabackup_copy_mmap_logfile(): Copy the InnoDB log in mariadb-backup --backup from a memory mapped file. --- cmake/os/WindowsCache.cmake | 1 - config.h.cmake | 1 - configure.cmake | 1 - extra/mariabackup/xtrabackup.cc | 142 +++++- include/my_sys.h | 4 - .../innodb/r/log_file_size_online.result | 6 + .../suite/innodb/t/log_file_size_online.test | 11 + .../suite/sys_vars/r/sysvars_innodb.result | 1 + .../suite/sys_vars/t/sysvars_innodb.test | 1 + mysys/my_getpagesize.c | 12 +- mysys/my_init.c | 4 +- storage/innobase/buf/buf0flu.cc | 23 +- storage/innobase/handler/ha_innodb.cc | 23 +- storage/innobase/include/log0log.h | 63 +-- storage/innobase/include/log0recv.h | 9 +- storage/innobase/include/mtr0mtr.h | 6 +- storage/innobase/include/univ.i | 5 +- storage/innobase/log/log0log.cc | 433 ++++++++++++------ storage/innobase/log/log0recv.cc | 48 +- storage/innobase/mtr/mtr0mtr.cc | 43 +- storage/innobase/srv/srv0start.cc | 14 +- storage/innobase/trx/trx0trx.cc | 24 +- 22 files changed, 579 insertions(+), 296 deletions(-) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index c1048661aaa..75d21f6ca41 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -61,7 +61,6 @@ SET(HAVE_GETIFADDRS CACHE INTERNAL "") SET(HAVE_GETCWD 1 CACHE INTERNAL "") SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") -SET(HAVE_GETPAGESIZE CACHE INTERNAL "") SET(HAVE_GETPASS CACHE INTERNAL "") SET(HAVE_GETMNTENT CACHE INTERNAL "") SET(HAVE_GETMNTENT_IN_SYS_MNTAB CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 49783ce6b50..b81c4148ccb 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -151,7 +151,6 @@ #cmakedefine HAVE_GETCWD 1 #cmakedefine HAVE_GETHOSTBYADDR_R 1 #cmakedefine HAVE_GETHRTIME 1 -#cmakedefine HAVE_GETPAGESIZE 1 #cmakedefine HAVE_GETPAGESIZES 1 #cmakedefine HAVE_GETPASS 1 #cmakedefine HAVE_GETPASSPHRASE 1 diff --git a/configure.cmake b/configure.cmake index 273c155158e..474c82cb59c 100644 --- a/configure.cmake +++ b/configure.cmake @@ -463,7 +463,6 @@ CHECK_SYMBOL_EXISTS(madvise "sys/mman.h" HAVE_DECL_MADVISE) CHECK_SYMBOL_EXISTS(getpagesizes "sys/mman.h" HAVE_GETPAGESIZES) CHECK_SYMBOL_EXISTS(tzname "time.h" HAVE_TZNAME) CHECK_SYMBOL_EXISTS(lrand48 "stdlib.h" HAVE_LRAND48) -CHECK_SYMBOL_EXISTS(getpagesize "unistd.h" HAVE_GETPAGESIZE) CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index ca8891ca546..e5d05b230fd 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -205,6 +205,8 @@ lsn_t checkpoint_lsn_start; lsn_t checkpoint_no_start; /** whether log_copying_thread() is active; protected by recv_sys.mutex */ static bool log_copying_running; +/** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */ +lsn_t metadata_to_lsn; uint xtrabackup_parallel; @@ -236,7 +238,6 @@ my_bool opt_encrypted_backup; #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/ static lsn_t metadata_from_lsn; -lsn_t metadata_to_lsn; static lsn_t metadata_last_lsn; static ds_file_t* dst_log_file; @@ -282,9 +283,6 @@ my_bool xtrabackup_incremental_force_scan = FALSE; */ ulong xtrabackup_innodb_force_recovery = 0; -/* The flushed lsn which is read from data files */ -lsn_t flushed_lsn= 0; - ulong xb_open_files_limit= 0; char *xb_plugin_dir; char *xb_plugin_load; @@ -1329,6 +1327,9 @@ enum options_xtrabackup OPT_INNODB_BUFFER_POOL_FILENAME, OPT_INNODB_LOCK_WAIT_TIMEOUT, OPT_INNODB_LOG_BUFFER_SIZE, +#ifdef HAVE_INNODB_MMAP + OPT_INNODB_LOG_FILE_MMAP, +#endif #if defined __linux__ || defined _WIN32 OPT_INNODB_LOG_FILE_BUFFERING, #endif @@ -1890,6 +1891,13 @@ struct my_option xb_server_options[] = (G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0, GET_UINT, REQUIRED_ARG, 2U << 20, 2U << 20, log_sys.buf_size_max, 0, 4096, 0}, +#ifdef HAVE_INNODB_MMAP + {"innodb_log_file_mmap", OPT_INNODB_LOG_FILE_SIZE, + "Whether ib_logfile0 should be memory-mapped", + (G_PTR*) &log_sys.log_mmap, + (G_PTR*) &log_sys.log_mmap, 0, GET_BOOL, NO_ARG, + log_sys.log_mmap_default, 0, 0, 0, 0, 0}, +#endif #if defined __linux__ || defined _WIN32 {"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING, "Whether the file system cache for ib_logfile0 is enabled during --backup", @@ -3368,8 +3376,108 @@ skip: return(FALSE); } +#ifdef HAVE_INNODB_MMAP +static int +xtrabackup_copy_mmap_snippet(ds_file_t *ds, const byte *start, const byte *end) +{ + if (UNIV_UNLIKELY(start > end)) + { + if (int r= ds_write(ds, start, log_sys.buf + log_sys.file_size - start)) + return r; + start= log_sys.buf + log_sys.START_OFFSET; + } + return ds_write(ds, start, end - start); +} + +/** Copy memory-mapped log until the end of the log is reached +or the log_copying_stop signal is received +@return whether the operation failed */ +static bool xtrabackup_copy_mmap_logfile() +{ + mysql_mutex_assert_owner(&recv_sys.mutex); + recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn)); + recv_sys.len= size_t(log_sys.file_size); + const size_t seq_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; + const char one{'\1'}; + + for (unsigned retry_count{0};;) + { + recv_sys_t::parse_mtr_result r; + const byte *start= &log_sys.buf[recv_sys.offset]; + + if (recv_sys.parse_mmap(false) == recv_sys_t::OK) + { + const byte *end; + + do + { + /* Set the sequence bit (the backed-up log will not wrap around) */ + size_t seqo= recv_sys.offset - seq_offset; + if (seqo < log_sys.START_OFFSET) + seqo+= log_sys.file_size - log_sys.START_OFFSET; + const byte *seq= &log_sys.buf[seqo]; + ut_ad(*seq == log_sys.get_sequence_bit(recv_sys.lsn - seq_offset)); + if (!*seq) + { + if (xtrabackup_copy_mmap_snippet(dst_log_file, start, seq) || + ds_write(dst_log_file, &one, 1)) + goto write_error; + start = seq + 1; + } + } + while ((r= recv_sys.parse_mmap(false)) == recv_sys_t::OK); + + end= &log_sys.buf[recv_sys.offset]; + + if (xtrabackup_copy_mmap_snippet(dst_log_file, start, end)) + { + write_error: + msg("Error: write to ib_logfile0 failed"); + return true; + } + + start= end; + + pthread_cond_broadcast(&scanned_lsn_cond); + + if (r == recv_sys_t::GOT_EOF) + break; + + retry_count= 0; + } + else + { + if (metadata_to_lsn) + { + if (metadata_to_lsn <= recv_sys.lsn) + return false; + } + else if (xtrabackup_throttle && io_ticket-- < 0) + mysql_cond_wait(&wait_throttle, &recv_sys.mutex); + + if (!retry_count++) + msg("Retrying read of log at LSN=" LSN_PF, recv_sys.lsn); + else if (retry_count == 100) + break; + else + { + timespec abstime; + set_timespec_nsec(abstime, 1000000ULL /* 1 ms */); + if (!mysql_cond_timedwait(&log_copying_stop, &recv_sys.mutex, + &abstime)) + return true; + } + } + } + + if (verbose) + msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); + return false; +} +#endif + /** Copy redo log until the current end of the log is reached -@return whether the operation failed */ +@return whether the operation failed */ static bool xtrabackup_copy_logfile() { mysql_mutex_assert_owner(&recv_sys.mutex); @@ -3377,16 +3485,17 @@ static bool xtrabackup_copy_logfile() ut_a(dst_log_file); ut_ad(recv_sys.is_initialised()); + +#ifdef HAVE_INNODB_MMAP + if (log_sys.is_mmap()) + return xtrabackup_copy_mmap_logfile(); +#endif const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; const size_t block_size_1{log_sys.write_size - 1}; - ut_ad(!log_sys.is_pmem()); - - { - recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & - block_size_1; - recv_sys.len= 0; - } + recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & + block_size_1; + recv_sys.len= 0; for (unsigned retry_count{0};;) { @@ -5376,9 +5485,8 @@ fail: goto fail; } - if (!log_sys.create()) { - goto fail; - } + log_sys.create(); + /* get current checkpoint_lsn */ { log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -6730,9 +6838,7 @@ error: } recv_sys.create(); - if (!log_sys.create()) { - goto error; - } + log_sys.create(); recv_sys.recovery_on = true; xb_fil_io_init(); diff --git a/include/my_sys.h b/include/my_sys.h index e4ab497a0e8..0797f96607e 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1017,11 +1017,7 @@ extern int my_win_pclose(FILE*); #endif /* my_getpagesize */ -#ifdef HAVE_GETPAGESIZE -#define my_getpagesize() getpagesize() -#else int my_getpagesize(void); -#endif int my_msync(int, void *, size_t, int); diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result index e4c4e899995..e34d4f3cdc2 100644 --- a/mysql-test/suite/innodb/r/log_file_size_online.result +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -19,6 +19,12 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; Variable_name Value innodb_log_file_size 4194304 FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err +SET @save=@@GLOBAL.innodb_log_file_buffering; +SET GLOBAL innodb_log_file_buffering=OFF; +SET GLOBAL innodb_log_file_buffering=ON; +SET GLOBAL innodb_log_file_buffering=@save; +SET GLOBAL innodb_log_file_mmap=OFF; +Got one of the listed errors SET GLOBAL innodb_log_file_size=5242880; connect con1,localhost,root; UPDATE t SET b='' WHERE a<10; diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test index 3b56144ca43..14224ab9c47 100644 --- a/mysql-test/suite/innodb/t/log_file_size_online.test +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -25,6 +25,17 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB; --source include/search_pattern_in_file.inc +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET @save=@@GLOBAL.innodb_log_file_buffering; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=OFF; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=ON; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=@save; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_mmap=OFF; + send SET GLOBAL innodb_log_file_size=5242880; --connect con1,localhost,root diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index a1228716b1d..e4d8480c1fc 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -4,6 +4,7 @@ variable_name not in ( 'innodb_numa_interleave', # only available WITH_NUMA 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS +'innodb_log_file_mmap', # only available on 64-bit 'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 2680e442da4..86f5ffddf1c 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -11,6 +11,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP 'innodb_numa_interleave', # only available WITH_NUMA 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS + 'innodb_log_file_mmap', # only available on 64-bit 'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c index 62d077ccdc4..4087ead1663 100644 --- a/mysys/my_getpagesize.c +++ b/mysys/my_getpagesize.c @@ -16,8 +16,6 @@ #include "mysys_priv.h" -#ifndef HAVE_GETPAGESIZE - #if defined _WIN32 int my_getpagesize(void) @@ -27,6 +25,13 @@ int my_getpagesize(void) return si.dwPageSize; } +#elif defined _SC_PAGESIZE + +int my_getpagesize(void) +{ + return (int)sysconf(_SC_PAGESIZE); +} + #else /* Default implementation */ @@ -36,6 +41,3 @@ int my_getpagesize(void) } #endif - -#endif - diff --git a/mysys/my_init.c b/mysys/my_init.c index 44488e5848a..04c36770289 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -151,9 +151,7 @@ my_bool my_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ my_global_flags= 0; -#ifdef _SC_PAGESIZE - my_system_page_size= sysconf(_SC_PAGESIZE); -#endif + my_system_page_size= my_getpagesize(); /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index b919323f8b3..859ef0fcb4d 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1766,7 +1766,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept static_assert(CPU_LEVEL1_DCACHE_LINESIZE >= 64, "efficiency"); static_assert(CPU_LEVEL1_DCACHE_LINESIZE <= 4096, "compatibility"); byte* c= my_assume_aligned - (is_pmem() ? buf + offset : checkpoint_buf); + (is_mmap() ? buf + offset : checkpoint_buf); memset_aligned(c, 0, CPU_LEVEL1_DCACHE_LINESIZE); mach_write_to_8(my_assume_aligned<8>(c), next_checkpoint_lsn); mach_write_to_8(my_assume_aligned<8>(c + 8), end_lsn); @@ -1775,8 +1775,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept lsn_t resizing; #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) { + ut_ad(!is_opened()); resizing= resize_lsn.load(std::memory_order_relaxed); if (resizing > 1 && resizing <= next_checkpoint_lsn) @@ -1790,12 +1791,12 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept else #endif { + ut_ad(!is_mmap()); ut_ad(!checkpoint_pending); checkpoint_pending= true; latch.wr_unlock(); log_write_and_flush_prepare(); resizing= resize_lsn.load(std::memory_order_relaxed); - /* FIXME: issue an asynchronous write */ ut_ad(ut_is_2pow(write_size)); ut_ad(write_size >= 512); ut_ad(write_size <= 4096); @@ -1838,9 +1839,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resizing > 1 && resizing <= checkpoint_lsn) { - ut_ad(is_pmem() == !resize_flush_buf); + ut_ad(is_mmap() == !resize_flush_buf); - if (!is_pmem()) + if (!is_mmap()) { if (srv_file_flush_method != SRV_O_DSYNC) ut_a(resize_log.flush()); @@ -1849,13 +1850,17 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resize_rename()) { - /* Resizing failed. Discard the log_sys.resize_log. */ + /* Resizing failed. Discard the ib_logfile101. */ #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) + { + ut_ad(!is_opened()); my_munmap(resize_buf, resize_target); + } else #endif { + ut_ad(!is_mmap()); ut_free_dodump(resize_buf, buf_size); ut_free_dodump(resize_flush_buf, buf_size); #ifdef _WIN32 @@ -1873,8 +1878,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept { /* Adopt the resized log. */ #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) { + ut_ad(!is_opened()); my_munmap(buf, file_size); buf= resize_buf; set_buf_free(START_OFFSET + (get_lsn() - resizing)); @@ -1882,6 +1888,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept else #endif { + ut_ad(!is_mmap()); IF_WIN(,log.close()); std::swap(log, resize_log); ut_free_dodump(buf, buf_size); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d35889c4277..9acbd538d78 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18532,7 +18532,10 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, if (high_level_read_only) ib_senderrf(thd, IB_LOG_LEVEL_ERROR, ER_READ_ONLY_MODE); - else if (!log_sys.is_pmem() && + else if ( +#ifdef HAVE_PMEM + !log_sys.is_mmap() && +#endif *static_cast(save) < log_sys.buf_size) my_printf_error(ER_WRONG_ARGUMENTS, "innodb_log_file_size must be at least" @@ -18573,7 +18576,7 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (start > log_sys.get_lsn()) { - ut_ad(!log_sys.is_pmem()); + ut_ad(!log_sys.is_mmap()); /* The server is almost idle. Write dummy FILE_CHECKPOINT records to ensure that the log resizing will complete. */ log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -19437,6 +19440,19 @@ static MYSQL_SYSVAR_UINT(log_buffer_size, log_sys.buf_size, "Redo log buffer size in bytes.", NULL, NULL, 16U << 20, 2U << 20, log_sys.buf_size_max, 4096); +#ifdef HAVE_INNODB_MMAP + static constexpr const char *innodb_log_file_mmap_description= + "Whether ib_logfile0" +# ifdef HAVE_PMEM + " resides in persistent memory or" +# endif + " should initially be memory-mapped"; +static MYSQL_SYSVAR_BOOL(log_file_mmap, log_sys.log_mmap, + PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, + innodb_log_file_mmap_description, + nullptr, nullptr, log_sys.log_mmap_default); +#endif + #if defined __linux__ || defined _WIN32 static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered, PLUGIN_VAR_OPCMDARG, @@ -19922,6 +19938,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(deadlock_report), MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_buffer_size), +#ifdef HAVE_INNODB_MMAP + MYSQL_SYSVAR(log_file_mmap), +#endif #if defined __linux__ || defined _WIN32 MYSQL_SYSVAR(log_file_buffering), #endif diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index cb45f931262..90261050017 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -118,15 +118,14 @@ public: @return file size in bytes @retval 0 if not readable */ os_offset_t open(bool read_only) noexcept; + + /** @return whether a handle to the log is open */ bool is_opened() const noexcept { return m_file != OS_FILE_CLOSED; } dberr_t close() noexcept; dberr_t read(os_offset_t offset, span buf) noexcept; void write(os_offset_t offset, span buf) noexcept; bool flush() const noexcept { return os_file_flush(m_file); } -#ifdef HAVE_PMEM - byte *mmap(bool read_only, const struct stat &st) noexcept; -#endif }; /** Redo log buffer */ @@ -189,7 +188,7 @@ private: public: /** number of append_prepare_wait(); protected by lock_lsn() or lsn_lock */ size_t waits; - /** innodb_log_buffer_size (size of buf,flush_buf if !is_pmem(), in bytes) */ + /** innodb_log_buffer_size (size of buf,flush_buf if !is_mmap(), in bytes) */ unsigned buf_size; /** log file size in bytes, including the header */ lsn_t file_size; @@ -231,7 +230,7 @@ public: /** Last written LSN */ lsn_t write_lsn; - /** buffer for writing data to ib_logfile0, or nullptr if is_pmem() + /** Buffer for writing data to ib_logfile0, or nullptr if is_mmap(). In write_buf(), buf and flush_buf may be swapped */ byte *flush_buf; @@ -280,6 +279,19 @@ public: uint write_size; /** format of the redo log: e.g., FORMAT_10_8 */ uint32_t format; +#ifdef HAVE_INNODB_MMAP + /** whether the memory-mapped interface is enabled for the log */ + my_bool log_mmap; + /** the default value of log_mmap */ + static constexpr bool log_mmap_default= +# if defined __linux__ /* MAP_POPULATE would enable read-ahead */ + true || +# elif defined __FreeBSD__ /* MAP_PREFAULT_READ would enable read-ahead */ + true || +# else /* an unnecessary read-ahead of a large ib_logfile0 is a risk */ +# endif + false; +#endif #if defined __linux__ || defined _WIN32 /** whether file system caching is enabled for the log */ my_bool log_buffered; @@ -322,7 +334,7 @@ public: /** whether there is capacity in the log buffer */ bool buf_free_ok() const noexcept { - ut_ad(!is_pmem()); + ut_ad(!is_mmap()); return (buf_free.load(std::memory_order_relaxed) & ~buf_free_LOCK) < max_buf_free; } @@ -332,12 +344,14 @@ public: void set_buf_free(size_t f) noexcept { ut_ad(f < buf_free_LOCK); buf_free.store(f, std::memory_order_relaxed); } -#ifdef HAVE_PMEM - bool is_pmem() const noexcept { return !flush_buf; } +#ifdef HAVE_INNODB_MMAP + bool is_mmap() const noexcept { return !flush_buf; } #else - static constexpr bool is_pmem() { return false; } + static constexpr bool is_mmap() { return false; } #endif + /** @return whether a handle to the log is open; + is_mmap() && !is_opened() holds for PMEM */ bool is_opened() const noexcept { return log.is_opened(); } /** @return target write LSN to react on !buf_free_ok() */ @@ -381,40 +395,33 @@ public: @return whether an error occurred */ static bool resize_rename() noexcept; -#ifdef HAVE_PMEM /** @return pointer for writing to resize_buf - @retval nullptr if no PMEM based resizing is active */ + @retval nullptr if no is_mmap() based resizing is active */ inline byte *resize_buf_begin(lsn_t lsn) const noexcept; /** @return end of resize_buf */ inline const byte *resize_buf_end() const noexcept { return resize_buf + resize_target; } /** Initialise the redo log subsystem. */ - void create_low(); - /** Initialise the redo log subsystem. - @return whether the initialisation succeeded */ - bool create() { create_low(); return true; } + void create(); /** Attach a log file. @return whether the memory allocation succeeded */ bool attach(log_file_t file, os_offset_t size); -#else - /** Initialise the redo log subsystem. - @return whether the initialisation succeeded */ - bool create(); - /** Attach a log file. */ - void attach_low(log_file_t file, os_offset_t size); - bool attach(log_file_t file, os_offset_t size) - { attach_low(file, size); return true; } -#endif +#ifdef HAVE_INNODB_MMAP + /** Disable memory-mapped access (update log_mmap) */ + void clear_mmap(); + void close_file(bool really_close= true); +#else + static void clear_mmap() {} + void close_file(); +#endif #if defined __linux__ || defined _WIN32 /** Try to enable or disable file system caching (update log_buffered) */ void set_buffered(bool buffered); #endif - void close_file(); - /** Calculate the checkpoint safety margins. */ static void set_capacity(); @@ -494,11 +501,11 @@ private: public: /** Reserve space in the log buffer for appending data. @tparam spin whether to use the spin-only lock_lsn() - @tparam pmem log_sys.is_pmem() + @tparam mmap log_sys.is_mmap() @param size total length of the data to append(), in bytes @param ex whether log_sys.latch is exclusively locked @return the start LSN and the buffer position for append() */ - template + template std::pair append_prepare(size_t size, bool ex) noexcept; /** Append a string of bytes to the redo log. diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index a73b727991c..6cf79c857e4 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -408,19 +408,18 @@ private: ATTRIBUTE_COLD void report_progress() const; public: /** Parse and register one log_t::FORMAT_10_8 mini-transaction, - handling log_sys.is_pmem() buffer wrap-around. + without handling any log_sys.is_mmap() buffer wrap-around. @tparam store whether to store the records @param if_exists if store: whether to check if the tablespace exists */ template static parse_mtr_result parse_mtr(bool if_exists) noexcept; - /** Parse and register one log_t::FORMAT_10_8 mini-transaction, - handling log_sys.is_pmem() buffer wrap-around. + handling log_sys.is_mmap() buffer wrap-around. @tparam store whether to store the records @param if_exists if store: whether to check if the tablespace exists */ template - static parse_mtr_result parse_pmem(bool if_exists) noexcept -#ifdef HAVE_PMEM + static parse_mtr_result parse_mmap(bool if_exists) noexcept +#ifdef HAVE_INNODB_MMAP ; #else { return parse_mtr(if_exists); } diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index bfa66216184..79211326030 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -696,7 +696,7 @@ private: ATTRIBUTE_NOINLINE void encrypt(); /** Commit the mini-transaction log. - @tparam pmem log_sys.is_pmem() + @tparam pmem log_sys.is_mmap() @param mtr mini-transaction @param lsns {start_lsn,flush_ahead} */ template @@ -708,11 +708,11 @@ private: /** Append the redo log records to the redo log buffer. @tparam spin whether to use the spin-only log_sys.lock_lsn() - @tparam pmem log_sys.is_pmem() + @tparam mmap log_sys.is_mmap() @param mtr mini-transaction @param len number of bytes to write @return {start_lsn,flush_ahead} */ - template static + template static std::pair finish_writer(mtr_t *mtr, size_t len); /** The applicable variant of commit_log() */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 1b4f70b683b..70a136273ee 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -170,6 +170,9 @@ using the call command. */ #define UNIV_INLINE static inline #define UNIV_WORD_SIZE SIZEOF_SIZE_T +#if SIZEOF_SIZE_T == 8 +# define HAVE_INNODB_MMAP +#endif /** The following alignment is used in memory allocations in memory heap management to ensure correct alignment for doubles etc. */ @@ -199,7 +202,7 @@ and 2 bits for flags. This limits the uncompressed page size to 16k. /* Define the Min, Max, Default page sizes. */ /** Minimum Page Size Shift (power of 2) */ #define UNIV_PAGE_SIZE_SHIFT_MIN 12U -/** log2 of largest page size (1<<16 == 64436 bytes). */ +/** log2 of largest page size (1<<16 == 65536 bytes). */ /** Maximum Page Size Shift (power of 2) */ #define UNIV_PAGE_SIZE_SHIFT_MAX 16U /** log2 of default page size (1<<14 == 16384 bytes). */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 4ec43a81531..dde2b3f41a9 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -86,11 +86,7 @@ void log_t::set_capacity() log_sys.max_checkpoint_age = margin; } -#ifdef HAVE_PMEM -void log_t::create_low() -#else -bool log_t::create() -#endif +void log_t::create() { ut_ad(this == &log_sys); ut_ad(!is_initialised()); @@ -101,35 +97,10 @@ bool log_t::create() need_checkpoint.store(true, std::memory_order_relaxed); write_lsn= FIRST_LSN; -#ifndef HAVE_PMEM - buf= static_cast(ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME)); - if (!buf) - { - alloc_fail: - sql_print_error("InnoDB: Cannot allocate memory;" - " too large innodb_log_buffer_size?"); - return false; - } - flush_buf= static_cast(ut_malloc_dontdump(buf_size, - PSI_INSTRUMENT_ME)); - if (!flush_buf) - { - ut_free_dodump(buf, buf_size); - buf= nullptr; - goto alloc_fail; - } - - TRASH_ALLOC(buf, buf_size); - TRASH_ALLOC(flush_buf, buf_size); - checkpoint_buf= static_cast(aligned_malloc(4096, 4096)); - memset_aligned<4096>(checkpoint_buf, 0, 4096); - max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; -#else ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); max_buf_free= 1; -#endif latch.SRW_LOCK_INIT(log_latch_key); lsn_lock.init(); @@ -144,9 +115,6 @@ bool log_t::create() set_buf_free(0); ut_ad(is_initialised()); -#ifndef HAVE_PMEM - return true; -#endif } dberr_t log_file_t::close() noexcept @@ -178,22 +146,91 @@ void log_file_t::write(os_offset_t offset, span buf) noexcept << IF_WIN(GetLastError(), errno) << "."; } -#ifdef HAVE_PMEM -# include "cache.h" +#ifdef HAVE_INNODB_MMAP +# ifdef HAVE_PMEM +# include "cache.h" +# endif /** Attempt to memory map a file. @param file log file handle @param size file size @return pointer to memory mapping @retval MAP_FAILED if the memory cannot be mapped */ -static void *log_mmap(os_file_t file, os_offset_t size) +static void *log_mmap(os_file_t file, +# ifdef HAVE_PMEM + bool &is_pmem, /*!< whether the file is on pmem */ +# endif + os_offset_t size) { - void *ptr= - my_mmap(0, size_t(size), - srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE, - MAP_SHARED_VALIDATE | MAP_SYNC, file, 0); -#ifdef __linux__ - if (ptr == MAP_FAILED) + if (my_system_page_size > 4096) + return MAP_FAILED; +# ifndef HAVE_PMEM + if (!log_sys.log_mmap) + /* If support for persistent memory (Linux: mount -o dax) is enabled, + we always attempt to open a MAP_SYNC memory mapping to ib_logfile0. + This mapping will be read-only during crash recovery, and read-write + during normal operation. + + A regular read-only memory mapping may be attempted if + innodb_log_file_mmap=ON. This may benefit mariadb-backup + and crash recovery. */ + return MAP_FAILED; +# endif + + /* For now, InnoDB does not support memory-mapped writes to + a regular log file. + + If PMEM is supported, the initially attempted memory mapping may + be read-write, but the fallback will be read-only. + + The mapping will always be read-only if innodb_read_only=ON or + if mariadb-backup is running in any other mode than --prepare --export. */ + const bool read_only= + srv_read_only_mode || srv_operation >= SRV_OPERATION_BACKUP; + +# ifdef _WIN32 + void *ptr= MAP_FAILED; + if (!read_only); + else if (HANDLE h= + CreateFileMappingA(file, nullptr, PAGE_READONLY, + DWORD(size >> 32), DWORD(size), nullptr)) + { + if (h != INVALID_HANDLE_VALUE) + { + ptr= MapViewOfFileEx(h, FILE_MAP_READ, 0, 0, size, nullptr); + CloseHandle(h); + if (!ptr) + ptr= MAP_FAILED; + } + } +# else + int flags= +# ifdef HAVE_PMEM + MAP_SHARED_VALIDATE | MAP_SYNC, +# else + MAP_SHARED, +# endif + prot= PROT_READ; + + if (!read_only) +# ifdef HAVE_PMEM + prot= PROT_READ | PROT_WRITE; +# else + return MAP_FAILED; +# endif + + void *ptr= my_mmap(0, size_t(size), prot, flags, file, 0); + +# ifdef HAVE_PMEM + is_pmem= ptr != MAP_FAILED; +# endif + + if (ptr != MAP_FAILED) + return ptr; + +# ifdef HAVE_PMEM +# ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ + if (srv_operation < SRV_OPERATION_BACKUP) { struct stat st; if (!fstat(file, &st)) @@ -203,46 +240,82 @@ static void *log_mmap(os_file_t file, os_offset_t size) 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); + is_pmem= st.st_dev == st_dev; + if (!is_pmem) + return ptr; /* MAP_FAILED */ } } } -#endif /* __linux__ */ +# endif /* __linux__ */ + if (read_only && log_sys.log_mmap) + ptr= my_mmap(0, size_t(size), PROT_READ, MAP_SHARED, file, 0); +# endif /* HAVE_PMEM */ +# endif return ptr; } #endif -#ifdef HAVE_PMEM -bool log_t::attach(log_file_t file, os_offset_t size) +#if defined __linux__ || defined _WIN32 +/** Display a message about opening the log */ +ATTRIBUTE_COLD static void log_file_message() +{ + sql_print_information("InnoDB: %s (block size=%u bytes)", +# ifdef HAVE_INNODB_MMAP + log_sys.log_mmap + ? (log_sys.log_buffered + ? "Memory-mapped log" + : "Memory-mapped unbuffered log") + : +# endif + log_sys.log_buffered + ? "Buffered log writes" + : "File system buffers for log disabled", + log_sys.write_size); +} #else -void log_t::attach_low(log_file_t file, os_offset_t size) +static inline void log_file_message() {} #endif + +bool log_t::attach(log_file_t file, os_offset_t size) { log= file; ut_ad(!size || size >= START_OFFSET + SIZE_OF_FILE_CHECKPOINT); file_size= size; -#ifdef HAVE_PMEM ut_ad(!buf); ut_ad(!flush_buf); - if (size && !(size_t(size) & 4095) && srv_operation != SRV_OPERATION_BACKUP) +#ifdef HAVE_INNODB_MMAP + if (size) { - void *ptr= log_mmap(log.m_file, size); +# ifdef HAVE_PMEM + bool is_pmem; + void *ptr= ::log_mmap(log.m_file, is_pmem, size); +# else + void *ptr= ::log_mmap(log.m_file, size); +# endif if (ptr != MAP_FAILED) { - log.close(); - mprotect(ptr, size_t(size), PROT_READ); +# ifdef HAVE_PMEM + if (is_pmem) + { + log.close(); + log_buffered= false; + log_maybe_unbuffered= true; + IF_WIN(,mprotect(ptr, size_t(size), PROT_READ)); + } +# endif buf= static_cast(ptr); max_buf_free= 1; - log_maybe_unbuffered= true; - log_buffered= false; mtr_t::finisher_update(); - return true; +# ifdef HAVE_PMEM + if (is_pmem) + return true; +# endif + goto func_exit; } } + log_mmap= false; +#endif buf= static_cast(ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME)); if (!buf) { @@ -256,33 +329,34 @@ void log_t::attach_low(log_file_t file, os_offset_t size) PSI_INSTRUMENT_ME)); if (!flush_buf) { + alloc_fail2: ut_free_dodump(buf, buf_size); buf= nullptr; goto alloc_fail; } - TRASH_ALLOC(buf, buf_size); - TRASH_ALLOC(flush_buf, buf_size); - max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; -#endif - -#if defined __linux__ || defined _WIN32 - sql_print_information("InnoDB: %s (block size=%u bytes)", - log_buffered - ? "Buffered log writes" - : "File system buffers for log disabled", - write_size); -#endif - - mtr_t::finisher_update(); -#ifdef HAVE_PMEM ut_ad(ut_is_2pow(write_size)); ut_ad(write_size >= 512); ut_ad(write_size <= 4096); checkpoint_buf= static_cast(aligned_malloc(write_size, write_size)); + if (!checkpoint_buf) + { + ut_free_dodump(flush_buf, buf_size); + flush_buf= nullptr; + goto alloc_fail2; + } + + TRASH_ALLOC(buf, buf_size); + TRASH_ALLOC(flush_buf, buf_size); + max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; + mtr_t::finisher_update(); memset_aligned<512>(checkpoint_buf, 0, write_size); - return true; + +#ifdef HAVE_INNODB_MMAP + func_exit: #endif + log_file_message(); + return true; } /** Write a log file header. @@ -325,66 +399,83 @@ void log_t::create(lsn_t lsn) noexcept last_checkpoint_lsn= 0; -#ifdef HAVE_PMEM - if (is_pmem()) - { - mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); - memset_aligned<4096>(buf, 0, 4096); - set_buf_free(START_OFFSET); - } - else -#endif - { - set_buf_free(0); - memset_aligned<4096>(flush_buf, 0, buf_size); - memset_aligned<4096>(buf, 0, buf_size); - } - - log_sys.header_write(buf, lsn, is_encrypted()); DBUG_PRINT("ib_log", ("write header " LSN_PF, lsn)); #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) + { + ut_ad(!is_opened()); + mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); + memset_aligned<4096>(buf, 0, 4096); + log_sys.header_write(buf, lsn, is_encrypted()); + set_buf_free(START_OFFSET); pmem_persist(buf, 512); + } else #endif { + ut_ad(!is_mmap()); + set_buf_free(0); + memset_aligned<4096>(flush_buf, 0, buf_size); + memset_aligned<4096>(buf, 0, buf_size); + log_sys.header_write(buf, lsn, is_encrypted()); log.write(0, {buf, 4096}); memset_aligned<512>(buf, 0, 512); } } -void log_t::close_file() +ATTRIBUTE_COLD static void log_close_failed(dberr_t err) { -#ifdef HAVE_PMEM - if (is_pmem()) + ib::fatal() << "closing ib_logfile0 failed: " << err; +} + +#ifdef HAVE_INNODB_MMAP +void log_t::close_file(bool really_close) +#else +void log_t::close_file() +#endif +{ +#ifdef HAVE_INNODB_MMAP + if (is_mmap()) { - ut_ad(!is_opened()); ut_ad(!checkpoint_buf); + ut_ad(!flush_buf); if (buf) { my_munmap(buf, file_size); buf= nullptr; } - return; + } + else +#endif + { + ut_ad(!buf == !flush_buf); + ut_ad(!buf == !checkpoint_buf); + if (buf) + { + ut_free_dodump(buf, buf_size); + buf= nullptr; + ut_free_dodump(flush_buf, buf_size); + flush_buf= nullptr; + } + aligned_free(checkpoint_buf); + checkpoint_buf= nullptr; } - ut_free_dodump(buf, buf_size); - buf= nullptr; - ut_free_dodump(flush_buf, buf_size); - flush_buf= nullptr; - aligned_free(checkpoint_buf); - checkpoint_buf= nullptr; +#ifdef HAVE_INNODB_MMAP + if (really_close) #endif - if (is_opened()) - if (const dberr_t err= log.close()) - ib::fatal() << "closing ib_logfile0 failed: " << err; + if (is_opened()) + if (const dberr_t err= log.close()) + log_close_failed(err); } /** Acquire all latches that protect the log. */ static void log_resize_acquire() { - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (!log_sys.is_mmap()) +#endif { while (flush_lock.acquire(log_sys.get_lsn() + 1, nullptr) != group_commit_lock::ACQUIRED); @@ -400,7 +491,9 @@ void log_resize_release() { log_sys.latch.wr_unlock(); - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (!log_sys.is_mmap()) +#endif { lsn_t lsn1= write_lock.release(write_lock.value()); lsn_t lsn2= flush_lock.release(flush_lock.value()); @@ -413,13 +506,17 @@ void log_resize_release() /** Try to enable or disable file system caching (update log_buffered) */ void log_t::set_buffered(bool buffered) { - if (!log_maybe_unbuffered || is_pmem() || high_level_read_only) + if (!log_maybe_unbuffered || +#ifdef HAVE_PMEM + is_mmap() || +#endif + high_level_read_only) return; log_resize_acquire(); if (!resize_in_progress() && is_opened() && bool(log_buffered) != buffered) { - os_file_close_func(log.m_file); - log.m_file= OS_FILE_CLOSED; + if (const dberr_t err= log.close()) + log_close_failed(err); std::string path{get_log_file_path()}; log_buffered= buffered; bool success; @@ -427,11 +524,7 @@ void log_t::set_buffered(bool buffered) OS_FILE_OPEN, OS_FILE_NORMAL, OS_LOG_FILE, false, &success); ut_a(log.m_file != OS_FILE_CLOSED); - sql_print_information("InnoDB: %s (block size=%u bytes)", - log_buffered - ? "Buffered log writes" - : "File system buffers for log disabled", - write_size); + log_file_message(); } log_resize_release(); } @@ -450,6 +543,9 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept resize_start_status status= RESIZE_NO_CHANGE; lsn_t start_lsn{0}; +#ifdef HAVE_PMEM + bool is_pmem{false}; +#endif if (resize_in_progress()) status= RESIZE_IN_PROGRESS; @@ -475,10 +571,15 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept void *ptr= nullptr, *ptr2= nullptr; success= os_file_set_size(path.c_str(), resize_log.m_file, size); if (!success); -#ifdef HAVE_PMEM - else if (is_pmem()) +#ifdef HAVE_INNODB_MMAP + else if (is_mmap()) { - ptr= log_mmap(resize_log.m_file, size); + ptr= ::log_mmap(resize_log.m_file, +#ifdef HAVE_PMEM + is_pmem, +#endif + size); + if (ptr == MAP_FAILED) goto alloc_fail; } @@ -518,12 +619,12 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept resize_flush_buf= static_cast(ptr2); start_lsn= get_lsn(); - if (is_pmem()) - resize_log.close(); - else + if (!is_mmap()) start_lsn= first_lsn + (~lsn_t{write_size - 1} & (lsn_t{write_size - 1} + start_lsn - first_lsn)); + else if (!is_opened()) + resize_log.close(); } resize_lsn.store(start_lsn, std::memory_order_relaxed); status= success ? RESIZE_STARTED : RESIZE_FAILED; @@ -552,14 +653,13 @@ void log_t::resize_abort() noexcept if (resize_in_progress() > 1) { - if (!is_pmem()) + if (!is_mmap()) { - resize_log.close(); ut_free_dodump(resize_buf, buf_size); ut_free_dodump(resize_flush_buf, buf_size); resize_flush_buf= nullptr; } -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP else { ut_ad(!resize_log.is_opened()); @@ -568,6 +668,8 @@ void log_t::resize_abort() noexcept my_munmap(resize_buf, resize_target); } #endif + if (resize_log.is_opened()) + resize_log.close(); resize_buf= nullptr; resize_target= 0; resize_lsn.store(0, std::memory_order_relaxed); @@ -732,7 +834,7 @@ static size_t log_pad(lsn_t lsn, size_t pad, byte *begin, byte *extra) #ifdef HAVE_PMEM void log_t::persist(lsn_t lsn, bool holding_latch) noexcept { - ut_ad(is_pmem()); + ut_ad(!is_opened()); ut_ad(!write_lock.is_owner()); ut_ad(!flush_lock.is_owner()); #ifdef LOG_LATCH_DEBUG @@ -752,12 +854,11 @@ void log_t::persist(lsn_t lsn, bool holding_latch) noexcept if (UNIV_UNLIKELY(end < start)) { - pmem_persist(log_sys.buf + start, log_sys.file_size - start); - pmem_persist(log_sys.buf + log_sys.START_OFFSET, - end - log_sys.START_OFFSET); + pmem_persist(buf + start, file_size - start); + pmem_persist(buf + START_OFFSET, end - START_OFFSET); } else - pmem_persist(log_sys.buf + start, end - start); + pmem_persist(buf + start, end - start); old= flushed_to_disk_lsn.load(std::memory_order_relaxed); @@ -818,7 +919,7 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept template inline lsn_t log_t::write_buf() noexcept { ut_ad(latch_have_wr()); - ut_ad(!is_pmem()); + ut_ad(!is_mmap()); ut_ad(!srv_read_only_mode); const lsn_t lsn{get_lsn(std::memory_order_relaxed)}; @@ -941,7 +1042,7 @@ bool log_t::flush(lsn_t lsn) noexcept */ static lsn_t log_flush(lsn_t lsn) { - ut_ad(!log_sys.is_pmem()); + ut_ad(!log_sys.is_mmap()); ut_a(log_sys.flush(lsn)); DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE();); return flush_lock.release(lsn); @@ -961,6 +1062,7 @@ void log_write_up_to(lsn_t lsn, bool durable, ut_ad(!srv_read_only_mode || log_sys.buf_free_ok()); ut_ad(lsn != LSN_MAX); ut_ad(lsn != 0); + ut_ad(!log_sys.is_mmap() || !callback || durable); if (UNIV_UNLIKELY(recv_no_ibuf_operations)) { @@ -973,21 +1075,25 @@ void log_write_up_to(lsn_t lsn, bool durable, ut_ad(lsn <= log_sys.get_lsn()); #ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { - ut_ad(!callback); if (durable) log_sys.persist(lsn, false); return; } #endif + ut_ad(!log_sys.is_mmap()); repeat: if (durable) { if (flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED) return; - flush_lock.set_pending(log_sys.get_lsn()); + /* Promise to other concurrent flush_lock.acquire() that we + will durable at least up to the current LSN. The LSN may still + advance until we acquire log_sys.latch below. */ + lsn= log_sys.get_lsn(); + flush_lock.set_pending(lsn); } lsn_t pending_write_lsn= 0, pending_flush_lsn= 0; @@ -1023,8 +1129,10 @@ void log_buffer_flush_to_disk(bool durable) /** Prepare to invoke log_write_and_flush(), before acquiring log_sys.latch. */ ATTRIBUTE_COLD void log_write_and_flush_prepare() { - if (log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (log_sys.is_mmap()) return; +#endif while (flush_lock.acquire(log_sys.get_lsn() + 1, nullptr) != group_commit_lock::ACQUIRED); @@ -1032,20 +1140,56 @@ ATTRIBUTE_COLD void log_write_and_flush_prepare() group_commit_lock::ACQUIRED); } +#ifdef HAVE_INNODB_MMAP +void log_t::clear_mmap() +{ + if (!is_mmap() || +#ifdef HAVE_PMEM + !is_opened() || +#endif + high_level_read_only) + return; + log_resize_acquire(); + ut_ad(!resize_in_progress()); + ut_ad(write_lsn == get_lsn()); + ut_ad(write_lsn == get_flushed_lsn(std::memory_order_relaxed)); + + if (buf) /* this may be invoked while creating a new database */ + { + alignas(16) byte log_block[4096]; + const size_t bs{write_size}; + const size_t bf{buf_free.load(std::memory_order_relaxed)}; + { + byte *const b= buf; + memcpy_aligned<16>(log_block, b + (bf & ~(bs - 1)), bs); + } + + close_file(false); + log_mmap= false; + ut_a(attach(log, file_size)); + ut_ad(!is_mmap()); + + set_buf_free(bf & (bs - 1)); + memcpy_aligned<16>(log_sys.buf, log_block, bs); + } + log_resize_release(); +} +#endif + /** Durably write the log up to log_sys.get_lsn(). */ ATTRIBUTE_COLD void log_write_and_flush() { ut_ad(!srv_read_only_mode); - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (log_sys.is_mmap()) + log_sys.persist(log_sys.get_lsn(), true); + else +#endif { const lsn_t lsn{log_sys.write_buf()}; write_lock.release(lsn); log_flush(lsn); } -#ifdef HAVE_PMEM - else - log_sys.persist(log_sys.get_lsn(), true); -#endif } /****************************************************************//** @@ -1323,18 +1467,9 @@ void log_t::close() if (!is_initialised()) return; close_file(); -#ifndef HAVE_PMEM - ut_free_dodump(buf, buf_size); - buf= nullptr; - ut_free_dodump(flush_buf, buf_size); - flush_buf= nullptr; - aligned_free(checkpoint_buf); - checkpoint_buf= nullptr; -#else ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); -#endif latch.destroy(); lsn_lock.destroy(); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 2b70501dc11..019001dd37f 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1480,6 +1480,7 @@ void recv_sys_t::debug_free() pages_it= pages.end(); mysql_mutex_unlock(&mutex); + log_sys.clear_mmap(); } @@ -1632,7 +1633,7 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() byte *buf= const_cast(field_ref_zero); - if (source_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) + if (source_offset < (log_sys.is_mmap() ? log_sys.file_size : 4096)) memcpy_aligned<512>(buf, &log_sys.buf[source_offset & ~511], 512); else if (dberr_t err= recv_sys.read(source_offset & ~511, {buf, 512})) @@ -1671,7 +1672,7 @@ static dberr_t recv_log_recover_10_5(lsn_t lsn_offset) { byte *buf= const_cast(field_ref_zero); - if (lsn_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) + if (lsn_offset < (log_sys.is_mmap() ? log_sys.file_size : 4096)) memcpy_aligned<512>(buf, &log_sys.buf[lsn_offset & ~511], 512); else { @@ -1772,7 +1773,7 @@ dberr_t recv_sys_t::find_checkpoint() log_sys.next_checkpoint_lsn= 0; lsn= 0; buf= my_assume_aligned<4096>(log_sys.buf); - if (!log_sys.is_pmem()) + if (!log_sys.is_mmap()) if (dberr_t err= log_sys.log.read(0, {buf, log_sys.START_OFFSET})) return err; /* Check the header page checksum. There was no @@ -2210,7 +2211,7 @@ static void store_freed_or_init_rec(page_id_t page_id, bool freed) /** Wrapper for log_sys.buf[] between recv_sys.offset and recv_sys.len */ struct recv_buf { - bool is_pmem() const noexcept { return log_sys.is_pmem(); } + bool is_mmap() const noexcept { return log_sys.is_mmap(); } const byte *ptr; @@ -2301,11 +2302,11 @@ struct recv_buf } }; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP /** Ring buffer wrapper for log_sys.buf[]; recv_sys.len == log_sys.file_size */ struct recv_ring : public recv_buf { - static constexpr bool is_pmem() { return true; } + static constexpr bool is_mmap() { return true; } constexpr recv_ring(const byte *ptr) : recv_buf(ptr) {} @@ -2598,7 +2599,7 @@ restart: ut_d(const source el{l}); lsn+= l - begin; offset= l.ptr - log_sys.buf; - if (!l.is_pmem()); + if (!l.is_mmap()); else if (offset == log_sys.file_size) offset= log_sys.START_OFFSET; else @@ -3110,12 +3111,12 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse_mtr(bool if_exists) noexcept template recv_sys_t::parse_mtr_result recv_sys_t::parse_mtr(bool) noexcept; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP template -recv_sys_t::parse_mtr_result recv_sys_t::parse_pmem(bool if_exists) noexcept +recv_sys_t::parse_mtr_result recv_sys_t::parse_mmap(bool if_exists) noexcept { recv_sys_t::parse_mtr_result r{parse_mtr(if_exists)}; - if (UNIV_LIKELY(r != PREMATURE_EOF) || !log_sys.is_pmem()) + if (UNIV_LIKELY(r != PREMATURE_EOF) || !log_sys.is_mmap()) return r; ut_ad(recv_sys.len == log_sys.file_size); ut_ad(recv_sys.offset >= log_sys.START_OFFSET); @@ -3126,6 +3127,10 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse_pmem(bool if_exists) noexcept : &log_sys.buf[recv_sys.offset]}; return recv_sys.parse(s, if_exists); } + +/** for mariadb-backup; @see xtrabackup_copy_mmap_logfile() */ +template +recv_sys_t::parse_mtr_result recv_sys_t::parse_mmap(bool) noexcept; #endif /** Apply the hashed log records to the page, if the page lsn is less than the @@ -3996,7 +4001,7 @@ void recv_sys_t::apply(bool last_batch) log_sort_flush_list(); #ifdef HAVE_PMEM - if (last_batch && log_sys.is_pmem()) + if (last_batch && log_sys.is_mmap() && !log_sys.is_opened()) mprotect(log_sys.buf, len, PROT_READ | PROT_WRITE); #endif @@ -4024,15 +4029,13 @@ static bool recv_scan_log(bool last_phase) bool store{recv_sys.file_checkpoint != 0}; size_t buf_size= log_sys.buf_size; -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn)); buf_size= size_t(log_sys.file_size); recv_sys.len= size_t(log_sys.file_size); } else -#endif { recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & block_size_1; @@ -4094,7 +4097,7 @@ static bool recv_scan_log(bool last_phase) for (;;) { const byte& b{log_sys.buf[recv_sys.offset]}; - r= recv_sys.parse_pmem(false); + r= recv_sys.parse_mmap(false); switch (r) { case recv_sys_t::PREMATURE_EOF: goto read_more; @@ -4124,7 +4127,7 @@ static bool recv_scan_log(bool last_phase) else { ut_ad(recv_sys.file_checkpoint != 0); - switch ((r= recv_sys.parse_pmem(false))) { + switch ((r= recv_sys.parse_mmap(false))) { case recv_sys_t::PREMATURE_EOF: goto read_more; case recv_sys_t::GOT_EOF: @@ -4146,11 +4149,11 @@ static bool recv_scan_log(bool last_phase) if (!store) skip_the_rest: - while ((r= recv_sys.parse_pmem(false)) == recv_sys_t::OK); + while ((r= recv_sys.parse_mmap(false)) == recv_sys_t::OK); else { uint16_t count= 0; - while ((r= recv_sys.parse_pmem(last_phase)) == recv_sys_t::OK) + while ((r= recv_sys.parse_mmap(last_phase)) == recv_sys_t::OK) if (!++count && recv_sys.report(time(nullptr))) { const size_t n= recv_sys.pages.size(); @@ -4189,10 +4192,9 @@ static bool recv_scan_log(bool last_phase) } read_more: -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) break; -#endif + if (recv_sys.is_corrupt_log()) break; @@ -4537,13 +4539,13 @@ inline void log_t::set_recovered() noexcept ut_ad(get_flushed_lsn() == get_lsn()); ut_ad(recv_sys.lsn == get_lsn()); size_t offset{recv_sys.offset}; - if (!is_pmem()) + if (!is_mmap()) { const size_t bs{log_sys.write_size}, bs_1{bs - 1}; memmove_aligned<512>(buf, buf + (offset & ~bs_1), bs); offset&= bs_1; } -#ifdef HAVE_PMEM +#ifndef _WIN32 else mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); #endif diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d531838b5fd..15370943a55 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -42,6 +42,7 @@ Created 11/26/1995 Heikki Tuuri #ifdef HAVE_PMEM void (*mtr_t::commit_logger)(mtr_t *, std::pair); #endif + std::pair (*mtr_t::finisher)(mtr_t *, size_t); unsigned mtr_t::spin_wait_delay; @@ -49,7 +50,7 @@ void mtr_t::finisher_update() { ut_ad(log_sys.latch_have_wr()); #ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { commit_logger= mtr_t::commit_log; finisher= spin_wait_delay @@ -351,11 +352,11 @@ inline lsn_t log_t::get_write_target() const return write_lsn + max_buf_free / 2; } -template +template void mtr_t::commit_log(mtr_t *mtr, std::pair lsns) { size_t modified= 0; - const lsn_t write_lsn= pmem ? 0 : log_sys.get_write_target(); + const lsn_t write_lsn= mmap ? 0 : log_sys.get_write_target(); if (mtr->m_made_dirty) { @@ -475,7 +476,7 @@ void mtr_t::commit_log(mtr_t *mtr, std::pair lsns) if (UNIV_UNLIKELY(lsns.second != PAGE_FLUSH_NO)) buf_flush_ahead(mtr->m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); - if (!pmem && UNIV_UNLIKELY(write_lsn != 0)) + if (!mmap && UNIV_UNLIKELY(write_lsn != 0)) log_write_up_to(write_lsn, false); } @@ -1011,7 +1012,7 @@ ATTRIBUTE_COLD size_t log_t::append_prepare_wait(size_t b, bool ex, lsn_t lsn) else latch.rd_unlock(); - log_write_up_to(lsn, is_pmem()); + log_write_up_to(lsn, is_mmap()); if (ex) latch.wr_lock(SRW_LOCK_CALL); @@ -1027,16 +1028,16 @@ ATTRIBUTE_COLD size_t log_t::append_prepare_wait(size_t b, bool ex, lsn_t lsn) /** Reserve space in the log buffer for appending data. @tparam spin whether to use the spin-only lock_lsn() -@tparam pmem log_sys.is_pmem() +@tparam mmap log_sys.is_mmap() @param size total length of the data to append(), in bytes @param ex whether log_sys.latch is exclusively locked @return the start LSN and the buffer position for append() */ -template +template inline std::pair log_t::append_prepare(size_t size, bool ex) noexcept { ut_ad(ex ? latch_have_wr() : latch_have_rd()); - ut_ad(pmem == is_pmem()); + ut_ad(mmap == is_mmap()); if (!spin) lsn_lock.wr_lock(); size_t b{spin ? lock_lsn() : buf_free.load(std::memory_order_relaxed)}; @@ -1044,7 +1045,7 @@ std::pair log_t::append_prepare(size_t size, bool ex) noexcept lsn_t l{lsn.load(std::memory_order_relaxed)}, end_lsn{l + size}; - if (UNIV_UNLIKELY(pmem + if (UNIV_UNLIKELY(mmap ? (end_lsn - get_flushed_lsn(std::memory_order_relaxed)) > capacity() : b + size >= buf_size)) @@ -1057,7 +1058,7 @@ std::pair log_t::append_prepare(size_t size, bool ex) noexcept } size_t new_buf_free= b + size; - if (pmem && new_buf_free >= file_size) + if (mmap && new_buf_free >= file_size) new_buf_free-= size_t(capacity()); lsn.store(end_lsn, std::memory_order_relaxed); @@ -1213,10 +1214,10 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, end-= len; size_t s; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP if (!resize_flush_buf) { - ut_ad(is_pmem()); + ut_ad(is_mmap()); lsn_lock.wr_lock(); const size_t resize_capacity{resize_target - START_OFFSET}; { @@ -1236,7 +1237,7 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, cannot overlap, that is, our entire log must be discarded. Besides, incomplete mini-transactions cannot be parsed anyway. */ ut_ad(resizing >= lsn + len); - goto pmem_done; + goto mmap_done; } s= START_OFFSET; @@ -1277,7 +1278,7 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, we will advance resize_lsn. */ ut_ad(resize_buf[s] <= 1); resize_buf[s]= 1; - pmem_done: + mmap_done: lsn_lock.wr_unlock(); } else @@ -1300,12 +1301,12 @@ inline void log_t::append(byte *&d, const void *s, size_t size) noexcept { ut_ad(log_sys.latch_have_any()); ut_ad(d + size <= log_sys.buf + - (log_sys.is_pmem() ? log_sys.file_size : log_sys.buf_size)); + (log_sys.is_mmap() ? log_sys.file_size : log_sys.buf_size)); memcpy(d, s, size); d+= size; } -template +template std::pair mtr_t::finish_writer(mtr_t *mtr, size_t len) { @@ -1316,16 +1317,14 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) const size_t size{mtr->m_commit_lsn ? 5U + 8U : 5U}; std::pair start= - log_sys.append_prepare(len, mtr->m_latch_ex); + log_sys.append_prepare(len, mtr->m_latch_ex); - if (!pmem) + if (!mmap) { mtr->m_log.for_each_block([&start](const mtr_buf_t::block_t *b) { log_sys.append(start.second, b->begin(), b->used()); return true; }); -#ifdef HAVE_PMEM write_trailer: -#endif *start.second++= log_sys.get_sequence_bit(start.first + len - size); if (mtr->m_commit_lsn) { @@ -1336,7 +1335,6 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) mach_write_to_4(start.second, mtr->m_crc); start.second+= 4; } -#ifdef HAVE_PMEM else { if (UNIV_LIKELY(start.second + len <= &log_sys.buf[log_sys.file_size])) @@ -1384,9 +1382,6 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) ((size >= size_left) ? log_sys.START_OFFSET : log_sys.file_size) + (size - size_left); } -#else - static_assert(!pmem, ""); -#endif log_sys.resize_write(start.first, start.second, len, size); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 124ac4b294d..56b31c12063 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1094,7 +1094,8 @@ same_size: log_sys.latch.wr_unlock(); - log_write_up_to(flushed_lsn, false); + if (latest_format) + log_write_up_to(flushed_lsn, false); ut_ad(flushed_lsn == log_sys.get_lsn()); ut_ad(!os_aio_pending_reads()); @@ -1290,10 +1291,7 @@ dberr_t srv_start(bool create_new_db) } #endif /* UNIV_DEBUG */ - if (!log_sys.create()) { - return srv_init_abort(DB_ERROR); - } - + log_sys.create(); recv_sys.create(); lock_sys.create(srv_lock_table_size); @@ -1856,13 +1854,13 @@ skip_monitors: if (srv_print_verbose_log) { sql_print_information("InnoDB: " "log sequence number " LSN_PF -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP "%s" #endif "; transaction id " TRX_ID_FMT, recv_sys.lsn, -#ifdef HAVE_PMEM - log_sys.is_pmem() +#ifdef HAVE_INNODB_MMAP + log_sys.is_mmap() ? " (memory-mapped)" : "", #endif trx_sys.get_max_trx_id()); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 0a4845f7763..2b304868b14 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1260,20 +1260,20 @@ static void trx_flush_log_if_needed(lsn_t lsn, trx_t *trx) const bool flush= (srv_file_flush_method != SRV_NOSYNC && (srv_flush_log_at_trx_commit & 1)); + if (!log_sys.is_mmap()) + { + completion_callback cb; - completion_callback cb; - if (!log_sys.is_pmem() && - (cb.m_param= thd_increment_pending_ops(trx->mysql_thd))) - { - cb.m_callback = (void (*)(void *)) thd_decrement_pending_ops; - log_write_up_to(lsn, flush, &cb); - } - else - { - trx->op_info= "flushing log"; - log_write_up_to(lsn, flush); - trx->op_info= ""; + if ((cb.m_param= thd_increment_pending_ops(trx->mysql_thd))) + { + cb.m_callback= (void (*)(void *)) thd_decrement_pending_ops; + log_write_up_to(lsn, flush, &cb); + return; + } } + trx->op_info= "flushing log"; + log_write_up_to(lsn, flush); + trx->op_info= ""; } /** Process tables that were modified by the committing transaction. */ From 2d3ddaef3553f8828b55054073359b56c172011b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 27 Sep 2024 12:31:37 +0300 Subject: [PATCH 142/185] MDEV-34907 Bogus assertion failure and busy work while parsing FILE_ records A server that was running with innodb_log_file_size=96M and innodb_buffer_pool_size=6M had inserted some data into a table that was subsequently dropped. When the server was killed and restarted, an assertion failed in recv_sys_t::parse() while a FSP_SIZE change was unnecessarily being processed during the skip_the_rest: loop in recv_scan_log(). The ib_logfile0 contents was as follows: 1. The checkpoint start LSN points to the start of some mini-transaction. 2. There may be log records for modifying files for which a FILE_MODIFY had been written before the checkpoint. These records were "purged" by advancing the checkpoint. 3. At some point during the initial parsing with store=true the space reserved for recv_sys.pages will run out and recv_scan_log() would switch to the skip_the_rest: mode. 4. We encounter a log record for extending a tablespace that will be deleted a bit later. This would trip the bogus debug assertion. 5. Later on, there would be a FILE_DELETE record for this tablespace. 6. The checkpoint end LSN points to a possibly empty sequence of FILE_MODIFY records and a FILE_CHECKPOINT record. Recovery had parsed these records first, before rewinding to the checkpoint start LSN. 7. There could be further records following the FILE_CHECKPOINT record. Recovery will process all records until an inconsistency is found and it is assumed that the end of the circular ib_logfile0 was reached. recv_sys_t::parse(): For the template instantiation with store=false, remove a debug assertion that could fail in a multi-batch recovery, while recv_scan_log(false) would be in the skip_the_rest: loop. It is very well possible that we have not encountered all FILE_ records yet, and therefore we should not complain about unknown tablespaces. Reviewed by: Debarun Banerjee --- storage/innobase/log/log0recv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 019001dd37f..1a49df99f51 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2847,7 +2847,7 @@ restart: last_offset) : file_name_t::initial_flags; if (it == recv_spaces.end()) - ut_ad(!file_checkpoint || space_id == TRX_SYS_SPACE || + ut_ad(!store || space_id == TRX_SYS_SPACE || srv_is_undo_tablespace(space_id)); else if (!it->second.space) { From d0a6a7886b9f8ac71f7a9989585c5446de208980 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 23 Jul 2024 14:33:33 +0300 Subject: [PATCH 143/185] MDEV-25822 JSON_TABLE: default values should allow non-string literals (Polished initial patch by Alexey Botchkov) Make the code handle DEFAULT values of any datatype - Make Json_table_column::On_response::m_default be Item*, not LEX_STRING. - Change the parser to use string literal non-terminals for producing the DEFAULT value -- Also, stop updating json_table->m_text_literal_cs for the DEFAULT value literals as it is not used. --- mysql-test/suite/json/r/json_table.result | 45 +++++++++++++++++++ .../suite/json/r/json_table_mysql.result | 12 +++-- mysql-test/suite/json/t/json_table.test | 24 ++++++++++ mysql-test/suite/json/t/json_table_mysql.test | 6 --- sql/json_table.cc | 22 ++++++--- sql/json_table.h | 3 +- sql/sql_yacc.yy | 32 ++++--------- 7 files changed, 101 insertions(+), 43 deletions(-) diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 20e1a4b1225..2260b8c1f55 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -1036,5 +1036,50 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY jt ALL NULL NULL NULL NULL 40 Table function: json_table drop table t1; # +# MDEV-25822: JSON_TABLE: default values should allow non-string literals +# +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +col1 +0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +col1 +5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +col1 +asdf +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +col1 +-0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +col1 +18446744073709551615 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; +col1 +2021-01-01 +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +col1 +5 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 5 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +col1 +18446744073709551615 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 18446744073709551615 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +col1 +asdf +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 'asdf' ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +# # End of 10.6 tests # diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index 699d5a8b4f3..5f9c437ee6b 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -545,10 +545,12 @@ Warning 1366 Incorrect double value: 'asdf' for column ``.`(temporary)`.`f` at r Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`d` at row 1 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON EMPTY)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON ERROR)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; x @@ -561,12 +563,14 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON EMPTY)) jt' at line 4 +x +2020-01-01 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON ERROR)) jt' at line 4 +x +NULL # # Bug#25413069: SIG11 IN CHECK_COLUMN_GRANT_IN_TABLE_REF # diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 580a8507c8f..ae8deffc0fe 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -893,6 +893,30 @@ explain select c, drop table t1; +--echo # +--echo # MDEV-25822: JSON_TABLE: default values should allow non-string literals +--echo # +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; + +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +show create view v; +drop view v; + + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test index 9f77ad964f3..8595c0e15e8 100644 --- a/mysql-test/suite/json/t/json_table_mysql.test +++ b/mysql-test/suite/json/t/json_table_mysql.test @@ -445,11 +445,8 @@ SELECT * FROM JSON_TABLE('"asdf"', '$' COLUMNS( f FLOAT PATH '$', d DECIMAL PATH '$')) AS jt; -# DEFAULT NULL is not accepted syntax. ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; @@ -457,13 +454,10 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; -# We don't accept dates in DEFAULT ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' diff --git a/sql/json_table.cc b/sql/json_table.cc index d4ba9f88a78..86f565aa561 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -1030,8 +1030,7 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, return 1; case Json_table_column::RESPONSE_DEFAULT: f->set_notnull(); - f->store(m_default.str, - m_default.length, jc->m_defaults_cs); + m_default->save_in_field(f, TRUE); break; } return 0; @@ -1041,7 +1040,11 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, int Json_table_column::On_response::print(const char *name, String *str) const { LEX_CSTRING resp; - const LEX_CSTRING *ds= NULL; + + char valbuf[512]; + String val(valbuf, sizeof(valbuf), str->charset()); + String *ds= NULL; + if (m_response == Json_table_column::RESPONSE_NOT_SPECIFIED) return 0; @@ -1056,7 +1059,7 @@ int Json_table_column::On_response::print(const char *name, String *str) const case Json_table_column::RESPONSE_DEFAULT: { lex_string_set3(&resp, STRING_WITH_LEN("DEFAULT")); - ds= &m_default; + ds= m_default->val_str(&val); break; } default: @@ -1065,9 +1068,14 @@ int Json_table_column::On_response::print(const char *name, String *str) const } return (str->append(' ') || str->append(resp) || - (ds && (str->append(STRING_WITH_LEN(" '")) || - str->append_for_single_quote(ds->str, ds->length) || - str->append('\''))) || + (ds && + (str->append(' ') || + (m_default->result_type()==STRING_RESULT && str->append('\''))|| + + str->append_for_single_quote(ds) || + + (m_default->result_type()==STRING_RESULT && str->append('\''))))|| + str->append(STRING_WITH_LEN(" ON ")) || str->append(name, strlen(name))); } diff --git a/sql/json_table.h b/sql/json_table.h index 7316edd4ee6..545dfb0aa90 100644 --- a/sql/json_table.h +++ b/sql/json_table.h @@ -140,7 +140,7 @@ public: { public: Json_table_column::enum_on_response m_response; - LEX_CSTRING m_default; + Item *m_default; int respond(Json_table_column *jc, Field *f, uint error_num); int print(const char *name, String *str) const; bool specified() const { return m_response != RESPONSE_NOT_SPECIFIED; } @@ -154,7 +154,6 @@ public: Create_field *m_field; Json_table_nested_path *m_nest; CHARSET_INFO *m_explicit_cs; - CHARSET_INFO *m_defaults_cs; void set(enum_type ctype) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ed2bcd5deb9..50a115a3201 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1328,7 +1328,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TEXT_STRING NCHAR_STRING json_text_literal - json_text_literal_or_num %type opt_table_alias_clause @@ -1512,6 +1511,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); simple_target_specification condition_number opt_versioning_interval_start + json_default_literal %type param_marker @@ -11595,26 +11595,6 @@ json_text_literal: } ; -json_text_literal_or_num: - json_text_literal - | NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | LONG_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | DECIMAL_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | FLOAT_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - ; - join_table_list: derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } ; @@ -11720,6 +11700,12 @@ json_opt_on_empty_or_error: | json_on_empty_response json_on_error_response ; +json_default_literal: + literal + | signed_literal + ; + + json_on_response: ERROR_SYM { @@ -11729,12 +11715,10 @@ json_on_response: { $$.m_response= Json_table_column::RESPONSE_NULL; } - | DEFAULT json_text_literal_or_num + | DEFAULT json_default_literal { $$.m_response= Json_table_column::RESPONSE_DEFAULT; $$.m_default= $2; - Lex->json_table->m_cur_json_table_column->m_defaults_cs= - thd->variables.collation_connection; } ; From ce272f7c2959d4fcf1cefc9d048e7ff90f0b31a6 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 23 Jul 2024 14:58:24 +0300 Subject: [PATCH 144/185] Remove unused Table_function_json_table::m_text_literal_cs --- sql/json_table.h | 3 --- sql/sql_yacc.yy | 7 ------- 2 files changed, 10 deletions(-) diff --git a/sql/json_table.h b/sql/json_table.h index 545dfb0aa90..d228fdb1fad 100644 --- a/sql/json_table.h +++ b/sql/json_table.h @@ -260,9 +260,6 @@ public: /* SQL Parser: current column in JSON_TABLE (...) syntax */ Json_table_column *m_cur_json_table_column; - /* SQL Parser: charset of the current text literal */ - CHARSET_INFO *m_text_literal_cs; - private: /* Context to be used for resolving the first argument. */ Name_resolution_context *m_context; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 50a115a3201..9a21a93c788 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -11581,16 +11581,9 @@ table_ref: json_text_literal: TEXT_STRING - { - Lex->json_table->m_text_literal_cs= NULL; - } | NCHAR_STRING - { - Lex->json_table->m_text_literal_cs= national_charset_info; - } | UNDERSCORE_CHARSET TEXT_STRING { - Lex->json_table->m_text_literal_cs= $1; $$= $2; } ; From 2c0b7ff2b4b11fa82ff074ab1f4d24885c1dad47 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 27 Sep 2024 14:42:53 +0200 Subject: [PATCH 145/185] Windows : support Wix toolset 3.14 Chocolatey package manager installs this one. --- win/packaging/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt index ba4a631f5fd..191809aa96b 100644 --- a/win/packaging/CMakeLists.txt +++ b/win/packaging/CMakeLists.txt @@ -23,7 +23,7 @@ ENDIF() SET(MANUFACTURER "MariaDB Corporation Ab") SET(WIX_BIN_PATHS) -FOREACH(WIX_VER 3.9 3.10 3.11) +FOREACH(WIX_VER 3.9 3.10 3.11 3.14) LIST(APPEND WIX_BIN_PATHS "$ENV{ProgramFiles}/WiX Toolset v${WIX_VER}/bin") LIST(APPEND WIX_BIN_PATHS "$ENV{ProgramFiles} (x86)/WiX Toolset v${WIX_VER}/bin") ENDFOREACH() From 78e640ea3e02d1b2a4605c0fc78356eee6b4b87a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 27 Sep 2024 14:44:20 +0200 Subject: [PATCH 146/185] MDEV-34808 Update HeidiSQL to v12.8 --- win/packaging/heidisql.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index 681a4250e65..f745eeb060b 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_12.6_32_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_12.8_32_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) From 35c732cdde6a637514ec29abcb752446e5a24295 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Wed, 18 Sep 2024 14:19:52 +0200 Subject: [PATCH 147/185] MDEV-25611: RESET MASTER causes the server to hang RESET MASTER waits for storage engines to reply to a binlog checkpoint requests. If this response is delayed for a long time for some reason, then RESET MASTER can hang. Fix this by forcing a log sync in all engines just before waiting for the checkpoint reply. (Waiting for old checkpoint responses is needed to preserve durability of any commits that were synced to disk in the to-be-deleted binlog but not yet synced in the engine.) Reviewed-by: Andrei Elkin Signed-off-by: Kristian Nielsen --- .../suite/binlog/r/binlog_mdev25611.result | 28 ++++++++++ .../suite/binlog/t/binlog_mdev25611.test | 54 +++++++++++++++++++ sql/log.cc | 3 ++ storage/innobase/handler/ha_innodb.cc | 7 ++- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_mdev25611.result create mode 100644 mysql-test/suite/binlog/t/binlog_mdev25611.test diff --git a/mysql-test/suite/binlog/r/binlog_mdev25611.result b/mysql-test/suite/binlog/r/binlog_mdev25611.result new file mode 100644 index 00000000000..04204a89f4e --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mdev25611.result @@ -0,0 +1,28 @@ +*** MDEV-25611: RESET MASTER hangs waiting for InnoDB to flush its log +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid"; +SET @old_flush= @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +SET @old_flush_timeout= @@GLOBAL.innoDB_flush_log_at_timeout; +SET GLOBAL innoDB_flush_log_at_timeout=2700; +connection default; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (3,1); +connect stop_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 VALUES (4,2); +DELETE FROM t1 WHERE a in (1,2,3); +FLUSH BINARY LOGS; +connection stop_purge; +ROLLBACK; +connection default; +disconnect stop_purge; +RESET MASTER; +connection default; +DROP TABLE t1; +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL innodb_flush_log_at_trx_commit= @old_flush; +SET GLOBAL innoDB_flush_log_at_timeout= @old_flush_timeout; diff --git a/mysql-test/suite/binlog/t/binlog_mdev25611.test b/mysql-test/suite/binlog/t/binlog_mdev25611.test new file mode 100644 index 00000000000..e9a2dbc283c --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mdev25611.test @@ -0,0 +1,54 @@ +source include/have_innodb.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_mixed.inc; + +--echo *** MDEV-25611: RESET MASTER hangs waiting for InnoDB to flush its log +# Error injection to minimize extra log flushing inside innodb. +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid"; +# Couple other settings that reduce redo log flushing, thus potentially +# triggering the hang. +SET @old_flush= @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +SET @old_flush_timeout= @@GLOBAL.innoDB_flush_log_at_timeout; +SET GLOBAL innoDB_flush_log_at_timeout=2700; + +--connection default +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (3,1); + +connect (stop_purge,localhost,root,,); +# This blocks purge due to old data being still visible. +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connection default +INSERT INTO t1 VALUES (4,2); +DELETE FROM t1 WHERE a in (1,2,3); + +# Rotate the binlog and wait for everything to settle down and latest binlog +# checkpoint to be done. The small sleep helps trigger the bug more reliably +# before the fix. +FLUSH BINARY LOGS; +--sleep 0.1 + +# Now unblock the purge, and wait for some purge records to be written +# to the redo log so the LSN is incremented but will not be synced to +# disk until something else happens. +--connection stop_purge +ROLLBACK; +--connection default +--disconnect stop_purge + +--sleep 0.1 + +# Now see if RESET MASTER will request and wait for a binlog checkpoint that is never reported. +RESET MASTER; + +# Clean up. +--connection default +DROP TABLE t1; +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL innodb_flush_log_at_trx_commit= @old_flush; +SET GLOBAL innoDB_flush_log_at_timeout= @old_flush_timeout; diff --git a/sql/log.cc b/sql/log.cc index d01be078f17..1054e36afda 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4435,6 +4435,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, mark_xids_active(current_binlog_id, 1); do_checkpoint_request(current_binlog_id); + /* Flush all engine logs to force checkpoint responses to come through. */ + ha_flush_logs(); + /* Now wait for all checkpoint requests and pending unlog() to complete. */ mysql_mutex_lock(&LOCK_xid_list); for (;;) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e1bcda284c8..e2cd72a5b75 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1583,10 +1583,9 @@ innobase_start_trx_and_assign_read_view( @return false */ static bool innobase_flush_logs(handlerton*) { - if (!srv_read_only_mode && srv_flush_log_at_trx_commit) - /* Write any outstanding redo log. Durably if - innodb_flush_log_at_trx_commit=1. */ - log_buffer_flush_to_disk(srv_flush_log_at_trx_commit == 1); + if (!srv_read_only_mode) + /* Write and flush any outstanding redo log. */ + log_buffer_flush_to_disk(true); return false; } From cf0c3ec27458523cdab9a756943db40bbdcad55f Mon Sep 17 00:00:00 2001 From: sjaakola Date: Wed, 28 Dec 2022 19:44:41 +0200 Subject: [PATCH 148/185] MDEV-30307 KILL command inside a transaction causes problem for galera replication Added new test scenario in galera.galera_bf_kill test to make the issue surface. The tetst scenario has a multi statement transaction containing a KILL command. When the KILL is submitted, another transaction is replicated, which causes BF abort for the KILL command processing. Handling BF abort rollback while executing KILL command causes node hanging, in this scenario. sql_kill() and sql_kill_user() functions have now fix, to perform implicit commit before starting the KILL command execution. BEcause of the implicit commit, the KILL execution will not happen inside transaction context anymore. Signed-off-by: Julius Goryavsky --- .../suite/galera/r/galera_bf_kill.result | 29 ++++++++ mysql-test/suite/galera/t/galera_bf_kill.test | 67 +++++++++++++++++++ sql/sql_parse.cc | 41 +++++++++++- 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result index 71b0366081b..41e7f2b0db0 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill.result +++ b/mysql-test/suite/galera/r/galera_bf_kill.result @@ -77,4 +77,33 @@ a b 5 2 disconnect node_2a; connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +truncate t1; +insert into t1 values (7,0); +connection node_2; +set wsrep_sync_wait=0; +begin; +update t1 set b=2 where a=7; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +set wsrep_sync_wait=0; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; +connection node_1; +update t1 set b=1 where a=7; +connection node_2b; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_2; +connection node_2b; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +commit; +select * from t1; +a b +7 1 +connection node_2a; +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL debug_dbug = ""; drop table t1; +disconnect node_2a; +disconnect node_2b; diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1b35b609a96..b952d567556 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -154,4 +154,71 @@ select * from t1; --disconnect node_2a --connection node_1 + +# +# Test case 7: Start a transaction on node_2 and use KILL to abort +# a query in connection node_2a +# During the KILL execution replicate conflicting transaction from node_1 +# to BF abort the transaction executing the KILL +# + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +truncate t1; +insert into t1 values (7,0); + +--connection node_2 +set wsrep_sync_wait=0; + +# get the ID of connection to be later killed +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1 +--source include/wait_condition.inc +--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1` + +# start a transaction +begin; +update t1 set b=2 where a=7; + +# set sync point for incoming applying +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +set wsrep_sync_wait=0; + +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; + +# replicate conflicting transaction, should stopp in the sync point +--connection node_1 +update t1 set b=1 where a=7; + +# wait for the applier to reach the sync point +--connection node_2b +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +# issue KILL inside the transacion, implicit commit is expected +--connection node_2 +--disable_query_log +--send_eval KILL QUERY $k_thread +--enable_query_log + +# wait for the KILL processing to be seen in processlist +--connection node_2b +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND INFO LIKE 'KILL QUERY%' +--source include/wait_condition.inc + +# resume applying, BF abort should follow +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--error ER_LOCK_DEADLOCK +--reap + +commit; + +select * from t1; + +--connection node_2a +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL debug_dbug = ""; + drop table t1; +--disconnect node_2a +--disconnect node_2b diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 377d3051794..e0c87ec2117 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9599,8 +9599,27 @@ static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { #ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } + bool wsrep_high_priority= false; -#endif +#endif /* WITH_WSREP */ uint error= kill_one_thread(thd, id, state, type #ifdef WITH_WSREP , wsrep_high_priority @@ -9632,6 +9651,26 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state) { uint error; ha_rows rows; +#ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } +#endif /* WITH_WSREP */ switch (error= kill_threads_for_user(thd, user, state, &rows)) { case 0: From 95d285fb752dcf0f80045e7a24d9c417d6ffbb1b Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 30 Sep 2024 00:31:48 +0200 Subject: [PATCH 149/185] MDEV-30307 addendum: support for compilation in release mode --- .../suite/galera/r/galera_bf_kill,debug.rdiff | 37 +++++++++++++++++++ .../suite/galera/r/galera_bf_kill.result | 29 --------------- mysql-test/suite/galera/t/galera_bf_kill.test | 8 +++- 3 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff diff --git a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff new file mode 100644 index 00000000000..e02acc3de08 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff @@ -0,0 +1,37 @@ +--- a/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.result ++++ b/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.reject +@@ -77,4 +77,34 @@ a b + 5 2 + disconnect node_2a; + connection node_1; ++connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++connection node_2a; ++truncate t1; ++insert into t1 values (7,0); ++connection node_2; ++set wsrep_sync_wait=0; ++begin; ++update t1 set b=2 where a=7; ++connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++set wsrep_sync_wait=0; ++SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; ++connection node_1; ++update t1 set b=1 where a=7; ++connection node_2b; ++SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; ++connection node_2; ++connection node_2b; ++SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; ++connection node_2; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++commit; ++select * from t1; ++a b ++7 1 ++connection node_2a; ++SET DEBUG_SYNC= 'RESET'; ++SET GLOBAL debug_dbug = ""; ++disconnect node_2a; ++disconnect node_2b; ++connection node_1; + drop table t1; diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result index 41e7f2b0db0..71b0366081b 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill.result +++ b/mysql-test/suite/galera/r/galera_bf_kill.result @@ -77,33 +77,4 @@ a b 5 2 disconnect node_2a; connection node_1; -connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2a; -truncate t1; -insert into t1 values (7,0); -connection node_2; -set wsrep_sync_wait=0; -begin; -update t1 set b=2 where a=7; -connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; -set wsrep_sync_wait=0; -SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; -connection node_1; -update t1 set b=1 where a=7; -connection node_2b; -SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; -connection node_2; -connection node_2b; -SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; -connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -commit; -select * from t1; -a b -7 1 -connection node_2a; -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL debug_dbug = ""; drop table t1; -disconnect node_2a; -disconnect node_2b; diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index b952d567556..1cb2e866cb4 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -155,6 +155,8 @@ select * from t1; --connection node_1 +source include/maybe_debug.inc; +if ($have_debug) { # # Test case 7: Start a transaction on node_2 and use KILL to abort # a query in connection node_2a @@ -219,6 +221,10 @@ select * from t1; SET DEBUG_SYNC= 'RESET'; SET GLOBAL debug_dbug = ""; -drop table t1; --disconnect node_2a --disconnect node_2b + +--connection node_1 +} + +drop table t1; From 69874ee95c337cad36224ecd4b37293ea87caed4 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 30 Sep 2024 15:12:00 +1000 Subject: [PATCH 150/185] MDEV-34828 Remove some obsolete cmake code related to the removed spider handlersocket support A fixup of MDEV-26858 --- storage/spider/CMakeLists.txt | 5 -- storage/spider/Makefile.am | 89 ---------------------------- storage/spider/hs_client/hs_compat.h | 24 -------- storage/spider/spd_db_include.h | 5 +- 4 files changed, 4 insertions(+), 119 deletions(-) delete mode 100644 storage/spider/Makefile.am delete mode 100644 storage/spider/hs_client/hs_compat.h diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt index 11304d05b18..cde6de6142b 100644 --- a/storage/spider/CMakeLists.txt +++ b/storage/spider/CMakeLists.txt @@ -1,6 +1,3 @@ -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET") - IF(HAVE_WVLA) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla") @@ -45,8 +42,6 @@ IF(EXISTS ${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake) ELSEIF(PLUGIN_PARTITION MATCHES "^NO$") MESSAGE(STATUS "Spider is skipped because partitioning is disabled") ELSE() - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/spider/hs_client) - IF(DEB) SET(extra_options COMPONENT spider-engine) ELSE() diff --git a/storage/spider/Makefile.am b/storage/spider/Makefile.am deleted file mode 100644 index 3847b3f2332..00000000000 --- a/storage/spider/Makefile.am +++ /dev/null @@ -1,89 +0,0 @@ -HAVE_HANDLERSOCKET = "-DHAVE_HANDLERSOCKET" - -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(SPD_MYSQL_INC)$(top_srcdir)/include \ - -I$(SPD_MYSQL_INC)$(top_srcdir)/regex \ - -I$(SPD_MYSQL_INC)$(top_srcdir)/sql \ - -I$(SPD_MYSQL_INC)$(top_srcdir)/extra/yassl/include \ - -I./hs_client \ - $(MYSQL_INCLUDE_PATH) \ - $(HANDLERSOCKET_INCLUDE_PATH) - -noinst_HEADERS = ha_spider.h spd_conn.h spd_db_conn.h \ - spd_db_include.h spd_err.h spd_sys_table.h \ - spd_table.h spd_trx.h spd_include.h spd_param.h \ - spd_direct_sql.h spd_udf.h spd_ping_table.h \ - spd_copy_tables.h spd_malloc.h \ - spd_db_mysql.h spd_db_handlersocket.h \ - hs_client/allocator.hpp hs_client/config.hpp \ - hs_client/mutex.hpp hs_client/string_util.hpp \ - hs_client/auto_addrinfo.hpp hs_client/escape.hpp \ - hs_client/socket.hpp hs_client/thread.hpp \ - hs_client/auto_file.hpp hs_client/fatal.hpp \ - hs_client/string_buffer.hpp hs_client/util.hpp \ - hs_client/auto_ptrcontainer.hpp \ - hs_client/hstcpcli.hpp hs_client/string_ref.hpp \ - hs_client/hs_compat.h - -lib_LTLIBRARIES = $(PLUGIN_SPIDER_LTLIBRARIES_TARGET) -EXTRA_LTLIBRARIES = ha_spider.la -pkgplugin_LTLIBRARIES = @plugin_spider_shared_target@ -ha_spider_la_LDFLAGS = -shared -module -rpath $(pkgplugindir) -ha_spider_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN \ - $(HAVE_HANDLERSOCKET) -ha_spider_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN \ - $(HAVE_HANDLERSOCKET) -ha_spider_la_SOURCES = \ - spd_param.cc \ - spd_sys_table.cc \ - spd_trx.cc \ - spd_db_conn.cc \ - spd_conn.cc \ - spd_table.cc \ - spd_direct_sql.cc \ - spd_udf.cc \ - spd_ping_table.cc \ - spd_copy_tables.cc \ - spd_i_s.cc \ - spd_malloc.cc \ - ha_spider.cc \ - spd_db_mysql.cc \ - spd_db_handlersocket.cc \ - hs_client/config.cpp \ - hs_client/escape.cpp \ - hs_client/fatal.cpp \ - hs_client/hstcpcli.cpp \ - hs_client/socket.cpp \ - hs_client/string_util.cpp - -lib_LIBRARIES = $(PLUGIN_SPIDER_LIBRARIES_TARGET) -EXTRA_LIBRARIES = libspider.a -noinst_LIBRARIES = @plugin_spider_static_target@ -libspider_a_CXXFLAGS = $(AM_CXXFLAGS) $(HAVE_HANDLERSOCKET) -libspider_a_CFLAGS = $(AM_CFLAGS) $(HAVE_HANDLERSOCKET) -libspider_a_SOURCES = \ - spd_param.cc \ - spd_sys_table.cc \ - spd_trx.cc \ - spd_db_conn.cc \ - spd_conn.cc \ - spd_table.cc \ - spd_direct_sql.cc \ - spd_udf.cc \ - spd_ping_table.cc \ - spd_copy_tables.cc \ - spd_i_s.cc \ - spd_malloc.cc \ - ha_spider.cc \ - spd_db_mysql.cc \ - spd_db_handlersocket.cc \ - hs_client/config.cpp \ - hs_client/escape.cpp \ - hs_client/fatal.cpp \ - hs_client/hstcpcli.cpp \ - hs_client/socket.cpp \ - hs_client/string_util.cpp - -EXTRA_DIST = plug.in -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/storage/spider/hs_client/hs_compat.h b/storage/spider/hs_client/hs_compat.h deleted file mode 100644 index b12711fa3d1..00000000000 --- a/storage/spider/hs_client/hs_compat.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2013-2018 Kentoku Shiba - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#ifndef HS_COMPAT_H -#define HS_COMPAT_H - -#define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \ - my_init_dynamic_array2(PSI_INSTRUMENT_ME, A, B, C, D, E, F) -#define SPD_INIT_ALLOC_ROOT(A, B, C, D) \ - init_alloc_root(PSI_INSTRUMENT_ME, A, B, C, D) - -#endif diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index ac031dfe64d..17ae8a42704 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -14,7 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#include "hs_compat.h" +#define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \ + my_init_dynamic_array2(PSI_INSTRUMENT_ME, A, B, C, D, E, F) +#define SPD_INIT_ALLOC_ROOT(A, B, C, D) \ + init_alloc_root(PSI_INSTRUMENT_ME, A, B, C, D) #define SPIDER_DBTON_SIZE 15 From f43ea935a1220c534f692ac85f85b654a9f2d15a Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 25 Jul 2024 17:24:13 +0800 Subject: [PATCH 151/185] MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags --- storage/spider/ha_spider.cc | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 1eb0dc6e53f..701d0c6eba3 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1223,7 +1223,6 @@ int ha_spider::reset() int ha_spider::extra( enum ha_extra_function operation ) { - int error_num; DBUG_ENTER("ha_spider::extra"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider operation=%d", (int) operation)); @@ -1273,16 +1272,6 @@ int ha_spider::extra( case HA_EXTRA_INSERT_WITH_UPDATE: wide_handler->insert_with_update = TRUE; break; - case HA_EXTRA_ATTACH_CHILDREN: - DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; - case HA_EXTRA_ADD_CHILDREN_LIST: - DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN")); if (table_share->primary_key != MAX_KEY) From 42735c557e7f5f515684e649f112abfd59b18aba Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 2 Aug 2024 15:27:35 +1000 Subject: [PATCH 152/185] MDEV-34636 Spider: reset wide_handler->trx in two occasions ha_spider::update_create_info() ha_spider::append_lock_tables_list() --- storage/spider/ha_spider.cc | 11 +++---- .../spider/bugfix/r/mdev_34636.result | 20 +++++++++++++ .../spider/bugfix/t/mdev_34636.test | 29 +++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 701d0c6eba3..b4be3c2fd8e 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -5746,13 +5746,6 @@ int ha_spider::info( DBUG_PRINT("info",("spider flag=%x", flag)); auto_inc_temporary = FALSE; wide_handler->sql_command = thd_sql_command(thd); -/* - if ( - sql_command == SQLCOM_DROP_TABLE || - sql_command == SQLCOM_ALTER_TABLE || - sql_command == SQLCOM_SHOW_CREATE - ) { -*/ if (flag & HA_STATUS_AUTO) { if (share->lgtm_tblhnd_share->auto_increment_value) @@ -8131,6 +8124,8 @@ void ha_spider::update_create_info( DBUG_PRINT("info",("spider this=%p", this)); if (wide_handler && wide_handler->sql_command == SQLCOM_ALTER_TABLE) { + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &store_error_num))) + DBUG_VOID_RETURN; SPIDER_TRX *trx = wide_handler->trx; THD *thd = trx->thd; if (trx->query_id != thd->query_id) @@ -11621,6 +11616,8 @@ int ha_spider::append_lock_tables_list() DBUG_PRINT("info",("spider lock_table_type=%u", wide_handler->lock_table_type)); + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) + DBUG_RETURN(error_num); if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this, FALSE))) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result new file mode 100644 index 00000000000..472a050a4f3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result @@ -0,0 +1,20 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +INSERT INTO t2 SELECT * FROM t3; +ERROR 21S01: Column count doesn't match value count at row 1 +SELECT * FROM t3; +ERROR HY000: Unable to connect to foreign data source: localhost +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +DROP TABLE t1,t2,t3; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test new file mode 100644 index 00000000000..08a699b9370 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test @@ -0,0 +1,29 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t2 SELECT * FROM t3; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +SELECT * FROM t3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +# Cleanup +DROP TABLE t1,t2,t3; + +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log From 282b92f0a2b461e99d6d8876cdc4a1673a8b6b62 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 18 Jul 2024 17:26:27 +0800 Subject: [PATCH 153/185] MDEV-34589 Do not execute before queries in spider_db_mbase::rollback() Rollback is not supposed to fail. This prevents false failures in spider rollback. --- .../spider/bugfix/r/mdev_34589.result | 23 ++++++++++++++++++ .../spider/bugfix/t/mdev_34589.test | 24 +++++++++++++++++++ storage/spider/spd_db_mysql.cc | 14 ++++++++--- 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result new file mode 100644 index 00000000000..557c9031330 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result @@ -0,0 +1,23 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check error Partition p0 returned error +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check error Unknown - internal error 1227 during operation +drop table t1, t2; +drop server srv; +drop user spider@localhost; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test new file mode 100644 index 00000000000..dd465b52db1 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test @@ -0,0 +1,24 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +CHECK TABLE t2; +drop table t1, t2; +drop server srv; +drop user spider@localhost; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 9ab15058253..06dcee81462 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -2548,13 +2548,21 @@ int spider_db_mbase::commit( int spider_db_mbase::rollback( int *need_mon ) { - bool is_error; + bool is_error, save_in_before_query; int error_num= 0; DBUG_ENTER("spider_db_mbase::rollback"); DBUG_PRINT("info",("spider this=%p", this)); spider_lock_before_query(conn, need_mon); - if (spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, - SPIDER_SQL_ROLLBACK_LEN, -1, need_mon)) + save_in_before_query= conn->in_before_query; + /* + We do not execute the before queries to avoid unnecessary + failures in rollback + */ + conn->in_before_query= TRUE; + error_num= spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, + SPIDER_SQL_ROLLBACK_LEN, -1, need_mon); + conn->in_before_query= save_in_before_query; + if (error_num) { is_error= conn->thd->is_error(); error_num= spider_db_errorno(conn); From b7bca3ff71615ab918410f02ffae74f8d66ff03f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 3 Jul 2024 16:52:08 +0800 Subject: [PATCH 154/185] MDEV-34518 Initialise THD::max_tmp_space_used --- sql/sql_class.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index f79d99c902e..b3b58833e13 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3867,7 +3867,7 @@ public: ulonglong tmp_tables_size; ulonglong bytes_sent_old; ulonglong affected_rows; /* Number of changed rows */ - ulonglong max_tmp_space_used; + ulonglong max_tmp_space_used= 0; Opt_trace_context opt_trace; pthread_t real_id; /* For debugging */ From f199dffe3bf25640dbf7882bf9084ddcb4977fb7 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 27 Sep 2024 06:48:55 +1000 Subject: [PATCH 155/185] MDEV-34937 s3 engine no longer functional on non-gcc builds Last commit on libmarias3 broke non-gcc builds by excluding the most important aspect, the snprintf being executed. Reviewer: Andrew Hutchings Ref: https://github.com/mariadb-corporation/libmarias3/pull/130 --- storage/maria/libmarias3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/maria/libmarias3 b/storage/maria/libmarias3 index 5e6aa32f96e..0d5babbe46f 160000 --- a/storage/maria/libmarias3 +++ b/storage/maria/libmarias3 @@ -1 +1 @@ -Subproject commit 5e6aa32f96ebdbcaf32b90d6182685156f8198b5 +Subproject commit 0d5babbe46f17147ed51efd1f05a0001017a2aad From dd5ce6b0c4737de5313cd2d3f173c1c646d1f6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Sep 2024 13:36:38 +0300 Subject: [PATCH 156/185] MDEV-34450 os_file_write_func() is an overkill for ib_logfile0 log_file_t::read(), log_file_t::write(): Invoke pread() or pwrite() directly, so that we can give more accurate diagnostics in case of a failure, and so that we will avoid the overhead of setting up 5(!) stack frames and related objects. tpool::pwrite(): Add a missing const qualifier. --- storage/innobase/log/log0log.cc | 54 ++++++++++++++++++++++++++++----- tpool/aio_simulated.cc | 6 ++-- tpool/tpool.h | 6 ++-- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index dde2b3f41a9..eff5f5889cd 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -46,6 +46,7 @@ Created 12/9/1995 Heikki Tuuri #include "buf0dump.h" #include "log0sync.h" #include "log.h" +#include "tpool.h" /* General philosophy of InnoDB redo-logs: @@ -132,18 +133,57 @@ __attribute__((warn_unused_result)) dberr_t log_file_t::read(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - return os_file_read(IORequestRead, m_file, buf.data(), offset, buf.size(), - nullptr); + byte *data= buf.data(); + size_t size= buf.size(); + ut_ad(size); + ssize_t s; + + for (;;) + { + s= IF_WIN(tpool::pread(m_file, data, size, offset), + pread(m_file, data, size, offset)); + if (UNIV_UNLIKELY(s <= 0)) + break; + size-= size_t(s); + if (!size) + return DB_SUCCESS; + offset+= s; + data+= s; + ut_a(size < buf.size()); + } + + sql_print_error("InnoDB: pread(\"ib_logfile0\") returned %zd," + " operating system error %u", + s, unsigned(IF_WIN(GetLastError(), errno))); + return DB_IO_ERROR; } void log_file_t::write(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - if (dberr_t err= os_file_write_func(IORequestWrite, "ib_logfile0", m_file, - buf.data(), offset, buf.size())) - ib::fatal() << "write(\"ib_logfile0\") returned " << err - << ". Operating system error number " - << IF_WIN(GetLastError(), errno) << "."; + const byte *data= buf.data(); + size_t size= buf.size(); + ut_ad(size); + ssize_t s; + + for (;;) + { + s= IF_WIN(tpool::pwrite(m_file, data, size, offset), + pwrite(m_file, data, size, offset)); + if (UNIV_UNLIKELY(s <= 0)) + break; + size-= size_t(s); + if (!size) + return; + offset+= s; + data+= s; + ut_a(size < buf.size()); + } + + sql_print_error("[FATAL] InnoDB: pwrite(\"ib_logfile0\") returned %zd," + " operating system error %u", + s, unsigned(IF_WIN(GetLastError(), errno))); + abort(); } #ifdef HAVE_INNODB_MMAP diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc index 4167b8cdd1a..cf1e7dca4c9 100644 --- a/tpool/aio_simulated.cc +++ b/tpool/aio_simulated.cc @@ -73,7 +73,7 @@ static WinIoInit win_io_init; SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset) + unsigned long long offset) { OVERLAPPED ov{}; ULARGE_INTEGER uli; @@ -95,8 +95,8 @@ SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, return -1; } -SSIZE_T pwrite(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset) +SSIZE_T pwrite(const native_file_handle &h, const void *buf, size_t count, + unsigned long long offset) { OVERLAPPED ov{}; ULARGE_INTEGER uli; diff --git a/tpool/tpool.h b/tpool/tpool.h index 2f87bcd4bf4..c906500ed86 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -293,10 +293,10 @@ create_thread_pool_win(int min_threads= DEFAULT_MIN_POOL_THREADS, opened with FILE_FLAG_OVERLAPPED, and bound to completion port. */ -SSIZE_T pwrite(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset); +SSIZE_T pwrite(const native_file_handle &h, const void *buf, size_t count, + unsigned long long offset); SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset); + unsigned long long offset); HANDLE win_get_syncio_event(); #endif } // namespace tpool From 20f57a8529ea61c505332208436375ae3b2ddb2f Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 19 Sep 2024 16:51:05 +0200 Subject: [PATCH 157/185] MDEV-33373 part 1: Unexpected ER_FILE_NOT_FOUND upon reading from logging table after crash recovery We have found that my_errno can be "passed" to the next commad in some cases. It is practically impossible to check/fix all cases of my_errno in the server, plugins and engines so we will reset it as we reset other errors. The test case will be fixed by CSV engine fix so will be added with it (see part2). --- sql/sql_class.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_class.h b/sql/sql_class.h index 08a04665383..93c5850ae3d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4176,6 +4176,7 @@ public: is_slave_error= 0; if (killed == KILL_BAD_DATA) reset_killed(); + my_errno= 0; DBUG_VOID_RETURN; } From b88f1267e45123db83059d28171c35863b05abb7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 19 Sep 2024 18:57:37 +0200 Subject: [PATCH 158/185] MDEV-33373 part 2: Unexpected ER_FILE_NOT_FOUND upon reading from logging table after crash recovery CSV engine shoud set my_errno if use it. --- mysql-test/main/log_crash.result | 17 +++++++++++++++++ mysql-test/main/log_crash.test | 25 +++++++++++++++++++++++++ storage/csv/ha_tina.cc | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 mysql-test/main/log_crash.result create mode 100644 mysql-test/main/log_crash.test diff --git a/mysql-test/main/log_crash.result b/mysql-test/main/log_crash.result new file mode 100644 index 00000000000..5a820a1fd01 --- /dev/null +++ b/mysql-test/main/log_crash.result @@ -0,0 +1,17 @@ +# +# MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +# table after crash recovery +# +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +# restart +DROP TABLE t; +SELECT count(*) FROM mysql.general_log; +count(*) +5 +Warnings: +Error 1194 Table 'general_log' is marked as crashed and should be repaired +# +# End of 10.5 tests +# diff --git a/mysql-test/main/log_crash.test b/mysql-test/main/log_crash.test new file mode 100644 index 00000000000..3a6a2ff4454 --- /dev/null +++ b/mysql-test/main/log_crash.test @@ -0,0 +1,25 @@ + +--source include/not_embedded.inc +--source include/have_csv.inc + +--echo # +--echo # MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +--echo # table after crash recovery +--echo # + +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); + +--disable_ps_protocol +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +--disable_ps_protocol +--let $shutdown_timeout= 0 +--source include/restart_mysqld.inc +DROP TABLE t; +--disable_ps_protocol +SELECT count(*) FROM mysql.general_log; +--enable_ps_protocol + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 04e63530c0e..894fdf2f200 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -333,7 +333,7 @@ static int read_meta_file(File meta_file, ha_rows *rows) /* check crashed bit and magic number */ if ((meta_buffer[0] != (uchar)TINA_CHECK_HEADER) || ((bool)(*ptr)== TRUE)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE); mysql_file_sync(meta_file, MYF(MY_WME)); @@ -974,7 +974,7 @@ int ha_tina::open(const char *name, int mode, uint open_options) if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR)) { free_share(share); - DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno); } local_data_file_version= share->data_file_version; From d28ac3f82d7259d165b8f41d549cb9846f99fe09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 Sep 2024 15:27:38 +0300 Subject: [PATCH 159/185] MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics commit_try_norebuild(): If the STATS_PERSISTENT attribute of the table is being changed to disabled, drop the persistent statistics of the table. --- mysql-test/suite/innodb/r/stat_tables.result | 18 +++++++++++ mysql-test/suite/innodb/t/stat_tables.test | 24 ++++++++++++++ storage/innobase/handler/handler0alter.cc | 34 ++++++++++++++++++-- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index d91b854d347..2a7eac01d73 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -82,4 +82,22 @@ WHERE database_name='test' AND table_name='t1' AND stat_name='size'; TIMESTAMPDIFF(DAY,last_update,now())<=1 1 DROP TABLE t1; +# +# MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index 359fb1e00ec..602d05915a0 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -80,5 +80,29 @@ SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='t1' AND stat_name='size'; DROP TABLE t1; +--echo # +--echo # MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +--echo # +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; + +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; + +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; + +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; + +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; --echo # End of 10.6 tests diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index d2604533983..be721a51f3c 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -10597,6 +10597,16 @@ commit_try_norebuild( dict_index_t* index; const char *op = "rename index to add"; ulint num_fts_index = 0; + const bool statistics_drop = statistics_exist + && ((HA_OPTION_NO_STATS_PERSISTENT | + HA_OPTION_STATS_PERSISTENT) + & (old_table->s->db_create_options + ^ altered_table->s->db_create_options)) + && ((altered_table->s->db_create_options + & HA_OPTION_NO_STATS_PERSISTENT) + || (!(altered_table->s->db_create_options + & HA_OPTION_STATS_PERSISTENT) + && !srv_stats_persistent)); /* We altered the table in place. Mark the indexes as committed. */ for (ulint i = 0; i < ctx->num_to_add_index; i++) { @@ -10619,7 +10629,8 @@ commit_try_norebuild( } char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; - if (ctx->num_to_drop_index) { + + if (statistics_exist && (statistics_drop || ctx->num_to_drop_index)) { dict_fs2utf8(ctx->old_table->name.m_name, db, sizeof db, table, sizeof table); } @@ -10654,7 +10665,7 @@ commit_try_norebuild( goto handle_error; } - if (!statistics_exist) { + if (!statistics_exist || statistics_drop) { continue; } @@ -10670,6 +10681,25 @@ commit_try_norebuild( } if (!statistics_exist) { + } else if (statistics_drop) { + error = dict_stats_delete_from_table_stats(db, table, trx); + switch (error) { + case DB_SUCCESS: + case DB_STATS_DO_NOT_EXIST: + break; + default: + goto handle_error; + } + error = dict_stats_delete_from_index_stats(db, table, trx); + switch (error) { + case DB_STATS_DO_NOT_EXIST: + error = DB_SUCCESS; + /* fall through */ + case DB_SUCCESS: + break; + default: + goto handle_error; + } } else if (const size_t size = ha_alter_info->rename_keys.size()) { char tmp_name[5]; char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; From da322f19c618538b26f46d818f5fe33eebf78b6d Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 1 Oct 2021 11:00:29 +0200 Subject: [PATCH 160/185] MDEV-26459 Assertion `block_size <= 0xFFFFFFFFL' failed in calculate_block_sizes for 10.7 only Limit default allocation block in tree of Unique class --- mysql-test/main/delete.result | 11 +++++++++++ mysql-test/main/delete.test | 14 ++++++++++++++ sql/uniques.cc | 6 ++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index 7a9963abc71..5bfe8e7b709 100644 --- a/mysql-test/main/delete.result +++ b/mysql-test/main/delete.result @@ -557,3 +557,14 @@ having t3.a > any (select t2.b from t2 where t2.b*10 < sum(t3.b))); drop table t1,t2,t3; End of 10.4 tests +# +# MDEV-26459: Assertion `block_size <= 0xFFFFFFFFL' failed +# in calculate_block_sizes for 10.7 only +# +SET @sort_buffer_size_save= @@sort_buffer_size; +SET sort_buffer_size=1125899906842624; +CREATE TABLE t1 (a INT,b CHAR,KEY(a,b)); +DELETE a1 FROM t1 AS a1,t1 AS a2 WHERE a1.a=a2.a; +DROP TABLE t1; +SET sort_buffer_size= @sort_buffer_size_save; +# End of 10.11 tests diff --git a/mysql-test/main/delete.test b/mysql-test/main/delete.test index 0b0e7ce4019..4838663f700 100644 --- a/mysql-test/main/delete.test +++ b/mysql-test/main/delete.test @@ -625,3 +625,17 @@ update t1 set t1.a=t1.a+10 drop table t1,t2,t3; --echo End of 10.4 tests + +--echo # +--echo # MDEV-26459: Assertion `block_size <= 0xFFFFFFFFL' failed +--echo # in calculate_block_sizes for 10.7 only +--echo # + +SET @sort_buffer_size_save= @@sort_buffer_size; +SET sort_buffer_size=1125899906842624; +CREATE TABLE t1 (a INT,b CHAR,KEY(a,b)); +DELETE a1 FROM t1 AS a1,t1 AS a2 WHERE a1.a=a2.a; +DROP TABLE t1; +SET sort_buffer_size= @sort_buffer_size_save; + +--echo # End of 10.11 tests diff --git a/sql/uniques.cc b/sql/uniques.cc index 572d80f0b64..a4c2cca8ac9 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -90,8 +90,10 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, if (min_dupl_count_arg) full_size+= sizeof(element_count); with_counters= MY_TEST(min_dupl_count_arg); - init_tree(&tree, (max_in_memory_size / 16), 0, size, comp_func, - NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC)); + + init_tree(&tree, MY_MIN(max_in_memory_size / 16, UINT_MAX32), + 0, size, comp_func, NULL, comp_func_fixed_arg, + MYF(MY_THREAD_SPECIFIC)); /* If the following fail's the next add will also fail */ my_init_dynamic_array(PSI_INSTRUMENT_ME, &file_ptrs, sizeof(Merge_chunk), 16, 16, MYF(MY_THREAD_SPECIFIC)); From 45298b730b8aa99a1848e504908ed8a7c8847ab5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 20 Sep 2024 08:48:52 +0200 Subject: [PATCH 161/185] sql/handler: referenced_by_foreign_key() returns bool The method was declared to return an unsigned integer, but it is really a boolean (and used as such by all callers). A secondary change is the addition of "const" and "noexcept" to this method. In ha_mroonga.cpp, I also added "inline" to the two helper methods of referenced_by_foreign_key(). This allows the compiler to flatten the method. --- sql/ha_partition.h | 2 +- sql/handler.h | 2 +- storage/innobase/handler/ha_innodb.cc | 16 ++++++---------- storage/innobase/handler/ha_innodb.h | 2 +- storage/mroonga/ha_mroonga.cpp | 12 ++++++------ storage/mroonga/ha_mroonga.hpp | 6 +++--- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index f47cc3f8957..1c50dde348a 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1464,7 +1464,7 @@ public: virtual int get_foreign_key_list(THD *thd, List *f_key_list) - virtual uint referenced_by_foreign_key() + bool referenced_by_foreign_key() const noexcept override */ bool can_switch_engines() override; /* diff --git a/sql/handler.h b/sql/handler.h index 91879010ff9..d7dddd95da5 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4078,7 +4078,7 @@ public: virtual int get_parent_foreign_key_list(THD *thd, List *f_key_list) { return 0; } - virtual uint referenced_by_foreign_key() { return 0;} + virtual bool referenced_by_foreign_key() const noexcept { return false;} virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 689cf76e1ce..2c24bbf4485 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -10052,8 +10052,8 @@ wsrep_append_key( static bool referenced_by_foreign_key2( /*=======================*/ - dict_table_t* table, - dict_index_t* index) + const dict_table_t* table, + const dict_index_t* index) noexcept { ut_ad(table != NULL); ut_ad(index != NULL); @@ -15451,16 +15451,12 @@ ha_innobase::can_switch_engines(void) DBUG_RETURN(can_switch); } -/*******************************************************************//** -Checks if a table is referenced by a foreign key. The MySQL manual states that -a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a +/** Checks if a table is referenced by a foreign key. The MySQL manual states +that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update. -@return > 0 if referenced by a FOREIGN KEY */ - -uint -ha_innobase::referenced_by_foreign_key(void) -/*========================================*/ +@return whether the table is referenced by a FOREIGN KEY */ +bool ha_innobase::referenced_by_foreign_key() const noexcept { if (dict_table_is_referenced_by_foreign_key(m_prebuilt->table)) { diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index ba4f5b62f90..bd99b230a67 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -222,7 +222,7 @@ public: bool can_switch_engines() override; - uint referenced_by_foreign_key() override; + bool referenced_by_foreign_key() const noexcept override; void free_foreign_key_create_info(char* str) override; diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 75f2387beab..442146fae95 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -16790,10 +16790,10 @@ int ha_mroonga::get_parent_foreign_key_list(THD *thd, DBUG_RETURN(res); } -uint ha_mroonga::wrapper_referenced_by_foreign_key() +inline bool ha_mroonga::wrapper_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); res = wrap_handler->referenced_by_foreign_key(); @@ -16802,17 +16802,17 @@ uint ha_mroonga::wrapper_referenced_by_foreign_key() DBUG_RETURN(res); } -uint ha_mroonga::storage_referenced_by_foreign_key() +inline bool ha_mroonga::storage_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res = handler::referenced_by_foreign_key(); + bool res = handler::referenced_by_foreign_key(); DBUG_RETURN(res); } -uint ha_mroonga::referenced_by_foreign_key() +bool ha_mroonga::referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; if (share->wrapper_mode) { res = wrapper_referenced_by_foreign_key(); diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 2bc5c2b30f3..7a5628a2b1f 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -618,7 +618,7 @@ protected: bool can_switch_engines() mrn_override; int get_foreign_key_list(THD *thd, List *f_key_list) mrn_override; int get_parent_foreign_key_list(THD *thd, List *f_key_list) mrn_override; - uint referenced_by_foreign_key() mrn_override; + bool referenced_by_foreign_key() const noexcept mrn_override; void init_table_handle_for_HANDLER() mrn_override; void free_foreign_key_create_info(char* str) mrn_override; #ifdef MRN_HAVE_HA_REBIND_PSI @@ -1268,8 +1268,8 @@ private: int storage_get_foreign_key_list(THD *thd, List *f_key_list); int wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list); int storage_get_parent_foreign_key_list(THD *thd, List *f_key_list); - uint wrapper_referenced_by_foreign_key(); - uint storage_referenced_by_foreign_key(); + bool wrapper_referenced_by_foreign_key() const noexcept; + bool storage_referenced_by_foreign_key() const noexcept; void wrapper_init_table_handle_for_HANDLER(); void storage_init_table_handle_for_HANDLER(); void wrapper_free_foreign_key_create_info(char* str); From 21b20712a3fe7ac44291b398a3731e514c23c8a4 Mon Sep 17 00:00:00 2001 From: Meng-Hsiu Chiang Date: Tue, 19 Mar 2024 00:11:11 +0000 Subject: [PATCH 162/185] Replace using of internal fmt lib API with public API The commit cd5808eb introduced a union as a storage for the format argument passed to the internal API fmt::detail::make_arg. This was done to solve the issue that the internal API no longer accepted temporary variables. However, it's generally better to avoid using internal APIs, as they are more likely to have breaking changes in the future. Instead, we can use the public API fmt::dynamic_format_arg_store to dynamically build the argument list. This API accepts temporary variables, and its behavior is more stable than the internal API. `libfmt.cmake` is updated to reflect the change as well. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- cmake/libfmt.cmake | 9 ++++---- sql/item_strfunc.cc | 56 ++++++++------------------------------------- 2 files changed, 15 insertions(+), 50 deletions(-) diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index 911fb75385e..78a0df6f911 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -30,12 +30,13 @@ MACRO (CHECK_LIBFMT) CHECK_CXX_SOURCE_RUNS( "#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 - #include + #include int main() { + using ArgStore= fmt::dynamic_format_arg_store; + ArgStore arg_store; int answer= 4321; - fmt::format_args::format_arg arg= - fmt::detail::make_arg(answer); - return fmt::vformat(\"{:L}\", fmt::format_args(&arg, 1)).compare(\"4,321\"); + arg_store.push_back(answer); + return fmt::vformat(\"{:L}\", arg_store).compare(\"4,321\"); }" HAVE_SYSTEM_LIBFMT) SET(CMAKE_REQUIRED_INCLUDES) ENDIF() diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d58d817deeb..d0e8aaa6064 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -58,7 +58,7 @@ C_MODE_END /* fmtlib include (https://fmt.dev/). */ #define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 -#include "fmt/format-inl.h" +#include "fmt/args.h" size_t username_char_length= USERNAME_CHAR_LENGTH; @@ -1403,75 +1403,42 @@ namespace fmt { */ String *Item_func_sformat::val_str(String *res) { - /* - A union that stores a numeric format arg value. - fmt::detail::make_arg does not accept temporaries, so all of its numeric - args are temporarily stored in the fmt_args array. - See: https://github.com/fmtlib/fmt/issues/3596 - */ - union Format_arg_store { - longlong val_int; - float val_float; - double val_double; - }; - DBUG_ASSERT(fixed()); - using ctx= fmt::format_context; - String *fmt_arg= NULL; - String *parg= NULL; - fmt::format_args::format_arg *vargs= NULL; - Format_arg_store *fmt_args= NULL; + using ArgStore= fmt::dynamic_format_arg_store; + String *fmt_arg= NULL; + String *parg= NULL; + ArgStore arg_store; null_value= true; if (!(fmt_arg= args[0]->val_str(res))) return NULL; - if (!(vargs= new fmt::format_args::format_arg[arg_count - 1])) - return NULL; - - if (!(fmt_args= new Format_arg_store[arg_count - 1])) - { - delete [] vargs; - return NULL; - } - /* Creates the array of arguments for vformat */ for (uint carg= 1; carg < arg_count; carg++) { switch (args[carg]->result_type()) { case INT_RESULT: - fmt_args[carg-1].val_int= args[carg]->val_int(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_int); + arg_store.push_back(args[carg]->val_int()); break; case DECIMAL_RESULT: // TODO case REAL_RESULT: if (args[carg]->field_type() == MYSQL_TYPE_FLOAT) - { - fmt_args[carg-1].val_float= (float)args[carg]->val_real(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_float); - } + arg_store.push_back((float)args[carg]->val_real()); else - { - fmt_args[carg-1].val_double= args[carg]->val_real(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_double); - } + arg_store.push_back(args[carg]->val_real()); break; case STRING_RESULT: if (!(parg= args[carg]->val_str(&val_arg[carg-1]))) { - delete [] vargs; - delete [] fmt_args; return NULL; } - vargs[carg-1]= fmt::detail::make_arg(*parg); + arg_store.push_back(*parg); break; case TIME_RESULT: // TODO case ROW_RESULT: // TODO default: DBUG_ASSERT(0); - delete [] vargs; - delete [] fmt_args; return NULL; } } @@ -1480,8 +1447,7 @@ String *Item_func_sformat::val_str(String *res) /* Create the string output */ try { - auto text = fmt::vformat(fmt_arg->c_ptr_safe(), - fmt::format_args(vargs, arg_count-1)); + auto text = fmt::vformat(fmt_arg->c_ptr_safe(), arg_store); res->length(0); res->set_charset(collation.collation); res->append(text.c_str(), text.size(), fmt_arg->charset()); @@ -1494,8 +1460,6 @@ String *Item_func_sformat::val_str(String *res) ER_THD(thd, WARN_SFORMAT_ERROR), ex.what()); null_value= true; } - delete [] vargs; - delete [] fmt_args; return null_value ? NULL : res; } From cc810e64d40367208b3f3f35c0277f0c8586a293 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 30 Sep 2024 13:37:26 +0530 Subject: [PATCH 163/185] MDEV-34392 Inplace algorithm violates the foreign key constraint Don't allow the referencing key column from NULL TO NOT NULL when 1) Foreign key constraint type is ON UPDATE SET NULL 2) Foreign key constraint type is ON DELETE SET NULL 3) Foreign key constraint type is UPDATE CASCADE and referenced column declared as NULL Don't allow the referenced key column from NOT NULL to NULL when foreign key constraint type is UPDATE CASCADE and referencing key columns doesn't allow NULL values get_foreign_key_info(): InnoDB sends the information about nullability of the foreign key fields and referenced key fields. fk_check_column_changes(): Enforce the above rules for COPY algorithm innobase_check_foreign_drop_col(): Checks whether the dropped column exists in existing foreign key relation innobase_check_foreign_low() : Enforce the above rules for INPLACE algorithm dict_foreign_t::check_fk_constraint_valid(): This is used by CREATE TABLE statement to check nullability for foreign key relation. --- include/my_bit.h | 5 + .../galera/r/galera_fk_multicolumn.result | 2 +- .../suite/galera/t/galera_fk_multicolumn.test | 2 +- .../suite/innodb/r/foreign_null,COPY.rdiff | 18 ++ mysql-test/suite/innodb/r/foreign_null.result | 156 +++++++++++ mysql-test/suite/innodb/r/innodb-index.result | 8 +- mysql-test/suite/innodb/r/innodb.result | 2 +- .../suite/innodb/t/foreign_null.combinations | 2 + mysql-test/suite/innodb/t/foreign_null.test | 225 ++++++++++++++++ mysql-test/suite/innodb/t/innodb-index.test | 2 +- sql/sql_table.cc | 98 +++++-- sql/table.h | 65 +++++ storage/innobase/dict/dict0crea.cc | 12 +- storage/innobase/dict/dict0dict.cc | 28 +- storage/innobase/handler/ha_innodb.cc | 39 ++- storage/innobase/handler/handler0alter.cc | 255 +++++++++++------- storage/innobase/include/dict0mem.h | 189 +++++++++---- storage/innobase/row/row0ins.cc | 26 +- 18 files changed, 919 insertions(+), 215 deletions(-) create mode 100644 mysql-test/suite/innodb/r/foreign_null,COPY.rdiff create mode 100644 mysql-test/suite/innodb/r/foreign_null.result create mode 100644 mysql-test/suite/innodb/t/foreign_null.combinations create mode 100644 mysql-test/suite/innodb/t/foreign_null.test diff --git a/include/my_bit.h b/include/my_bit.h index 8ee8b41c8d4..e86c3ec883f 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -175,6 +175,11 @@ static inline uchar last_byte_mask(uint bits) return (uchar) ((2U << used) - 1); } +static inline uint my_bits_in_bytes(uint n) +{ + return ((n + 7) / 8); +} + #ifdef _MSC_VER #include #endif diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result index b626d963af8..c10c0a5c702 100644 --- a/mysql-test/suite/galera/r/galera_fk_multicolumn.result +++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; CREATE TABLE t0 ( f1 INT PRIMARY KEY, -f2 INT UNIQUE +f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( f1 INT PRIMARY KEY, diff --git a/mysql-test/suite/galera/t/galera_fk_multicolumn.test b/mysql-test/suite/galera/t/galera_fk_multicolumn.test index ad42f65924d..eeed46bca6c 100644 --- a/mysql-test/suite/galera/t/galera_fk_multicolumn.test +++ b/mysql-test/suite/galera/t/galera_fk_multicolumn.test @@ -7,7 +7,7 @@ CREATE TABLE t0 ( f1 INT PRIMARY KEY, - f2 INT UNIQUE + f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff new file mode 100644 index 00000000000..e39d5c0e9db --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff @@ -0,0 +1,18 @@ +--- foreign_null.result ++++ foreign_null,COPY.result +@@ -139,6 +139,7 @@ + ALTER TABLE `t#2` DROP INDEX f1; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#1` MODIFY COLUMN f2 INT; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00231' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Drop referenced index and modify column + CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +@@ -147,6 +148,7 @@ + ALTER TABLE `t#1` DROP INDEX f2; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00232' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Self referential modifying column + CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; diff --git a/mysql-test/suite/innodb/r/foreign_null.result b/mysql-test/suite/innodb/r/foreign_null.result new file mode 100644 index 00000000000..a5d1afc7e0c --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null.result @@ -0,0 +1,156 @@ +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); +# modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, +FOREIGN KEY(f1) REFERENCES `t#1`(f2) +ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +ERROR HY000: Cannot change column 'f2': used in a foreign key constraint 't#2_ibfk_1' of table 'test.t#2' +DROP TABLE `t#2`, `t#1`; +# modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# foreign key constraint for multiple columns +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +ERROR HY000: Cannot change column 'f1': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2' +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET f2= NULL; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE) +SELECT * FROM t2; +f1 +1 +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +f1 +1 +DROP TABLE t2, t1; +# Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, +FOREIGN KEY fdx(f2) REFERENCES t1(f1), +FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; +ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx; +ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1); +ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx; +DROP TABLE t2, t1; +# Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#2` DROP INDEX f1; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +DROP TABLE `t#2`, `t#1`; +# Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#1` DROP INDEX f2; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE `t#2`, `t#1`; +# Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; +ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index ad169757571..a590d4f0953 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -455,11 +455,11 @@ ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 drop index b, drop index c, drop index d; ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; -ERROR HY000: Cannot change column 'b': used in a foreign key constraint 't2_ibfk_1' +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 MODIFY b INT NOT NULL, ALGORITHM=INPLACE; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; SET FOREIGN_KEY_CHECKS=0; alter table t2 DROP COLUMN b, ALGORITHM=COPY; @@ -480,10 +480,10 @@ info: Records: 0 Duplicates: 0 Warnings: 0 set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 add primary key (alpha), change a alpha int, change b beta int not null, change c charlie int not null; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL alter table t2 add primary key (alpha), change a alpha int, change c charlie int not null, change d delta int not null; -ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_3' SET NULL +ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_3' SET NULL alter table t2 add primary key (alpha), change a alpha int, change b beta int, modify c int not null; affected rows: 0 diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 168327d781e..e1d99c3b731 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3057,7 +3057,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; ALTER TABLE t2 MODIFY a INT NOT NULL; -ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; DELETE FROM t1; DROP TABLE t2,t1; diff --git a/mysql-test/suite/innodb/t/foreign_null.combinations b/mysql-test/suite/innodb/t/foreign_null.combinations new file mode 100644 index 00000000000..e84e17b06ac --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.combinations @@ -0,0 +1,2 @@ +[COPY] +[INPLACE] diff --git a/mysql-test/suite/innodb/t/foreign_null.test b/mysql-test/suite/innodb/t/foreign_null.test new file mode 100644 index 00000000000..6869154fc9f --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.test @@ -0,0 +1,225 @@ +--source include/have_innodb.inc +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); + +let $MYSQLD_DATADIR= `select @@datadir`; +let $algorithm=`select regexp_replace('$MTR_COMBINATIONS', 'innodb,\|,innodb', '')`; + +--echo # modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, + FOREIGN KEY(f1) REFERENCES `t#1`(f2) + ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # foreign key constraint for multiple columns +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, + FOREIGN KEY fdx(f2) REFERENCES t1(f1), + FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1),ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=0; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#2` DROP INDEX f1,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +let $error_code=0; +if ($algorithm == "COPY") +{ + let $error_code= ER_ERROR_ON_RENAME; +} + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#1` DROP INDEX f2,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index 9350672bee9..7495fc4d17e 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -168,7 +168,7 @@ alter table t4 drop index d; alter table t2 drop index b; --error ER_DROP_INDEX_FK alter table t2 drop index b, drop index c, drop index d; ---error ER_FK_COLUMN_CANNOT_CHANGE +--error ER_FK_COLUMN_NOT_NULL alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; # NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on. set @old_sql_mode = @@sql_mode; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0a0ea7acb2e..bd43a70324a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -9589,18 +9589,20 @@ static Create_field *get_field_by_old_name(Alter_info *alter_info, enum fk_column_change_type { FK_COLUMN_NO_CHANGE, FK_COLUMN_DATA_CHANGE, - FK_COLUMN_RENAMED, FK_COLUMN_DROPPED + FK_COLUMN_RENAMED, FK_COLUMN_DROPPED, FK_COLUMN_NOT_NULL }; /** Check that ALTER TABLE's changes on columns of a foreign key are allowed. @param[in] thd Thread context. + @param[in] table table to be altered @param[in] alter_info Alter_info describing changes to be done by ALTER TABLE. - @param[in] fk_columns List of columns of the foreign key to check. + @param[in] fk Foreign key information. @param[out] bad_column_name Name of field on which ALTER TABLE tries to do prohibited operation. + @param[in] referenced Check the referenced fields @note This function takes into account value of @@foreign_key_checks setting. @@ -9611,17 +9613,27 @@ enum fk_column_change_type change in foreign key column. @retval FK_COLUMN_RENAMED Foreign key column is renamed. @retval FK_COLUMN_DROPPED Foreign key column is dropped. + @retval FK_COLUMN_NOT_NULL Foreign key column cannot be null + if ON...SET NULL or ON UPDATE + CASCADE conflicts with NOT NULL */ static enum fk_column_change_type -fk_check_column_changes(THD *thd, Alter_info *alter_info, - List &fk_columns, - const char **bad_column_name) +fk_check_column_changes(THD *thd, const TABLE *table, + Alter_info *alter_info, + FOREIGN_KEY_INFO *fk, + const char **bad_column_name, + bool referenced=false) { + List &fk_columns= referenced + ? fk->referenced_fields + : fk->foreign_fields; List_iterator_fast column_it(fk_columns); LEX_CSTRING *column; + int n_col= 0; *bad_column_name= NULL; + enum fk_column_change_type result= FK_COLUMN_NO_CHANGE; while ((column= column_it++)) { @@ -9640,8 +9652,8 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, SE that foreign keys should be updated to use new name of column like it happens in case of in-place algorithm. */ - *bad_column_name= column->str; - return FK_COLUMN_RENAMED; + result= FK_COLUMN_RENAMED; + goto func_exit; } /* @@ -9654,17 +9666,55 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, new_field->flags&= ~AUTO_INCREMENT_FLAG; const bool equal_result= old_field->is_equal(*new_field); new_field->flags= flags; + const bool old_field_not_null= old_field->flags & NOT_NULL_FLAG; + const bool new_field_not_null= new_field->flags & NOT_NULL_FLAG; - if ((equal_result == IS_EQUAL_NO) || - ((new_field->flags & NOT_NULL_FLAG) && - !(old_field->flags & NOT_NULL_FLAG))) + if ((equal_result == IS_EQUAL_NO)) { /* Column in a FK has changed significantly and it may break referential intergrity. */ - *bad_column_name= column->str; - return FK_COLUMN_DATA_CHANGE; + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + + if (old_field_not_null != new_field_not_null) + { + if (referenced && !new_field_not_null) + { + /* + Don't allow referenced column to change from + NOT NULL to NULL when foreign key relation is + ON UPDATE CASCADE and the referencing column + is declared as NOT NULL + */ + if (fk->update_method == FK_OPTION_CASCADE && + !fk->is_nullable(false, n_col)) + { + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + } + else if (!referenced && new_field_not_null) + { + /* + Don't allow the foreign column to change + from NULL to NOT NULL when foreign key type is + 1) UPDATE SET NULL + 2) DELETE SET NULL + 3) UPDATE CASCADE and referenced column is declared as NULL + */ + if (fk->update_method == FK_OPTION_SET_NULL || + fk->delete_method == FK_OPTION_SET_NULL || + (fk->update_method == FK_OPTION_CASCADE && + fk->referenced_key_name && + fk->is_nullable(true, n_col))) + { + result= FK_COLUMN_NOT_NULL; + goto func_exit; + } + } } } else @@ -9678,12 +9728,15 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, field being dropped since it is easy to break referential integrity in this case. */ - *bad_column_name= column->str; - return FK_COLUMN_DROPPED; + result= FK_COLUMN_DROPPED; + goto func_exit; } + n_col++; } - return FK_COLUMN_NO_CHANGE; +func_exit: + *bad_column_name= column->str; + return result; } @@ -9775,9 +9828,8 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->referenced_fields, - &bad_column_name); + changes= fk_check_column_changes(thd, table, alter_info, f_key, + &bad_column_name, true); switch(changes) { @@ -9811,6 +9863,9 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, f_key->foreign_id->str, buff.c_ptr()); DBUG_RETURN(true); } + /* FK_COLUMN_NOT_NULL error happens only when changing + the foreign key column from NULL to NOT NULL */ + case FK_COLUMN_NOT_NULL: default: DBUG_ASSERT(0); } @@ -9849,8 +9904,7 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->foreign_fields, + changes= fk_check_column_changes(thd, table, alter_info, f_key, &bad_column_name); switch(changes) @@ -9872,6 +9926,10 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), bad_column_name, f_key->foreign_id->str); DBUG_RETURN(true); + case FK_COLUMN_NOT_NULL: + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), bad_column_name, + f_key->foreign_id->str); + DBUG_RETURN(true); default: DBUG_ASSERT(0); } diff --git a/sql/table.h b/sql/table.h index 6910ff0aff1..45fd8c01d9e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -36,6 +36,7 @@ #include "sql_i_s.h" #include "sql_type.h" /* vers_kind_t */ #include "privilege.h" /* privilege_t */ +#include "my_bit.h" /* Buffer for unix timestamp in microseconds: @@ -1882,6 +1883,70 @@ typedef struct st_foreign_key_info LEX_CSTRING *referenced_key_name; List foreign_fields; List referenced_fields; +private: + unsigned char *fields_nullable= nullptr; + + /** + Get the number of fields exist in foreign key relationship + */ + unsigned get_n_fields() const noexcept + { + unsigned n_fields= foreign_fields.elements; + if (n_fields == 0) + n_fields= referenced_fields.elements; + return n_fields; + } + + /** + Assign nullable field for referenced and foreign fields + based on number of fields. This nullable fields + should be allocated by engine for passing the + foreign key information + @param thd thread to allocate the memory + @param num_fields number of fields + */ + void assign_nullable(THD *thd, unsigned num_fields) noexcept + { + fields_nullable= + (unsigned char *)thd_calloc(thd, + my_bits_in_bytes(2 * num_fields)); + } + +public: + /** + Set nullable bit for the field in the given field + @param referenced set null bit for referenced column + @param field field number + @param n_fields number of fields + */ + void set_nullable(THD *thd, bool referenced, + unsigned field, unsigned n_fields) noexcept + { + if (!fields_nullable) + assign_nullable(thd, n_fields); + DBUG_ASSERT(fields_nullable); + DBUG_ASSERT(field < n_fields); + size_t bit= size_t{field} + referenced * n_fields; + fields_nullable[bit / 8]|= (unsigned char)(1 << (bit % 8)); + } + + /** + Check whether the given field_no in foreign key field or + referenced key field + @param referenced check referenced field nullable value + @param field field number + @return true if the field is nullable or false if it is not + */ + bool is_nullable(bool referenced, unsigned field) const noexcept + { + if (!fields_nullable) + return false; + unsigned n_field= get_n_fields(); + DBUG_ASSERT(field < n_field); + size_t bit= size_t{field} + referenced * n_field; + return fields_nullable[bit / 8] & (1 << (bit % 8)); + } + } FOREIGN_KEY_INFO; LEX_CSTRING *fk_option_name(enum_fk_option opt); diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index e904c2e3e86..f0e47938178 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1838,8 +1838,8 @@ dict_foreigns_has_s_base_col( foreign = *it; ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0) { continue; @@ -1897,8 +1897,12 @@ dict_create_add_foreigns_to_dictionary( foreign = *it; ut_ad(foreign->id != NULL); - error = dict_create_add_foreign_to_dictionary( - table->name.m_name, foreign, trx); + if (!foreign->check_fk_constraint_valid()) { + error = DB_CANNOT_ADD_CONSTRAINT; + } else { + error = dict_create_add_foreign_to_dictionary( + table->name.m_name, foreign, trx); + } if (error != DB_SUCCESS) { break; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 1df848d259c..b5b0331b6d9 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -3037,8 +3037,8 @@ dict_foreign_add_to_cache( for_in_cache->n_fields, for_in_cache->referenced_index, check_charsets, for_in_cache->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL)); + & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL)); if (index == NULL && !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) { @@ -4003,27 +4003,27 @@ dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, str.append(")"); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type & foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } @@ -4086,27 +4086,27 @@ dict_print_info_on_foreign_keys( str.append(")"); - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type == foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type == foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 2c24bbf4485..1abf394c7bd 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12524,13 +12524,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type |= foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type |= foreign->DELETE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type |= foreign->DELETE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -12545,13 +12545,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -15266,28 +15266,43 @@ get_foreign_key_info( name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.foreign_fields.push_back(name); + + if (dict_index_t* fidx = foreign->foreign_index) { + if (fidx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, false, i, + foreign->n_fields); + } + } ptr = foreign->referenced_col_names[i]; name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.referenced_fields.push_back(name); + + if (dict_index_t* ref_idx = foreign->referenced_index) { + if (ref_idx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, true, i, + foreign->n_fields); + } + } + } while (++i < foreign->n_fields); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { f_key_info.delete_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + } else if (foreign->type & foreign->DELETE_SET_NULL) { f_key_info.delete_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + } else if (foreign->type & foreign->DELETE_NO_ACTION) { f_key_info.delete_method = FK_OPTION_NO_ACTION; } else { f_key_info.delete_method = FK_OPTION_RESTRICT; } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { f_key_info.update_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + } else if (foreign->type & foreign->UPDATE_SET_NULL) { f_key_info.update_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + } else if (foreign->type & foreign->UPDATE_NO_ACTION) { f_key_info.update_method = FK_OPTION_NO_ACTION; } else { f_key_info.update_method = FK_OPTION_RESTRICT; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index d3a7e3d3749..613ba560ab2 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2759,8 +2759,8 @@ innobase_check_fk_option( return(true); } - if (foreign->type & (DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_DELETE_SET_NULL)) { + if (foreign->type & (foreign->UPDATE_SET_NULL + | foreign->DELETE_SET_NULL)) { for (ulint j = 0; j < foreign->n_fields; j++) { if ((dict_index_get_nth_col( @@ -2795,13 +2795,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type = DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type = foreign->DELETE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type = foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type = foreign->DELETE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -2811,13 +2811,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -2968,8 +2968,8 @@ innobase_check_fk_stored( { ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0 || s_cols == NULL) { return(false); @@ -4220,103 +4220,157 @@ innobase_dropping_foreign( return(false); } -/** Determines if an InnoDB FOREIGN KEY constraint depends on a -column that is being dropped or modified to NOT NULL. +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the nullability changes of a column. +Enforce the following rules: + +i) Don't allow the referencing column from NULL TO NOT NULL when + 1) Foreign key constraint type is ON UPDATE SET NULL + 2) Foreign key constraint type is ON DELETE SET NULL + 3) Foreign key constraint type is UPDATE CASCADE and referenced + column declared as NULL + +ii) Don't allow the referenced column from NOT NULL to NULL when +foreign key constraint type is UPDATE CASCADE and referencing column +declared as NOT NULL + @param user_table InnoDB table as it is before the ALTER operation -@param col_name Name of the column being altered @param drop_fk constraints being dropped @param n_drop_fk number of constraints that are being dropped -@param drop true=drop column, false=set NOT NULL +@param col_name modified column name +@param new_field_flags Modified field flags @retval true Not allowed (will call my_error()) @retval false Allowed */ -MY_ATTRIBUTE((pure, nonnull(1,4), warn_unused_result)) static -bool -innobase_check_foreigns_low( - const dict_table_t* user_table, - dict_foreign_t** drop_fk, - ulint n_drop_fk, - const char* col_name, - bool drop) +bool check_foreigns_nullability(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name, uint32_t new_field_flags) { - dict_foreign_t* foreign; - ut_ad(mutex_own(&dict_sys.mutex)); + ut_ad(mutex_own(&dict_sys.mutex)); - /* Check if any FOREIGN KEY constraints are defined on this - column. */ + /* Changing from NULL to NOT NULL. So check referenced set */ + if ((new_field_flags & NOT_NULL_FLAG)) + { + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin(); - it != user_table->foreign_set.end(); - ++it) { + if (foreign->on_update_cascade_null(col_name)) + goto non_null_error; - foreign = *it; + if (foreign->type & (foreign->DELETE_SET_NULL | + foreign->UPDATE_SET_NULL)) + { + if (foreign->foreign_index + && foreign->col_fk_exists(col_name) != UINT_MAX) + { +non_null_error: + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), col_name, fid); + return true; + } + } + } + } + else + { + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (foreign->on_update_cascade_not_null(col_name)) + { + char display_name[FN_REFLEN]; + const int dblen= int(table_name_t(const_cast(foreign-> + foreign_table_name)).dblen()); + char tbl_name[MAX_TABLE_NAME_LEN]; + uint errors; + ulint tbl_name_len= strlen(foreign->foreign_table_name) - dblen + 1; + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + innobase_convert_to_system_charset(tbl_name, + strchr(foreign->foreign_table_name, + '/') + 1, + MAX_TABLE_NAME_LEN, &errors); + if (errors) + { + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + } - if (!drop && !(foreign->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { - continue; - } + my_snprintf(display_name, FN_REFLEN - 1, "%.*s.%s", + dblen, foreign->foreign_table_name, tbl_name); - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + display_name[FN_REFLEN - 1]= '\0'; + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_CANNOT_CHANGE_CHILD, MYF(0), col_name, + fid, display_name); + return true; + } + } + } - for (unsigned f = 0; f < foreign->n_fields; f++) { - if (!strcmp(foreign->foreign_col_names[f], - col_name)) { - my_error(drop - ? ER_FK_COLUMN_CANNOT_DROP - : ER_FK_COLUMN_NOT_NULL, MYF(0), - col_name, foreign->id); - return(true); - } - } - } + return false; +} - if (!drop) { - /* SET NULL clauses on foreign key constraints of - child tables affect the child tables, not the parent table. - The column can be NOT NULL in the parent table. */ - return(false); - } +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the column when it is being dropped. +@param user_table InnoDB table as it is before the ALTER operation +@param drop_fk constraints being dropped +@param n_drop_fk number of constraints that are being dropped +@param col_name column name to be dropped +@retval true Not allowed (will call my_error()) +@retval false Allowed +*/ +static +bool check_foreign_drop_col(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name) +{ + ut_ad(mutex_own(&dict_sys.mutex)); - /* Check if any FOREIGN KEY constraints in other tables are - referring to the column that is being dropped. */ - for (dict_foreign_set::const_iterator it - = user_table->referenced_set.begin(); - it != user_table->referenced_set.end(); - ++it) { + /* Check if any FOREIGN KEY constraints are defined on this column. */ + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - foreign = *it; + for (unsigned f = 0; f < foreign->n_fields; f++) + if (!strcmp(foreign->foreign_col_names[f], col_name)) + { + my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), + col_name, foreign->id); + return true; + } + } - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + /* Check if any FOREIGN KEY constraints in other tables are + referring to the column that is being dropped. */ + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (unsigned f = 0; f < foreign->n_fields; f++) { - char display_name[FN_REFLEN]; - - if (strcmp(foreign->referenced_col_names[f], - col_name)) { - continue; - } - - char* buf_end = innobase_convert_name( - display_name, (sizeof display_name) - 1, - foreign->foreign_table_name, - strlen(foreign->foreign_table_name), - NULL); - *buf_end = '\0'; - my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, - MYF(0), col_name, foreign->id, - display_name); - - return(true); - } - } - - return(false); + for (unsigned f = 0; f < foreign->n_fields; f++) + { + char display_name[FN_REFLEN]; + if (strcmp(foreign->referenced_col_names[f], col_name)) + continue; + char* buf_end = innobase_convert_name( + display_name, (sizeof display_name) - 1, + foreign->foreign_table_name, + strlen(foreign->foreign_table_name), NULL); + *buf_end = '\0'; + my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, + MYF(0), col_name, foreign->id, display_name); + return true; + } + } + return false; } /** Determines if an InnoDB FOREIGN KEY constraint depends on a @@ -4351,16 +4405,25 @@ innobase_check_foreigns( return field.field == *fp; }); - if (it == end || (it->flags & NOT_NULL_FLAG)) { - if (innobase_check_foreigns_low( - user_table, drop_fk, n_drop_fk, - (*fp)->field_name.str, it == end)) { - return(true); + if (it == end) { + if (check_foreign_drop_col( + user_table, drop_fk, n_drop_fk, + (*fp)->field_name.str)) { + return true; + } + } else if ((it->flags & NOT_NULL_FLAG) + != ((*fp)->flags & NOT_NULL_FLAG)) { + + if (check_foreigns_nullability(user_table, drop_fk, + n_drop_fk, + (*fp)->field_name.str, + it->flags)) { + return true; } } } - return(false); + return false; } /** Convert a default value for ADD COLUMN. @@ -9836,8 +9899,8 @@ innobase_update_foreign_try( fk->foreign_col_names, fk->n_fields, fk->referenced_index, TRUE, fk->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL), + & (fk->DELETE_SET_NULL + | fk->UPDATE_SET_NULL), NULL, NULL, NULL); if (!fk->foreign_index) { my_error(ER_FK_INCORRECT_OPTION, diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 6bf16bcbdc3..5cebfe6710d 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1451,45 +1451,149 @@ typedef std::set, /** Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D). Most fields will be initialized to 0, NULL or FALSE in dict_mem_foreign_create(). */ -struct dict_foreign_t{ - mem_heap_t* heap; /*!< this object is allocated from - this memory heap */ - char* id; /*!< id of the constraint as a - null-terminated string */ - unsigned n_fields:10; /*!< number of indexes' first fields - for which the foreign key - constraint is defined: we allow the - indexes to contain more fields than - mentioned in the constraint, as long - as the first fields are as mentioned */ - unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE - or DICT_FOREIGN_ON_DELETE_SET_NULL */ - char* foreign_table_name;/*!< foreign table name */ - char* foreign_table_name_lookup; - /*!< foreign table name used for dict lookup */ - dict_table_t* foreign_table; /*!< table where the foreign key is */ - const char** foreign_col_names;/*!< names of the columns in the - foreign key */ - char* referenced_table_name;/*!< referenced table name */ - char* referenced_table_name_lookup; - /*!< referenced table name for dict lookup*/ - dict_table_t* referenced_table;/*!< table where the referenced key - is */ - const char** referenced_col_names;/*!< names of the referenced - columns in the referenced table */ - dict_index_t* foreign_index; /*!< foreign index; we require that - both tables contain explicitly defined - indexes for the constraint: InnoDB - does not generate new indexes - implicitly */ - dict_index_t* referenced_index;/*!< referenced index */ +struct dict_foreign_t +{ + /* Object is allocated from this memory heap */ + mem_heap_t *heap; + /* id of the constraint as a null terminated string */ + char *id; + /* number of indexes first fields for which the foreign key + constraint is defined: We allow the indexes to contain more + fields than mentioned in the constraint, as long as the first + fields are as mentioned */ + unsigned n_fields:10; + /* 0 or DELETE_CASCADE OR DELETE_SET_NULL */ + unsigned type:6; + /* foreign table name */ + char *foreign_table_name; + /* Foreign table name used for dict lookup */ + char *foreign_table_name_lookup; + /* table where the foreign key is */ + dict_table_t *foreign_table; + /* names of the columns in the foreign key */ + const char **foreign_col_names; + /* referenced table name */ + char *referenced_table_name; + /* referenced table name for dict lookup */ + char *referenced_table_name_lookup; + /* Table where the referenced key is */ + dict_table_t *referenced_table; + /* Names of the referenced columns in the referenced table */ + const char **referenced_col_names; + /* foreign index; we require that both tables contain explicitly + defined indexes for the constraint: InnoDB does not generate + new indexes implicitly */ + dict_index_t *foreign_index; + /* referenced index */ + dict_index_t *referenced_index; + /* set of virtual columns affected by foreign key constraint */ + dict_vcol_set *v_cols; + /** Check whether the fulltext index gets affected by + foreign key constraint */ + bool affects_fulltext() const; + /** The flags for ON_UPDATE and ON_DELETE can be ORed; + the default is that a foreign key constraint is enforced, + therefore RESTRICT just means no flag */ + static constexpr unsigned DELETE_CASCADE= 1U; + static constexpr unsigned DELETE_SET_NULL= 2U; + static constexpr unsigned UPDATE_CASCADE= 4U; + static constexpr unsigned UPDATE_SET_NULL= 8U; + static constexpr unsigned DELETE_NO_ACTION= 16U; + static constexpr unsigned UPDATE_NO_ACTION= 32U; +private: + /** Check whether the name exists in given column names + @retval offset or UINT_MAX if name not found */ + unsigned col_exists(const char *name, const char **names) const noexcept + { + for (unsigned i= 0; i < n_fields; i++) + { + if (!strcmp(names[i], name)) + return i; + } + return UINT_MAX; + } - dict_vcol_set* v_cols; /*!< set of virtual columns affected - by foreign key constraint. */ +public: + /** Check whether the name exists in the foreign key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_fk_exists(const char *name) const noexcept + { + return col_exists(name, foreign_col_names); + } - /** Check whether the fulltext index gets affected by - foreign key constraint */ - bool affects_fulltext() const; + /** Check whether the name exists in the referenced + key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_ref_exists(const char *name) const noexcept + { + return col_exists(name, referenced_col_names); + } + + /** Check whether the foreign key constraint depends on + the nullability of the referenced column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_not_null(const char *name) const noexcept + { + if (!foreign_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_ref_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return foreign_index->fields[offset].col->prtype & DATA_NOT_NULL; + } + + /** Check whether the foreign key constraint depends on + the nullability of the foreign column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_null(const char *name) const noexcept + { + if (!referenced_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_fk_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return !(referenced_index->fields[offset].col->prtype & DATA_NOT_NULL); + } + + /** This is called during CREATE TABLE statement + to check the foreign key nullability constraint + @return true if foreign key constraint is valid + or else false */ + bool check_fk_constraint_valid() + { + if (!type || type & (DELETE_CASCADE | DELETE_NO_ACTION | + UPDATE_NO_ACTION)) + return true; + + if (!referenced_index) + return true; + + for (unsigned i= 0; i < n_fields; i++) + { + dict_col_t *col = foreign_index->fields[i].col; + if (col->prtype & DATA_NOT_NULL) + { + /* Foreign type is ON DELETE SET NULL + or ON UPDATE SET NULL */ + if (type & (DELETE_SET_NULL | UPDATE_SET_NULL)) + return false; + + dict_col_t *ref_col= referenced_index->fields[i].col; + /* Referenced index respective fields shouldn't be NULL */ + if (!(ref_col->prtype & DATA_NOT_NULL)) + return false; + } + } + return true; + } }; std::ostream& @@ -1667,17 +1771,6 @@ struct dict_foreign_set_free { const dict_foreign_set& m_foreign_set; }; -/** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that -a foreign key constraint is enforced, therefore RESTRICT just means no flag */ -/* @{ */ -#define DICT_FOREIGN_ON_DELETE_CASCADE 1U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_DELETE_SET_NULL 2U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_UPDATE_CASCADE 4U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16U /*!< ON DELETE NO ACTION */ -#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32U /*!< ON UPDATE NO ACTION */ -/* @} */ - /** Display an identifier. @param[in,out] s output stream @param[in] id_name SQL identifier (other than table name) diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 350a002f83f..4f14ccbd7ab 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -903,10 +903,10 @@ row_ins_foreign_fill_virtual( return DB_OUT_OF_MEMORY; } ut_ad(!node->is_delete - || (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)); - ut_ad(foreign->type & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_CASCADE)); + || (foreign->type & foreign->DELETE_SET_NULL)); + ut_ad(foreign->type & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL + | foreign->UPDATE_CASCADE)); for (uint16_t i = 0; i < n_v_fld; i++) { @@ -1021,8 +1021,8 @@ row_ins_foreign_check_on_constraint( node = static_cast(thr->run_node); if (node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_DELETE_CASCADE - | DICT_FOREIGN_ON_DELETE_SET_NULL))) { + & (foreign->DELETE_CASCADE + | foreign->DELETE_SET_NULL))) { row_ins_foreign_report_err("Trying to delete", thr, foreign, @@ -1032,8 +1032,8 @@ row_ins_foreign_check_on_constraint( } if (!node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_UPDATE_CASCADE - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + & (foreign->UPDATE_CASCADE + | foreign->UPDATE_SET_NULL))) { /* This is an UPDATE */ @@ -1056,7 +1056,7 @@ row_ins_foreign_check_on_constraint( cascade->foreign = foreign; if (node->is_delete - && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) { + && (foreign->type & foreign->DELETE_CASCADE)) { cascade->is_delete = PLAIN_DELETE; } else { cascade->is_delete = NO_DELETE; @@ -1199,8 +1199,8 @@ row_ins_foreign_check_on_constraint( } if (node->is_delete - ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) - : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) { + ? (foreign->type & foreign->DELETE_SET_NULL) + : (foreign->type & foreign->UPDATE_SET_NULL)) { /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -1245,12 +1245,12 @@ row_ins_foreign_check_on_constraint( } } else if (table->fts && cascade->is_delete == PLAIN_DELETE && foreign->affects_fulltext()) { - /* DICT_FOREIGN_ON_DELETE_CASCADE case */ + /* dict_foreign_t::DELETE_CASCADE case */ fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL); } if (!node->is_delete - && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) { + && (foreign->type & foreign->UPDATE_CASCADE)) { /* Build the appropriate update vector which sets changing foreign->n_fields first fields in rec to new values */ From 813123e3e020f2f2e8482000a7e87a8a23bd146e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 20 Sep 2024 10:19:44 +0200 Subject: [PATCH 164/185] MDEV-34973: innobase/lock0lock: add `noexcept` MariaDB is compiled with C++ exceptions enabled, and that disallows some optimizations (e.g. the stack must always be unwinding-safe). By adding `noexcept` to functions that are guaranteed to never throw, some of these optimizations can be regained. Low-level locking functions that are called often are a good candidate for this. This shrinks the executable a bit (tested with GCC 14 on aarch64): text data bss dec hex filename 24448910 2436488 9473185 36358583 22ac9b7 build/release/sql/mariadbd 24448622 2436488 9473537 36358647 22ac9f7 build/release/sql/mariadbd --- storage/innobase/include/lock0lock.h | 12 +- storage/innobase/include/srw_lock.h | 212 +++++++++--------- .../include/transactional_lock_guard.h | 32 +-- storage/innobase/sync/srw_lock.cc | 140 ++++++------ 4 files changed, 198 insertions(+), 198 deletions(-) diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 08b9f4bcb35..085e2c78fbc 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -788,28 +788,28 @@ public: ATTRIBUTE_NOINLINE void rd_unlock(); #else /** Acquire exclusive lock_sys.latch */ - void wr_lock() + void wr_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.wr_lock(); } /** Release exclusive lock_sys.latch */ - void wr_unlock() { latch.wr_unlock(); } + void wr_unlock() noexcept { latch.wr_unlock(); } /** Acquire shared lock_sys.latch */ - void rd_lock() + void rd_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.rd_lock(); } /** Release shared lock_sys.latch */ - void rd_unlock() { latch.rd_unlock(); } + void rd_unlock() noexcept { latch.rd_unlock(); } #endif /** Try to acquire exclusive lock_sys.latch @return whether the latch was acquired */ - bool wr_lock_try() { return latch.wr_lock_try(); } + bool wr_lock_try() noexcept { return latch.wr_lock_try(); } /** Try to acquire shared lock_sys.latch @return whether the latch was acquired */ - bool rd_lock_try() { return latch.rd_lock_try(); } + bool rd_lock_try() noexcept { return latch.rd_lock_try(); } /** Assert that wr_lock() has been invoked by this thread */ void assert_locked() const { ut_ad(latch.have_wr()); } diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index a601d09c91a..94f76ab763e 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -44,10 +44,10 @@ class pthread_mutex_wrapper final /** whether the mutex is usable; set by init(); cleared by destroy() */ bool initialized{false}; public: - ~pthread_mutex_wrapper() { ut_ad(!initialized); } + ~pthread_mutex_wrapper() noexcept { ut_ad(!initialized); } #endif public: - void init() + void init() noexcept { ut_ad(!initialized); ut_d(initialized= true); @@ -56,31 +56,31 @@ public: else pthread_mutex_init(&lock, nullptr); } - void destroy() + void destroy() noexcept { ut_ad(initialized); ut_d(initialized=false); pthread_mutex_destroy(&lock); } # ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - void wr_lock() { ut_ad(initialized); pthread_mutex_lock(&lock); } + void wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } # else private: - void wr_wait(); + void wr_wait() noexcept; public: - inline void wr_lock(); + inline void wr_lock() noexcept; # endif - void wr_unlock() { ut_ad(initialized); pthread_mutex_unlock(&lock); } - bool wr_lock_try() + void wr_unlock() noexcept { ut_ad(initialized); pthread_mutex_unlock(&lock); } + bool wr_lock_try() noexcept { ut_ad(initialized); return !pthread_mutex_trylock(&lock); } }; # ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait(); +template<> void pthread_mutex_wrapper::wr_wait() noexcept; template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } # endif #endif @@ -110,22 +110,22 @@ private: #endif /** Wait until the mutex has been acquired */ - void wait_and_lock(); + void wait_and_lock() noexcept; /** Wait for lock!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wake up one wait() thread */ - void wake(); + void wake() noexcept; /** Wake up all wait() threads */ - inline void wake_all(); + inline void wake_all() noexcept; public: /** @return whether the mutex is being held or waited for */ - bool is_locked_or_waiting() const + bool is_locked_or_waiting() const noexcept { return lock.load(std::memory_order_acquire) != 0; } /** @return whether the mutex is being held by any thread */ - bool is_locked() const + bool is_locked() const noexcept { return (lock.load(std::memory_order_acquire) & HOLDER) != 0; } - void init() + void init() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -133,7 +133,7 @@ public: pthread_cond_init(&cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -143,7 +143,7 @@ public: } /** @return whether the mutex was acquired */ - bool wr_lock_try() + bool wr_lock_try() noexcept { uint32_t lk= 0; return lock.compare_exchange_strong(lk, HOLDER + WAITER, @@ -151,8 +151,8 @@ public: std::memory_order_relaxed); } - void wr_lock() { if (!wr_lock_try()) wait_and_lock(); } - void wr_unlock() + void wr_lock() noexcept { if (!wr_lock_try()) wait_and_lock(); } + void wr_unlock() noexcept { const uint32_t lk= lock.fetch_sub(HOLDER + WAITER, std::memory_order_release); @@ -198,16 +198,16 @@ class ssux_lock_impl static constexpr uint32_t WRITER= 1U << 31; /** Wait for readers!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wait for readers!=lk|WRITER */ - void wr_wait(uint32_t lk); + void wr_wait(uint32_t lk) noexcept; /** Wake up wait() on the last rd_unlock() */ - void wake(); + void wake() noexcept; /** Acquire a read lock */ - void rd_wait(); + void rd_wait() noexcept; public: - void init() + void init() noexcept { writer.init(); DBUG_ASSERT(is_vacant()); @@ -215,7 +215,7 @@ public: pthread_cond_init(&readers_cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(is_vacant()); writer.destroy(); @@ -224,17 +224,17 @@ public: #endif } /** @return whether any writer is waiting */ - bool is_waiting() const + bool is_waiting() const noexcept { return (readers.load(std::memory_order_relaxed) & WRITER) != 0; } #ifndef DBUG_OFF /** @return whether the lock is being held or waited for */ - bool is_vacant() const { return !is_locked_or_waiting(); } + bool is_vacant() const noexcept { return !is_locked_or_waiting(); } #endif /* !DBUG_OFF */ private: /** Try to acquire a shared latch. @return the lock word value if the latch was not acquired @retval 0 if the latch was acquired */ - uint32_t rd_lock_try_low() + uint32_t rd_lock_try_low() noexcept { uint32_t lk= 0; while (!readers.compare_exchange_weak(lk, lk + 1, @@ -246,11 +246,11 @@ private: } public: - bool rd_lock_try() { return rd_lock_try_low() == 0; } + bool rd_lock_try() noexcept { return rd_lock_try_low() == 0; } - bool u_lock_try() { return writer.wr_lock_try(); } + bool u_lock_try() noexcept { return writer.wr_lock_try(); } - bool wr_lock_try() + bool wr_lock_try() noexcept { if (!writer.wr_lock_try()) return false; @@ -263,12 +263,12 @@ public: return false; } - void rd_lock() { if (!rd_lock_try()) rd_wait(); } - void u_lock() + void rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } + void u_lock() noexcept { writer.wr_lock(); } - void wr_lock() + void wr_lock() noexcept { writer.wr_lock(); #if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 @@ -289,23 +289,23 @@ public: #endif } - bool rd_u_upgrade_try() { return writer.wr_lock_try(); } + bool rd_u_upgrade_try() noexcept { return writer.wr_lock_try(); } - void u_wr_upgrade() + void u_wr_upgrade() noexcept { DBUG_ASSERT(writer.is_locked()); uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire); if (lk) wr_wait(lk); } - void wr_u_downgrade() + void wr_u_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); /* Note: Any pending rd_lock() will not be woken up until u_unlock() */ } - void u_rd_downgrade() + void u_rd_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); ut_d(uint32_t lk=) readers.fetch_add(1, std::memory_order_relaxed); @@ -313,18 +313,18 @@ public: u_unlock(); } - void rd_unlock() + void rd_unlock() noexcept { uint32_t lk= readers.fetch_sub(1, std::memory_order_release); ut_ad(~WRITER & lk); if (lk == WRITER + 1) wake(); } - void u_unlock() + void u_unlock() noexcept { writer.wr_unlock(); } - void wr_unlock() + void wr_unlock() noexcept { DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); @@ -340,10 +340,10 @@ public: bool is_locked_or_waiting() const noexcept { return is_locked() || writer.is_locked_or_waiting(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } }; #if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -360,20 +360,20 @@ class srw_lock_ rw_lock_t lk; # endif - void rd_wait(); - void wr_wait(); + void rd_wait() noexcept; + void wr_wait() noexcept; public: - void init() { IF_WIN(,my_rwlock_init(&lk, nullptr)); } - void destroy() { IF_WIN(,rwlock_destroy(&lk)); } - inline void rd_lock(); - inline void wr_lock(); - bool rd_lock_try() + void init() noexcept { IF_WIN(,my_rwlock_init(&lk, nullptr)); } + void destroy() noexcept { IF_WIN(,rwlock_destroy(&lk)); } + inline void rd_lock() noexcept; + inline void wr_lock() noexcept; + bool rd_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockShared(&lk), !rw_tryrdlock(&lk)); } - void rd_unlock() + void rd_unlock() noexcept { IF_WIN(ReleaseSRWLockShared(&lk), rw_unlock(&lk)); } - bool wr_lock_try() + bool wr_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockExclusive(&lk), !rw_trywrlock(&lk)); } - void wr_unlock() + void wr_unlock() noexcept { IF_WIN(ReleaseSRWLockExclusive(&lk), rw_unlock(&lk)); } #ifdef _WIN32 /** @return whether any lock may be held by any thread */ @@ -387,27 +387,27 @@ public: return is_locked(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } #endif }; -template<> void srw_lock_::rd_wait(); -template<> void srw_lock_::wr_wait(); +template<> void srw_lock_::rd_wait() noexcept; +template<> void srw_lock_::wr_wait() noexcept; template<> -inline void srw_lock_::rd_lock() +inline void srw_lock_::rd_lock() noexcept { IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } template<> -inline void srw_lock_::wr_lock() +inline void srw_lock_::wr_lock() noexcept { IF_WIN(AcquireSRWLockExclusive(&lk), rw_wrlock(&lk)); } template<> -inline void srw_lock_::rd_lock() { if (!rd_lock_try()) rd_wait(); } +inline void srw_lock_::rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } template<> -inline void srw_lock_::wr_lock() { if (!wr_lock_try()) wr_wait(); } +inline void srw_lock_::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } typedef srw_lock_ srw_lock_low; typedef srw_lock_ srw_spin_lock_low; @@ -433,17 +433,17 @@ class ssux_lock PSI_rwlock *pfs_psi; ssux_lock_impl lock; - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -452,56 +452,56 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void u_lock(const char *file, unsigned line) + void u_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_lock(file, line); else lock.u_lock(); } - void u_unlock() + void u_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.u_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - void u_wr_upgrade(const char *file, unsigned line) + void u_wr_upgrade(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_wr_upgrade(file, line); else lock.u_wr_upgrade(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool u_lock_try() { return lock.u_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - bool is_waiting() const { return lock.is_waiting(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool u_lock_try() noexcept { return lock.u_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + bool is_waiting() const noexcept { return lock.is_waiting(); } }; /** Slim reader-writer lock with PERFORMANCE_SCHEMA instrumentation */ @@ -515,15 +515,15 @@ class srw_lock_impl ssux_lock_impl lock; # endif - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -532,36 +532,36 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - void lock_shared() { return rd_lock(SRW_LOCK_CALL); } - void unlock_shared() { return rd_unlock(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + void lock_shared() noexcept { return rd_lock(SRW_LOCK_CALL); } + void unlock_shared() noexcept { return rd_unlock(); } #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ bool is_locked_or_waiting() const noexcept @@ -591,11 +591,11 @@ class srw_lock_debug : private srw_lock std::atomic*> readers; /** Register a read lock. */ - void readers_register(); + void readers_register() noexcept; public: - void SRW_LOCK_INIT(mysql_pfs_key_t key); - void destroy(); + void SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept; + void destroy() noexcept; #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ @@ -606,17 +606,17 @@ public: #endif /** Acquire an exclusive lock */ - void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether an exclusive lock was acquired */ - bool wr_lock_try(); + bool wr_lock_try() noexcept; /** Release after wr_lock() */ - void wr_unlock(); + void wr_unlock() noexcept; /** Acquire a shared lock */ - void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether a shared lock was acquired */ - bool rd_lock_try(); + bool rd_lock_try() noexcept; /** Release after rd_lock() */ - void rd_unlock(); + void rd_unlock() noexcept; /** @return whether this thread is between rd_lock() and rd_unlock() */ bool have_rd() const noexcept; /** @return whether this thread is between wr_lock() and wr_unlock() */ diff --git a/storage/innobase/include/transactional_lock_guard.h b/storage/innobase/include/transactional_lock_guard.h index 168a68977a7..c48bde87d72 100644 --- a/storage/innobase/include/transactional_lock_guard.h +++ b/storage/innobase/include/transactional_lock_guard.h @@ -41,7 +41,7 @@ static inline bool xtest() { return false; } #else # if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # include # if defined __GNUC__ && !defined __INTEL_COMPILER @@ -52,7 +52,7 @@ bool transactional_lock_enabled(); # define TRANSACTIONAL_INLINE /* nothing */ # endif -TRANSACTIONAL_INLINE static inline bool xbegin() +TRANSACTIONAL_INLINE static inline bool xbegin() noexcept { return have_transactional_memory && _xbegin() == _XBEGIN_STARTED; } @@ -60,18 +60,18 @@ TRANSACTIONAL_INLINE static inline bool xbegin() # ifdef UNIV_DEBUG # ifdef __GNUC__ /** @return whether a memory transaction is active */ -bool xtest(); +bool xtest() noexcept; # else -static inline bool xtest() { return have_transactional_memory && _xtest(); } +static inline bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif # endif -TRANSACTIONAL_INLINE static inline void xabort() { _xabort(0); } +TRANSACTIONAL_INLINE static inline void xabort() noexcept { _xabort(0); } -TRANSACTIONAL_INLINE static inline void xend() { _xend(); } +TRANSACTIONAL_INLINE static inline void xend() noexcept { _xend(); } # elif defined __powerpc64__ || defined __s390__ extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # define TRANSACTIONAL_TARGET __attribute__((hot)) # define TRANSACTIONAL_INLINE __attribute__((hot,always_inline)) @@ -89,9 +89,9 @@ bool transactional_lock_enabled(); could be implemented here, we keep the implementation the same as ppc64. */ -TRANSACTIONAL_TARGET bool xbegin(); -TRANSACTIONAL_TARGET void xabort(); -TRANSACTIONAL_TARGET void xend(); +TRANSACTIONAL_TARGET bool xbegin() noexcept; +TRANSACTIONAL_TARGET void xabort() noexcept; +TRANSACTIONAL_TARGET void xend() noexcept; # ifdef UNIV_DEBUG bool xtest(); # endif @@ -105,7 +105,7 @@ class transactional_lock_guard mutex &m; public: - TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -117,8 +117,8 @@ public: #endif m.lock(); } - transactional_lock_guard(const transactional_lock_guard &)= delete; - TRANSACTIONAL_INLINE ~transactional_lock_guard() + transactional_lock_guard(const transactional_lock_guard &) noexcept= delete; + TRANSACTIONAL_INLINE ~transactional_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else @@ -144,7 +144,7 @@ class transactional_shared_lock_guard #endif public: - TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -160,9 +160,9 @@ public: #endif m.lock_shared(); } - transactional_shared_lock_guard(const transactional_shared_lock_guard &)= + transactional_shared_lock_guard(const transactional_shared_lock_guard &) noexcept= delete; - TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() + TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 71e3303736d..4b380462189 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -25,7 +25,7 @@ this program; if not, write to the Free Software Foundation, Inc., #elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { int regs[4]; __cpuid(regs, 0); @@ -39,7 +39,7 @@ bool transactional_lock_enabled() #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { if (__get_cpuid_max(0, nullptr) < 7) return false; @@ -52,7 +52,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG TRANSACTIONAL_TARGET -bool xtest() { return have_transactional_memory && _xtest(); } +bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif #elif defined __powerpc64__ || defined __s390__ # include @@ -60,21 +60,21 @@ bool xtest() { return have_transactional_memory && _xtest(); } # include __attribute__((target("htm"),hot)) -bool xbegin() +bool xbegin() noexcept { return have_transactional_memory && __TM_simple_begin() == _HTM_TBEGIN_STARTED; } __attribute__((target("htm"),hot)) -void xabort() { __TM_abort(); } +void xabort() noexcept { __TM_abort(); } __attribute__((target("htm"),hot)) -void xend() { __TM_end(); } +void xend() noexcept { __TM_end(); } bool have_transactional_memory; static sigjmp_buf ill_jmp; -static void ill_handler(int sig) +static void ill_handler(int sig) noexcept { siglongjmp(ill_jmp, sig); } @@ -83,7 +83,7 @@ static void ill_handler(int sig) and a 1 instruction store can succeed. */ __attribute__((noinline)) -static void test_tm(bool *r) +static void test_tm(bool *r) noexcept { if (__TM_simple_begin() == _HTM_TBEGIN_STARTED) { @@ -91,7 +91,7 @@ static void test_tm(bool *r) __TM_end(); } } -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { bool r= false; sigset_t oset; @@ -115,7 +115,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG __attribute__((target("htm"),hot)) -bool xtest() +bool xtest() noexcept { # ifdef __s390x__ return have_transactional_memory && @@ -129,13 +129,13 @@ bool xtest() #endif /** @return the parameter for srw_pause() */ -static inline unsigned srw_pause_delay() +static inline unsigned srw_pause_delay() noexcept { return my_cpu_relax_multiplier / 4 * srv_spin_wait_delay; } /** Pause the CPU for some time, with no memory accesses. */ -static inline void srw_pause(unsigned delay) +static inline void srw_pause(unsigned delay) noexcept { HMT_low(); while (delay--) @@ -145,7 +145,7 @@ static inline void srw_pause(unsigned delay) #ifdef SUX_LOCK_GENERIC # ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait() +template<> void pthread_mutex_wrapper::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -160,13 +160,13 @@ template<> void pthread_mutex_wrapper::wr_wait() } # endif -template void ssux_lock_impl::init(); -template void ssux_lock_impl::init(); -template void ssux_lock_impl::destroy(); -template void ssux_lock_impl::destroy(); +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::destroy() noexcept; +template void ssux_lock_impl::destroy() noexcept; template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&mutex); while (lock.load(std::memory_order_relaxed) == lk) @@ -175,7 +175,7 @@ inline void srw_mutex_impl::wait(uint32_t lk) } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&writer.mutex); while (readers.load(std::memory_order_relaxed) == lk) @@ -184,21 +184,21 @@ inline void ssux_lock_impl::wait(uint32_t lk) } template -void srw_mutex_impl::wake() +void srw_mutex_impl::wake() noexcept { pthread_mutex_lock(&mutex); pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); } template -inline void srw_mutex_impl::wake_all() +inline void srw_mutex_impl::wake_all() noexcept { pthread_mutex_lock(&mutex); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); } template -void ssux_lock_impl::wake() +void ssux_lock_impl::wake() noexcept { pthread_mutex_lock(&writer.mutex); pthread_cond_signal(&readers_cond); @@ -210,18 +210,18 @@ static_assert(4 == sizeof(rw_lock), "ABI"); # include template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&lock, &lk, 4, INFINITE); } template -void srw_mutex_impl::wake() { WakeByAddressSingle(&lock); } +void srw_mutex_impl::wake() noexcept { WakeByAddressSingle(&lock); } template -inline void srw_mutex_impl::wake_all() { WakeByAddressAll(&lock); } +inline void srw_mutex_impl::wake_all() noexcept { WakeByAddressAll(&lock); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&readers, &lk, 4, INFINITE); } template -void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } +void ssux_lock_impl::wake() noexcept { WakeByAddressSingle(&readers); } # else # ifdef __linux__ # include @@ -249,28 +249,28 @@ void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } # endif template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&lock, WAIT, lk); } template -void srw_mutex_impl::wake() { SRW_FUTEX(&lock, WAKE, 1); } +void srw_mutex_impl::wake() noexcept { SRW_FUTEX(&lock, WAKE, 1); } template -void srw_mutex_impl::wake_all() { SRW_FUTEX(&lock, WAKE, INT_MAX); } +void srw_mutex_impl::wake_all() noexcept { SRW_FUTEX(&lock, WAKE, INT_MAX); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&readers, WAIT, lk); } template -void ssux_lock_impl::wake() { SRW_FUTEX(&readers, WAKE, 1); } +void ssux_lock_impl::wake() noexcept { SRW_FUTEX(&readers, WAKE, 1); } # endif #endif -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; template -void srw_mutex_impl::wait_and_lock() +void srw_mutex_impl::wait_and_lock() noexcept { uint32_t lk= WAITER + lock.fetch_add(WAITER, std::memory_order_relaxed); @@ -339,11 +339,11 @@ acquired: } } -template void srw_mutex_impl::wait_and_lock(); -template void srw_mutex_impl::wait_and_lock(); +template void srw_mutex_impl::wait_and_lock() noexcept; +template void srw_mutex_impl::wait_and_lock() noexcept; template -void ssux_lock_impl::wr_wait(uint32_t lk) +void ssux_lock_impl::wr_wait(uint32_t lk) noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(lk); @@ -374,11 +374,11 @@ void ssux_lock_impl::wr_wait(uint32_t lk) while (lk != WRITER); } -template void ssux_lock_impl::wr_wait(uint32_t); -template void ssux_lock_impl::wr_wait(uint32_t); +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; template -void ssux_lock_impl::rd_wait() +void ssux_lock_impl::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -429,11 +429,11 @@ void ssux_lock_impl::rd_wait() writer.wake_all(); } -template void ssux_lock_impl::rd_wait(); -template void ssux_lock_impl::rd_wait(); +template void ssux_lock_impl::rd_wait() noexcept; +template void ssux_lock_impl::rd_wait() noexcept; #if defined _WIN32 || defined SUX_LOCK_GENERIC -template<> void srw_lock_::rd_wait() +template<> void srw_lock_::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -447,7 +447,7 @@ template<> void srw_lock_::rd_wait() IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } -template<> void srw_lock_::wr_wait() +template<> void srw_lock_::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -463,13 +463,13 @@ template<> void srw_lock_::wr_wait() #endif #ifdef UNIV_PFS_RWLOCK -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; template -void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) +void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -486,7 +486,7 @@ void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) } template -void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) +void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -525,7 +525,7 @@ void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_rd_lock(const char *file, unsigned line) +void ssux_lock::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -541,7 +541,7 @@ void ssux_lock::psi_rd_lock(const char *file, unsigned line) lock.rd_lock(); } -void ssux_lock::psi_u_lock(const char *file, unsigned line) +void ssux_lock::psi_u_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; if (PSI_rwlock_locker *locker= PSI_RWLOCK_CALL(start_rwlock_wrwait) @@ -554,7 +554,7 @@ void ssux_lock::psi_u_lock(const char *file, unsigned line) lock.u_lock(); } -void ssux_lock::psi_wr_lock(const char *file, unsigned line) +void ssux_lock::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -594,7 +594,7 @@ void ssux_lock::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) +void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; DBUG_ASSERT(lock.writer.is_locked()); @@ -616,14 +616,14 @@ void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) lock.u_wr_upgrade(); } #else /* UNIV_PFS_RWLOCK */ -template void ssux_lock_impl::rd_lock(); -template void ssux_lock_impl::rd_unlock(); -template void ssux_lock_impl::u_unlock(); -template void ssux_lock_impl::wr_unlock(); +template void ssux_lock_impl::rd_lock() noexcept; +template void ssux_lock_impl::rd_unlock() noexcept; +template void ssux_lock_impl::u_unlock() noexcept; +template void ssux_lock_impl::wr_unlock() noexcept; #endif /* UNIV_PFS_RWLOCK */ #ifdef UNIV_DEBUG -void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) +void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept { srw_lock::SRW_LOCK_INIT(key); readers_lock.init(); @@ -631,7 +631,7 @@ void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) ut_ad(!have_any()); } -void srw_lock_debug::destroy() +void srw_lock_debug::destroy() noexcept { ut_ad(!writer); if (auto r= readers.load(std::memory_order_relaxed)) @@ -644,7 +644,7 @@ void srw_lock_debug::destroy() srw_lock::destroy(); } -bool srw_lock_debug::wr_lock_try() +bool srw_lock_debug::wr_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::wr_lock_try()) @@ -654,7 +654,7 @@ bool srw_lock_debug::wr_lock_try() return true; } -void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::wr_lock(SRW_LOCK_ARGS(file, line)); @@ -662,14 +662,14 @@ void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) writer.store(pthread_self(), std::memory_order_relaxed); } -void srw_lock_debug::wr_unlock() +void srw_lock_debug::wr_unlock() noexcept { ut_ad(have_wr()); writer.store(0, std::memory_order_relaxed); srw_lock::wr_unlock(); } -void srw_lock_debug::readers_register() +void srw_lock_debug::readers_register() noexcept { readers_lock.wr_lock(); auto r= readers.load(std::memory_order_relaxed); @@ -682,7 +682,7 @@ void srw_lock_debug::readers_register() readers_lock.wr_unlock(); } -bool srw_lock_debug::rd_lock_try() +bool srw_lock_debug::rd_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::rd_lock_try()) @@ -691,14 +691,14 @@ bool srw_lock_debug::rd_lock_try() return true; } -void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::rd_lock(SRW_LOCK_ARGS(file, line)); readers_register(); } -void srw_lock_debug::rd_unlock() +void srw_lock_debug::rd_unlock() noexcept { const pthread_t self= pthread_self(); ut_ad(writer != self); From 6715e4dfe1f9484cf6a686459eb3fdbef4f37d30 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 20 Sep 2024 10:34:44 +0200 Subject: [PATCH 165/185] MDEV-34973: innobase/dict0dict: add `noexcept` to lock/unlock methods Another chance for cutting back overhead due to C++ exceptions being enabled; the `dict_sys_t` class is a good candidate because its locking methods are called frequently. Binary size reduction this time: text data bss dec hex filename 24448622 2436488 9473537 36358647 22ac9f7 build/release/sql/mariadbd 24448474 2436488 9473601 36358563 22ac9a3 build/release/sql/mariadbd --- storage/innobase/dict/dict0dict.cc | 8 ++++---- storage/innobase/include/dict0dict.h | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 3c6d1ce9e48..70afa0a30f3 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -955,7 +955,7 @@ void dict_sys_t::create() } -void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) +void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ulonglong now= my_hrtime_coarse().val, old= 0; if (latch_ex_wait_start.compare_exchange_strong @@ -981,17 +981,17 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) } #ifdef UNIV_PFS_RWLOCK -ATTRIBUTE_NOINLINE void dict_sys_t::unlock() +ATTRIBUTE_NOINLINE void dict_sys_t::unlock() noexcept { latch.wr_unlock(); } -ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) +ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) noexcept { latch.rd_lock(file, line); } -ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() +ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() noexcept { latch.rd_unlock(); } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index a62a1ec004e..b9a8c0e70e7 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1493,24 +1493,24 @@ public: #ifdef UNIV_DEBUG /** @return whether the current thread is holding the latch */ - bool frozen() const { return latch.have_any(); } + bool frozen() const noexcept { return latch.have_any(); } /** @return whether the current thread is holding a shared latch */ - bool frozen_not_locked() const { return latch.have_rd(); } + bool frozen_not_locked() const noexcept { return latch.have_rd(); } /** @return whether the current thread holds the exclusive latch */ - bool locked() const { return latch.have_wr(); } + bool locked() const noexcept { return latch.have_wr(); } #endif private: /** Acquire the exclusive latch */ ATTRIBUTE_NOINLINE - void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)); + void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; public: /** @return the my_hrtime_coarse().val of the oldest lock_wait() start, assuming that requests are served on a FIFO basis */ - ulonglong oldest_wait() const + ulonglong oldest_wait() const noexcept { return latch_ex_wait_start.load(std::memory_order_relaxed); } /** Exclusively lock the dictionary cache. */ - void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) + void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { if (!latch.wr_lock_try()) lock_wait(SRW_LOCK_ARGS(file, line)); @@ -1518,18 +1518,18 @@ public: #ifdef UNIV_PFS_RWLOCK /** Unlock the data dictionary cache. */ - ATTRIBUTE_NOINLINE void unlock(); + ATTRIBUTE_NOINLINE void unlock() noexcept; /** Acquire a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line) noexcept; /** Release a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void unfreeze(); + ATTRIBUTE_NOINLINE void unfreeze() noexcept; #else /** Unlock the data dictionary cache. */ - void unlock() { latch.wr_unlock(); } + void unlock() noexcept { latch.wr_unlock(); } /** Acquire a shared lock on the dictionary cache. */ - void freeze() { latch.rd_lock(); } + void freeze() noexcept { latch.rd_lock(); } /** Release a shared lock on the dictionary cache. */ - void unfreeze() { latch.rd_unlock(); } + void unfreeze() noexcept { latch.rd_unlock(); } #endif /** Estimate the used memory occupied by the data dictionary From 753e7d6d7ce7770d3c98beb6fdcb97e0e8d1ec9f Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Tue, 23 Jul 2024 16:09:10 +0530 Subject: [PATCH 166/185] MDEV-27412: JSON_TABLE doesn't properly unquote strings Analysis: The value gets appended as string instead of unescaped json value Fix: Append the value of json in a temporary string and then store it in the field instead of directly storing as string. --- mysql-test/main/func_json.result | 9 +++++++++ mysql-test/main/func_json.test | 12 ++++++++++++ sql/item_func.h | 2 ++ sql/item_jsonfunc.cc | 2 +- sql/json_table.cc | 5 ++++- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 8a4405ac22d..d8d87b53672 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1757,5 +1757,14 @@ JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, {"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"} DROP TABLE t; # +# MDEV-27412: JSON_TABLE doesn't properly unquote strings +# +SET @data = '[{"Data": ""}]'; +SELECT +data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; +data + +# # End of 10.6 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index dcbbd6055b1..195f487879d 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1189,6 +1189,18 @@ SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_I SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t; DROP TABLE t; + +--echo # +--echo # MDEV-27412: JSON_TABLE doesn't properly unquote strings +--echo # + + +SET @data = '[{"Data": ""}]'; + +SELECT + data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/item_func.h b/sql/item_func.h index 592bcb65a0e..bf3582ded03 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -35,6 +35,8 @@ extern "C" /* Bug in BSDI include file */ #include +extern int st_append_json(String *s, + CHARSET_INFO *json_cs, const uchar *js, uint js_len); class Item_func :public Item_func_or_sum { void sync_with_sum_func_and_with_field(List &list); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index fc485c182cb..3755b880247 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -79,7 +79,7 @@ static inline bool append_simple(String *s, const uchar *a, size_t a_len) Appends JSON string to the String object taking charsets in consideration. */ -static int st_append_json(String *s, +int st_append_json(String *s, CHARSET_INFO *json_cs, const uchar *js, uint js_len) { int str_len= js_len * s->charset()->mbmaxlen; diff --git a/sql/json_table.cc b/sql/json_table.cc index 86f565aa561..8a3ca39f883 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -380,6 +380,8 @@ int ha_json_table::rnd_init(bool scan) static void store_json_in_field(Field *f, const json_engine_t *je) { + String res_tmp("", 0, je->s.cs); + switch (je->value_type) { case JSON_VALUE_NULL: @@ -400,7 +402,8 @@ static void store_json_in_field(Field *f, const json_engine_t *je) default: break; }; - f->store((const char *) je->value, (uint32) je->value_len, je->s.cs); + st_append_json(&res_tmp, je->s.cs, je->value, je->value_len); + f->store((const char *) res_tmp.ptr(), (uint32) res_tmp.length(), je->s.cs); } From d8d80bd5039d1353ba5908137c4eefbd85b6f7f1 Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Sun, 22 Sep 2024 13:33:16 -0600 Subject: [PATCH 167/185] Fix a couple of `my_snprintf` arg mismatches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit backports two fixes from #3360’s vast discovery. --- client/mysqldump.cc | 2 +- sql/log.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/mysqldump.cc b/client/mysqldump.cc index 65a969a94a5..8a06a283957 100644 --- a/client/mysqldump.cc +++ b/client/mysqldump.cc @@ -7285,7 +7285,7 @@ int main(int argc, char **argv) goto err; connection_pool.for_each_connection([](MYSQL *c) { if (start_transaction(c)) - maybe_die(EX_MYSQLERR, "Failed to start transaction on connection ID %u", mysql->thread_id); + maybe_die(EX_MYSQLERR, "Failed to start transaction on connection ID %lu", mysql->thread_id); }); } diff --git a/sql/log.cc b/sql/log.cc index 1054e36afda..d5b0f0ba95d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3901,7 +3901,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name, if (!gtid_index) sql_print_information("Could not create GTID index for binlog " "file '%s'. Accesses to this binlog file will " - "fallback to slower sequential scan."); + "fallback to slower sequential scan.", + log_file_name); } else gtid_index= nullptr; From 8d810e9426573cdcbcc60c7577ffd4f3f29ce391 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 20 Sep 2024 14:58:23 +0200 Subject: [PATCH 168/185] MDEV-29537 Creation of view with UNION and SELECT ... FOR UPDATE in definition is failed with error lock_type is writen in the last SELECT of the unit even if it parsed last, so it should be printed last from the last select of the unit. --- mysql-test/main/view.result | 31 +++++++++++++++++++++++++++++++ mysql-test/main/view.test | 32 ++++++++++++++++++++++++++++++++ sql/sql_lex.cc | 18 ++++++++++++++++++ sql/sql_lex.h | 2 ++ sql/sql_select.cc | 17 +++++++++++++---- 5 files changed, 96 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index bc319d3c5b7..74f64388b4a 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6970,3 +6970,34 @@ DROP VIEW v1; DROP VIEW v2; DROP TABLE t; # End of 10.4 tests +# +# MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +# in definition is failed with error +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE; +SELECT * FROM v1; +1 +1 +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from `t1` union select 1 AS `1` from DUAL where 1 group by 1 having 1 order by 1 for update latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE); +SELECT * FROM v1; +1 +1 +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from `t1` union (select 1 AS `1` from DUAL where 1 group by 1 having 1 for update) latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 6730e7f7111..229fedddb5c 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -6726,3 +6726,35 @@ DROP VIEW v2; DROP TABLE t; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +--echo # in definition is failed with error +--echo # + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE; + +SELECT * FROM v1; +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 + UNION + (SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE); +SELECT * FROM v1; + +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # End of 10.5 tests diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index fc39bd858f8..385131642b0 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3788,6 +3788,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type) } else if (saved_fake_select_lex) saved_fake_select_lex->print_limit(thd, str, query_type); + + print_lock_from_the_last_select(str); } @@ -10612,6 +10614,22 @@ bool SELECT_LEX_UNIT::set_lock_to_the_last_select(Lex_select_lock l) return FALSE; } + +void SELECT_LEX_UNIT::print_lock_from_the_last_select(String *str) +{ + SELECT_LEX *sel= first_select(); + while (sel->next_select()) + sel= sel->next_select(); + if(sel->braces) + return; // braces processed in st_select_lex::print + + // lock type + sel->print_lock_type(str); + + return; +} + + /** Generate unique name for generated derived table for this SELECT */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index e0cb336de5a..1dbd839ac53 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1042,6 +1042,7 @@ public: bool check_parameters(SELECT_LEX *main_select); bool set_lock_to_the_last_select(Lex_select_lock l); + void print_lock_from_the_last_select(String *str); bool can_be_merged(); @@ -1465,6 +1466,7 @@ public: bool setup_ref_array(THD *thd, uint order_group_num); uint get_cardinality_of_ref_ptrs_slice(uint order_group_num_arg); void print(THD *thd, String *str, enum_query_type query_type); + void print_lock_type(String *str); void print_item_list(THD *thd, String *str, enum_query_type query_type); void print_set_clause(THD *thd, String *str, enum_query_type query_type); void print_on_duplicate_key_clause(THD *thd, String *str, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b995beb53e3..e0eb7bec3e4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -28787,6 +28787,16 @@ void st_select_lex::print_on_duplicate_key_clause(THD *thd, String *str, } } + +void st_select_lex::print_lock_type(String *str) +{ + if (lock_type == TL_READ_WITH_SHARED_LOCKS) + str->append(" lock in share mode"); + else if (lock_type == TL_WRITE) + str->append(" for update"); +} + + void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) { DBUG_ASSERT(thd); @@ -29059,10 +29069,9 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) print_limit(thd, str, query_type); // lock type - if (lock_type == TL_READ_WITH_SHARED_LOCKS) - str->append(" lock in share mode"); - else if (lock_type == TL_WRITE) - str->append(" for update"); + if (braces) /* no braces processed in + SELECT_LEX_UNIT::print_lock_from_the_last_select */ + print_lock_type(str); if ((sel_type == INSERT_CMD || sel_type == REPLACE_CMD) && thd->lex->update_list.elements) From 2d031f4a71205fcd89f73febe9e09efc0954e611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Oct 2024 13:29:59 +0300 Subject: [PATCH 169/185] MDEV-34973 fixup for POWER,s390x xtest(): Correct the declaration. --- storage/innobase/include/transactional_lock_guard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/transactional_lock_guard.h b/storage/innobase/include/transactional_lock_guard.h index c48bde87d72..40519f513b2 100644 --- a/storage/innobase/include/transactional_lock_guard.h +++ b/storage/innobase/include/transactional_lock_guard.h @@ -93,7 +93,7 @@ TRANSACTIONAL_TARGET bool xbegin() noexcept; TRANSACTIONAL_TARGET void xabort() noexcept; TRANSACTIONAL_TARGET void xend() noexcept; # ifdef UNIV_DEBUG -bool xtest(); +bool xtest() noexcept; # endif # endif From a298dfb84c532009be43055be4b2b7bbe56c6e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Oct 2024 15:03:04 +0300 Subject: [PATCH 170/185] MDEV-35053 Crash in purge_sys_t::iterator::free_history_rseg() purge_sys_t::get_page(): Avoid accessing a freed reference to pages[id] after pages.erase(id). This heap-use-after-free would sometimes be caught by AddressSanitizer. purge_sys_t::iterator::free_history_rseg(): Do not crash if undo=nullptr (the database is corrupted). Reviewed by: Debarun Banerjee --- storage/innobase/trx/trx0purge.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index d9550a19cc6..eead5118eb7 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -493,16 +493,18 @@ loop: if (undo->hdr_page_no == hdr_addr.page) goto found_cached; ut_ad("inconsistent undo logs" == 0); - if (false) - found_cached: - UT_LIST_REMOVE(rseg.undo_cached, undo); + found_cached: static_assert(FIL_NULL == 0xffffffff, ""); if (UNIV_UNLIKELY(mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT + rseg_hdr->page.frame))) trx_rseg_format_upgrade(rseg_hdr, &mtr); - mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + - undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); - ut_free(undo); + if (UNIV_LIKELY(undo != nullptr)) + { + UT_LIST_REMOVE(rseg.undo_cached, undo); + mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + + undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); + ut_free(undo); + } mtr.write<8,mtr_t::MAYBE_NOP>(*rseg_hdr, TRX_RSEG + TRX_RSEG_MAX_TRX_ID + rseg_hdr->page.frame, trx_sys.get_max_trx_id() - 1); @@ -778,13 +780,16 @@ buf_block_t *purge_sys_t::get_page(page_id_t id) { ut_ad(!recv_sys.recovery_on); - buf_block_t*& undo_page= pages[id]; + buf_block_t *&h= pages[id]; + buf_block_t *undo_page= h; if (!undo_page) { undo_page= buf_pool.page_fix(id); // batch_cleanup() will unfix() if (!undo_page) pages.erase(id); + else + h= undo_page; } return undo_page; From 464055fe655d70e7191f4bd9f5709bc64b26b942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Oct 2024 18:35:39 +0300 Subject: [PATCH 171/185] MDEV-34078 Memory leak in InnoDB purge with 32-column PRIMARY KEY row_purge_reset_trx_id(): Reserve large enough offsets for accomodating the maximum width PRIMARY KEY followed by DB_TRX_ID,DB_ROLL_PTR. Reviewed by: Thirunarayanan Balathandayuthapani --- mysql-test/suite/innodb/r/purge.result | 23 ++++++++++++++++++++ mysql-test/suite/innodb/t/purge.test | 29 +++++++++++++++++++++++++- storage/innobase/row/row0purge.cc | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result index a71d0afdcbe..5eedbc4ad9d 100644 --- a/mysql-test/suite/innodb/r/purge.result +++ b/mysql-test/suite/innodb/r/purge.result @@ -116,6 +116,29 @@ t12963823 CREATE TABLE `t12963823` ( KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_33); +EXECUTE IMMEDIATE c; +END; +$$ +ERROR 42000: Too many key parts specified; max 32 parts allowed +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_32); +EXECUTE IMMEDIATE c; +END; +$$ +INSERT INTO t1() VALUES(); InnoDB 0 transactions not purged +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/t/purge.test b/mysql-test/suite/innodb/t/purge.test index 63312e50fd8..3caa3f065aa 100644 --- a/mysql-test/suite/innodb/t/purge.test +++ b/mysql-test/suite/innodb/t/purge.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc +--source include/have_sequence.inc SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency=1; @@ -110,8 +111,34 @@ CREATE INDEX ndx_n ON t12963823 (n(500)); CREATE INDEX ndx_o ON t12963823 (o(500)); CREATE INDEX ndx_p ON t12963823 (p(500)); SHOW CREATE TABLE t12963823; -# We need to activate the purge thread before DROP TABLE. +DELIMITER $$; +--error ER_TOO_MANY_KEY_PARTS +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_33); + EXECUTE IMMEDIATE c; +END; +$$ +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_32); + EXECUTE IMMEDIATE c; +END; +$$ +DELIMITER ;$$ +INSERT INTO t1() VALUES(); + +# We need to activate the purge thread before DROP TABLE. -- source include/wait_all_purged.inc +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 6942f5b7af8..f9b30b6a0a9 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -678,7 +678,7 @@ static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr) mem_heap_t* heap = NULL; /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3]; rec_offs_init(offsets_); rec_offs* offsets = rec_get_offsets( rec, index, offsets_, index->n_core_fields, From 2cdcfb644ce7e1c3324543c1ee5504db14363297 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 24 Sep 2024 14:40:04 +0200 Subject: [PATCH 172/185] MDEV-26314 ST_EQUALS listed twice in information_schema.SQL_FUNCTIONS --- sql/item_geofunc.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 5160bfdc4bb..86965bcfe78 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -4012,7 +4012,6 @@ static Native_func_registry func_array_geom[] = { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)}, { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)}, { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, - { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, From 5bf543fd43ce6bb26a14c93f5058dd23edf1dc54 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 24 Sep 2024 19:08:24 +0200 Subject: [PATCH 173/185] MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table privilege tables do not always have to exist --- mysql-test/main/create_user.result | 9 +++++++++ mysql-test/main/create_user.test | 12 ++++++++++++ sql/sql_acl.cc | 5 ++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result index 8bd0ca88335..477d4d53bbe 100644 --- a/mysql-test/main/create_user.result +++ b/mysql-test/main/create_user.result @@ -70,3 +70,12 @@ select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time % foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 mysql_native_password N N 0.000000 drop user foo; +# End of 10.2 tests +# +# MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +# +RENAME TABLE mysql.procs_priv TO mysql.temp; +CREATE USER a IDENTIFIED WITH 'a'; +ERROR HY000: Plugin 'a' is not loaded +RENAME TABLE mysql.temp TO mysql.procs_priv; +# End of 10.5 tests diff --git a/mysql-test/main/create_user.test b/mysql-test/main/create_user.test index f04cb3e302a..ef855ed5e86 100644 --- a/mysql-test/main/create_user.test +++ b/mysql-test/main/create_user.test @@ -56,3 +56,15 @@ create user foo with MAX_QUERIES_PER_HOUR 10 MAX_USER_CONNECTIONS 40; select * from mysql.user where user like 'foo'; drop user foo; + +--echo # End of 10.2 tests + +--echo # +--echo # MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +--echo # +RENAME TABLE mysql.procs_priv TO mysql.temp; +--error ER_PLUGIN_IS_NOT_LOADED +CREATE USER a IDENTIFIED WITH 'a'; +RENAME TABLE mysql.temp TO mysql.procs_priv; + +--echo # End of 10.5 tests diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index acbb9fa6d38..d0fa2ff9c1f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10192,6 +10192,10 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table, int result= 0; int error; TABLE *table= grant_table.table(); + DBUG_ENTER("handle_grant_table"); + if (!table) + DBUG_RETURN(0); + Field *host_field= table->field[0]; Field *user_field= table->field[which_table == USER_TABLE || which_table == PROXIES_PRIV_TABLE ? 1 : 2]; @@ -10201,7 +10205,6 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table, const char *user; uchar user_key[MAX_KEY_LENGTH]; uint key_prefix_length; - DBUG_ENTER("handle_grant_table"); if (which_table == ROLES_MAPPING_TABLE) { From 813e5927630c440b636e1de293fc153b93bb142e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 27 Sep 2024 13:10:17 +0200 Subject: [PATCH 174/185] compilation failure in CONNECT storage/connect/tabfmt.cpp:419:24: error: '%.3d' directive writing between 3 and 10 bytes into a region of size 5 [-Werror=format-overflow=] 419 | sprintf(buf, "COL%.3d", i+1); --- storage/connect/tabfmt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 037a465af13..05799cb3d87 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -93,7 +93,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) char sep, q; int rc, mxr; bool hdr; - char *p, *colname[MAXCOL], dechar, buf[8]; + char *p, *colname[MAXCOL], dechar, buf[16]; int i, imax, hmax, n, nerr, phase, blank, digit, dec, type; int ncol = sizeof(buftyp) / sizeof(int); int num_read = 0, num_max = 10000000; // Statistics From b1bbdbab9e13c0b947ec1a0dd882da7b2f197de1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 27 Sep 2024 12:58:15 +0200 Subject: [PATCH 175/185] cleanup: remove redundant if() likely, a result of auto-merge of two fixes in different versions --- sql/sql_select.cc | 10 +--------- storage/innobase/handler/ha_innodb.cc | 12 ++---------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e0eb7bec3e4..001053e0ed7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13904,13 +13904,6 @@ void JOIN_TAB::cleanup() delete filesort->select; delete filesort; filesort= NULL; - /* Skip non-existing derived tables/views result tables */ - if (table && - (table->s->tmp_table != INTERNAL_TMP_TABLE || table->is_created())) - { - table->file->ha_end_keyread(); - table->file->ha_index_or_rnd_end(); - } if (table) { table->file->ha_end_keyread(); @@ -13919,8 +13912,7 @@ void JOIN_TAB::cleanup() else table->file->ha_index_or_rnd_end(); preread_init_done= FALSE; - if (table->pos_in_table_list && - table->pos_in_table_list->jtbm_subselect) + if (table->pos_in_table_list && table->pos_in_table_list->jtbm_subselect) { if (table->pos_in_table_list->jtbm_subselect->is_jtbm_const_tab) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1abf394c7bd..37b2d9ad7bd 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15929,10 +15929,10 @@ ha_innobase::external_lock( } DBUG_RETURN(0); - } else { - DEBUG_SYNC_C("ha_innobase_end_statement"); } + DEBUG_SYNC_C("ha_innobase_end_statement"); + /* MySQL is releasing a table lock */ trx->n_mysql_tables_in_use--; @@ -15959,14 +15959,6 @@ ha_innobase::external_lock( } } - if (!trx_is_started(trx) - && lock_type != F_UNLCK - && (m_prebuilt->select_lock_type != LOCK_NONE - || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { - - trx->will_lock = true; - } - DBUG_RETURN(0); } From 9021f40b8ebfa9a9e0b01029a62742b7cdde5be5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 30 Sep 2024 18:08:00 +0200 Subject: [PATCH 176/185] MDEV-35050 Found wrong usage of mutex upon setting plugin session variables --- mysql-test/suite/plugins/r/fulltext_plugin.result | 11 +++++++++++ mysql-test/suite/plugins/t/fulltext_plugin.test | 15 ++++++++++++--- sql/session_tracker.cc | 4 ++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/plugins/r/fulltext_plugin.result b/mysql-test/suite/plugins/r/fulltext_plugin.result index 2c104c98676..6fcba7735c9 100644 --- a/mysql-test/suite/plugins/r/fulltext_plugin.result +++ b/mysql-test/suite/plugins/r/fulltext_plugin.result @@ -1,3 +1,6 @@ +# +# BUG#39746 - Debug flag breaks struct definition (server crash) +# INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; @@ -5,3 +8,11 @@ DROP TABLE t1; UNINSTALL PLUGIN simple_parser; show status like 'a%status'; Variable_name Value +# +# MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +# +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; +# End of 10.5 tests diff --git a/mysql-test/suite/plugins/t/fulltext_plugin.test b/mysql-test/suite/plugins/t/fulltext_plugin.test index e9b4343e0dc..8a3a9d62e9c 100644 --- a/mysql-test/suite/plugins/t/fulltext_plugin.test +++ b/mysql-test/suite/plugins/t/fulltext_plugin.test @@ -1,8 +1,8 @@ --source include/have_simple_parser.inc -# -# BUG#39746 - Debug flag breaks struct definition (server crash) -# +--echo # +--echo # BUG#39746 - Debug flag breaks struct definition (server crash) +--echo # --replace_result .dll .so eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); @@ -15,3 +15,12 @@ UNINSTALL PLUGIN simple_parser; # show status like 'a%status'; +--echo # +--echo # MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +--echo # +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; + +--echo # End of 10.5 tests diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc index 10d0267326e..cd3491ca9f3 100644 --- a/sql/session_tracker.cc +++ b/sql/session_tracker.cc @@ -428,6 +428,7 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) SHOW_VAR show; CHARSET_INFO *charset; size_t val_length, length; + mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_plugin); if (!*node->test_load) { @@ -444,13 +445,12 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) show.name= svar->name.str; show.value= (char *) svar; - mysql_mutex_lock(&LOCK_global_system_variables); const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL, &charset, val_buf, &val_length); - mysql_mutex_unlock(&LOCK_global_system_variables); if (is_plugin) mysql_mutex_unlock(&LOCK_plugin); + mysql_mutex_unlock(&LOCK_global_system_variables); length= net_length_size(svar->name.length) + svar->name.length + From 8166a5d33dda510f3c51341112742064d581a6c3 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 24 Sep 2024 09:44:39 +0300 Subject: [PATCH 177/185] MDEV-34993: Incorrect cardinality estimation causes poor query plan When calculate_cond_selectivity_for_table() takes into account multi- column selectivities from range access, it tries to take-into account that selectivity for some columns may have been already taken into account. For example, for range access on IDX1 using {kp1, kp2}, the selectivity of restrictions on "kp2" might have already been taken into account to some extent. So, the code tries to "discount" that using rec_per_key[] estimates. This seems to be wrong and unreliable: the "discounting" may produce a rselectivity_multiplier number that hints that the overall selectivity of range access on IDX1 was greater than 1. Do a conservative fix: if we arrive at conclusion that selectivity of range access on condition in IDX1 >1.0, clip it down to 1. --- .../selectivity_innodb_notembedded.result | 74 +++++++++++++++++++ .../main/selectivity_innodb_notembedded.test | 1 + .../main/selectivity_notembedded.result | 74 +++++++++++++++++++ mysql-test/main/selectivity_notembedded.test | 39 ++++++++++ .../sys_vars/r/sysvars_server_embedded.result | 10 +++ sql/opt_range.cc | 26 ++++++- 6 files changed, 223 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result index 95da1decd5e..5f8e9e85d5e 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.result +++ b/mysql-test/main/selectivity_innodb_notembedded.result @@ -208,6 +208,80 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using where +# Must have a note that "multiplier is too high": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.399, + "selectivity_multiplier": 90.9091, + "note": "multiplier too high, clipping", + "clipped_multiplier": 2.506265664 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 5, + "cost": 6.666533161, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 5, + "cost": 6.666533161, + "uses_join_buffering": false + } + } +] +drop table t1; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_innodb_notembedded.test b/mysql-test/main/selectivity_innodb_notembedded.test index 387f7dcb7de..bc07bcad464 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.test +++ b/mysql-test/main/selectivity_innodb_notembedded.test @@ -3,6 +3,7 @@ --source include/big_test.inc --source include/default_optimizer_switch.inc --source include/not_embedded.inc +--source ./include/innodb_stable_estimates.inc SET SESSION STORAGE_ENGINE='InnoDB'; diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result index ef3f6bb9bf3..995ef1681a4 100644 --- a/mysql-test/main/selectivity_notembedded.result +++ b/mysql-test/main/selectivity_notembedded.result @@ -203,6 +203,80 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where +# Must have a note that "multiplier is too high": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.391, + "selectivity_multiplier": 90.9091, + "note": "multiplier too high, clipping", + "clipped_multiplier": 2.557544757 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 5, + "cost": 6.647684891, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 5, + "cost": 6.647684891, + "uses_join_buffering": false + } + } +] +drop table t1; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test index 323e4ca6bd6..b5f004502eb 100644 --- a/mysql-test/main/selectivity_notembedded.test +++ b/mysql-test/main/selectivity_notembedded.test @@ -220,6 +220,45 @@ from set optimizer_trace=@trace_tmp; drop table t1; +--echo # +--echo # MDEV-34993: Incorrect cardinality estimation causes poor query plan +--echo # + +create table t1 ( + pk int, + key1 int, + filler char(100), + index (key1, pk), + primary key (pk) +); + +insert into t1 +select + seq, FLOOR(seq/100), 'filler' +from + seq_1_to_1000; +analyze table t1; + +set optimizer_trace=1; +explain select * from t1 +where + pk in (1,2,3,4,5) and + key1 <= 4; + +--echo # Must have a note that "multiplier is too high": +select + json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from + information_schema.optimizer_trace; + +--echo # Must not include 1.79...e308 as cost: +select + json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from + information_schema.optimizer_trace; + +drop table t1; + --echo # --echo # Clean up --echo # diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 67c9b40ea2d..a5a02bfa1bc 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2242,6 +2242,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS +VARIABLE_SCOPE SESSION +VARIABLE_TYPE SET +VARIABLE_COMMENT A bit field with the following values: fix_card_multiplier = Fix the computation in selectivity_for_indexes. selectivity_multiplier. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST fix_card_multiplier +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ac3b2d6f339..15a9dfb2e0f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3503,9 +3503,33 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) */ selectivity_mult= ((double)(i+1)) / i; } - table->cond_selectivity*= selectivity_mult; selectivity_for_index.add("selectivity_multiplier", selectivity_mult); + + /* + Ok, now we assume that selectivity that range condition on + this index adds over selectivities on indexes that we've already + examined is + + $SEL= (quick_cond_selectivity * selectivity_mult) + + The heuristic that we used to obtain selectivity_mult may not be + correct (actually is known to be incorrect in simple cases), so + we make sure here that $SEL <= 1.0. + + We adjust selectivity_mult (table->cond_selectivity was already + multiplied by quick_cond_selectivity above, so we will only + multiply it with selectivity_mult). + */ + if (selectivity_mult > 1.0 / quick_cond_selectivity) + { + selectivity_for_index.add("note", "multiplier too high, clipping"); + selectivity_mult= 1.0/quick_cond_selectivity; + selectivity_for_index.add("clipped_multiplier", selectivity_mult); + DBUG_ASSERT(quick_cond_selectivity * selectivity_mult <= 1.0); + } + + table->cond_selectivity*= selectivity_mult; } /* We need to set selectivity for fields supported by indexes. From 1cda4726ca6bc4d43c3545c744a5b0a4357e7dba Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 24 Sep 2024 10:23:34 +0300 Subject: [PATCH 178/185] MDEV-34993, part2: backport optimizer_adjust_secondary_key_costs ...and make the fix for MDEV-34993 switchable. It is enabled by default and controlled with @optimizer_adjust_secondary_key_costs=fix_card_multiplier --- mysql-test/main/mysqld--help.result | 7 +++ .../selectivity_innodb_notembedded.result | 54 +++++++++++++++++++ .../main/selectivity_notembedded.result | 54 +++++++++++++++++++ mysql-test/main/selectivity_notembedded.test | 18 +++++++ .../r/sysvars_server_notembedded.result | 10 ++++ sql/opt_range.cc | 4 +- sql/sql_class.h | 5 ++ sql/sql_priv.h | 5 ++ sql/sys_vars.cc | 19 +++++++ 9 files changed, 175 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 43377506eba..83a93a197a6 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -682,6 +682,12 @@ The following specify which files/extra groups are read (specified before remain max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors (Automatically configured unless set explicitly) + --optimizer-adjust-secondary-key-costs=name + A bit field with the following values: + fix_card_multiplier = Fix the computation in + selectivity_for_indexes. selectivity_multiplier. This + variable will be deleted in MariaDB 11.0 as it is not + needed with the new 11.0 optimizer. --optimizer-max-sel-arg-weight=# The maximum weight of the SEL_ARG graph. Set to 0 for no limit @@ -1642,6 +1648,7 @@ old-alter-table DEFAULT old-mode old-passwords FALSE old-style-user-limits FALSE +optimizer-adjust-secondary-key-costs fix_card_multiplier optimizer-max-sel-arg-weight 32000 optimizer-prune-level 1 optimizer-search-depth 62 diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result index 5f8e9e85d5e..0ed8908063e 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.result +++ b/mysql-test/main/selectivity_innodb_notembedded.result @@ -280,7 +280,61 @@ JS } } ] +# Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using where drop table t1; +# Shows a high multiplier, without a "note": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.399, + "selectivity_multiplier": 90.9091 + } + ] +] +# Includes 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 181.3636545, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 181.3636545, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +set optimizer_adjust_secondary_key_costs=default; # # Clean up # diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result index 995ef1681a4..77ae626f567 100644 --- a/mysql-test/main/selectivity_notembedded.result +++ b/mysql-test/main/selectivity_notembedded.result @@ -275,7 +275,61 @@ JS } } ] +# Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where drop table t1; +# Shows a high multiplier, without a "note": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.391, + "selectivity_multiplier": 90.9091 + } + ] +] +# Includes 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 177.7272905, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 177.7272905, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +set optimizer_adjust_secondary_key_costs=default; # # Clean up # diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test index b5f004502eb..2c4431adb23 100644 --- a/mysql-test/main/selectivity_notembedded.test +++ b/mysql-test/main/selectivity_notembedded.test @@ -257,7 +257,25 @@ select from information_schema.optimizer_trace; +--echo # Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where + pk in (1,2,3,4,5) and + key1 <= 4; drop table t1; +--echo # Shows a high multiplier, without a "note": +select + json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from + information_schema.optimizer_trace; + +--echo # Includes 1.79...e308 as cost: +select + json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from + information_schema.optimizer_trace; +set optimizer_adjust_secondary_key_costs=default; --echo # --echo # Clean up diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index ea1dd7af53b..50dd4ae23a3 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2402,6 +2402,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS +VARIABLE_SCOPE SESSION +VARIABLE_TYPE SET +VARIABLE_COMMENT A bit field with the following values: fix_card_multiplier = Fix the computation in selectivity_for_indexes. selectivity_multiplier. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST fix_card_multiplier +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 15a9dfb2e0f..8d36fdb4a18 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3521,7 +3521,9 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) multiplied by quick_cond_selectivity above, so we will only multiply it with selectivity_mult). */ - if (selectivity_mult > 1.0 / quick_cond_selectivity) + if ((thd->variables.optimizer_adjust_secondary_key_costs & + OPTIMIZER_ADJ_FIX_CARD_MULT) && + selectivity_mult > 1.0 / quick_cond_selectivity) { selectivity_for_index.add("note", "multiplier too high, clipping"); selectivity_mult= 1.0/quick_cond_selectivity; diff --git a/sql/sql_class.h b/sql/sql_class.h index 93c5850ae3d..3048e27daf8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -672,6 +672,11 @@ typedef struct system_variables ulonglong sortbuff_size; ulonglong default_regex_flags; ulonglong max_mem_used; + /* + A bitmap of OPTIMIZER_ADJ_* flags (defined in sql_priv.h). + See sys_vars.cc:adjust_secondary_key_cost for symbolic names. + */ + ulonglong optimizer_adjust_secondary_key_costs; /** Place holders to store Multi-source variables in sys_var.cc during diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 2335c6ba516..f7367e93edf 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -266,6 +266,11 @@ OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING | \ OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE) +/* + See adjust_secondary_key_cost in sys_vars.cc for symbolic names. +*/ +#define OPTIMIZER_ADJ_FIX_CARD_MULT (1) + /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you use strictly more than 64 bits by adding one more define above, you should diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 44302b3a507..93298ff7b04 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2777,6 +2777,25 @@ static Sys_var_ulong Sys_optimizer_trace_max_mem_size( SESSION_VAR(optimizer_trace_max_mem_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, ULONG_MAX), DEFAULT(1024 * 1024), BLOCK_SIZE(1)); +/* + Symbolic names for OPTIMIZER_ADJ_* flags in sql_priv.h +*/ +static const char *adjust_secondary_key_cost[]= +{ + "fix_card_multiplier", 0 +}; + +static Sys_var_set Sys_optimizer_adjust_secondary_key_costs( + "optimizer_adjust_secondary_key_costs", + "A bit field with the following values: " + "fix_card_multiplier = Fix the computation in selectivity_for_indexes." + " selectivity_multiplier. " + "This variable will be deleted in MariaDB 11.0 as it is not needed with the " + "new 11.0 optimizer.", + SESSION_VAR(optimizer_adjust_secondary_key_costs), CMD_LINE(REQUIRED_ARG), + adjust_secondary_key_cost, DEFAULT(OPTIMIZER_ADJ_FIX_CARD_MULT)); + + static Sys_var_charptr_fscs Sys_pid_file( "pid_file", "Pid file used by safe_mysqld", READ_ONLY GLOBAL_VAR(pidfile_name_ptr), CMD_LINE(REQUIRED_ARG), From 90f090f22c6f0063dfb3f00867e0ed5553e32cce Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Wed, 2 Oct 2024 09:41:28 +0200 Subject: [PATCH 179/185] Fix binlog.binlog_mdev25611 test failure on non-debug build Signed-off-by: Kristian Nielsen --- mysql-test/suite/binlog/t/binlog_mdev25611.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/binlog/t/binlog_mdev25611.test b/mysql-test/suite/binlog/t/binlog_mdev25611.test index e9a2dbc283c..fc40db8c1f5 100644 --- a/mysql-test/suite/binlog/t/binlog_mdev25611.test +++ b/mysql-test/suite/binlog/t/binlog_mdev25611.test @@ -1,4 +1,5 @@ source include/have_innodb.inc; +source include/have_debug.inc; source include/have_log_bin.inc; source include/have_binlog_format_mixed.inc; From cc70ca7eab449912b6e2f99c56265eab826e5645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Oct 2024 11:09:31 +0300 Subject: [PATCH 180/185] MDEV-35059 ALTER TABLE...IMPORT TABLESPACE with FULLTEXT SEARCH may corrupt the adaptive hash index build_fts_hidden_table(): Correct a mistake that had been made in commit 903ae300697786d11f300cd0289ab1dcb6da3b9b (MDEV-30655). --- mysql-test/suite/innodb/r/import_hidden_fts.result | 6 +++++- mysql-test/suite/innodb/t/import_hidden_fts.test | 11 ++++++++++- storage/innobase/row/row0import.cc | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/import_hidden_fts.result b/mysql-test/suite/innodb/r/import_hidden_fts.result index 69120898d4d..e08558cdc89 100644 --- a/mysql-test/suite/innodb/r/import_hidden_fts.result +++ b/mysql-test/suite/innodb/r/import_hidden_fts.result @@ -1,3 +1,5 @@ +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index=ON; call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, fulltext f_idx(f2), @@ -9,7 +11,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect con1,localhost,root,,; +connect block_purge,localhost,root,,; START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; DELETE FROM t1 WHERE f1 > 1; @@ -22,6 +24,7 @@ UNLOCK TABLES; Warnings: Warning 1235 This version of MariaDB doesn't yet support 'FLUSH TABLES on a table that had an FTS index, created on a hidden column, the auxiliary tables haven't been dropped as yet. FTS auxiliary tables will not be flushed.' DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, f3 INT as (f1) VIRTUAL, INDEX(f3), @@ -43,3 +46,4 @@ t1 CREATE TABLE `t1` ( KEY `f4` (`f4`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/mysql-test/suite/innodb/t/import_hidden_fts.test b/mysql-test/suite/innodb/t/import_hidden_fts.test index 4129e258fe1..406f11f7642 100644 --- a/mysql-test/suite/innodb/t/import_hidden_fts.test +++ b/mysql-test/suite/innodb/t/import_hidden_fts.test @@ -1,5 +1,11 @@ --source include/have_innodb.inc --source include/have_sequence.inc + +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=ON; + # Table with virtual, fulltext, instant add, instant drop column # and purgeable rows call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); @@ -13,7 +19,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect(con1,localhost,root,,); +connect(block_purge,localhost,root,,); START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -26,6 +32,7 @@ ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, @@ -44,3 +51,5 @@ ALTER TABLE t1 IMPORT TABLESPACE; --enable_warnings SHOW CREATE TABLE t1; DROP TABLE t1; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 4d5f3592b5a..0be420147c0 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3335,7 +3335,9 @@ static dict_table_t *build_fts_hidden_table( new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t); } - new_index->search_info= old_index->search_info; +#ifdef BTR_CUR_HASH_ADAPT + new_index->search_info= btr_search_info_create(new_index->heap); +#endif /* BTR_CUR_HASH_ADAPT */ UT_LIST_ADD_LAST(new_index->table->indexes, new_index); old_index= UT_LIST_GET_NEXT(indexes, old_index); if (UT_LIST_GET_LEN(new_table->indexes) From 3723fd1573b465886abf18d8b95cd82b40d8d4ed Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 25 Sep 2024 11:06:11 +1000 Subject: [PATCH 181/185] MDEV-35007 mroonga should modify source files during build CMake rewriting the tests causes Mroonga to be un-buildable on build environments where there source directory is read only. In the test results, the version wasn't particularly important. Remove the version dependence of tests. --- .gitignore | 2 -- storage/mroonga/CMakeLists.txt | 8 -------- .../mroonga/storage/r/information_schema_plugins.result | 4 ++++ .../storage/r/information_schema_plugins.result.in | 4 ---- ...variable_version.result.in => variable_version.result} | 2 +- .../mroonga/storage/t/information_schema_plugins.test | 2 +- .../mysql-test/mroonga/storage/t/variable_version.test | 1 + 7 files changed, 7 insertions(+), 16 deletions(-) create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result delete mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in rename storage/mroonga/mysql-test/mroonga/storage/r/{variable_version.result.in => variable_version.result} (66%) diff --git a/.gitignore b/.gitignore index f67226125a9..27b32471c1e 100644 --- a/.gitignore +++ b/.gitignore @@ -307,8 +307,6 @@ storage/mroonga/vendor/groonga/src/grnslap storage/mroonga/vendor/groonga/src/groonga storage/mroonga/vendor/groonga/src/groonga-benchmark storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset -storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result -storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result zlib/zconf.h xxx/* yyy/* diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index fffcd80c971..11eec13d520 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -431,14 +431,6 @@ set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga") if(NOT EXISTS "${MRN_TEST_SUITE_DIR}") set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga") endif() -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result" - NEWLINE_STYLE LF) -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result" - NEWLINE_STYLE LF) configure_file( "${PROJECT_SOURCE_DIR}/data/install.sql.in" diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result new file mode 100644 index 00000000000..ef47d228da4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_TYPE +Mroonga STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in deleted file mode 100644 index f1020453183..00000000000 --- a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in +++ /dev/null @@ -1,4 +0,0 @@ -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE -from information_schema.plugins where plugin_name = "Mroonga"; -PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE -Mroonga @MRN_PLUGIN_VERSION@ STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result similarity index 66% rename from storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in rename to storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result index 26ff300a759..146f70e1df0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result @@ -1,3 +1,3 @@ show variables like 'mroonga_version'; Variable_name Value -mroonga_version @MRN_VERSION@ +mroonga_version # diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test index 2d65b763aac..2fc986a27ee 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -16,7 +16,7 @@ --source ../../include/mroonga/have_mroonga.inc -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +select PLUGIN_NAME, PLUGIN_TYPE from information_schema.plugins where plugin_name = "Mroonga"; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test index d9795eabdb6..848d800b5ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -17,6 +17,7 @@ --source ../../include/mroonga/have_mroonga.inc # show variables like 'groonga%'; +--replace_column 2 # show variables like 'mroonga_version'; --source ../../include/mroonga/have_mroonga_deinit.inc From 1f7898f6869fc0db486b453d644908b42e92d50b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 25 Sep 2024 11:09:09 +1000 Subject: [PATCH 182/185] mroonga: remove -Wunused-but-set-variable warnings There where unused variable. They were not conditional on defines, so removed them. Added an error handing in proc_object if there was no db as subsequent operations would have failed. --- storage/mroonga/vendor/groonga/lib/proc/proc_object.c | 6 ++++-- .../mroonga/vendor/groonga/plugins/functions/index_column.c | 3 +-- .../mroonga/vendor/groonga/plugins/query_expanders/tsv.c | 3 +-- storage/mroonga/vendor/groonga/plugins/suggest/suggest.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c index 380e65531a1..40eb2b51bb5 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c @@ -69,13 +69,15 @@ command_object_remove(grn_ctx *ctx, grn_obj **args, grn_user_data *user_data) { - grn_obj *db; grn_obj *name; grn_bool force; grn_obj *target; grn_bool failed_to_open; - db = grn_ctx_db(ctx); + if (!grn_ctx_db(ctx)) { + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "invalid db assigned"); + return NULL; + } name = grn_plugin_proc_get_var(ctx, user_data, "name", -1); force = grn_plugin_proc_get_var_bool(ctx, user_data, "force", -1, GRN_FALSE); diff --git a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c index 0501007471f..58764944d4f 100644 --- a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c +++ b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c @@ -91,8 +91,7 @@ selector_index_column_df_ratio_between(grn_ctx *ctx, df_ratio = (double)n_match_documents / (double)n_documents; { void *key; - int key_size; - key_size = grn_table_cursor_get_key(ctx, cursor, &key); + grn_table_cursor_get_key(ctx, cursor, &key); } if (min <= df_ratio && df_ratio <= max) { posting.rid = term_id; diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c index 5d5deec69c1..09d3803eddb 100644 --- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c +++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c @@ -196,7 +196,6 @@ load_synonyms(grn_ctx *ctx) const char *path; grn_file_reader *file_reader; int number_of_lines; - grn_encoding encoding; grn_obj line, key, value; grn_getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE", @@ -234,7 +233,7 @@ load_synonyms(grn_ctx *ctx) } number_of_lines++; if (number_of_lines == 1) { - encoding = guess_encoding(ctx, &line_value, &line_length); + guess_encoding(ctx, &line_value, &line_length); } GRN_BULK_REWIND(&key); GRN_BULK_REWIND(&value); diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c index 7f64f3c17d9..411000f7dbf 100644 --- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c +++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c @@ -653,7 +653,7 @@ learner_init(grn_ctx *ctx, grn_suggest_learner *learner, static void learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) { - grn_id events_id, event_types_id; + grn_id events_id; grn_obj *seqs, *events, *post_item, *items, *pairs; learner->seqs = seqs = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAIN(learner->seq)); @@ -665,7 +665,7 @@ learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) learner->events_type = grn_obj_column(ctx, events, CONST_STR_LEN("type")); learner->events_time = grn_obj_column(ctx, events, CONST_STR_LEN("time")); - event_types_id = grn_obj_get_range(ctx, learner->events_type); + grn_obj_get_range(ctx, learner->events_type); learner->event_types = grn_obj_column(ctx, events, CONST_STR_LEN("time")); post_item = learner->post_item; From 23debf214fff3b3f03cf98f6298d06f552d93b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Oct 2024 08:15:17 +0300 Subject: [PATCH 183/185] MDEV-28091 fixup: Fix another pfs_malloc() stub In commit 0f56e21efa68ba3b37d1171d001c21845c3d2b7d only one pfs_malloc() stub was fixed to return aligned memory. Also, the MSVC _aligned_malloc() pairs with _aligned_free(). --- storage/perfschema/unittest/stub_pfs_global.h | 7 +++++-- .../perfschema/unittest/stub_print_error.h | 20 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index 48a01ce5be2..22a87430e33 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -67,8 +67,11 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf) void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - free(ptr); +#ifdef HAVE_ALIGNED_MALLOC + _aligned_free(ptr); +#else + free(ptr); +#endif } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index a02e2478d27..026ac905569 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -23,12 +23,25 @@ #include #include #include +#ifdef HAVE_MEMALIGN +# include +#endif bool pfs_initialized= false; void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf flags) { +#ifndef PFS_ALIGNEMENT void *ptr= malloc(size); +#elif defined HAVE_MEMALIGN + void *ptr= memalign(PFS_ALIGNEMENT, size); +#elif defined HAVE_ALIGNED_MALLOC + void *ptr= _aligned_malloc(size, PFS_ALIGNEMENT); +#else + void *ptr; + if (posix_memalign(&ptr, PFS_ALIGNEMENT, size)) + ptr= NULL; +#endif if (ptr && (flags & MY_ZEROFILL)) memset(ptr, 0, size); return ptr; @@ -36,8 +49,11 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf flags) void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - free(ptr); +#ifdef HAVE_ALIGNED_MALLOC + _aligned_free(ptr); +#else + free(ptr); +#endif } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) From 170e4555e21dd04aefe9585d3cd0b8a40b77d2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Oct 2024 08:15:48 +0300 Subject: [PATCH 184/185] MDEV-35040: Fix std::unique deleter for clang++-20 -stdlib=libc++ Thanks to Khem Raj for reporting this. --- extra/mariabackup/backup_copy.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index f4c1b5bc83a..120555c0f1a 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -60,6 +60,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #ifdef _WIN32 #include /* rmdir */ #endif +#include #define ROCKSDB_BACKUP_DIR "#rocksdb" @@ -1851,7 +1852,7 @@ is_aria_log_dir_file(const datadir_node_t &node) bool copy_back_aria_logs(const char *dstdir) { - std::unique_ptr + std::unique_ptr> ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy); datadir_node_t node; From 6878c9d591607be6e6f330a0ca11e8ab06dff59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Oct 2024 10:40:58 +0300 Subject: [PATCH 185/185] MDEV-35050 fixup: ./mtr --embedded --- mysql-test/suite/plugins/t/fulltext_plugin.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/plugins/t/fulltext_plugin.test b/mysql-test/suite/plugins/t/fulltext_plugin.test index 8a3a9d62e9c..f6f6e169945 100644 --- a/mysql-test/suite/plugins/t/fulltext_plugin.test +++ b/mysql-test/suite/plugins/t/fulltext_plugin.test @@ -1,3 +1,4 @@ +--source include/not_embedded.inc --source include/have_simple_parser.inc --echo #