Skip to content

Commit

Permalink
fix(client): CompareAndSwap
Browse files Browse the repository at this point in the history
Signed-off-by: James Yin <[email protected]>
  • Loading branch information
ifplusor committed Sep 6, 2023
1 parent 5be65e6 commit 8ac9ade
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/pkg/eventlog/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *segment) Update(ctx context.Context, r *record.Segment, towrite bool) e
// When a segment become read-only, the end offset needs to be set to the real value.
// TODO(wenfeng) data race?
s.lastEventBornAt = r.LastEventBornAt
if s.Writable() && !r.Writable && s.writable.CAS(true, false) {
if s.Writable() && !r.Writable && s.writable.CompareAndSwap(true, false) {
s.endOffset.Store(r.EndOffset)
return nil
}
Expand Down

0 comments on commit 8ac9ade

Please sign in to comment.