@@ -514,7 +514,7 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
514
514
auto table_cache = cfd_->table_cache ();
515
515
auto ioptions = cfd_->ioptions ();
516
516
Status s = table_cache->GetTableProperties (
517
- vset_->storage_options_ , cfd_->internal_comparator (), file_meta->fd ,
517
+ vset_->env_options_ , cfd_->internal_comparator (), file_meta->fd ,
518
518
tp, true /* no io */ );
519
519
if (s.ok ()) {
520
520
return s;
@@ -531,12 +531,12 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
531
531
std::unique_ptr<RandomAccessFile> file;
532
532
if (fname != nullptr ) {
533
533
s = ioptions->env ->NewRandomAccessFile (
534
- *fname, &file, vset_->storage_options_ );
534
+ *fname, &file, vset_->env_options_ );
535
535
} else {
536
536
s = ioptions->env ->NewRandomAccessFile (
537
- TableFileName (vset_->options_ ->db_paths , file_meta->fd .GetNumber (),
537
+ TableFileName (vset_->db_options_ ->db_paths , file_meta->fd .GetNumber (),
538
538
file_meta->fd .GetPathId ()),
539
- &file, vset_->storage_options_ );
539
+ &file, vset_->env_options_ );
540
540
}
541
541
if (!s.ok ()) {
542
542
return s;
@@ -562,7 +562,7 @@ Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
562
562
for (int level = 0 ; level < num_levels_; level++) {
563
563
for (const auto & file_meta : files_[level]) {
564
564
auto fname =
565
- TableFileName (vset_->options_ ->db_paths , file_meta->fd .GetNumber (),
565
+ TableFileName (vset_->db_options_ ->db_paths , file_meta->fd .GetNumber (),
566
566
file_meta->fd .GetPathId ());
567
567
// 1. If the table is already present in table cache, load table
568
568
// properties from there.
@@ -584,7 +584,7 @@ size_t Version::GetMemoryUsageByTableReaders() {
584
584
for (auto & file_level : file_levels_) {
585
585
for (size_t i = 0 ; i < file_level.num_files ; i++) {
586
586
total_usage += cfd_->table_cache ()->GetMemoryUsageByTableReader (
587
- vset_->storage_options_ , cfd_->internal_comparator (),
587
+ vset_->env_options_ , cfd_->internal_comparator (),
588
588
file_level.files [i].fd );
589
589
}
590
590
}
@@ -864,7 +864,7 @@ bool Version::MaybeInitializeFileMetaData(FileMetaData* file_meta) {
864
864
Status s = GetTableProperties (&tp, file_meta);
865
865
file_meta->init_stats_from_file = true ;
866
866
if (!s.ok ()) {
867
- Log (vset_->options_ ->info_log ,
867
+ Log (vset_->db_options_ ->info_log ,
868
868
" Unable to load table properties for file %" PRIu64 " --- %s\n " ,
869
869
file_meta->fd .GetNumber (), s.ToString ().c_str ());
870
870
return false ;
@@ -1677,7 +1677,7 @@ class VersionSet::Builder {
1677
1677
for (auto & file_meta : *(levels_[level].added_files )) {
1678
1678
assert (!file_meta->table_reader_handle );
1679
1679
cfd_->table_cache ()->FindTable (
1680
- base_->vset_ ->storage_options_ , cfd_->internal_comparator (),
1680
+ base_->vset_ ->env_options_ , cfd_->internal_comparator (),
1681
1681
file_meta->fd , &file_meta->table_reader_handle , false );
1682
1682
if (file_meta->table_reader_handle != nullptr ) {
1683
1683
// Load table_reader
@@ -1705,23 +1705,23 @@ class VersionSet::Builder {
1705
1705
}
1706
1706
};
1707
1707
1708
- VersionSet::VersionSet (const std::string& dbname, const DBOptions* options ,
1709
- const EnvOptions& storage_options , Cache* table_cache,
1708
+ VersionSet::VersionSet (const std::string& dbname, const DBOptions* db_options ,
1709
+ const EnvOptions& env_options , Cache* table_cache,
1710
1710
WriteController* write_controller)
1711
- : column_family_set_(new ColumnFamilySet(dbname, options, storage_options ,
1711
+ : column_family_set_(new ColumnFamilySet(dbname, db_options, env_options ,
1712
1712
table_cache, write_controller)),
1713
- env_(options ->env),
1713
+ env_(db_options ->env),
1714
1714
dbname_(dbname),
1715
- options_(options ),
1715
+ db_options_(db_options ),
1716
1716
next_file_number_(2 ),
1717
1717
manifest_file_number_(0 ), // Filled by Recover()
1718
1718
pending_manifest_file_number_(0 ),
1719
1719
last_sequence_(0 ),
1720
1720
prev_log_number_(0 ),
1721
1721
current_version_number_(0 ),
1722
1722
manifest_file_size_(0 ),
1723
- storage_options_(storage_options ),
1724
- storage_options_compactions_(storage_options_ ) {}
1723
+ env_options_(env_options ),
1724
+ env_options_compactions_(env_options_ ) {}
1725
1725
1726
1726
VersionSet::~VersionSet () {
1727
1727
// we need to delete column_family_set_ because its destructor depends on
@@ -1823,7 +1823,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1823
1823
1824
1824
assert (pending_manifest_file_number_ == 0 );
1825
1825
if (!descriptor_log_ ||
1826
- manifest_file_size_ > options_ ->max_manifest_file_size ) {
1826
+ manifest_file_size_ > db_options_ ->max_manifest_file_size ) {
1827
1827
pending_manifest_file_number_ = NewFileNumber ();
1828
1828
batch_edits.back ()->SetNextFile (next_file_number_);
1829
1829
new_descriptor_log = true ;
@@ -1851,7 +1851,8 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1851
1851
1852
1852
mu->Unlock ();
1853
1853
1854
- if (!edit->IsColumnFamilyManipulation () && options_->max_open_files == -1 ) {
1854
+ if (!edit->IsColumnFamilyManipulation () &&
1855
+ db_options_->max_open_files == -1 ) {
1855
1856
// unlimited table cache. Pre-load table handle now.
1856
1857
// Need to do it out of the mutex.
1857
1858
builder->LoadTableHandlers ();
@@ -1861,15 +1862,15 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1861
1862
// only one thread can be here at the same time
1862
1863
if (new_descriptor_log) {
1863
1864
// create manifest file
1864
- Log (options_ ->info_log ,
1865
+ Log (db_options_ ->info_log ,
1865
1866
" Creating manifest %" PRIu64 " \n " , pending_manifest_file_number_);
1866
1867
unique_ptr<WritableFile> descriptor_file;
1867
1868
s = env_->NewWritableFile (
1868
1869
DescriptorFileName (dbname_, pending_manifest_file_number_),
1869
- &descriptor_file, env_->OptimizeForManifestWrite (storage_options_ ));
1870
+ &descriptor_file, env_->OptimizeForManifestWrite (env_options_ ));
1870
1871
if (s.ok ()) {
1871
1872
descriptor_file->SetPreallocationBlockSize (
1872
- options_ ->manifest_preallocation_size );
1873
+ db_options_ ->manifest_preallocation_size );
1873
1874
descriptor_log_.reset (new log ::Writer (std::move (descriptor_file)));
1874
1875
s = WriteSnapshot (descriptor_log_.get ());
1875
1876
}
@@ -1891,18 +1892,19 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1891
1892
}
1892
1893
}
1893
1894
if (s.ok ()) {
1894
- if (options_ ->use_fsync ) {
1895
- StopWatch sw (env_, options_ ->statistics .get (),
1895
+ if (db_options_ ->use_fsync ) {
1896
+ StopWatch sw (env_, db_options_ ->statistics .get (),
1896
1897
MANIFEST_FILE_SYNC_MICROS);
1897
1898
s = descriptor_log_->file ()->Fsync ();
1898
1899
} else {
1899
- StopWatch sw (env_, options_ ->statistics .get (),
1900
+ StopWatch sw (env_, db_options_ ->statistics .get (),
1900
1901
MANIFEST_FILE_SYNC_MICROS);
1901
1902
s = descriptor_log_->file ()->Sync ();
1902
1903
}
1903
1904
}
1904
1905
if (!s.ok ()) {
1905
- Log (options_->info_log , " MANIFEST write: %s\n " , s.ToString ().c_str ());
1906
+ Log (db_options_->info_log , " MANIFEST write: %s\n " ,
1907
+ s.ToString ().c_str ());
1906
1908
bool all_records_in = true ;
1907
1909
for (auto & e : batch_edits) {
1908
1910
std::string record;
@@ -1913,7 +1915,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1913
1915
}
1914
1916
}
1915
1917
if (all_records_in) {
1916
- Log (options_ ->info_log ,
1918
+ Log (db_options_ ->info_log ,
1917
1919
" MANIFEST contains log record despite error; advancing to new "
1918
1920
" version to prevent mismatch between in-memory and logged state"
1919
1921
" If paranoid is set, then the db is now in readonly mode." );
@@ -1929,7 +1931,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1929
1931
db_directory);
1930
1932
if (s.ok () && pending_manifest_file_number_ > manifest_file_number_) {
1931
1933
// delete old manifest file
1932
- Log (options_ ->info_log ,
1934
+ Log (db_options_ ->info_log ,
1933
1935
" Deleting manifest %" PRIu64 " current manifest %" PRIu64 " \n " ,
1934
1936
manifest_file_number_, pending_manifest_file_number_);
1935
1937
// we don't care about an error here, PurgeObsoleteFiles will take care
@@ -1943,7 +1945,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1943
1945
new_manifest_file_size = descriptor_log_->file ()->GetFileSize ();
1944
1946
}
1945
1947
1946
- LogFlush (options_ ->info_log );
1948
+ LogFlush (db_options_ ->info_log );
1947
1949
mu->Lock ();
1948
1950
}
1949
1951
@@ -1979,12 +1981,12 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
1979
1981
manifest_file_size_ = new_manifest_file_size;
1980
1982
prev_log_number_ = edit->prev_log_number_ ;
1981
1983
} else {
1982
- Log (options_ ->info_log , " Error in committing version %lu to [%s]" ,
1984
+ Log (db_options_ ->info_log , " Error in committing version %lu to [%s]" ,
1983
1985
(unsigned long )v->GetVersionNumber (),
1984
1986
column_family_data->GetName ().c_str ());
1985
1987
delete v;
1986
1988
if (new_descriptor_log) {
1987
- Log (options_ ->info_log ,
1989
+ Log (db_options_ ->info_log ,
1988
1990
" Deleting manifest %" PRIu64 " current manifest %" PRIu64 " \n " ,
1989
1991
manifest_file_number_, pending_manifest_file_number_);
1990
1992
descriptor_log_.reset ();
@@ -2076,13 +2078,13 @@ Status VersionSet::Recover(
2076
2078
return Status::Corruption (" CURRENT file corrupted" );
2077
2079
}
2078
2080
2079
- Log (options_ ->info_log , " Recovering from manifest file: %s\n " ,
2081
+ Log (db_options_ ->info_log , " Recovering from manifest file: %s\n " ,
2080
2082
manifest_filename.c_str ());
2081
2083
2082
2084
manifest_filename = dbname_ + " /" + manifest_filename;
2083
2085
unique_ptr<SequentialFile> manifest_file;
2084
2086
s = env_->NewSequentialFile (manifest_filename, &manifest_file,
2085
- storage_options_ );
2087
+ env_options_ );
2086
2088
if (!s.ok ()) {
2087
2089
return s;
2088
2090
}
@@ -2209,7 +2211,7 @@ Status VersionSet::Recover(
2209
2211
if (cfd != nullptr ) {
2210
2212
if (edit.has_log_number_ ) {
2211
2213
if (cfd->GetLogNumber () > edit.log_number_ ) {
2212
- Log (options_ ->info_log ,
2214
+ Log (db_options_ ->info_log ,
2213
2215
" MANIFEST corruption detected, but ignored - Log numbers in "
2214
2216
" records NOT monotonically increasing" );
2215
2217
} else {
@@ -2285,7 +2287,7 @@ Status VersionSet::Recover(
2285
2287
assert (builders_iter != builders.end ());
2286
2288
auto builder = builders_iter->second ;
2287
2289
2288
- if (options_ ->max_open_files == -1 ) {
2290
+ if (db_options_ ->max_open_files == -1 ) {
2289
2291
// unlimited table cache. Pre-load table handle now.
2290
2292
// Need to do it out of the mutex.
2291
2293
builder->LoadTableHandlers ();
@@ -2306,7 +2308,7 @@ Status VersionSet::Recover(
2306
2308
last_sequence_ = last_sequence;
2307
2309
prev_log_number_ = prev_log_number;
2308
2310
2309
- Log (options_ ->info_log ,
2311
+ Log (db_options_ ->info_log ,
2310
2312
" Recovered from manifest file:%s succeeded,"
2311
2313
" manifest_file_number is %lu, next_file_number is %lu, "
2312
2314
" last_sequence is %lu, log_number is %lu,"
@@ -2318,7 +2320,7 @@ Status VersionSet::Recover(
2318
2320
column_family_set_->GetMaxColumnFamily ());
2319
2321
2320
2322
for (auto cfd : *column_family_set_) {
2321
- Log (options_ ->info_log ,
2323
+ Log (db_options_ ->info_log ,
2322
2324
" Column family [%s] (ID %u), log number is %" PRIu64 " \n " ,
2323
2325
cfd->GetName ().c_str (), cfd->GetID (), cfd->GetLogNumber ());
2324
2326
}
@@ -2401,7 +2403,7 @@ Status VersionSet::ListColumnFamilies(std::vector<std::string>* column_families,
2401
2403
#ifndef ROCKSDB_LITE
2402
2404
Status VersionSet::ReduceNumberOfLevels (const std::string& dbname,
2403
2405
const Options* options,
2404
- const EnvOptions& storage_options ,
2406
+ const EnvOptions& env_options ,
2405
2407
int new_levels) {
2406
2408
if (new_levels <= 1 ) {
2407
2409
return Status::InvalidArgument (
@@ -2413,7 +2415,7 @@ Status VersionSet::ReduceNumberOfLevels(const std::string& dbname,
2413
2415
options->max_open_files - 10 , options->table_cache_numshardbits ,
2414
2416
options->table_cache_remove_scan_count_limit ));
2415
2417
WriteController wc;
2416
- VersionSet versions (dbname, options, storage_options , tc.get (), &wc);
2418
+ VersionSet versions (dbname, options, env_options , tc.get (), &wc);
2417
2419
Status status;
2418
2420
2419
2421
std::vector<ColumnFamilyDescriptor> dummy;
@@ -2484,7 +2486,7 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname,
2484
2486
bool verbose, bool hex) {
2485
2487
// Open the specified manifest file.
2486
2488
unique_ptr<SequentialFile> file;
2487
- Status s = options.env ->NewSequentialFile (dscname, &file, storage_options_ );
2489
+ Status s = options.env ->NewSequentialFile (dscname, &file, env_options_ );
2488
2490
if (!s.ok ()) {
2489
2491
return s;
2490
2492
}
@@ -2726,12 +2728,12 @@ bool VersionSet::ManifestContains(uint64_t manifest_file_number,
2726
2728
const std::string& record) const {
2727
2729
std::string fname =
2728
2730
DescriptorFileName (dbname_, manifest_file_number);
2729
- Log (options_ ->info_log , " ManifestContains: checking %s\n " , fname.c_str ());
2731
+ Log (db_options_ ->info_log , " ManifestContains: checking %s\n " , fname.c_str ());
2730
2732
unique_ptr<SequentialFile> file;
2731
- Status s = env_->NewSequentialFile (fname, &file, storage_options_ );
2733
+ Status s = env_->NewSequentialFile (fname, &file, env_options_ );
2732
2734
if (!s.ok ()) {
2733
- Log (options_ ->info_log , " ManifestContains: %s\n " , s.ToString ().c_str ());
2734
- Log (options_ ->info_log ,
2735
+ Log (db_options_ ->info_log , " ManifestContains: %s\n " , s.ToString ().c_str ());
2736
+ Log (db_options_ ->info_log ,
2735
2737
" ManifestContains: is unable to reopen the manifest file %s" ,
2736
2738
fname.c_str ());
2737
2739
return false ;
@@ -2746,7 +2748,7 @@ bool VersionSet::ManifestContains(uint64_t manifest_file_number,
2746
2748
break ;
2747
2749
}
2748
2750
}
2749
- Log (options_ ->info_log , " ManifestContains: result = %d\n " , result ? 1 : 0 );
2751
+ Log (db_options_ ->info_log , " ManifestContains: result = %d\n " , result ? 1 : 0 );
2750
2752
return result;
2751
2753
}
2752
2754
@@ -2774,7 +2776,7 @@ uint64_t VersionSet::ApproximateOffsetOf(Version* v, const InternalKey& ikey) {
2774
2776
// approximate offset of "ikey" within the table.
2775
2777
TableReader* table_reader_ptr;
2776
2778
Iterator* iter = v->cfd_ ->table_cache ()->NewIterator (
2777
- ReadOptions (), storage_options_ , v->cfd_ ->internal_comparator (),
2779
+ ReadOptions (), env_options_ , v->cfd_ ->internal_comparator (),
2778
2780
files[i]->fd , &table_reader_ptr);
2779
2781
if (table_reader_ptr != nullptr ) {
2780
2782
result += table_reader_ptr->ApproximateOffsetOf (ikey.Encode ());
@@ -2836,14 +2838,14 @@ Iterator* VersionSet::MakeInputIterator(Compaction* c) {
2836
2838
const FileLevel* flevel = c->input_levels (which);
2837
2839
for (size_t i = 0 ; i < flevel->num_files ; i++) {
2838
2840
list[num++] = cfd->table_cache ()->NewIterator (
2839
- read_options, storage_options_compactions_ ,
2841
+ read_options, env_options_compactions_ ,
2840
2842
cfd->internal_comparator (), flevel->files [i].fd , nullptr ,
2841
2843
true /* for compaction */ );
2842
2844
}
2843
2845
} else {
2844
2846
// Create concatenating iterator for the files from this level
2845
2847
list[num++] = NewTwoLevelIterator (new Version::LevelFileIteratorState (
2846
- cfd->table_cache (), read_options, storage_options_ ,
2848
+ cfd->table_cache (), read_options, env_options_ ,
2847
2849
cfd->internal_comparator (), true /* for_compaction */ ,
2848
2850
false /* prefix enabled */ ),
2849
2851
new Version::LevelFileNumIterator (cfd->internal_comparator (),
@@ -2864,7 +2866,7 @@ bool VersionSet::VerifyCompactionFileConsistency(Compaction* c) {
2864
2866
#ifndef NDEBUG
2865
2867
Version* version = c->column_family_data ()->current ();
2866
2868
if (c->input_version () != version) {
2867
- Log (options_ ->info_log ,
2869
+ Log (db_options_ ->info_log ,
2868
2870
" [%s] VerifyCompactionFileConsistency version mismatch" ,
2869
2871
c->column_family_data ()->GetName ().c_str ());
2870
2872
}
@@ -2935,11 +2937,11 @@ void VersionSet::GetLiveFilesMetaData(std::vector<LiveFileMetaData>* metadata) {
2935
2937
LiveFileMetaData filemetadata;
2936
2938
filemetadata.column_family_name = cfd->GetName ();
2937
2939
uint32_t path_id = file->fd .GetPathId ();
2938
- if (path_id < options_ ->db_paths .size ()) {
2939
- filemetadata.db_path = options_ ->db_paths [path_id].path ;
2940
+ if (path_id < db_options_ ->db_paths .size ()) {
2941
+ filemetadata.db_path = db_options_ ->db_paths [path_id].path ;
2940
2942
} else {
2941
- assert (!options_ ->db_paths .empty ());
2942
- filemetadata.db_path = options_ ->db_paths .back ().path ;
2943
+ assert (!db_options_ ->db_paths .empty ());
2944
+ filemetadata.db_path = db_options_ ->db_paths .back ().path ;
2943
2945
}
2944
2946
filemetadata.name = MakeTableFileName (" " , file->fd .GetNumber ());
2945
2947
filemetadata.level = level;
0 commit comments