TiKV CDC stops outputting data, errors, and heartbeats after a period of time following subscription

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tikv cdc 订阅后吐出一段时间数据后无任何error和数据、心跳吐出

| username: 迷人的Ti

[TiDB Usage Environment] Production Environment
[TiDB Version] 5.4.3 Single-node Cluster Deployment (1 PD, 1 TiDB, 3 TiKV)
[Reproduction Path] Using TiKV client Java to subscribe to region CDC data:


Initially, there are some heartbeat or data outputs:

Then, although there are continuous data changes, the CDC client for this region does not receive any data, and there are no error events or heartbeat events.

[Encountered Problem: Phenomenon and Impact]
Initially receiving some data or heartbeats indicates that the subscription request is not problematic. If TiKV outputs data, I can receive it, and the network is stable, and the TiKV cluster is healthy. However, later on, no events are received at all.
What could be the reason? Do I need to adjust any parameters or code? Please advise, thank you!

| username: pingyu | Original post link

What version of client-java?

| username: 迷人的Ti | Original post link

The version is 3.3.3

| username: xfworld | Original post link

What issue caused the events to not be received? Are there logs retained for this period?

| username: TiDBer_小阿飞 | Original post link

The link you provided leads to a specific article on JianShu, which I cannot access directly. Please provide the text you need translated, and I will translate it for you.

| username: 迷人的Ti | Original post link

After receiving error events for some regions, the main error events for these regions are normal errors like “not leader.” You can simply resubscribe. However, after resubscribing, there are no event pushes. There are no errors in the tikv.log.

| username: 迷人的Ti | Original post link

Thank you for sharing, but it seems that my question was not addressed: why doesn’t TiKV push CDC events?

| username: xfworld | Original post link

Here are a few questions:

  1. The only component in TiDB that can implement change subscriptions is TiCDC.
  2. Through what mechanism does the TiKV client achieve subscriptions?
  3. Can it be connected to the TiCDC component?
| username: 迷人的Ti | Original post link

Hello, I’m glad to receive your reply.
The principle of the subscription implemented by the tikv client in Java should be similar to ticdc, which is also sending requests to pd via gRpc and then having tikv push the data back.
Currently, our business cannot interface with the ticdc component, so we want to get it directly through tikv.
Can you find any reasons for this? Or is there any other way in Java to obtain incremental data without relying on ticdc?

| username: Billmay表妹 | Original post link

Recommend installing TiCDC for the cluster~

Do not recommend using it in a roundabout way!

| username: xfworld | Original post link

Hard model…
It is recommended to use TiCDC…
Reduce mental burden…

| username: heiwandou | Original post link

CDC吧