Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] space: fix space_group_id return value
@ 2019-04-02 17:06 Vladimir Davydov
  2019-04-02 17:06 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vladimir Davydov @ 2019-04-02 17:06 UTC (permalink / raw)
  To: tarantool-patches

Should be uint32_t obviously, not bool. This didn't affect anything,
because there are only two replication groups right now - 0 and 1.

Spotted by @GeorgyKirichenko.

Fixes commit f64f46199e19 ("Introduce replica local spaces").
---
 src/box/space.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/space.h b/src/box/space.h
index bbb2addd..13a220d1 100644
--- a/src/box/space.h
+++ b/src/box/space.h
@@ -235,7 +235,7 @@ space_is_temporary(struct space *space)
 }
 
 /** Return replication group id of a space. */
-static inline bool
+static inline uint32_t
 space_group_id(struct space *space)
 {
 	return space->def->opts.group_id;
-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple
  2019-04-02 17:06 [PATCH] space: fix space_group_id return value Vladimir Davydov
@ 2019-04-02 17:06 ` Vladimir Davydov
  2019-04-02 17:09   ` Vladimir Davydov
  2019-04-02 17:09 ` [PATCH] space: fix space_group_id return value Vladimir Davydov
  2019-04-02 18:05 ` [tarantool-patches] " Konstantin Osipov
  2 siblings, 1 reply; 5+ messages in thread
From: Vladimir Davydov @ 2019-04-02 17:06 UTC (permalink / raw)
  To: tarantool-patches

So as not to confuse it with a tuple comparison hint.
---
 src/box/vy_write_iterator.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c
index ee2cb7ae..6818a31c 100644
--- a/src/box/vy_write_iterator.c
+++ b/src/box/vy_write_iterator.c
@@ -803,7 +803,7 @@ next_lsn:
  * one statement.
  *
  * @param stream Write iterator.
- * @param hint   The tuple from a previous read view (can be NULL).
+ * @param prev_tuple Tuple from the previous read view (can be NULL).
  * @param rv Read view to merge.
  * @param is_first_insert Set if the oldest statement for the
  * current key among all sources is an INSERT.
@@ -812,7 +812,7 @@ next_lsn:
  * @retval -1 Memory error.
  */
 static NODISCARD int
-vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
+vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *prev_tuple,
 		   struct vy_read_view_stmt *rv, bool is_first_insert)
 {
 	assert(rv != NULL);
@@ -824,7 +824,8 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
 	 * by a read view if it is preceded by another DELETE for
 	 * the same key.
 	 */
-	if (hint != NULL && vy_stmt_type(hint) == IPROTO_DELETE &&
+	if (prev_tuple != NULL &&
+	    vy_stmt_type(prev_tuple) == IPROTO_DELETE &&
 	    vy_stmt_type(h->tuple) == IPROTO_DELETE) {
 		vy_write_history_destroy(h);
 		rv->history = NULL;
@@ -840,11 +841,11 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
 	 *    it, whether is_last_level is true or not.
 	 */
 	if (vy_stmt_type(h->tuple) == IPROTO_UPSERT &&
-	    (stream->is_last_level || (hint != NULL &&
-	     vy_stmt_type(hint) != IPROTO_UPSERT))) {
-		assert(!stream->is_last_level || hint == NULL ||
-		       vy_stmt_type(hint) != IPROTO_UPSERT);
-		struct tuple *applied = vy_apply_upsert(h->tuple, hint,
+	    (stream->is_last_level || (prev_tuple != NULL &&
+	     vy_stmt_type(prev_tuple) != IPROTO_UPSERT))) {
+		assert(!stream->is_last_level || prev_tuple == NULL ||
+		       vy_stmt_type(prev_tuple) != IPROTO_UPSERT);
+		struct tuple *applied = vy_apply_upsert(h->tuple, prev_tuple,
 							stream->cmp_def, false);
 		if (applied == NULL)
 			return -1;
@@ -893,7 +894,7 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
 		}
 		vy_stmt_set_flags(rv->tuple, flags & ~VY_STMT_DEFERRED_DELETE);
 	}
-	if (hint != NULL) {
+	if (prev_tuple != NULL) {
 		/* Not the first statement. */
 		return 0;
 	}
@@ -974,11 +975,11 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count)
 	 * here > 0.
 	 */
 	assert(rv >= &stream->read_views[0] && rv->history != NULL);
-	struct tuple *hint = NULL;
+	struct tuple *prev_tuple = NULL;
 	for (; rv >= &stream->read_views[0]; --rv) {
 		if (rv->history == NULL)
 			continue;
-		if (vy_read_view_merge(stream, hint, rv,
+		if (vy_read_view_merge(stream, prev_tuple, rv,
 				       is_first_insert) != 0)
 			goto error;
 		assert(rv->history == NULL);
@@ -986,7 +987,7 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count)
 			continue;
 		stream->rv_used_count++;
 		++*count;
-		hint = rv->tuple;
+		prev_tuple = rv->tuple;
 	}
 	region_truncate(region, used);
 	return 0;
-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] space: fix space_group_id return value
  2019-04-02 17:06 [PATCH] space: fix space_group_id return value Vladimir Davydov
  2019-04-02 17:06 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov
@ 2019-04-02 17:09 ` Vladimir Davydov
  2019-04-02 18:05 ` [tarantool-patches] " Konstantin Osipov
  2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Davydov @ 2019-04-02 17:09 UTC (permalink / raw)
  To: tarantool-patches

On Tue, Apr 02, 2019 at 08:06:16PM +0300, Vladimir Davydov wrote:
> Should be uint32_t obviously, not bool. This didn't affect anything,
> because there are only two replication groups right now - 0 and 1.
> 
> Spotted by @GeorgyKirichenko.
> 
> Fixes commit f64f46199e19 ("Introduce replica local spaces").
> ---
>  src/box/space.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Trivial, pushed to master.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple
  2019-04-02 17:06 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov
@ 2019-04-02 17:09   ` Vladimir Davydov
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Davydov @ 2019-04-02 17:09 UTC (permalink / raw)
  To: tarantool-patches

On Tue, Apr 02, 2019 at 08:06:17PM +0300, Vladimir Davydov wrote:
> So as not to confuse it with a tuple comparison hint.
> ---
>  src/box/vy_write_iterator.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)

Trivial, pushed to master.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tarantool-patches] Re: [PATCH] space: fix space_group_id return value
  2019-04-02 17:06 [PATCH] space: fix space_group_id return value Vladimir Davydov
  2019-04-02 17:06 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov
  2019-04-02 17:09 ` [PATCH] space: fix space_group_id return value Vladimir Davydov
@ 2019-04-02 18:05 ` Konstantin Osipov
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Osipov @ 2019-04-02 18:05 UTC (permalink / raw)
  To: tarantool-patches

* Vladimir Davydov <vdavydov.dev@gmail.com> [19/04/02 20:25]:
> Should be uint32_t obviously, not bool. This didn't affect anything,
> because there are only two replication groups right now - 0 and 1.
> 

OK to push.


 

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-02 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 17:06 [PATCH] space: fix space_group_id return value Vladimir Davydov
2019-04-02 17:06 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov
2019-04-02 17:09   ` Vladimir Davydov
2019-04-02 17:09 ` [PATCH] space: fix space_group_id return value Vladimir Davydov
2019-04-02 18:05 ` [tarantool-patches] " Konstantin Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox