Skip to content

Commit 7b708ee

Browse files
committed
MDEV-11329: MariaRocks: rocksdb.add_index_inplace fails
- Make ha_rocksdb::check_if_supported_inplace_alter() take into account the Alter_inplace_info::ALTER_PARTITIONED flag - Adjust the testcase to work in MariaDB
1 parent 05a593d commit 7b708ee

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

storage/rocksdb/ha_rocksdb.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9656,7 +9656,8 @@ my_core::enum_alter_inplace_result ha_rocksdb::check_if_supported_inplace_alter(
96569656
if (ha_alter_info->handler_flags &
96579657
~(my_core::Alter_inplace_info::DROP_INDEX |
96589658
my_core::Alter_inplace_info::DROP_UNIQUE_INDEX |
9659-
my_core::Alter_inplace_info::ADD_INDEX))
9659+
my_core::Alter_inplace_info::ADD_INDEX |
9660+
my_core::Alter_inplace_info::ALTER_PARTITIONED))
96609661
{
96619662
DBUG_RETURN(my_core::HA_ALTER_INPLACE_NOT_SUPPORTED);
96629663
}

storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ DROP INDEX kij ON t1;
252252
SHOW CREATE TABLE t1;
253253
Table Create Table
254254
t1 CREATE TABLE `t1` (
255-
`i` int(11) NOT NULL DEFAULT '0',
255+
`i` int(11) NOT NULL,
256256
`j` int(11) DEFAULT NULL,
257257
`k` int(11) DEFAULT NULL,
258258
PRIMARY KEY (`i`),
@@ -282,10 +282,10 @@ INSERT INTO t1 (a, b) VALUES (2, 6);
282282
INSERT INTO t1 (a, b) VALUES (3, 7);
283283
# crash_during_online_index_creation
284284
flush logs;
285-
SET SESSION debug="+d,crash_during_online_index_creation";
285+
SET SESSION debug_dbug="+d,crash_during_online_index_creation";
286286
ALTER TABLE t1 ADD INDEX kb(b), ALGORITHM=INPLACE;
287287
ERROR HY000: Lost connection to MySQL server during query
288-
SET SESSION debug="-d,crash_during_online_index_creation";
288+
SET SESSION debug_dbug="-d,crash_during_online_index_creation";
289289
SHOW CREATE TABLE t1;
290290
Table Create Table
291291
t1 CREATE TABLE `t1` (
@@ -301,14 +301,14 @@ DROP TABLE t1;
301301
CREATE TABLE t1 (i INT, j INT, k INT, PRIMARY KEY (i), KEY(j)) ENGINE = ROCKSDB PARTITION BY KEY(i) PARTITIONS 4;
302302
# crash_during_index_creation_partition
303303
flush logs;
304-
SET SESSION debug="+d,crash_during_index_creation_partition";
304+
SET SESSION debug_dbug="+d,crash_during_index_creation_partition";
305305
ALTER TABLE t1 ADD INDEX kij(i,j), ALGORITHM=INPLACE;
306306
ERROR HY000: Lost connection to MySQL server during query
307-
SET SESSION debug="-d,crash_during_index_creation_partition";
307+
SET SESSION debug_dbug="-d,crash_during_index_creation_partition";
308308
SHOW CREATE TABLE t1;
309309
Table Create Table
310310
t1 CREATE TABLE `t1` (
311-
`i` int(11) NOT NULL DEFAULT '0',
311+
`i` int(11) NOT NULL,
312312
`j` int(11) DEFAULT NULL,
313313
`k` int(11) DEFAULT NULL,
314314
PRIMARY KEY (`i`),
@@ -336,17 +336,17 @@ DROP TABLE t1;
336336
CREATE TABLE t1 (i INT, j INT, k INT, PRIMARY KEY (i), KEY(j)) ENGINE = ROCKSDB PARTITION BY KEY(i) PARTITIONS 4;
337337
# crash_during_index_creation_partition
338338
flush logs;
339-
SET SESSION debug="+d,myrocks_simulate_index_create_rollback";
339+
SET SESSION debug_dbug="+d,myrocks_simulate_index_create_rollback";
340340
# expected assertion failure from sql layer here for alter rollback
341341
call mtr.add_suppression("Assertion `0' failed.");
342342
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
343343
ALTER TABLE t1 ADD INDEX kij(i,j), ALGORITHM=INPLACE;
344344
ERROR HY000: Lost connection to MySQL server during query
345-
SET SESSION debug="-d,myrocks_simulate_index_create_rollback";
345+
SET SESSION debug_dbug="-d,myrocks_simulate_index_create_rollback";
346346
SHOW CREATE TABLE t1;
347347
Table Create Table
348348
t1 CREATE TABLE `t1` (
349-
`i` int(11) NOT NULL DEFAULT '0',
349+
`i` int(11) NOT NULL,
350350
`j` int(11) DEFAULT NULL,
351351
`k` int(11) DEFAULT NULL,
352352
PRIMARY KEY (`i`),
@@ -358,7 +358,7 @@ ALTER TABLE t1 ADD INDEX kij(i,j), ALGORITHM=INPLACE;
358358
SHOW CREATE TABLE t1;
359359
Table Create Table
360360
t1 CREATE TABLE `t1` (
361-
`i` int(11) NOT NULL DEFAULT '0',
361+
`i` int(11) NOT NULL,
362362
`j` int(11) DEFAULT NULL,
363363
`k` int(11) DEFAULT NULL,
364364
PRIMARY KEY (`i`),
@@ -371,8 +371,11 @@ SELECT COUNT(*) FROM t1;
371371
COUNT(*)
372372
100
373373
DROP TABLE t1;
374+
set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
375+
set global rocksdb_strict_collation_check=1;
374376
CREATE TABLE t1 (a INT, b TEXT);
375377
ALTER TABLE t1 ADD KEY kb(b(10));
376378
ERROR HY000: Unsupported collation on string indexed column test.t1.b Use binary collation (binary, latin1_bin, utf8_bin).
377379
ALTER TABLE t1 ADD PRIMARY KEY(a);
378380
DROP TABLE t1;
381+
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;

storage/rocksdb/mysql-test/rocksdb/t/add_index_inplace.cnf

Lines changed: 0 additions & 5 deletions
This file was deleted.

storage/rocksdb/mysql-test/rocksdb/t/add_index_inplace.test

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--source include/have_rocksdb.inc
22
--source include/have_debug.inc
3+
--source include/have_partition.inc
34

45
--disable_warnings
56
drop table if exists t1;
@@ -181,14 +182,14 @@ INSERT INTO t1 (a, b) VALUES (3, 7);
181182
flush logs;
182183

183184
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
184-
SET SESSION debug="+d,crash_during_online_index_creation";
185+
SET SESSION debug_dbug="+d,crash_during_online_index_creation";
185186
--error 2013
186187
ALTER TABLE t1 ADD INDEX kb(b), ALGORITHM=INPLACE;
187188

188189
--enable_reconnect
189190
--source include/wait_until_connected_again.inc
190191

191-
SET SESSION debug="-d,crash_during_online_index_creation";
192+
SET SESSION debug_dbug="-d,crash_during_online_index_creation";
192193

193194
SHOW CREATE TABLE t1;
194195
CHECK TABLE t1;
@@ -214,14 +215,14 @@ while ($i <= $max) {
214215
flush logs;
215216

216217
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
217-
SET SESSION debug="+d,crash_during_index_creation_partition";
218+
SET SESSION debug_dbug="+d,crash_during_index_creation_partition";
218219
--error 2013
219220
ALTER TABLE t1 ADD INDEX kij(i,j), ALGORITHM=INPLACE;
220221

221222
--enable_reconnect
222223
--source include/wait_until_connected_again.inc
223224

224-
SET SESSION debug="-d,crash_during_index_creation_partition";
225+
SET SESSION debug_dbug="-d,crash_during_index_creation_partition";
225226

226227
SHOW CREATE TABLE t1;
227228

@@ -253,7 +254,7 @@ while ($i <= $max) {
253254
flush logs;
254255

255256
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
256-
SET SESSION debug="+d,myrocks_simulate_index_create_rollback";
257+
SET SESSION debug_dbug="+d,myrocks_simulate_index_create_rollback";
257258

258259
--echo # expected assertion failure from sql layer here for alter rollback
259260
call mtr.add_suppression("Assertion `0' failed.");
@@ -266,7 +267,7 @@ ALTER TABLE t1 ADD INDEX kij(i,j), ALGORITHM=INPLACE;
266267
--enable_reconnect
267268
--source include/wait_until_connected_again.inc
268269

269-
SET SESSION debug="-d,myrocks_simulate_index_create_rollback";
270+
SET SESSION debug_dbug="-d,myrocks_simulate_index_create_rollback";
270271

271272
SHOW CREATE TABLE t1;
272273

@@ -280,11 +281,14 @@ SELECT COUNT(*) FROM t1;
280281
DROP TABLE t1;
281282

282283
# test failure in prepare phase (due to collation)
284+
set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
285+
set global rocksdb_strict_collation_check=1;
283286
CREATE TABLE t1 (a INT, b TEXT);
284287

285288
--error 1105
286289
ALTER TABLE t1 ADD KEY kb(b(10));
287290
ALTER TABLE t1 ADD PRIMARY KEY(a);
288291
DROP TABLE t1;
289292

293+
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;
290294

0 commit comments

Comments
 (0)