diff --git a/src/vitess-tester/query.go b/src/vitess-tester/query.go index e14234c..c93cf5c 100644 --- a/src/vitess-tester/query.go +++ b/src/vitess-tester/query.go @@ -128,6 +128,7 @@ const ( Q_EMPTY_LINE Q_SKIP_IF_BELOW_VERSION Q_VEXPLAIN + Q_WAIT_FOR_AUTHORITATIVE ) type query struct { diff --git a/src/vitess-tester/tester.go b/src/vitess-tester/tester.go index af0e048..92ed763 100644 --- a/src/vitess-tester/tester.go +++ b/src/vitess-tester/tester.go @@ -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 diff --git a/src/vitess-tester/type.go b/src/vitess-tester/type.go index 1d463d3..5fec58f 100644 --- a/src/vitess-tester/type.go +++ b/src/vitess-tester/type.go @@ -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 {