From 9afa0f05ad0789af261c72beec7a104445fbf7e8 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Wed, 25 Jan 2023 12:08:49 -0800 Subject: [PATCH] Remove deprecated Env::LoadEnv() (#11121) Summary: Can use Env::CreateFromString() instead Pull Request resolved: https://github.com/facebook/rocksdb/pull/11121 Test Plan: unit tests updated Reviewed By: cbi42 Differential Revision: D42723813 Pulled By: pdillinger fbshipit-source-id: 5d4b5b10225dfdaf662f5f8049ee965a05d3edc9 --- HISTORY.md | 1 + env/env.cc | 9 --------- include/rocksdb/env.h | 11 ----------- options/options_test.cc | 4 ++-- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 12c9305c1..3c846895c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,6 +5,7 @@ ### Feature Removal * The feature block_cache_compressed is removed. Statistics related to it are removed too. +* Remove deprecated Env::LoadEnv(). Use Env::CreateFromString() instead. ### Public API Changes * Completely removed the following deprecated/obsolete statistics: `STALL_L0_SLOWDOWN_MICROS`, `STALL_MEMTABLE_COMPACTION_MICROS`, `STALL_L0_NUM_FILES_MICROS`, `NO_ITERATORS`, `BLOB_DB_GC_NUM_KEYS_OVERWRITTEN`, `BLOB_DB_GC_NUM_KEYS_EXPIRED`, `BLOB_DB_GC_BYTES_OVERWRITTEN`, `BLOB_DB_GC_BYTES_EXPIRED`, `BLOB_DB_GC_MICROS`, and `NUM_DATA_BLOCKS_READ_PER_LEVEL`. diff --git a/env/env.cc b/env/env.cc index f70d1f067..832dd9509 100644 --- a/env/env.cc +++ b/env/env.cc @@ -640,10 +640,6 @@ Status Env::NewLogger(const std::string& fname, return NewEnvLogger(fname, this, result); } -Status Env::LoadEnv(const std::string& value, Env** result) { - return CreateFromString(ConfigOptions(), value, result); -} - Status Env::CreateFromString(const ConfigOptions& config_options, const std::string& value, Env** result) { Env* base = Env::Default(); @@ -661,11 +657,6 @@ Status Env::CreateFromString(const ConfigOptions& config_options, } } -Status Env::LoadEnv(const std::string& value, Env** result, - std::shared_ptr* guard) { - return CreateFromString(ConfigOptions(), value, result, guard); -} - Status Env::CreateFromString(const ConfigOptions& config_options, const std::string& value, Env** result, std::shared_ptr* guard) { diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index bef60a212..789e2bfb4 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -179,17 +179,6 @@ class Env : public Customizable { // should implement this method. const char* Name() const override { return ""; } - // Loads the environment specified by the input value into the result - // The CreateFromString alternative should be used; this method may be - // deprecated in a future release. - static Status LoadEnv(const std::string& value, Env** result); - - // Loads the environment specified by the input value into the result - // The CreateFromString alternative should be used; this method may be - // deprecated in a future release. - static Status LoadEnv(const std::string& value, Env** result, - std::shared_ptr* guard); - // Loads the environment specified by the input value into the result // @see Customizable for a more detailed description of the parameters and // return codes diff --git a/options/options_test.cc b/options/options_test.cc index 96e5464e6..46ca08092 100644 --- a/options/options_test.cc +++ b/options/options_test.cc @@ -1389,7 +1389,7 @@ TEST_F(OptionsTest, GetOptionsFromStringTest) { ASSERT_EQ(new_options.max_open_files, 1); ASSERT_TRUE(new_options.rate_limiter.get() != nullptr); Env* newEnv = new_options.env; - ASSERT_OK(Env::LoadEnv(CustomEnv::kClassName(), &newEnv)); + ASSERT_OK(Env::CreateFromString({}, CustomEnv::kClassName(), &newEnv)); ASSERT_EQ(newEnv, new_options.env); config_options.ignore_unknown_options = false; @@ -3092,7 +3092,7 @@ TEST_F(OptionsOldApiTest, GetOptionsFromStringTest) { ASSERT_EQ(new_options.max_open_files, 1); ASSERT_TRUE(new_options.rate_limiter.get() != nullptr); Env* newEnv = new_options.env; - ASSERT_OK(Env::LoadEnv("CustomEnvDefault", &newEnv)); + ASSERT_OK(Env::CreateFromString({}, "CustomEnvDefault", &newEnv)); ASSERT_EQ(newEnv, new_options.env); }