Skip to content

Commit

Permalink
Merge pull request #8 from vitessio/wait-auth
Browse files Browse the repository at this point in the history
add support for wait for authoritative table command
  • Loading branch information
harshit-gangal authored Jun 14, 2024
2 parents fb2f7c3 + d0b8826 commit eb95312
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/vitess-tester/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const (
Q_EMPTY_LINE
Q_SKIP_IF_BELOW_VERSION
Q_VEXPLAIN
Q_WAIT_FOR_AUTHORITATIVE
)

type query struct {
Expand Down
14 changes: 14 additions & 0 deletions src/vitess-tester/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ func (t *tester) Run() error {
}

t.vexplain = strs[1]
case Q_WAIT_FOR_AUTHORITATIVE:
strs := strings.Split(q.Query, " ")
if len(strs) != 2 {
t.reporter.AddFailure(t.vschema, fmt.Errorf("expected table name for wait_authoritative in: %v", q.Query))
continue
}

tblName := strs[1]
log.Infof("Waiting for authoritative schema for table %s", tblName)
err := utils.WaitForAuthoritative(t, t.keyspaceName, tblName, t.clusterInstance.VtgateProcess.ReadVSchema)
if err != nil {
t.reporter.AddFailure(t.vschema, fmt.Errorf("failed to wait for authoritative schema for table %s: %v", tblName, err))
continue
}
case Q_QUERY:
if t.skipNext {
t.skipNext = false
Expand Down
1 change: 1 addition & 0 deletions src/vitess-tester/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ var commandMap = map[string]CmdType{
"end_concurrent": Q_END_CONCURRENT,
"skip_if_below_version": Q_SKIP_IF_BELOW_VERSION,
"vexplain": Q_VEXPLAIN,
"wait_authoritative": Q_WAIT_FOR_AUTHORITATIVE,
}

func findType(cmdName string) CmdType {
Expand Down

0 comments on commit eb95312

Please sign in to comment.