Questions about whether TiCDC will block GC recommendations after stopping

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

Original topic: ticdc停止后会阻挡GC推荐的疑问

| username: HACK

【TiDB Usage Environment】Production Environment or Test Environment or POC
【TiDB Version】
【Encountered Issue】
Cluster Version: 4.0.16
Issue:
According to the official documentation

it mentions that manually pausing changefeed will block the advancement of GC.

  • Stopped: Synchronization task stopped due to user manually pausing (pause) changefeed. Changefeed in this state will block GC advancement.

I tested it, and after manually stopping changefeed, the GC on the source side is still advancing, which does not match the description on the official website.
mysql> select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb;
±-------------------------±--------------------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
±-------------------------±--------------------------------------------------------------------------------------------------+
| bootstrapped | True |
| tidb_server_version | 52 |
| system_tz | Asia/Shanghai |
| new_collation_enabled | False |
| tikv_gc_leader_uuid | 6064e266ed00012 |
| tikv_gc_leader_desc | host:TIDBjsjdsjkxt02, pid:28057, start at 2022-06-24 10:27:58.041037014 +0800 CST m=+13.677271402 |
| tikv_gc_leader_lease | 20220625-09:26:58 +0800 |
| tikv_gc_enable | true |
| tikv_gc_run_interval | 10m0s |
| tikv_gc_life_time | 24h |
| tikv_gc_last_run_time | 20220625-09:17:58 +0800 |
| tikv_gc_safe_point | 20220624-09:17:58 +0800 |
| tikv_gc_auto_concurrency | true |
| tikv_gc_mode | distributed |
| tidb_4.0_minor_version | 1 |
±-------------------------±--------------------------------------------------------------------------------------------------+
15 rows in set (0.00 sec)

mysql> select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb;
±-------------------------±--------------------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
±-------------------------±--------------------------------------------------------------------------------------------------+
| bootstrapped | True |
| tidb_server_version | 52 |
| system_tz | Asia/Shanghai |
| new_collation_enabled | False |
| tikv_gc_leader_uuid | 6064e266ed00012 |
| tikv_gc_leader_desc | host:TIDBjsjdsjkxt02, pid:28057, start at 2022-06-24 10:27:58.041037014 +0800 CST m=+13.677271402 |
| tikv_gc_leader_lease | 20220625-09:35:58 +0800 |
| tikv_gc_enable | true |
| tikv_gc_run_interval | 10m0s |
| tikv_gc_life_time | 24h |
| tikv_gc_last_run_time | 20220625-09:27:58 +0800 |
| tikv_gc_safe_point | 20220624-09:27:58 +0800 |
| tikv_gc_auto_concurrency | true |
| tikv_gc_mode | distributed |
| tidb_4.0_minor_version | 1 |
±-------------------------±--------------------------------------------------------------------------------------------------+
15 rows in set (0.00 sec)

mysql> select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb;
±-------------------------±--------------------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
±-------------------------±--------------------------------------------------------------------------------------------------+
| bootstrapped | True |
| tidb_server_version | 52 |
| system_tz | Asia/Shanghai |
| new_collation_enabled | False |
| tikv_gc_leader_uuid | 6064e266ed00012 |
| tikv_gc_leader_desc | host:TIDBjsjdsjkxt02, pid:28057, start at 2022-06-24 10:27:58.041037014 +0800 CST m=+13.677271402 |
| tikv_gc_leader_lease | 20220625-09:40:58 +0800 |
| tikv_gc_enable | true |
| tikv_gc_run_interval | 10m0s |
| tikv_gc_life_time | 24h |
| tikv_gc_last_run_time | 20220625-09:37:58 +0800 |
| tikv_gc_safe_point | 20220624-09:37:58 +0800 |
| tikv_gc_auto_concurrency | true |
| tikv_gc_mode | distributed |
| tidb_4.0_minor_version | 1 |
±-------------------------±--------------------------------------------------------------------------------------------------+
15 rows in set (0.00 sec)

Looking at the GC point, it is also changing.
[tidb@TIDBjsjdsjkxt01 ~]$ pd-ctl -u “http://xxx.xxx.xxx:2379” service-gc-safepoint
{
“service_gc_safe_points”: [
{
“service_id”: “gc_worker”,
“expired_at”: 9223372036854775807,
“safe_point”: 434120183792533504
},
{
“service_id”: “ticdc”,
“expired_at”: 1656210087,
“safe_point”: 434142887324155913
}
],
“gc_safe_point”: 434120183792533504
}

[tidb@TIDBjsjdsjkxt01 ~]$ pd-ctl -u “http://xxx.xxx.xxx:2379” service-gc-safepoint
{
“service_gc_safe_points”: [
{
“service_id”: “gc_worker”,
“expired_at”: 9223372036854775807,
“safe_point”: 434120183792533504
},
{
“service_id”: “ticdc”,
“expired_at”: 1656210210,
“safe_point”: 434142894598651904
}
],
“gc_safe_point”: 434120183792533504
}

[tidb@TIDBjsjdsjkxt01 ~]$ pd-ctl -u “http://xxx.xxx.xxx:2379” service-gc-safepoint
{
“service_gc_safe_points”: [
{
“service_id”: “gc_worker”,
“expired_at”: 9223372036854775807,
“safe_point”: 434120183792533504
},
{
“service_id”: “ticdc”,
“expired_at”: 1656210330,
“safe_point”: 434142894598651904
}
],
“gc_safe_point”: 434120183792533504
}

【Reproduction Path】What operations were performed to encounter the issue
【Issue Phenomenon and Impact】

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: hey-hoho | Original post link

Let me explain my understanding:
The GC mentioned here does not refer to the TiKV GC safepoint, but rather the TiCDC GC safepoint. It is a GC safepoint registered by TiCDC with PD to protect TiCDC’s data from being cleaned up by TiKV GC.

Refer to these two explanations for clarity:

It’s a bit convoluted, so take a moment to sort it out carefully.

| username: hey-hoho | Original post link

Seeing is believing.

| username: HACK | Original post link

:sweat_smile: I might have misread the line, the safe point should not have changed. That would be consistent with what was said.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.