Changeset: e80441a8dae6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e80441a8dae6 Added Files: sql/test/mergetables/Tests/mergedb.Bug-6820.sql sql/test/mergetables/Tests/mergedb.sql sql/test/mergetables/Tests/mergedb_drop.sql Modified Files: monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c sql/test/mergetables/Tests/All Branch: Jul2017 Log Message:
merged diffs (191 lines): diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -116,6 +116,7 @@ newMalBlk(int elements) mb->sealedProp = 0; mb->replica = NULL; mb->trap = 0; + mb->starttime = 0; mb->runtime = 0; mb->calls = 0; mb->optimize = 0; diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -360,7 +360,7 @@ str runMAL(Client cntxt, MalBlkPtr mb, M garbageCollector(cntxt, mb, stk, env != stk); if (stk && stk != env) freeStack(stk); - if (cntxt->qtimeout && GDKusec()- mb->starttime > cntxt->qtimeout) + if (ret == MAL_SUCCEED && cntxt->qtimeout && GDKusec()- mb->starttime > cntxt->qtimeout) throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT); return ret; } @@ -452,10 +452,10 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS default: throw(MAL, "mal.interpreter", RUNTIME_UNKNOWN_INSTRUCTION); } + if (stk) + garbageCollector(cntxt, mb, stk, TRUE); if ( ret == MAL_SUCCEED && cntxt->qtimeout && GDKusec()- mb->starttime > cntxt->qtimeout) throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT); - if (stk) - garbageCollector(cntxt, mb, stk, TRUE); return ret; } @@ -806,6 +806,8 @@ str runMALsequence(Client cntxt, MalBlkP continue; runtimeProfileExit(cntxt, mb, stk, pci, &runtimeProfile); /* check for strong debugging after each MAL statement */ + /* when we find a timeout situation, then the result is already known + * and assigned, the backup version is not removed*/ if ( pci->token != FACcall && ret== MAL_SUCCEED) { for (i = 0; i < pci->retc; i++) { lhs = &backup[i]; diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All --- a/sql/test/mergetables/Tests/All +++ b/sql/test/mergetables/Tests/All @@ -19,3 +19,7 @@ singlekeyconstraint part-elim mergedropcascade addtable + +mergedb +mergedb.Bug-6820 +mergedb_drop diff --git a/sql/test/mergetables/Tests/mergedb.Bug-6820.sql b/sql/test/mergetables/Tests/mergedb.Bug-6820.sql new file mode 100644 --- /dev/null +++ b/sql/test/mergetables/Tests/mergedb.Bug-6820.sql @@ -0,0 +1,55 @@ +select + sample_8.dimpos as c0, + ref_4.x as c1, + ref_2.y as c2 +from + sys.r3 as ref_2 + left join tmp._tables as sample_6 + on (ref_2.y = sample_6.id ) + left join sys._tables as sample_7 + right join sys.netcdf_vardim as sample_8 + left join sys.querylog_catalog as ref_3 + on (sample_8.dimpos = ref_3.mal ) + on (true) + left join sys.s1 as ref_4 + on (sample_8.dimpos = ref_4.x ) + on ((sample_7.id is NULL) + or (sample_8.var_id is not NULL)) + left join sys.optimizers as ref_12 + inner join bam.sq as ref_13 + on (ref_12.def = ref_13.sn ) + inner join sys.keywords as ref_14 + on (ref_13.sp is not NULL) + on ((sample_6.commit_action is NULL) + or (ref_14.keyword is not NULL)) +where ref_3.optimize is NULL +limit 86; + +select + ref_7.length as c0, + sample_1.type as c1, + ref_7.length as c2, + sample_8.function_type_id as c3 +from + sys.columns as sample_1 + inner join bam.rg as ref_4 + left join sys.keys as ref_6 + on (ref_4.pi = ref_6.id ) + right join sys.table_types as sample_7 + left join sys.function_types as sample_8 + left join sys.r as sample_9 + on (sample_9.y is not NULL) + on (sample_7.table_type_name = sample_8.function_type_name ) + left join sys.r as sample_10 + right join sys.netcdf_dims as ref_7 + on ((false) + or (true)) + on (sample_10.z is not NULL) + right join sys._tables as sample_12 + left join bam.rg as ref_8 + on (sample_12.id = ref_8.pi ) + on (sample_10.y = ref_8.pi ) + on (ref_4.cn = sample_9.z ) + on (sample_1.type_scale = ref_4.pi ) +where sample_10.y is NULL +limit 14; diff --git a/sql/test/mergetables/Tests/mergedb.sql b/sql/test/mergetables/Tests/mergedb.sql new file mode 100644 --- /dev/null +++ b/sql/test/mergetables/Tests/mergedb.sql @@ -0,0 +1,56 @@ +-- create a small database with Partitioned data +-- used in sqlsmith testing +CREATE TABLE R1 ( x integer primary key, y integer, z string); +COPY 4 RECORDS INTO R1 FROM stdin USING DELIMITERS ' ','\n'; +0 0 hello +1 0 hello +2 1 world +3 1 world + +CREATE TABLE R2 ( x integer primary key, y integer, z string); +COPY 4 RECORDS INTO R2 FROM stdin USING DELIMITERS ' ','\n'; +5 0 hello +6 0 hello +7 1 world +8 1 world + +CREATE TABLE R3 ( x integer primary key, y integer, z string); +COPY 4 RECORDS INTO R3 FROM stdin USING DELIMITERS ' ','\n'; +10 0 hello +11 0 hello +12 1 world +13 1 world + +CREATE MERGE TABLE R ( x integer primary key, y integer, z string); +ALTER TABLE R ADD TABLE R1; +ALTER TABLE R ADD TABLE R2; +ALTER TABLE R ADD TABLE R3; + +SELECT * FROM R; + +CREATE TABLE S1 ( x integer primary key, y integer, z string); +COPY 7 RECORDS INTO S1 FROM stdin USING DELIMITERS ' ','\n'; +0 0 hello +1 0 hello +2 1 world +3 1 world +4 1 bye +5 0 hello +6 0 hello + +CREATE TABLE S2 ( x integer primary key, y integer, z string); +COPY 7 RECORDS INTO S2 FROM stdin USING DELIMITERS ' ','\n'; +7 1 world +8 1 world +9 1 bye +10 0 hello +11 0 hello +12 1 world +13 1 world + +CREATE MERGE TABLE S ( x integer primary key, y integer, z string); +ALTER TABLE S ADD TABLE S1; +ALTER TABLE S ADD TABLE S2; + +SELECT * FROM S; + diff --git a/sql/test/mergetables/Tests/mergedb_drop.sql b/sql/test/mergetables/Tests/mergedb_drop.sql new file mode 100644 --- /dev/null +++ b/sql/test/mergetables/Tests/mergedb_drop.sql @@ -0,0 +1,9 @@ +-- create a small database with Partitioned data +-- used in sqlsmith testing +drop table R; +drop table R1; +drop table R2; +drop table R3; +drop table S; +drop table S1; +drop table S2; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list