File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,20 @@ type flushableEntry struct {
7979 // Holds the timestamp of when the flush will be issued.
8080 delayedFlushForcedAt time.Time
8181 // logNum corresponds to the WAL that contains the records present in the
82- // receiver.
82+ // receiver. It is possible for multiple flushable entries to have the same
83+ // logNum:
84+ // 1. When a large batch is committed, it is not appended to the WAL.
85+ // Instead, the memtable is rotated, and the large batch is appended to the
86+ // flushable queue with a logNum that matches the newly immutable memtable.
87+ // Care is taken in DB.flush1 to ensure that the large batch is always
88+ // flushed alongside the memtable with the same logNum.
89+ // 2. During recovery, we replay WAL entries into the mutable memtable. The
90+ // memtable we allocate during recovery may be smaller than the memtable
91+ // that corresponded to the original WAL at the time it was written. This
92+ // means we may fill the memtable before finishing replaying the WAL,
93+ // resulting in multiple consecutive flushable entries all with the same
94+ // logNum. This is okay because we take care to flush all the flushables
95+ // during Open.
8396 logNum base.DiskFileNum
8497 // logSize is the size in bytes of the associated WAL. Protected by DB.mu.
8598 logSize uint64
You can’t perform that action at this time.
0 commit comments