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

【 TiDB 使用环境】生产环境 or 测试环境 or POC
【 TiDB 版本】
【遇到的问题】
集群版本:4.0.16
问题:
看官网
https://docs.pingcap.com/zh/tidb/v4.0/manage-ticdc
提到手工暂停changedfeed会阻挡GC的推进

  • Stopped:同步任务停止,由于用户手动暂停 (pause) changefeed。处于这个状态的 changefeed 会阻挡 GC 推进。

我测试了一下,手工停止changefeed以后,看源端的GC仍然在推进,跟官网描述的不符。
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)

看gc point也在变化
[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
}

【复现路径】做过哪些操作出现的问题
【问题现象及影响】

【附件】

请提供各个组件的 version 信息,如 cdc/tikv,可通过执行 cdc version/tikv-server --version 获取。

1 个赞

说下我的理解,
这里说的GC并不是指TiKV那个GC safepoint,而是指 TiCDC GC safepoint,它是TiCDC向PD注册的一个GC safepoint用来保护TiCDC的数据不会被TiKV GC清理。

参考下这两段说明就清楚了:
https://docs.pingcap.com/zh/tidb/v4.0/troubleshoot-ticdc#ticdc-的-gc-ttl-是什么
https://docs.pingcap.com/zh/tidb/v4.0/troubleshoot-ticdc#ticdc-gc-safepoint-的完整行为是什么

有点饶,仔细捋一下。

有图有真相

:sweat_smile:我可能看错行了,safe point应该是没有变化。那就符合所说的了。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。