flow control for ticdc change feeds
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
There appears to be the chance that TiCDC changefeed streams can not keep up with the inflow of events of a TiDB cluster.
Ideally there should be a mechanism where TiCDC can pass feedback to TiDB to 'slow down' the permitted commit rate of transactions so that the checkpoint lag is reduced. ~This is because my understanding is that if the CDC replica gets too delayed, it won't be able to read old versions of rows (i.e. tidb_gc_life_time defaults to 10 minutes, but I expect most CDC users will increase it.)~ **Note:** It looks like my understanding here is incorrect. CDC will auto-extend the GC lifetime, but there are still problems with a large delay
Here are my suggestions for the TiDB server:
- Make `token-limit` dynamically configurable. See https://github.com/pingcap/tidb/issues/34583
- Add `tidb_commit_delay` for a sleep delay before committing in us.
By controlling the two variables, CDC should be able to automatically 'slow down tidb' once a threshold is crossed.
Contributor guide
Assessment
This issue has not been assessed yet.