You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reading this code the other day, I think I see a potentially racey access of some state in segment.Writer.
There is a test the uses it concurrently and that passes even with the race detector enabled. But it's only OK because it's making use of an implicit contract that Sealed is only called in the single writer thread and never concurrently with Append.
The int is the indexStart which is part of the writer state.
While reading this code the other day, I think I see a potentially racey access of some state in
segment.Writer
.There is a test the uses it concurrently and that passes even with the race detector enabled. But it's only OK because it's making use of an implicit contract that
Sealed
is only called in the single writer thread and never concurrently withAppend
.The int is the
indexStart
which is part of the writer state.raft-wal/segment/writer.go
Lines 40 to 59 in 50b7503
We note there that no synchronisation is needed because only the writer may access that state...
But then the
Sealed
method reads that property:raft-wal/segment/writer.go
Lines 511 to 521 in 50b7503
We didn't state in the docs that
Sealed
must not be called concurrently with Append although that is how we expect it to be used.It's minor as it won't affect WAL right now, however we should clean that up.
Possible options:
Sealed
may not be called concurrently withAppend
(and vice versa).Either way we should also:
writer
state around where that state is used since they are a bit misleading right now.The text was updated successfully, but these errors were encountered: