Dumpling specifying the --snapshot parameter cannot export data from a specific snapshot, it still exports the latest data

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

Original topic: dumpling 指定–snapshot 参数,无法导出某个快照的数据,导出的还是最新的数据

| username: TiDBer_yUoxD0vR

【TiDB Usage Environment】Production Environment / Test / Poc
【TiDB Version】3.0.13
【Reproduction Path】What operations were performed to cause the issue

root@192.168.8.11:4000 12:51:24 [testdb01]>create table t (c int);
Query OK, 0 rows affected (1.03 sec)

root@192.168.8.11:4000 12:51:30 [testdb01]>
root@192.168.8.11:4000 12:51:34 [testdb01]>insert into t values (1), (2), (3);
Query OK, 3 rows affected (0.02 sec)
Records: 3 Duplicates: 0 Warnings: 0

root@192.168.8.11:4000 12:51:36 [testdb01]>select * from t;
±-----+
| c |
±-----+
| 1 |
| 2 |
| 3 |
±-----+
3 rows in set (0.00 sec)

root@192.168.8.11:4000 12:57:50 [testdb01]>

Update data, change 2 to 22

root@192.168.8.11:4000 12:57:50 [testdb01]>select now();update t set c=22 where c=2;
±--------------------+
| now() |
±--------------------+
| 2023-03-12 12:58:00 |
±--------------------+
1 row in set (0.00 sec)

Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0

root@192.168.8.11:4000 12:58:00 [testdb01]>select * from t;
±-----+
| c |
±-----+
| 1 |
| 22 |
| 3 |
±-----+
3 rows in set (0.00 sec)

Set snapshot time point

root@192.168.8.11:4000 12:58:03 [testdb01]>set @@tidb_snapshot=“2023-03-12 12:57:00”;
Query OK, 0 rows affected (0.02 sec)

The snapshot data at “2023-03-12 12:57:00” is the previous data

root@192.168.8.11:4000 12:58:38 [testdb01]>select * from t;
±-----+
| c |
±-----+
| 1 |
| 2 |
| 3 |
±-----+
3 rows in set (0.00 sec)

GC is 24 hours, ensuring GC will not be cleaned

root@192.168.8.11:4000 12:58:40 [testdb01]>select * from mysql.tidb where variable_name=‘tikv_gc_life_time’;
±------------------±---------------±---------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE | COMMENT |
±------------------±---------------±---------------------------------------------------------------------------------------+
| tikv_gc_life_time | 24h | All versions within life time will not be collected by GC, at least 10m, in Go format. |
±------------------±---------------±---------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

TiDB version TiDB-v3.0.13

root@192.168.8.11:4000 12:58:58 [testdb01]>\s

mysql Ver 14.14 Distrib 5.7.32, for linux-glibc2.12 (x86_64) using EditLine wrapper

Connection id: 54
Current database: testdb01
Current user: root@192.168.8.11
SSL: Not in use
Current pager: stdout
Using outfile: ‘’
Using delimiter: ;
Server version: 5.7.25-TiDB-v3.0.13 MySQL Community Server (Apache License 2.0)
Protocol version: 10
Connection: 192.168.8.11 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8
Conn. characterset: utf8
TCP port: 4000

Use dumpling to export the snapshot data at “2023-03-12 12:57:00”

[root@test01 tmpdata]# dumpling --snapshot “2023-03-12 12:57:00” -uroot -P4000 -h 192.168.8.11 -p’123456’ --filetype sql -t 8 -r 200000 -F 256MiB -T testdb01.t --consistency snapshot -o ./d1
Release version:
Git commit hash: 0175843056a6068dd2f64afca6277d890934b63c
Git branch: master
Build timestamp: 2020-06-08 02:26:25Z
Go version: go version go1.13.4 linux/amd64

[2023/03/12 13:00:32.932 +08:00] [INFO] [config.go:118] [“detect server type”] [type=TiDB]
[2023/03/12 13:00:32.932 +08:00] [INFO] [config.go:136] [“detect server version”] [version=3.0.13]
[2023/03/12 13:00:32.944 +08:00] [WARN] [black_white_list.go:15] [“unsupported dump schema in TiDB now”] [schema=PERFORMANCE_SCHEMA]
[2023/03/12 13:00:32.944 +08:00] [WARN] [black_white_list.go:15] [“unsupported dump schema in TiDB now”] [schema=mysql]
[2023/03/12 13:00:32.944 +08:00] [WARN] [black_white_list.go:15] [“unsupported dump schema in TiDB now”] [schema=INFORMATION_SCHEMA]
[2023/03/12 13:00:32.993 +08:00] [INFO] [main.go:178] [“dump data successfully, dumpling will exit now”]
[root@test01 tmpdata]# cat d1/testdb01
testdb01-schema-create.sql testdb01.t.0.sql testdb01.t-schema.sql

The exported data is the latest data 22, not the snapshot data 2 at “2023-03-12 12:57:00”. Why is that?

[root@test01 tmpdata]# cat d1/testdb01.t.0.sql
/!40101 SET NAMES binary/;
INSERT INTO t VALUES
(1),
(22),
(3);
[root@test01 tmpdata]# dumpling --version
Release version:
Git commit hash: 0175843056a6068dd2f64afca6277d890934b63c
Git branch: master
Build timestamp: 2020-06-08 02:26:25Z
Go version: go version go1.13.4 linux/amd64

[root@test01 tmpdata]#

【Encountered Problem: Problem Phenomenon and Impact】
dumpling specifies the --snapshot parameter but cannot export data from a specific snapshot, it still exports the latest data
【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】

| username: xfworld | Original post link

The documentation for version 3.X is no longer available, maybe you should upgrade…

I feel that the snapshot feature is not supported.

Found a little bit: mydumper
Refer to this
https://docs.pingcap.com/zh/tidb/v3.0/mydumper-overview

| username: Billmay表妹 | Original post link

It is recommended to upgrade, as many issues in the older versions have actually been resolved in the higher versions.

| username: 裤衩儿飞上天 | Original post link

This… I don’t even have an environment to verify it :dizzy_face: :dizzy_face: :dizzy_face:

| username: tidb菜鸟一只 | Original post link

I can’t even get the environment for version 3, so I can’t reproduce it at all.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.