]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/dbstore: Add options to configure dbstore db file path & name_prefix
authorSoumya Koduri <skoduri@redhat.com>
Tue, 19 Apr 2022 18:04:10 +0000 (23:34 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Fri, 6 May 2022 10:21:45 +0000 (15:51 +0530)
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 <skoduri@redhat.com>
src/common/options/rgw.yaml.in
src/rgw/store/dbstore/README.md
src/rgw/store/dbstore/dbstore_mgr.cc

index b25fbad092522f7f6864b05ff6ba8a8d3e3dfc0b..65bc6b41f8907f7218349a745edd777c69d89ae2 100644 (file)
@@ -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
index 3e7016cab9368ffda321aaf848941013da6cbf3f..32c4b6c41ef2bbd61a690ac16a113e94e0b94dc3 100644 (file)
@@ -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 = <path for the directory for storing the db backend store data>
+        dbstore db name prefix = <prefix to the file names created by db backend store>
 
 
 ## DBStore Unit Tests
index 9da98a487dcdda921f085d6b4dcafd0c4b52717a..5725793b71ba4effa9b1de5815216ca6add4924a 100644 (file)
@@ -37,15 +37,20 @@ not_found:
 }
 
 /* Create DBStore instance */
-DB *DBStoreManager::createDB(string tenant) {
+DB *DBStoreManager::createDB(std::string tenant) {
   DB *dbs = nullptr;
   pair<map<string, DB*>::iterator,bool> ret;
+  const auto& db_path = g_conf().get_val<std::string>("dbstore_db_dir");
+  const auto& db_name = g_conf().get_val<std::string>("dbstore_db_name_prefix");
+
+  std::string db_full_path = db_path + "/" + db_name + "-" + tenant;
+   ldout(cct, 0) << "DB initialization full db_path("<<db_full_path<<")" << dendl;
 
   /* Create the handle */
 #ifdef SQLITE_ENABLED
-  dbs = new SQLiteDB(tenant, cct);
+  dbs = new SQLiteDB(db_full_path, cct);
 #else
-  dbs = new DB(tenant, cct);
+  dbs = new DB(db_full_path, cct);
 #endif
 
   /* API is DB::Initialize(string logfile, int loglevel);