Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: tidb 4.0.12 ,集群主备切换
tidb 4.0.12
initial-commit-ts
Specifies the transaction commit timestamp (commit ts) from which to start synchronization. This configuration is only applicable to Drainer nodes that are starting synchronization for the first time.
If a checkpoint already exists downstream, synchronization will proceed based on the time recorded in the checkpoint.
The commit ts (commit timestamp) is the transaction commit time in TiDB.
This timestamp is a globally unique, incrementing timestamp obtained from PD, serving as the unique ID for the current transaction. A typical initial-commit-ts configuration can be obtained in the following ways:
- The backup TS recorded in the metadata (backupmeta) of a BR backup
- The Pos recorded in the metadata of a Dumpling backup
- The result returned by the tso command in PD Control
Default: -1. Drainer will obtain the latest timestamp from PD as the initial time, meaning synchronization will start from the current time.
drainer_servers:
- host: 10.0.1.12
port: 8249
data_dir: “/tidb-data/drainer-8249”
commit_ts: -1
deploy_dir: “/tidb-deploy/drainer-8249”
config:
Conclusion: In the absence of a checkpoint, commit_ts will be used. Therefore, deleting the checkpoint can avoid duplicate data or primary key conflicts.
Question: When using Drainer for synchronization, when is the checkpoint updated? Or is the checkpoint never updated? How to check the master-slave synchronization status?