Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infoschema: fix flashback integration test to make it more stable (pi…
Browse files Browse the repository at this point in the history
tiancaiamao authored and RidRisR committed May 23, 2024
1 parent a79ac6b commit 9e099a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/infoschema/infoschema_v2.go
Original file line number Diff line number Diff line change
@@ -17,7 +17,9 @@ package infoschema
import (
"fmt"
"math"
"strings"
"sync"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/ddl/placement"
@@ -582,6 +584,7 @@ func (is *infoschemaV2) SchemaTables(schema model.CIStr) (tables []table.Table)
return tables
}

retry:
dbInfo, ok := is.SchemaByName(schema)
if !ok {
return
@@ -596,6 +599,13 @@ func (is *infoschemaV2) SchemaTables(schema model.CIStr) (tables []table.Table)
if meta.ErrDBNotExists.Equal(err) {
return nil
}
// Flashback statement could cause such kind of error.
// In theory that error should be handled in the lower layer, like client-go.
// But it's not done, so we retry here.
if strings.Contains(err.Error(), "in flashback progress") {
time.Sleep(200 * time.Millisecond)
goto retry
}
// TODO: error could happen, so do not panic!
panic(err)
}

0 comments on commit 9e099a8

Please sign in to comment.