From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 2/2] vinyl: fix backup skipping vylog created after recovery Date: Sun, 19 Aug 2018 23:44:40 +0300 Message-Id: In-Reply-To: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> References: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> In-Reply-To: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> References: <70ba3452fba34b4a1529f17e4872924005ea439b.1534710806.git.vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: Commit 8e710090fcbc ("vinyl: simplify vylog recovery from backup") broke backup in case the vylog directory is empty at the time of recovery (i.e. vinyl isn't in use): before the commit we added the last checkpoint vclock to the vylog directory index in this case while now we don't. As a result, if the user starts using vinyl (creates a vinyl space) after recovery, backup will not return the newly created vylog, because it hasn't been indexed. Fix this issue by restoring the code that adds the last checkpoint vclock to the vylog directory index in case no vylog exists on recovery. Closes #3624 --- https://github.com/tarantool/tarantool/issues/3624 https://github.com/tarantool/tarantool/commits/dv/gh-3624-vy-fix-vylog-backup src/box/vy_log.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/box/vy_log.c b/src/box/vy_log.c index d8613170..fc8ede59 100644 --- a/src/box/vy_log.c +++ b/src/box/vy_log.c @@ -912,8 +912,17 @@ vy_log_begin_recovery(const struct vclock *vclock) if (xdir_scan(&vy_log.dir) < 0 && errno != ENOENT) return NULL; - if (xdir_last_vclock(&vy_log.dir, &vy_log.last_checkpoint) < 0) + if (xdir_last_vclock(&vy_log.dir, &vy_log.last_checkpoint) < 0) { + /* + * Even if there's no vylog (i.e. vinyl isn't in use), + * we still have to add the vclock to the xdir index, + * because we may need it for garbage collection or + * backup in case the user starts using vinyl after + * recovery. + */ + xdir_add_vclock(&vy_log.dir, vclock); vclock_copy(&vy_log.last_checkpoint, vclock); + } int cmp = vclock_compare(&vy_log.last_checkpoint, vclock); if (cmp > 0) { -- 2.11.0