Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hx235 committed Apr 18, 2024
1 parent e82fe7c commit bc3719d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ Status DBImpl::CloseHelper() {
}
for (auto& log : logs_) {
uint64_t log_number = log.writer->get_log_number();
Status s = log.ClearWriter();
Status s = log.ClearWriter(immutable_db_options_.use_fsync);
if (!s.ok()) {
ROCKS_LOG_WARN(
immutable_db_options_.info_log,
Expand Down
12 changes: 10 additions & 2 deletions db/db_impl/db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1680,9 +1680,17 @@ class DBImpl : public DB {
writer = nullptr;
return w;
}
Status ClearWriter() {
Status ClearWriter(bool use_fsync) {
// TODO: plumb Env::IOActivity, Env::IOPriority
Status s = writer->WriteBuffer(WriteOptions());
WriteOptions wopts;
Status s = writer->WriteBuffer(wopts);
if (s.ok()) {
IOOptions opts;
s = WritableFileWriter::PrepareIOOptions(wopts, opts);
if (s.ok()) {
s = writer->file()->Sync(opts, use_fsync);
}
}
delete writer;
writer = nullptr;
return s;
Expand Down
1 change: 1 addition & 0 deletions unreleased_history/behavior_changes/wal_sync_on_close.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB `Close()` will sync the WALs now

0 comments on commit bc3719d

Please sign in to comment.