From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: "N. Tatunov" <hollow653@gmail.com> Subject: [tarantool-patches] Re: [PATCH] sql: xfer optimization issue Date: Thu, 19 Jul 2018 03:20:48 +0300 [thread overview] Message-ID: <12B62C73-9BEC-49FA-B3FD-590C445CF25B@tarantool.org> (raw) In-Reply-To: <CAEi+_apjTxvQ7etgzH+KthvqWRx65=pVstxM7pXJ5Du4viz4EQ@mail.gmail.com> When answering on review, include only chunks related to your answers. Otherwise, letter becomes really long.. > > > @@ -1725,9 +1727,9 @@ xferOptimization(Parse * pParse, /* Parser context */ > > int emptyDestTest = 0; /* Address of test for empty pDest */ > > int emptySrcTest = 0; /* Address of test for empty pSrc */ > > Vdbe *v; /* The VDBE we are building */ > > - int destHasUniqueIdx = 0; /* True if pDest has a UNIQUE index */ > > int regData, regTupleid; /* Registers holding data and tupleid */ > > struct session *user_session = current_session(); > > + bool is_err_action_default = false; > > Again: why do you need this flag? Default action is just synonym for ABORT, > so why should we care about it? > > > It's all about conflict action priorities as I said before. > Consider the following example: > ``` > CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b); > CREATE TABLE t2(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b); > INSERT INTO t1 VALUES (1, 1), (3, 3), (5, 5); > INSERT INTO t2 VALUES (2, 2), (3, 4); > BEGIN; > INSERT INTO t2 VALUES (4, 4); > INSERT INTO t2 SELECT * FROM t1; > INSERT INTO t2 VALUES (10, 10); > COMMIT; onError is an action of whole statement, not of index. In your example onError == ABORT == DEFAULT. Replace action of index is not involved in code you wrote. >+ uint32_t src_space_id = SQLITE_PAGENO_TO_SPACEID(pSrc->tnum); >+ struct space *src_space = space_by_id(src_space_id); >+ uint32_t dest_space_id = SQLITE_PAGENO_TO_SPACEID(pDest->tnum); >+ struct space *dest_space = space_by_id(dest_space_id); Move here also assert: assert(src_space != NULL && dest_space != NULL); > > diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua > > new file mode 100755 > > index 0000000..e75fabc > > --- /dev/null > > +test:do_catchsql_test( > > + "xfer-optimization-1.15", > > + [[ > > + DROP TABLE t1; > > + DROP TABLE t2; > > + CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE); > > + CREATE TABLE t2(a INTEGER PRIMARY KEY, b UNIQUE); > > + INSERT INTO t1 VALUES (2, 2), (3, 3), (5, 5); > > + INSERT INTO t2 VALUES (1, 1), (4, 4); > > + INSERT OR ROLLBACK INTO t2 SELECT * FROM t1; > > INSERT OT ROLLBACK outside transaction works the same as ABORT and DEFAULT. > So, surround it with transaction and check that it really rollbacks. > > There are basically almost the same tests surrounded by transactions (1.30 - 1.35). If so, remove redundant tests pls. > -/* Opcode: RowData P1 P2 * * * > +/* Opcode: RowData P1 P2 * * P5 > * Synopsis: r[P2]=data > * > * Write into register P2 the complete row content for the row at > @@ -3984,6 +3994,8 @@ case OP_SorterData: { > * There is no interpretation of the data. > * It is just copied onto the P2 register exactly as > * it is found in the database file. > + * P5 can be used in debug mode to check if xferOptimization has > + * actually started processing. > * > * If cursor P1 is an index, then the content is the key of the row. > * If cursor P2 is a table, then the content extracted is the data. > @@ -3996,6 +4008,13 @@ case OP_RowData: { > BtCursor *pCrsr; > u32 n; > > +#ifdef SQLITE_TEST > + if (pOp->p5 == 1) { Use named value (i.e. OPFLAG_XFER_OPT) even if they are the same. > + > +test:do_execsql_test( > + "xfer-optimization-1.37", > + [[ > + INSERT INTO t2 VALUES (10, 10); Here (and in some other places) smth wrong with indentation, fix it pls.
next prev parent reply other threads:[~2018-07-19 0:20 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-18 15:32 [tarantool-patches] " N.Tatunov 2018-04-18 16:33 ` [tarantool-patches] " Hollow111 2018-04-19 11:22 ` n.pettik 2018-04-19 15:36 ` Hollow111 2018-04-20 1:02 ` n.pettik 2018-04-20 15:09 ` Hollow111 2018-04-20 16:09 ` n.pettik 2018-04-20 17:59 ` Hollow111 2018-04-23 23:40 ` n.pettik 2018-04-27 15:45 ` Hollow111 2018-05-03 22:57 ` n.pettik 2018-05-04 12:54 ` Hollow111 2018-06-28 10:18 ` Alexander Turenko 2018-07-09 15:50 ` Alexander Turenko 2018-07-16 12:54 ` Nikita Tatunov 2018-07-16 13:06 ` n.pettik 2018-07-16 13:20 ` Nikita Tatunov 2018-07-16 18:37 ` Nikita Tatunov 2018-07-16 19:12 ` n.pettik 2018-07-16 21:27 ` Nikita Tatunov 2018-07-18 15:13 ` n.pettik 2018-07-18 20:18 ` Nikita Tatunov 2018-07-19 0:20 ` n.pettik [this message] 2018-07-19 17:26 ` Nikita Tatunov 2018-07-20 3:20 ` n.pettik 2018-07-20 11:56 ` Nikita Tatunov 2018-07-20 16:43 ` n.pettik 2018-07-20 16:58 ` Nikita Tatunov 2018-07-29 1:12 ` Alexander Turenko 2018-07-29 11:23 ` n.pettik 2018-07-29 15:16 ` Alexander Turenko 2018-07-30 18:33 ` Nikita Tatunov 2018-07-30 22:17 ` Alexander Turenko 2018-07-31 11:48 ` Nikita Tatunov 2018-07-31 13:29 ` Alexander Turenko 2018-07-31 17:04 ` Nikita Tatunov 2018-07-31 17:44 ` Alexander Turenko 2018-08-21 16:43 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=12B62C73-9BEC-49FA-B3FD-590C445CF25B@tarantool.org \ --to=korablev@tarantool.org \ --cc=hollow653@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH] sql: xfer optimization issue' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox