github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/pkg/cputil/table.go (about) 1 // Copyright 2020 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package cputil 15 16 import ( 17 "fmt" 18 19 "github.com/pingcap/tiflow/dm/pkg/utils" 20 ) 21 22 const maxSchemaLength = 64 23 24 // LoaderCheckpoint returns loader's checkpoint table name. 25 func LoaderCheckpoint(task string) string { 26 return task + "_loader_checkpoint" 27 } 28 29 // LightningCheckpoint returns lightning's checkpoint table name. 30 func LightningCheckpoint(task string) string { 31 return task + "_lightning_checkpoint_list" 32 } 33 34 // LightningCheckpointSchema returns lightning's checkpoint schema name. 35 func LightningCheckpointSchema(task string, sourceID string) string { 36 if task == "" { 37 return "tidb_lightning_checkpoint" 38 } 39 return utils.TruncateStringQuiet( 40 fmt.Sprintf("%s_%d_tidb_lightning_checkpoint", task, utils.GenHashKey(sourceID)), 41 maxSchemaLength) 42 } 43 44 // SyncerCheckpoint returns syncer's checkpoint table name. 45 func SyncerCheckpoint(task string) string { 46 return task + "_syncer_checkpoint" 47 } 48 49 // SyncerShardMeta returns syncer's sharding meta table name for pessimistic. 50 func SyncerShardMeta(task string) string { 51 return task + "_syncer_sharding_meta" 52 } 53 54 // SyncerOnlineDDL returns syncer's onlineddl checkpoint table name. 55 func SyncerOnlineDDL(task string) string { 56 return task + "_onlineddl" 57 } 58 59 func ValidatorCheckpoint(task string) string { 60 return task + "_validator_checkpoint" 61 } 62 63 func ValidatorPendingChange(task string) string { 64 return task + "_validator_pending_change" 65 } 66 67 func ValidatorErrorChange(task string) string { 68 return task + "_validator_error_change" 69 } 70 71 func ValidatorTableStatus(task string) string { 72 return task + "_validator_table_status" 73 }