From 7678cf2df77195a93ab34df940d5febf5e890430 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Mon, 16 Dec 2019 20:00:43 -0800 Subject: [PATCH] Use Env::LoadEnv to create custom Env objects (#6196) Summary: As title. Previous assumption was that the underlying lib can always return a shared_ptr. This is too strong. Therefore, we use Env::LoadEnv to relax it. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6196 Test Plan: make check Differential Revision: D19133199 Pulled By: riversand963 fbshipit-source-id: c83a0c02a42610d077054f2de1acfc45126b3a75 --- db/column_family_test.cc | 6 +++--- db/db_test_util.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/column_family_test.cc b/db/column_family_test.cc index 95c43ac5a..2e91f7da3 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -67,9 +67,9 @@ class ColumnFamilyTestBase : public testing::Test { #ifndef ROCKSDB_LITE const char* test_env_uri = getenv("TEST_ENV_URI"); if (test_env_uri) { - Status s = ObjectRegistry::NewInstance()->NewSharedObject(test_env_uri, - &env_guard_); - base_env = env_guard_.get(); + Env* test_env = nullptr; + Status s = Env::LoadEnv(test_env_uri, &test_env, &env_guard_); + base_env = test_env; EXPECT_OK(s); EXPECT_NE(Env::Default(), base_env); } diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 88f57275f..a6842b728 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -53,9 +53,9 @@ DBTestBase::DBTestBase(const std::string path) #ifndef ROCKSDB_LITE const char* test_env_uri = getenv("TEST_ENV_URI"); if (test_env_uri) { - Status s = ObjectRegistry::NewInstance()->NewSharedObject(test_env_uri, - &env_guard_); - base_env = env_guard_.get(); + Env* test_env = nullptr; + Status s = Env::LoadEnv(test_env_uri, &test_env, &env_guard_); + base_env = test_env; EXPECT_OK(s); EXPECT_NE(Env::Default(), base_env); }