Skip to content

Commit 810ed88

Browse files
MDEV-27169 Change default values of Spider plugin variables to default values of table variables
Some Spider table options introduces an unnecessary complication to Spider settings. For example, the default value of the plugin variable spider_auto_increment_mode is -1 (use table value) and the default table option value is 0 (normal mode). Thus, the virtual default value of the variable is 0. This kind of indirection is confusing. In order to delete such confusing table options in a future release, we first change the default values of some Spider plugin variables from -1 (use table value) to the corresponding default table values. The default table values are defined in spider_set_connect_info_default(). At the same time, we also deprecate the option value -1 (use table value).
1 parent 332c59a commit 810ed88

17 files changed

+252
-118
lines changed

storage/spider/mysql-test/spider/bg/r/spider3_fixes.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ SELECT 1;
3636
3.1
3737
auto_increment
3838
connection master_1;
39+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
40+
SET SESSION spider_auto_increment_mode = -1;
41+
Warnings:
42+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
3943
connection slave1_1;
4044
connection master_1;
4145
DROP TABLE IF EXISTS t1, t2;
@@ -190,6 +194,7 @@ LAST_INSERT_ID()
190194
SELECT MAX(id) FROM t2;
191195
MAX(id)
192196
10000
197+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
193198
connection slave1_1;
194199
SELECT id FROM t1 ORDER BY id;
195200
id

storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ SELECT 1;
3434
1
3535
auto_increment with partition
3636
connection master_1;
37+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
38+
SET SESSION spider_auto_increment_mode = -1;
39+
Warnings:
40+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
3741
connection slave1_1;
3842
connection master_1;
3943
DROP TABLE IF EXISTS t1, t2;
@@ -188,6 +192,7 @@ LAST_INSERT_ID()
188192
SELECT MAX(id) FROM t2;
189193
MAX(id)
190194
10000
195+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
191196
connection slave1_1;
192197
SELECT id FROM t1 ORDER BY id;
193198
id

storage/spider/mysql-test/spider/bg/r/spider_fixes.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ connection master_1;
413413

