From 4b5d03a2c32c22ed16677b6f0a4a466836241624 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Thu, 21 Apr 2016 17:49:10 +0300 Subject: [PATCH] Remove wal_writer_start() from recovery_finalize(). --- src/box/applier.cc | 1 + src/box/box.cc | 11 +++++++++-- src/box/cluster.cc | 1 + src/box/recovery.cc | 11 ++--------- src/box/recovery.h | 4 +--- src/box/txn.cc | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/box/applier.cc b/src/box/applier.cc index e18c34f014..fecdb7d79a 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -39,6 +39,7 @@ #include "coio_buf.h" #include "xstream.h" #include "recovery.h" +#include "wal.h" #include "xrow.h" #include "box/cluster.h" #include "iproto_constants.h" diff --git a/src/box/box.cc b/src/box/box.cc index 6be2207c39..411b94122b 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -35,6 +35,7 @@ #include "iproto.h" #include "iproto_constants.h" #include "recovery.h" +#include "wal.h" #include "relay.h" #include "applier.h" #include <rmean.h> @@ -1175,6 +1176,8 @@ box_free(void) if (recovery) { recovery_exit(recovery); recovery = NULL; + if (wal) + wal_writer_stop(); } /* * See gh-584 "box_free() is called even if box is not @@ -1385,6 +1388,8 @@ box_init(void) port_init(); iproto_init(); box_set_listen(); + recovery_finalize(recovery, &wal_stream.base); + box_sync_replication_source(); } else { /* TODO: don't create recovery for this case */ @@ -1407,8 +1412,10 @@ box_init(void) int64_t rows_per_wal = box_check_rows_per_wal(cfg_geti64("rows_per_wal")); enum wal_mode wal_mode = box_check_wal_mode(cfg_gets("wal_mode")); - recovery_finalize(recovery, &wal_stream.base, wal_mode, rows_per_wal); - + if (wal_mode != WAL_NONE) { + wal_writer_start(wal_mode, cfg_gets("wal_dir"), &SERVER_UUID, + &recovery->vclock, rows_per_wal); + } engine_end_recovery(); rmean_cleanup(rmean_box); diff --git a/src/box/cluster.cc b/src/box/cluster.cc index a83e330ac7..e7fc0455d9 100644 --- a/src/box/cluster.cc +++ b/src/box/cluster.cc @@ -38,6 +38,7 @@ #include "box.h" #include "recovery.h" +#include "wal.h" #include "applier.h" /** diff --git a/src/box/recovery.cc b/src/box/recovery.cc index f5faba506f..46a94bf38f 100644 --- a/src/box/recovery.cc +++ b/src/box/recovery.cc @@ -36,7 +36,7 @@ #include "xlog.h" #include "xrow.h" #include "xstream.h" - +#include "wal.h" /* wal_watcher */ #include "cluster.h" #include "session.h" @@ -198,8 +198,6 @@ recovery_exit(struct recovery *r) /* Avoid fibers, there is no event loop */ r->watcher = NULL; recovery_delete(r); - if (wal) - wal_writer_stop(); } /** @@ -363,8 +361,7 @@ recover_remaining_wals(struct recovery *r, struct xstream *stream, } void -recovery_finalize(struct recovery *r, struct xstream *stream, - enum wal_mode wal_mode, int64_t rows_per_wal) +recovery_finalize(struct recovery *r, struct xstream *stream) { recovery_stop_local(r); @@ -384,10 +381,6 @@ recovery_finalize(struct recovery *r, struct xstream *stream, */ vclock_inc(&r->vclock, r->server_id); } - if (wal_mode != WAL_NONE) { - wal_writer_start(wal_mode, r->wal_dir.dirname, - &SERVER_UUID, &r->vclock, rows_per_wal); - } } diff --git a/src/box/recovery.h b/src/box/recovery.h index 61a7b3c598..fec2617c28 100644 --- a/src/box/recovery.h +++ b/src/box/recovery.h @@ -35,7 +35,6 @@ #include "xlog.h" #include "vclock.h" #include "tt_uuid.h" -#include "wal.h" #if defined(__cplusplus) extern "C" { @@ -83,8 +82,7 @@ void recovery_stop_local(struct recovery *r); void -recovery_finalize(struct recovery *r, struct xstream *stream, - enum wal_mode mode, int64_t rows_per_wal); +recovery_finalize(struct recovery *r, struct xstream *stream); void recovery_fill_lsn(struct recovery *r, struct xrow_header *row); diff --git a/src/box/txn.cc b/src/box/txn.cc index 3c65a43c05..15f692ff7f 100644 --- a/src/box/txn.cc +++ b/src/box/txn.cc @@ -33,6 +33,7 @@ #include "box.h" /* global recovery */ #include "tuple.h" #include "recovery.h" +#include "wal.h" #include <fiber.h> #include "request.h" /* for request_name */ #include "xrow.h" -- GitLab