From 2e2eb69b7c9ee943de563d12a8a324a5dbf4bcea Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Tue, 19 Apr 2022 23:34:10 +0530 Subject: [PATCH] rgw/dbstore: Add options to configure dbstore db file path & name_prefix DBStore will use the below options when creating .db file for rgw server to use. 'dbstore_db_dir': - path for the directory to store db backend store files - default: /var/run/ceph 'dbstore_db_name_prefix': - prefix to be used for the files created by db backend store - defauult: dbstore For eg., by default the full path of the file shall be eg., /var/run/ceph/dbstore-default_ns.db Signed-off-by: Soumya Koduri --- src/common/options/rgw.yaml.in | 14 ++++++++++++++ src/rgw/store/dbstore/README.md | 7 ++++++- src/rgw/store/dbstore/dbstore_mgr.cc | 11 ++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/common/options/rgw.yaml.in b/src/common/options/rgw.yaml.in index b25fbad092522..65bc6b41f8907 100644 --- a/src/common/options/rgw.yaml.in +++ b/src/common/options/rgw.yaml.in @@ -3456,6 +3456,20 @@ options: - rados - dbstore - motr +- name: dbstore_db_dir + type: str + level: advanced + desc: path for the directory for storing the db backend store data + default: /var/run/ceph + services: + - rgw +- name: dbstore_db_name_prefix + type: str + level: advanced + desc: prefix to the file names created by db backend store + default: dbstore + services: + - rgw - name: motr_profile_fid type: str level: advanced diff --git a/src/rgw/store/dbstore/README.md b/src/rgw/store/dbstore/README.md index 3e7016cab9368..32c4b6c41ef2b 100644 --- a/src/rgw/store/dbstore/README.md +++ b/src/rgw/store/dbstore/README.md @@ -26,7 +26,12 @@ Restart vstart cluster or just RGW server The above configuration brings up RGW server on dbstore and creates testid user to be used for s3 operations. -By default, dbstore creates .db file named 'default_ns.db' where in the data is stored. + +By default, dbstore creates .db file *'/var/run/ceph/dbstore-default_ns.db'* to store the data. This can be configured using below options in ceph.conf + + [client] + dbstore db dir = + dbstore db name prefix = ## DBStore Unit Tests diff --git a/src/rgw/store/dbstore/dbstore_mgr.cc b/src/rgw/store/dbstore/dbstore_mgr.cc index 9da98a487dcdd..5725793b71ba4 100644 --- a/src/rgw/store/dbstore/dbstore_mgr.cc +++ b/src/rgw/store/dbstore/dbstore_mgr.cc @@ -37,15 +37,20 @@ not_found: } /* Create DBStore instance */ -DB *DBStoreManager::createDB(string tenant) { +DB *DBStoreManager::createDB(std::string tenant) { DB *dbs = nullptr; pair::iterator,bool> ret; + const auto& db_path = g_conf().get_val("dbstore_db_dir"); + const auto& db_name = g_conf().get_val("dbstore_db_name_prefix"); + + std::string db_full_path = db_path + "/" + db_name + "-" + tenant; + ldout(cct, 0) << "DB initialization full db_path("<