Skip to content

Commit

Permalink
osd: Flush Journal on shutdown
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wido committed Sep 28, 2016
1 parent e4ed13f commit 356377e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 356377e

Please sign in to comment.