From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 1/2] engine: constify vclock argument Date: Wed, 30 May 2018 11:43:58 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: 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