@@ -313,41 +313,35 @@ func TestGlobalSortDuplicateErrMsg(t *testing.T) {
313
313
"create table t (id int, data varchar(255));" ,
314
314
"" ,
315
315
"insert into t values (1, '1'), (2, '1');" ,
316
- "alter table t add unique index i (data);" ,
317
- "[kv:1062]Duplicate entry '1' for key 't.i '" ,
316
+ "alter table t add unique index idx (data);" ,
317
+ "[kv:1062]Duplicate entry '1' for key 't.idx '" ,
318
318
},
319
319
{
320
320
"combined index" ,
321
321
"create table t (id int, data varchar(255));" ,
322
322
"" ,
323
323
"insert into t values (1, '1'), (1, '1');" ,
324
- "alter table t add unique index i (id, data);" ,
325
- "[kv:1062]Duplicate entry '1-1' for key 't.i '" ,
324
+ "alter table t add unique index idx (id, data);" ,
325
+ "[kv:1062]Duplicate entry '1-1' for key 't.idx '" ,
326
326
},
327
327
{
328
328
"multi value index" ,
329
329
"create table t (id int, data json);" ,
330
330
"" ,
331
331
`insert into t values (1, '{"code":[1,1]}'), (2, '{"code":[1,1]}');` ,
332
- "alter table t add unique index zips ( (CAST(data->'$.code' AS UNSIGNED ARRAY)));" ,
333
- "Duplicate entry '1' for key 't.zips " ,
332
+ "alter table t add unique index idx ( (CAST(data->'$.code' AS UNSIGNED ARRAY)));" ,
333
+ "Duplicate entry '1' for key 't.idx " ,
334
334
},
335
335
{
336
336
"global index" ,
337
337
"create table t (k int, c int) partition by list (k) (partition odd values in (1,3,5,7,9), partition even values in (2,4,6,8,10));" ,
338
338
"" ,
339
339
"insert into t values (1, 1), (2, 1)" ,
340
- "alter table t add unique index i (c) global" ,
341
- "[kv:1062]Duplicate entry '1' for key 't.i '" ,
340
+ "alter table t add unique index idx (c) global" ,
341
+ "[kv:1062]Duplicate entry '1' for key 't.idx '" ,
342
342
},
343
343
}
344
344
345
- checkSubtaskErr := func (t * testing.T ) {
346
- errorSubtask := taskexecutor .GetErrorSubtask4Test .Swap (nil )
347
- require .NotEmpty (t , errorSubtask )
348
- require .Equal (t , proto .BackfillStepWriteAndIngest , errorSubtask .Step )
349
- }
350
-
351
345
for _ , tc := range testcases {
352
346
t .Run (tc .caseName , func (tt * testing.T ) {
353
347
// init
@@ -368,7 +362,13 @@ func TestGlobalSortDuplicateErrMsg(t *testing.T) {
368
362
}
369
363
370
364
tk .MustContainErrMsg (tc .addUniqueKeySQL , tc .errMsg )
371
- checkSubtaskErr (tt )
365
+ errorSubtask := taskexecutor .GetErrorSubtask4Test .Swap (nil )
366
+ require .NotEmpty (tt , errorSubtask )
367
+ require .Equal (tt , proto .BackfillStepWriteAndIngest , errorSubtask .Step )
368
+
369
+ tk .MustExec ("set session tidb_redact_log = on;" )
370
+ tk .MustContainErrMsg (tc .addUniqueKeySQL , "[kv:1062]Duplicate entry '?' for key 't.idx'" )
371
+ tk .MustExec ("set session tidb_redact_log = off;" )
372
372
})
373
373
}
374
374
}
0 commit comments