diff --git a/pkg/lightning/errormanager/errormanager.go b/pkg/lightning/errormanager/errormanager.go index 5649bf7be1279..f472f381d3b0d 100644 --- a/pkg/lightning/errormanager/errormanager.go +++ b/pkg/lightning/errormanager/errormanager.go @@ -91,8 +91,8 @@ const ( create_time datetime(6) NOT NULL DEFAULT now(6), table_name varchar(261) NOT NULL, index_name varchar(128) NOT NULL, - key_data text NOT NULL COMMENT 'decoded from raw_key, human readable only, not for machine use', - row_data text NOT NULL COMMENT 'decoded from raw_row, human readable only, not for machine use', + key_data text COMMENT 'decoded from raw_key, human readable only, not for machine use', + row_data text COMMENT 'decoded from raw_row, human readable only, not for machine use', raw_key mediumblob NOT NULL COMMENT 'the conflicted key', raw_value mediumblob NOT NULL COMMENT 'the value of the conflicted key', raw_handle mediumblob NOT NULL COMMENT 'the data handle derived from the conflicted key or value', @@ -150,7 +150,7 @@ const ( ` insertIntoConflictErrorData = ` - INSERT IGNORE INTO %s.` + ConflictErrorTableName + ` + INSERT INTO %s.` + ConflictErrorTableName + ` (task_id, table_name, index_name, key_data, row_data, raw_key, raw_value, raw_handle, raw_row, kv_type) VALUES ` diff --git a/pkg/lightning/errormanager/errormanager_test.go b/pkg/lightning/errormanager/errormanager_test.go index 0dc0c2368912d..f823d870e9f32 100644 --- a/pkg/lightning/errormanager/errormanager_test.go +++ b/pkg/lightning/errormanager/errormanager_test.go @@ -497,7 +497,7 @@ func TestReplaceConflictOneUniqueKey(t *testing.T) { AddRow(3, data3IndexKey, "uni_b", data3IndexValue, data3RowKey). AddRow(4, data3IndexKey, "uni_b", data4IndexValue, data4RowKey)) mockDB.ExpectBegin() - mockDB.ExpectExec("INSERT IGNORE INTO `lightning_task_info`\\.conflict_error_v3.*"). + mockDB.ExpectExec("INSERT INTO `lightning_task_info`\\.conflict_error_v3.*"). WithArgs(0, "test", nil, nil, data2RowKey, data2RowValue, 2, 0, "test", nil, nil, data4RowKey, data4RowValue, 2). WillReturnResult(driver.ResultNoRows) diff --git a/pkg/lightning/errormanager/resolveconflict_test.go b/pkg/lightning/errormanager/resolveconflict_test.go index 7dee78af9a715..c1f4edffcd840 100644 --- a/pkg/lightning/errormanager/resolveconflict_test.go +++ b/pkg/lightning/errormanager/resolveconflict_test.go @@ -178,7 +178,7 @@ func TestReplaceConflictMultipleKeysNonclusteredPk(t *testing.T) { AddRow(3, data6RowKey, "PRIMARY", data6RowValue, data5RowKey). AddRow(4, data6RowKey, "PRIMARY", data7NonclusteredValue, data6NonclusteredKey)) mockDB.ExpectBegin() - mockDB.ExpectExec("INSERT IGNORE INTO `lightning_task_info`\\.conflict_error_v3.*"). + mockDB.ExpectExec("INSERT INTO `lightning_task_info`\\.conflict_error_v3.*"). WithArgs(0, "a", nil, nil, data2NonclusteredKey, data2NonclusteredValue, 2, 0, "a", nil, nil, data6NonclusteredKey, data6NonclusteredValue, 2). WillReturnResult(driver.ResultNoRows) @@ -361,7 +361,7 @@ func TestReplaceConflictOneKeyNonclusteredPk(t *testing.T) { AddRow(1, data3IndexKey, "PRIMARY", data3IndexValue, data3RowKey). AddRow(2, data3IndexKey, "PRIMARY", data4IndexValue, data4RowKey)) mockDB.ExpectBegin() - mockDB.ExpectExec("INSERT IGNORE INTO `lightning_task_info`\\.conflict_error_v3.*"). + mockDB.ExpectExec("INSERT INTO `lightning_task_info`\\.conflict_error_v3.*"). WithArgs(0, "a", nil, nil, data4RowKey, data4RowValue, 2). WillReturnResult(driver.ResultNoRows) mockDB.ExpectCommit() @@ -547,7 +547,7 @@ func TestReplaceConflictOneUniqueKeyNonclusteredPk(t *testing.T) { AddRow(5, data3IndexKey, "PRIMARY", data3IndexValue, data3RowKey). AddRow(6, data3IndexKey, "PRIMARY", data4NonclusteredValue, data4RowKey)) mockDB.ExpectBegin() - mockDB.ExpectExec("INSERT IGNORE INTO `lightning_task_info`\\.conflict_error_v3.*"). + mockDB.ExpectExec("INSERT INTO `lightning_task_info`\\.conflict_error_v3.*"). WithArgs(0, "a", nil, nil, data5RowKey, data5RowValue, 2, 0, "a", nil, nil, data2RowKey, data2RowValue, 2, 0, "a", nil, nil, data4RowKey, data4RowValue, 2). @@ -754,7 +754,7 @@ func TestReplaceConflictOneUniqueKeyNonclusteredVarcharPk(t *testing.T) { AddRow(5, data3IndexKey, "PRIMARY", data3IndexValue, data3RowKey). AddRow(6, data3IndexKey, "PRIMARY", data4IndexValue, data4RowKey)) mockDB.ExpectBegin() - mockDB.ExpectExec("INSERT IGNORE INTO `lightning_task_info`\\.conflict_error_v3.*"). + mockDB.ExpectExec("INSERT INTO `lightning_task_info`\\.conflict_error_v3.*"). WithArgs(0, "a", nil, nil, data5RowKey, data5RowValue, 2, 0, "a", nil, nil, data2RowKey, data2RowValue, 2, 0, "a", nil, nil, data4RowKey, data4RowValue, 2).