Skip to content

Commit

Permalink
db: produce the FlushEnd event after installing readState
Browse files Browse the repository at this point in the history
This helps unit tests that use the callback to trigger a
read using an iterator with IterOptions.OnlyReadGuaranteedDurable.

Informs cockroachdb/cockroach#77046
  • Loading branch information
sumeerbhola committed Feb 26, 2022
1 parent cb84847 commit 2467b11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,6 @@ func (d *DB) flush1() error {
d.mu.versions.incrementCompactionBytes(-c.bytesWritten)

info.TotalDuration = d.timeNow().Sub(startTime)
d.opts.EventListener.FlushEnd(info)

// Refresh bytes flushed count.
atomic.StoreUint64(&d.atomic.bytesFlushed, 0)
Expand All @@ -1468,6 +1467,10 @@ func (d *DB) flush1() error {
// TODO(jackson): Remove this when range keys are persisted to sstables.
err = d.applyFlushedRangeKeys(flushed)
}
// Signal FlushEnd after installing the new readState. This helps for unit
// tests that use the callback to trigger a read using an iterator with
// IterOptions.OnlyReadGuaranteedDurable.
d.opts.EventListener.FlushEnd(info)

d.deleteObsoleteFiles(jobID, false /* waitForOngoing */)

Expand Down

0 comments on commit 2467b11

Please sign in to comment.