414414
read only
415415
connection master_1;
416+
SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
417+
SET SESSION spider_read_only_mode = -1;
418+
Warnings:
419+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
416420
DROP TABLE IF EXISTS t1;
417421
CREATE TABLE t1 (
418422
id int(11) NOT NULL,
@@ -441,10 +445,19 @@ DELETE FROM t1;
441445
ERROR HY000: Table 'auto_test_local.t1' is read only
442446
TRUNCATE t1;
443447
ERROR HY000: Table 'auto_test_local.t1' is read only
448+
SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
444449

445450
2.27
446451
error mode
447452
connection master_1;
453+
SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
454+
SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
455+
SET SESSION spider_error_read_mode = -1;
456+
Warnings:
457+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
458+
SET SESSION spider_error_write_mode = -1;
459+
Warnings:
460+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
448461
DROP TABLE IF EXISTS t1;
449462
CREATE TABLE t1 (
450463
id int(11) NOT NULL,
@@ -466,6 +479,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
466479
TRUNCATE t1;
467480
Warnings:
468481
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
482+
SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
483+
SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
469484

470485
3.0
471486
is null

storage/spider/mysql-test/spider/bg/t/spider3_fixes.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
9797
}
9898
}
9999
--connection master_1
100+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
101+
SET SESSION spider_auto_increment_mode = -1;
100102
if ($USE_REPLICATION)
101103
{
102104
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
222224
INSERT INTO t2 (id) VALUES (1000);
223225
SELECT LAST_INSERT_ID();
224226
SELECT MAX(id) FROM t2;
227+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
225228
if ($USE_REPLICATION)
226229
{
227230
save_master_pos;

storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
131131
}
132132
}
133133
--connection master_1
134+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
135+
SET SESSION spider_auto_increment_mode = -1;
134136
if ($USE_REPLICATION)
135137
{
136138
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
256258
INSERT INTO t2 (id) VALUES (1000);
257259
SELECT LAST_INSERT_ID();
258260
SELECT MAX(id) FROM t2;
261+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
259262
if ($USE_REPLICATION)
260263
{
261264
save_master_pos;

storage/spider/mysql-test/spider/bg/t/spider_fixes.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
11721172
if ($MASTER_1_ENGINE_IS_SPIDER)
11731173
{
11741174
--connection master_1
1175+
SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
1176+
SET SESSION spider_read_only_mode = -1;
11751177
--disable_warnings
11761178
DROP TABLE IF EXISTS t1;
11771179
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
11971199
DELETE FROM t1;
11981200
--error 12518
11991201
TRUNCATE t1;
1202+
SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
12001203
}
12011204
if (!$MASTER_1_ENGINE_IS_SPIDER)
12021205
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
12101213
if ($MASTER_1_ENGINE_IS_SPIDER)
12111214
{
12121215
--connection master_1
1216+
SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
1217+
SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
1218+
SET SESSION spider_error_read_mode = -1;
1219+
SET SESSION spider_error_write_mode = -1;
12131220
--disable_warnings
12141221
DROP TABLE IF EXISTS t1;
12151222
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
12271234
INSERT INTO t1 (id) VALUES (1);
12281235
DELETE FROM t1;
12291236
TRUNCATE t1;
1237+
SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
1238+
SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
12301239
}
12311240
if (!$MASTER_1_ENGINE_IS_SPIDER)
12321241
{

storage/spider/mysql-test/spider/handler/r/spider3_fixes.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ SELECT 1;
3636
3.1
3737
auto_increment
3838
connection master_1;
39+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
40+
SET SESSION spider_auto_increment_mode = -1;
41+
Warnings:
42+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
3943
connection slave1_1;
4044
connection master_1;
4145
DROP TABLE IF EXISTS t1, t2;
@@ -206,6 +210,7 @@ LAST_INSERT_ID()
206210
SELECT MAX(id) FROM t2;
207211
MAX(id)
208212
46
213+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
209214
connection slave1_1;
210215
SELECT id FROM t1 ORDER BY id;
211216
id

storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ SELECT 1;
3434
1
3535
auto_increment with partition
3636
connection master_1;
37+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
38+
SET SESSION spider_auto_increment_mode = -1;
39+
Warnings:
40+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
3741
connection slave1_1;
3842
connection master_1;
3943
DROP TABLE IF EXISTS t1, t2;
@@ -204,6 +208,7 @@ LAST_INSERT_ID()
204208
SELECT MAX(id) FROM t2;
205209
MAX(id)
206210
26
211+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
207212
connection slave1_1;
208213
SELECT id FROM t1 ORDER BY id;
209214
id

storage/spider/mysql-test/spider/handler/r/spider_fixes.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ UNLOCK TABLES;
306306

307307
auto_increment
308308
connection master_1;
309+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
310+
SET SESSION spider_auto_increment_mode = -1;
311+
Warnings:
312+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
309313
connection slave1_1;
310314
connection master_1;
311315
DROP TABLE IF EXISTS t1;
@@ -399,6 +403,7 @@ LAST_INSERT_ID()
399403
SELECT MAX(id) FROM t1;
400404
MAX(id)
401405
42
406+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
402407
connection slave1_1;
403408
SELECT id FROM t1 ORDER BY id;
404409
id
@@ -417,6 +422,10 @@ connection master_1;
417422

418423
read only
419424
connection master_1;
425+
SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
426+
SET SESSION spider_read_only_mode = -1;
427+
Warnings:
428+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
420429
DROP TABLE IF EXISTS t1;
421430
CREATE TABLE t1 (
422431
id int(11) NOT NULL,
@@ -445,10 +454,19 @@ DELETE FROM t1;
445454
ERROR HY000: Table 'auto_test_local.t1' is read only
446455
TRUNCATE t1;
447456
ERROR HY000: Table 'auto_test_local.t1' is read only
457+
SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
448458

449459
2.27
450460
error mode
451461
connection master_1;
462+
SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
463+
SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
464+
SET SESSION spider_error_read_mode = -1;
465+
Warnings:
466+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
467+
SET SESSION spider_error_write_mode = -1;
468+
Warnings:
469+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
452470
DROP TABLE IF EXISTS t1;
453471
CREATE TABLE t1 (
454472
id int(11) NOT NULL,
@@ -470,6 +488,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
470488
TRUNCATE t1;
471489
Warnings:
472490
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
491+
SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
492+
SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
473493

474494
3.0
475495
is null

storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ a b c
109109
2.26
110110
auto_increment with partition
111111
connection master_1;
112+
SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
113+
SET SESSION spider_auto_increment_mode = -1;
114+
Warnings:
115+
Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
112116
connection slave1_1;
113117
connection master_1;
114118
DROP TABLE IF EXISTS t1;
@@ -202,6 +206,7 @@ LAST_INSERT_ID()
202206
SELECT MAX(id) FROM t1;
203207
MAX(id)
204208
26
209+
SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
205210
connection slave1_1;
206211
SELECT id FROM t1 ORDER BY id;
207212
id

0 commit comments

Comments
 (0)