diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_delete.cc | 10 | ||||
-rw-r--r-- | sql/sql_update.cc | 11 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 3 | ||||
-rw-r--r-- | sql/wsrep_schema.cc | 48 |
4 files changed, 59 insertions, 13 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 1966a77aa3e..7e053e60fdf 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -620,14 +620,18 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (!table->check_virtual_columns_marked_for_read()) { DBUG_PRINT("info", ("Trying direct delete")); - if (select && select->cond && - (select->cond->used_tables() == table->map)) + bool use_direct_delete= !select || !select->cond; + if (!use_direct_delete && + (select->cond->used_tables() & ~RAND_TABLE_BIT) == table->map) { DBUG_ASSERT(!table->file->pushed_cond); if (!table->file->cond_push(select->cond)) + { + use_direct_delete= TRUE; table->file->pushed_cond= select->cond; + } } - if (!table->file->direct_delete_rows_init()) + if (use_direct_delete && !table->file->direct_delete_rows_init()) { /* Direct deleting is supported */ DBUG_PRINT("info", ("Using direct delete")); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 977e459f9df..624c183c83b 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -754,15 +754,20 @@ int mysql_update(THD *thd, !table->check_virtual_columns_marked_for_write()) { DBUG_PRINT("info", ("Trying direct update")); - if (select && select->cond && - (select->cond->used_tables() == table->map)) + bool use_direct_update= !select || !select->cond; + if (!use_direct_update && + (select->cond->used_tables() & ~RAND_TABLE_BIT) == table->map) { DBUG_ASSERT(!table->file->pushed_cond); if (!table->file->cond_push(select->cond)) + { + use_direct_update= TRUE; table->file->pushed_cond= select->cond; + } } - if (!table->file->info_push(INFO_KIND_UPDATE_FIELDS, &fields) && + if (use_direct_update && + !table->file->info_push(INFO_KIND_UPDATE_FIELDS, &fields) && !table->file->info_push(INFO_KIND_UPDATE_VALUES, &values) && !table->file->direct_update_rows_init(&fields)) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d2fc4273f49..7d73bc97ea4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -74,6 +74,9 @@ /* warning C4065: switch statement contains 'default' but no 'case' labels */ #pragma warning (disable : 4065) #endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */ +#endif int yylex(void *yylval, void *yythd); diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 0df1b527afe..252f41cb380 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2019 Codership Oy <info@codership.com> +/* Copyright (C) 2015-2021 Codership Oy <info@codership.com> 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 @@ -54,7 +54,7 @@ static const std::string create_cluster_table_str= "view_seqno BIGINT NOT NULL," "protocol_version INT NOT NULL," "capabilities INT NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; static const std::string create_members_table_str= "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + members_table_str + @@ -63,7 +63,7 @@ static const std::string create_members_table_str= "cluster_uuid CHAR(36) NOT NULL," "node_name CHAR(32) NOT NULL," "node_incoming_address VARCHAR(256) NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; #ifdef WSREP_SCHEMA_MEMBERS_HISTORY static const std::string cluster_member_history_table_str= "wsrep_cluster_member_history"; @@ -76,7 +76,7 @@ static const std::string create_members_history_table_str= "last_view_seqno BIGINT NOT NULL," "node_name CHAR(32) NOT NULL," "node_incoming_address VARCHAR(256) NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ static const std::string create_frag_table_str= @@ -88,7 +88,7 @@ static const std::string create_frag_table_str= "flags INT NOT NULL, " "frag LONGBLOB NOT NULL, " "PRIMARY KEY (node_uuid, trx_id, seqno)" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; static const std::string delete_from_cluster_table= "DELETE FROM " + wsrep_schema_str + "." + cluster_table_str; @@ -96,6 +96,26 @@ static const std::string delete_from_cluster_table= static const std::string delete_from_members_table= "DELETE FROM " + wsrep_schema_str + "." + members_table_str; +/* For rolling upgrade we need to use ALTER. We do not want +persistent statistics to be collected from these tables. */ +static const std::string alter_cluster_table= + "ALTER TABLE " + wsrep_schema_str + "." + cluster_table_str + + " STATS_PERSISTENT=0"; + +static const std::string alter_members_table= + "ALTER TABLE " + wsrep_schema_str + "." + members_table_str + + " STATS_PERSISTENT=0"; + +#ifdef WSREP_SCHEMA_MEMBERS_HISTORY +static const std::string alter_members_history_table= + "ALTER TABLE " + wsrep_schema_str + "." + members_history_table_str + + " STATS_PERSISTENT=0"; +#endif + +static const std::string alter_frag_table= + "ALTER TABLE " + wsrep_schema_str + "." + sr_table_str + + " STATS_PERSISTENT=0"; + namespace Wsrep_schema_impl { @@ -675,13 +695,27 @@ int Wsrep_schema::init() Wsrep_schema_impl::execute_SQL(thd, create_members_history_table_str.c_str(), create_members_history_table_str.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_members_history_table.c_str(), + alter_members_history_table.size()) || #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ Wsrep_schema_impl::execute_SQL(thd, create_frag_table_str.c_str(), - create_frag_table_str.size())) { + create_frag_table_str.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_cluster_table.c_str(), + alter_cluster_table.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_members_table.c_str(), + alter_members_table.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_frag_table.c_str(), + alter_frag_table.size())) + { ret= 1; } - else { + else + { ret= 0; } |