[patches] [PATCH 1/1] test: vinyl secondary idx iterator skips changes of read keys

Vladimir Davydov vdavydov.dev at gmail.com
Fri Feb 16 11:54:06 MSK 2018


On Thu, Feb 15, 2018 at 10:11:09PM +0300, Vladislav Shpilevoy wrote:
> diff --git a/src/box/vinyl.c b/src/box/vinyl.c
> index 03ad2bf4a..3e2aa2fdc 100644
> --- a/src/box/vinyl.c
> +++ b/src/box/vinyl.c
> @@ -3845,6 +3845,14 @@ vinyl_iterator_next(struct iterator *base, struct tuple **ret)
>  	}
>  
>  	if (it->index->id > 0) {
> +#ifndef NDEBUG
> +		struct errinj *delay = errinj(ERRINJ_DELAY_PK_LOOKUP,
> +					      ERRINJ_BOOL);
> +		if (delay && delay->bparam) {
> +			while (delay->bparam)
> +				fiber_sleep(0.01);
> +		}
> +#endif

I'd prefer this errinj to take the delay in seconds, similarly to
how we inject other delays.

>  		/* Get the full tuple from the primary index. */
>  		if (vy_index_get(it->index->pk, it->tx, it->rv,
>  				 tuple, &tuple) != 0)
> diff --git a/src/errinj.h b/src/errinj.h
> index 512d2342f..d99fd7417 100644
> --- a/src/errinj.h
> +++ b/src/errinj.h
> @@ -105,6 +105,7 @@ struct errinj {
>  	_(ERRINJ_BUILD_SECONDARY, ERRINJ_INT, {.iparam = -1}) \
>  	_(ERRINJ_VY_POINT_ITER_WAIT, ERRINJ_BOOL, {.bparam = false}) \
>  	_(ERRINJ_RELAY_EXIT_DELAY, ERRINJ_DOUBLE, {.dparam = 0}) \
> +	_(ERRINJ_DELAY_PK_LOOKUP, ERRINJ_BOOL, {.bparam = false}) \

This errinj is for vinyl so please prefix it with VY_ and define near
other vinyl injections.

>  
>  ENUM0(errinj_id, ERRINJ_LIST);
>  extern struct errinj errinjs[];
> diff --git a/test/vinyl/errinj.result b/test/vinyl/errinj.result
> index 8aaa47457..b1e7b54f5 100644
> --- a/test/vinyl/errinj.result
> +++ b/test/vinyl/errinj.result
> @@ -1194,3 +1194,70 @@ box.commit()
>  s:drop()
>  ---
>  ...
> +--
> +-- gh-2442: secondary index cursor skips key, inserted after
> +-- the secondary index scan, but before a primary index lookup.
> +-- It is ok, and the test checks this.

So what happened before this issue was fixed? And what commit fixed it?

> +--
> +s = box.schema.create_space('test', {engine = 'vinyl'})
> +---
> +...
> +pk = s:create_index('pk')
> +---
> +...
> +sk = s:create_index('sk', {parts = {{2, 'unsigned'}}})
> +---
> +...
> +s:replace{1, 1}
> +---
> +- [1, 1]
> +...
> +s:replace{3, 3}
> +---
> +- [3, 3]
> +...
> +box.snapshot()
> +---
> +- ok
> +...
> +ret = nil
> +---
> +...
> +function do_read() ret = sk:select({2}, {iterator = 'GE'}) end
> +---
> +...
> +errinj.set("ERRINJ_DELAY_PK_LOOKUP", true)
> +---
> +- ok
> +...
> +f = fiber.create(do_read)
> +---
> +...
> +f
> +---
> +- status: suspended
> +  name: lua
> +  id: 247

Fix it please:

vinyl/errinj.test.lua                                           [ pass ]
vinyl/errinj.test.lua                                           [ fail ]

Test failed! Result content mismatch:
--- vinyl/errinj.result Fri Feb 16 11:46:45 2018
+++ vinyl/errinj.reject Fri Feb 16 11:47:21 2018
@@ -1237,7 +1237,7 @@
 ---
 - status: suspended
   name: lua
-  id: 247
+  id: 383



More information about the Tarantool-patches mailing list