Skip to content

Commit ea4103d

Browse files
author
Jan Lindström
committed
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.
1 parent fe4f467 commit ea4103d

13 files changed

+291
-34
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# innodb_disallow_writes
3+
#
4+
# save the initial value
5+
SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes;
6+
# default
7+
SELECT @@global.innodb_disallow_writes;
8+
@@global.innodb_disallow_writes
9+
0
10+
11+
# scope
12+
SELECT @@session.innodb_disallow_writes;
13+
ERROR HY000: Variable 'innodb_disallow_writes' is a GLOBAL variable
14+
SET @@global.innodb_disallow_writes=OFF;
15+
SELECT @@global.innodb_disallow_writes;
16+
@@global.innodb_disallow_writes
17+
0
18+
SET @@global.innodb_disallow_writes=ON;
19+
SELECT @@global.innodb_disallow_writes;
20+
@@global.innodb_disallow_writes
21+
1
22+
23+
# valid values
24+
SET @@global.innodb_disallow_writes='OFF';
25+
SELECT @@global.innodb_disallow_writes;
26+
@@global.innodb_disallow_writes
27+
0
28+
SET @@global.innodb_disallow_writes=ON;
29+
SELECT @@global.innodb_disallow_writes;
30+
@@global.innodb_disallow_writes
31+
1
32+
SET @@global.innodb_disallow_writes=default;
33+
SELECT @@global.innodb_disallow_writes;
34+
@@global.innodb_disallow_writes
35+
0
36+
37+
# invalid values
38+
SET @@global.innodb_disallow_writes=NULL;
39+
ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'NULL'
40+
SET @@global.innodb_disallow_writes='junk';
41+
ERROR 42000: Variable 'innodb_disallow_writes' can't be set to the value of 'junk'
42+
43+
# restore the initial value
44+
SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved;
45+
# End of test
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# wsrep_slave_fk_checks
3+
#
4+
# save the initial value
5+
SET @wsrep_slave_fk_checks_global_saved = @@global.wsrep_slave_fk_checks;
6+
# default
7+
SELECT @@global.wsrep_slave_fk_checks;
8+
@@global.wsrep_slave_fk_checks
9+
1
10+
11+
# scope
12+
SELECT @@session.wsrep_slave_fk_checks;
13+
ERROR HY000: Variable 'wsrep_slave_FK_checks' is a GLOBAL variable
14+
SET @@global.wsrep_slave_fk_checks=OFF;
15+
SELECT @@global.wsrep_slave_fk_checks;
16+
@@global.wsrep_slave_fk_checks
17+
0
18+
SET @@global.wsrep_slave_fk_checks=ON;
19+
SELECT @@global.wsrep_slave_fk_checks;
20+
@@global.wsrep_slave_fk_checks
21+
1
22+
23+
# valid values
24+
SET @@global.wsrep_slave_fk_checks='OFF';
25+
SELECT @@global.wsrep_slave_fk_checks;
26+
@@global.wsrep_slave_fk_checks
27+
0
28+
SET @@global.wsrep_slave_fk_checks=ON;
29+
SELECT @@global.wsrep_slave_fk_checks;
30+
@@global.wsrep_slave_fk_checks
31+
1
32+
SET @@global.wsrep_slave_fk_checks=default;
33+
SELECT @@global.wsrep_slave_fk_checks;
34+
@@global.wsrep_slave_fk_checks
35+
1
36+
37+
# invalid values
38+
SET @@global.wsrep_slave_fk_checks=NULL;
39+
ERROR 42000: Variable 'wsrep_slave_FK_checks' can't be set to the value of 'NULL'
40+
SET @@global.wsrep_slave_fk_checks='junk';
41+
ERROR 42000: Variable 'wsrep_slave_FK_checks' can't be set to the value of 'junk'
42+
43+
# restore the initial value
44+
SET @@global.wsrep_slave_fk_checks = @wsrep_slave_fk_checks_global_saved;
45+
# End of test
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# wsrep_slave_uk_checks
3+
#
4+
# save the initial value
5+
SET @wsrep_slave_uk_checks_global_saved = @@global.wsrep_slave_uk_checks;
6+
# default
7+
SELECT @@global.wsrep_slave_uk_checks;
8+
@@global.wsrep_slave_uk_checks
9+
0
10+
11+
# scope
12+
SELECT @@session.wsrep_slave_uk_checks;
13+
ERROR HY000: Variable 'wsrep_slave_UK_checks' is a GLOBAL variable
14+
SET @@global.wsrep_slave_uk_checks=OFF;
15+
SELECT @@global.wsrep_slave_uk_checks;
16+
@@global.wsrep_slave_uk_checks
17+
0
18+
SET @@global.wsrep_slave_uk_checks=ON;
19+
SELECT @@global.wsrep_slave_uk_checks;
20+
@@global.wsrep_slave_uk_checks
21+
1
22+
23+
# valid values
24+
SET @@global.wsrep_slave_uk_checks='OFF';
25+
SELECT @@global.wsrep_slave_uk_checks;
26+
@@global.wsrep_slave_uk_checks
27+
0
28+
SET @@global.wsrep_slave_uk_checks=ON;
29+
SELECT @@global.wsrep_slave_uk_checks;
30+
@@global.wsrep_slave_uk_checks
31+
1
32+
SET @@global.wsrep_slave_uk_checks=default;
33+
SELECT @@global.wsrep_slave_uk_checks;
34+
@@global.wsrep_slave_uk_checks
35+
0
36+
37+
# invalid values
38+
SET @@global.wsrep_slave_uk_checks=NULL;
39+
ERROR 42000: Variable 'wsrep_slave_UK_checks' can't be set to the value of 'NULL'
40+
SET @@global.wsrep_slave_uk_checks='junk';
41+
ERROR 42000: Variable 'wsrep_slave_UK_checks' can't be set to the value of 'junk'
42+
43+
# restore the initial value
44+
SET @@global.wsrep_slave_uk_checks = @wsrep_slave_uk_checks_global_saved;
45+
# End of test
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--source include/have_innodb_disallow_writes.inc
2+
3+
--echo #
4+
--echo # innodb_disallow_writes
5+
--echo #
6+
7+
--echo # save the initial value
8+
SET @innodb_disallow_writes_global_saved = @@global.innodb_disallow_writes;
9+
10+
--echo # default
11+
SELECT @@global.innodb_disallow_writes;
12+
13+
--echo
14+
--echo # scope
15+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
16+
SELECT @@session.innodb_disallow_writes;
17+
SET @@global.innodb_disallow_writes=OFF;
18+
SELECT @@global.innodb_disallow_writes;
19+
SET @@global.innodb_disallow_writes=ON;
20+
SELECT @@global.innodb_disallow_writes;
21+
22+
--echo
23+
--echo # valid values
24+
SET @@global.innodb_disallow_writes='OFF';
25+
SELECT @@global.innodb_disallow_writes;
26+
SET @@global.innodb_disallow_writes=ON;
27+
SELECT @@global.innodb_disallow_writes;
28+
SET @@global.innodb_disallow_writes=default;
29+
SELECT @@global.innodb_disallow_writes;
30+
31+
--echo
32+
--echo # invalid values
33+
--error ER_WRONG_VALUE_FOR_VAR
34+
SET @@global.innodb_disallow_writes=NULL;
35+
--error ER_WRONG_VALUE_FOR_VAR
36+
SET @@global.innodb_disallow_writes='junk';
37+
38+
--echo
39+
--echo # restore the initial value
40+
SET @@global.innodb_disallow_writes = @innodb_disallow_writes_global_saved;
41+
42+
--echo # End of test
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--source include/have_wsrep.inc
2+
3+
--echo #
4+
--echo # wsrep_slave_fk_checks
5+
--echo #
6+
7+
--echo # save the initial value
8+
SET @wsrep_slave_fk_checks_global_saved = @@global.wsrep_slave_fk_checks;
9+
10+
--echo # default
11+
SELECT @@global.wsrep_slave_fk_checks;
12+
13+
--echo
14+
--echo # scope
15+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
16+
SELECT @@session.wsrep_slave_fk_checks;
17+
SET @@global.wsrep_slave_fk_checks=OFF;
18+
SELECT @@global.wsrep_slave_fk_checks;
19+
SET @@global.wsrep_slave_fk_checks=ON;
20+
SELECT @@global.wsrep_slave_fk_checks;
21+
22+
--echo
23+
--echo # valid values
24+
SET @@global.wsrep_slave_fk_checks='OFF';
25+
SELECT @@global.wsrep_slave_fk_checks;
26+
SET @@global.wsrep_slave_fk_checks=ON;
27+
SELECT @@global.wsrep_slave_fk_checks;
28+
SET @@global.wsrep_slave_fk_checks=default;
29+
SELECT @@global.wsrep_slave_fk_checks;
30+
31+
--echo
32+
--echo # invalid values
33+
--error ER_WRONG_VALUE_FOR_VAR
34+
SET @@global.wsrep_slave_fk_checks=NULL;
35+
--error ER_WRONG_VALUE_FOR_VAR
36+
SET @@global.wsrep_slave_fk_checks='junk';
37+
38+
--echo
39+
--echo # restore the initial value
40+
SET @@global.wsrep_slave_fk_checks = @wsrep_slave_fk_checks_global_saved;
41+
42+
--echo # End of test
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--source include/have_wsrep.inc
2+
3+
--echo #
4+
--echo # wsrep_slave_uk_checks
5+
--echo #
6+
7+
--echo # save the initial value
8+
SET @wsrep_slave_uk_checks_global_saved = @@global.wsrep_slave_uk_checks;
9+
10+
--echo # default
11+
SELECT @@global.wsrep_slave_uk_checks;
12+
13+
--echo
14+
--echo # scope
15+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
16+
SELECT @@session.wsrep_slave_uk_checks;
17+
SET @@global.wsrep_slave_uk_checks=OFF;
18+
SELECT @@global.wsrep_slave_uk_checks;
19+
SET @@global.wsrep_slave_uk_checks=ON;
20+
SELECT @@global.wsrep_slave_uk_checks;
21+
22+
--echo
23+
--echo # valid values
24+
SET @@global.wsrep_slave_uk_checks='OFF';
25+
SELECT @@global.wsrep_slave_uk_checks;
26+
SET @@global.wsrep_slave_uk_checks=ON;
27+
SELECT @@global.wsrep_slave_uk_checks;
28+
SET @@global.wsrep_slave_uk_checks=default;
29+
SELECT @@global.wsrep_slave_uk_checks;
30+
31+
--echo
32+
--echo # invalid values
33+
--error ER_WRONG_VALUE_FOR_VAR
34+
SET @@global.wsrep_slave_uk_checks=NULL;
35+
--error ER_WRONG_VALUE_FOR_VAR
36+
SET @@global.wsrep_slave_uk_checks='junk';
37+
38+
--echo
39+
--echo # restore the initial value
40+
SET @@global.wsrep_slave_uk_checks = @wsrep_slave_uk_checks_global_saved;
41+
42+
--echo # End of test

