Commit ea4103d9 authored by Jan Lindström's avatar Jan Lindström

Add missing test files for new configuration variables.

Added a new functions to handler API to forcefully abort_transaction,
producing fake_trx_id, get_checkpoint and set_checkpoint for XA. These
were added for future possiblity to add more storage engines that
could use galera replication.
parent fe4f4672
#
# 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
#
# 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
#
# 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
--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
--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
--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
...@@ -6212,9 +6212,9 @@ void handler::set_lock_type(enum thr_lock_type lock) ...@@ -6212,9 +6212,9 @@ void handler::set_lock_type(enum thr_lock_type lock)
always 0 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) && if (!WSREP(bf_thd) &&
!(wsrep_OSU_method_options == WSREP_OSU_RSU && !(wsrep_OSU_method_options == WSREP_OSU_RSU &&
bf_thd->wsrep_exec_mode == TOTAL_ORDER)) { 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) ...@@ -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) for (; ha_info; ha_info= ha_info_next)
{ {
handlerton *hton= ha_info->ht(); 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 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_next= ha_info->next();
ha_info->reset(); /* keep it conveniently zero-filled */ ha_info->reset(); /* keep it conveniently zero-filled */
} }
DBUG_RETURN(0); 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)) if (!WSREP(thd))
{ {
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -6253,12 +6253,12 @@ void ha_wsrep_fake_trx_id(THD *thd) ...@@ -6253,12 +6253,12 @@ void ha_wsrep_fake_trx_id(THD *thd)
for (; ha_info; ha_info= ha_info_next) for (; ha_info; ha_info= ha_info_next)
{ {
handlerton *hton= ha_info->ht(); handlerton *hton= ha_info->ht();
if (!hton->wsrep_fake_trx_id) if (!hton->fake_trx_id)
{ {
WSREP_WARN("cannot get fake InnoDB transaction ID"); WSREP_WARN("cannot get fake InnoDB transaction ID");
} }
else else
hton->wsrep_fake_trx_id(hton, thd); hton->fake_trx_id(hton, thd);
ha_info_next= ha_info->next(); ha_info_next= ha_info->next();
ha_info->reset(); /* keep it conveniently zero-filled */ ha_info->reset(); /* keep it conveniently zero-filled */
} }
......
...@@ -1230,13 +1230,11 @@ struct handlerton ...@@ -1230,13 +1230,11 @@ struct handlerton
enum handler_create_iterator_result enum handler_create_iterator_result
(*create_iterator)(handlerton *hton, enum handler_iterator_type type, (*create_iterator)(handlerton *hton, enum handler_iterator_type type,
struct handler_iterator *fill_this_in); struct handler_iterator *fill_this_in);
#ifdef WITH_WSREP int (*abort_transaction)(handlerton *hton, THD *bf_thd,
int (*wsrep_abort_transaction)(handlerton *hton, THD *bf_thd, THD *victim_thd, my_bool signal);
THD *victim_thd, my_bool signal); int (*set_checkpoint)(handlerton *hton, const XID* xid);
int (*wsrep_set_checkpoint)(handlerton *hton, const XID* xid); int (*get_checkpoint)(handlerton *hton, XID* xid);
int (*wsrep_get_checkpoint)(handlerton *hton, XID* xid); void (*fake_trx_id)(handlerton *hton, THD *thd);
void (*wsrep_fake_trx_id)(handlerton *hton, THD *thd);
#endif /* WITH_WSREP */
/* /*
Optional clauses in the CREATE/ALTER TABLE Optional clauses in the CREATE/ALTER TABLE
*/ */
...@@ -4091,8 +4089,8 @@ bool ha_rollback_to_savepoint_can_release_mdl(THD *thd); ...@@ -4091,8 +4089,8 @@ bool ha_rollback_to_savepoint_can_release_mdl(THD *thd);
int ha_savepoint(THD *thd, SAVEPOINT *sv); int ha_savepoint(THD *thd, SAVEPOINT *sv);
int ha_release_savepoint(THD *thd, SAVEPOINT *sv); int ha_release_savepoint(THD *thd, SAVEPOINT *sv);
#ifdef WITH_WSREP #ifdef WITH_WSREP
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);
void ha_wsrep_fake_trx_id(THD *thd); void ha_fake_trx_id(THD *thd);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* these are called by storage engines */ /* these are called by storage engines */
......
...@@ -4194,7 +4194,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) ...@@ -4194,7 +4194,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
errcode); errcode);
} }
IF_WSREP(ha_wsrep_fake_trx_id(thd), ); IF_WSREP(ha_fake_trx_id(thd), );
return result; return result;
} }
......
...@@ -176,14 +176,14 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) ...@@ -176,14 +176,14 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
{ {
XID* xid= reinterpret_cast<XID*>(arg); XID* xid= reinterpret_cast<XID*>(arg);
handlerton* hton= plugin_data(plugin, handlerton *); 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)); const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
char uuid_str[40] = {0, }; char uuid_str[40] = {0, };
wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld",
uuid_str, (long long)wsrep_xid_seqno(xid)); uuid_str, (long long)wsrep_xid_seqno(xid));
hton->wsrep_set_checkpoint(hton, xid); hton->set_checkpoint(hton, xid);
} }
return FALSE; return FALSE;
} }
...@@ -197,15 +197,14 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) ...@@ -197,15 +197,14 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
{ {
XID* xid= reinterpret_cast<XID*>(arg); XID* xid= reinterpret_cast<XID*>(arg);
handlerton* hton= plugin_data(plugin, handlerton *); 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)); const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
char uuid_str[40] = {0, }; char uuid_str[40] = {0, };
wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld",
uuid_str, (long long)wsrep_xid_seqno(xid)); uuid_str, (long long)wsrep_xid_seqno(xid));
} }
return FALSE; return FALSE;
} }
......
...@@ -581,7 +581,7 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal) ...@@ -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) ? WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
(long long)bf_thd->real_id : 0, (long long)victim_thd->real_id); (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 else
{ {
......
...@@ -3018,10 +3018,10 @@ innobase_init( ...@@ -3018,10 +3018,10 @@ innobase_init(
innobase_hton->release_temporary_latches = innobase_hton->release_temporary_latches =
innobase_release_temporary_latches; innobase_release_temporary_latches;
#ifdef WITH_WSREP #ifdef WITH_WSREP
innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; innobase_hton->abort_transaction=wsrep_abort_transaction;
innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; innobase_hton->fake_trx_id=wsrep_fake_trx_id;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
innobase_hton->kill_query = innobase_kill_query; innobase_hton->kill_query = innobase_kill_query;
...@@ -9830,7 +9830,6 @@ ha_innobase::wsrep_append_keys( ...@@ -9830,7 +9830,6 @@ ha_innobase::wsrep_append_keys(
uint len; uint len;
char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
char *key = &keyval[0]; char *key = &keyval[0];
KEY *key_info = table->key_info;
ibool is_null; ibool is_null;
len = wsrep_store_key_val_for_row( len = wsrep_store_key_val_for_row(
......
...@@ -3373,10 +3373,10 @@ innobase_init( ...@@ -3373,10 +3373,10 @@ innobase_init(
innobase_hton->table_options = innodb_table_option_list; innobase_hton->table_options = innodb_table_option_list;
#ifdef WITH_WSREP #ifdef WITH_WSREP
innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; innobase_hton->abort_transaction=wsrep_abort_transaction;
innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; innobase_hton->set_checkpoint=innobase_wsrep_set_checkpoint;
innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; innobase_hton->fake_trx_id=wsrep_fake_trx_id;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment