@@ -576,7 +576,7 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
576
576
auto table_cache = cfd_->table_cache ();
577
577
auto ioptions = cfd_->ioptions ();
578
578
Status s = table_cache->GetTableProperties (
579
- vset_-> env_options_ , cfd_->internal_comparator (), file_meta->fd ,
579
+ env_options_, cfd_->internal_comparator (), file_meta->fd ,
580
580
tp, true /* no io */ );
581
581
if (s.ok ()) {
582
582
return s;
@@ -599,7 +599,7 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
599
599
TableFileName (vset_->db_options_ ->db_paths , file_meta->fd .GetNumber (),
600
600
file_meta->fd .GetPathId ());
601
601
}
602
- s = ioptions->env ->NewRandomAccessFile (file_name, &file, vset_-> env_options_ );
602
+ s = ioptions->env ->NewRandomAccessFile (file_name, &file, env_options_);
603
603
if (!s.ok ()) {
604
604
return s;
605
605
}
@@ -711,7 +711,7 @@ size_t Version::GetMemoryUsageByTableReaders() {
711
711
for (auto & file_level : storage_info_.level_files_brief_ ) {
712
712
for (size_t i = 0 ; i < file_level.num_files ; i++) {
713
713
total_usage += cfd_->table_cache ()->GetMemoryUsageByTableReader (
714
- vset_-> env_options_ , cfd_->internal_comparator (),
714
+ env_options_, cfd_->internal_comparator (),
715
715
file_level.files [i].fd );
716
716
}
717
717
}
@@ -936,7 +936,7 @@ VersionStorageInfo::VersionStorageInfo(
936
936
}
937
937
938
938
Version::Version (ColumnFamilyData* column_family_data, VersionSet* vset,
939
- uint64_t version_number)
939
+ const EnvOptions& env_opt, uint64_t version_number)
940
940
: env_(vset->env_),
941
941
cfd_(column_family_data),
942
942
info_log_((cfd_ == nullptr ) ? nullptr : cfd_->ioptions()->info_log),
@@ -959,6 +959,7 @@ Version::Version(ColumnFamilyData* column_family_data, VersionSet* vset,
959
959
next_(this ),
960
960
prev_(this ),
961
961
refs_(0 ),
962
+ env_options_(env_opt),
962
963
version_number_(version_number) {}
963
964
964
965
void Version::Get (const ReadOptions& read_options, const LookupKey& k,
@@ -2532,7 +2533,8 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
2532
2533
LogAndApplyCFHelper (w.edit_list .front ());
2533
2534
batch_edits.push_back (w.edit_list .front ());
2534
2535
} else {
2535
- v = new Version (column_family_data, this , current_version_number_++);
2536
+ v = new Version (column_family_data, this , env_options_,
2537
+ current_version_number_++);
2536
2538
builder_guard.reset (new BaseReferencedVersionBuilder (column_family_data));
2537
2539
auto * builder = builder_guard->version_builder ();
2538
2540
for (const auto & writer : manifest_writers_) {
@@ -2577,7 +2579,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
2577
2579
// Unlock during expensive operations. New writes cannot get here
2578
2580
// because &w is ensuring that all new writes get queued.
2579
2581
{
2580
-
2582
+ EnvOptions opt_env_opts = env_-> OptimizeForManifestWrite (env_options_);
2581
2583
mu->Unlock ();
2582
2584
2583
2585
TEST_SYNC_POINT (" VersionSet::LogAndApply:WriteManifest" );
@@ -2599,7 +2601,6 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
2599
2601
ROCKS_LOG_INFO (db_options_->info_log , " Creating manifest %" PRIu64 " \n " ,
2600
2602
pending_manifest_file_number_);
2601
2603
unique_ptr<WritableFile> descriptor_file;
2602
- EnvOptions opt_env_opts = env_->OptimizeForManifestWrite (env_options_);
2603
2604
s = NewWritableFile (
2604
2605
env_, DescriptorFileName (dbname_, pending_manifest_file_number_),
2605
2606
&descriptor_file, opt_env_opts);
@@ -3064,7 +3065,8 @@ Status VersionSet::Recover(
3064
3065
false /* prefetch_index_and_filter_in_cache */ );
3065
3066
}
3066
3067
3067
- Version* v = new Version (cfd, this , current_version_number_++);
3068
+ Version* v =
3069
+ new Version (cfd, this , env_options_, current_version_number_++);
3068
3070
builder->SaveTo (v->storage_info ());
3069
3071
3070
3072
// Install recovered version
@@ -3422,7 +3424,8 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname,
3422
3424
assert (builders_iter != builders.end ());
3423
3425
auto builder = builders_iter->second ->version_builder ();
3424
3426
3425
- Version* v = new Version (cfd, this , current_version_number_++);
3427
+ Version* v =
3428
+ new Version (cfd, this , env_options_, current_version_number_++);
3426
3429
builder->SaveTo (v->storage_info ());
3427
3430
v->PrepareApply (*cfd->GetLatestMutableCFOptions (), false );
3428
3431
@@ -3634,7 +3637,7 @@ uint64_t VersionSet::ApproximateSize(Version* v, const FdWithKeyRange& f,
3634
3637
// approximate offset of "key" within the table.
3635
3638
TableReader* table_reader_ptr;
3636
3639
InternalIterator* iter = v->cfd_ ->table_cache ()->NewIterator (
3637
- ReadOptions (), env_options_, v->cfd_ ->internal_comparator (), f.fd ,
3640
+ ReadOptions (), v-> env_options_ , v->cfd_ ->internal_comparator (), f.fd ,
3638
3641
nullptr /* range_del_agg */ , &table_reader_ptr);
3639
3642
if (table_reader_ptr != nullptr ) {
3640
3643
result = table_reader_ptr->ApproximateOffsetOf (key);
@@ -3865,15 +3868,16 @@ ColumnFamilyData* VersionSet::CreateColumnFamily(
3865
3868
const ColumnFamilyOptions& cf_options, VersionEdit* edit) {
3866
3869
assert (edit->is_column_family_add_ );
3867
3870
3868
- Version* dummy_versions = new Version (nullptr , this );
3871
+ Version* dummy_versions = new Version (nullptr , this , env_options_ );
3869
3872
// Ref() dummy version once so that later we can call Unref() to delete it
3870
3873
// by avoiding calling "delete" explicitly (~Version is private)
3871
3874
dummy_versions->Ref ();
3872
3875
auto new_cfd = column_family_set_->CreateColumnFamily (
3873
3876
edit->column_family_name_ , edit->column_family_ , dummy_versions,
3874
3877
cf_options);
3875
3878
3876
- Version* v = new Version (new_cfd, this , current_version_number_++);
3879
+ Version* v =
3880
+ new Version (new_cfd, this , env_options_, current_version_number_++);
3877
3881
3878
3882
// Fill level target base information.
3879
3883
v->storage_info ()->CalculateBaseBytes (*new_cfd->ioptions (),
0 commit comments