sql/handler.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6212,9 +6212,9 @@ void handler::set_lock_type(enum thr_lock_type lock)
62126212
always 0
62136213
*/
62146214

6215-
int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
6215+
int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
62166216
{
6217-
DBUG_ENTER("ha_wsrep_abort_transaction");
6217+
DBUG_ENTER("ha_abort_transaction");
62186218
if (!WSREP(bf_thd) &&
62196219
!(wsrep_OSU_method_options == WSREP_OSU_RSU &&
62206220
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)
62276227
for (; ha_info; ha_info= ha_info_next)
62286228
{
62296229
handlerton *hton= ha_info->ht();
6230-
if (!hton->wsrep_abort_transaction)
6230+
if (!hton->abort_transaction)
62316231
{
6232-
WSREP_WARN("cannot abort WRESP transaction");
6232+
WSREP_WARN("cannot abort transaction");
62336233
}
62346234
else
6235-
hton->wsrep_abort_transaction(hton, bf_thd, victim_thd, signal);
6235+
hton->abort_transaction(hton, bf_thd, victim_thd, signal);
62366236
ha_info_next= ha_info->next();
62376237
ha_info->reset(); /* keep it conveniently zero-filled */
62386238
}
62396239
DBUG_RETURN(0);
62406240
}
62416241

6242-
void ha_wsrep_fake_trx_id(THD *thd)
6242+
void ha_fake_trx_id(THD *thd)
62436243
{
6244-
DBUG_ENTER("ha_wsrep_fake_trx_id");
6244+
DBUG_ENTER("ha_fake_trx_id");
62456245
if (!WSREP(thd))
62466246
{
62476247
DBUG_VOID_RETURN;
@@ -6253,12 +6253,12 @@ void ha_wsrep_fake_trx_id(THD *thd)
62536253
for (; ha_info; ha_info= ha_info_next)
62546254
{
62556255
handlerton *hton= ha_info->ht();
6256-
if (!hton->wsrep_fake_trx_id)
6256+
if (!hton->fake_trx_id)
62576257
{
62586258
WSREP_WARN("cannot get fake InnoDB transaction ID");
62596259
}
62606260
else
6261-
hton->wsrep_fake_trx_id(hton, thd);
6261+
hton->fake_trx_id(hton, thd);
62626262
ha_info_next= ha_info->next();
62636263
ha_info->reset(); /* keep it conveniently zero-filled */
62646264
}

sql/handler.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,13 +1230,11 @@ struct handlerton
12301230
enum handler_create_iterator_result
12311231
(*create_iterator)(handlerton *hton, enum handler_iterator_type type,
12321232
struct handler_iterator *fill_this_in);
1233-
#ifdef WITH_WSREP
1234-
int (*wsrep_abort_transaction)(handlerton *hton, THD *bf_thd,
1235-
THD *victim_thd, my_bool signal);
1236-
int (*wsrep_set_checkpoint)(handlerton *hton, const XID* xid);
1237-
int (*wsrep_get_checkpoint)(handlerton *hton, XID* xid);
1238-
void (*wsrep_fake_trx_id)(handlerton *hton, THD *thd);
1239-
#endif /* WITH_WSREP */
1233+
int (*abort_transaction)(handlerton *hton, THD *bf_thd,
1234+
THD *victim_thd, my_bool signal);
1235+
int (*set_checkpoint)(handlerton *hton, const XID* xid);
1236+
int (*get_checkpoint)(handlerton *hton, XID* xid);
1237+
void (*fake_trx_id)(handlerton *hton, THD *thd);
12401238
/*
12411239
Optional clauses in the CREATE/ALTER TABLE
12421240
*/
@@ -4091,8 +4089,8 @@ bool ha_rollback_to_savepoint_can_release_mdl(THD *thd);
40914089
int ha_savepoint(THD *thd, SAVEPOINT *sv);
40924090
int ha_release_savepoint(THD *thd, SAVEPOINT *sv);
40934091
#ifdef WITH_WSREP
4094-
int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal);
4095-
void ha_wsrep_fake_trx_id(THD *thd);
4092+
int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal);
4093+
void ha_fake_trx_id(THD *thd);
40964094
#endif /* WITH_WSREP */
40974095

40984096
/* these are called by storage engines */

sql/sql_insert.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4194,7 +4194,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
41944194
errcode);
41954195
}
41964196

