Skip to content

Commit

Permalink
Merge pull request #16223 from kensou97/fix-barrier
Browse files Browse the repository at this point in the history
clientv3: fix barrier.Wait() still block after barrier.Release()
  • Loading branch information
ahrtr authored Aug 1, 2023
2 parents 9ad5189 + c3e5201 commit 8524903
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/v3/experimental/recipes/barrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (b *Barrier) Wait() error {
_, err = WaitEvents(
b.client,
b.key,
resp.Header.Revision,
[]mvccpb.Event_EventType{mvccpb.PUT, mvccpb.DELETE})
resp.Header.Revision+1,
[]mvccpb.Event_EventType{mvccpb.DELETE})
return err
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package recipes_test

import (
"context"
"testing"
"time"

Expand Down Expand Up @@ -46,6 +47,11 @@ func testBarrier(t *testing.T, waiters int, chooseClient func() *clientv3.Client
t.Fatalf("able to double-hold barrier")
}

// put a random key to move the revision forward
if _, err := chooseClient().Put(context.Background(), "x", ""); err != nil {
t.Errorf("could not put x (%v)", err)
}

donec := make(chan struct{})
stopc := make(chan struct{})
defer close(stopc)
Expand Down

0 comments on commit 8524903

Please sign in to comment.