avoid ftruncate twice in buffered io
Summary: in buffered io, the filesize_ is the real size. Closes https://github.com/facebook/rocksdb/pull/1991 Differential Revision: D4711433 Pulled By: lightmark fbshipit-source-id: ad604b9
This commit is contained in:
parent
d52f334cbd
commit
9272e12f19
@ -184,12 +184,15 @@ Status WritableFileWriter::Close() {
|
||||
|
||||
s = Flush(); // flush cache to OS
|
||||
|
||||
Status interim;
|
||||
// In direct I/O mode we write whole pages so
|
||||
// we need to let the file know where data ends.
|
||||
Status interim = writable_file_->Truncate(filesize_);
|
||||
if (use_direct_io()) {
|
||||
interim = writable_file_->Truncate(filesize_);
|
||||
if (!interim.ok() && s.ok()) {
|
||||
s = interim;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_KILL_RANDOM("WritableFileWriter::Close:0", rocksdb_kill_odds);
|
||||
interim = writable_file_->Close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user