diff --git a/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result b/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result new file mode 100644 index 00000000000..bfb6b67b5d8 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_disallow_writes_basic.result @@ -0,0 +1,45 @@ +# +# innodb_disallow_writes +# +# save the initial value +SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes; +# default +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +0 + +# scope +SELECT @@session.innodb_disallow_writes; +ERROR HY000: Variable 'innodb_disallow_writes' is a GLOBAL variable +SET @@global.innodb_disallow_writes=OFF; +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +0 +SET @@global.innodb_disallow_writes=ON; +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +1 + +# valid values +SET @@global.innodb_disallow_writes='OFF'; +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +0 +SET @@global.innodb_disallow_writes=ON; +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +1 +SET @@global.innodb_disallow_writes=default; +SELECT @@global.innodb_disallow_writes; +@@global.innodb_disallow_writes +0 + +# invalid values +SET @@global.innodb_disallow_writes=NULL; +ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'NULL' +SET @@global.innodb_disallow_writes='junk'; +ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_slave_fk_checks_basic.result b/mysql-test/suite/sys_vars/r/wsrep_slave_fk_checks_basic.result new file mode 100644 index 00000000000..40b3270e221 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/wsrep_slave_fk_checks_basic.result @@ -0,0 +1,45 @@ +# +# wsrep_slave_fk_checks +# +# save the initial value +SET @wsrep_slave_fk_checks_global_saved = @@global.wsrep_slave_fk_checks; +# default +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +1 + +# scope +SELECT @@session.wsrep_slave_fk_checks; +ERROR HY000: Variable 'wsrep_slave_FK_checks' is a GLOBAL variable +SET @@global.wsrep_slave_fk_checks=OFF; +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +0 +SET @@global.wsrep_slave_fk_checks=ON; +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +1 + +# valid values +SET @@global.wsrep_slave_fk_checks='OFF'; +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +0 +SET @@global.wsrep_slave_fk_checks=ON; +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +1 +SET @@global.wsrep_slave_fk_checks=default; +SELECT @@global.wsrep_slave_fk_checks; +@@global.wsrep_slave_fk_checks +1 + +# invalid values +SET @@global.wsrep_slave_fk_checks=NULL; +ERROR 42000: Variable 'wsrep_slave_FK_checks' can't be set to the value of 'NULL' +SET @@global.wsrep_slave_fk_checks='junk'; +ERROR 42000: Variable 'wsrep_slave_FK_checks' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_slave_fk_checks = @wsrep_slave_fk_checks_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_slave_uk_checks_basic.result b/mysql-test/suite/sys_vars/r/wsrep_slave_uk_checks_basic.result new file mode 100644 index 00000000000..b78a83b547d --- /dev/null +++ b/mysql-test/suite/sys_vars/r/wsrep_slave_uk_checks_basic.result @@ -0,0 +1,45 @@ +# +# wsrep_slave_uk_checks +# +# save the initial value +SET @wsrep_slave_uk_checks_global_saved = @@global.wsrep_slave_uk_checks; +# default +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +0 + +# scope +SELECT @@session.wsrep_slave_uk_checks; +ERROR HY000: Variable 'wsrep_slave_UK_checks' is a GLOBAL variable +SET @@global.wsrep_slave_uk_checks=OFF; +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +0 +SET @@global.wsrep_slave_uk_checks=ON; +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +1 + +# valid values +SET @@global.wsrep_slave_uk_checks='OFF'; +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +0 +SET @@global.wsrep_slave_uk_checks=ON; +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +1 +SET @@global.wsrep_slave_uk_checks=default; +SELECT @@global.wsrep_slave_uk_checks; +@@global.wsrep_slave_uk_checks +0 + +# invalid values +SET @@global.wsrep_slave_uk_checks=NULL; +ERROR 42000: Variable 'wsrep_slave_UK_checks' can't be set to the value of 'NULL' +SET @@global.wsrep_slave_uk_checks='junk'; +ERROR 42000: Variable 'wsrep_slave_UK_checks' can't be set to the value of 'junk' + +# restore the initial value +SET @@global.wsrep_slave_uk_checks = @wsrep_slave_uk_checks_global_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test new file mode 100644 index 00000000000..b8e5c127377 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_disallow_writes_basic.test @@ -0,0 +1,42 @@ +--source include/have_innodb_disallow_writes.inc + +--echo # +--echo # innodb_disallow_writes +--echo # + +--echo # save the initial value +SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes; + +--echo # default +SELECT @@global.innodb_disallow_writes; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.innodb_disallow_writes; +SET @@global.innodb_disallow_writes=OFF; +SELECT @@global.innodb_disallow_writes; +SET @@global.innodb_disallow_writes=ON; +SELECT @@global.innodb_disallow_writes; + +--echo +--echo # valid values +SET @@global.innodb_disallow_writes='OFF'; +SELECT @@global.innodb_disallow_writes; +SET @@global.innodb_disallow_writes=ON; +SELECT @@global.innodb_disallow_writes; +SET @@global.innodb_disallow_writes=default; +SELECT @@global.innodb_disallow_writes; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_disallow_writes=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_disallow_writes='junk'; + +--echo +--echo # restore the initial value +SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test b/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test new file mode 100644 index 00000000000..dd60eb8694b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test @@ -0,0 +1,42 @@ +--source include/have_wsrep.inc + +--echo # +--echo # wsrep_slave_fk_checks +--echo # + +--echo # save the initial value +SET @wsrep_slave_fk_checks_global_saved = @@global.wsrep_slave_fk_checks; + +--echo # default +SELECT @@global.wsrep_slave_fk_checks; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_slave_fk_checks; +SET @@global.wsrep_slave_fk_checks=OFF; +SELECT @@global.wsrep_slave_fk_checks; +SET @@global.wsrep_slave_fk_checks=ON; +SELECT @@global.wsrep_slave_fk_checks; + +--echo +--echo # valid values +SET @@global.wsrep_slave_fk_checks='OFF'; +SELECT @@global.wsrep_slave_fk_checks; +SET @@global.wsrep_slave_fk_checks=ON; +SELECT @@global.wsrep_slave_fk_checks; +SET @@global.wsrep_slave_fk_checks=default; +SELECT @@global.wsrep_slave_fk_checks; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_slave_fk_checks=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_slave_fk_checks='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_slave_fk_checks = @wsrep_slave_fk_checks_global_saved; + +--echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test b/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test new file mode 100644 index 00000000000..c9012954371 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test @@ -0,0 +1,42 @@ +--source include/have_wsrep.inc + +--echo # +--echo # wsrep_slave_uk_checks +--echo # + +--echo # save the initial value +SET @wsrep_slave_uk_checks_global_saved = @@global.wsrep_slave_uk_checks; + +--echo # default +SELECT @@global.wsrep_slave_uk_checks; + +--echo +--echo # scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_slave_uk_checks; +SET @@global.wsrep_slave_uk_checks=OFF; +SELECT @@global.wsrep_slave_uk_checks; +SET @@global.wsrep_slave_uk_checks=ON; +SELECT @@global.wsrep_slave_uk_checks; + +--echo +--echo # valid values +SET @@global.wsrep_slave_uk_checks='OFF'; +SELECT @@global.wsrep_slave_uk_checks; +SET @@global.wsrep_slave_uk_checks=ON; +SELECT @@global.wsrep_slave_uk_checks; +SET @@global.wsrep_slave_uk_checks=default; +SELECT @@global.wsrep_slave_uk_checks; + +--echo +--echo # invalid values +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_slave_uk_checks=NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.wsrep_slave_uk_checks='junk'; + +--echo +--echo # restore the initial value +SET @@global.wsrep_slave_uk_checks = @wsrep_slave_uk_checks_global_saved; + +--echo # End of test diff --git a/sql/handler.cc b/sql/handler.cc index e8c3a823a41..63ddb9c6d6e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6212,9 +6212,9 @@ void handler::set_lock_type(enum thr_lock_type lock) always 0 */ -int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) +int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) { - DBUG_ENTER("ha_wsrep_abort_transaction"); + DBUG_ENTER("ha_abort_transaction"); if (!WSREP(bf_thd) && !(wsrep_OSU_method_options == WSREP_OSU_RSU && bf_thd->wsrep_exec_mode == TOTAL_ORDER)) { @@ -6227,21 +6227,21 @@ int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) for (; ha_info; ha_info= ha_info_next) { handlerton *hton= ha_info->ht(); - if (!hton->wsrep_abort_transaction) + if (!hton->abort_transaction) { - WSREP_WARN("cannot abort WRESP transaction"); + WSREP_WARN("cannot abort transaction"); } else - hton->wsrep_abort_transaction(hton, bf_thd, victim_thd, signal); + hton->abort_transaction(hton, bf_thd, victim_thd, signal); ha_info_next= ha_info->next(); ha_info->reset(); /* keep it conveniently zero-filled */ } DBUG_RETURN(0); } -void ha_wsrep_fake_trx_id(THD *thd) +void ha_fake_trx_id(THD *thd) { - DBUG_ENTER("ha_wsrep_fake_trx_id"); + DBUG_ENTER("ha_fake_trx_id"); if (!WSREP(thd)) { DBUG_VOID_RETURN; @@ -6253,12 +6253,12 @@ void ha_wsrep_fake_trx_id(THD *thd) for (; ha_info; ha_info= ha_info_next) { handlerton *hton= ha_info->ht(); - if (!hton->wsrep_fake_trx_id) + if (!hton->fake_trx_id) { WSREP_WARN("cannot get fake InnoDB transaction ID"); } else - hton->wsrep_fake_trx_id(hton, thd); + hton->fake_trx_id(hton, thd); ha_info_next= ha_info->next(); ha_info->reset(); /* keep it conveniently zero-filled */ } diff --git a/sql/handler.h b/sql/handler.h index 9622cef3a11..169ed209403 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1230,13 +1230,11 @@ struct handlerton enum handler_create_iterator_result (*create_iterator)(handlerton *hton, enum handler_iterator_type type, struct handler_iterator *fill_this_in); -#ifdef WITH_WSREP - int (*wsrep_abort_transaction)(handlerton *hton, THD *bf_thd, - THD *victim_thd, my_bool signal); - int (*wsrep_set_checkpoint)(handlerton *hton, const XID* xid); - int (*wsrep_get_checkpoint)(handlerton *hton, XID* xid); - void (*wsrep_fake_trx_id)(handlerton *hton, THD *thd); -#endif /* WITH_WSREP */ + int (*abort_transaction)(handlerton *hton, THD *bf_thd, + THD *victim_thd, my_bool signal); + int (*set_checkpoint)(handlerton *hton, const XID* xid); + int (*get_checkpoint)(handlerton *hton, XID* xid); + void (*fake_trx_id)(handlerton *hton, THD *thd); /* Optional clauses in the CREATE/ALTER TABLE */ @@ -4091,8 +4089,8 @@ bool ha_rollback_to_savepoint_can_release_mdl(THD *thd); int ha_savepoint(THD *thd, SAVEPOINT *sv); int ha_release_savepoint(THD *thd, SAVEPOINT *sv); #ifdef WITH_WSREP -int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal); -void ha_wsrep_fake_trx_id(THD *thd); +int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal); +void ha_fake_trx_id(THD *thd); #endif /* WITH_WSREP */ /* these are called by storage engines */ diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5ee341435cf..f90e9cd2439 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4194,7 +4194,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) errcode); } - IF_WSREP(ha_wsrep_fake_trx_id(thd), ); + IF_WSREP(ha_fake_trx_id(thd), ); return result; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index a8157082038..c1b15bd02c2 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -176,14 +176,14 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) { XID* xid= reinterpret_cast(arg); handlerton* hton= plugin_data(plugin, handlerton *); - if (hton->db_type == DB_TYPE_INNODB) + if (hton->set_checkpoint) { const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); char uuid_str[40] = {0, }; wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", uuid_str, (long long)wsrep_xid_seqno(xid)); - hton->wsrep_set_checkpoint(hton, xid); + hton->set_checkpoint(hton, xid); } return FALSE; } @@ -197,15 +197,14 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) { XID* xid= reinterpret_cast(arg); handlerton* hton= plugin_data(plugin, handlerton *); - if (hton->db_type == DB_TYPE_INNODB) + if (hton->get_checkpoint) { - hton->wsrep_get_checkpoint(hton, xid); + hton->get_checkpoint(hton, xid); const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); char uuid_str[40] = {0, }; wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", uuid_str, (long long)wsrep_xid_seqno(xid)); - } return FALSE; } diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 6fc91c9fa31..fabced2d11a 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -581,7 +581,7 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal) { WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ? (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id); - ha_wsrep_abort_transaction(bf_thd, victim_thd, signal); + ha_abort_transaction(bf_thd, victim_thd, signal); } else { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a5a0616dc63..970127a7420 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3018,10 +3018,10 @@ innobase_init( innobase_hton->release_temporary_latches = innobase_release_temporary_latches; #ifdef WITH_WSREP - innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; - innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; - innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; - innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; + innobase_hton->abort_transaction=wsrep_abort_transaction; + innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint; + innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint; + innobase_hton->fake_trx_id=wsrep_fake_trx_id; #endif /* WITH_WSREP */ innobase_hton->kill_query = innobase_kill_query; @@ -9830,7 +9830,6 @@ ha_innobase::wsrep_append_keys( uint len; char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; char *key = &keyval[0]; - KEY *key_info = table->key_info; ibool is_null; len = wsrep_store_key_val_for_row( diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 91322b91aa6..4c4bccd15e1 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -3373,10 +3373,10 @@ innobase_init( innobase_hton->table_options = innodb_table_option_list; #ifdef WITH_WSREP - innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; - innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; - innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; - innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; + innobase_hton->abort_transaction=wsrep_abort_transaction; + innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint; + innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint; + innobase_hton->fake_trx_id=wsrep_fake_trx_id; #endif /* WITH_WSREP */ ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);