Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log truncate: delete the data by mistake #38939

Closed
Leavrth opened this issue Nov 7, 2022 · 0 comments · Fixed by #38870
Closed

log truncate: delete the data by mistake #38939

Leavrth opened this issue Nov 7, 2022 · 0 comments · Fixed by #38870
Labels
affects-6.4 component/br This issue is related to BR of TiDB. may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 severity/critical type/bug This issue is a bug.

Comments

@Leavrth
Copy link
Contributor

Leavrth commented Nov 7, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. prepare 2 meta

meta1:

{
    "file_groups": [
        {
            "path": "v1/20221031/06/18/schema-meta/437045466125041735-ce0e9757-14c4-484d-a42a-1cc742338363.log",
            "data_files_info": [
                {
                    "sha256": "l+01PuAHw7Hc4Pc4dzgNQFpKwBSwkpwLT8ta2hEjP10=",
                    "number_of_entries": 7,
                    "min_ts": 433344455566677711,
                    "max_ts": 433344455566677722,
                    "resolved_ts": 433344455566677711,
                    "region_id": 37,
                    "start_key": "bURCOjM0Nzj/AP4AAAAAAAD/AGhUSUQ6MzX/MTX/AAAAAAD/AAAA9wAAAAD7+e9NchOj/uk=",
                    "end_key": "bURCOjM0Nzj/AP4AAAAAAAD/AGhUSUQ6NjL/Njj/AAAAAAD/AAAA9wAAAAD7+e9Ncm13//k=",
                    "cf": "default",
                    "type": 1,
                    "is_meta": true,
                    "length": 568,
                    "min_begin_ts_in_default_cf": 0,
                    "range_length": 253,
                    "compression_type": 3
                }
            ],
            "min_ts": 433344455566677711,
            "max_ts": 433344455566677722,
            "min_resolved_ts": 433344455566677711,
            "length": 253
        }
    ],
    "store_id": 18,
    "resolved_ts": 433344455566677711,
    "max_ts": 433344455566677722,
    "min_ts": 433344455566677711,
    "meta_version": 1
}

meta2:

{
    "file_groups": [
        {
            "path": "v1/20221031/06/18/schema-meta/437045466125041735-ce0e9757-14c4-484d-a42a-1cc742338363.log",
            "data_files_info": [
                {
                    "sha256": "l+01PuAHw7Hc4Pc4dzgNQFpKwBSwkpwLT8ta2hEjP10=",
                    "number_of_entries": 7,
                    "min_ts": 433344455566677733,
                    "max_ts": 433344455566677744,
                    "resolved_ts": 433344455566677733,
                    "region_id": 37,
                    "start_key": "bURCOjM0Nzj/AP4AAAAAAAD/AGhUSUQ6MzX/MTX/AAAAAAD/AAAA9wAAAAD7+e9NchOj/uk=",
                    "end_key": "bURCOjM0Nzj/AP4AAAAAAAD/AGhUSUQ6NjL/Njj/AAAAAAD/AAAA9wAAAAD7+e9Ncm13//k=",
                    "cf": "write",
                    "type": 1,
                    "is_meta": true,
                    "length": 568,
                    "min_begin_ts_in_default_cf": 433344455566677711,
                    "range_length": 253,
                    "compression_type": 3
                }
            ],
            "min_ts": 433344455566677733,
            "max_ts": 433344455566677744,
            "min_resolved_ts": 433344455566677733,
            "length": 253
        }
    ],
    "store_id": 18,
    "resolved_ts": 433344455566677733,
    "max_ts": 433344455566677744,
    "min_ts": 433344455566677733,
    "meta_version": 1
}
  1. run the truncate
br log truncate -s "..." --until "433344455566677730"

2. What did you expect to see? (Required)

output should be this:

Detail BR log in /tmo/br.log.....
Reading Metadata... DONE { take = 5ms }
We are going to remove 0 files, until ...
Sure? (y/N)

3. What did you see instead (Required)

output is this:

Detail BR log in /tmo/br.log.....
Reading Metadata... DONE { take = 5ms }
We are going to remove 1 files, until ...
Sure? (y/N)

4. What is your TiDB version? (Required)

master

@Leavrth Leavrth added the type/bug This issue is a bug. label Nov 7, 2022
@Leavrth Leavrth linked a pull request Nov 7, 2022 that will close this issue
12 tasks
@fubinzh fubinzh added severity/moderate component/br This issue is related to BR of TiDB. severity/critical and removed severity/moderate labels Nov 7, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Nov 7, 2022
ti-chi-bot pushed a commit that referenced this issue Nov 8, 2022
Leavrth added a commit to Leavrth/tidb that referenced this issue Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.4 component/br This issue is related to BR of TiDB. may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 severity/critical type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants