Skip to content

Commit

Permalink
When destroying or resetting an open RecordWriter which uses parall…
Browse files Browse the repository at this point in the history
…elism,

do not interrupt background work. Wait for it to complete.

There might be a pending `FutureFlush()` in the queue of requests, which means
that pending writes before it are not necessarily irrelevant. The caller can
expect the flush to be eventually finished, which is as good as closing.

PiperOrigin-RevId: 624863444
  • Loading branch information
QrczakMK committed Apr 15, 2024
1 parent 7c98e1d commit 5d75119
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions riegeli/records/record_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,7 @@ inline RecordWriterBase::ParallelWorker::ParallelWorker(
}

RecordWriterBase::ParallelWorker::~ParallelWorker() {
if (ABSL_PREDICT_FALSE(state_.is_open())) {
// Ask the chunk writer thread to stop working and exit.
ParallelWorker::FailWithoutAnnotation(absl::CancelledError());
Done();
}
if (ABSL_PREDICT_FALSE(state_.is_open())) Done();
}

void RecordWriterBase::ParallelWorker::Done() {
Expand Down

0 comments on commit 5d75119

Please sign in to comment.