diff --git a/src/box/vy_cache.c b/src/box/vy_cache.c index 24ce2fa348287dc4100f2b8c56e11e86f9c8136d..671b3152599bbbe825ecafdfb9f70bff92a767db 100644 --- a/src/box/vy_cache.c +++ b/src/box/vy_cache.c @@ -818,7 +818,6 @@ vy_cache_iterator_close(struct vy_stmt_iterator *vitr) tuple_unref(itr->curr_stmt); itr->curr_stmt = NULL; } - tuple_unref(itr->key); TRASH(itr); } @@ -831,15 +830,14 @@ static struct vy_stmt_iterator_iface vy_cache_iterator_iface = { void vy_cache_iterator_open(struct vy_cache_iterator *itr, struct vy_cache *cache, - enum iterator_type iterator_type, struct tuple *key, - const struct vy_read_view **rv) + enum iterator_type iterator_type, + const struct tuple *key, const struct vy_read_view **rv) { itr->base.iface = &vy_cache_iterator_iface; itr->cache = cache; itr->iterator_type = iterator_type; itr->key = key; - tuple_ref(key); itr->read_view = rv; itr->curr_stmt = NULL; diff --git a/src/box/vy_cache.h b/src/box/vy_cache.h index b3ad3d0da272a4b728602ad1e2bab1fcbeebdd43..b94fb5d0aedaf17f5bca78268dc684ef2b8d575e 100644 --- a/src/box/vy_cache.h +++ b/src/box/vy_cache.h @@ -226,7 +226,7 @@ struct vy_cache_iterator { */ enum iterator_type iterator_type; /* Search key data in terms of vinyl, vy_stmt_compare_raw argument */ - struct tuple *key; + const struct tuple *key; /* LSN visibility, iterator shows values with lsn <= vlsn */ const struct vy_read_view **read_view; @@ -253,7 +253,7 @@ struct vy_cache_iterator { void vy_cache_iterator_open(struct vy_cache_iterator *itr, struct vy_cache *cache, enum iterator_type iterator_type, - struct tuple *key, const struct vy_read_view **rv); + const struct tuple *key, const struct vy_read_view **rv); #if defined(__cplusplus) } /* extern "C" { */ diff --git a/src/box/vy_mem.c b/src/box/vy_mem.c index 453c194f99ae2493ae8ba3567d5f5b78e73e0dd0..8878894e9615fa3a11d20fed3c6b9106df6fed34 100644 --- a/src/box/vy_mem.c +++ b/src/box/vy_mem.c @@ -423,7 +423,7 @@ static const struct vy_stmt_iterator_iface vy_mem_iterator_iface; void vy_mem_iterator_open(struct vy_mem_iterator *itr, struct vy_mem_iterator_stat *stat, struct vy_mem *mem, enum iterator_type iterator_type, - struct tuple *key, const struct vy_read_view **rv) + const struct tuple *key, const struct vy_read_view **rv) { itr->base.iface = &vy_mem_iterator_iface; itr->stat = stat; @@ -433,7 +433,6 @@ vy_mem_iterator_open(struct vy_mem_iterator *itr, struct vy_mem_iterator_stat *s itr->iterator_type = iterator_type; itr->key = key; - tuple_ref(key); itr->read_view = rv; itr->curr_pos = vy_mem_tree_invalid_iterator(); @@ -598,7 +597,6 @@ vy_mem_iterator_close(struct vy_stmt_iterator *vitr) struct vy_mem_iterator *itr = (struct vy_mem_iterator *) vitr; if (itr->last_stmt != NULL) tuple_unref(itr->last_stmt); - tuple_unref(itr->key); TRASH(itr); } diff --git a/src/box/vy_mem.h b/src/box/vy_mem.h index a03f965aa62c95bfde58b5d486724817a57c1170..dcd2135b09524156ed3bfdcf14effcb84af8073e 100644 --- a/src/box/vy_mem.h +++ b/src/box/vy_mem.h @@ -316,7 +316,7 @@ struct vy_mem_iterator { */ enum iterator_type iterator_type; /** Key to search. */ - struct tuple *key; + const struct tuple *key; /* LSN visibility, iterator shows values with lsn <= than that */ const struct vy_read_view **read_view; @@ -349,7 +349,7 @@ struct vy_mem_iterator { void vy_mem_iterator_open(struct vy_mem_iterator *itr, struct vy_mem_iterator_stat *stat, struct vy_mem *mem, enum iterator_type iterator_type, - struct tuple *key, const struct vy_read_view **rv); + const struct tuple *key, const struct vy_read_view **rv); /** * Simple stream over a mem. @see vy_stmt_stream. diff --git a/src/box/vy_point_iterator.c b/src/box/vy_point_iterator.c index cf4d41660eed6e21e55e85b8e46b290db9c5058b..4764ebf8b2ff9a84194f8a9224b54d17ed5ca804 100644 --- a/src/box/vy_point_iterator.c +++ b/src/box/vy_point_iterator.c @@ -51,7 +51,6 @@ vy_point_iterator_open(struct vy_point_iterator *itr, struct vy_run_env *run_env itr->tx = tx; itr->p_read_view = rv; itr->key = key; - tuple_ref(key); itr->curr_stmt = NULL; } @@ -91,7 +90,6 @@ vy_point_iterator_close(struct vy_point_iterator *itr) if (itr->curr_stmt != NULL) tuple_unref(itr->curr_stmt); vy_index_unref(itr->index); - tuple_unref(itr->key); TRASH(itr); } diff --git a/src/box/vy_run.c b/src/box/vy_run.c index 548e6a2e028159a966c4477200eb7289f4a1f1ba..147c6410fff73fd3c1944d40ce5ae0711ce1512d 100644 --- a/src/box/vy_run.c +++ b/src/box/vy_run.c @@ -1508,7 +1508,7 @@ void vy_run_iterator_open(struct vy_run_iterator *itr, struct vy_run_iterator_stat *stat, struct vy_run_env *run_env, struct vy_slice *slice, enum iterator_type iterator_type, - struct tuple *key, const struct vy_read_view **rv, + const struct tuple *key, const struct vy_read_view **rv, const struct key_def *cmp_def, const struct key_def *key_def, struct tuple_format *format, @@ -1527,7 +1527,6 @@ vy_run_iterator_open(struct vy_run_iterator *itr, itr->iterator_type = iterator_type; itr->key = key; - tuple_ref(key); itr->read_view = rv; itr->curr_stmt = NULL; @@ -1763,7 +1762,6 @@ vy_run_iterator_close(struct vy_stmt_iterator *vitr) assert(vitr->iface->close == vy_run_iterator_close); struct vy_run_iterator *itr = (struct vy_run_iterator *) vitr; vy_run_iterator_cache_clean(itr); - tuple_unref(itr->key); TRASH(itr); } diff --git a/src/box/vy_run.h b/src/box/vy_run.h index 5effe2c7c3e065a90d05e6a1fbbd8d4805626a54..be6eb0e00dbf448e27bc8a6ed9cc9ab628ac387f 100644 --- a/src/box/vy_run.h +++ b/src/box/vy_run.h @@ -236,7 +236,7 @@ struct vy_run_iterator { */ enum iterator_type iterator_type; /** Key to search. */ - struct tuple *key; + const struct tuple *key; /* LSN visibility, iterator shows values with lsn <= vlsn */ const struct vy_read_view **read_view; @@ -468,7 +468,7 @@ void vy_run_iterator_open(struct vy_run_iterator *itr, struct vy_run_iterator_stat *stat, struct vy_run_env *run_env, struct vy_slice *slice, enum iterator_type iterator_type, - struct tuple *key, const struct vy_read_view **rv, + const struct tuple *key, const struct vy_read_view **rv, const struct key_def *cmp_def, const struct key_def *key_def, struct tuple_format *format, diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c index d71e8896b6b1450835e0f07d2c6d181b72ff901f..9fc8d8918cc99fb306915a508a41326abb88a942 100644 --- a/src/box/vy_tx.c +++ b/src/box/vy_tx.c @@ -846,7 +846,8 @@ void vy_txw_iterator_open(struct vy_txw_iterator *itr, struct vy_txw_iterator_stat *stat, struct vy_tx *tx, struct vy_index *index, - enum iterator_type iterator_type, struct tuple *key) + enum iterator_type iterator_type, + const struct tuple *key) { itr->base.iface = &vy_txw_iterator_iface; itr->stat = stat; @@ -854,7 +855,6 @@ vy_txw_iterator_open(struct vy_txw_iterator *itr, itr->index = index; itr->iterator_type = iterator_type; itr->key = key; - tuple_ref(key); itr->version = UINT32_MAX; itr->curr_txv = NULL; itr->search_started = false; @@ -1030,7 +1030,7 @@ vy_txw_iterator_close(struct vy_stmt_iterator *vitr) { assert(vitr->iface->close == vy_txw_iterator_close); struct vy_txw_iterator *itr = (struct vy_txw_iterator *) vitr; - tuple_unref(itr->key); + (void)itr; /* suppress warn if NDEBUG */ TRASH(itr); } diff --git a/src/box/vy_tx.h b/src/box/vy_tx.h index bfbeffa438a33613961c8f701efca9a77549082e..1160c665e25fe2e2c0cfab097befdd34d6216779 100644 --- a/src/box/vy_tx.h +++ b/src/box/vy_tx.h @@ -369,7 +369,7 @@ struct vy_txw_iterator { */ enum iterator_type iterator_type; /** Search key. */ - struct tuple *key; + const struct tuple *key; /* Last seen value of the write set version. */ uint32_t version; /* Current position in the write set. */ @@ -385,7 +385,8 @@ void vy_txw_iterator_open(struct vy_txw_iterator *itr, struct vy_txw_iterator_stat *stat, struct vy_tx *tx, struct vy_index *index, - enum iterator_type iterator_type, struct tuple *key); + enum iterator_type iterator_type, + const struct tuple *key); #if defined(__cplusplus) } /* extern "C" */