Skip to content

Commit 562c8d4

Browse files
committed
internal/manifest: document relationship between LastSeqNum and WAL seqnums
Clarify commentary around logSeqNum/LastSeqNum. Unflushed WALs may contain sequence numbers less than the most recently persisted LastSeqNum.
1 parent 6d69292 commit 562c8d4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

internal/manifest/version_edit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ type VersionEdit struct {
150150

151151
// LastSeqNum is an upper bound on the sequence numbers that have been
152152
// assigned in flushed WALs. Unflushed WALs (that will be replayed during
153-
// recovery) may contain sequence numbers greater than this value.
153+
// recovery) may contain sequence numbers greater than this value. They're
154+
// also allowed to contain sequence numbers less than or equal to this value.
154155
LastSeqNum base.SeqNum
155156

156157
// A file num may be present in both deleted files and new files when it

version_set.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ const manifestMarkerName = `manifest`
3434
// to the MANIFEST file, which is replayed at startup.
3535
type versionSet struct {
3636
// Next seqNum to use for WAL writes.
37+
//
38+
// Note that unflushed WALs may contain sequence numbers less than, equal
39+
// to, or greater than logSeqNum. This is because every version edit
40+
// includes the current logSeqNum, so any version edits applied after a
41+
// write and before the flush of the write to a sstable will update
42+
// logSeqNum beyond the write's sequence number.
3743
logSeqNum base.AtomicSeqNum
3844

3945
// The upper bound on sequence numbers that have been assigned so far. A

0 commit comments

Comments
 (0)