Skip to content

Commit

Permalink
lightning: remove some NOT NULL constraints on lightning table (#57577
Browse files Browse the repository at this point in the history
) (#57600)

close #57578
  • Loading branch information
ti-chi-bot authored Nov 22, 2024
1 parent 51e8310 commit c257fbe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/lightning/errormanager/errormanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
`
Expand Down
2 changes: 1 addition & 1 deletion pkg/lightning/errormanager/errormanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pkg/lightning/errormanager/resolveconflict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit c257fbe

Please sign in to comment.