Skip to content

Commit

Permalink
schemastore: ignore unsupported ddl types (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu authored Feb 10, 2025
1 parent ff8e3e1 commit 8b3929e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
22 changes: 21 additions & 1 deletion logservice/schemastore/persist_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,31 @@ func shouldSkipDDL(job *model.Job, tableMap map[int64]*BasicTableInfo) bool {
return true
}
// DDLs ignored
case model.ActionCreateSequence,
case model.ActionLockTable,
model.ActionUnlockTable,
model.ActionRepairTable,
model.ActionSetTiFlashReplica,
model.ActionUpdateTiFlashReplicaStatus,
model.ActionCreateSequence,
model.ActionAlterSequence,
model.ActionDropSequence,
model.ActionModifyTableAutoIDCache,
model.ActionRebaseAutoRandomBase,
model.ActionAddCheckConstraint,
model.ActionDropCheckConstraint,
model.ActionAlterCheckConstraint,
model.ActionAlterTableAttributes,
model.ActionAlterTablePartitionAttributes,
model.ActionCreatePlacementPolicy,
model.ActionAlterPlacementPolicy,
model.ActionDropPlacementPolicy,
model.ActionAlterTablePartitionPlacement,
model.ActionModifySchemaDefaultPlacement,
model.ActionAlterTablePlacement,
model.ActionAlterCacheTable,
model.ActionAlterNoCacheTable,
model.ActionFlashbackCluster,
model.ActionRecoverSchema,
model.ActionCreateResourceGroup,
model.ActionAlterResourceGroup,
model.ActionDropResourceGroup:
Expand Down
9 changes: 0 additions & 9 deletions logservice/schemastore/persist_storage_ddl_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,6 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncIgnore,
buildDDLEventFunc: buildDDLEventForModifySchemaCharsetAndCollate,
},
model.ActionSetTiFlashReplica: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTableForTiDB,
},

model.ActionAddPrimaryKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
Expand Down
3 changes: 1 addition & 2 deletions logservice/schemastore/persist_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,6 @@ func TestApplyDDLJobs(t *testing.T) {
buildModifyTableCharsetJobForTest(100, 300, 1040, charset.CharsetUTF8MB4),
buildAlterTTLJobForTest(100, 300, 1050),
buildRemoveTTLJobForTest(100, 300, 1060),
buildSetTiFlashReplicaJobForTest(100, 300, 1070),
buildMultiSchemaChangeJobForTest(100, 300, 1080),
buildAddColumnJobForTest(100, 300, 1090),
buildDropColumnJobForTest(100, 300, 1100),
Expand All @@ -1743,7 +1742,7 @@ func TestApplyDDLJobs(t *testing.T) {
},
},
map[int64][]uint64{
300: {1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100, 1110},
300: {1010, 1020, 1030, 1040, 1050, 1060, 1080, 1090, 1100, 1110},
},
[]uint64{1110, 1120},
nil,
Expand Down
12 changes: 0 additions & 12 deletions logservice/schemastore/persist_storage_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,6 @@ func buildRemoveTTLJobForTest(schemaID, tableID int64, finishedTs uint64) *model
}
}

func buildSetTiFlashReplicaJobForTest(schemaID, tableID int64, finishedTs uint64) *model.Job {
return &model.Job{
Type: model.ActionSetTiFlashReplica,
SchemaID: schemaID,
TableID: tableID,
BinlogInfo: &model.HistoryInfo{
TableInfo: newEligibleTableInfoForTest(tableID, fmt.Sprintf("t_%d", tableID)),
FinishedTS: finishedTs,
},
}
}

func buildMultiSchemaChangeJobForTest(schemaID, tableID int64, finishedTs uint64) *model.Job {
return &model.Job{
Type: model.ActionMultiSchemaChange,
Expand Down

0 comments on commit 8b3929e

Please sign in to comment.