]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add config option to compact OSD's object store on start 35605/head
authorWido den Hollander <wido@42on.com>
Tue, 16 Jun 2020 19:50:19 +0000 (21:50 +0200)
committerKefu Chai <kchai@redhat.com>
Thu, 16 Jul 2020 09:55:36 +0000 (17:55 +0800)
By setting this configuration option an OSD will compact it's
store's OMAP on start.

This way admin's can trigger an offline compaction by setting this
configuration value to 'true' and then restarting the OSD.

This is easier than using tools like 'ceph-kvstore-tool' with requires
more manual work on the CLI and might be more difficult for users.

Signed-off-by: Wido den Hollander <wido@42on.com>
PendingReleaseNotes
src/common/options.cc
src/osd/OSD.cc

index c487313ee4b34ae1482796f33e3d7cfb6da59192..b88f6001b8a869860a3896b0c2a2240ed59ca299 100644 (file)
@@ -92,3 +92,7 @@
     ceph fs required_client_features <fs name> add <feature>
     ceph fs required_client_features <fs name> rm <feature>
     ceph fs feature ls
+
+* OSD: A new configuration option ``osd_compact_on_start`` has been added which triggers
+  an OSD compaction on start. Setting this option to ``true`` and restarting an OSD
+  will result in an offline compaction of the OSD prior to booting.
index 0d7c6880e9ed22fbdaba06ef539fea8e6c12f523..3ff9807aca282bb1684a0f92cdb6398eb2e84da2 100644 (file)
@@ -2514,6 +2514,10 @@ std::vector<Option> get_global_options() {
     .set_default(true)
     .set_description("flush FileStore journal contents during clean OSD shutdown"),
 
+    Option("osd_compact_on_start", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("compact OSD's object store's OMAP on start"),
+
     Option("osd_os_flags", Option::TYPE_UINT, Option::LEVEL_DEV)
     .set_default(0)
     .set_description("flags to skip filestore omap or journal initialization"),
index b1a0c70dda8f2bc0c9296d724c27e22b832a61cc..ef1583a8ff4e2c78e840dacbe91fe622c01f13a3 100644 (file)
@@ -3500,6 +3500,10 @@ int OSD::init()
 
   dout(2) << "superblock: I am osd." << superblock.whoami << dendl;
 
+  if (cct->_conf.get_val<bool>("osd_compact_on_start")) {
+    dout(2) << "compacting object store's omap" << dendl;
+    store->compact();
+  }
 
   // prime osd stats
   {