4197-
IF_WSREP(ha_wsrep_fake_trx_id(thd), );
4197+
IF_WSREP(ha_fake_trx_id(thd), );
41984198

41994199
return result;
42004200
}

sql/wsrep_mysqld.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
176176
{
177177
XID* xid= reinterpret_cast<XID*>(arg);
178178
handlerton* hton= plugin_data(plugin, handlerton *);
179-
if (hton->db_type == DB_TYPE_INNODB)
179+
if (hton->set_checkpoint)
180180
{
181181
const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
182182
char uuid_str[40] = {0, };
183183
wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
184184
WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld",
185185
uuid_str, (long long)wsrep_xid_seqno(xid));
186-
hton->wsrep_set_checkpoint(hton, xid);
186+
hton->set_checkpoint(hton, xid);
187187
}
188188
return FALSE;
189189
}
@@ -197,15 +197,14 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg)
197197
{
198198
XID* xid= reinterpret_cast<XID*>(arg);
199199
handlerton* hton= plugin_data(plugin, handlerton *);
200-
if (hton->db_type == DB_TYPE_INNODB)
200+
if (hton->get_checkpoint)
201201
{
202-
hton->wsrep_get_checkpoint(hton, xid);
202+
hton->get_checkpoint(hton, xid);
203203
const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid));
204204
char uuid_str[40] = {0, };
205205
wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str));
206206
WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld",
207207
uuid_str, (long long)wsrep_xid_seqno(xid));
208-
209208
}
210209
return FALSE;
211210
}

0 commit comments

Comments
 (0)