提交 7a23a217 编写于 作者: A Andrew Kryczka 提交者: Facebook GitHub Bot

enable Status check assertions for sst_file_reader_test (#7448)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7448

Reviewed By: jay-zhuang

Differential Revision: D23973281

Pulled By: ajkr

fbshipit-source-id: 90fe55f1db904f1a236f3f7994d0806b8d24282c
上级 d71cfe04
......@@ -613,6 +613,7 @@ ifdef ASSERT_STATUS_CHECKED
options_test \
random_test \
range_del_aggregator_test \
sst_file_reader_test \
range_tombstone_fragmenter_test \
repeatable_thread_test \
skiplist_test \
......
......@@ -99,9 +99,7 @@ struct SstFileWriter::Rep {
file_info.largest_key.assign(user_key.data(), user_key.size());
file_info.file_size = builder->FileSize();
InvalidatePageCache(false /* closing */);
return Status::OK();
return InvalidatePageCache(false /* closing */);
}
Status DeleteRange(const Slice& begin_key, const Slice& end_key) {
......@@ -135,15 +133,14 @@ struct SstFileWriter::Rep {
file_info.num_range_del_entries++;
file_info.file_size = builder->FileSize();
InvalidatePageCache(false /* closing */);
return Status::OK();
return InvalidatePageCache(false /* closing */);
}
void InvalidatePageCache(bool closing) {
Status InvalidatePageCache(bool closing) {
Status s = Status::OK();
if (invalidate_page_cache == false) {
// Fadvise disabled
return;
return s;
}
uint64_t bytes_since_last_fadvise =
builder->FileSize() - last_fadvise_size;
......@@ -151,11 +148,16 @@ struct SstFileWriter::Rep {
TEST_SYNC_POINT_CALLBACK("SstFileWriter::Rep::InvalidatePageCache",
&(bytes_since_last_fadvise));
// Tell the OS that we don't need this file in page cache
file_writer->InvalidateCache(0, 0);
s = file_writer->InvalidateCache(0, 0);
if (s.IsNotSupported()) {
// NotSupported is fine as it could be a file type that doesn't use page
// cache.
s = Status::OK();
}
last_fadvise_size = builder->FileSize();
}
return s;
}
};
SstFileWriter::SstFileWriter(const EnvOptions& env_options,
......@@ -306,7 +308,9 @@ Status SstFileWriter::Finish(ExternalSstFileInfo* file_info) {
if (s.ok()) {
s = r->file_writer->Sync(r->ioptions.use_fsync);
r->InvalidatePageCache(true /* closing */);
if (s.ok()) {
s = r->InvalidatePageCache(true /* closing */);
}
if (s.ok()) {
s = r->file_writer->Close();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册