[tarantool-patches] Re: [PATCH] sql: refactor SQL cursor to remove write ones

Kirill Yukhin kyukhin at tarantool.org
Fri Oct 5 07:39:44 MSK 2018


Hello,
On 04 окт 15:00, Kirill Yukhin wrote:
> Hello,
> On 01 окт 13:31, Kirill Yukhin wrote:
> > In Tarantool opening and positioning cursor for writing
> > have no sense. So refactor SQL code, to perform:
> >   - Creation of ephemeral table w/o any cursors machinery.
> >     No op-code returns register which contains plain pointer
> >     to the ephemeral space.
> >   - OpenRead/OpenWrite opcodes were replaced with single
> >     CursorOpen op-code, which establishes new cursor w/
> >     intention to sebsequent read from the space. This opcode
> >     accepts both plain pointer (in P4 operand) and register
> >     which contains pointer (inn P3) to the ephemeral space.
> > This query scheduler and DML routines thoroughly.
> > 
> > Closes #3182
> > Part of #2362
> > ---
> > Branch: https://github.com/tarantool/tarantool/commits/kyukhin/gh-3182-repair-cursors-2
> > Issue: https://github.com/tarantool/tarantool/issues/3182
> Patch was checked into 2.0 branch.

Seems like the patch broken testing in release mode. This is
due to non-initialized local variable.

Patch in the bottom fixes that. Comitted as obvious into 2.0
branch.

--
Regard, Kirill Yukhin

commit cebcf21114f50141e8aa0a72f30ea47dfbfef16c
Author: Kirill Yukhin <kyukhin at tarantool.org>
Date:   Fri Oct 5 07:19:56 2018 +0300

    sql: fix local var initialization in select planner
    
    Not initialized var led to crashes in non-debug
    modes.
---
 src/box/sql/where.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index 6a1bea0..520a847 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -4591,7 +4591,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 		if (pLoop->wsFlags & WHERE_INDEXED) {
 			struct index_def *idx_def = pLoop->index_def;
 			int iIndexCur;
-			int op;
+			int op = OP_IteratorOpen;
 			/* Check if index is primary. Either of
 			 * points should be true:
 			 * 1. struct Index is non-NULL and is
@@ -4636,7 +4636,6 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 					}
 				}
 				assert(wctrlFlags & WHERE_ONEPASS_DESIRED);
-				op = OP_IteratorOpen;
 				pWInfo->aiCurOnePass[1] = iIndexCur;
 			} else if (iAuxArg
 				   && (wctrlFlags & WHERE_OR_SUBCLAUSE) != 0) {




More information about the Tarantool-patches mailing list