Skip to content

Commit

Permalink
fix a bug related to BR
Browse files Browse the repository at this point in the history
  • Loading branch information
bb7133 committed Oct 24, 2024
1 parent 67e4fbf commit 2148bd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,6 @@ func (t *tester) handleBackupAndRestore(q query) error {
if err := t.executeStmt(renameStmt); err != nil {
return err
}
dupTableStmt := fmt.Sprintf("CREATE TABLE `%s` LIKE `%s`", t.backupAndRestore.sourceTable, tempTable)
if err := t.executeStmt(dupTableStmt); err != nil {
return err
}
if err := t.executeStmt(restoreStmt); err != nil {
return err
}
Expand Down Expand Up @@ -797,9 +793,13 @@ func (t *tester) Run() error {
}
t.replaceRegex = regex
case Q_BACKUP_AND_RESTORE:
t.handleBackupAndRestore(q)
if err := t.handleBackupAndRestore(q); err != nil {
return err
}
case Q_DUMP_AND_IMPORT:
t.handleDumpAndImport(q)
if err := t.handleDumpAndImport(q); err != nil {
return err
}
case Q_REPLICATION_CHECKPOINT:
if !isTiDB(t.mdb) {
return errors.New(fmt.Sprintf("replication_checkpoint is only supported on TiDB, line: %d sql:%v", q.Line, q.Query))
Expand Down
4 changes: 1 addition & 3 deletions t/br_integration.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Test BR and AutoIncrement

CREATE TABLE t1 (a INT PRIMARY KEY NONCLUSTERED AUTO_INCREMENT, b INT) AUTO_ID_CACHE = 1;
CREATE TABLE t1 (a INT PRIMARY KEY NONCLUSTERED AUTO_INCREMENT, b INT) AUTO_ID_CACHE = 100;
INSERT INTO t1 (b) VALUES (1), (2), (3);
SHOW TABLE t1 NEXT_ROW_ID;

--backup_and_restore t1 AS tt1

SHOW TABLE tt1 NEXT_ROW_ID;
INSERT INTO tt1 (b) VALUES (4), (5), (6);
SHOW TABLE tt1 NEXT_ROW_ID;

0 comments on commit 2148bd9

Please sign in to comment.