Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 1/2] engine: constify vclock argument
Date: Wed, 30 May 2018 11:43:58 +0300	[thread overview]
Message-ID: <d77c45249d61b87bdc8636564e4d3b05b86ffdcf.1527669266.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1527669266.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1527669266.git.vdavydov.dev@gmail.com>

None of engine_wait_checkpoint, engine_commit_checkpoint, engine_join,
engine_backup needs to modify the vclock argument.
---
 src/box/engine.c         |  6 +++---
 src/box/engine.h         | 16 ++++++++--------
 src/box/memtx_engine.c   | 10 ++++++----
 src/box/sysview_engine.c | 10 ++++++----
 src/box/vinyl.c          | 10 ++++++----
 src/box/vy_log.c         |  2 +-
 src/box/vy_log.h         |  2 +-
 7 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/src/box/engine.c b/src/box/engine.c
index b3e3fe1d..82293fd1 100644
--- a/src/box/engine.c
+++ b/src/box/engine.c
@@ -126,7 +126,7 @@ engine_begin_checkpoint(void)
 }
 
 int
-engine_commit_checkpoint(struct vclock *vclock)
+engine_commit_checkpoint(const struct vclock *vclock)
 {
 	struct engine *engine;
 	engine_foreach(engine) {
@@ -159,7 +159,7 @@ engine_collect_garbage(int64_t lsn)
 }
 
 int
-engine_backup(struct vclock *vclock, engine_backup_cb cb, void *cb_arg)
+engine_backup(const struct vclock *vclock, engine_backup_cb cb, void *cb_arg)
 {
 	struct engine *engine;
 	engine_foreach(engine) {
@@ -170,7 +170,7 @@ engine_backup(struct vclock *vclock, engine_backup_cb cb, void *cb_arg)
 }
 
 int
-engine_join(struct vclock *vclock, struct xstream *stream)
+engine_join(const struct vclock *vclock, struct xstream *stream)
 {
 	struct engine *engine;
 	engine_foreach(engine) {
diff --git a/src/box/engine.h b/src/box/engine.h
index 436bb967..825f059e 100644
--- a/src/box/engine.h
+++ b/src/box/engine.h
@@ -76,7 +76,7 @@ struct engine_vtab {
 	/**
 	 * Write statements stored in checkpoint @vclock to @stream.
 	 */
-	int (*join)(struct engine *engine, struct vclock *vclock,
+	int (*join)(struct engine *engine, const struct vclock *vclock,
 		    struct xstream *stream);
 	/**
 	 * Begin a new single or multi-statement transaction.
@@ -144,12 +144,12 @@ struct engine_vtab {
 	/**
 	 * Wait for a checkpoint to complete.
 	 */
-	int (*wait_checkpoint)(struct engine *, struct vclock *);
+	int (*wait_checkpoint)(struct engine *, const struct vclock *);
 	/**
 	 * All engines prepared their checkpoints,
 	 * fix up the changes.
 	 */
-	void (*commit_checkpoint)(struct engine *, struct vclock *);
+	void (*commit_checkpoint)(struct engine *, const struct vclock *);
 	/**
 	 * An error in one of the engines, abort checkpoint.
 	 */
@@ -172,7 +172,7 @@ struct engine_vtab {
 	 * that needs to be backed up in order to restore from the
 	 * checkpoint @vclock.
 	 */
-	int (*backup)(struct engine *engine, struct vclock *vclock,
+	int (*backup)(struct engine *engine, const struct vclock *vclock,
 		      engine_backup_cb cb, void *cb_arg);
 	/**
 	 * Accumulate engine memory statistics.
@@ -310,7 +310,7 @@ engine_end_recovery(void);
  * (called on the master).
  */
 int
-engine_join(struct vclock *vclock, struct xstream *stream);
+engine_join(const struct vclock *vclock, struct xstream *stream);
 
 int
 engine_begin_checkpoint(void);
@@ -319,7 +319,7 @@ engine_begin_checkpoint(void);
  * Create a checkpoint.
  */
 int
-engine_commit_checkpoint(struct vclock *vclock);
+engine_commit_checkpoint(const struct vclock *vclock);
 
 void
 engine_abort_checkpoint(void);
@@ -328,7 +328,7 @@ int
 engine_collect_garbage(int64_t lsn);
 
 int
-engine_backup(struct vclock *vclock, engine_backup_cb cb, void *cb_arg);
+engine_backup(const struct vclock *vclock, engine_backup_cb cb, void *cb_arg);
 
 void
 engine_memory_stat(struct engine_memory_stat *stat);
@@ -415,7 +415,7 @@ engine_end_recovery_xc(void)
 }
 
 static inline void
-engine_join_xc(struct vclock *vclock, struct xstream *stream)
+engine_join_xc(const struct vclock *vclock, struct xstream *stream)
 {
 	if (engine_join(vclock, stream) != 0)
 		diag_raise();
diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c
index 1d3d4943..0e5eb42a 100644
--- a/src/box/memtx_engine.c
+++ b/src/box/memtx_engine.c
@@ -677,7 +677,8 @@ memtx_engine_begin_checkpoint(struct engine *engine)
 }
 
 static int
-memtx_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
+memtx_engine_wait_checkpoint(struct engine *engine,
+			     const struct vclock *vclock)
 {
 	struct memtx_engine *memtx = (struct memtx_engine *)engine;
 
@@ -708,7 +709,8 @@ memtx_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
 }
 
 static void
-memtx_engine_commit_checkpoint(struct engine *engine, struct vclock *vclock)
+memtx_engine_commit_checkpoint(struct engine *engine,
+			       const struct vclock *vclock)
 {
 	(void) vclock;
 	struct memtx_engine *memtx = (struct memtx_engine *)engine;
@@ -793,7 +795,7 @@ memtx_engine_collect_garbage(struct engine *engine, int64_t lsn)
 }
 
 static int
-memtx_engine_backup(struct engine *engine, struct vclock *vclock,
+memtx_engine_backup(struct engine *engine, const struct vclock *vclock,
 		    engine_backup_cb cb, void *cb_arg)
 {
 	struct memtx_engine *memtx = (struct memtx_engine *)engine;
@@ -854,7 +856,7 @@ memtx_initial_join_f(va_list ap)
 }
 
 static int
-memtx_engine_join(struct engine *engine, struct vclock *vclock,
+memtx_engine_join(struct engine *engine, const struct vclock *vclock,
 		  struct xstream *stream)
 {
 	struct memtx_engine *memtx = (struct memtx_engine *)engine;
diff --git a/src/box/sysview_engine.c b/src/box/sysview_engine.c
index 5aea87e5..762bf93e 100644
--- a/src/box/sysview_engine.c
+++ b/src/box/sysview_engine.c
@@ -286,7 +286,7 @@ sysview_engine_end_recovery(struct engine *engine)
 }
 
 static int
-sysview_engine_join(struct engine *engine, struct vclock *vclock,
+sysview_engine_join(struct engine *engine, const struct vclock *vclock,
 		    struct xstream *stream)
 {
 	(void)engine;
@@ -303,7 +303,8 @@ sysview_engine_begin_checkpoint(struct engine *engine)
 }
 
 static int
-sysview_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
+sysview_engine_wait_checkpoint(struct engine *engine,
+			       const struct vclock *vclock)
 {
 	(void)engine;
 	(void)vclock;
@@ -311,7 +312,8 @@ sysview_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
 }
 
 static void
-sysview_engine_commit_checkpoint(struct engine *engine, struct vclock *vclock)
+sysview_engine_commit_checkpoint(struct engine *engine,
+				 const struct vclock *vclock)
 {
 	(void)engine;
 	(void)vclock;
@@ -332,7 +334,7 @@ sysview_engine_collect_garbage(struct engine *engine, int64_t lsn)
 }
 
 static int
-sysview_engine_backup(struct engine *engine, struct vclock *vclock,
+sysview_engine_backup(struct engine *engine, const struct vclock *vclock,
 		      engine_backup_cb cb, void *cb_arg)
 {
 	(void)engine;
diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index f0d26874..fd0e9ca6 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -2809,7 +2809,8 @@ vinyl_engine_begin_checkpoint(struct engine *engine)
 }
 
 static int
-vinyl_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
+vinyl_engine_wait_checkpoint(struct engine *engine,
+			     const struct vclock *vclock)
 {
 	struct vy_env *env = vy_env(engine);
 	assert(env->status == VINYL_ONLINE);
@@ -2821,7 +2822,8 @@ vinyl_engine_wait_checkpoint(struct engine *engine, struct vclock *vclock)
 }
 
 static void
-vinyl_engine_commit_checkpoint(struct engine *engine, struct vclock *vclock)
+vinyl_engine_commit_checkpoint(struct engine *engine,
+			       const struct vclock *vclock)
 {
 	(void)vclock;
 	struct vy_env *env = vy_env(engine);
@@ -3174,7 +3176,7 @@ vy_join_f(va_list ap)
 }
 
 static int
-vinyl_engine_join(struct engine *engine, struct vclock *vclock,
+vinyl_engine_join(struct engine *engine, const struct vclock *vclock,
 		  struct xstream *stream)
 {
 	struct vy_env *env = vy_env(engine);
@@ -3415,7 +3417,7 @@ vinyl_engine_collect_garbage(struct engine *engine, int64_t lsn)
 /* {{{ Backup */
 
 static int
-vinyl_engine_backup(struct engine *engine, struct vclock *vclock,
+vinyl_engine_backup(struct engine *engine, const struct vclock *vclock,
 		    engine_backup_cb cb, void *cb_arg)
 {
 	struct vy_env *env = vy_env(engine);
diff --git a/src/box/vy_log.c b/src/box/vy_log.c
index bdf9eee3..ab74c9b0 100644
--- a/src/box/vy_log.c
+++ b/src/box/vy_log.c
@@ -1023,7 +1023,7 @@ vy_log_collect_garbage(int64_t signature)
 }
 
 const char *
-vy_log_backup_path(struct vclock *vclock)
+vy_log_backup_path(const struct vclock *vclock)
 {
 	/*
 	 * Use the previous log file, because the current one
diff --git a/src/box/vy_log.h b/src/box/vy_log.h
index d77cb298..3c1482be 100644
--- a/src/box/vy_log.h
+++ b/src/box/vy_log.h
@@ -405,7 +405,7 @@ vy_log_collect_garbage(int64_t signature);
  * in order to recover to checkpoint @vclock.
  */
 const char *
-vy_log_backup_path(struct vclock *vclock);
+vy_log_backup_path(const struct vclock *vclock);
 
 /** Allocate a unique ID for a vinyl object. */
 int64_t
-- 
2.11.0

  reply	other threads:[~2018-05-30  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30  8:43 [PATCH 0/2] Extend backup API to backup any checkpoint Vladimir Davydov
2018-05-30  8:43 ` Vladimir Davydov [this message]
2018-05-30 19:05   ` [PATCH 1/2] engine: constify vclock argument Konstantin Osipov
2018-05-30  8:43 ` [PATCH 2/2] box: allow to specify the checkpoint to backup Vladimir Davydov
2018-05-30 19:08   ` Konstantin Osipov
2018-05-31  7:48     ` 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=d77c45249d61b87bdc8636564e4d3b05b86ffdcf.1527669266.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 1/2] engine: constify vclock argument' \
    /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