mirror of
https://github.com/MariaDB/server.git
synced 2025-04-16 20:25:33 +02:00
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.
This commit is contained in:
parent
fe4f467276
commit
ea4103d94d
13 changed files with 291 additions and 34 deletions
mysql-test/suite/sys_vars
r
innodb_disallow_writes_basic.resultwsrep_slave_fk_checks_basic.resultwsrep_slave_uk_checks_basic.result
t
sql
storage
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
42
mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test
Normal file
42
mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test
Normal file
|
@ -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
|
42
mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test
Normal file
42
mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test
Normal file
|
@ -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
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -176,14 +176,14 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
|
|||
{
|
||||
XID* xid= reinterpret_cast<XID*>(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<XID*>(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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue