From: Konstantin Osipov <kostja@tarantool.org> To: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: tarantool-patches@freelists.org Subject: Re: [PATCH v2 1/6] xlog: store prev vclock in xlog header Date: Thu, 5 Jul 2018 09:52:41 +0300 [thread overview] Message-ID: <20180705065241.GB11571@chai> (raw) In-Reply-To: <25eb188a0085216aef3a2e292fe14d0df71ede13.1530287767.git.vdavydov.dev@gmail.com> * Vladimir Davydov <vdavydov.dev@gmail.com> [18/06/29 19:49]: > This patch adds a new key to xlog header, PrevVclock, which contains the > vclock of the previous xlog file in the xlog directory. It is set by > xdir_create_xlog() to the last vclock in xdir::index. The new key is > only present in XLOG files (it doesn't make sense for SNAP or VYLOG > anyway). It will be used to make the check for xlog gaps more thorough. What about the following diff: --- diff --git a/src/box/xlog.c b/src/box/xlog.c index 59459b25d..a60f2ffa8 100644 --- a/src/box/xlog.c +++ b/src/box/xlog.c @@ -126,12 +126,10 @@ xlog_meta_format(const struct xlog_meta *meta, char *buf, int size) VCLOCK_KEY ": %s\n", meta->filetype, v13, PACKAGE_VERSION, instance_uuid, vstr); free(vstr); - if (meta->has_prev_vclock) { - vstr = vclock_to_string(&meta->prev_vclock); - SNPRINT(total, snprintf, buf, size, - PREV_VCLOCK_KEY ": %s\n", vstr); - free(vstr); - } + vstr = vclock_to_string(&meta->prev_vclock); + SNPRINT(total, snprintf, buf, size, + PREV_VCLOCK_KEY ": %s\n", vstr); + free(vstr); SNPRINT(total, snprintf, buf, size, "\n"); assert(total > 0); return total; @@ -263,7 +261,6 @@ xlog_meta_parse(struct xlog_meta *meta, const char **data, */ if (parse_vclock(val, val_end, &meta->prev_vclock) != 0) return -1; - meta->has_prev_vclock = true; } else if (memcmp(key, VERSION_KEY, key_end - key) == 0) { /* Ignore Version: for now */ } else { @@ -926,12 +923,10 @@ xdir_create_xlog(struct xdir *dir, struct xlog *xlog, * For WAL dir: store vclock of the previous xlog file * to check for gaps on recovery. */ - if (dir->type == XLOG && !vclockset_empty(&dir->index)) { + if (!vclockset_empty(&dir->index)) { vclock_copy(&meta.prev_vclock, vclockset_last(&dir->index)); - meta.has_prev_vclock = true; } else { vclock_create(&meta.prev_vclock); - meta.has_prev_vclock = false; } if (xlog_create(xlog, filename, dir->open_wflags, &meta) != 0) diff --git a/src/box/xlog.h b/src/box/xlog.h index 259b5210b..08eb0952c 100644 --- a/src/box/xlog.h +++ b/src/box/xlog.h @@ -246,8 +246,6 @@ struct xlog_meta { * directory for missing WALs. */ struct vclock prev_vclock; - /** Set if @prev_vclock is present. */ - bool has_prev_vclock; }; /* }}} */ --- Would it work? -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov
next prev parent reply other threads:[~2018-07-05 6:52 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-29 16:48 [PATCH v2 0/6] Create empty xlog on shutdown Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 1/6] xlog: store prev vclock in xlog header Vladimir Davydov 2018-07-05 6:49 ` Konstantin Osipov 2018-07-05 6:52 ` Konstantin Osipov [this message] 2018-07-05 8:23 ` Vladimir Davydov 2018-07-05 11:22 ` Konstantin Osipov 2018-07-10 16:28 ` [PATCH] xlog: get rid of xlog_meta::has_prev_vclock Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 2/6] xlog: differentiate between closed and never opened cursor Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 3/6] recovery: make LSN gap check more thorough Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 4/6] recovery: promote recovery clock even if the WAL is empty Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 5/6] wal: create empty xlog on shutdown Vladimir Davydov 2018-06-29 16:48 ` [PATCH v2 6/6] error: move XlogGapError to box/error.h Vladimir Davydov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180705065241.GB11571@chai \ --to=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH v2 1/6] xlog: store prev vclock in xlog header' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox