]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Flush Journal on shutdown 11249/head
authorWido den Hollander <wido@42on.com>
Wed, 28 Sep 2016 09:05:19 +0000 (11:05 +0200)
committerWido den Hollander <wido@42on.com>
Wed, 28 Sep 2016 09:09:51 +0000 (11:09 +0200)
This way a data store is consistent and hot-swappable if a OSD had
a clean shutdown.

Make this behavior configurable and enable it by default.

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

index 5175334c5538f39fe8348eb76a072b4374d62646..fa58a4c02b468b6d91bca7514de597a64d9e6985 100644 (file)
@@ -604,6 +604,7 @@ OPTION(osd_uuid, OPT_UUID, uuid_d())
 OPTION(osd_data, OPT_STR, "/var/lib/ceph/osd/$cluster-$id")
 OPTION(osd_journal, OPT_STR, "/var/lib/ceph/osd/$cluster-$id/journal")
 OPTION(osd_journal_size, OPT_INT, 5120)         // in mb
+OPTION(osd_journal_flush_on_shutdown, OPT_BOOL, true) // Flush journal to data store on shutdown
 // flags for specific control purpose during osd mount() process. 
 // e.g., can be 1 to skip over replaying journal
 // or 2 to skip over mounting omap or 3 to skip over both.
index bc18041bf69e1addd346b8c31d6375b1fba47b59..cca9df9fd61eb0b9c28f71b72bcf13a506cd234e 100644 (file)
@@ -2752,6 +2752,12 @@ int OSD::shutdown()
 
   dout(10) << "syncing store" << dendl;
   enable_disable_fuse(true);
+
+  if (g_conf->osd_journal_flush_on_shutdown) {
+    dout(10) << "flushing journal" << dendl;
+    store->flush_journal();
+  }
+
   store->umount();
   delete store;
   store = 0;