Changeset: 10083c4cf7c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10083c4cf7c0
Added Files:
sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat
sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh
sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err
sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.sql
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.stable.err
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.stable.out
Modified Files:
buildtools/selinux/monetdb.te
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/jdbc/tests/Tests/All
sql/server/rel_optimizer.c
sql/test/BugTracker-2019/Tests/All
Branch: default
Log Message:
Merge with Nov2019 branch.
diffs (truncated from 441 to 300 lines):
diff --git a/buildtools/selinux/monetdb.te b/buildtools/selinux/monetdb.te
--- a/buildtools/selinux/monetdb.te
+++ b/buildtools/selinux/monetdb.te
@@ -1,4 +1,4 @@
-policy_module(monetdb, 0.6)
+policy_module(monetdb, 0.7)
# The above line declares that this file is a SELinux policy file. Its
# name is monetdb, so the file should be saved as monetdb.te
@@ -8,8 +8,10 @@ require {
type tmp_t;
type var_t;
type user_home_t;
+ type user_home_dir_t;
type unconfined_service_t; # for EPEL 7
type proc_t; # for EPEL 7
+ type cgroup_t;
class dir { read };
class fd { use };
class fifo_file { getattr read write };
@@ -125,6 +127,7 @@ allow mserver5_t self:unix_stream_socket
allow mserver5_t self:netlink_selinux_socket create_socket_perms;
manage_dirs_pattern(mserver5_t, tmp_t, tmp_t)
manage_sock_files_pattern(mserver5_t, tmp_t, tmp_t)
+allow mserver5_t tmp_t:file create;
manage_sock_files_pattern(mserver5_t, mserver5_db_t, mserver5_db_t)
allow mserver5_t monetdbd_t:fifo_file { read write getattr };
allow mserver5_t monetdbd_t:unix_stream_socket { read write getopt shutdown };
@@ -132,10 +135,13 @@ allow mserver5_t var_t:dir { read };
# we want to be able to read some cgroup files
fs_search_cgroup_dirs(mserver5_t);
fs_read_cgroup_files(mserver5_t);
+allow mserver5_t cgroup_t:dir search;
+allow mserver5_t self:process execmem;
allow monetdbd_t var_t:dir { read };
gen_tunable(mserver5_can_read_home, false)
tunable_policy(`mserver5_can_read_home', `
userdom_search_user_home_dirs(mserver5_t)
allow mserver5_t user_home_t:file read_file_perms;
+ allow mserver5_t user_home_dir_t:dir search;
')
allow monetdbd_t mserver5_t:unix_stream_socket { connectto };
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1973,7 +1973,7 @@ rel2bin_join(backend *be, sql_rel *rel,
/* only handle simple joins here */
if ((exp_has_func(e) && get_cmp(e) != cmp_filter) ||
- get_cmp(e) == cmp_or || e->f) {
+ get_cmp(e) == cmp_or || (e->f && e->anti)) {
if (!join && !list_length(lje)) {
stmt *l = bin_first_column(be, left);
stmt *r = bin_first_column(be, right);
@@ -2248,65 +2248,6 @@ rel2bin_semijoin(backend *be, sql_rel *r
* first cheap join(s) (equality or idx)
* second selects/filters
*/
-
-#if 0
- if (rel->exps && rel->op == op_anti && need_no_nil(rel)) {
- sql_subtype *lng = sql_bind_localtype("lng");
- stmt *nilcnt = NULL;
-
- for( en = rel->exps->h; en; en = en->next ) {
- sql_exp *e = en->data, *r, *l;
- stmt *s;
-
- if (e->type != e_cmp || e->flag != cmp_equal)
- break;
- l = e->l;
- r = e->r;
-
- /* for each equality join add a rel_select(r is NULL) */
- s = exp_bin(be, r, right, NULL, NULL, NULL, NULL, NULL);
- if (!s) {
- s = exp_bin(be, l, right, NULL, NULL, NULL,
NULL, NULL);
- if(!s)
- return NULL;
- }
- if (s && !exp_is_atom(r)) {
- sql_subaggr *cnt = sql_bind_aggr(sql->sa,
sql->session->schema, "count", NULL);
- sql_subfunc *add =
sql_bind_func_result(sql->sa, sql->session->schema, "sql_add", lng, lng, lng);
-
- s = stmt_selectnil(be, s);
- s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
- if (nilcnt) {
- nilcnt = stmt_binop(be, nilcnt, s, add);
- } else {
- nilcnt = s;
- }
- }
- }
- if (nilcnt) {
- sql_subtype *bt = sql_bind_localtype("bit");
- sql_subfunc *ne = sql_bind_func_result(sql->sa,
sql->session->schema, "<>", lng, lng, bt);
- stmt *ls = bin_first_column(be, left), *s, *sel;
- list *l;
-
- s = stmt_binop(be, nilcnt, stmt_atom_lng(be, 0), ne);
- /* keep if no nulls are in the right side */
- ls = stmt_const(be, ls, stmt_bool(be,0));
- sel = stmt_uselect(be, ls, s, cmp_equal, NULL, 0);
- l = sa_list(sql->sa);
- for( n = left->op4.lval->h; n; n = n->next ) {
- stmt *col = n->data;
-
- if (col->nrcols == 0) /* constant */
- col = stmt_const(be, sel, col);
- else
- col = stmt_project(be, sel, col);
- list_append(l, col);
- }
- left = stmt_list(be, l);
- }
- }
-#endif
if (rel->exps) {
int idx = 0;
list *jexps = sa_list(sql->sa);
@@ -2335,7 +2276,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
/* only handle simple joins here */
if ((exp_has_func(e) && get_cmp(e) != cmp_filter) ||
- get_cmp(e) == cmp_or || e->f) {
+ get_cmp(e) == cmp_or || (e->f && e->anti)) {
if (!join && !list_length(lje)) {
stmt *l = bin_first_column(be, left);
stmt *r = bin_first_column(be, right);
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -1591,7 +1591,7 @@ select2_join2(backend *be, stmt *op1, st
if (op1->nr < 0 && (sub && sub->nr < 0))
return NULL;
l = op1->nr;
- if (((cmp & CMP_BETWEEN && cmp & CMP_SYMMETRIC) || op2->nrcols > 0 ||
op3->nrcols > 0) && (type == st_uselect2)) {
+ if (((cmp & CMP_BETWEEN && cmp & CMP_SYMMETRIC) || (cmp & CMP_BETWEEN
&& anti) || op2->nrcols > 0 || op3->nrcols > 0) && (type == st_uselect2)) {
int k;
if (op2->nr < 0 || op3->nr < 0)
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -44,3 +44,4 @@ HAVE_JDBCTESTS?Bug_Connect_as_voc_getMet
HAVE_JDBCTESTS?Bug_PrepStmtSetString_6382
HAVE_JDBCTESTS?Bug_LargeQueries_6571_6693
HAVE_JDBCTESTS?Bug_IsValid_Timeout_Bug_6782
+HAVE_JDBCTESTS?Bug_PrepStmt_With_Errors_Jira292
diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat
b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat
@@ -0,0 +1,1 @@
+@call "%TSTSRCDIR%\Test.SQL.bat" %*
diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh
b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$TSTSRCDIR/Test.SQL.sh $*
diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err
b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err
@@ -0,0 +1,39 @@
+stderr of test 'Bug_PrepStmt_With_Errors_Jira292` in directory
'sql/jdbc/tests` itself:
+
+
+# 14:46:39 >
+# 14:46:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35788" "--set"
"mapi_usock=/var/tmp/mtest-8623/.s.monetdb.35788" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests"
+# 14:46:39 >
+
+# builtin opt gdk_dbpath =
/export/scratch2/dinther/INSTALL/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 = 35788
+# cmdline opt mapi_usock = /var/tmp/mtest-8623/.s.monetdb.35788
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath =
/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests
+# cmdline opt gdk_debug = 536870922
+
+# 14:46:39 >
+# 14:46:39 > "./Bug_PrepStmtSetObject_CLOB_6349.SQL.sh"
"Bug_PrepStmtSetObject_CLOB_6349"
+# 14:46:39 >
+
+
+# 14:46:39 >
+# 14:46:39 > java Bug_PrepStmtSetObject_CLOB_6349
"jdbc:monetdb://toulouse:35788/mTests_sql_jdbc_tests?user=monetdb&password=monetdb"
+# 14:46:39 >
+
+
+# 14:46:40 >
+# 14:46:40 > "Done."
+# 14:46:40 >
+
diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out
b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out
@@ -0,0 +1,55 @@
+stdout of test 'Bug_PrepStmt_With_Errors_Jira292` in directory
'sql/jdbc/tests` itself:
+
+
+# 14:46:39 >
+# 14:46:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=35788" "--set"
"mapi_usock=/var/tmp/mtest-8623/.s.monetdb.35788" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests"
+# 14:46:39 >
+
+# MonetDB 5 server v11.27.2
+# This is an unreleased version
+# Serving database 'mTests_sql_jdbc_tests', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.588 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:35788/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-8623/.s.monetdb.35788
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+# 20:28:13 >
+# 20:28:13 > "./Bug_PrepStmt_With_Errors_Jira292.SQL.sh"
"Bug_PrepStmt_With_Errors_Jira292"
+# 20:28:13 >
+
+# 14:46:39 >
+# 14:46:39 > "./Bug_PrepStmtSetObject_CLOB_6349.SQL.sh"
"Bug_PrepStmtSetObject_CLOB_6349"
+# 14:46:39 >
+
+
+# 14:46:39 >
+# 14:46:39 > java Bug_PrepStmtSetObject_CLOB_6349
"jdbc:monetdb://toulouse:35788/mTests_sql_jdbc_tests?user=monetdb&password=monetdb"
+# 14:46:39 >
+
+0. true true
+1. table created and inserted 1 row
+2. before select query execution
+2a. select query executed
+2c. closed select query resultset
+2d. normal end of select query
+3. before creating a prepared select query
+3a. prepared select query
+3b. Prepared Query has 0 parameters.
+3c. Prepared Query has 1 columns. Type of first is: varchar
+3d. before executing the prepared select query
+3e. prepared select query executed
+3f. prepared Query ResultSet has 1 columns. Type of first is: varchar
+3h. closed prepared select query resultset
+3i. normal end of prepared select query
+4. drop table
+5. normal end of test
+
+# 19:43:34 >
+# 19:43:34 > "Done."
+# 19:43:34 >
+
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
@@ -4780,12 +4780,39 @@ rel_push_join_down(int *changes, mvc *sq
*
* also push simple expressions of a semijoin down if they only
* involve the left sided of the semijoin.
+ *
+ * in some cases the other way is usefull, ie push join down
+ * semijoin. When the join reduces (ie when there are selects on it).
*/
static sql_rel *
-rel_push_semijoin_down(int *changes, mvc *sql, sql_rel *rel)
+rel_push_semijoin_down_or_up(int *changes, mvc *sql, sql_rel *rel)
{
(void)*changes;
+ if (rel->op == op_join && rel->exps && rel->l) {
+ sql_rel *l = rel->l, *r = rel->r;
+
+ if (is_semi(l->op) && !rel_is_ref(l) && is_select(r->op) &&
!rel_is_ref(r)) {
+ rel->l = l->l;
+ l->l = rel;
+ return l;
+ }
+ }
+ /* also case with 2 joins */
+ /* join ( join ( semijoin(), table), select (table)); */
+ if (rel->op == op_join && rel->exps && rel->l) {
+ sql_rel *l = rel->l, *r = rel->r;
+ sql_rel *ll;
+
+ if (is_join(l->op) && !rel_is_ref(l) && is_select(r->op) &&
!rel_is_ref(r)) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list