diff --git a/src/box/box.cc b/src/box/box.cc index 23004fff1a245dd424de37ea181f832d97c0218b..bc54e2f15a23a3a95ee28fc65e30612f55b17d70 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 94c79e663fcb20273e9bf182d195a2b92ba9afcf..4729c99d10ed36f7f5d13affaf51c53b5431b102 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