From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v2 2/6] xlog: differentiate between closed and never opened cursor
Date: Fri, 29 Jun 2018 19:48:29 +0300 [thread overview]
Message-ID: <71f63ba2e80ebb668394a5015acd0d538ba465f2.1530287767.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1530287767.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1530287767.git.vdavydov.dev@gmail.com>
Currently, a cursor that has never been opened and a cursor that was
properly closed share the same state, XLOG_CURSOR_CLOSED. Let's add a
new state, XLOG_CURSOR_UNINITIALIZED, so that we can differentiate
between those two. This new state will be used by the next patch.
---
src/box/xlog.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/box/xlog.h b/src/box/xlog.h
index bff3275f..9b5c8555 100644
--- a/src/box/xlog.h
+++ b/src/box/xlog.h
@@ -545,8 +545,8 @@ xlog_tx_decode(const char *data, const char *data_end,
/* {{{ xlog_cursor - read rows from a log file */
enum xlog_cursor_state {
- /* Cursor is closed */
- XLOG_CURSOR_CLOSED = 0,
+ /* The cursor was never opened. */
+ XLOG_CURSOR_UNINITIALIZED = 0,
/* The cursor is open but no tx is read */
XLOG_CURSOR_ACTIVE = 1,
/* The Cursor is open and a tx is read */
@@ -555,6 +555,8 @@ enum xlog_cursor_state {
XLOG_CURSOR_EOF = 3,
/* The cursor was closed after reaching EOF. */
XLOG_CURSOR_EOF_CLOSED = 4,
+ /* The cursor was closed before reaching EOF. */
+ XLOG_CURSOR_CLOSED = 5,
};
/**
@@ -586,7 +588,8 @@ struct xlog_cursor
static inline bool
xlog_cursor_is_open(const struct xlog_cursor *cursor)
{
- return (cursor->state != XLOG_CURSOR_CLOSED &&
+ return (cursor->state != XLOG_CURSOR_UNINITIALIZED &&
+ cursor->state != XLOG_CURSOR_CLOSED &&
cursor->state != XLOG_CURSOR_EOF_CLOSED);
}
--
2.11.0
next prev parent reply other threads:[~2018-06-29 16:48 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
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 ` Vladimir Davydov [this message]
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=71f63ba2e80ebb668394a5015acd0d538ba465f2.1530287767.git.vdavydov.dev@gmail.com \
--to=vdavydov.dev@gmail.com \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH v2 2/6] xlog: differentiate between closed and never opened cursor' \
/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