Skip to content

Commit

Permalink
comment: explain the sequence number and data race
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <eke@fastmail.com>
  • Loading branch information
ekexium committed Feb 12, 2025
1 parent de43ee4 commit a5e313d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/unionstore/art/art.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type ART struct {
missCount atomic.Uint64

// The counter of every write operation, used to invalidate iterators that were created before the write operation.
// The purpose of the counter is to tolerate interleaving of write and read operations (via iterator).
// It does not protect against data race. If it happens, there must be a bug in the caller code.
// invariant: no concurrent access to it
WriteSeqNo int
// Increased by 1 when an operation that may affect the content returned by "snapshot" (i.e. stage[0]) happens.
// It's used to invalidate snapshot iterators.
Expand Down

0 comments on commit a5e313d

Please sign in to comment.