[patches] Re: [PATCH 1/1] index: make index:min/max return a tuple with correct key

Konstantin Osipov kostja at tarantool.org
Wed Mar 7 20:33:42 MSK 2018


* Konstantin Osipov <kostja at tarantool.org> [18/03/07 20:23]:
> * v.shpilevoy at tarantool.org <v.shpilevoy at tarantool.org> [18/03/07 16:46]:

Nikita has found the cause of the issue, he has been misuing the
max api in sql bindings.

> 
> It turns out this patch breaks 2.0, selectB.test.lua in sql-tap
> suite. 
> 
> Somehow vdbe relies on the old behaviour of max.
> 
> Could you please investigate?
> 
> > Used EQ/REQ instead of manual LE, GE + cmp().
> > 
> > 
> > diff --git a/src/box/index.cc b/src/box/index.cc
> > index 5d1ad3571..1ab0aba58 100644
> > --- a/src/box/index.cc
> > +++ b/src/box/index.cc
> > @@ -38,7 +38,6 @@
> >  #include "txn.h"
> >  #include "rmean.h"
> >  #include "info.h"
> > -#include "tuple_compare.h"
> >  
> >  /* {{{ Utilities. **********************************************/
> >  
> > @@ -562,14 +561,11 @@ int
> >  generic_index_min(struct index *index, const char *key,
> >  		  uint32_t part_count, struct tuple **result)
> >  {
> > -	struct iterator *it = index_create_iterator(index, ITER_GE,
> > +	struct iterator *it = index_create_iterator(index, ITER_EQ,
> >  						    key, part_count);
> >  	if (it == NULL)
> >  		return -1;
> >  	int rc = iterator_next(it, result);
> > -	if (*result != NULL && tuple_compare_with_key(*result, key, part_count,
> > -						      index->def->key_def) != 0)
> > -		*result = NULL;
> >  	iterator_delete(it);
> >  	return rc;
> >  }
> > @@ -578,14 +574,11 @@ int
> >  generic_index_max(struct index *index, const char *key,
> >  		  uint32_t part_count, struct tuple **result)
> >  {
> > -	struct iterator *it = index_create_iterator(index, ITER_LE,
> > +	struct iterator *it = index_create_iterator(index, ITER_REQ,
> >  						    key, part_count);
> >  	if (it == NULL)
> >  		return -1;
> >  	int rc = iterator_next(it, result);
> > -	if (*result != NULL && tuple_compare_with_key(*result, key, part_count,
> > -						      index->def->key_def) != 0)
> > -		*result = NULL;
> >  	iterator_delete(it);
> >  	return rc;
> >  }
> > 
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.org - www.twitter.com/kostja_osipov

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



More information about the Tarantool-patches mailing list