Changeset: 31588b3c1500 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=31588b3c1500 Added Files: sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.32bit sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.sql sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.err sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.out sql/test/pg_regress/Tests/oid.stable.err.64bit.int128 sql/test/pg_regress/Tests/oid.stable.err.64bit.oid32 Removed Files: sql/test/pg_regress/Tests/oid.stable.err.int128 sql/test/pg_regress/Tests/oid.stable.err.oid32 Modified Files: MonetDB.spec debian/changelog gdk/ChangeLog-Archive monetdb5/mal/mal_authorize.c monetdb5/optimizer/opt_pipes.c sql/server/rel_optimizer.c sql/test/BugTracker-2016/Tests/All testing/Mtest.py.in Branch: Jun2016 Log Message:
Merge with Jul2015 branch. diffs (truncated from 378 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -997,7 +997,7 @@ rm -f %{buildroot}%{_bindir}/Maddlog * Mon Apr 4 2016 Sjoerd Mullender <sjo...@acm.org> - 11.21.19-20160405 - gdk: Fixed a bug that caused various instances where old data returned or where crashes occurred. The problem was that internally data wasn't - always marked dirty when it was being changed, causiing later processing + always marked dirty when it was being changed, causing later processing to not deal with the changed data correctly. * Thu Mar 24 2016 Sjoerd Mullender <sjo...@acm.org> - 11.21.17-20160324 diff --git a/debian/changelog b/debian/changelog --- a/debian/changelog +++ b/debian/changelog @@ -13,7 +13,7 @@ monetdb (11.21.19) unstable; urgency=low * gdk: Fixed a bug that caused various instances where old data returned or where crashes occurred. The problem was that internally data wasn't - always marked dirty when it was being changed, causiing later processing + always marked dirty when it was being changed, causing later processing to not deal with the changed data correctly. -- Sjoerd Mullender <sjo...@acm.org> Mon, 4 Apr 2016 11:29:47 +0200 diff --git a/gdk/ChangeLog-Archive b/gdk/ChangeLog-Archive --- a/gdk/ChangeLog-Archive +++ b/gdk/ChangeLog-Archive @@ -4,7 +4,7 @@ * Mon Apr 4 2016 Sjoerd Mullender <sjo...@acm.org> - 11.21.19-20160405 - Fixed a bug that caused various instances where old data returned or where crashes occurred. The problem was that internally data wasn't - always marked dirty when it was being changed, causiing later processing + always marked dirty when it was being changed, causing later processing to not deal with the changed data correctly. * Wed Feb 4 2015 Sjoerd Mullender <sjo...@acm.org> - 11.21.1-20150807 diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -555,10 +555,10 @@ AUTHsetPassword(Client cntxt, str *usern str AUTHresolveUser(str *username, oid *uid) { - BUN p = *uid; + BUN p; BATiter useri; - if (uid == NULL || *uid == oid_nil || *uid > BATcount(user)) + if (uid == NULL || *uid == oid_nil || (p = (BUN) *uid) >= BATcount(user)) throw(ILLARG, "resolveUser", "userid should not be nil"); assert (username != NULL); @@ -590,7 +590,7 @@ AUTHgetUsername(str *username, Client cn * happens, it may be a security breach/attempt, and hence * terminating the entire system seems like the right thing to do to * me. */ - if (p == BUN_NONE || id > BATcount(user)) + if (p == BUN_NONE || id >= BATcount(user)) GDKfatal("Internal error: user id that doesn't exist: " OIDFMT, id); useri = bat_iterator(user); diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -433,7 +433,7 @@ compileOptimizer(Client cntxt, str name) for (i = 0; i < MAXOPTPIPES && pipes[i].name; i++) { if (strcmp(pipes[i].name, name) == 0 && pipes[i].mb == 0) { /* precompile the pipeline as MAL string */ - MCinitClientRecord(&c,(oid) 1, 0, 0); + MCinitClientRecord(&c, cntxt->user, 0, 0); c.nspace = newModule(NULL, putName("user", 4)); c.father = cntxt; /* to avoid conflicts on GDKin */ c.fdout = cntxt->fdout; diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1757,8 +1757,33 @@ rel_no_rename_exps( list *exps ) static void rel_rename_exps( mvc *sql, list *exps1, list *exps2) { + int pos = 0; node *n, *m; + /* check if a column uses an alias earlier in the list */ + for (n = exps1->h, m = exps2->h; n && m; n = n->next, m = m->next, pos++) { + sql_exp *e2 = m->data; + + if (e2->type == e_column) { + sql_exp *ne = NULL; + + if (e2->l) + ne = exps_bind_column2(exps2, e2->l, e2->r); + if (!ne && !e2->l) + ne = exps_bind_column(exps2, e2->r, NULL); + if (ne) { + int p = list_position(exps2, ne); + + if (p < pos) { + ne = list_fetch(exps1, p); + if (e2->l) + e2->l = exp_relname(ne); + e2->r = exp_name(ne); + } + } + } + } + assert(list_length(exps1) == list_length(exps2)); for (n = exps1->h, m = exps2->h; n && m; n = n->next, m = m->next) { sql_exp *e1 = n->data; @@ -3635,16 +3660,19 @@ rel_push_select_down_join(int *changes, for (n = exps->h; n; n = n->next) { sql_exp *e = n->data; if (e->type == e_cmp && !e->f && !is_complex_exp(e->flag)) { + sql_rel *nr = NULL; sql_exp *re = e->r, *ne = rel_find_exp(r, re); if (ne && ne->card >= CARD_AGGR) /* possibly changed because of apply rewrites */ re->card = ne->card; if (re->card >= CARD_AGGR) { - rel->l = rel_push_join(sql, r, e->l, re, NULL, e); + nr = rel_push_join(sql, r, e->l, re, NULL, e); } else { - rel->l = rel_push_select(sql, r, e->l, e); + nr = rel_push_select(sql, r, e->l, e); } + if (nr) + rel->l = nr; /* only pushed down selects are counted */ if (r == rel->l) { (*changes)++; @@ -7553,7 +7581,19 @@ rel_apply_rewrite(int *changes, mvc *sql r->r = r->l; r->l = rel; rel = r; - } else { /* both used or unused */ + } else if (rused && lused) { /* both used */ + sql_rel *la = rel, *ra = rel_create(sql->sa); + + ra->l = la->l; + ra->op = la->op; + ra->flag = la->flag; + la->r = r->l; + ra->r = r->r; + + r->l = la; + r->r = ra; + rel = r; + } else { /* both unused */ int flag = rel->flag; node *n; /* rewrite apply into join (later use flag, loj, join or exists (which is antijoin)) */ diff --git a/sql/test/BugTracker-2016/Tests/All b/sql/test/BugTracker-2016/Tests/All --- a/sql/test/BugTracker-2016/Tests/All +++ b/sql/test/BugTracker-2016/Tests/All @@ -22,3 +22,4 @@ group_distinct_quantile.Bug-3927 merge_project.Bug-3955 decimal_vs_integer.Bug-3941 foreign_key.Bug-3938 +rename_exps.Bug-3974 diff --git a/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.32bit b/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.32bit new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.32bit @@ -0,0 +1,94 @@ +stdout of test 'decimal_vs_integer.Bug-3941` in directory 'sql/test/BugTracker-2016` itself: + + +# 15:01:29 > +# 15:01:29 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37542" "--set" "mapi_usock=/var/tmp/mtest-23330/.s.monetdb.37542" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2016" "--set" "mal_listing=0" "--set" "embedded_r=yes" +# 15:01:29 > + +# MonetDB 5 server v11.21.12 +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2016', using 4 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked +# Found 7.332 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://localhost.nes.nl:37542/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-23330/.s.monetdb.37542 +# MonetDB/GIS module loaded +# Start processing logs sql/sql_logs version 52200 +# Start reading the write-ahead log 'sql_logs/sql/log.11' +# Finished reading the write-ahead log 'sql_logs/sql/log.11' +# Finished processing logs sql/sql_logs +# MonetDB/SQL module loaded +# MonetDB/R module loaded + +Ready. + +# 15:01:30 > +# 15:01:30 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-23330" "--port=37542" +# 15:01:30 > + +#start transaction; +#create table tmp(i decimal(8)); +#explain select count(*) from tmp where i = 20160222; +% .explain # table_name +% mal # name +% clob # type +% 107 # length +function user.s2_1(A0:int):void; + X_21:void := querylog.define("explain select count(*) from tmp where i = 20160222;","default_pipe",11); + X_2 := sql.mvc(); + X_6:bat[:oid,:int] := sql.bind(X_2,"sys","tmp","i",0); + X_9 := X_6; + X_3:bat[:oid,:oid] := sql.tid(X_2,"sys","tmp"); + X_10 := algebra.subselect(X_9,X_3,A0,A0,true,false,false); + X_13 := algebra.leftfetchjoin(X_10,X_9); + X_14 := aggr.count(X_13); + sql.resultSet("sys.L1","L1","wrd",32,0,7,X_14); +end user.s2_1; +# optimizer.mitosis() +# optimizer.dataflow() +#explain select count(*) from tmp where i = '20160222'; +% .explain # table_name +% mal # name +% clob # type +% 113 # length +function user.s3_1(A0:str):void; + X_23:void := querylog.define("explain select count(*) from tmp where i = \\'20160222\\';","default_pipe",12); + X_2 := sql.mvc(); + X_6:bat[:oid,:int] := sql.bind(X_2,"sys","tmp","i",0); + X_9 := X_6; + X_3:bat[:oid,:oid] := sql.tid(X_2,"sys","tmp"); + X_10 := calc.int(A0,8,0); + X_12 := algebra.subselect(X_9,X_3,X_10,X_10,true,false,false); + X_15 := algebra.leftfetchjoin(X_12,X_9); + X_16 := aggr.count(X_15); + sql.resultSet("sys.L1","L1","wrd",32,0,7,X_16); +end user.s3_1; +# optimizer.mitosis() +# optimizer.dataflow() +#explain select count(*) from tmp where i = 201602221; +% .explain # table_name +% mal # name +% clob # type +% 108 # length +function user.s4_1(A0:lng):void; + X_23:void := querylog.define("explain select count(*) from tmp where i = 201602221;","default_pipe",12); + X_2 := sql.mvc(); + X_6:bat[:oid,:int] := sql.bind(X_2,"sys","tmp","i",0); + X_9 := X_6; + X_10:bat[:oid,:lng] := batcalc.lng(0,X_9,10,0); + X_3:bat[:oid,:oid] := sql.tid(X_2,"sys","tmp"); + X_12 := algebra.subselect(X_10,X_3,A0,A0,true,false,false); + X_15 := algebra.leftfetchjoin(X_12,X_9); + X_16 := aggr.count(X_15); + sql.resultSet("sys.L1","L1","wrd",32,0,7,X_16); +end user.s4_1; +# optimizer.mitosis() +# optimizer.dataflow() + +# 15:01:30 > +# 15:01:30 > "Done." +# 15:01:30 > + diff --git a/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.sql b/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.sql @@ -0,0 +1,3 @@ +create table foo (a int, b int); +prepare select count(b) from (select a,b from foo union all select null,null from foo) t; +drop table foo; diff --git a/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.err b/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.err @@ -0,0 +1,37 @@ +stderr of test 'rename_exps.Bug-3974` in directory 'sql/test/BugTracker-2016` itself: + + +# 12:27:17 > +# 12:27:17 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39847" "--set" "mapi_usock=/var/tmp/mtest-21445/.s.monetdb.39847" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2016" "--set" "mal_listing=0" "--set" "embedded_r=yes" +# 12:27:17 > + +# builtin opt gdk_dbpath = /home/niels/scratch/rc-monetdb/Linux-x86_64/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 39847 +# cmdline opt mapi_usock = /var/tmp/mtest-21445/.s.monetdb.39847 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2016 +# cmdline opt mal_listing = 0 +# cmdline opt embedded_r = yes +# cmdline opt gdk_debug = 536870922 _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list