Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: remove some NOT NULL constraints on lightning table (#57577) #57600

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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