Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

BR full restore won't rebase auto_random counter #241

Closed
3pointer opened this issue Apr 21, 2020 · 1 comment · Fixed by #248
Closed

BR full restore won't rebase auto_random counter #241

3pointer opened this issue Apr 21, 2020 · 1 comment · Fixed by #248
Labels
type/bug Something isn't working

Comments

@3pointer
Copy link
Collaborator

3pointer commented Apr 21, 2020

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    BR didn't rebase auto_random after restore

    1. set tidb config auto_random to true.
    2. create table t(a int key auto_random); insert into t values (), (), ();
    3. br backup table --db t --table t --pd xxx -s xxx
    4. drop table t
    5. br restore table --db t --table t --pd xxx -s xxx
    6. insert into t values (),(),();

before backup:

MySQL [t]> select a & b'0000011111111111111111111111111' from t.t;
+----------------------------------------+
| a & b'0000011111111111111111111111111' |
+----------------------------------------+
|                                      1 |
|                                      2 |
|                                      3 |
+----------------------------------------+
  1. What did you expect to see?

after restore:

select a & b'0000011111111111111111111111111' from t.t;
+----------------------------------------+
| a & b'0000011111111111111111111111111' |
+----------------------------------------+
|                                      4 |
|                                      5 |
|                                      6 |
|                                      1 |
|                                      2 |
|                                      3 |
+----------------------------------------+
  1. What did you see instead?

after restore:

select a & b'0000011111111111111111111111111' from t.t;
+----------------------------------------+
| a & b'0000011111111111111111111111111' |
+----------------------------------------+
|                                      1 |
|                                      2 |
|                                      3 |
|                                      1 |
|                                      2 |
|                                      3 |
+----------------------------------------+
  1. What version of BR and TiDB/TiKV/PD are you using?
    master
@3pointer 3pointer added the type/bug Something isn't working label Apr 21, 2020
@shenli shenli changed the title BR full restore won't rebase auto_random column BR full restore won't rebase auto_random counter Apr 21, 2020
@bb7133
Copy link
Member

bb7133 commented Apr 24, 2020

The cause of this issue is that BR did not backup the "incremental part" of auto_random, and when restoring the data, TiDB cannot rebase the counter automatically since the restore is not in SQL layer.

In order to solve it, we need:

It will be fixed in release v3.1.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants