Skip to content

log truncate: delete the data by mistake #38939

@Leavrth

Description

@Leavrth

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions