From 9f9ebbf00bacf131c124f76763b62e9c09b20cc9 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 22 Mar 2023 15:03:53 +0800 Subject: [PATCH] use revision for watch Signed-off-by: Ryan Leung --- pkg/tso/tso.go | 2 +- tests/client/client_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/tso/tso.go b/pkg/tso/tso.go index 0b4ad7da745..110f221afde 100644 --- a/pkg/tso/tso.go +++ b/pkg/tso/tso.go @@ -198,7 +198,7 @@ func (t *timestampOracle) isInitialized() bool { // resetUserTimestamp update the TSO in memory with specified TSO by an atomically way. // When ignoreSmaller is true, resetUserTimestamp will ignore the smaller tso resetting error and do nothing. -// It's used to write MaxTS during the Global TSO synchronization whitout failing the writing as much as possible. +// It's used to write MaxTS during the Global TSO synchronization without failing the writing as much as possible. // cannot set timestamp to one which >= current + maxResetTSGap func (t *timestampOracle) resetUserTimestamp(leadership *election.Leadership, tso uint64, ignoreSmaller bool) error { return t.resetUserTimestampInner(leadership, tso, ignoreSmaller, false) diff --git a/tests/client/client_test.go b/tests/client/client_test.go index ebf2d1f9982..48f6b8eaeb5 100644 --- a/tests/client/client_test.go +++ b/tests/client/client_test.go @@ -1358,7 +1358,10 @@ func TestWatch(t *testing.T) { defer client.Close() key := "test" - ch, err := client.Watch(ctx, []byte(key)) + resp, err := client.Get(ctx, []byte(key)) + re.NoError(err) + rev := resp.GetHeader().GetRevision() + ch, err := client.Watch(ctx, []byte(key), pd.WithRev(rev)) re.NoError(err) exit := make(chan struct{}) go func() {