TiDB v6.5 truncate table tikv space not released

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

Original topic: TiDB v6.5 truncate 表tikv 空间不释放

| username: TiDBer_ZsnVPQB4

[TiDB Usage Environment] Production Environment
[TiDB Version] v6.5.0
[Reproduction Path] truncate table table_name
[Encountered Problem: Phenomenon and Impact]
Truncate table on 3 large tables, which are 1.4T, 1.3T, and 700G respectively.
The disk space on the TiKV nodes is not being released. The gc_life_time is set to 1 hour, and it has been 5 days, but the space has still not been truly released. The statistics for the 1.4T and 1.3T tables have already become 0, and no more data will be inserted. The 700G table still has applications inserting data.

[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: WalterWj | Original post link

Provide feedback in the feedback section. You can try upgrading to a newer 6.5.x version.

| username: redgame | Original post link

Is the GC process running normally? The gc_life_time parameter is set correctly. You can use the pd-ctl tool to check the GC process.

| username: 大飞哥online | Original post link

Take a look at the GC page on the TiKV-Details monitoring panel.

| username: 大飞哥online | Original post link

Check the corresponding monitoring and look at the GC status.

| username: h5n1 | Original post link

Check the result of pd-ctl service-gc-safepoint --pd <pd-addrs>.

| username: TiDBer_ZsnVPQB4 | Original post link

| username: 大飞哥online | Original post link

Starting from the 29th, we began to truncate the table. Looking at the monitoring data from the 29th to the 1st, there was a lot of GC processing, but it decreased significantly afterward.

| username: TiDBer_ZsnVPQB4 | Original post link

pd-ctl service-gc-safepoint --pd

| username: TiDBer_ZsnVPQB4 | Original post link

Yes, the disk space on the TiKV node is not being released. It is at 85% capacity and still increasing.

| username: h5n1 | Original post link

GC is stuck. Use pd-ctl tso 443831....... to check the timestamp, it should be June 15th at 23:00 on your monitoring. Find the GC leader’s TiDB node from mysql.tidb and check the tidb.log.

| username: 大飞哥online | Original post link

Normally, gc_safe_point should be 0, right?

| username: 大飞哥online | Original post link

It started lagging at this time: 2023-08-27 05:05:04.080000

| username: TiDBer_ZsnVPQB4 | Original post link

At this point in time, it should be caused by the BR full backup. It has been killed for a while, but it seems that the lock has not been released.

| username: TiDBer_ZsnVPQB4 | Original post link

My current gc_safe_point is continuously increasing.

| username: TiDBer_ZsnVPQB4 | Original post link

It’s done. The space has been released. Thank you, everyone.

| username: 大飞哥online | Original post link

Is it the reboot method?

| username: Kongdom | Original post link

What method did you use? :thinking:

| username: TiDBer_ZsnVPQB4 | Original post link

It takes quite a long time to release after killing the br full backup.

| username: 大飞哥online | Original post link

If allowed, wouldn’t it be faster to just restart the TiDB server? :face_with_peeking_eye: