|
|
@ -27,7 +27,7 @@ const size_t kFadviseTrigger = 1024 * 1024; // 1MB |
|
|
|
struct SstFileWriter::Rep { |
|
|
|
struct SstFileWriter::Rep { |
|
|
|
Rep(const EnvOptions& _env_options, const Options& options, |
|
|
|
Rep(const EnvOptions& _env_options, const Options& options, |
|
|
|
Env::IOPriority _io_priority, const Comparator* _user_comparator, |
|
|
|
Env::IOPriority _io_priority, const Comparator* _user_comparator, |
|
|
|
ColumnFamilyHandle* _cfh, bool _invalidate_page_cache) |
|
|
|
ColumnFamilyHandle* _cfh, bool _invalidate_page_cache, bool _skip_filters) |
|
|
|
: env_options(_env_options), |
|
|
|
: env_options(_env_options), |
|
|
|
ioptions(options), |
|
|
|
ioptions(options), |
|
|
|
mutable_cf_options(options), |
|
|
|
mutable_cf_options(options), |
|
|
@ -35,7 +35,8 @@ struct SstFileWriter::Rep { |
|
|
|
internal_comparator(_user_comparator), |
|
|
|
internal_comparator(_user_comparator), |
|
|
|
cfh(_cfh), |
|
|
|
cfh(_cfh), |
|
|
|
invalidate_page_cache(_invalidate_page_cache), |
|
|
|
invalidate_page_cache(_invalidate_page_cache), |
|
|
|
last_fadvise_size(0) {} |
|
|
|
last_fadvise_size(0), |
|
|
|
|
|
|
|
skip_filters(_skip_filters) {} |
|
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<WritableFileWriter> file_writer; |
|
|
|
std::unique_ptr<WritableFileWriter> file_writer; |
|
|
|
std::unique_ptr<TableBuilder> builder; |
|
|
|
std::unique_ptr<TableBuilder> builder; |
|
|
@ -54,6 +55,7 @@ struct SstFileWriter::Rep { |
|
|
|
// The size of the file during the last time we called Fadvise to remove
|
|
|
|
// The size of the file during the last time we called Fadvise to remove
|
|
|
|
// cached pages from page cache.
|
|
|
|
// cached pages from page cache.
|
|
|
|
uint64_t last_fadvise_size; |
|
|
|
uint64_t last_fadvise_size; |
|
|
|
|
|
|
|
bool skip_filters; |
|
|
|
Status Add(const Slice& user_key, const Slice& value, |
|
|
|
Status Add(const Slice& user_key, const Slice& value, |
|
|
|
const ValueType value_type) { |
|
|
|
const ValueType value_type) { |
|
|
|
if (!builder) { |
|
|
|
if (!builder) { |
|
|
@ -122,9 +124,9 @@ SstFileWriter::SstFileWriter(const EnvOptions& env_options, |
|
|
|
const Comparator* user_comparator, |
|
|
|
const Comparator* user_comparator, |
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
bool invalidate_page_cache, |
|
|
|
bool invalidate_page_cache, |
|
|
|
Env::IOPriority io_priority) |
|
|
|
Env::IOPriority io_priority, bool skip_filters) |
|
|
|
: rep_(new Rep(env_options, options, io_priority, user_comparator, |
|
|
|
: rep_(new Rep(env_options, options, io_priority, user_comparator, |
|
|
|
column_family, invalidate_page_cache)) { |
|
|
|
column_family, invalidate_page_cache, skip_filters)) { |
|
|
|
rep_->file_info.file_size = 0; |
|
|
|
rep_->file_info.file_size = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -189,8 +191,8 @@ Status SstFileWriter::Open(const std::string& file_path) { |
|
|
|
TableBuilderOptions table_builder_options( |
|
|
|
TableBuilderOptions table_builder_options( |
|
|
|
r->ioptions, r->internal_comparator, &int_tbl_prop_collector_factories, |
|
|
|
r->ioptions, r->internal_comparator, &int_tbl_prop_collector_factories, |
|
|
|
compression_type, r->ioptions.compression_opts, |
|
|
|
compression_type, r->ioptions.compression_opts, |
|
|
|
nullptr /* compression_dict */, false /* skip_filters */, |
|
|
|
nullptr /* compression_dict */, r->skip_filters, r->column_family_name, |
|
|
|
r->column_family_name, unknown_level); |
|
|
|
unknown_level); |
|
|
|
r->file_writer.reset( |
|
|
|
r->file_writer.reset( |
|
|
|
new WritableFileWriter(std::move(sst_file), r->env_options)); |
|
|
|
new WritableFileWriter(std::move(sst_file), r->env_options)); |
|
|
|
|
|
|
|
|
|
|
|