From faf9b7d3891060548afe722148a99dec92765c81 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Wed, 21 Jan 2015 15:16:31 +0300 Subject: [PATCH] Misc cleanups. --- src/box/box.cc | 15 ++++++++++++--- src/box/box.h | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index 23004fff1a..bc54e2f15a 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -64,6 +64,9 @@ int64_t snapshot_last_lsn = 0; static void box_snapshot_cb(struct xlog *l); +static void +engine_save_snapshot(struct recovery_state *r); + /** The snapshot row metadata repeats the structure of REPLACE request. */ struct request_replace_body { uint8_t m_body; @@ -386,6 +389,12 @@ box_free(void) static void engine_init() { + /* + * Sic: order is important here, since + * memtx must be the first to participate + * in snapshotting (in enigne_foreach order), + * so it must be registered first. + */ MemtxFactory *memtx = new MemtxFactory(); engine_register(memtx); @@ -444,14 +453,14 @@ box_init() /* Initialize a new replica */ replica_bootstrap(recovery); engine_end_recover_snapshot(); - box_deploy(recovery); + engine_save_snapshot(recovery); } else { /* Initialize the first server of a new cluster */ recovery_bootstrap(recovery); box_set_cluster_uuid(); box_set_server_uuid(); engine_end_recover_snapshot(); - box_deploy(recovery); + engine_save_snapshot(recovery); } fiber_gc(); } catch (Exception *e) { @@ -656,7 +665,7 @@ box_snapshot(void) } void -box_deploy(struct recovery_state *r) +engine_save_snapshot(struct recovery_state *r) { /* create memtx snapshot */ snapshot_save(r, box_snapshot_cb, true); diff --git a/src/box/box.h b/src/box/box.h index 94c79e663f..4729c99d10 100644 --- a/src/box/box.h +++ b/src/box/box.h @@ -83,7 +83,6 @@ extern uint32_t snapshot_version; * snapshot file. */ int box_snapshot(void); -void box_deploy(struct recovery_state*); /** Basic initialization of the storage dir. */ void -- GitLab