Skip to content

Commit

Permalink
schemastore: small reorganize
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu committed Jan 3, 2025
1 parent 8e99d89 commit d3efb33
Showing 1 changed file with 55 additions and 52 deletions.
107 changes: 55 additions & 52 deletions logservice/schemastore/persist_storage_ddl_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncIgnore,
buildDDLEventFunc: buildDDLEventForDropSchema,
},
model.ActionModifyTableCharsetAndCollate: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},

model.ActionCreateTable: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForCreateTable,
updateDDLHistoryFunc: updateDDLHistoryForAddDropTable,
Expand Down Expand Up @@ -169,30 +160,6 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionAlterIndexVisibility: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionAddPrimaryKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionDropPrimaryKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionAddForeignKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
Expand Down Expand Up @@ -249,15 +216,6 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionSetTiFlashReplica: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTableForTiDB,
},

model.ActionShardRowID: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
Expand Down Expand Up @@ -306,6 +264,14 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncIgnore,
buildDDLEventFunc: buildDDLEventForCreateDropView,
},
model.ActionModifyTableCharsetAndCollate: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionTruncateTablePartition: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalPartitionDDL,
updateDDLHistoryFunc: updateDDLHistoryForTruncatePartition,
Expand All @@ -314,7 +280,7 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForTruncateAndReorganizePartition,
buildDDLEventFunc: buildDDLEventForTruncateAndReorganizePartition,
},

// TODO: model.ActionDropView
model.ActionRecoverTable: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForCreateTable,
updateDDLHistoryFunc: updateDDLHistoryForAddDropTable,
Expand All @@ -323,6 +289,44 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNewTableDDL,
},
// TODO: model.ActionModifySchemaCharsetAndCollate
// TODO: model.LockTable
// TODO: model.UnlockTable
// TODO: model.ActionRepairTable
model.ActionSetTiFlashReplica: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTableForTiDB,
},
// TODO: model.ActionUpdateTiFlashReplicaStatus
model.ActionAddPrimaryKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
model.ActionDropPrimaryKey: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},

model.ActionAlterIndexVisibility: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},

model.ActionExchangeTablePartition: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForExchangePartition,
Expand All @@ -341,6 +345,14 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForCreateTables,
buildDDLEventFunc: buildDDLEventForCreateTables,
},
model.ActionMultiSchemaChange: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},

model.ActionReorganizePartition: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalPartitionDDL,
Expand All @@ -367,15 +379,6 @@ var allDDLHandlers = map[model.ActionType]*persistStorageDDLHandler{
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTableForTiDB,
},

model.ActionMultiSchemaChange: {
buildPersistedDDLEventFunc: buildPersistedDDLEventForNormalDDLOnSingleTable,
updateDDLHistoryFunc: updateDDLHistoryForNormalDDLOnSingleTable,
updateSchemaMetadataFunc: updateSchemaMetadataIgnore,
iterateEventTablesFunc: iterateEventTablesForSingleTableDDL,
extractTableInfoFunc: extractTableInfoFuncForSingleTableDDL,
buildDDLEventFunc: buildDDLEventForNormalDDLOnSingleTable,
},
}

func isPartitionTable(tableInfo *model.TableInfo) bool {
Expand Down

0 comments on commit d3efb33

Please sign in to comment.