You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LOG_WARNING(log, "Execute exchange partition, the table info of partition can not get from TiKV, npt_database_id={} partition_id={}", npt_database_id, pt_partition_id);
862
+
throwTiFlashException(fmt::format("miss partition table in TiKV, may have been dropped, physical_table_id={}", pt_partition_id), Errors::DDL::StaleSchema);
Copy file name to clipboardExpand all lines: tests/fullstack-test2/ddl/alter_exchange_partition.test
+98Lines changed: 98 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -267,6 +267,104 @@ mysql> set session tidb_isolation_read_engines='tiflash'; select * from test_new
267
267
mysql> alter table test.e drop column c1;
268
268
>> DBGInvoke __refresh_schemas()
269
269
270
+
# cleanup
271
+
mysql> drop table if exists test.e;
272
+
mysql> drop table if exists test.e2;
273
+
mysql> drop table if exists test_new.e2;
274
+
mysql> drop database if exists test_new;
275
+
276
+
# case 11, create non-partition table and execute exchagne partition immediately
277
+
mysql> create table test.e(id INT NOT NULL,fname VARCHAR(30),lname VARCHAR(30)) PARTITION BY RANGE (id) ( PARTITION p0 VALUES LESS THAN (50),PARTITION p1 VALUES LESS THAN (100),PARTITION p2 VALUES LESS THAN (150), PARTITION p3 VALUES LESS THAN (MAXVALUE));
278
+
mysql> insert into test.e values (1, 'a', 'b'),(108, 'a', 'b');
279
+
# sync the partition table to tiflash
280
+
>> DBGInvoke __refresh_schemas()
281
+
282
+
mysql> create table test.e2(id int not null,fname varchar(30),lname varchar(30));
283
+
mysql> insert into test.e2 values (2, 'a', 'b');
284
+
mysql> set @@tidb_enable_exchange_partition=1; alter table test.e exchange partition p0 with table test.e2
285
+
286
+
mysql> alter table test.e set tiflash replica 1;
287
+
mysql> alter table test.e2 set tiflash replica 1;
288
+
func> wait_table test e e2
289
+
>> DBGInvoke __refresh_schemas()
290
+
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e order by id;
291
+
+-----+-------+-------+
292
+
| id | fname | lname |
293
+
+-----+-------+-------+
294
+
| 2 | a | b |
295
+
| 108 | a | b |
296
+
+-----+-------+-------+
297
+
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e2 order by id;
298
+
+-----+-------+-------+
299
+
| id | fname | lname |
300
+
+-----+-------+-------+
301
+
| 1 | a | b |
302
+
+-----+-------+-------+
303
+
304
+
# ensure the swap out table is not mark as tombstone
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e order by id;
309
+
+-----+-------+-------+
310
+
| id | fname | lname |
311
+
+-----+-------+-------+
312
+
| 2 | a | b |
313
+
| 108 | a | b |
314
+
+-----+-------+-------+
315
+
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e2 order by id;
316
+
+-----+-------+-------+
317
+
| id | fname | lname |
318
+
+-----+-------+-------+
319
+
| 1 | a | b |
320
+
+-----+-------+-------+
321
+
322
+
# case 12, create partition table, non-partition table and execute exchagne partition immediately
323
+
mysql> drop table if exists test.e
324
+
mysql> drop table if exists test.e2
325
+
mysql> create table test.e(id INT NOT NULL,fname VARCHAR(30),lname VARCHAR(30)) PARTITION BY RANGE (id) ( PARTITION p0 VALUES LESS THAN (50),PARTITION p1 VALUES LESS THAN (100),PARTITION p2 VALUES LESS THAN (150), PARTITION p3 VALUES LESS THAN (MAXVALUE));
326
+
mysql> insert into test.e values (1, 'a', 'b'),(108, 'a', 'b');
327
+
mysql> create table test.e2(id int not null,fname varchar(30),lname varchar(30));
328
+
mysql> insert into test.e2 values (2, 'a', 'b');
329
+
mysql> set @@tidb_enable_exchange_partition=1; alter table test.e exchange partition p0 with table test.e2
330
+
331
+
mysql> alter table test.e set tiflash replica 1;
332
+
mysql> alter table test.e2 set tiflash replica 1;
333
+
func> wait_table test e e2
334
+
# tiflash the final result
335
+
>> DBGInvoke __refresh_schemas()
336
+
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e order by id;
337
+
+-----+-------+-------+
338
+
| id | fname | lname |
339
+
+-----+-------+-------+
340
+
| 2 | a | b |
341
+
| 108 | a | b |
342
+
+-----+-------+-------+
343
+
mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.e2 order by id;
344
+
+-----+-------+-------+
345
+
| id | fname | lname |
346
+
+-----+-------+-------+
347
+
| 1 | a | b |
348
+
+-----+-------+-------+
349
+
# ensure the swap out table is not mark as tombstone
0 commit comments