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

BR tool ErrRestoreTableIDMismatch error when using raw kv mode #35279

Closed
harshul4274 opened this issue Jun 9, 2022 · 0 comments · Fixed by #35641
Closed

BR tool ErrRestoreTableIDMismatch error when using raw kv mode #35279

harshul4274 opened this issue Jun 9, 2022 · 0 comments · Fixed by #35641
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 component/br This issue is related to BR of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@harshul4274
Copy link

1. Minimal reproduce step (Required)

Hello Everyone,

We have used pingcap TiDB Operator to deploy TiKV cluster in Kubernetes. We want to use TiKV only not TiDB, so we have disabled TiDB component.
We want to take backup of our TiKV data so we have setup one pod which has BR tool installed.
We are using below commands to take backup and restore it with raw mode:

Backup:
./br backup raw --pd "test-tikv-pd.tikv:2379"
--storage "s3://tikv/backup"
--s3.region "us-west-2"
--send-credentials-to-tikv=true
--start 1
--end zzzzzzzz
--ratelimit 128
--format raw
--cf default
--log-file backupfull.log

Restore:
./br restore raw --pd "test-tikv-pd.tikv:2379"
--storage "s3://tikv/backup"
--s3.region "us-west-2"
--send-credentials-to-tikv=true
--start 1
--end zzzzzzzz
--ratelimit 128
--format raw
--cf default
--log-file restore_raw.log

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

Ideally backup and restore should work with any key range in raw kv mode

3. What did you see instead (Required)

When we take backup using BR tool using above commands, backup works fine and we can see data also into our AWS S3 storage bucket, but when we try to restore that data using BR tool, it is giving below error:

Error: table id mismatch: [BR:Restore:ErrRestoreTableIDMismatch]restore table ID mismatch

After working with team on Slack (https://tidbcommunity.slack.com/archives/CH7TTLL7P/p1654330656688959?thread_ts=1653049435.952779&cid=CH7TTLL7P), we found that we can not take backup of keys that are starting with "t" because if we take backup of that keys (which are internal for TiDB) then at the time of restore it is giving error as mentioned above.

So for example below backup and restore command worked for us:

Backup:
./br backup raw --pd "test-tikv-pd.tikv:2379"
--storage "s3://tikv/backup"
--s3.region "us-west-2"
--send-credentials-to-tikv=true
--start k
--end l
--ratelimit 128
--format raw
--cf default
--log-file backupfull.log

Restore:
./br restore raw --pd "test-tikv-pd.tikv:2379"
--storage "s3://tikv/backup"
--s3.region "us-west-2"
--send-credentials-to-tikv=true
--start k
--end l
--ratelimit 128
--format raw
--cf default
--log-file restore_raw.log

But this workaround is not ideal because we cannot use keys starting with "t".

4. What is your TiDB version? (Required)

We are using TiDB Operator 1.3.3 and TiKV 5.4.1

@harshul4274 harshul4274 added the type/bug The issue is confirmed as a bug. label Jun 9, 2022
@ChenPeng2013 ChenPeng2013 added severity/major component/br This issue is related to BR of TiDB. labels Jun 10, 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 labels Jun 10, 2022
@3pointer 3pointer assigned pingyu and unassigned 3pointer Jun 16, 2022
@3pointer 3pointer added affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 and removed may-affects-4.0 This bug maybe affects 4.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-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 may-affects-6.1 labels Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 component/br This issue is related to BR of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants