From: Wido den Hollander Date: Wed, 28 Sep 2016 09:05:19 +0000 (+0200) Subject: osd: Flush Journal on shutdown X-Git-Tag: v11.1.0~473^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=356377e18ab21c26e9120fbcb439e148f895fbc8;p=ceph.git osd: Flush Journal on shutdown 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 --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 5175334c553..fa58a4c02b4 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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. diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index bc18041bf69..cca9df9fd61 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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;