diff --git a/mysql-test/r/information_schema_ci.result b/mysql-test/r/information_schema_ci.result index ec0b0dc0b94..bf0e94a5502 100644 --- a/mysql-test/r/information_schema_ci.result +++ b/mysql-test/r/information_schema_ci.result @@ -2886,7 +2886,7 @@ SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; TABLE_NAME CREATE_OPTIONS -t1 SECONDARY_ENGINE="myisam" +t1 SECONDARY_ENGINE="myisam" SECONDARY_LOAD="0" DROP TABLE t1; CREATE TABLE t1 (f1 INT); SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES @@ -2897,7 +2897,7 @@ ALTER TABLE t1 SECONDARY_ENGINE=myisam; SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; TABLE_NAME CREATE_OPTIONS -t1 SECONDARY_ENGINE="myisam" +t1 SECONDARY_ENGINE="myisam" SECONDARY_LOAD="0" DROP TABLE t1; # # BUG#29406053: OPTIMIZER_SWITCH DERIVED_MERGE=OFF CAUSES TABLE COMMENTS diff --git a/mysql-test/r/information_schema_cs.result b/mysql-test/r/information_schema_cs.result index ea398822136..2960412ddb6 100644 --- a/mysql-test/r/information_schema_cs.result +++ b/mysql-test/r/information_schema_cs.result @@ -2886,7 +2886,7 @@ SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; TABLE_NAME CREATE_OPTIONS -t1 SECONDARY_ENGINE="myisam" +t1 SECONDARY_ENGINE="myisam" SECONDARY_LOAD="0" DROP TABLE t1; CREATE TABLE t1 (f1 INT); SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES @@ -2897,7 +2897,7 @@ ALTER TABLE t1 SECONDARY_ENGINE=myisam; SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; TABLE_NAME CREATE_OPTIONS -t1 SECONDARY_ENGINE="myisam" +t1 SECONDARY_ENGINE="myisam" SECONDARY_LOAD="0" DROP TABLE t1; # # BUG#29406053: OPTIMIZER_SWITCH DERIVED_MERGE=OFF CAUSES TABLE COMMENTS diff --git a/sql/dd/cache/dictionary_client.h b/sql/dd/cache/dictionary_client.h index 0b826c22e70..36695d98d33 100644 --- a/sql/dd/cache/dictionary_client.h +++ b/sql/dd/cache/dictionary_client.h @@ -1199,7 +1199,7 @@ class Dictionary_client { verifying that an object with the same id already exists. The old object, which may be present in the shared dictionary cache, is not modified. To make the changes visible in the shared cache, please call - remove_uncommuitted_objects(). + remove_uncommitted_objects(). @note A precondition is that the object has been acquired from the shared cache indirectly by acquire_for_modification(). For storing diff --git a/sql/dd/dd_table.cc b/sql/dd/dd_table.cc index baf168c9963..ea52c1a263a 100644 --- a/sql/dd/dd_table.cc +++ b/sql/dd/dd_table.cc @@ -2136,10 +2136,12 @@ static bool fill_dd_table_from_create_info( assert(create_info->default_table_charset); tab_obj->set_collation_id(create_info->default_table_charset->number); - // Secondary engine. - if (create_info->secondary_engine.str != nullptr) + // Secondary engine and secondary load. + if (create_info->secondary_engine.str != nullptr) { table_options->set("secondary_engine", make_string_type(create_info->secondary_engine)); + table_options->set("secondary_load", false); + } tab_obj->set_engine_attribute(create_info->engine_attribute); tab_obj->set_secondary_engine_attribute( diff --git a/sql/dd/impl/types/abstract_table_impl.cc b/sql/dd/impl/types/abstract_table_impl.cc index 8a5de5d8727..ea8ec195d16 100644 --- a/sql/dd/impl/types/abstract_table_impl.cc +++ b/sql/dd/impl/types/abstract_table_impl.cc @@ -78,6 +78,7 @@ static const std::set default_valid_option_keys = { "plugin_version", "row_type", "secondary_engine", + "secondary_load", "server_i_s_table", "server_p_s_table", "stats_auto_recalc", diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0ad8f1a1566..3907900ddbf 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4620,6 +4620,16 @@ String *Item_func_get_dd_create_options::val_str(String *str) { } } + if (p->exists("secondary_load")) { + dd::String_type opt_value; + p->get("secondary_load", &opt_value); + if (!opt_value.empty()) { + ptr = my_stpcpy(ptr, " SECONDARY_LOAD=\""); + ptr = my_stpcpy(ptr, opt_value.c_str()); + ptr = my_stpcpy(ptr, "\""); + } + } + if (ptr == option_buff) oss << ""; else diff --git a/sql/mysqld.h b/sql/mysqld.h index 20eaab6a294..c6f9fcc58ca 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -158,7 +158,7 @@ extern CHARSET_INFO *character_set_filesystem; enum enum_server_operational_state { SERVER_BOOTING, /* Server is not operational. It is starting */ SERVER_OPERATING, /* Server is fully initialized and operating */ - SERVER_SHUTTING_DOWN /* erver is shutting down */ + SERVER_SHUTTING_DOWN /* Server is shutting down */ }; enum_server_operational_state get_server_state(); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ca26918b0c0..5f440deb674 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11464,9 +11464,9 @@ bool Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload( hton->post_ddl != nullptr); dd::cache::Dictionary_client::Auto_releaser releaser(thd->dd_client()); - const dd::Table *table_def = nullptr; - if (thd->dd_client()->acquire(table_list->db, table_list->table_name, - &table_def)) + dd::Table *table_def = nullptr; + if (thd->dd_client()->acquire_for_modification( + table_list->db, table_list->table_name, &table_def)) return true; // Cleanup that must be done regardless of commit or rollback. @@ -11514,6 +11514,11 @@ bool Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload( thd->variables.lock_wait_timeout)) return true; + // Update the secondary_load flag based on the current operation. + if (table_def->options().set("secondary_load", is_load) || + thd->dd_client()->update(table_def)) + return true; + // Close primary table. close_all_tables_for_name(thd, table_list->table->s, false, nullptr); table_list->table = nullptr;