MonetDB: default - Copy into file monetdbe + example_copy test u...

2021-02-25 Thread Thodoris Zois
Changeset: 2d3e3c26778b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d3e3c26778b
Modified Files:
ctest/tools/monetdbe/example_copy.c
sql/backends/monet5/sql.c
Branch: default
Log Message:

Copy into file monetdbe + example_copy test update


diffs (45 lines):

diff --git a/ctest/tools/monetdbe/example_copy.c 
b/ctest/tools/monetdbe/example_copy.c
--- a/ctest/tools/monetdbe/example_copy.c
+++ b/ctest/tools/monetdbe/example_copy.c
@@ -26,10 +26,12 @@ main(void)
if (monetdbe_open(, NULL, NULL))
error("Failed to open database");
 
-   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (b bool, x integer, 
f float, y string)", NULL, NULL)) != NULL)
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL)
error(err)
-
-   if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (TRUE, 42, 
42.42, 'Hello'), (NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL)
+   if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello', 
'2020-01-02 10:20:30', '2020-01-02', '10:20:30', '01020308'), \
+   
(NULL, 'World', NULL, NULL, NULL, 
NULL),\
+   
(NULL, 'Foo', NULL, NULL, NULL, NULL), \
+   
(43, 'Bar', '2021-02-03 11:21:31', 
'2021-02-03', '11:21:31', '01020306')", NULL, NULL)) != NULL)
error(err)
 
// Get working directory and construct the CSV path
@@ -40,12 +42,12 @@ main(void)
 
 strcpy(sql, "COPY SELECT * FROM test INTO '");
 strcat(sql, csv_path);
-strcat(sql, "' USING DELIMITERS ',' NULL AS ''");
+strcat(sql, "' USING DELIMITERS ','");
 
if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL)
error(err)

-   if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (b bool, x 
integer, f float, y string)", NULL, NULL)) != NULL) {
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL) {
delete_file(csv_path)
error(err)
}
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2657,6 +2657,7 @@ mvc_export_table_wrap( Client cntxt, Mal
close_stream(s);
goto wrapup_result_set1;
}
+   be->output_format = OFMT_CSV;
} else {
while (!m->scanner.rs->eof)
bstream_next(m->scanner.rs);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge

2021-02-25 Thread Thodoris Zois
Changeset: 9b22edee7ab6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b22edee7ab6
Branch: default
Log Message:

Merge


diffs (143 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1615,7 +1615,7 @@ BUNfnd(BAT *b, const void *v)
BATiter bi;
 
BATcheck(b, BUN_NONE);
-   if (!v)
+   if (!v || BATcount(b) == 0)
return r;
if (complex_cand(b)) {
struct canditer ci;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1204,7 +1204,6 @@ check_version(logger *lg, FILE *fp, cons
return GDK_FAIL;
}
if (version < 52300) {  /* first CATALOG_VERSION for "new" log format */
-   fclose(fp);
lg->catalog_bid = logbat_new(TYPE_int, BATSIZE, PERSISTENT);
lg->catalog_id = logbat_new(TYPE_int, BATSIZE, PERSISTENT);
lg->dcatalog = logbat_new(TYPE_oid, BATSIZE, PERSISTENT);
@@ -1212,7 +1211,7 @@ check_version(logger *lg, FILE *fp, cons
GDKerror("cannot create catalog bats");
return GDK_FAIL;
}
-   if (old_logger_load(lg, fn, logdir) != GDK_SUCCEED) {
+   if (old_logger_load(lg, fn, logdir, fp, version) != 
GDK_SUCCEED) {
//loads drop no longer needed catalog, snapshots bats
//convert catalog_oid -> catalog_id (lng->int)
GDKerror("Incompatible database version %06d, "
diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -44,7 +44,7 @@ typedef int log_id;
 
 /* interface for the "old" logger */
 typedef struct old_logger old_logger;
-gdk_export gdk_return old_logger_load(logger *lg, const char *fn, const char 
*logdir);
+gdk_export gdk_return old_logger_load(logger *lg, const char *fn, const char 
*logdir, FILE *fp, int version);
 gdk_export log_bid old_logger_find_bat(old_logger *lg, const char *name, char 
tpe, oid id);
 
 gdk_export logger *logger_create(int debug, const char *fn, const char 
*logdir, int version, preversionfix_fptr prefuncp, postversionfix_fptr 
postfuncp, void *funcdata);
diff --git a/gdk/gdk_logger_old.c b/gdk/gdk_logger_old.c
--- a/gdk/gdk_logger_old.c
+++ b/gdk/gdk_logger_old.c
@@ -1341,16 +1341,8 @@ logger_commit(old_logger *lg)
 #endif
 
 static gdk_return
-check_version(old_logger *lg, FILE *fp)
+check_version(old_logger *lg, FILE *fp, int version)
 {
-   int version = 0;
-
-   if (fscanf(fp, "%6d", ) != 1) {
-   GDKerror("Could not read the version number from the file 
'%slog'.\n",
-lg->lg->dir);
-
-   return GDK_FAIL;
-   }
/* if these were equal we wouldn't have gotten here */
assert(version != lg->lg->version);
 
@@ -1598,10 +1590,9 @@ bm_subcommit(old_logger *lg, BAT *list_b
  * unless running in read-only mode
  * Load data and persist it in the BATs */
 static gdk_return
-logger_load(const char *fn, char filename[FILENAME_MAX], old_logger *lg)
+logger_load(const char *fn, char filename[FILENAME_MAX], old_logger *lg, FILE 
*fp, int version)
 {
size_t len;
-   FILE *fp = NULL;
char bak[FILENAME_MAX];
str filenamestr = NULL;
log_bid snapshots_bid = 0;
@@ -1625,25 +1616,6 @@ logger_load(const char *fn, char filenam
goto error;
}
 
-   /* try to open logfile backup, or failing that, the file
-* itself. we need to know whether this file exists when
-* checking the database consistency later on */
-   if ((fp = MT_fopen(bak, "r")) != NULL) {
-   fclose(fp);
-   fp = NULL;
-   if (GDKunlink(0, lg->lg->dir, LOGFILE, NULL) != GDK_SUCCEED ||
-   GDKmove(0, lg->lg->dir, LOGFILE, "bak", lg->lg->dir, 
LOGFILE, NULL) != GDK_SUCCEED)
-   goto error;
-   } else if (errno != ENOENT) {
-   GDKsyserror("open %s failed", bak);
-   goto error;
-   }
-   fp = MT_fopen(filename, "r");
-   if (fp == NULL) {
-   GDKsyserror("open %s failed", filename);
-   goto error;
-   }
-
strconcat_len(bak, sizeof(bak), fn, "_catalog_bid", NULL);
catalog_bid = BBPindex(bak);
 
@@ -1896,7 +1868,7 @@ logger_load(const char *fn, char filenam
}
GDKdebug = dbg;
 
-   if (check_version(lg, fp) != GDK_SUCCEED) {
+   if (check_version(lg, fp, version) != GDK_SUCCEED) {
goto error;
}
 
@@ -1937,7 +1909,7 @@ logger_load(const char *fn, char filenam
 /* Initialize a new logger
  * It will load any data in the logdir and persist it in the BATs*/
 static old_logger *
-logger_new(logger *lg, const char *fn, const char *logdir)
+logger_new(logger *lg, const char *fn, const char *logdir, FILE *fp, int 
version)
 {

MonetDB: default - Added a test for COPY INTO from file

2021-02-25 Thread Thodoris Zois
Changeset: ff8e3560ca3e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ff8e3560ca3e
Added Files:
ctest/tools/monetdbe/example_copy.c
Modified Files:
ctest/tools/monetdbe/CMakeLists.txt
Branch: default
Log Message:

Added a test for COPY INTO from file


diffs (103 lines):

diff --git a/ctest/tools/monetdbe/CMakeLists.txt 
b/ctest/tools/monetdbe/CMakeLists.txt
--- a/ctest/tools/monetdbe/CMakeLists.txt
+++ b/ctest/tools/monetdbe/CMakeLists.txt
@@ -64,6 +64,15 @@ target_link_libraries(example_backup
 add_test(run_example_backup example_backup)
 endif()
 
+if(NOT WIN32)
+add_executable(example_copy example_copy.c)
+target_link_libraries(example_copy
+  PRIVATE
+monetdb_config_header
+monetdbe)
+add_test(run_example_copy example_copy)
+endif()
+
 add_executable(example_connections example_connections.c)
 target_link_libraries(example_connections
   PRIVATE
diff --git a/ctest/tools/monetdbe/example_copy.c 
b/ctest/tools/monetdbe/example_copy.c
new file mode 100644
--- /dev/null
+++ b/ctest/tools/monetdbe/example_copy.c
@@ -0,0 +1,79 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
+ */
+
+#include "monetdb_config.h"
+#include 
+#include 
+#include 
+
+#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;}
+#define delete_file(fpath) {  int del = remove(fpath); if (del) { error("Could 
not remove the file"); } }
+
+int
+main(void)
+{
+   char sql[1000];
+   char csv_path[PATH_MAX];
+   char* err = NULL;
+   monetdbe_database mdbe;
+   monetdbe_result* result = NULL;
+
+   if (monetdbe_open(, NULL, NULL))
+   error("Failed to open database");
+
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (b bool, x integer, 
f float, y string)", NULL, NULL)) != NULL)
+   error(err)
+
+   if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (TRUE, 42, 
42.42, 'Hello'), (NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL)
+   error(err)
+
+   // Get working directory and construct the CSV path
+   if (getcwd(csv_path, sizeof(csv_path)) == NULL) {
+   error("Could not get the current working directory");
+   }
+   strcat(csv_path, "/test.csv");
+
+strcpy(sql, "COPY SELECT * FROM test INTO '");
+strcat(sql, csv_path);
+strcat(sql, "' USING DELIMITERS ',' NULL AS ''");
+
+   if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL)
+   error(err)
+   
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (b bool, x 
integer, f float, y string)", NULL, NULL)) != NULL) {
+   delete_file(csv_path)
+   error(err)
+   }
+
+   memset(sql, 0, 1000);
+   strcpy(sql, "COPY INTO test_copy FROM '");
+strcat(sql, csv_path);
+strcat(sql, "' DELIMITERS ','");
+
+   if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL) {
+   delete_file(csv_path)
+   error(err)
+   }
+
+   if ((err = monetdbe_query(mdbe, "SELECT * FROM test_copy; ", , 
NULL)) != NULL) {
+   delete_file(csv_path)
+   error(err)
+   }
+
+   if (result->nrows == 0) {
+   delete_file(csv_path)
+   error("Copy failed, database is empty")
+   }
+
+   delete_file(csv_path)
+
+   if (monetdbe_close(mdbe))
+   error("Failed to close database");
+
+   return 0;
+}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - Fixes for tests in sql/test/copy

2020-11-12 Thread Thodoris Zois
Changeset: 50520d8024e8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=50520d8024e8
Modified Files:
sql/test/copy/Tests/All
sql/test/copy/Tests/columns.sql
sql/test/copy/Tests/columns.test
sql/test/copy/Tests/format_date.test
sql/test/copy/Tests/ingestion.sql
sql/test/copy/Tests/ingestion.test
sql/test/copy/Tests/int_parse.sql
sql/test/copy/Tests/int_parse.test
sql/test/copy/Tests/null_as_string_errors.sql
sql/test/copy/Tests/null_as_string_errors.test
Branch: mtest
Log Message:

Fixes for tests in sql/test/copy


diffs (truncated from 946 to 300 lines):

diff --git a/sql/test/copy/Tests/All b/sql/test/copy/Tests/All
--- a/sql/test/copy/Tests/All
+++ b/sql/test/copy/Tests/All
@@ -4,13 +4,13 @@ escaped_char
 null_as_string
 null_as_string_errors
 null_as_string_output
-int_parse_best
+# int_parse_best
 int_parse
 load_stdin_incorrect_line_nr
 overflow_error
 format_date
 key_copy
-nonutf8
+# nonutf8
 incorrect_columns
 columns
 no_escape
diff --git a/sql/test/copy/Tests/columns.sql b/sql/test/copy/Tests/columns.sql
--- a/sql/test/copy/Tests/columns.sql
+++ b/sql/test/copy/Tests/columns.sql
@@ -4,6 +4,7 @@ copy 3 records into tbl (i, d) from stdi
 1,2.0
 2,2.1
 3,2.2
+
 select * from tbl;
 drop table tbl;
 
@@ -13,6 +14,7 @@ copy 3 records into tbl (i, d) from stdi
 1,"test",2.0
 2,"test1",2.1
 3,"test",2.2
+
 select * from tbl;
 drop table tbl;
 
@@ -22,5 +24,6 @@ copy 3 records into tbl (i, d) from stdi
 1,2.0
 2,2.1
 3,2.2
+
 select * from tbl;
 drop table tbl;
diff --git a/sql/test/copy/Tests/columns.test b/sql/test/copy/Tests/columns.test
--- a/sql/test/copy/Tests/columns.test
+++ b/sql/test/copy/Tests/columns.test
@@ -2,71 +2,69 @@ statement ok
 create table tbl (i int, s string, d decimal(5, 2))
 
 statement error
-copy 3 records into tbl (i, d) from stdin using delimiters ',',E'\n'
+copy 3 records into tbl (i, d) from stdin delimiters ',',E'\n'
 
 1,2.0
 2,2.1
 3,2.2
 
-
-query ITT nosort
-select * from tbl;
+query ITR rowsort
+select * from tbl
 
 
 statement ok
-drop table tbl;
+drop table tbl
 
 statement ok
 create table tbl (i int, s string, d decimal(5, 2))
 
 statement ok
-copy 3 records into tbl (i, d) from stdin using delimiters ',',E'\n'
+copy 3 records into tbl (i, d) from stdin delimiters ',',E'\n'
 
 1,"test",2.0
 2,"test1",2.1
 3,"test",2.2
 
-
-query ITT nosort
-select * from tbl;
+query ITR rowsort
+select * from tbl
 
 1
 NULL
-2.00
+2.000
 2
 NULL
-2.10
+2.100
 3
 NULL
-2.20
+2.200
 
 statement ok
-drop table tbl;
+drop table tbl
 
 statement ok
 create table tbl (i int, s string, d decimal(5, 2))
 
 statement ok
-copy 3 records into tbl (i, d) from stdin (i, d) using delimiters ',',E'\n'
+copy 3 records into tbl (i, d) from stdin (i, d) delimiters ',',E'\n'
 
 1,2.0
 2,2.1
 3,2.2
 
-query ITT nosort
-select * from tbl;
+query ITR rowsort
+select * from tbl
 
 1
 NULL
-2.00
+2.000
 2
 NULL
-2.10
+2.100
 3
 NULL
-2.20
+2.200
 
 statement ok
-drop table tbl;
+drop table tbl
 
 
diff --git a/sql/test/copy/Tests/format_date.test 
b/sql/test/copy/Tests/format_date.test
--- a/sql/test/copy/Tests/format_date.test
+++ b/sql/test/copy/Tests/format_date.test
@@ -7,323 +7,328 @@ CREATE TABLE orders_1 (o_orderkey INT NO
 statement ok
 CREATE TABLE orders_2 (o_orderkey INT NOT NULL, o_custkey INT NOT NULL, 
o_orderstatus VARCHAR(1) NOT NULL, o_totalprice FLOAT NOT NULL, o_orderdate 
DATE NOT NULL, o_orderpriority VARCHAR(15) NOT NULL, o_clerk VARCHAR(15) NOT 
NULL, o_shippriority INT NOT NULL, o_comment VARCHAR(79) NOT NULL) 
 
-statement error
+statement ok
 COPY 150 RECORDS INTO orders_1 from STDIN USING DELIMITERS '|', E'|\n'
 
-1|370|O|172799.49|1996-01-02|5-LOW|Clerk
-2|781|O|38426.09|1996-12-01|1-URGENT|Clerk
-3|1234|F|205654.30|1993-10-14|5-LOW|Clerk
-4|1369|O|56000.91|1995-10-11|5-LOW|Clerk
-5|445|F|105367.67|1994-07-30|5-LOW|Clerk
-6|557|F|45523.10|1992-02-21|4-NOT SPECIFIED|Clerk
-7|392|O|271885.66|1996-01-10|2-HIGH|Clerk
-32|1301|O|198665.57|1995-07-16|2-HIGH|Clerk
-33|670|F|146567.24|1993-10-27|3-MEDIUM|Clerk
-34|611|O|73315.48|1998-07-21|3-MEDIUM|Clerk
-35|1276|O|194641.93|1995-10-23|4-NOT SPECIFIED|Clerk
-36|1153|O|42011.04|1995-11-03|1-URGENT|Clerk
-37|862|F|131896.49|1992-06-03|3-MEDIUM|Clerk
-38|1249|O|71553.08|1996-08-21|4-NOT SPECIFIED|Clerk
-39|818|O|326565.37|1996-09-20|3-MEDIUM|Clerk
-64|322|F|35831.73|1994-07-16|3-MEDIUM|Clerk
-65|163|P|95469.44|1995-03-18|1-URGENT|Clerk
-66|1292|F|104190.66|1994-01-20|5-LOW|Clerk
-67|568|O|182481.16|1996-12-19|4-NOT SPECIFIED|Clerk
-68|286|O|301968.79|1998-04-18|3-MEDIUM|Clerk
-69|845|F|204110.73|1994-06-04|4-NOT SPECIFIED|Clerk
-70|644|F|125705.32|1993-12-18|5-LOW|Clerk
-71|34|O|260603.38|1998-01-24|4-NOT SPECIFIED|Clerk
-96|1078|F|64364.30|1994-04-17|2-HIGH|Clerk
-97|211|F|100572.55|1993-01-29|3-MEDIUM|Clerk
-98|1045|F|71721.40|1994-09-25|1-URGENT|Clerk
-99|890|F|108594.87|1994-03-13|4-NOT SPECIFIED|Clerk

MonetDB: mtest - merge

2020-11-10 Thread Thodoris Zois
Changeset: f3fd2e1d6152 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3fd2e1d6152
Branch: mtest
Log Message:

merge


diffs (truncated from 43209 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -1,6 +1,6 @@
 query T rowsort
 select * from sys.malfunctions() order by module, "function", address, 
signature, comment
 
-64110 values hashing to 2c8d260ec221c669a3c878cf04340222
+65490 values hashing to ca0241b9eab8bb582f3f93a7fd008dd8
 
 
diff --git a/sql/test/SQLancer/Tests/sqlancer01.test 
b/sql/test/SQLancer/Tests/sqlancer01.test
new file mode 100644
--- /dev/null
+++ b/sql/test/SQLancer/Tests/sqlancer01.test
@@ -0,0 +1,645 @@
+statement ok
+CREATE TABLE tbl_ProductSales (ColID int, Product_Category  varchar(64), 
Product_Name  varchar(64), TotalSales int)
+
+statement ok
+INSERT INTO tbl_ProductSales VALUES (1,'Game','Mobo Game',200),(2,'Game','PKO 
Game',400),(3,'Fashion','Shirt',500),(4,'Fashion','Shorts',100)
+
+statement ok
+CREATE TABLE another_T (col1 INT, col2 INT, col3 INT, col4 INT, col5 INT, col6 
INT, col7 INT, col8 INT)
+
+statement ok
+INSERT INTO another_T VALUES (1,2,3,4,5,6,7,8), (11,22,33,44,55,66,77,88), 
(111,222,333,444,555,666,777,888), (,,,,,,,)
+
+statement ok
+CREATE TABLE integers(i INTEGER)
+
+statement ok
+INSERT INTO integers VALUES (1), (2), (3), (NULL)
+
+statement ok
+START TRANSACTION
+
+query I rowsort
+select 1 from integers where (((0.7161494983624688) in (integers.i)) = true) = 
false
+
+1
+1
+1
+
+statement ok
+delete from integers where (((0.7161494983624688) in (integers.i)) = true) = 
false
+
+query I rowsort
+select i from integers
+
+NULL
+
+statement ok
+CREATE TABLE t0 (a1 INT, a2 int, a3 int)
+
+statement ok
+UPDATE t0 SET a2 = (- (- (t0.a1))), a3 = 
(ascii(CAST(ascii('}悂Y8K*韖5^n8_X1X|p(''bX') AS STRING(920 WHERE NOT 
(((0.27023923567918073) NOT IN (0.9149447665258329)) = FALSE)
+
+statement ok
+insert into integers(i) values(((length(reverse('8 
\rcr੧[bp1eMY쫺4j5s뮯!>(((- (- 
(528640982)))&(ascii('528640982'))
+
+query I rowsort
+SELECT i from integers order by i
+
+0
+NULL
+
+query T rowsort
+select reverse(r'8 \rcr੧[bp1eMY쫺4j5s뮯! 1 WHERE another_T.col2 > 1 GROUP BY 
another_T.col2 HAVING COUNT((another_T.col2) IN (another_T.col2)) > 0
+
+22
+222
+
+
+query I rowsort
+SELECT COUNT(1 IN (1))
+
+1
+
+statement ok
+START TRANSACTION
+
+statement ok
+create view v0(c0) as (select distinct - (tbl_productsales.totalsales) from 
tbl_productsales, another_t)
+
+statement ok
+create view v1(c0) as (select distinct not (not v0.c0)=(1560867215))) = 
false)) from integers, another_t, tbl_productsales, v0)
+
+statement ok
+create view v2(c0, c1) as (select v1.c0, -3.025584E8 from v0, 
tbl_productsales, v1, another_t)
+
+statement ok
+create view v3(c0, c1, c2) as (select all 
0.9104878744438205107059047804796136915683746337890625, -705263737, 0.7147939 
from v2 where (cast(v2.c0 as varchar(32))) is null order by v2.c1 desc, v2.c0 
desc)
+
+query R rowsort
+SELECT v3.c0 FROM v3, v0, tbl_productsales FULL OUTER JOIN v2 ON v2.c0 RIGHT 
OUTER JOIN integers ON (tbl_productsales.TotalSales) BETWEEN (NULL) AND (v2.c1) 
JOIN another_t ON v2.c0
+
+
+statement ok
+ROLLBACK
+
+statement ok
+START TRANSACTION
+
+statement ok
+insert into tbl_productsales(product_name, totalsales) values (((cast(0.1 as 
string))||(charindex(cast(1)*(-1)))&(((-1)|(-1 as string),
+rtrim('0.9407860360743894', ''))||(1)))||(cast(1.44041702E9 as 
string(75,
+((- (((1)*(-1*(1), -1833694753)
+
+query T rowsort
+select rtrim('0.9407860360743894', '')
+
+0.9407860360743894
+
+statement ok
+ROLLBACK
+
+query I rowsort
+SELECT another_t.col1 FROM tbl_productsales CROSS JOIN another_t WHERE 
((tbl_productsales.product_category) NOT IN (tbl_productsales.product_category, 
tbl_productsales.product_category)) IS NULL
+
+
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE t0 (c0 int, c1 int)
+
+statement ok
+insert into t0 values (1, 1)
+
+query I rowsort
+select all t0.c0 from t0 where (1) not in (1.52414541E9, 0.13482326)
+union all select all t0.c0 from t0 where not (1) not in (1.52414541E9, 
0.13482326)
+union all select t0.c0 from t0 where (1) not in (1.52414541E9, 0.13482326) is 
null
+
+1
+
+query I rowsort
+select 1 from t0 where (3 in (1, 2)) is null
+
+
+query I rowsort
+SELECT 1 FROM t0 WHERE t0.c0 BETWEEN SYMMETRIC (1 IN (2, 1)) AND t0.c0
+
+1
+
+statement ok
+ROLLBACK
+
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE "t0"("c0" DECIMAL(18,3), "c1" BIGINT)
+
+statement ok
+COPY 12 RECORDS INTO "t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+
+0.244  NULL
+0.578  NULL
+0.119  NULL
+0.773  495026350
+0.329  2108706088
+0.483  1298757529
+0.880  39
+0.084  1
+0.332  859611948
+0.607  NULL

MonetDB: mtest - Coverted copy tests

2020-11-10 Thread Thodoris Zois
Changeset: c63d30b5358f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c63d30b5358f
Added Files:
sql/test/copy/Tests/columns.test
sql/test/copy/Tests/embedded_sep.test
sql/test/copy/Tests/escaped_char.test
sql/test/copy/Tests/format_date.test
sql/test/copy/Tests/incorrect_columns.test
sql/test/copy/Tests/ingestion.test
sql/test/copy/Tests/int_parse.test
sql/test/copy/Tests/key_copy.test
sql/test/copy/Tests/load_stdin_incorrect_line_nr.test
sql/test/copy/Tests/no_escape.test
sql/test/copy/Tests/no_escape2.test
sql/test/copy/Tests/null_as_string.test
sql/test/copy/Tests/null_as_string_errors.test
sql/test/copy/Tests/null_as_string_output.test
sql/test/copy/Tests/overflow_error.test
Branch: mtest
Log Message:

Coverted copy tests


diffs (truncated from 2034 to 300 lines):

diff --git a/sql/test/copy/Tests/columns.test b/sql/test/copy/Tests/columns.test
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/columns.test
@@ -0,0 +1,37 @@
+statement ok
+create table tbl (i int, s string, d decimal(5, 2))
+
+statement error
+copy 3 records into tbl (i, d) from stdin delimiters ',',E'\n'
+
+1,2.0
+2,2.1
+3,2.2
+select * from tbl;
+drop table tbl;
+
+statement error
+create table tbl (i int, s string, d decimal(5, 2))
+
+statement ok
+copy 3 records into tbl (i, d) from stdin delimiters ',',E'\n'
+
+1,"test",2.0
+2,"test1",2.1
+3,"test",2.2
+select * from tbl;
+drop table tbl;
+
+statement ok
+create table tbl (i int, s string, d decimal(5, 2))
+
+statement ok
+copy 3 records into tbl (i, d) from stdin (i, d) delimiters ',',E'\n'
+
+1,2.0
+2,2.1
+3,2.2
+select * from tbl;
+drop table tbl;
+
+
diff --git a/sql/test/copy/Tests/embedded_sep.test 
b/sql/test/copy/Tests/embedded_sep.test
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/embedded_sep.test
@@ -0,0 +1,54 @@
+statement ok
+start transaction
+
+statement ok
+create table t_str(s string, t string)
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n'
+
+hello,world
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n','"'
+
+hello,world
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n','"'
+
+"hello","world"
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n','"'
+
+"hello,world","all"
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n','"'
+
+"hello\nworld","all"
+
+query TT rowsort
+select * from t_str
+
+10 values hashing to a6dbadc81143452216f62c11e22b2497
+
+statement ok
+copy 1 records into t_str from stdin delimiters ',',E'\n','"'
+
+"hello\
+world","all"
+
+query TT rowsort
+select * from t_str
+
+12 values hashing to d44a98cf9491f612e5dfefc441dae383
+
+statement ok
+drop table t_str
+
+statement ok
+rollback
+
+
diff --git a/sql/test/copy/Tests/escaped_char.test 
b/sql/test/copy/Tests/escaped_char.test
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/escaped_char.test
@@ -0,0 +1,41 @@
+statement ok
+start transaction
+
+statement ok
+create table tt_str(s string, t string)
+
+statement ok
+copy 3 records into tt_str from stdin delimiters ',',E'\n'
+
+\\hello,world
+hello\t,world
+hello\n,world
+
+statement ok
+copy 1 records into tt_str from stdin delimiters ',',E'\n','"'
+
+"hello\"","world"
+
+statement ok
+copy 1 records into tt_str from stdin delimiters ',',E'\n','"'
+
+hello\,world,"all"
+
+statement ok
+copy 1 records into tt_str from stdin delimiters ',',E'\n','"'
+
+hello\,world,"all\
+therest"
+
+query TT rowsort
+select * from tt_str
+
+12 values hashing to 7fa94a1fa7c55c7b8258f06f40d7808a
+
+statement ok
+drop table tt_str
+
+statement ok
+rollback
+
+
diff --git a/sql/test/copy/Tests/format_date.test 
b/sql/test/copy/Tests/format_date.test
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/format_date.test
@@ -0,0 +1,331 @@
+statement ok
+start transaction
+
+statement ok
+CREATE TABLE orders_1 (o_orderkey INT NOT NULL, o_custkey INT NOT NULL, 
o_orderstatus VARCHAR(1) NOT NULL, o_totalprice FLOAT NOT NULL, o_orderdate 
DATE NOT NULL, o_orderpriority VARCHAR(15) NOT NULL, o_clerk VARCHAR(15) NOT 
NULL, o_shippriority INT NOT NULL, o_comment VARCHAR(79) NOT NULL) 
+
+statement ok
+CREATE TABLE orders_2 (o_orderkey INT NOT NULL, o_custkey INT NOT NULL, 
o_orderstatus VARCHAR(1) NOT NULL, o_totalprice FLOAT NOT NULL, o_orderdate 
DATE NOT NULL, o_orderpriority VARCHAR(15) NOT NULL, o_clerk VARCHAR(15) NOT 
NULL, o_shippriority INT NOT NULL, o_comment VARCHAR(79) NOT NULL) 
+
+statement error
+COPY 150 RECORDS INTO orders_1 from STDIN USING DELIMITERS '|', E'|\n'
+
+1|370|O|172799.49|1996-01-02|5-LOW|Clerk
+2|781|O|38426.09|1996-12-01|1-URGENT|Clerk
+3|1234|F|205654.30|1993-10-14|5-LOW|Clerk
+4|1369|O|56000.91|1995-10-11|5-LOW|Clerk
+5|445|F|105367.67|1994-07-30|5-LOW|Clerk
+6|557|F|45523.10|1992-02-21|4-NOT SPECIFIED|Clerk

MonetDB: mtest - Converted BugConstraints tests

2020-11-10 Thread Thodoris Zois
Changeset: 69f9ebe2c970 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=69f9ebe2c970
Added Files:
sql/test/BugConstraints/Tests/add_constraint_1643522.test
sql/test/BugConstraints/Tests/check_constraint.SF-1714829.test
sql/test/BugConstraints/Tests/delete_primarykey_1643845.test
sql/test/BugConstraints/Tests/drop_column_1643542.test
sql/test/BugConstraints/Tests/update_primarykey_1643375.test
Branch: mtest
Log Message:

Converted BugConstraints tests


diffs (142 lines):

diff --git a/sql/test/BugConstraints/Tests/add_constraint_1643522.test 
b/sql/test/BugConstraints/Tests/add_constraint_1643522.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugConstraints/Tests/add_constraint_1643522.test
@@ -0,0 +1,22 @@
+statement ok
+create table t1(id int, name varchar(1024))
+
+statement ok
+alter table t1 add constraint id_p primary key(id)
+
+statement error
+alter table t1 add constraint id_p primary key(id)
+
+query T rowsort
+select name from sys.keys where name = 'id_p'
+
+id_p
+
+statement ok
+drop table t1
+
+query T rowsort
+select name from sys.keys where name = 'id_p'
+
+
+
diff --git a/sql/test/BugConstraints/Tests/check_constraint.SF-1714829.test 
b/sql/test/BugConstraints/Tests/check_constraint.SF-1714829.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugConstraints/Tests/check_constraint.SF-1714829.test
@@ -0,0 +1,7 @@
+statement error
+create table t1 (id int CHECK (f1() = 1))
+
+statement error
+drop table t1
+
+
diff --git a/sql/test/BugConstraints/Tests/delete_primarykey_1643845.test 
b/sql/test/BugConstraints/Tests/delete_primarykey_1643845.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugConstraints/Tests/delete_primarykey_1643845.test
@@ -0,0 +1,31 @@
+statement ok
+create table t1(id int, name varchar(1024))
+
+statement ok
+alter table t1 add constraint id_p primary key(id)
+
+statement ok
+create table t2(id_f int, age int, foreign key(id_f) references t1(id))
+
+statement ok
+alter table t2 add constraint age_p primary key(age)
+
+statement ok
+insert into t1 values(1,'romulo')
+
+statement ok
+insert into t2 values(1,33)
+
+statement error
+insert into t2 values(2,33)
+
+statement error
+delete from t1 where id = 1
+
+statement ok
+drop table t2
+
+statement ok
+drop table t1
+
+
diff --git a/sql/test/BugConstraints/Tests/drop_column_1643542.test 
b/sql/test/BugConstraints/Tests/drop_column_1643542.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugConstraints/Tests/drop_column_1643542.test
@@ -0,0 +1,29 @@
+statement ok
+create table t1(id int, name varchar(1024))
+
+statement ok
+alter table t1 add constraint id_p primary key(id)
+
+statement ok
+create table t2(id_f int, age int, foreign key(id_f) references t1(id))
+
+statement error
+alter table t2 add constraint id_p primary key(id_f)
+
+statement ok
+alter table t2 add constraint id_p_2 primary key(id_f)
+
+statement error
+alter table t1 drop id
+
+query IT rowsort
+select * from t1
+
+
+statement ok
+drop table t2
+
+statement ok
+drop table t1
+
+
diff --git a/sql/test/BugConstraints/Tests/update_primarykey_1643375.test 
b/sql/test/BugConstraints/Tests/update_primarykey_1643375.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugConstraints/Tests/update_primarykey_1643375.test
@@ -0,0 +1,28 @@
+statement ok
+create table t1(id int, name varchar(1024))
+
+statement ok
+alter table t1 add constraint id_p primary key(id)
+
+statement ok
+create table t2(id_f int, age int, foreign key(id_f) references t1(id))
+
+statement ok
+alter table t2 add constraint age_p primary key(age)
+
+statement ok
+insert into t1 values(1,'romulo')
+
+statement ok
+insert into t2 values(1,33)
+
+statement error
+update t1 set id = 0 where id =1
+
+statement ok
+drop table t2
+
+statement ok
+drop table t1
+
+
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Minor comment as a note in example_append_raw

2020-06-30 Thread Thodoris Zois
Changeset: ac7236bc4ecc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac7236bc4ecc
Modified Files:
ctest/tools/monetdbe/example_append_raw.c
Branch: default
Log Message:

Minor comment as a note in example_append_raw


diffs (12 lines):

diff --git a/ctest/tools/monetdbe/example_append_raw.c 
b/ctest/tools/monetdbe/example_append_raw.c
--- a/ctest/tools/monetdbe/example_append_raw.c
+++ b/ctest/tools/monetdbe/example_append_raw.c
@@ -32,6 +32,8 @@ main(void)
error(err)
 
// fill the empty table with data using append
+   // it is important to match column order below with the column order of 
the table
+
// int_32
int32_t i1 = 42;
int32_t i2 = *(int32_t*)monetdbe_null(mdbe, monetdbe_int32_t);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - monetdbe example_append_raw - removed name fr...

2020-06-30 Thread Thodoris Zois
Changeset: fe821ce3fe8d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe821ce3fe8d
Modified Files:
ctest/tools/monetdbe/example_append_raw.c
Branch: default
Log Message:

monetdbe example_append_raw - removed name from monetdbe_column


diffs (47 lines):

diff --git a/ctest/tools/monetdbe/example_append_raw.c 
b/ctest/tools/monetdbe/example_append_raw.c
--- a/ctest/tools/monetdbe/example_append_raw.c
+++ b/ctest/tools/monetdbe/example_append_raw.c
@@ -36,11 +36,11 @@ main(void)
int32_t i1 = 42;
int32_t i2 = *(int32_t*)monetdbe_null(mdbe, monetdbe_int32_t);
int32_t ints[2] = { i1, i2 };
-   monetdbe_column col0 = { .name = "x", .type = monetdbe_int32_t, .data = 
, .count = 2 };
+   monetdbe_column col0 = { .type = monetdbe_int32_t, .data = , 
.count = 2 };

// str
char* dstr[2] = { "Hello", "World" };
-   monetdbe_column col1 = { .name = "y", .type = monetdbe_str, .data = 
, .count = 2 };
+   monetdbe_column col1 = { .type = monetdbe_str, .data = , .count = 
2 };
 
// timestamp
monetdbe_data_date dt = { .day = 2, .month = 3, .year = 2020 };
@@ -48,25 +48,25 @@ main(void)
monetdbe_data_timestamp t1 = { .date = dt, .time = tm };
monetdbe_data_timestamp t2 = 
*(monetdbe_data_timestamp*)monetdbe_null(mdbe, monetdbe_timestamp);
monetdbe_data_timestamp tss[2] = { t1, t2 };
-   monetdbe_column col2 = { .name = "ts", .type = monetdbe_timestamp, 
.data = , .count = 2 };
+   monetdbe_column col2 = { .type = monetdbe_timestamp, .data = , 
.count = 2 };
 
// date 
monetdbe_data_date d1 = dt;
monetdbe_data_date d2 = *(monetdbe_data_date*)monetdbe_null(mdbe, 
monetdbe_date);
monetdbe_data_date dts[2] = { d1, d2 };
-   monetdbe_column col3 = { .name = "dt", .type = monetdbe_date, .data = 
, .count = 2 };
+   monetdbe_column col3 = { .type = monetdbe_date, .data = , .count = 
2 };
 
// time
monetdbe_data_time tm1 = tm;
monetdbe_data_time tm2 = *(monetdbe_data_time*)monetdbe_null(mdbe, 
monetdbe_time);
monetdbe_data_time tms[2] = { tm1, tm2 };
-   monetdbe_column col4 = { .name = "t", .type = monetdbe_time, .data = 
, .count = 2 };
+   monetdbe_column col4 = { .type = monetdbe_time, .data = , .count = 
2 };
 
// blob
monetdbe_data_blob b1 = { .size = 1, .data = "33" };
monetdbe_data_blob b2 = *(monetdbe_data_blob*)monetdbe_null(mdbe, 
monetdbe_blob);
monetdbe_data_blob bs[2] = { b1, b2 };
-   monetdbe_column col5 = { .name = "b", .type = monetdbe_blob, .data = 
, .count = 2 };
+   monetdbe_column col5 = { .type = monetdbe_blob, .data = , .count = 2 
};
 
monetdbe_column* dcol[6] = { , , , , ,  };
if ((err = monetdbe_append(mdbe, "sys", "test", (monetdbe_column**) 
, 6)) != NULL)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - monetdbe (example_append_raw.c) - example wit...

2020-06-29 Thread Thodoris Zois
Changeset: 32f3e97673e2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32f3e97673e2
Added Files:
ctest/tools/monetdbe/example_append_raw.c
Modified Files:
ctest/tools/monetdbe/CMakeLists.txt
Branch: default
Log Message:

monetdbe (example_append_raw.c) - example with C generated data


diffs (183 lines):

diff --git a/ctest/tools/monetdbe/CMakeLists.txt 
b/ctest/tools/monetdbe/CMakeLists.txt
--- a/ctest/tools/monetdbe/CMakeLists.txt
+++ b/ctest/tools/monetdbe/CMakeLists.txt
@@ -48,6 +48,13 @@ target_link_libraries(example_append
 monetdbe)
 add_test(run_example_append example_append)
 
+add_executable(example_append_raw example_append_raw.c)
+target_link_libraries(example_append_raw
+  PRIVATE
+monetdb_config_header
+monetdbe)
+add_test(run_example_append_raw example_append_raw)
+
 add_executable(example_backup example_backup.c)
 target_link_libraries(example_backup
   PRIVATE
diff --git a/ctest/tools/monetdbe/example_append_raw.c 
b/ctest/tools/monetdbe/example_append_raw.c
new file mode 100644
--- /dev/null
+++ b/ctest/tools/monetdbe/example_append_raw.c
@@ -0,0 +1,161 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#include "monetdbe.h"
+#include 
+#include 
+#include 
+
+#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;}
+
+#define date_eq(d1, d2) (d1.year == d2.year && d1.month == d2.month && d1.day 
== d2.day)
+#define time_eq(t1, t2) (t1.hours == t2.hours && t1.minutes == t2.minutes && 
t1.seconds == t2.seconds && t1.ms == t2.ms)
+
+static char hexit[] = "0123456789ABCDEF";
+
+int
+main(void)
+{
+   char* err = NULL;
+   monetdbe_database mdbe = NULL;
+   monetdbe_result* result = NULL;
+
+   // second argument is a string for the db directory or NULL for 
in-memory mode
+   if (monetdbe_open(, NULL, NULL))
+   error("Failed to open database")
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL)
+   error(err)
+
+   // fill the empty table with data using append
+   // int_32
+   int32_t i1 = 42;
+   int32_t i2 = *(int32_t*)monetdbe_null(mdbe, monetdbe_int32_t);
+   int32_t ints[2] = { i1, i2 };
+   monetdbe_column col0 = { .name = "x", .type = monetdbe_int32_t, .data = 
, .count = 2 };
+   
+   // str
+   char* dstr[2] = { "Hello", "World" };
+   monetdbe_column col1 = { .name = "y", .type = monetdbe_str, .data = 
, .count = 2 };
+
+   // timestamp
+   monetdbe_data_date dt = { .day = 2, .month = 3, .year = 2020 };
+   monetdbe_data_time tm = { .hours = 3, .minutes = 13, .seconds = 23, .ms 
= 33 };
+   monetdbe_data_timestamp t1 = { .date = dt, .time = tm };
+   monetdbe_data_timestamp t2 = 
*(monetdbe_data_timestamp*)monetdbe_null(mdbe, monetdbe_timestamp);
+   monetdbe_data_timestamp tss[2] = { t1, t2 };
+   monetdbe_column col2 = { .name = "ts", .type = monetdbe_timestamp, 
.data = , .count = 2 };
+
+   // date 
+   monetdbe_data_date d1 = dt;
+   monetdbe_data_date d2 = *(monetdbe_data_date*)monetdbe_null(mdbe, 
monetdbe_date);
+   monetdbe_data_date dts[2] = { d1, d2 };
+   monetdbe_column col3 = { .name = "dt", .type = monetdbe_date, .data = 
, .count = 2 };
+
+   // time
+   monetdbe_data_time tm1 = tm;
+   monetdbe_data_time tm2 = *(monetdbe_data_time*)monetdbe_null(mdbe, 
monetdbe_time);
+   monetdbe_data_time tms[2] = { tm1, tm2 };
+   monetdbe_column col4 = { .name = "t", .type = monetdbe_time, .data = 
, .count = 2 };
+
+   // blob
+   monetdbe_data_blob b1 = { .size = 1, .data = "33" };
+   monetdbe_data_blob b2 = *(monetdbe_data_blob*)monetdbe_null(mdbe, 
monetdbe_blob);
+   monetdbe_data_blob bs[2] = { b1, b2 };
+   monetdbe_column col5 = { .name = "b", .type = monetdbe_blob, .data = 
, .count = 2 };
+
+   monetdbe_column* dcol[6] = { , , , , ,  };
+   if ((err = monetdbe_append(mdbe, "sys", "test", (monetdbe_column**) 
, 6)) != NULL)
+   error(err)
+
+   if ((err = monetdbe_query(mdbe, "SELECT * FROM test; ", , NULL)) 
!= NULL)
+   error(err)
+   fprintf(stdout, "Query result after append with %zu cols and %"PRId64" 
rows\n", result->ncols, result->nrows);
+   monetdbe_column* rcol[6];
+   for (int64_t r = 0; r < result->nrows; r++) {
+   for (size_t c = 0; c < result->ncols; c++) {
+   if ((err = monetdbe_result_fetch(result, rcol+c, c)) != 
NULL)
+   error(err)
+   switch (rcol[c]->type) {
+   case monetdbe_int32_t: {
+   

MonetDB: default - monetdbe_append removed constraint of 16 rows

2020-06-26 Thread Thodoris Zois
Changeset: 7b2dc7c74ab8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7b2dc7c74ab8
Modified Files:
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

monetdbe_append removed constraint of 16 rows


diffs (188 lines):

diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -1079,107 +1079,101 @@ monetdbe_append(monetdbe_database dbhdl,
goto cleanup;
}
 
-   /* small number of rows */
-   if (input[0]->count <= 16) {
-   size_t i, cnt = input[0]->count;
-   node *n;
+   size_t i, cnt = input[0]->count;
+   node *n;
+
+   for (i = 0, n = t->columns.set->h; i < column_count && n; i++, n = 
n->next) {
+   sql_column *c = n->data;
+   int mtype = monetdbe_type(input[i]->type);
+   const void* nil = (mtype>=0)?ATOMnilptr(mtype):NULL;
+   char *v = input[i]->data;
+   int w = 1;
 
-   for (i = 0, n = t->columns.set->h; i < column_count && n; i++, 
n = n->next) {
-   sql_column *c = n->data;
-   int mtype = monetdbe_type(input[i]->type);
-   const void* nil = (mtype>=0)?ATOMnilptr(mtype):NULL;
-   char *v = input[i]->data;
-   int w = 1;
-
-   if (mtype < 0) {
-   mdbe->msg = createException(SQL, 
"monetdbe.monetdbe_append", "Cannot find type for column %zu", i);
-   goto cleanup;
+   if (mtype < 0) {
+   mdbe->msg = createException(SQL, 
"monetdbe.monetdbe_append", "Cannot find type for column %zu", i);
+   goto cleanup;
+   }
+   if ((mtype >= TYPE_bit && mtype <= TYPE_lng)) {
+   w = ATOMsize(mtype);
+   for (size_t j=0; jsession->tr, c, 
v, mtype) != 0) {
+   mdbe->msg = createException(SQL, 
"monetdbe.monetdbe_append", "Cannot append values");
+   goto cleanup;
+   }
}
-   if ((mtype >= TYPE_bit && mtype <= TYPE_lng)) {
-   w = ATOMsize(mtype);
-   for (size_t j=0; jsession->tr, c, v, mtype) != 0) {
-   mdbe->msg = 
createException(SQL, "monetdbe.monetdbe_append", "Cannot append values");
-   goto cleanup;
-   }
-   }
-   } else if (mtype == TYPE_str) {
-   char **d = (char**)v;
+   } else if (mtype == TYPE_str) {
+   char **d = (char**)v;
+
+   for (size_t j=0; jsession->tr, c, 
s, mtype) != 0) {
+   mdbe->msg = createException(SQL, 
"monetdbe.monetdbe_append", "Cannot append values");
+   goto cleanup;
+   }
+   }
+   } else if (mtype == TYPE_timestamp) {
+   monetdbe_data_timestamp* ts = 
(monetdbe_data_timestamp*)v;
 
-   if 
(store_funcs.append_col(m->session->tr, c, s, mtype) != 0) {
-   mdbe->msg = 
createException(SQL, "monetdbe.monetdbe_append", "Cannot append values");
-   goto cleanup;
-   }
-   }
-   } else if (mtype == TYPE_timestamp) {
-   monetdbe_data_timestamp* ts = 
(monetdbe_data_timestamp*)v;
-
-   for (size_t j=0; jsession->tr, c, , mtype) != 0) {
-   mdbe->msg = 
createException(SQL, "monetdbe.monetdbe_append", "Cannot append values");
-   goto cleanup;
-   }
+   if (store_funcs.append_col(m->session->tr, c, 
, mtype) != 0) {
+   mdbe->msg = createException(SQL, 
"monetdbe.monetdbe_append", "Cannot append values");
+   goto cleanup;
}
-   } else if (mtype == TYPE_date) {
-   monetdbe_data_date* de = (monetdbe_data_date*)v;
+   }
+   } else if (mtype == TYPE_date) {
+   monetdbe_data_date* de = (monetdbe_data_date*)v;
 
-   for (size_t j=0; jsession->tr, c, , mtype) != 0) {
-   

MonetDB: default - Fix example_append

2020-06-22 Thread Thodoris Zois
Changeset: 7e1d517924cb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7e1d517924cb
Modified Files:
ctest/tools/monetdbe/example_append.c
Branch: default
Log Message:

Fix example_append


diffs (21 lines):

diff --git a/ctest/tools/monetdbe/example_append.c 
b/ctest/tools/monetdbe/example_append.c
--- a/ctest/tools/monetdbe/example_append.c
+++ b/ctest/tools/monetdbe/example_append.c
@@ -39,7 +39,7 @@ main(void)
if ((err = monetdbe_query(mdbe, "SELECT * FROM test; ", , NULL)) 
!= NULL)
error(err)
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", 
result->ncols, result->nrows);
-   monetdbe_column* rcol[result->ncols];
+   monetdbe_column* rcol[6];
for (int64_t r = 0; r < result->nrows; r++) {
for (size_t c = 0; c < result->ncols; c++) {
if ((err = monetdbe_result_fetch(result, rcol+c, c)) != 
NULL)
@@ -116,7 +116,7 @@ main(void)
}
printf("\n");
}
-   if ((err = monetdbe_append(mdbe, "sys", "test", rcol, result->ncols)) 
!= NULL)
+   if ((err = monetdbe_append(mdbe, "sys", "test", rcol, 6)) != NULL)
error(err)
/* we can now cleanup the previous query */
if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - monetdbe_append fixes - updated test

2020-06-22 Thread Thodoris Zois
Changeset: 637252a7de5e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=637252a7de5e
Modified Files:
ctest/tools/monetdbe/example_append.c
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

monetdbe_append fixes - updated test


diffs (275 lines):

diff --git a/ctest/tools/monetdbe/example_append.c 
b/ctest/tools/monetdbe/example_append.c
--- a/ctest/tools/monetdbe/example_append.c
+++ b/ctest/tools/monetdbe/example_append.c
@@ -13,6 +13,11 @@
 
 #define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;}
 
+#define date_eq(d1, d2) (d1.year == d2.year && d1.month == d2.month && d1.day 
== d2.day)
+#define time_eq(t1, t2) (t1.hours == t2.hours && t1.minutes == t2.minutes && 
t1.seconds == t2.seconds && t1.ms == t2.ms)
+
+static char hexit[] = "0123456789ABCDEF";
+
 int
 main(void)
 {
@@ -23,15 +28,18 @@ main(void)
// second argument is a string for the db directory or NULL for 
in-memory mode
if (monetdbe_open(, NULL, NULL))
error("Failed to open database")
-   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y 
string)", NULL, NULL)) != NULL)
+   if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL)
error(err)
-   if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello'), 
(NULL, 'World')", NULL, NULL)) != NULL)
+   if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello', 
'2020-01-02 10:20:30', '2020-01-02', '10:20:30', '01020308'), \
+   
(NULL, 'World', NULL, NULL, NULL, 
NULL),\
+   
(NULL, 'Foo', NULL, NULL, NULL, NULL), \
+   
(43, 'Bar', '2021-02-03 11:21:31', 
'2021-02-03', '11:21:31', '01020306')", NULL, NULL)) != NULL)
error(err)
 
-   if ((err = monetdbe_query(mdbe, "SELECT x, y FROM test; ", , 
NULL)) != NULL)
+   if ((err = monetdbe_query(mdbe, "SELECT * FROM test; ", , NULL)) 
!= NULL)
error(err)
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", 
result->ncols, result->nrows);
-   monetdbe_column* rcol[2];
+   monetdbe_column* rcol[result->ncols];
for (int64_t r = 0; r < result->nrows; r++) {
for (size_t c = 0; c < result->ncols; c++) {
if ((err = monetdbe_result_fetch(result, rcol+c, c)) != 
NULL)
@@ -55,6 +63,48 @@ main(void)
}
break;
}
+   case monetdbe_date: {
+   monetdbe_column_date * col = 
(monetdbe_column_date *) rcol[c];
+   if (date_eq(col->data[r], 
col->null_value)) {
+   printf("NULL");
+   } else {
+   printf("%d-%d-%d", 
col->data[r].year, col->data[r].month, col->data[r].day);
+   }
+   break;
+   }
+   case monetdbe_time: {
+   monetdbe_column_time * col = 
(monetdbe_column_time *) rcol[c];
+   if (time_eq(col->data[r], 
col->null_value)) {
+   printf("NULL");
+   } else {
+   printf("%d:%d:%d.%d", 
col->data[r].hours, col->data[r].minutes, col->data[r].seconds, 
col->data[r].ms);
+   }
+   break;
+   }
+   case monetdbe_timestamp: {
+   monetdbe_column_timestamp * col = 
(monetdbe_column_timestamp *) rcol[c];
+   if (date_eq(col->data[r].date, 
col->null_value.date) && time_eq(col->data[r].time, col->null_value.time)) {
+   printf("NULL");
+   } else {
+   printf("%d-%d-%d ", 
col->data[r].date.year, col->data[r].date.month, col->data[r].date.day);
+   printf("%d:%d:%d.%d", 
col->data[r].time.hours, col->data[r].time.minutes, col->data[r].time.seconds, 
col->data[r].time.ms);
+   }
+   

MonetDB: default - Set MBEDDED adapter for GDKtracer in case of ...

2020-06-19 Thread Thodoris Zois
Changeset: 68f38cf4c5f0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=68f38cf4c5f0
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

Set MBEDDED adapter for GDKtracer in case of monetdbe


diffs (50 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -407,6 +407,9 @@ GDKtracer_log(const char *file, const ch
  const char *syserr,
  const char *fmt, ...)
 {
+   if ((adapter_t) ATOMIC_GET(_adapter) == MBEDDED)
+   return;
+
int bytes_written;
char buffer[512];   /* should be plenty big enough for a message */
va_list va;
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -39,10 +39,11 @@
 
 
 // ADAPTERS
-#define FOREACH_ADPTR(ADPTR)   \
+#define FOREACH_ADPTR(ADPTR)   \
ADPTR( BASIC )  \
ADPTR( PROFILER )   \
-   \
+   ADPTR( MBEDDED )\
+   \
ADPTR( ADAPTERS_COUNT )
 
 typedef enum {
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -418,6 +418,7 @@ static char*
 monetdbe_startup(char* dbdir, monetdbe_options *opts)
 {
char* msg = MAL_SUCCEED;//, *err;
+   const char* mbedded = "MBEDDED";
monetdbe_result* res = NULL;
void* c;
opt *set = NULL;
@@ -463,6 +464,8 @@ monetdbe_startup(char* dbdir, monetdbe_o
GDK_vm_maxsize = opts->memorylimit;
}
 
+   GDKtracer_set_adapter(mbedded); /* set the output of GDKtracer logs */
+
if (!dbdir) { /* in-memory */
if (BBPaddfarm(NULL, (1 << PERSISTENT) | (1 << TRANSIENT), 
false) != GDK_SUCCEED) {
mo_free_options(set, setlen);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - MonetDBe append timestamp, date, time, and bl...

2020-06-18 Thread Thodoris Zois
Changeset: 88d9b58b85c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=88d9b58b85c3
Modified Files:
ctest/tools/embedded/example_append.c
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

MonetDBe append timestamp, date, time, and blob - Updated also test


diffs (truncated from 416 to 300 lines):

diff --git a/ctest/tools/embedded/example_append.c 
b/ctest/tools/embedded/example_append.c
--- a/ctest/tools/embedded/example_append.c
+++ b/ctest/tools/embedded/example_append.c
@@ -23,12 +23,13 @@ main(void)
// second argument is a string for the db directory or NULL for 
in-memory mode
if ((err = monetdb_open(, NULL)) != NULL)
error(err)
-   if ((err = monetdb_query(mdbe, "CREATE TABLE test (x integer, y 
string)", NULL, NULL)) != NULL)
+   if ((err = monetdb_query(mdbe, "CREATE TABLE test (x integer, y string, 
ts timestamp, dt date, t time, bl blob)", NULL, NULL)) != NULL)
error(err)
-   if ((err = monetdb_query(mdbe, "INSERT INTO test VALUES (42, 'Hello'), 
(NULL, 'World')", NULL, NULL)) != NULL)
+   if ((err = monetdb_query(mdbe, "INSERT INTO test VALUES (42, 'Hello', 
CURRENT_TIMESTAMP, '2008-11-11', '14:30:12', '123412'), \
+   
(NULL, 'World', NULL, NULL, NULL, 
NULL)", NULL, NULL)) != NULL)
error(err)
 
-   if ((err = monetdb_query(mdbe, "SELECT x, y FROM test; ", , 
NULL)) != NULL)
+   if ((err = monetdb_query(mdbe, "SELECT * FROM test; ", , NULL)) 
!= NULL)
error(err)
fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", 
result->ncols, result->nrows);
monetdb_column* rcol[2];
@@ -55,6 +56,43 @@ main(void)
}
break;
}
+   case monetdb_timestamp: {
+   monetdb_column_timestamp * col = 
(monetdb_column_timestamp *) rcol[c];
+   if(col->is_null(col->data[r])) {
+   printf("NULL");
+   } else {
+   printf("%s-%s-%d %s:%s:%s.%d", 
col->data[r].date.day, col->data[r].date.month, col->data[r].date.year,
+   
col->data[r].time.hours, 
col->data[r].time.minutes, col->data[r].time.seconds, col->data[r].time.ms);
+   }
+   break;
+   }
+   case monetdb_date: {
+   monetdb_column_date * col = 
(monetdb_column_date *) rcol[c];
+   if(col->is_null(col->data[r])) {
+   printf("NULL");
+   } else {
+   printf("%s-%s-%d", 
col->data[r].day, col->data[r].month, col->data[r].year);
+   }
+   break;
+   }
+   case monetdb_time: {
+   monetdb_column_time * col = 
(monetdb_column_time *) rcol[c];
+   if(col->is_null(col->data[r])) {
+   printf("NULL");
+   } else {
+   printf("%s:%s:%s.%d", 
col->data[r].hours, col->data[r].minutes, col->data[r].seconds, 
col->data[r].ms);
+   }
+   break;
+   }
+   case monetdb_blob: {
+   monetdb_column_blob * col = 
(monetdb_column_blob *) rcol[c];
+   if(col->is_null(col->data[r])) {
+   printf("NULL");
+   } else {
+   printf("%s", col->data[r].data);
+   }
+   break;
+   }
default: {
printf("UNKNOWN");
}
@@ -72,7 +110,7 @@ main(void)
if ((err = monetdb_cleanup_result(mdbe, result)) != NULL)
error(err)
 
-   if ((err = monetdb_query(mdbe, "SELECT x, y FROM test; ", , 
NULL)) != NULL)
+   if ((err = monetdb_query(mdbe, "SELECT * FROM test; ", , NULL)) 
!= NULL)
 

MonetDB: hitchhiker - Merge with default

2020-05-10 Thread Thodoris Zois
 for
+  inspection of both active, paused and recently executed queries.
+
diff --git a/ChangeLog.Jun2020 b/ChangeLog.Jun2020
--- a/ChangeLog.Jun2020
+++ b/ChangeLog.Jun2020
@@ -1,12 +1,18 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
-* Tue Feb 18 2020 Thodoris Zois 
-- Added mserver5 option (--dbtrace=) in order to be able to
-  specify the output directory of the produced traces.
-
-* Thu Feb  6 2020 Panagiotis Koutsourakis 
-- Add port and host as fields in the .monetdb file.
+* Mon Apr 20 2020 Sjoerd Mullender 
+- A new system to deal with debug output has been implemented.  There is
+  now an option --dbtrace to mserver5 that takes a file argument to which
+  debug output is written.  The default value is the file mdbtrace.log
+  inside the database directory.  This option can also be set through
+  the monetdb program.
+- The home directory of the automatically created monetdb user was
+  changed from /var/MonetDB to /var/lib/monetdb (RPM based systems
+  only).  This home directory is (currently) not used for anything,
+  though.
+- Python 2 support has been removed.  There is now only support for
+  using Python 3.
 
 * Thu Jan 30 2020 Sjoerd Mullender 
 - Removed support for bam and sam files.
@@ -16,24 +22,3 @@
   database property (raw_strings=yes|no) to control interpretation
   of strings.
 
-* Fri Nov 29 2019 Panagiotis Koutsourakis 
-- Added support for raw strings using the syntax r'' or R''. This means
-  that C-like escapes will remain uninterpreted within those strings. For
-  instance SELECT r'\"' returns a string of length two. The user needs
-  to escape single quotes by doubling them: SELECT r.
-
-* Fri Oct 25 2019 Joeri van Ruth 
-- Added SQL function sys.hot_snapshot() which can be used to write
-  a snapshot of the database to a tar file. For example,
-  sys.hot_snapshot('/tmp/snapshot.tar'). If compression support is
-  compiled in, snapshots can also be compressed ('/tmp/snapshot.tar.gz').
-  The tar file expands to a single directory with the same name as the
-  database that was snapshotted. This directory can be passed directly
-  as the --dbpath argument of mserver5 or it can be copied into an
-  existing dbfarm and started from monetdbd.
-
-* Sat Oct 12 2019 Martin Kersten 
-- The MAL profiler now assigns the SQL TRACE output to the client record
-  thereby avoiding the interaction with other queries, but loosing
-  insight of competing queries. The stethoscope should be used for that.
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -107,11 +107,14 @@ URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
 Source: 
https://www.monetdb.org/downloads/sources/Nov2019-SP3/%{name}-%{version}.tar.bz2
 
-# we need systemd for the _unitdir macro to exist
-# we need checkpolicy and selinux-policy-devel for the SELinux policy
+# The Fedora packaging document says we need systemd-rpm-macros for
+# the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
+# that doesn't exist and we need systemd, so instead we just require
+# the macro file that contains the definitions.
+# We need checkpolicy and selinux-policy-devel for the SELinux policy.
 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
 # RHEL >= 7, and all current Fedora
-BuildRequires: systemd
+BuildRequires: /usr/lib/rpm/macros.d/macros.systemd
 BuildRequires: checkpolicy
 BuildRequires: selinux-policy-devel
 BuildRequires: hardlink
@@ -507,6 +510,9 @@ Suggests: %{name}-client%{?_isa} = %{ver
 %endif
 # versions up to 1.0.5 don't accept the queryid field in the result set
 Conflicts: python-pymonetdb < 1.0.6
+%if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
+Requires(pre): systemd
+%endif
 
 %description -n MonetDB5-server
 MonetDB is a database management system that is developed from a
@@ -519,15 +525,32 @@ package if you want to use the MonetDB d
 to use the SQL front end, you also need %{name}-SQL-server5.
 
 %pre -n MonetDB5-server
-getent group monetdb >/dev/null || groupadd -r monetdb
-getent passwd monetdb >/dev/null || \
-useradd -r -g monetdb -d %{_localstatedir}/MonetDB -s /sbin/nologin \
-   -c "MonetDB Server" monetdb
+%{?sysusers_create_package:echo 'u monetdb - "MonetDB Server" 
/var/lib/monetdb' | systemd-sysusers --replace=%_sysusersdir/monetdb.conf -}
+
+getent group monetdb >/dev/null || groupadd --system monetdb
+if getent passwd monetdb >/dev/null; then
+case $(getent passwd monetdb | cut -d: -f6) in
+%{_localstatedir}/MonetDB) # old value
+   # change home directory, but not using usermod
+   # usermod requires there to not be any running processes owned by the 
user
+   EDITOR='sed -i 
"/^monetdb:/s|:%{_localstatedir}/MonetDB:|:%{_localstatedir}/lib/monetdb:|"'
+   unset VISUAL
+   export EDITOR
+   /sbin/vipw > /dev/null
+   ;;
+esac
+else
+useradd --system --gid monetdb --home-dir %{_localstatedir}/lib/monetdb \
+   --shel

MonetDB: hitchhiker - Checkpoint hh

2020-05-10 Thread Thodoris Zois
Changeset: a2e32ad6ef5b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a2e32ad6ef5b
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
Branch: hitchhiker
Log Message:

Checkpoint hh


diffs (37 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -30,11 +30,17 @@ OPThitchhikerImplementation(Client cntxt
 // and all tables exist on all nodes (see the Python script for more 
details)
 str home_node = "localhost:5";
 int next_node_idx = 2;
-const char* landscape[3] = {
+// const char* landscape[3] = {
+// "localhost:5:mdb1",
+// "localhost:50001:mdb2",
+// "localhost:50002:mdb3",
+// };
+
+const char* landscape[2] = {
 "localhost:5:mdb1",
-"localhost:50001:mdb2",
-"localhost:50002:mdb3",
+"localhost:50001:mdb2"
 };
+size_t landscape_size = sizeof landscape / sizeof landscape[0];
 
 // check if optimizer has been applied
 if(optimizerIsApplied(mb, "hh"))
@@ -78,10 +84,10 @@ OPThitchhikerImplementation(Client cntxt
 q = pushInt(mb, q, next_node_idx);
 
 // landscape-fmt
-q = pushStr(mb, q, "sss");
+// q = pushStr(mb, q, "sss");
 
 // fill landscape info
-for(j = 0; j < 3; j++)
+for(j = 0; j < landscape_size; j++)
 q = pushStr(mb, q, landscape[j]);
 
 // getArg(q, 0) = newTmpVariable(mb, TYPE_any);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - add dbalias in the connection string

2020-04-01 Thread Thodoris Zois
Changeset: 390d5ac2f34e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=390d5ac2f34e
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
sql/backends/monet5/sql_hitchhiker.c
Branch: hitchhiker
Log Message:

add dbalias in the connection string


diffs (87 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -31,9 +31,9 @@ OPThitchhikerImplementation(Client cntxt
 str home_node = "localhost:5";
 int next_node_idx = 2;
 const char* landscape[3] = {
-"localhost:5",
-"localhost:50001",
-"localhost:50002",
+"localhost:5:mdb1",
+"localhost:50001:mdb2",
+"localhost:50002:mdb3",
 };
 
 // check if optimizer has been applied
diff --git a/sql/backends/monet5/sql_hitchhiker.c 
b/sql/backends/monet5/sql_hitchhiker.c
--- a/sql/backends/monet5/sql_hitchhiker.c
+++ b/sql/backends/monet5/sql_hitchhiker.c
@@ -20,10 +20,9 @@ hh_move(Client cntxt, MalBlkPtr mb, MalS
 str username = "monetdb";
 str password = "monetdb";
 str lang = "sql";
-str dbalias = "mdb1";
 str msg = MAL_SUCCEED;
 
-str *home_node, *landscape, *next_node, host, token;
+str *home_node, *landscape, *next_node, host, dbalias, token;
 int *next_node_idx, port, idx;
 Mapi dbh;
 
@@ -39,33 +38,29 @@ hh_move(Client cntxt, MalBlkPtr mb, MalS
 token = strtok(*next_node, delim);
 host = token;
 if(!host)
-{
-fprintf(stderr, "Could not parse connection string\n");
-return msg;
-}
+goto parse_connection;
 
-while(token != NULL) {
-token = strtok(NULL, delim);
-if(token)
-port = atoi(token);
-}
+token = strtok(NULL, delim);
+if(!token)
+goto parse_connection;
+port = atoi(token);
 
-if(!port)
-{
-fprintf(stderr, "Could not parse connection string\n");
-return msg;
-}
+token = strtok(NULL, delim);
+dbalias = token;
+if(!dbalias)
+goto parse_connection;
+
 
 // connect to the next node 
 // TODO: change dbname
 dbh = mapi_connect(host, port, username, password, lang, dbalias);
 if(mapi_error(dbh)) 
-fprintf(stderr, "Failed to connect to node %s:%d\n", host, port);
+fprintf(stderr, "Failed to connect to node %s:%d:%s\n", host, port, 
dbalias);
 
-fprintf(stderr, "Connect to node %s:%d\n", host, port);
+fprintf(stderr, "Connect to node %s:%d:%s\n", host, port, dbalias);
 
 mapi_destroy(dbh); 
-fprintf(stderr, "Disconnected from node %s:%d\n", host, port);
+fprintf(stderr, "Disconnected from node %s:%d:%s\n", host, port, dbalias);
 
 
 
@@ -76,4 +71,8 @@ hh_move(Client cntxt, MalBlkPtr mb, MalS
 next_node_idx = getArgReference_int(stk, pci, 2);
 
 return msg;
+
+parse_connection:
+fprintf(stderr, "Could not parse connection string\n");
+   return msg;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - connect-disconnect to node

2020-03-31 Thread Thodoris Zois
Changeset: 69af7050a94a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=69af7050a94a
Modified Files:
sql/backends/monet5/sql_hitchhiker.c
Branch: hitchhiker
Log Message:

connect-disconnect to node


diffs (85 lines):

diff --git a/sql/backends/monet5/sql_hitchhiker.c 
b/sql/backends/monet5/sql_hitchhiker.c
--- a/sql/backends/monet5/sql_hitchhiker.c
+++ b/sql/backends/monet5/sql_hitchhiker.c
@@ -8,18 +8,24 @@
 
 #include "monetdb_config.h"
 #include "sql_hitchhiker.h"
-
+#include "mapi.h"
 
 str
 hh_move(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+(void) mb;
 (void) cntxt;
-(void) mb;
-(void) stk;
-(void) pci;
 
-str *home_node, *landscape;
-int *next_node_idx, idx;
+const str delim = ":";
+str username = "monetdb";
+str password = "monetdb";
+str lang = "sql";
+str dbalias = "mdb1";
+str msg = MAL_SUCCEED;
+
+str *home_node, *landscape, *next_node, host, token;
+int *next_node_idx, port, idx;
+Mapi dbh;
 
 home_node = getArgReference_str(stk, pci, 1);
 next_node_idx = getArgReference_int(stk, pci, 2);
@@ -29,16 +35,45 @@ hh_move(Client cntxt, MalBlkPtr mb, MalS
 // jump over home_node, next_node_idx and landscape
 // and get the node that should be visited next
 idx = 3 + *next_node_idx;
+next_node = getArgReference_str(stk, pci, idx);
+token = strtok(*next_node, delim);
+host = token;
+if(!host)
+{
+fprintf(stderr, "Could not parse connection string\n");
+return msg;
+}
+
+while(token != NULL) {
+token = strtok(NULL, delim);
+if(token)
+port = atoi(token);
+}
+
+if(!port)
+{
+fprintf(stderr, "Could not parse connection string\n");
+return msg;
+}
+
+// connect to the next node 
+// TODO: change dbname
+dbh = mapi_connect(host, port, username, password, lang, dbalias);
+if(mapi_error(dbh)) 
+fprintf(stderr, "Failed to connect to node %s:%d\n", host, port);
+
+fprintf(stderr, "Connect to node %s:%d\n", host, port);
+
+mapi_destroy(dbh); 
+fprintf(stderr, "Disconnected from node %s:%d\n", host, port);
+
+
 
 // modify the next_node_idx in the stack
 // so the next nodes knows where to jump
 *next_node_idx += 1;
 VALset(>stk[pci->argv[1]], TYPE_int, _node_idx);
 next_node_idx = getArgReference_int(stk, pci, 2);
-
-// connect to the next node 
-// TODO
-
 
-return MAL_SUCCEED;
+return msg;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - merge with default

2020-03-31 Thread Thodoris Zois
Changeset: 38f57551ed00 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38f57551ed00
Added Files:
ChangeLog.Jun2020
buildtools/ChangeLog.Jun2020
clients/ChangeLog.Jun2020
clients/R/Tests/SingleServer
clients/Tests/SingleServer
clients/mapiclient/Tests/SingleServer
clients/mapilib/ChangeLog.Jun2020
common/stream/ChangeLog.Jun2020
documentation/source/json.rst
gdk/ChangeLog.Jun2020
gdk/gdk_geomlogger.h
gdk/gdk_logger_internals.h
gdk/gdk_time.c
gdk/gdk_time.h
geom/BugTracker/Tests/SingleServer
geom/ChangeLog.Jun2020
geom/sql/conformance/Tests/SingleServer
geom/sql/functions/Tests/SingleServer
geom/sql/pg_regression/Tests/SingleServer
monetdb5/ChangeLog.Jun2020
monetdb5/extras/mal_optimizer_template/Tests/SingleServer
monetdb5/extras/rapi/Tests/SingleServer
monetdb5/mal/Tests/SingleServer
monetdb5/modules/atoms/Tests/SingleServer
monetdb5/modules/kernel/Tests/SingleServer
monetdb5/modules/mal/Tests/SingleServer
monetdb5/optimizer/Tests/SingleServer
monetdb5/scheduler/Tests/SingleServer
sql/ChangeLog.Jun2020
sql/ChangeLog.linear-hashing
sql/backends/monet5/Tests/SingleServer
sql/backends/monet5/UDF/capi/Tests/SingleServer
sql/backends/monet5/UDF/pyapi3/Tests/SingleServer
sql/backends/monet5/UDF/udf/Tests/SingleServer
sql/backends/monet5/generator/Tests/SingleServer
sql/benchmarks/ATIS/Tests/SingleServer
sql/benchmarks/arno/Tests/SingleServer
sql/benchmarks/arno_flt/Tests/SingleServer
sql/benchmarks/blob/Tests/SingleServer
sql/benchmarks/moa/Tests/SingleServer
sql/benchmarks/nobench/Tests/SingleServer
sql/benchmarks/ssbm/Tests/SingleServer
sql/benchmarks/tpcds/Tests/SingleServer
sql/benchmarks/tpch/LOCKED/Tests/SingleServer
sql/benchmarks/tpch/Tests/SingleServer
sql/benchmarks/viam/Tests/SingleServer
sql/jdbc/tests/Tests/SingleServer
sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
sql/jdbc/tests/Tests/bogus-auto-generated-keys.sql
sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.err
sql/jdbc/tests/Tests/bogus-auto-generated-keys.stable.out
sql/odbc/samples/Tests/SingleServer
sql/test/ADT2006/Tests/SingleServer
sql/test/BugConstraints/Tests/SingleServer
sql/test/BugDay_2005-10-06_2.8/Tests/SingleServer
sql/test/BugDay_2005-10-06_2.9.3/Tests/SingleServer
sql/test/BugDay_2005-11-09_2.8/Tests/SingleServer
sql/test/BugDay_2005-11-09_2.9.3/Tests/SingleServer
sql/test/BugDay_2005-12-19_2.9.3/Tests/SingleServer
sql/test/BugTracker-2008/Tests/SingleServer
sql/test/BugTracker-2009/Tests/SingleServer
sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py
sql/test/BugTracker-2009/Tests/lost_update.SF-2790020.SQL.py
sql/test/BugTracker-2010/Tests/SingleServer
sql/test/BugTracker-2010/Tests/new-readonly-db.Bug-2695.SQL.py

sql/test/BugTracker-2010/alter-table-restart-crash.SF-2975018/Tests/SingleServer

sql/test/BugTracker-2010/alter-table-restart-crash.SF-2975022/Tests/SingleServer
sql/test/BugTracker-2011/Tests/SingleServer

sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py
sql/test/BugTracker-2012/Tests/SingleServer
sql/test/BugTracker-2013/Tests/SingleServer
sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py
sql/test/BugTracker-2014/Tests/SingleServer
sql/test/BugTracker-2015/Tests/SingleServer
sql/test/BugTracker-2015/Tests/trigger-old-row.Bug-3741.sql
sql/test/BugTracker-2015/Tests/trigger-old-row.Bug-3741.stable.err
sql/test/BugTracker-2015/Tests/trigger-old-row.Bug-3741.stable.out
sql/test/BugTracker-2016/Tests/SingleServer

sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.single
sql/test/BugTracker-2017/Tests/SingleServer
sql/test/BugTracker-2017/Tests/date-arithmetic.Bug-6415.sql
sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py
sql/test/BugTracker-2018/Tests/SingleServer
sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
sql/test/BugTracker-2019/Tests/SingleServer

sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.stable.err
sql/test/BugTracker-2020/Tests/SingleServer
sql/test/BugTracker-2020/Tests/cume-dist-wrong-results.Bug-6827.sql

sql/test/BugTracker-2020/Tests/cume-dist-wrong-results.Bug-6827.stable.err

sql/test/BugTracker-2020/Tests/cume-dist-wrong-results.Bug-6827.stable.out
  

MonetDB: hitchhiker - py script fix whitespace

2020-03-31 Thread Thodoris Zois
Changeset: 09cf0b17149c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=09cf0b17149c
Modified Files:
manipulate_monet.py
Branch: hitchhiker
Log Message:

py script fix whitespace


diffs (35 lines):

diff --git a/manipulate_monet.py b/manipulate_monet.py
--- a/manipulate_monet.py
+++ b/manipulate_monet.py
@@ -40,27 +40,26 @@ def monet_cleanup():
 p.communicate()
 
 
-# Each of the 3 servers holds a table s1 with the same structure (replicated 
schema) 
+# Each of the 3 servers holds a table s1 with the same structure (replicated 
schema)
 # A query select * from s1 comes to one of the servers. The hitchhiker has to 
find all
-# the databases that s1 exists and put the necessary move statements. In this 
case it 
+# the databases that s1 exists and put the necessary move statements. In this 
case it
 # needs to put 3 different statements (since there are 3 mservers holding the 
same table)
 # P.S: In this query we are not using merge tables!
 def monet_execute():
 server = mapi.Connection()
 for i in range(0, len(all_servers)):
 database = all_db_paths[i].split("/")[2]
-server.connect(hostname=hostname, port=all_servers[i], 
+server.connect(hostname=hostname, port=all_servers[i],
username=username, password=password,
database=database, language="sql")
 if monetcase == "create_tables":
 server.cmd(f"sCREATE TABLE s1(i INT);")
 server.cmd(f"sINSERT INTO s1 VALUES ({i + 23}), ({i + 42});")
 elif monetcase == "execute":
-# we need to execute the query only on 1 mserver5 
+# we need to execute the query only on 1 mserver5
 # the hitchhiker will do the rest of the work
 server.cmd("sexplain SELECT * FROM s1;")
 break
-
 
 
 def main():
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - landscape arguments - manipulate monetdb

2020-03-31 Thread Thodoris Zois
Changeset: 08dc62ab8131 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=08dc62ab8131
Added Files:
manipulate_monet.py
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_hitchhiker.c
Branch: hitchhiker
Log Message:

landscape arguments - manipulate monetdb


diffs (206 lines):

diff --git a/manipulate_monet.py b/manipulate_monet.py
new file mode 100644
--- /dev/null
+++ b/manipulate_monet.py
@@ -0,0 +1,78 @@
+from pymonetdb import mapi
+import subprocess
+import sys
+import os
+
+available_cases = [ "start", "stop", "cleanup", "create_tables", "execute" ]
+all_servers = [ 5, 50001, 50002 ]
+all_db_paths = [ "/tmp/mdb1", "/tmp/mdb2", "/tmp/mdb3" ]
+hostname = "localhost"
+username = "monetdb"
+password = "monetdb"
+
+if len(sys.argv) < 2:
+print("Usage: python  ")
+sys.exit()
+else:
+monetcase = sys.argv[1]
+if monetcase not in available_cases:
+print("Usage: python  ")
+sys.exit()
+
+
+
+def monet_start():
+for i in range(0, len(all_servers)):
+print(f"Starting mserver on port: {all_servers[i]} and dbpath: 
{all_db_paths[i]}")
+p = subprocess.Popen([f"mserver5 --dbpath={all_db_paths[i]} --set 
mapi_port={all_servers[i]} --set monet_daemon=yes"], shell=True)
+
+
+def monet_stop():
+print(f"Stoping {len(all_servers)} mserver5 instances")
+p = subprocess.Popen(["t=`pgrep mserver5` && kill -9 $t"], shell=True)
+p.communicate()
+
+
+def monet_cleanup():
+for db_path in all_db_paths:
+print(f"Cleaning directory {db_path}")
+p = subprocess.Popen([f"rm -rf {db_path}"], shell=True)
+p.communicate()
+
+
+# Each of the 3 servers holds a table s1 with the same structure (replicated 
schema) 
+# A query select * from s1 comes to one of the servers. The hitchhiker has to 
find all
+# the databases that s1 exists and put the necessary move statements. In this 
case it 
+# needs to put 3 different statements (since there are 3 mservers holding the 
same table)
+# P.S: In this query we are not using merge tables!
+def monet_execute():
+server = mapi.Connection()
+for i in range(0, len(all_servers)):
+database = all_db_paths[i].split("/")[2]
+server.connect(hostname=hostname, port=all_servers[i], 
+   username=username, password=password,
+   database=database, language="sql")
+if monetcase == "create_tables":
+server.cmd(f"sCREATE TABLE s1(i INT);")
+server.cmd(f"sINSERT INTO s1 VALUES ({i + 23}), ({i + 42});")
+elif monetcase == "execute":
+# we need to execute the query only on 1 mserver5 
+# the hitchhiker will do the rest of the work
+server.cmd("sexplain SELECT * FROM s1;")
+break
+
+
+
+def main():
+if monetcase == "start":
+monet_start()
+elif monetcase == "stop":
+monet_stop()
+elif monetcase == "cleanup":
+monet_cleanup()
+else:
+monet_execute()
+
+
+if __name__ == "__main__":
+main()
diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -21,9 +21,21 @@ OPThitchhikerImplementation(Client cntxt
 str msg;
 char buf[256];
 int i, limit, slimit, updates = 0, actions = 0;
+size_t j;
 InstrPtr p, q, *old;
 lng clk = GDKusec();
 
+// Initialize the landscape - this is hardcoded it needs to be removed
+// It also assumes that the tables of the query have a replicated schema
+// and all tables exist on all nodes (see the Python script for more 
details)
+str home_node = "localhost:5";
+int next_node_idx = 2;
+const char* landscape[3] = {
+"localhost:5",
+"localhost:50001",
+"localhost:50002",
+};
+
 // check if optimizer has been applied
 if(optimizerIsApplied(mb, "hh"))
 return MAL_SUCCEED;
@@ -52,12 +64,31 @@ OPThitchhikerImplementation(Client cntxt
 // if instruction IS sql.tid first inject the new instruction first
 if(getModuleId(p) == sqlRef && getFunctionId(p) == tidRef)
 {
-// create a new instruction and push it
-q = newInstruction(mb, hitchhikerRef, moveRef);
-getArg(q, 0) = newTmpVariable(mb, TYPE_any);
-// setDestVar(q, newTmpVariable(mb, Typ));
-pushInstruction(mb, q);
-actions++;
+// SOS: if table s1 is included - this needs to be removed 
+if(strcmp(getVarConstant(mb, getArg(p, 3)).val.sval, "s1") == 
0) {
+
+// do it if table is s1 - for now
+// create a new instruction and push it
+q = newInstruction(mb, hitchhikerRef, moveRef);
+
+// fill 

MonetDB: hitchhiker - Add hh.move before every sql.tid statement

2020-03-13 Thread Thodoris Zois
Changeset: 8c25de4ce971 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c25de4ce971
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_hitchhiker.c
sql/backends/monet5/sql_hitchhiker.h
Branch: hitchhiker
Log Message:

Add hh.move before every sql.tid statement


diffs (232 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -20,48 +20,58 @@ OPThitchhikerImplementation(Client cntxt
 
 str msg;
 char buf[256];
-int i, limit, slimit, actions = 0;
-// InstrPtr p;
+int i, limit, slimit, updates = 0, actions = 0;
+InstrPtr p, q, *old;
 lng clk = GDKusec();
 
-// if (newMalBlkStmt(mb, mb->ssize) < 0)
-// throw(MAL, "optimizer.hitchhiker", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+// check if optimizer has been applied
+if(optimizerIsApplied(mb, "hh"))
+return MAL_SUCCEED;
 
 limit = mb->stop;
 slimit = mb->ssize;
-// old = mb->stmt;
-
-// sql in bindRef and tidRef
+old = mb->stmt;
+
+// count the number statements that need to be inserted
+// in practice, for every sql.tid we need a hh.move
 for(i = 0; i < limit; i++)
+if(getModuleId(mb->stmt[i]) == sqlRef && getFunctionId(mb->stmt[i]) == 
tidRef)
+updates++;
+
+if(updates)
 {
-if(getModuleId(mb->stmt[i]) == sqlRef && (getFunctionId(mb->stmt[i]) 
== bindRef || getFunctionId(mb->stmt[i]) == tidRef))
+// malloc new MAL block statement
+if (newMalBlkStmt(mb, mb->ssize + updates) < 0)
+throw(MAL, "hitchhiker.optimizer", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+
+// locate sql.tid and inject hh.move calls before that
+for(i = 0; i < limit; i++)
 {
-// if((q = copyInstruction(p)) == NULL) {
-// for (; i < slimit; i++)
-// if (old[i])
-// freeInstruction(old[i]);
-// GDKfree(old);
+p = old[i];
 
-// return createException(MAL, "optimizer.hitchhiker", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
-// }
+// if instruction IS sql.tid first inject the new instruction first
+if(getModuleId(p) == sqlRef && getFunctionId(p) == tidRef)
+{
+// create a new instruction and push it
+q = newInstruction(mb, hitchhikerRef, moveRef);
+getArg(q, 0) = newTmpVariable(mb, TYPE_any);
+// setDestVar(q, newTmpVariable(mb, Typ));
+pushInstruction(mb, q);
+actions++;
+}
 
-setModuleId(mb->stmt[i], hitchhikerRef);
-actions++;
+// push the original instructions
+if(p)
+pushInstruction(mb, p);
 }
 
-// if(p)
-// pushInstruction(mb, p);
+// free old
+for (; i < slimit; i++)
+if (old[i])
+freeInstruction(old[i]);
+GDKfree(old);
 }
 
-// free old
-// for (; i < slimit; i++)
-// if (old[i])
-// freeInstruction(old[i]);
-// GDKfree(old);
-
-if(mb->errors)
-throw(MAL, "optimizer.hitchhiker", SQLSTATE(42000) PROGRAM_GENERAL);
-
 // defense line against incorrect plans
 msg = chkTypes(cntxt->usermodule, mb, FALSE);
 if(msg == MAL_SUCCEED) msg = chkFlow(mb);
@@ -69,7 +79,7 @@ OPThitchhikerImplementation(Client cntxt
 
 clk = GDKusec() - clk;
 snprintf(buf, 256, "%-20s actions=%2d time=" LLFMT " usec", 
"optimizer.hitchhiker", actions, clk);
-newComment(mb,buf);
+newComment(mb, buf);
 addtoMalBlkHistory(mb);
 
 return msg;
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -187,6 +187,7 @@ str mirrorRef;
 str mitosisRef;
 str mkeyRef;
 str mmathRef;
+str moveRef;
 str mtimeRef;
 str mulRef;
 str multicolumnRef;
@@ -488,6 +489,7 @@ void optimizerInit(void)
mitosisRef = putName("mitosis");
mkeyRef = putName("mkey");
mmathRef = putName("mmath");
+   moveRef = putName("move");
mtimeRef = putName("mtime");
mulRef = putName("*");
multicolumnRef = putName("multicolumn");
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -186,6 +186,7 @@ mal_export  str mirrorRef;
 mal_export  str mitosisRef;
 mal_export  str mkeyRef;
 mal_export  str mmathRef;
+mal_export  str moveRef;
 mal_export  str mtimeRef;
 mal_export  str mulRef;
 mal_export  str multicolumnRef;
diff --git 

MonetDB: hitchhiker - Hitchhiker optimizer replaces sql.bind wit...

2020-02-21 Thread Thodoris Zois
Changeset: e2c95ea966c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2c95ea966c8
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_hitchhiker.c
sql/backends/monet5/sql_hitchhiker.h
Branch: hitchhiker
Log Message:

Hitchhiker optimizer replaces sql.bind with hh.bind and sql.tid with hh.tid


diffs (283 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -11,69 +11,56 @@
 #include "mal_interpreter.h"
 
 
-
-static int 
-OPThitchhiker(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-(void) cntxt;
-   (void) pci;
-   (void) stk;
-(void) mb;
-return 0;
-}
-
-
 str
 OPThitchhikerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
 (void) cntxt;
+(void) stk;
+(void) pci;
 
-str modnme;
-   str fcnnme;
 str msg;
-Symbol s = NULL;
-int actions = 0;
 char buf[256];
-lng clk= GDKusec();
+int i, limit, slimit, actions = 0;
+// InstrPtr p;
+lng clk = GDKusec();
 
-if(pci)
-removeInstruction(mb, pci);
+// if (newMalBlkStmt(mb, mb->ssize) < 0)
+// throw(MAL, "optimizer.hitchhiker", SQLSTATE(HY013) MAL_MALLOC_FAIL);
 
-if(pci && pci->argc > 1){
-if( getArgType(mb, pci, 1) != TYPE_str ||
-getArgType(mb, pci, 2) != TYPE_str ||
-!isVarConstant(mb, getArg(pci, 1)) ||
-!isVarConstant(mb, getArg(pci, 2))
-) {
-throw(MAL, "optimizer.hitchhiker", ILLARG_CONSTANTS);
-}
-if(stk != 0) {
-modnme = *getArgReference_str(stk, pci, 1);
-fcnnme = *getArgReference_str(stk, pci, 2);
-} else {
-modnme = getArgDefault(mb, pci, 1);
-fcnnme = getArgDefault(mb, pci, 2);
-}
-s = findSymbol(cntxt->usermodule, putName(modnme), putName(fcnnme));
+limit = mb->stop;
+slimit = mb->ssize;
+// old = mb->stmt;
+
+// sql in bindRef and tidRef
+for(i = 0; i < limit; i++)
+{
+if(getModuleId(mb->stmt[i]) == sqlRef && (getFunctionId(mb->stmt[i]) 
== bindRef || getFunctionId(mb->stmt[i]) == tidRef))
+{
+// if((q = copyInstruction(p)) == NULL) {
+// for (; i < slimit; i++)
+// if (old[i])
+// freeInstruction(old[i]);
+// GDKfree(old);
 
-if(s == NULL) {
-char buf[1024];
-snprintf(buf, 1024, "%s.%s", modnme, fcnnme);
-throw(MAL, "optimizer.hitchhiker", RUNTIME_OBJECT_UNDEFINED ":%s", 
buf);
+// return createException(MAL, "optimizer.hitchhiker", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
+// }
+
+setModuleId(mb->stmt[i], hitchhikerRef);
+actions++;
 }
 
-mb = s->def;
-stk = 0;
+// if(p)
+// pushInstruction(mb, p);
 }
 
-if(mb->errors) {
-// when we have errors, we still want to see them
-addtoMalBlkHistory(mb);
-return MAL_SUCCEED;
-}
+// free old
+// for (; i < slimit; i++)
+// if (old[i])
+// freeInstruction(old[i]);
+// GDKfree(old);
 
-// number of successfull changes to the code
-actions = OPThitchhiker(cntxt, mb, stk, pci);
+if(mb->errors)
+throw(MAL, "optimizer.hitchhiker", SQLSTATE(42000) PROGRAM_GENERAL);
 
 // defense line against incorrect plans
 msg = chkTypes(cntxt->usermodule, mb, FALSE);
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
@@ -91,6 +91,7 @@ static struct PIPELINES {
 "optimizer.postfix();"
 //  "optimizer.jit();" awaiting the new batcalc api
 "optimizer.wlc();"
+"optimizer.hitchhiker();"
 "optimizer.garbageCollector();",
 "stable", NULL, NULL, 1},
 /*
@@ -205,6 +206,7 @@ static struct PIPELINES {
 "optimizer.postfix();"
 //  "optimizer.jit();" awaiting the new batcalc api
 "optimizer.wlc();"
+"optimizer.hitchhiker();"
 "optimizer.garbageCollector();",
 "stable", NULL, NULL, 1},
 /* The sequential pipe line is (and should be kept!) identical to the
@@ -245,6 +247,7 @@ static struct PIPELINES {
 "optimizer.postfix();"
 //  "optimizer.jit();" awaiting the new batcalc api
 "optimizer.wlc();"
+"optimizer.hitchhiker();"
 "optimizer.garbageCollector();",
 "stable", NULL, NULL, 1},
 /* Experimental pipelines stressing various components under
diff --git a/monetdb5/optimizer/opt_prelude.c 

MonetDB: hitchhiker - Added module hitchhiker (hh) in SQL layer

2020-02-21 Thread Thodoris Zois
Changeset: 9e97ff5d1439 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9e97ff5d1439
Added Files:
sql/backends/monet5/sql_hitchhiker.c
sql/backends/monet5/sql_hitchhiker.h
Modified Files:
sql/backends/monet5/Makefile.ag
sql/backends/monet5/sql.mal
Branch: hitchhiker
Log Message:

Added module hitchhiker (hh) in SQL layer


diffs (109 lines):

diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -46,6 +46,7 @@ lib__sql = {
sql_round.c sql_round_impl.h sql_bat2time.c \
sql_fround.c sql_fround_impl.h \
sql_orderidx.c sql_orderidx.h \
+   sql_hitchhiker.c sql_hitchhiker.h \
wlr.c wlr.h \
sql_datetrunc.c \
sql_rank.c sql_rank.h sql_subquery.c sql_subquery.h
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -6,6 +6,7 @@
 
 module batsql;
 module sql;
+module hh;
 
 pattern shutdown(delay:bte, force:bit):str
 address SQLshutdown_wrap;
@@ -208,6 +209,34 @@ comment "Bind the 'schema.table.index' B
1 - inserts
2 - updates";
 
+pattern hh.bind(mvc:int, schema:str, table:str, column:str, access:int 
):bat[:any_1]
+address sql_hitchhiker
+comment "Bind the 'schema.table.column' BAT with access kind:
+   0 - base table
+   1 - inserts
+   2 - updates";
+
+pattern hh.bind(mvc:int, schema:str, table:str, column:str, access:int 
)(uid:bat[:oid],uval:bat[:any_1])
+address sql_hitchhiker
+comment "Bind the 'schema.table.column' BAT with access kind:
+   0 - base table
+   1 - inserts
+   2 - updates";
+
+pattern hh.bind(mvc:int, schema:str, table:str, column:str, access:int, 
part_nr:int, nr_parts:int ):bat[:any_1]
+address sql_hitchhiker
+comment "Bind the 'schema.table.column' BAT partition with access kind:
+   0 - base table
+   1 - inserts
+   2 - updates";
+
+pattern hh.bind(mvc:int, schema:str, table:str, column:str, access:int, 
part_nr:int, nr_parts:int )(uid:bat[:oid],uval:bat[:any_1])
+address sql_hitchhiker
+comment "Bind the 'schema.table.column' BAT with access kind:
+   0 - base table
+   1 - inserts
+   2 - updates";
+
 pattern emptybind(mvc:int, schema:str, table:str, column:str, access:int 
):bat[:any_1]
 address mvc_bind_wrap;
 pattern bind(mvc:int, schema:str, table:str, column:str, access:int 
):bat[:any_1]
diff --git a/sql/backends/monet5/sql_hitchhiker.c 
b/sql/backends/monet5/sql_hitchhiker.c
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/sql_hitchhiker.c
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#include "monetdb_config.h"
+#include "sql_hitchhiker.h"
+
+str
+sql_hitchhiker(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+return mvc_bind_wrap(cntxt, mb, stk, pci);
+}
diff --git a/sql/backends/monet5/sql_hitchhiker.h 
b/sql/backends/monet5/sql_hitchhiker.h
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/sql_hitchhiker.h
@@ -0,0 +1,26 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#ifndef _SQL_HITCHHIKER_
+#define _SQL_HITCHHIKER_
+
+#include "sql.h"
+
+#ifdef WIN32
+#ifndef LIBSQL
+#define sql5_export extern __declspec(dllimport)
+#else
+#define sql5_export extern __declspec(dllexport)
+#endif
+#else
+#define sql5_export extern
+#endif
+
+sql5_export str sql_hitchhiker(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+
+#endif /* _SQL_HITCHHIKER_ */
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Merge with default

2020-02-19 Thread Thodoris Zois
Changeset: 3ceae43efdab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ceae43efdab
Added Files:
sql/test/rename/Tests/rename12.sql
sql/test/rename/Tests/rename12.stable.err
sql/test/rename/Tests/rename12.stable.out
Modified Files:
clients/Tests/exports.stable.out
clients/mapilib/monetdb-mapi.pc.in
monetdb5/modules/mal/profiler.mal
monetdb5/tools/Tests/mserver5--help.stable.err
monetdb5/tools/Tests/mserver5--help.stable.err.Windows
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_upgrades.c
sql/server/rel_exp.c
sql/server/rel_unnest.c
sql/server/sql_mvc.c
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128

sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/mergetables/Tests/sqlsmith-exists2.stable.out
sql/test/rename/Tests/All
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
tools/mserver/mserver5.c
Branch: hitchhiker
Log Message:

Merge with default


diffs (truncated from 1289 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -300,10 +300,11 @@ ssize_t GDKstrFromStr(unsigned char *res
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
-gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_Level);
+gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
 gdk_return GDKtracer_flush_buffer(void);
 char *GDKtracer_get_timestamp(const char *fmt, char *buf, size_t sz);
 gdk_return GDKtracer_log(LOG_LEVEL level, const char *fmt, ...) 
__attribute__((format(printf, 2, 3)));
+void GDKtracer_reinit_basic(int sig);
 gdk_return GDKtracer_reset_adapter(void);
 gdk_return GDKtracer_reset_component_level(int comp);
 gdk_return GDKtracer_reset_flush_level(void);
diff --git a/clients/mapilib/monetdb-mapi.pc.in 
b/clients/mapilib/monetdb-mapi.pc.in
--- a/clients/mapilib/monetdb-mapi.pc.in
+++ b/clients/mapilib/monetdb-mapi.pc.in
@@ -2,17 +2,17 @@
 # License, v. 2.0.  If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
-# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${exec_prefix}
+libdir=${libdir}
+includedir=${includedir}
 
 Name: monetdb-mapi
 Description: MonetDB MAPI C-client libary
-Version: @PACKAGE_VERSION@
+Version: @MONETDB_VERSION@
 Requires: monetdb-stream openssl
 
-Libs: -L${libdir} -lmapi @SOCKET_LIBS@
+Libs: -L${libdir} -lmapi
 Cflags: -I${includedir}/monetdb
diff --git a/monetdb5/modules/mal/profiler.mal 
b/monetdb5/modules/mal/profiler.mal
--- a/monetdb5/modules/mal/profiler.mal
+++ b/monetdb5/modules/mal/profiler.mal
@@ -38,10 +38,6 @@ pattern openstream():void
 address CMDopenProfilerStream
 comment "Start profiling the events, send to output stream";
 
-pattern openstream(mode:int):void
-address CMDopenProfilerStream
-comment "Start profiling the events, send to output stream";
-
 pattern closestream():void
 address CMDcloseProfilerStream
 comment "Stop offline proviling";
diff --git a/monetdb5/tools/Tests/mserver5--help.stable.err 
b/monetdb5/tools/Tests/mserver5--help.stable.err
--- a/monetdb5/tools/Tests/mserver5--help.stable.err
+++ 

MonetDB: default - ifdef SIGHUP

2020-02-18 Thread Thodoris Zois
Changeset: cde3d1278c6b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cde3d1278c6b
Modified Files:
tools/mserver/mserver5.c
Branch: default
Log Message:

ifdef SIGHUP


diffs (14 lines):

diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -733,8 +733,10 @@ main(int argc, char **av)
free(err);
}
 
+#ifdef SIGHUP
// Register signal to GDKtracer (logrotate)
signal(SIGHUP, GDKtracer_reinit_basic);
+#endif
 
 #ifdef _MSC_VER
printf("# MonetDB server is started. To stop server press Ctrl-C.\n");
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Optimizer start

2020-02-18 Thread Thodoris Zois
Changeset: 8e11b67b43a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8e11b67b43a4
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
Branch: hitchhiker
Log Message:

Optimizer start


diffs (88 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -10,14 +10,80 @@
 #include "opt_hitchhiker.h"
 #include "mal_interpreter.h"
 
+
+
+static int 
+OPThitchhiker(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+(void) cntxt;
+   (void) pci;
+   (void) stk;
+(void) mb;
+return 0;
+}
+
+
 str
 OPThitchhikerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
 (void) cntxt;
-(void) mb;
-(void) stk;
-(void) pci;
+
+str modnme;
+   str fcnnme;
+str msg;
+Symbol s = NULL;
+int actions = 0;
+char buf[256];
+lng clk= GDKusec();
+
+if(pci)
+removeInstruction(mb, pci);
+
+if(pci && pci->argc > 1){
+if( getArgType(mb, pci, 1) != TYPE_str ||
+getArgType(mb, pci, 2) != TYPE_str ||
+!isVarConstant(mb, getArg(pci, 1)) ||
+!isVarConstant(mb, getArg(pci, 2))
+) {
+throw(MAL, "optimizer.hitchhiker", ILLARG_CONSTANTS);
+}
+if(stk != 0) {
+modnme = *getArgReference_str(stk, pci, 1);
+fcnnme = *getArgReference_str(stk, pci, 2);
+} else {
+modnme = getArgDefault(mb, pci, 1);
+fcnnme = getArgDefault(mb, pci, 2);
+}
+s = findSymbol(cntxt->usermodule, putName(modnme), putName(fcnnme));
 
-str msg = MAL_SUCCEED;
+if(s == NULL) {
+char buf[1024];
+snprintf(buf, 1024, "%s.%s", modnme, fcnnme);
+throw(MAL, "optimizer.hitchhiker", RUNTIME_OBJECT_UNDEFINED ":%s", 
buf);
+}
+
+mb = s->def;
+stk = 0;
+}
+
+if(mb->errors) {
+// when we have errors, we still want to see them
+addtoMalBlkHistory(mb);
+return MAL_SUCCEED;
+}
+
+// number of successfull changes to the code
+actions = OPThitchhiker(cntxt, mb, stk, pci);
+
+// defense line against incorrect plans
+msg = chkTypes(cntxt->usermodule, mb, FALSE);
+if(msg == MAL_SUCCEED) msg = chkFlow(mb);
+if(msg == MAL_SUCCEED) msg = chkDeclarations(mb);
+
+clk = GDKusec() - clk;
+snprintf(buf, 256, "%-20s actions=%2d time=" LLFMT " usec", 
"optimizer.hitchhiker", actions, clk);
+newComment(mb,buf);
+addtoMalBlkHistory(mb);
+
 return msg;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Merge with default

2020-02-18 Thread Thodoris Zois
Changeset: 6e2d11ae973b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e2d11ae973b
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: hitchhiker
Log Message:

Merge with default


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -3178,7 +3178,7 @@ SQLupgrades(Client c, mvc *m)
sql_find_subtype(, "hugeint", 0, 0);
if (!sql_bind_func(m->sa, s, "median_avg", , NULL, F_AGGR)) {
if ((err = sql_update_nov2019_sp1_hugeint(c, m, 
prev_schema, )) != NULL) {
-   fprintf(stderr, "!%s\n", err);
+   TRC_ERROR(SQL_UPGRADES, "%s\n", err);
freeException(err);
res = -1;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Replaced fprintf

2020-02-18 Thread Thodoris Zois
Changeset: 97db6d79429c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=97db6d79429c
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: default
Log Message:

Replaced fprintf


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -3178,7 +3178,7 @@ SQLupgrades(Client c, mvc *m)
sql_find_subtype(, "hugeint", 0, 0);
if (!sql_bind_func(m->sa, s, "median_avg", , NULL, F_AGGR)) {
if ((err = sql_update_nov2019_sp1_hugeint(c, m, 
prev_schema, )) != NULL) {
-   fprintf(stderr, "!%s\n", err);
+   TRC_ERROR(SQL_UPGRADES, "%s\n", err);
freeException(err);
res = -1;
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Merge with default

2020-02-18 Thread Thodoris Zois
Changeset: daa17a255eea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=daa17a255eea
Added Files:
sql/server/rel_rewriter.c
sql/server/rel_rewriter.h
sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.py
sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.err
sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.out
Modified Files:
.hgtags
ChangeLog
MonetDB.spec
NT/monetdb_config.h.in
NT/rules.msc
clients/Tests/exports.stable.out
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
configure.ag
debian/changelog
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_atoms.h
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_hash.c
gdk/gdk_hash.h
gdk/gdk_private.h
gdk/gdk_string.c
gdk/gdk_system.h
gdk/gdk_tracer.c
gdk/gdk_tracer.h
gdk/gdk_utils.c
gdk/gdk_utils.h
gdk/libbat.rc
geom/monetdb5/geom.c
libversions
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_private.h
monetdb5/modules/atoms/blob.h
monetdb5/modules/kernel/bat5.c
monetdb5/modules/mal/remote.c
monetdb5/optimizer/opt_oltp.c
monetdb5/tools/libmonetdb5.rc
sql/backends/monet5/UDF/capi/capi.c
sql/backends/monet5/UDF/capi/capi.h
sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
sql/backends/monet5/UDF/pyapi3/pyheader.h
sql/backends/monet5/sql_scenario.c
sql/scripts/81_tracer.sql
sql/server/Makefile.ag
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_schema.c
sql/server/rel_unnest.c
sql/server/sql_mvc.c
sql/storage/store.c

sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
sql/test/BugTracker-2017/Tests/not_plus.Bug-6294.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-mal-calc-undefined.Bug-6566.stable.out
sql/test/BugTracker-2020/Tests/All
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql

sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
sql/test/mergetables/Tests/sqlsmith-exists2.sql
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.out
tools/merovingian/ChangeLog
tools/merovingian/daemon/forkmserver.c
tools/merovingian/utils/properties.c
tools/mserver/mserver5.c
vertoo.data
Branch: hitchhiker
Log Message:

Merge with default


diffs (truncated from 5069 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -755,3 +755,6 @@ c35ea84b568b792c5fd073f6a1e1a24372de0e20
 4eb6068f63cf87fc6996daed59fbcc917c8b2881 Nov2019_13
 c35ea84b568b792c5fd073f6a1e1a24372de0e20 Nov2019_SP2_release
 4eb6068f63cf87fc6996daed59fbcc917c8b2881 Nov2019_SP2_release
+7186b517a584f0244e20eb7abe61f7a7c0c9ea1b Nov2019_15
+4eb6068f63cf87fc6996daed59fbcc917c8b2881 Nov2019_SP2_release
+7186b517a584f0244e20eb7abe61f7a7c0c9ea1b Nov2019_SP2_release
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Tue Feb 18 2020 Thodoris Zois 
+- Added mserver5 option (--dbtrace=) in order to be able to
+  specify the output directory of the produced traces.
+
 * Thu Feb  6 2020 Panagiotis Koutsourakis 
 - Add port and host as fields in the .monetdb file.
 
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -941,6 +941,12 @@ fi
 %postun -p /sbin/ldconfig
 
 %changelog
+* Mon Feb 17 2020 Sjoerd Mullender  - 11.35.15-20200217
+- Rebuilt.
+- BZ#6817: running analyze on a schema which contains a stream table
+  stops with an error
+- BZ#6819: functions do not persist
+
 * Wed Feb 12 2020 Sjoerd Mullender  - 11.35.13-20200212
 - Rebuilt.
 
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -512,7 +512,6 @@ ssize_t shtFromStr(const char *src, size
 ssize_t shtToStr(str *dst, size_t *len, const sht *src, bool external);
 const sht sht_nil;
 ssize_t strFromStr(const char *restrict src, size_t *restrict len, str 
*restrict dst, bool external);
-BUN strHash(const char *s);
 const char str_nil[2];
 gdk_return void_inplace(BAT *b, oid id, const void *val, bool force) 
__attribute__

MonetDB: default - merge with default

2020-02-18 Thread Thodoris Zois
Changeset: 873347ebd047 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=873347ebd047
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_string.c
sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
Branch: default
Log Message:

merge with default


diffs (71 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3169,7 +3169,7 @@ BATcalcvariance_sample(dbl *avgp, BAT *b
} while (0)
 
 static dbl
-calccovariance(const void *restrict v1, const void *restrict v2, BUN cnt, int 
tp, bool issample, const char *func)
+calccovariance(const void *v1, const void *v2, BUN cnt, int tp, bool issample, 
const char *func)
 {
BUN n = 0, i;
dbl mean1 = 0, mean2 = 0, m2 = 0, delta1, delta2;
@@ -3246,7 +3246,7 @@ BATcalccorrelation(BAT *b1, BAT *b2)
 {
BUN n = 0, i, cnt = BATcount(b1);
dbl mean1 = 0, mean2 = 0, up = 0, down1 = 0, down2 = 0, delta1, delta2, 
aux;
-   const void *restrict v1 = (const void *) Tloc(b1, 0), *restrict v2 = 
(const void *) Tloc(b2, 0);
+   const void *v1 = (const void *) Tloc(b1, 0), *v2 = (const void *) 
Tloc(b2, 0);
int tp = b1->ttype;
 
switch (tp) {
@@ -3517,8 +3517,8 @@ BATgroupvariance_population(BAT *b, BAT 
 
 #define AGGR_COVARIANCE(TYPE)  \
do {\
-   const TYPE *restrict vals1 = (const TYPE *) Tloc(b1, 0);
\
-   const TYPE *restrict vals2 = (const TYPE *) Tloc(b2, 0);
\
+   const TYPE *vals1 = (const TYPE *) Tloc(b1, 0); \
+   const TYPE *vals2 = (const TYPE *) Tloc(b2, 0); \
while (ncand > 0) { \
ncand--;\
i = canditer_next() - b1->hseqbase;  \
@@ -3691,8 +3691,8 @@ BATgroupcovariance_population(BAT *b1, B
 
 #define AGGR_CORRELATION(TYPE) \
do {\
-   const TYPE *restrict vals1 = (const TYPE *) Tloc(b1, 0);
\
-   const TYPE *restrict vals2 = (const TYPE *) Tloc(b2, 0);
\
+   const TYPE *vals1 = (const TYPE *) Tloc(b1, 0); \
+   const TYPE *vals2 = (const TYPE *) Tloc(b2, 0); \
while (ncand > 0) { \
ncand--;\
i = canditer_next() - b1->hseqbase;  \
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -794,8 +794,8 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
 {
oid gid;
BUN i, p, nils = 0;
-   size_t *lengths = NULL, *lastseplength = NULL, separator_length = 0, 
next_length;
-   str *astrings = NULL, s, sl;
+   size_t *restrict lengths = NULL, *restrict lastseplength = NULL, 
separator_length = 0, next_length;
+   str *restrict astrings = NULL, s, sl;
BATiter bi, bis = (BATiter) {0};
BAT *bn = NULL;
gdk_return rres = GDK_SUCCEED;
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out 
b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.stable.out
@@ -41,8 +41,8 @@ stdout of test 'pyloader3_01` in directo
 % sys.functions,   sys.functions,  sys.functions,  sys.functions,  
sys.functions,  sys.functions,  sys.functions,  sys.functions # table_name
 % name,func,   mod,language,   type,   side_effect,varres, 
vararg # name
 % varchar, varchar,varchar,int,int,boolean,
boolean,boolean # type
-% 6,   32, 6,  1,  1,  5,  5,  5 # length
-[ "myfunc","{\n\t_emit.emit({'a':42,'d':1})\n};",  "pyapi3",   6,  
7,  true,   true,   false   ]
+% 6,   32, 5,  1,  1,  5,  5,  5 # length
+[ "myfunc","{\n\t_emit.emit({'a':42,'d':1})\n};",  "pyapi",6,  
7,  true,   true,   false   ]
 #COPY LOADER INTO mytable FROM myfunc();
 #COPY LOADER INTO mytable FROM myfunc3(46, 'asdf', 3.2);
 #COPY LOADER INTO mytable FROM myfunc2(45, 'asdf');
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Sending SIGHUP to mserver5 will cause GDKtrac...

2020-02-18 Thread Thodoris Zois
Changeset: b6bde489af97 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6bde489af97
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
tools/mserver/mserver5.c
Branch: default
Log Message:

Sending SIGHUP to mserver5 will cause GDKtracer to reopen the trace file 
(logrotation)


diffs (120 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -16,6 +16,8 @@ static gdk_tracer *active_tracer = 
 MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer_1");
 
 static FILE *output_file;
+static char file_name[FILENAME_MAX];
+
 static ATOMIC_TYPE CUR_ADAPTER = ATOMIC_VAR_INIT(DEFAULT_ADAPTER);
 static bool INIT_BASIC_ADAPTER = false;
 static bool LOG_EXC_REP = false;
@@ -29,12 +31,11 @@ LOG_LEVEL LVL_PER_COMPONENT[] = {
 
 
 
-// When BASIC adapter is active, all the log messages are getting output to a 
file.
+// When BASIC adapter is active, all the log messages are getting printed to a 
file.
 // This function prepares a file in order to write the contents of the buffer 
when necessary.
 static gdk_return
 _GDKtracer_init_basic_adptr(void)
 {
-   char file_name[FILENAME_MAX];   
const char* TRACE_PATH = GDKgetenv("gdk_dbpath");
 
if(GDKgetenv("gdk_dbtrace") != NULL)
@@ -42,17 +43,17 @@ static gdk_return
 
snprintf(file_name, sizeof(file_name), "%s%c%s", TRACE_PATH, DIR_SEP, 
FILE_NAME);
output_file = fopen(file_name, "a");
-
+   
// Even if creating the file failed, the adapter has 
// still tried to initialize and we shouldn't retry it
INIT_BASIC_ADAPTER = true;
-   
+
if(!output_file)
{
-   GDK_TRACER_EXCEPTION(BASIC_INIT_FAILED ": %s\n", file_name);
+   GDK_TRACER_EXCEPTION(OPENFILE_FAILED);
return GDK_FAIL;
}
-   
+
return GDK_SUCCEED;
 }
 
@@ -190,6 +191,35 @@ GDKtracer_get_timestamp(const char *fmt,
 }
 
 
+void
+GDKtracer_reinit_basic(int sig)
+{
+   (void) sig;
+
+   // GDKtracer needs to reopen the file only in 
+   // case the adapter is BASIC
+   if ((int) ATOMIC_GET(_ADAPTER) != BASIC)
+   return;
+
+   // BASIC adapter has been initialized already and file is open
+   if(INIT_BASIC_ADAPTER && output_file) {
+   // Make sure that GDKtracer is not trying to flush the buffer
+   MT_lock_set();
+   {
+   // Close file 
+   fclose(output_file);
+   output_file = NULL;
+   
+   // Open a new file in append mode
+   output_file = fopen(file_name, "a");
+   if(!output_file)
+   GDK_TRACER_EXCEPTION(OPENFILE_FAILED);
+   }
+   MT_lock_unset();   
+   }
+}
+
+
 gdk_return
 GDKtracer_stop(void)
 {
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -44,7 +44,7 @@
 #define NEW_LINE '\n'
 #define MXW "20"
 
-#define BASIC_INIT_FAILED "Failed to initialize BASIC adapter"
+#define OPENFILE_FAILED "Failed to open "FILE_NAME
 #define GDKTRACER_FAILED "Failed to write logs"
 
 #define AS_STR(x) #x
@@ -334,6 +334,10 @@ typedef struct GDKtracer {
 gdk_export char *GDKtracer_get_timestamp(const char *fmt, char *buf, size_t 
sz);
 
 
+// Used for logrotate
+gdk_export void GDKtracer_reinit_basic(int sig);
+
+
 gdk_export gdk_return GDKtracer_stop(void);
 
 
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -733,6 +733,9 @@ main(int argc, char **av)
free(err);
}
 
+   // Register signal to GDKtracer (logrotate)
+   signal(SIGHUP, GDKtracer_reinit_basic);
+
 #ifdef _MSC_VER
printf("# MonetDB server is started. To stop server press Ctrl-C.\n");
 #endif
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Minor fixes in spelling

2020-02-18 Thread Thodoris Zois
Changeset: 9e42de913bd1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9e42de913bd1
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
sql/scripts/81_tracer.sql
Branch: default
Log Message:

Minor fixes in spelling


diffs (44 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -445,7 +445,7 @@ GDKtracer_flush_buffer(void)
 
 
 gdk_return
-GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_Level)
+GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level)
 {
for (int i = 0; i < COMPONENTS_COUNT; i++) {
if (BUNappend(id, , false) != GDK_SUCCEED)
@@ -454,7 +454,7 @@ GDKtracer_fill_comp_info(BAT *id, BAT *c
if (BUNappend(component, COMPONENT_STR[i], false) != 
GDK_SUCCEED)
return GDK_FAIL;
 
-   if (BUNappend(log_Level, LEVEL_STR[LVL_PER_COMPONENT[i]], 
false) != GDK_SUCCEED) 
+   if (BUNappend(log_level, LEVEL_STR[LVL_PER_COMPONENT[i]], 
false) != GDK_SUCCEED) 
return GDK_FAIL;
}
 
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -368,6 +368,6 @@ gdk_export gdk_return GDKtracer_log(LOG_
 gdk_export gdk_return GDKtracer_flush_buffer(void);
 
 
-gdk_export gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT 
*log_Level);
+gdk_export gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT 
*log_level);
 
 #endif /* _GDK_TRACER_H_ */
diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql
--- a/sql/scripts/81_tracer.sql
+++ b/sql/scripts/81_tracer.sql
@@ -43,7 +43,7 @@ CREATE PROCEDURE logging.resetadapter()
EXTERNAL NAME logging.resetadapter;
 
 -- Returns in the form of a SQL result-set all the 
--- components along with their ID the their current 
+-- components along with their ID and their current 
 -- logging level being set
 CREATE FUNCTION logging.compinfo()
 RETURNS TABLE(
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Added option for setting the output directory...

2020-02-18 Thread Thodoris Zois
Changeset: d96cd1ea02c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d96cd1ea02c3
Modified Files:
ChangeLog
gdk/gdk_tracer.c
gdk/gdk_tracer.h
tools/merovingian/ChangeLog
tools/merovingian/daemon/forkmserver.c
tools/merovingian/utils/properties.c
tools/mserver/mserver5.c
Branch: default
Log Message:

Added option for setting the output directory for the produced tracefiles 
(mserver5 and merovingian)


diffs (212 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Tue Feb 18 2020 Thodoris Zois 
+- Added mserver5 option (--dbtrace=) in order to be able to
+  specify the output directory of the produced traces.
+
 * Thu Feb  6 2020 Panagiotis Koutsourakis 
 - Add port and host as fields in the .monetdb file.
 
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -34,20 +34,25 @@ LOG_LEVEL LVL_PER_COMPONENT[] = {
 static gdk_return
 _GDKtracer_init_basic_adptr(void)
 {
-   char file_name[FILENAME_MAX];
-   snprintf(file_name, sizeof(file_name), "%s%c%s%c%s%s", 
GDKgetenv("gdk_dbpath"), DIR_SEP, FILE_NAME, NAME_SEP, 
GDKtracer_get_timestamp("%Y%m%d_%H%M%S", (char[20]){0}, 20), ".log");
+   char file_name[FILENAME_MAX];   
+   const char* TRACE_PATH = GDKgetenv("gdk_dbpath");
 
-   output_file = fopen(file_name, "w");
+   if(GDKgetenv("gdk_dbtrace") != NULL)
+   TRACE_PATH = GDKgetenv("gdk_dbtrace");
+
+   snprintf(file_name, sizeof(file_name), "%s%c%s", TRACE_PATH, DIR_SEP, 
FILE_NAME);
+   output_file = fopen(file_name, "a");
 
// Even if creating the file failed, the adapter has 
// still tried to initialize and we shouldn't retry it
INIT_BASIC_ADAPTER = true;
-
-   if (!output_file) {
+   
+   if(!output_file)
+   {
GDK_TRACER_EXCEPTION(BASIC_INIT_FAILED ": %s\n", file_name);
return GDK_FAIL;
}
-
+   
return GDK_SUCCEED;
 }
 
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -38,7 +38,7 @@
 #define DEFAULT_LOG_LEVEL M_ERROR
 #define DEFAULT_FLUSH_LEVEL M_INFO
 
-#define FILE_NAME "trace"
+#define FILE_NAME "mdbtrace.log"
 #define NAME_SEP '_'
 #define NULL_CHAR '\0'
 #define NEW_LINE '\n'
diff --git a/tools/merovingian/ChangeLog b/tools/merovingian/ChangeLog
--- a/tools/merovingian/ChangeLog
+++ b/tools/merovingian/ChangeLog
@@ -1,3 +1,7 @@
 # ChangeLog file for sql/src/backends/monet5/merovingian
 # This file is updated with mchangelog
 
+* Tue Feb 18 2020 Thodoris Zois 
+- Added dbtrace mserver5 option to the daemon in order to set
+  mserver5's output directory for the produced traces.
+
diff --git a/tools/merovingian/daemon/forkmserver.c 
b/tools/merovingian/daemon/forkmserver.c
--- a/tools/merovingian/daemon/forkmserver.c
+++ b/tools/merovingian/daemon/forkmserver.c
@@ -201,6 +201,7 @@ forkMserver(char *database, sabdb** stat
char *sabdbfarm;
char dbpath[1024];
char dbextra_path[1024];
+   char dbtrace_path[1024];
char port[32];
char listenaddr[512];
char muri[512]; /* possibly undersized */
@@ -218,6 +219,7 @@ forkMserver(char *database, sabdb** stat
char *raw_strings = NULL;
char *ipv6 = NULL;
char *dbextra = NULL;
+   char *dbtrace = NULL;
char *mserver5_extra = NULL;
char *mserver5_extra_token = NULL;
char *argv[MAX_NR_ARGS+1];  /* for the exec arguments */
@@ -522,6 +524,10 @@ forkMserver(char *database, sabdb** stat
dbextra = kv->val;
}
 
+   kv = findConfKey(ckv, "dbtrace");
+   if (kv != NULL && kv->val != NULL)
+   dbtrace = kv->val;
+
kv = findConfKey(ckv, "listenaddr");
if (kv->val != NULL) {
if (mydoproxy) {
@@ -561,6 +567,13 @@ forkMserver(char *database, sabdb** stat
 "--dbextra=%s", dbextra);
argv[c++] = dbextra_path;
}
+
+   if (dbtrace != NULL) {
+   snprintf(dbtrace_path, sizeof(dbtrace_path),
+"--dbtrace=%s", dbtrace);
+   argv[c++] = dbtrace_path;
+   }
+   
if (mydoproxy) {
argv[c++] = set; argv[c++] = "mapi_open=false";
/* we "proxy", so we can just solely use UNIX domain sockets
diff --git a/tools/merovingian/utils/properties.c 
b/tools/merovingian/utils/properties.c
--- a/tools/merovingian/utils/properties.c
+++ b/tools/merovingian/utils/properties.c
@@ -39,6 +39,7 @@ static const confkeyval _internal_prop_k

MonetDB: hitchhiker - Merge with default

2020-02-14 Thread Thodoris Zois
Changeset: 3fb9882bdda8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fb9882bdda8
Added Files:
sql/test/BugTracker-2020/Tests/alter-table-add-column.Bug-6816.py

sql/test/BugTracker-2020/Tests/alter-table-add-column.Bug-6816.stable.err

sql/test/BugTracker-2020/Tests/alter-table-add-column.Bug-6816.stable.out
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.out
sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.sql

sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.err

sql/test/BugTracker-2020/Tests/select-where-in-rtrim-crash.Bug-6818.stable.out
sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql
sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.err
sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.stable.out
sql/test/subquery/Tests/subquery4.sql
sql/test/subquery/Tests/subquery4.stable.err
sql/test/subquery/Tests/subquery4.stable.out
Removed Files:
sql/benchmarks/xmark-sql/Q1.sql
sql/benchmarks/xmark-sql/Q10.sql
sql/benchmarks/xmark-sql/Q11.sql
sql/benchmarks/xmark-sql/Q12.sql
sql/benchmarks/xmark-sql/Q15.sql
sql/benchmarks/xmark-sql/Q16.sql
sql/benchmarks/xmark-sql/Q17.sql
sql/benchmarks/xmark-sql/Q19.sql
sql/benchmarks/xmark-sql/Q2.sql
sql/benchmarks/xmark-sql/Q20.sql
sql/benchmarks/xmark-sql/Q3.sql
sql/benchmarks/xmark-sql/Q4.sql
sql/benchmarks/xmark-sql/Q5.sql
sql/benchmarks/xmark-sql/Q6.sql
sql/benchmarks/xmark-sql/Q7.sql
sql/benchmarks/xmark-sql/Q8.sql
sql/benchmarks/xmark-sql/Q9.sql
sql/benchmarks/xmark-sql/load.sql
sql/benchmarks/xmark-sql/schema.sql
sql/benchmarks/xmark/load.sh
sql/benchmarks/xmark/schema.sql
sql/benchmarks/xmark/unix.c
sql/benchmarks/xmark/xml.sql
sql/benchmarks/xmark/xml1.sql
sql/benchmarks/xmark/xml10.sql
sql/benchmarks/xmark/xml11.sql
sql/benchmarks/xmark/xml12.sql
sql/benchmarks/xmark/xml15.sql
sql/benchmarks/xmark/xml16.sql
sql/benchmarks/xmark/xml17.sql
sql/benchmarks/xmark/xml19.sql
sql/benchmarks/xmark/xml2.sql
sql/benchmarks/xmark/xml20.sql
sql/benchmarks/xmark/xml3.sql
sql/benchmarks/xmark/xml4.sql
sql/benchmarks/xmark/xml5.sql
sql/benchmarks/xmark/xml6.sql
sql/benchmarks/xmark/xml7.sql
sql/benchmarks/xmark/xml8.sql
sql/benchmarks/xmark/xml9.sql
sql/test/BugTracker-2020/Tests/alter-table-add-column-Bug-6816.py

sql/test/BugTracker-2020/Tests/alter-table-add-column-Bug-6816.stable.err

sql/test/BugTracker-2020/Tests/alter-table-add-column-Bug-6816.stable.out
Modified Files:
.hgtags
MonetDB.spec
NT/monetdb_config.h.in
NT/rules.msc
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
clients/mapiclient/mclient.c
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
common/utils/msabaoth.c
common/utils/mstring.h
configure.ag
debian/changelog
gdk/ChangeLog
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_calc_private.h
gdk/gdk_cand.c
gdk/gdk_private.h
gdk/gdk_system_private.h
gdk/gdk_tracer.c
gdk/gdk_tracer.h
gdk/libbat.rc
libversions
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_private.h
monetdb5/modules/mal/tracer.mal
monetdb5/modules/mal/wlc.c
monetdb5/tools/libmonetdb5.rc
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_statistics.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/wlr.c
sql/common/sql_types.c
sql/common/sql_types.h
sql/jdbc/tests/Tests/Bug_PrepStmtSetString_6382.SQL.bat
sql/jdbc/tests/Tests/Bug_PrepStmtSetString_6382.SQL.sh
sql/jdbc/tests/Tests/Test_CallableStmt.SQL.bat
sql/jdbc/tests/Tests/Test_CallableStmt.SQL.sh
sql/jdbc/tests/Tests/Test_Dobjects.SQL.sh
sql/jdbc/tests/Tests/Test_JdbcClient.stable.err
sql/jdbc/tests/Tests/Test_JdbcClient.stable.out
sql/rel.txt
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_psm.c
sql/server/rel_select.c

MonetDB: hitchhiker - Added opt_hitchhiker to opt_wrapper

2020-02-12 Thread Thodoris Zois
Changeset: 66b57dfecf18 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=66b57dfecf18
Modified Files:
monetdb5/optimizer/opt_hitchhiker.c
monetdb5/optimizer/opt_wrapper.c
Branch: hitchhiker
Log Message:

Added opt_hitchhiker to opt_wrapper


diffs (30 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -20,4 +20,4 @@ OPThitchhikerImplementation(Client cntxt
 
 str msg = MAL_SUCCEED;
 return msg;
-}
\ No newline at end of file
+}
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -51,6 +51,8 @@
 #include "opt_reorder.h"
 #include "opt_volcano.h"
 #include "opt_wlc.h"
+#include "opt_hitchhiker.h"
+
 
 struct{
str nme;
@@ -89,6 +91,7 @@ struct{
{"reorder", ,0,0},
{"volcano", ,0,0},
{"wlc", ,0,0},
+   {"hitchhiker", ,0,0},
{0,0,0,0}
 };
 mal_export str OPTwrapper(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Added opt hitchhiker

2020-02-12 Thread Thodoris Zois
Changeset: cf655cd30e7e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf655cd30e7e
Modified Files:
monetdb5/optimizer/Makefile.ag
monetdb5/optimizer/opt_hitchhiker.c
monetdb5/optimizer/opt_hitchhiker.h
monetdb5/optimizer/optimizer.mal
Branch: hitchhiker
Log Message:

Added opt hitchhiker


diffs (77 lines):

diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag
--- a/monetdb5/optimizer/Makefile.ag
+++ b/monetdb5/optimizer/Makefile.ag
@@ -52,7 +52,8 @@ lib_optimizer = {
opt_profiler.c opt_profiler.h \
opt_postfix.c opt_postfix.h \
opt_volcano.c opt_volcano.h \
-   opt_wrapper.c
+   opt_wrapper.c \
+   opt_hitchhiker.c opt_hitchhiker.h
 }
 
 headers_mal = {
diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
--- a/monetdb5/optimizer/opt_hitchhiker.c
+++ b/monetdb5/optimizer/opt_hitchhiker.c
@@ -0,0 +1,23 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#include "monetdb_config.h"
+#include "opt_hitchhiker.h"
+#include "mal_interpreter.h"
+
+str
+OPThitchhikerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
+{
+(void) cntxt;
+(void) mb;
+(void) stk;
+(void) pci;
+
+str msg = MAL_SUCCEED;
+return msg;
+}
\ No newline at end of file
diff --git a/monetdb5/optimizer/opt_hitchhiker.h 
b/monetdb5/optimizer/opt_hitchhiker.h
--- a/monetdb5/optimizer/opt_hitchhiker.h
+++ b/monetdb5/optimizer/opt_hitchhiker.h
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#ifndef _OPT_HITCHHIKER_
+#define _OPT_HITCHHIKER_
+
+#include "opt_prelude.h"
+
+mal_export str OPThitchhikerImplementation(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr p);
+
+#endif
diff --git a/monetdb5/optimizer/optimizer.mal b/monetdb5/optimizer/optimizer.mal
--- a/monetdb5/optimizer/optimizer.mal
+++ b/monetdb5/optimizer/optimizer.mal
@@ -285,5 +285,12 @@ pattern optimizer.postfix(mod:str, fcn:s
 address OPTwrapper
 comment "Postfix the plan,e.g. pushing projections";
 
+#opt_hitchhiker.mal
+pattern optimizer.hitchhiker():str
+address OPTwrapper;
+pattern optimizer.hitchhiker(mod:any_1, fcn:any_2):str
+address OPTwrapper
+comment "Hitchhiker optimizer: nomadic query evaluation";
+
 optimizer.prelude();
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: hitchhiker - Initial commit

2020-02-12 Thread Thodoris Zois
Changeset: ad1d89348ca0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ad1d89348ca0
Added Files:
monetdb5/optimizer/opt_hitchhiker.c
monetdb5/optimizer/opt_hitchhiker.h
Branch: hitchhiker
Log Message:

Initial commit


diffs (4 lines):

diff --git a/monetdb5/optimizer/opt_hitchhiker.c 
b/monetdb5/optimizer/opt_hitchhiker.c
new file mode 100644
diff --git a/monetdb5/optimizer/opt_hitchhiker.h 
b/monetdb5/optimizer/opt_hitchhiker.h
new file mode 100644
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Align code

2020-02-07 Thread Thodoris Zois
Changeset: ed6f6ba12a3d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed6f6ba12a3d
Modified Files:
monetdb5/modules/mal/tracer.c
Branch: default
Log Message:

Align code


diffs (44 lines):

diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -120,21 +120,21 @@ TRACERcomp_info(Client cntxt, MalBlkPtr 
 (void) mb;
 
 BAT *id, *component, *log_level;
-   bat *i = getArgReference_bat(stk, pci, 0);
-   bat *c = getArgReference_bat(stk, pci, 1);
-   bat *l = getArgReference_bat(stk, pci, 2);
+bat *i = getArgReference_bat(stk, pci, 0);
+bat *c = getArgReference_bat(stk, pci, 1);
+bat *l = getArgReference_bat(stk, pci, 2);
 str msg = MAL_SUCCEED;
 
 id = COLnew(0, TYPE_int, MAL_MAXCLIENTS, TRANSIENT);
-   component = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
-   log_level = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
+component = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
+log_level = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
 
 if ( id == NULL || component == NULL || log_level == NULL )
 {
 BBPreclaim(id);
-   BBPreclaim(component);
-   BBPreclaim(log_level);
-   throw(MAL, __FUNCTION__, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+BBPreclaim(component);
+BBPreclaim(log_level);
+throw(MAL, __FUNCTION__, SQLSTATE(HY013) MAL_MALLOC_FAIL);
 }
 
 // Fill the BATs
@@ -144,8 +144,8 @@ TRACERcomp_info(Client cntxt, MalBlkPtr 
 MT_lock_unset(_delayLock);
 
 BBPkeepref(*i = id->batCacheid);
-   BBPkeepref(*c = component->batCacheid);
-   BBPkeepref(*l = log_level->batCacheid);
+BBPkeepref(*c = component->batCacheid);
+BBPkeepref(*l = log_level->batCacheid);
 return MAL_SUCCEED;
 
 bailout:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Added new line to file

2020-02-07 Thread Thodoris Zois
Changeset: b743c3a9b436 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b743c3a9b436
Modified Files:
sql/scripts/81_tracer.sql
Branch: default
Log Message:

Added new line to file


diffs (10 lines):

diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql
--- a/sql/scripts/81_tracer.sql
+++ b/sql/scripts/81_tracer.sql
@@ -55,4 +55,4 @@ EXTERNAL NAME logging.compinfo;
 GRANT EXECUTE ON FUNCTION logging.compinfo TO public;
 
 CREATE view logging.compinfo AS SELECT * FROM logging.compinfo();
-GRANT SELECT ON logging.compinfo TO public;
\ No newline at end of file
+GRANT SELECT ON logging.compinfo TO public;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Return log_level per component as a SQL table

2020-02-07 Thread Thodoris Zois
Changeset: 5f5c9461bb90 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f5c9461bb90
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
sql/scripts/81_tracer.sql
Branch: default
Log Message:

Return log_level per component as a SQL table


diffs (132 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -441,9 +441,18 @@ GDKtracer_flush_buffer(void)
 
 
 gdk_return
-GDKtracer_show_comp_info(void)
+GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_Level)
 {
-   // "# (%d)  %s %*s\n", i, COMPONENT_STR[i], 1, 
LEVEL_STR[LVL_PER_COMPONENT[i]];
+   for (int i = 0; i < COMPONENTS_COUNT; i++) {
+   if (BUNappend(id, , false) != GDK_SUCCEED)
+   return GDK_FAIL;
+
+   if (BUNappend(component, COMPONENT_STR[i], false) != 
GDK_SUCCEED)
+   return GDK_FAIL;
+
+   if (BUNappend(log_Level, LEVEL_STR[LVL_PER_COMPONENT[i]], 
false) != GDK_SUCCEED) 
+   return GDK_FAIL;
+   }
 
return GDK_SUCCEED;
 }
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -368,6 +368,6 @@ gdk_export gdk_return GDKtracer_log(LOG_
 gdk_export gdk_return GDKtracer_flush_buffer(void);
 
 
-gdk_export gdk_return GDKtracer_show_comp_info(void);
+gdk_export gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT 
*log_Level);
 
 #endif /* _GDK_TRACER_H_ */
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -114,9 +114,44 @@ TRACERreset_adapter(void *ret)
 
 
 str
-TRACERshow_comp_info(void *ret)
+TRACERcomp_info(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-(void) ret;
-GDKtracer_show_comp_info();
+(void) cntxt;
+(void) mb;
+
+BAT *id, *component, *log_level;
+   bat *i = getArgReference_bat(stk, pci, 0);
+   bat *c = getArgReference_bat(stk, pci, 1);
+   bat *l = getArgReference_bat(stk, pci, 2);
+str msg = MAL_SUCCEED;
+
+id = COLnew(0, TYPE_int, MAL_MAXCLIENTS, TRANSIENT);
+   component = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
+   log_level = COLnew(0, TYPE_str, MAL_MAXCLIENTS, TRANSIENT);
+
+if ( id == NULL || component == NULL || log_level == NULL )
+{
+BBPreclaim(id);
+   BBPreclaim(component);
+   BBPreclaim(log_level);
+   throw(MAL, __FUNCTION__, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+}
+
+// Fill the BATs
+MT_lock_set(_delayLock);
+if(GDKtracer_fill_comp_info(id, component, log_level) == GDK_FAIL)
+goto bailout;
+MT_lock_unset(_delayLock);
+
+BBPkeepref(*i = id->batCacheid);
+   BBPkeepref(*c = component->batCacheid);
+   BBPkeepref(*l = log_level->batCacheid);
 return MAL_SUCCEED;
+
+bailout:
+MT_lock_unset(_delayLock);
+BBPunfix(id->batCacheid);
+BBPunfix(component->batCacheid);
+BBPunfix(log_level->batCacheid);
+return msg ? msg : createException(MAL, __FUNCTION__, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
 }
diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h
--- a/monetdb5/modules/mal/tracer.h
+++ b/monetdb5/modules/mal/tracer.h
@@ -25,7 +25,7 @@ mal_export str TRACERset_flush_level(voi
 mal_export str TRACERreset_flush_level(void *ret);
 mal_export str TRACERset_adapter(void *ret, int *adapter_id);
 mal_export str TRACERreset_adapter(void *ret);
-mal_export str TRACERshow_comp_info(void *ret);
+mal_export str TRACERcomp_info(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 
 
 #endif /* _TRACER_H */
diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -42,7 +42,7 @@ command resetadapter() :void
 address TRACERreset_adapter
 comment "Resets the adapter back to the default";
 
-command showcompinfo() :void
-address TRACERshow_comp_info
+pattern compinfo()(id:bat[:int], component:bat[:str], log_level:bat[:str])
+address TRACERcomp_info;
 comment "Returns in the form of a SQL result-set all the components along with 
their ID
 and the their current logging level being set";
diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql
--- a/sql/scripts/81_tracer.sql
+++ b/sql/scripts/81_tracer.sql
@@ -45,5 +45,14 @@ CREATE PROCEDURE logging.resetadapter()
 -- Returns in the form of a SQL result-set all the 
 -- components along with their ID the their current 
 -- logging level being set
-CREATE PROCEDURE logging.showcompinfo()
-   EXTERNAL NAME logging.showcompinfo;
+CREATE FUNCTION logging.compinfo()
+RETURNS TABLE(
+   "id" int,
+   "component" string,
+   "log_level" string
+)
+EXTERNAL 

MonetDB: default - Changed function call in test tracer00

2020-02-07 Thread Thodoris Zois
Changeset: 746cb8176b11 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=746cb8176b11
Modified Files:
monetdb5/mal/Tests/tracer00.malC
Branch: default
Log Message:

Changed function call in test tracer00


diffs (11 lines):

diff --git a/monetdb5/mal/Tests/tracer00.malC b/monetdb5/mal/Tests/tracer00.malC
--- a/monetdb5/mal/Tests/tracer00.malC
+++ b/monetdb5/mal/Tests/tracer00.malC
@@ -75,5 +75,5 @@ logging.resetadapter();
 
 
 
-# Show log levels etc
-logging.showinfo();
+# Show the log level of each component
+logging.showcompinfo();
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Disabled function logging.showinfo() && repor...

2020-02-07 Thread Thodoris Zois
Changeset: 9acdf458f9b4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9acdf458f9b4
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
sql/scripts/81_tracer.sql
sql/storage/store.c
Branch: default
Log Message:

Disabled function logging.showinfo() && report message in case GDKtracer fails 
to write logs for whatever reason


diffs (263 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -16,22 +16,13 @@ static gdk_tracer *active_tracer = 
 MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer_1");
 
 static FILE *output_file;
-static bool USE_STREAM = true;
+static ATOMIC_TYPE CUR_ADAPTER = ATOMIC_VAR_INIT(DEFAULT_ADAPTER);
 static bool INIT_BASIC_ADAPTER = false;
-
-static ATOMIC_TYPE CUR_ADAPTER = ATOMIC_VAR_INIT(DEFAULT_ADAPTER);
+static bool LOG_EXC_REP = false;
 
 static LOG_LEVEL CUR_FLUSH_LEVEL = DEFAULT_FLUSH_LEVEL;
 static bool GDK_TRACER_STOP = false;
 
-static const char *LAYER_STR[] = {
-   FOREACH_LAYER(GENERATE_STRING)
-};
-
-static const char *ADAPTER_STR[] = {
-   FOREACH_ADPTR(GENERATE_STRING)
-};
-
 LOG_LEVEL LVL_PER_COMPONENT[] = {
FOREACH_COMP(GENERATE_LOG_LEVEL)
 };
@@ -47,10 +38,13 @@ static gdk_return
snprintf(file_name, sizeof(file_name), "%s%c%s%c%s%s", 
GDKgetenv("gdk_dbpath"), DIR_SEP, FILE_NAME, NAME_SEP, 
GDKtracer_get_timestamp("%Y%m%d_%H%M%S"), ".log");
 
output_file = fopen(file_name, "w");
+
+   // Even if creating the file failed, the adapter has 
+   // still tried to initialize and we shouldn't retry it
INIT_BASIC_ADAPTER = true;
 
if (!output_file) {
-   GDK_TRACER_EXCEPTION("Failed to initialize BASIC adapter. Could 
not open file: %s\n", file_name);
+   GDK_TRACER_EXCEPTION(BASIC_INIT_FAILED ": %s\n", file_name);
return GDK_FAIL;
}
 
@@ -356,22 +350,22 @@ GDKtracer_log(LOG_LEVEL level, const cha
MT_lock_unset();
 
// Failed to write to the buffer - 
bytes_written < 0
-   // Fallback logging mechanism
-   va_list va;
-   va_start(va, fmt);
-   GDK_TRACER_OSTREAM(fmt, va);
-   va_end(va);
+   if(!LOG_EXC_REP)
+   {
+   GDK_TRACER_EXCEPTION(GDKTRACER_FAILED 
"\n");
+   LOG_EXC_REP = true;
+   }
}
}
} else {
MT_lock_unset();
 
// Failed to write to the buffer - bytes_written < 0
-   // Fallback logging mechanism
-   va_list va;
-   va_start(va, fmt);
-   GDK_TRACER_OSTREAM(fmt, va);
-   va_end(va);
+   if(!LOG_EXC_REP)
+   {
+   GDK_TRACER_EXCEPTION(GDKTRACER_FAILED "\n");
+   LOG_EXC_REP = true;
+   }
}
 
// Flush the current buffer in case the event is
@@ -411,15 +405,16 @@ GDKtracer_flush_buffer(void)
size_t nitems = 1;
size_t w = fwrite(_tracer->buffer, 
active_tracer->allocated_size, nitems, output_file);
 
-   if (w == nitems) {
-   USE_STREAM = false;
+   if (w == nitems)
fflush(output_file);
-   }
+   else
+   // fwrite failed for whatever reason 
(e.g: disk is full)
+   if(!LOG_EXC_REP)
+   {
+   
GDK_TRACER_EXCEPTION(GDKTRACER_FAILED "\n");
+   LOG_EXC_REP = true;
+   }
}
-   // fwrite failed for whatever reason
-   // (e.g: disk is full) fallback to stream
-   if (USE_STREAM)
-   GDK_TRACER_OSTREAM("%s", active_tracer->buffer);
 
// Reset buffer
memset(active_tracer->buffer, 0, BUFFER_SIZE);
@@ -432,7 +427,7 @@ GDKtracer_flush_buffer(void)
active_tracer->allocated_size = 0;
MT_lock_unset();
 
-   GDK_TRACER_OSTREAM("Using adapter: %s\n", ADAPTER_STR[(int) 
ATOMIC_GET(_ADAPTER)]);
+   // Here we are supposed to send the logs to the profiler
}
 
// The file is 

MonetDB: default - Report exceptions of GDKtracerAPI to mclient ...

2020-02-07 Thread Thodoris Zois
Changeset: b8297fb15909 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8297fb15909
Modified Files:
monetdb5/modules/mal/tracer.c
Branch: default
Log Message:

Report exceptions of GDKtracerAPI to mclient and GDKtracer at the same time


diffs (75 lines):

diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -30,7 +30,7 @@ TRACERset_component_level(void *ret, int
 {
 (void) ret;
 if (GDKtracer_set_component_level(*comp_id, *lvl_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED; 
 }
@@ -41,7 +41,7 @@ TRACERreset_component_level(void *ret, i
 {
 (void) ret;
 if (GDKtracer_reset_component_level(*comp_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " _OPERATION_FAILED"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED;
 }
@@ -52,7 +52,7 @@ TRACERset_layer_level(void *ret, int *la
 {
 (void) ret;
 if (GDKtracer_set_layer_level(*layer_id, *lvl_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED; 
 }
@@ -63,7 +63,7 @@ TRACERreset_layer_level(void *ret, int *
 {
 (void) ret;
 if (GDKtracer_reset_layer_level(*layer_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " _OPERATION_FAILED"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED;
 }
@@ -74,7 +74,7 @@ TRACERset_flush_level(void *ret, int *lv
 {
 (void) ret;
 if (GDKtracer_set_flush_level(*lvl_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED;
 }
@@ -85,7 +85,7 @@ TRACERreset_flush_level(void *ret)
 {
 (void) ret;
 if (GDKtracer_reset_flush_level() != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " _OPERATION_FAILED"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, _OPERATION_FAILED"\n");
 
 return MAL_SUCCEED;
 }
@@ -96,7 +96,7 @@ TRACERset_adapter(void *ret, int *adapte
 {
 (void) ret;
 if (GDKtracer_set_adapter(*adapter_id) != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, ILLEGAL_ARGUMENT"\n");
 
 return MAL_SUCCEED;
 }
@@ -107,7 +107,7 @@ TRACERreset_adapter(void *ret)
 {
 (void) ret;
 if (GDKtracer_reset_adapter() != GDK_SUCCEED)
-GDK_TRACER_EXCEPTION("[%s] " _OPERATION_FAILED"\n", __FUNCTION__);
+throw(MAL, __FUNCTION__, _OPERATION_FAILED"\n");
 
 return MAL_SUCCEED;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Thread-safe get_timestamp fix

2020-02-05 Thread Thodoris Zois
Changeset: 3390346e30d5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3390346e30d5
Modified Files:
gdk/gdk_tracer.c
Branch: default
Log Message:

Thread-safe get_timestamp fix


diffs (26 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -182,19 +182,17 @@ static gdk_return
 char *
 GDKtracer_get_timestamp(const char *fmt)
 {
-   MT_lock_set();
-
static char datetime[20];
time_t now = time(NULL);
struct tm tmp;
#ifdef HAVE_LOCALTIME_R
(void) localtime_r(, );
#else
+   MT_lock_set();
tmp = *localtime();
+   MT_lock_unset();
#endif
-   strftime(datetime, sizeof(datetime), fmt, );
-
-   MT_lock_unset();
+   strftime(datetime, sizeof(datetime), fmt, );
 
return datetime;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Modified tracer00.malc - removed cases relate...

2020-02-05 Thread Thodoris Zois
Changeset: 172ccd887626 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=172ccd887626
Modified Files:
monetdb5/mal/Tests/tracer00.malC
Branch: default
Log Message:

Modified tracer00.malc - removed cases related to enum count


diffs (100 lines):

diff --git a/monetdb5/mal/Tests/tracer00.malC b/monetdb5/mal/Tests/tracer00.malC
--- a/monetdb5/mal/Tests/tracer00.malC
+++ b/monetdb5/mal/Tests/tracer00.malC
@@ -4,12 +4,6 @@
 #
 # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
 #
-# Test SQL API for TRACER:
-# In some test cases (marked with #WARNING) the argument used is supposed to 
be 
-# an enum entry used to count the number of elements (e.g: COMPONENTS_COUNT in 
-# gdk_tracer.h). Thus, in those cases an error should be raised. However, 
adding 
-# or removing entries will affect the marked test cases and they won't fail.
-
 
 # logging.setcomplevel(...)
 logging.setcomplevel(-1, 1);# Should raise an error
@@ -22,19 +16,6 @@ logging.setcomplevel(-10, -1);  # Should
 # Component -10 does not exist
 # Log level -1 does not exist
 
-# WARNING
-logging.setcomplevel(1, 5); # Should raise an error
-# The last level is used for enum count
-
-# WARNING
-logging.setcomplevel(89, 3);# Should raise an error
-# The last component is used for enum count
-
-# WARNING
-logging.setcomplevel(89, 5);# Should raise an error
-# The last component is used for enum count
-# The last level is used for enum count
-
 logging.setcomplevel(1, 4); # OK
 
 
@@ -43,10 +24,6 @@ logging.setcomplevel(1, 4); # OK
 logging.resetcomplevel(-1); # Should raise an error
 # Component -1 does not exist
 
-# WARNING
-logging.resetcomplevel(89); # Should raise an error
-# The last component is used for enum count
-
 logging.resetcomplevel(1);  # OK
 
 
@@ -62,19 +39,6 @@ logging.setlayerlevel(-10, -1); # Should
 # Layer -10 does not exist
 # Log level -1 does not exist
 
-# WARNING
-logging.setlayerlevel(4, 2);# Should raise an error
-# The last layer is used for enum count
-
-# WARNING
-logging.setlayerlevel(1, 5);# Should raise an error
-# The last level is used for enum count
-
-# WARNING
-logging.setlayerlevel(4, 5);# Should raise an error
-# The last layer is used for enum count
-# The last level is used for enum count
-
 logging.setlayerlevel(1, 2);# OK
 
 
@@ -83,10 +47,6 @@ logging.setlayerlevel(1, 2);# OK
 logging.resetlayerlevel(-1);# Should raise an error
 # Layer -1 does not exist
 
-# WARNING
-logging.resetlayerlevel(4); # Should raise an error
-# The last layer is used for enum count   
-
 logging.resetlayerlevel(1); # OK
 
 
@@ -95,10 +55,6 @@ logging.resetlayerlevel(1); # OK
 logging.setflushlevel(-1); # Should raise an error
# Level -1 does not exist
 
-# WARNING
-logging.setflushlevel(5);  # Should raise an error
-   # The last level is used for enum count
-
 logging.setflushlevel(3);  # OK
 
 
@@ -111,10 +67,6 @@ logging.resetflushlevel();
 logging.setadapter(-1);# Should raise an error
# Adapter -1 does not exist
 
-# WARNING
-logging.setadapter(2); # Should raise an error
-   # The last adapter is used for enum count
-
 logging.setadapter(1); # OK
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Thread-safe get_timestamp()

2020-02-05 Thread Thodoris Zois
Changeset: 3acb71ec09c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3acb71ec09c9
Modified Files:
gdk/gdk_tracer.c
Branch: default
Log Message:

Thread-safe get_timestamp()


diffs (30 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -182,15 +182,20 @@ static gdk_return
 char *
 GDKtracer_get_timestamp(const char *fmt)
 {
+   MT_lock_set();
+
static char datetime[20];
time_t now = time(NULL);
struct tm tmp;
-#ifdef HAVE_LOCALTIME_R
-   (void) localtime_r(, );
-#else
-   tmp = *localtime();
-#endif
-   strftime(datetime, sizeof(datetime), fmt, );
+   #ifdef HAVE_LOCALTIME_R
+   (void) localtime_r(, );
+   #else
+   tmp = *localtime();
+   #endif
+   strftime(datetime, sizeof(datetime), fmt, );
+
+   MT_lock_unset();
+
return datetime;
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Fixed empty GDKtracer files and changed dump_...

2020-02-05 Thread Thodoris Zois
Changeset: 887c3d30382f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=887c3d30382f
Modified Files:
gdk/gdk_system.c
gdk/gdk_tracer.c
gdk/gdk_tracer.h
gdk/gdk_utils.c
Branch: default
Log Message:

Fixed empty GDKtracer files and changed dump_threads in gdk_system.c


diffs (truncated from 445 to 300 lines):

diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -192,18 +192,21 @@ static DWORD threadslot = TLS_OUT_OF_IND
 void
 dump_threads(void)
 {
-   EnterCriticalSection(_cs);
-   for (struct winthread *w = winthreads; w; w = w->next) {
-   TRC_DEBUG(THRD, "%s, waiting for %s, working on %.200s\n",
-   w->threadname,
-   w->lockwait ? w->lockwait->name 
:
-   w->semawait ? w->semawait->name 
:
-   w->joinwait ? 
w->joinwait->threadname :
-   "nothing",
-   ATOMIC_GET(>exited) ? 
"exiting" :
-   w->working ? w->working : 
"nothing");
+   TRC_DEBUG_IF(THRD)
+   {
+   EnterCriticalSection(_cs);
+   for (struct winthread *w = winthreads; w; w = w->next) {
+   TRC_DEBUG_ENDIF(THRD, "%s, waiting for %s, working on 
%.200s\n",
+   w->threadname,
+   w->lockwait ? 
w->lockwait->name :
+   w->semawait ? 
w->semawait->name :
+   w->joinwait ? 
w->joinwait->threadname :
+   "nothing",
+   ATOMIC_GET(>exited) 
? "exiting" :
+   w->working ? w->working 
: "nothing");
+   }
+   LeaveCriticalSection(_cs);
}
-   LeaveCriticalSection(_cs);
 }
 
 bool
@@ -500,18 +503,21 @@ static pthread_key_t threadkey;
 void
 dump_threads(void)
 {
-   pthread_mutex_lock(_lock);
-   for (struct posthread *p = posthreads; p; p = p->next) {
-   TRC_DEBUG(THRD, "%s, waiting for %s, working on %.200s\n",
-   p->threadname,
-   p->lockwait ? p->lockwait->name 
:
-   p->semawait ? p->semawait->name 
:
-   p->joinwait ? 
p->joinwait->threadname :
-   "nothing",
-   ATOMIC_GET(>exited) ? 
"exiting" :
-   p->working ? p->working : 
"nothing");
+   TRC_DEBUG_IF(THRD)
+   {
+   pthread_mutex_lock(_lock);
+   for (struct posthread *p = posthreads; p; p = p->next) {
+   TRC_DEBUG_ENDIF(THRD, "%s, waiting for %s, working on 
%.200s\n",
+   p->threadname,
+   p->lockwait ? 
p->lockwait->name :
+   p->semawait ? 
p->semawait->name :
+   p->joinwait ? 
p->joinwait->threadname :
+   "nothing",
+   ATOMIC_GET(>exited) 
? "exiting" :
+   p->working ? p->working 
: "nothing");
+   }
+   pthread_mutex_unlock(_lock);
}
-   pthread_mutex_unlock(_lock);
 }
 
 bool
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -17,6 +17,7 @@ MT_Lock lock = MT_LOCK_INITIALIZER("GDKt
 
 static FILE *output_file;
 static bool USE_STREAM = true;
+static bool INIT_BASIC_ADAPTER = false;
 
 static ATOMIC_TYPE CUR_ADAPTER = ATOMIC_VAR_INIT(DEFAULT_ADAPTER);
 
@@ -46,6 +47,7 @@ static gdk_return
snprintf(file_name, sizeof(file_name), "%s%c%s%c%s%s", 
GDKgetenv("gdk_dbpath"), DIR_SEP, FILE_NAME, NAME_SEP, 
GDKtracer_get_timestamp("%Y%m%d_%H%M%S"), ".log");
 
output_file = fopen(file_name, "w");
+   INIT_BASIC_ADAPTER = true;
 
if (!output_file) {
GDK_TRACER_EXCEPTION("Failed to initialize BASIC adapter. Could 
not open file: %s\n", file_name);
@@ -194,13 +196,6 @@ GDKtracer_get_timestamp(const char *fmt)
 
 
 gdk_return
-GDKtracer_init(void)
-{
-   return _GDKtracer_init_basic_adptr();
-}
-
-
-gdk_return
 GDKtracer_stop(void)
 {
GDK_TRACER_STOP = true;

MonetDB: default - Removed decorations from logs && changed the ...

2020-02-05 Thread Thodoris Zois
Changeset: 4d050abcc91e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d050abcc91e
Modified Files:
gdk/gdk_tracer.h
monetdb5/optimizer/opt_commonTerms.c
Branch: default
Log Message:

Removed decorations from logs && changed the logging macro in opt_commonTerms


diffs (24 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -300,7 +300,7 @@ typedef struct GDKtracer {
 // Exception
 #define GDK_TRACER_EXCEPTION(MSG, ...) \
mnstr_printf(GDKstdout, \
-"[%s] "\
+"%s "  \
 "%-"MXW"s "\
 "%"MXW"s:%d "  \
 "%"MXW"s " \
diff --git a/monetdb5/optimizer/opt_commonTerms.c 
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -177,7 +177,7 @@ OPTcommonTermsImplementation(Client cntx
}
 
else if(isUpdateInstruction(p)){
-   TRC_DEBUG_ENDIF(MAL_OPTIMIZER, "Skipped: %d 
%d\n", mayhaveSideEffects(cntxt, mb, q, TRUE) , isUpdateInstruction(p));
+   TRC_DEBUG(MAL_OPTIMIZER, "Skipped: %d %d\n", 
mayhaveSideEffects(cntxt, mb, q, TRUE) , isUpdateInstruction(p));
traceInstruction(MAL_OPTIMIZER, mb, 0, q, 
LIST_MAL_ALL);
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Updates

2019-12-19 Thread Thodoris Zois
Changeset: fc4f04fec020 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc4f04fec020
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/server/sql_mvc.c
sql/server/sql_mvc.h
Branch: gdk_tracer
Log Message:

Updates


diffs (242 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -212,49 +212,42 @@ SQLepilogue(void *ret)
return MAL_SUCCEED;
 }
 
-#define SQLglobal(name, val, failure)  
   \
+#define SQLglobal(name, val) \
if (!stack_push_var(sql, name, ) || !stack_set_var(sql, name, 
VALset(, ctype.type->localtype, (char*)(val \
failure--;
 
-#define NR_GLOBAL_VARS 9
-/* NR_GLOBAL_VAR should match exactly the number of variables created
-   in global_variables */
+/* NR_GLOBAL_VAR should match exactly the number of variables created in 
global_variables */
 /* initialize the global variable, ie make mvc point to these */
 static int
 global_variables(mvc *sql, const char *user, const char *schema)
 {
sql_subtype ctype;
-   const char *typename;
lng sec = 0;
ValRecord src;
const char *opt;
int failure = 0;
 
-   typename = "int";
-   sql_find_subtype(, typename, 0, 0);
-   SQLglobal("debug", >debug, failure);
-   SQLglobal("cache", >cache, failure);
+   sql_find_subtype(, "int", 0, 0);
+   SQLglobal("debug", >debug);
+   SQLglobal("cache", >cache);
 
-   typename = "varchar";
-   sql_find_subtype(, typename, 1024, 0);
-   SQLglobal("current_schema", schema, failure);
-   SQLglobal("current_user", user, failure);
-   SQLglobal("current_role", user, failure);
+   sql_find_subtype(,  "varchar", 1024, 0);
+   SQLglobal("current_schema", schema);
+   SQLglobal("current_user", user);
+   SQLglobal("current_role", user);
 
/* inherit the optimizer from the server */
opt = GDKgetenv("sql_optimizer");
if (!opt)
opt = "default_pipe";
-   SQLglobal("optimizer", opt, failure);
+   SQLglobal("optimizer", opt);
 
-   typename = "sec_interval";
-   sql_find_subtype(, typename, inttype2digits(ihour, isec), 0);
-   SQLglobal("current_timezone", , failure);
+   sql_find_subtype(, "sec_interval", inttype2digits(ihour, isec), 
0);
+   SQLglobal("current_timezone", );
 
-   typename = "bigint";
-   sql_find_subtype(, typename, 0, 0);
-   SQLglobal("last_id", >last_id, failure);
-   SQLglobal("rowcnt", >rowcnt, failure);
+   sql_find_subtype(, "bigint", 0, 0);
+   SQLglobal("last_id", >last_id);
+   SQLglobal("rowcnt", >rowcnt);
return failure;
 }
 
@@ -303,7 +296,7 @@ SQLprepareClient(Client c, int login)
*/
if (m->session->tr->active)
return NULL;
-   if (mvc_reset(m, c->fdin, c->fdout, SQLdebug, NR_GLOBAL_VARS) < 
0)
+   if (mvc_reset(m, c->fdin, c->fdout, SQLdebug) < 0)
throw(SQL,"sql.initClient", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
backend_reset(be);
}
@@ -440,8 +433,6 @@ SQLinit(Client c)
}
if ((msg = SQLprepareClient(c, 0)) != NULL) {
MT_lock_unset(_contextLock);
-   /* CHECK */
-   // Not sure if this is an info msg
TRC_INFO(SQL_SCENARIO, "%s\n", msg);
return msg;
}
@@ -744,8 +735,6 @@ SQLexitClient(Client c)
 {
str err;
 
-   TRC_DEBUG(SQL_SCENARIO, "Enter SQLexitClient\n");
-
MT_lock_set(_contextLock);
if (SQLinitialized == FALSE) {
MT_lock_unset(_contextLock);
@@ -875,13 +864,9 @@ SQLreader(Client c)
return MAL_SUCCEED;
}
if (!be || c->mode <= FINISHCLIENT) {
-   TRC_DEBUG(SQL_SCENARIO, "SQL client finished\n");
c->mode = FINISHCLIENT;
return MAL_SUCCEED;
}
-
-   TRC_DEBUG(SQL_SCENARIO, "Start reading SQL %s\n", (blocked ? "Blocked 
read" : ""));
-
language = be->language;/* 'S' for SQL, 'D' from debugger */
m = be->mvc;
m->errstr[0] = 0;
@@ -889,8 +874,6 @@ SQLreader(Client c)
 * Continue processing any left-over input from the previous round.
 */
 
-   TRC_DEBUG(SQL_SCENARIO, "Pos %zu len %zu eof %d \n", in->pos, in->len, 
in->eof);
-
while (more) {
more = false;
 
@@ -912,7 +895,6 @@ SQLreader(Client c)
ssize_t rd;
 
if (c->bak) {
-   TRC_DEBUG(SQL_SCENARIO, "Switch to backup 
stream\n");
in = c->fdin;
blocked = isa_block_stream(in->s);
  

MonetDB: gdk_tracer - Minor

2019-12-19 Thread Thodoris Zois
Changeset: d1ea3344a0f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d1ea3344a0f9
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
monetdb5/modules/mal/tracer.c
monetdb5/scheduler/run_isolate.h
sql/server/rel_distribute.c
Branch: gdk_tracer
Log Message:

Minor


diffs (158 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -66,7 +66,7 @@ static gdk_return
 
 if(!output_file)
 {
-GDK_TRACER_REPORT_EXCEPTION("Failed to initialize BASIC adapter. Could 
not open file: %s\n", file_name);
+GDK_TRACER_EXCEPTION("Failed to initialize BASIC adapter. Could not 
open file: %s\n", file_name);
 return GDK_FAIL;
 }
 
@@ -145,7 +145,7 @@ static int
 if(!tmp)
 {
 // Let GDKtracer_log to know about the failure
-GDK_TRACER_REPORT_EXCEPTION("Memory allocation failed\n");
+GDK_TRACER_EXCEPTION("Memory allocation failed\n");
 return -1;
 }
 else
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -345,22 +345,22 @@ gdk_tracer;
  * GDKtracer Stream Macros
  */
 // Exception
-#define GDK_TRACER_REPORT_EXCEPTION(MSG, ...)   \
+#define GDK_TRACER_EXCEPTION(MSG, ...)  \
 mnstr_printf(GDKstdout, \
-   "[%s] "  \
-   "%-"MXW"s "  \
-   "%"MXW"s:%d "\
-   "%"MXW"s "   \
-   "%-"MXW"s "  \
-   "%-"MXW"s # "MSG,\
-GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),   \
-__FILENAME__,   \
-__FUNCTION__,   \
-__LINE__,   \
-STR(M_CRITICAL),\
-STR(GDK_TRACER),\
-MT_thread_getname(),\
-## __VA_ARGS__);\
+"[%s] " \
+"%-"MXW"s " \
+"%"MXW"s:%d "   \
+"%"MXW"s "  \
+"%-"MXW"s " \
+"%-"MXW"s # "MSG,   \
+GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),   \
+__FILENAME__,   \
+__FUNCTION__,   \
+__LINE__,   \
+STR(M_CRITICAL),\
+STR(GDK_TRACER),\
+MT_thread_getname(),\
+## __VA_ARGS__);\
 
 
 #define GDK_TRACER_OSTREAM(MSG, ...)\
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -33,7 +33,7 @@ TRACERset_component_level(void *ret, int
 (void) ret;
 GDK_result = GDKtracer_set_component_level(comp_id, lvl_id);
 if(GDK_result == GDK_FAIL)
-GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
+GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
 
 return MAL_SUCCEED; 
 }
@@ -45,7 +45,7 @@ TRACERreset_component_level(void *ret, i
 (void) ret;
 GDK_result = GDKtracer_reset_component_level(comp_id);
 if(GDK_result == GDK_FAIL)
-GDK_TRACER_REPORT_EXCEPTION("[%s] " _OPERATION_FAILED"\n", 
__FUNCTION__);
+GDK_TRACER_EXCEPTION("[%s] " _OPERATION_FAILED"\n", __FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -57,7 +57,7 @@ TRACERset_layer_level(void *ret, int *la
 (void) ret;
 GDK_result = GDKtracer_set_layer_level(layer_id, lvl_id);
 if(GDK_result == GDK_FAIL)
-GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
+GDK_TRACER_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", __FUNCTION__);
 
 return 

MonetDB: gdk_tracer - Checkpoint: Replaced /* CHECK */ -> #ifdef...

2019-12-18 Thread Thodoris Zois
Changeset: a4ea03d8d47d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a4ea03d8d47d
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_batop.c
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_project.c
gdk/gdk_select.c
gdk/gdk_storage.c
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_mergetable.c
Branch: gdk_tracer
Log Message:

Checkpoint: Replaced /* CHECK */ -> #ifdef #endif


diffs (truncated from 499 to 300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -897,7 +897,7 @@ BATgroupsum(BAT *b, BAT *g, BAT *e, BAT 
 
/* CHECK */
// This is in ALGODEBUG
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
if ((err = BATgroupaggrinit(b, g, e, s, , , , , 
)) != NULL) {
GDKerror("BATgroupsum: %s\n", err);
@@ -972,7 +972,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
 
/* CHECK */
// This is in ALGODEBUG
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
if ((err = BATgroupaggrinit(b, NULL, NULL, s, , , , , 
)) != NULL) {
GDKerror("BATsum: %s\n", err);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -508,10 +508,13 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
 
/* CHECK */
// The whole if statement is in DEBUG CHECK_
-   if (BATttype(b) != BATttype(n) &&
+   TRC_DEBUG_IF(CHECK_)
+   {
+   if (BATttype(b) != BATttype(n) &&
ATOMtype(b->ttype) != ATOMtype(n->ttype)) {
-   TRC_DEBUG(CHECK_, "Interpreting %s as %s.\n",
-   ATOMname(BATttype(n)), 
ATOMname(BATttype(b)));
+   TRC_DEBUG_ENDIF(CHECK_, "Interpreting %s as %s.\n",
+   
ATOMname(BATttype(n)), ATOMname(BATttype(b)));
+   }
}
 
cnt = canditer_init(, n, s);
@@ -1448,7 +1451,7 @@ BATordered(BAT *b)
 
/* CHECK */
// This is in DEBUGALGO
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
if (b->ttype == TYPE_void)
return true;
@@ -1538,7 +1541,7 @@ BATordered_rev(BAT *b)
 
/* CHECK */
// This is in DEBUGALGO
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
if (b == NULL)
return false;
@@ -1637,7 +1640,7 @@ BATsort(BAT **sorted, BAT **order, BAT *
 
/* CHECK */
// This is in DEBUGALGO
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
/* we haven't implemented NILs as largest value for stable
 * sort, so NILs come first for ascending and last for
@@ -2097,7 +2100,7 @@ BATconstant(oid hseq, int tailtype, cons
 
/* CHECK */
// This is in DEBUGALGO
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ALGO) t0 = GDKusec();
 
if (v == NULL)
return NULL;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -174,11 +174,11 @@ BATcheckhash(BAT *b)
/* but when we want to change it, we need the lock */
/* CHECK */
// This is in ACCELDEBUG
-   t = GDKusec();
+   TRC_DEBUG_IF(ACCEL) t = GDKusec();
MT_lock_set(>batIdxLock);
/* CHECK */
// This is in ACCELDEBUG
-   t = GDKusec() - t;
+   TRC_DEBUG_IF(ACCEL) t = GDKusec() - t;
/* if still 1 now that we have the lock, we can update */
if (b->thash == (Hash *) 1) {
Hash *h;
@@ -268,7 +268,7 @@ BAThashsync(void *arg)
 
/* CHECK */
// This is in ACCELDEBUG
-   t0 = GDKusec();
+   TRC_DEBUG_IF(ACCEL) t0 = GDKusec();
 
/* we could check whether b->thash == NULL before getting the
 * lock, and only lock if it isn't; however, it's very
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -908,8 +908,11 @@ HEAP_empty(Heap *heap, size_t nprivate, 
headp->next = 0;
/* CHECK */
// HEAP_printstatus is also in if DEBUG-TRACE
-   TRC_DEBUG(TRACE, "We created the following heap\n");
-   HEAP_printstatus(heap);
+   TRC_DEBUG_IF(TRACE)
+   {
+   TRC_DEBUG_ENDIF(TRACE, "We created the following heap\n");
+   HEAP_printstatus(heap);
+   }
 }
 
 void
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -282,7 +282,7 @@ BATimpsync(void *arg)
 
/* CHECK */
// This is defined in 

MonetDB: gdk_tracer - Approved output

2019-12-18 Thread Thodoris Zois
Changeset: 0e1e0ec257af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e1e0ec257af
Modified Files:
clients/Tests/exports.stable.out
Branch: gdk_tracer
Log Message:

Approved output


diffs (25 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1872,17 +1872,16 @@ str TKNZRgetLevel(bat *r, int *level);
 str TKNZRlocate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str TKNZRopen(void *r, str *name);
 str TKNZRtakeOid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str TRACERflush_buffer(void);
-str TRACERlog(void);
-str TRACERreset_adapter(void);
+str TRACERflush_buffer(void *ret);
+str TRACERreset_adapter(void *ret);
 str TRACERreset_component_level(void *ret, int *comp_id);
-str TRACERreset_flush_level(void);
+str TRACERreset_flush_level(void *ret);
 str TRACERreset_layer_level(void *ret, int *layer_id);
 str TRACERset_adapter(void *ret, int *adapter_id);
 str TRACERset_component_level(void *ret, int *comp_id, int *lvl_id);
 str TRACERset_flush_level(void *ret, int *lvl_id);
 str TRACERset_layer_level(void *ret, int *layer_id, int *lvl_id);
-str TRACERshow_info(void);
+str TRACERshow_info(void *ret);
 int TRACEtable(Client cntxt, BAT **r);
 str TRNglobal_abort(bit *ret);
 str TRNglobal_commit(bit *ret);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Approve test tracer00

2019-12-18 Thread Thodoris Zois
Changeset: 1b3d21cc568d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1b3d21cc568d
Added Files:
monetdb5/mal/Tests/tracer00.stable.err
monetdb5/mal/Tests/tracer00.stable.out
Branch: gdk_tracer
Log Message:

Approve test tracer00


diffs (194 lines):

diff --git a/monetdb5/mal/Tests/tracer00.stable.err 
b/monetdb5/mal/Tests/tracer00.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tracer00.stable.err
@@ -0,0 +1,31 @@
+stderr of test 'tracer00` in directory 'monetdb5/mal` itself:
+
+
+# 19:00:00 >  
+# 19:00:00 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39787" "--set" 
"mapi_usock=/var/tmp/mtest-23382/.s.monetdb.39787" "--forcemito" 
"--dbpath=/Users/zois/Desktop/MonetDB/inst/var/MonetDB/mTests_monetdb5_mal" 
"--set" "embedded_c=true"
+# 19:00:00 >  
+
+# builtin opt  gdk_dbpath = 
/Users/zois/Desktop/MonetDB/inst/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 5
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# builtin opt  raw_strings = false
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 39787
+# cmdline opt  mapi_usock = /var/tmp/mtest-23382/.s.monetdb.39787
+# cmdline opt  gdk_dbpath = 
/Users/zois/Desktop/MonetDB/inst/var/MonetDB/mTests_monetdb5_mal
+# cmdline opt  embedded_c = true
+
+# 19:00:01 >  
+# 19:00:01 >  "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8" 
"--host=/var/tmp/mtest-23382" "--port=39787"
+# 19:00:01 >  
+
+
+# 19:00:01 >  
+# 19:00:01 >  "Done."
+# 19:00:01 >  
+
diff --git a/monetdb5/mal/Tests/tracer00.stable.out 
b/monetdb5/mal/Tests/tracer00.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tracer00.stable.out
@@ -0,0 +1,153 @@
+stdout of test 'tracer00` in directory 'monetdb5/mal` itself:
+
+
+# 19:00:00 >  
+# 19:00:00 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39787" "--set" 
"mapi_usock=/var/tmp/mtest-23382/.s.monetdb.39787" "--forcemito" 
"--dbpath=/Users/zois/Desktop/MonetDB/inst/var/MonetDB/mTests_monetdb5_mal" 
"--set" "embedded_c=true"
+# 19:00:00 >  
+
+# MonetDB 5 server v11.36.0 (hg id: bee1ed87fd07)
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_mal', using 8 threads
+# Compiled for x86_64-apple-darwin18.7.0/64bit with 128bit integers
+# Found 16.000 GiB available main-memory of which we use 13.040 GiB
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://poseidon.local:39787/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-23382/.s.monetdb.39787
+# MonetDB/SQL module loaded
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_component_level:36
   M_CRITICAL GDK_TRACER   client2  # 
[TRACERset_component_level] Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERreset_component_level:48  
 M_CRITICAL GDK_TRACER   client2  # 
[TRACERreset_component_level] Operation failed
+[2019-12-18 19:00:01] tracer.c TRACERset_layer_level:60   
M_CRITICAL GDK_TRACER   client2  # [TRACERset_layer_level] 
Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_layer_level:60   
M_CRITICAL GDK_TRACER   client2  # [TRACERset_layer_level] 
Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_layer_level:60   
M_CRITICAL GDK_TRACER   client2  # [TRACERset_layer_level] 
Illegal argument
+[2019-12-18 19:00:01] tracer.c TRACERset_layer_level:60   
M_CRITICAL GDK_TRACER   client2  # [TRACERset_layer_level] 
Illegal argument
+[2019-12-18 19:00:01] 

MonetDB: gdk_tracer - Fixes for MTest and tracer00.mal - removed...

2019-12-18 Thread Thodoris Zois
Changeset: bee1ed87fd07 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bee1ed87fd07
Modified Files:
gdk/gdk_tracer.h
monetdb5/mal/Tests/tracer00.malC
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
Branch: gdk_tracer
Log Message:

Fixes for MTest and tracer00.mal - removed TRACERlog


diffs (173 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -102,6 +102,13 @@ typedef enum {
 
 
 
+
+/*
+ *
+ * NOTE: Adding/Removing components will affect the test tracer00.mal
+ * See the test file for more details.
+ * 
+ */
 // COMPONENTS
 #define FOREACH_COMP(COMP)\
 COMP( ALLOC ) \
diff --git a/monetdb5/mal/Tests/tracer00.malC b/monetdb5/mal/Tests/tracer00.malC
--- a/monetdb5/mal/Tests/tracer00.malC
+++ b/monetdb5/mal/Tests/tracer00.malC
@@ -8,7 +8,7 @@
 # In some test cases (marked with #WARNING) the argument used is supposed to 
be 
 # an enum entry used to count the number of elements (e.g: COMPONENTS_COUNT in 
 # gdk_tracer.h). Thus, in those cases an error should be raised. However, 
adding 
-# new entries to the enum will affect the marked test cases and they won't 
fail.
+# or removing entries will affect the marked test cases and they won't fail.
 
 
 # logging.setcomplevel(...)
@@ -27,11 +27,11 @@ logging.setcomplevel(1, 5); # Should
 # The last level is used for enum count
 
 # WARNING
-logging.setcomplevel(98, 3);# Should raise an error
+logging.setcomplevel(89, 3);# Should raise an error
 # The last component is used for enum count
 
 # WARNING
-logging.setcomplevel(98, 5);# Should raise an error
+logging.setcomplevel(89, 5);# Should raise an error
 # The last component is used for enum count
 # The last level is used for enum count
 
@@ -44,7 +44,7 @@ logging.resetcomplevel(-1); # Should
 # Component -1 does not exist
 
 # WARNING
-logging.resetcomplevel(98); # Should raise an error
+logging.resetcomplevel(89); # Should raise an error
 # The last component is used for enum count
 
 logging.resetcomplevel(1);  # OK
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -6,13 +6,9 @@
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  * 
  * 
- * GDKtracer exposes routines where an occuring failure should not reach the 
client but 
- * should be made known only to the DBA. On the other hand, there are exposed 
routines
- * where the failure must also reach the client. 
- * 
- * For both cases the failures are being logged to the active adapter, or to 
the fallback
- * mechanism (mserver5). To cover the needs of the second category, an 
exception is thrown. 
- * Exceptions apart from being logged by GDKtracer are also percolating up to 
the client. 
+ * GDKtracer exposes routines where an occuring failure should reach the 
+ * client immediately. For that reason, GDKtracer reports those errors 
+ * directly to the stream.
  * 
  */
 
@@ -23,8 +19,9 @@
 int GDK_result = 0;
 
 str 
-TRACERflush_buffer(void)
+TRACERflush_buffer(void *ret)
 {
+(void) ret;
 GDKtracer_flush_buffer();
 return MAL_SUCCEED;
 }
@@ -91,8 +88,9 @@ TRACERset_flush_level(void *ret, int *lv
 
 
 str
-TRACERreset_flush_level(void)
+TRACERreset_flush_level(void *ret)
 {
+(void) ret;
 GDK_result = GDKtracer_reset_flush_level();
 if(GDK_result == GDK_FAIL)
 GDK_TRACER_REPORT_EXCEPTION("[%s] " _OPERATION_FAILED"\n", 
__FUNCTION__);
@@ -114,8 +112,9 @@ TRACERset_adapter(void *ret, int *adapte
 
 
 str
-TRACERreset_adapter(void)
+TRACERreset_adapter(void *ret)
 {
+(void) ret;
 GDK_result = GDKtracer_reset_adapter();
 if(GDK_result == GDK_FAIL)
 GDK_TRACER_REPORT_EXCEPTION("[%s] " _OPERATION_FAILED"\n", 
__FUNCTION__);
@@ -125,19 +124,9 @@ TRACERreset_adapter(void)
 
 
 str
-TRACERshow_info(void)
+TRACERshow_info(void *ret)
 {
+(void) ret;
 GDKtracer_show_info();
 return MAL_SUCCEED;
 }
-
-
-// Exposed only in MAL layer - for testing
-str
-TRACERlog(void)
-{
-TRC_CRITICAL(SQL_BAT, "A CRITICAL message\n");
-TRC_INFO(MAL_DATAFLOW, "An INFO message\n");
-
-return MAL_SUCCEED;
-}
diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h
--- a/monetdb5/modules/mal/tracer.h
+++ b/monetdb5/modules/mal/tracer.h
@@ -6,7 +6,6 @@
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  * 
  * All the functions correspond one by one to the API calls in gdk_tracer.h
- * Except TRACERlog which is exposed only in the MAL layer for testing.
  * 
  */
 
@@ -17,18 +16,16 @@
 #include "mal_interpreter.h"
 
 
-mal_export str 

MonetDB: gdk_tracer - Merge with default

2019-12-18 Thread Thodoris Zois
Changeset: 5a42e6a626e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5a42e6a626e3
Modified Files:
geom/monetdb5/geom.c
Branch: gdk_tracer
Log Message:

Merge with default


diffs (20 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -5256,13 +5256,13 @@ mbrTOSTR(char **dst, size_t *len, const 
dstStrLen = strlen(tempWkt);
}
 
-   if (*len < dstStrLen + 3 || *dst == NULL) {
+   if (*len < dstStrLen + 4 || *dst == NULL) {
GDKfree(*dst);
-   if ((*dst = GDKmalloc(*len = dstStrLen + 3)) == NULL)
+   if ((*dst = GDKmalloc(*len = dstStrLen + 4)) == NULL)
return -1;
}
 
-   if (dstStrLen > 3) {
+   if (dstStrLen > 4) {
if (external) {
snprintf(*dst, *len, "\"%s\"", tempWkt);
dstStrLen += 2;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Compilation fixes

2019-12-18 Thread Thodoris Zois
Changeset: ffa136ec11c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ffa136ec11c8
Modified Files:
gdk/gdk_group.c
gdk/gdk_hash.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Compilation fixes


diffs (92 lines):

diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -608,7 +608,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "trivial case: 1 element per group\n", 
MT_thread_getname(),
+ "trivial case: 1 element per group\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -660,7 +660,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "trivial case: single output group\n", 
MT_thread_getname(),
+ "trivial case: single output group\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -698,7 +698,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "trivial case: copy input groups\n", 
MT_thread_getname(),
+ "trivial case: copy input groups\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -801,7 +801,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "compare consecutive values\n", 
MT_thread_getname(),
+ "compare consecutive values\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -859,7 +859,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "subscan old groups\n", MT_thread_getname(),
+ "subscan old groups\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -996,7 +996,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "use existing hash table\n", 
MT_thread_getname(),
+ "use existing hash table\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
@@ -1062,7 +1062,7 @@ BATgroup_internal(BAT **groups, BAT **ex
  "g=%s#" BUNFMT ","
  "e=%s#" BUNFMT ","
  "h=%s#" BUNFMT ",subsorted=%d): "
- "create partial hash table%s\n", 
MT_thread_getname(),
+ "create partial hash table%s\n",
  BATgetId(b), BATcount(b), ATOMname(b->ttype),
  s ? BATgetId(s) : "NULL", s ? BATcount(s) : 0,
  g ? BATgetId(g) : "NULL", g ? BATcount(g) : 0,
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -488,9 +488,8 @@ BAThash_impl(BAT *b, BAT *s, const char 
break;
}
   

MonetDB: gdk_tracer - Get updates from branch gdk_tracer

2019-12-18 Thread Thodoris Zois
Changeset: bb1d2d00f0ff for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bb1d2d00f0ff
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
monetdb5/modules/mal/Tests/inspect00.stable.out
monetdb5/tools/Tests/mserver5--help.stable.err
monetdb5/tools/Tests/mserver5--help.stable.err.Windows
sql/backends/monet5/wlr.c

sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart-0.Bug-3063.stable.out

sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart-1.Bug-3063.stable.out
sql/test/bugs/Tests/groupby_having_charlength-bug-sf-943566.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: gdk_tracer
Log Message:

Get updates from branch gdk_tracer


diffs (251 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11244,14 +11244,15 @@ stdout of test 'MAL-signatures` in direc
 [ "lidar", "load", "pattern lidar.load(tablename:str):void ",  
"LIDARloadTable;",  "Load a LIDAR table from an attached file"  ]
 [ "logging",   "flush","command logging.flush():void ",
"TRACERflush_buffer;",  "Flush the buffer"  ]
 [ "logging",   "log",  "command logging.log():void ",  "TRACERlog;",   "Create 
a log message"  ]
-[ "logging",   "resetadapter", "command logging.resetadapter():void ", 
"TRACERreset_adapter;", "Reset the adapter" ]
-[ "logging",   "resetcomplevel",   "command 
logging.resetcomplevel(comp:int):void ",   "TRACERreset_component_level;", 
"Reset the log level for a specific component"  ]
-[ "logging",   "resetflushlevel",  "command logging.resetflushlevel():void 
",  "TRACERreset_flush_level;", "Reset the flush level" ]
-[ "logging",   "resetlayerlevel",  "command 
logging.resetlayerlevel(layer:int):void ", "TRACERreset_layer_level;", 
"Reset the log level for a specific layer"  ]
-[ "logging",   "setadapter",   "command logging.setadapter(adapter:int):void 
","TRACERset_adapter;",   "Set the adapter"   ]
-[ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Set the log level for 
a specific component"]
-[ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Set the 
flush level"   ]
-[ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Set the log level for a specific layer"
]
+[ "logging",   "resetadapter", "command logging.resetadapter():void ", 
"TRACERreset_adapter;", "Resets the adapter back to the default"]
+[ "logging",   "resetcomplevel",   "command 
logging.resetcomplevel(comp:int):void ",   "TRACERreset_component_level;", 
"Resets the log level for a specific component back to the default" ]
+[ "logging",   "resetflushlevel",  "command logging.resetflushlevel():void 
",  "TRACERreset_flush_level;", "Resets the flush level back to the 
default"]
+[ "logging",   "resetlayerlevel",  "command 
logging.resetlayerlevel(layer:int):void ", "TRACERreset_layer_level;", 
"Resets the log level for a specific layer back to the default" ]
+[ "logging",   "setadapter",   "command logging.setadapter(adapter:int):void 
","TRACERset_adapter;",   "Sets the adapter"  ]
+[ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Sets the log level for 
a specific component"   ]
+[ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Sets 
the flush level"  ]
+[ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Sets the log level for a specific layer"   
]
+[ "logging",   "showinfo", "command logging.showinfo():void ", 
"TRACERshow_info;", "Dumps to the console all the available logging levels, 
layers and the components\nalong with their current logging level being set"
]
 [ "mal",   "manifold", "pattern mal.manifold(mod:str, fcn:str, 
a:any...):bat[:any] ",  "MANIFOLDevaluate;",""  ]
 [ "mal",   "multiplex","pattern mal.multiplex(mod:str, fcn:str, 
a:any...):any... ","MANIFOLDremapMultiplex;",  ""  ]
 [ "manual","functions","pattern manual.functions() (mod:bat[:str], 
fcn:bat[:str], sig:bat[:str], adr:bat[:str], com:bat[:str]) ",  
"MANUALcreateOverview;","Produces a table with all MAL functions known" 
]
diff 

MonetDB: gdk_tracer - Merge with default & minor changes

2019-12-18 Thread Thodoris Zois
Changeset: bea8ce217040 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bea8ce217040
Added Files:
sql/test/mergetables/Tests/sqlsmith-exists2.sql
sql/test/mergetables/Tests/sqlsmith-exists2.stable.err
sql/test/mergetables/Tests/sqlsmith-exists2.stable.out
Removed Files:

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:
.hgtags
MonetDB.spec
NT/mkodbcwxs.py
NT/mksqlwxs.py
NT/monetdb_config.h.in
NT/rules.msc
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
clients/mapiclient/mclient.c
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
common/utils/mutils.c
configure.ag
debian/changelog
gdk/gdk.h
gdk/gdk_aggr.c
gdk/gdk_align.c
gdk/gdk_atoms.h
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_calc.c
gdk/gdk_cand.c
gdk/gdk_cross.c
gdk/gdk_group.c
gdk/gdk_hash.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_project.c
gdk/gdk_sample.c
gdk/gdk_tracer.h
gdk/gdk_unique.c
gdk/libbat.rc
geom/monetdb5/geom.c
geom/monetdb5/geomBulk.c
libversions
monetdb5/NT/M5server.bat
monetdb5/extras/rapi/rapi.c
monetdb5/mal/Tests/tracer00.malC
monetdb5/mal/mal_atom.c
monetdb5/mal/mal_authorize.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_factory.c
monetdb5/mal/mal_import.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_session.c
monetdb5/modules/atoms/batxml.c
monetdb5/modules/atoms/blob.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/atoms/json.c
monetdb5/modules/atoms/mtime.c
monetdb5/modules/atoms/str.c
monetdb5/modules/atoms/streams.c
monetdb5/modules/atoms/url.c
monetdb5/modules/atoms/uuid.c
monetdb5/modules/atoms/xml.c
monetdb5/modules/kernel/alarm.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/batcolor.c
monetdb5/modules/kernel/batmmath.c
monetdb5/modules/kernel/batstr.c
monetdb5/modules/kernel/status.c
monetdb5/modules/mal/batExtensions.c
monetdb5/modules/mal/bbp.c
monetdb5/modules/mal/calc.c
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/inspect.c
monetdb5/modules/mal/iterator.c
monetdb5/modules/mal/json_util.c
monetdb5/modules/mal/language.c
monetdb5/modules/mal/mal_io.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/manual.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/mdb.c
monetdb5/modules/mal/mkey.c
monetdb5/modules/mal/oltp.c
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/projectionpath.c
monetdb5/modules/mal/querylog.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/sysmon.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tokenizer.c
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/txtsim.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_json.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_oltp.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_postfix.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c

MonetDB: gdk_tracer - Changed the way that exceptions are handle...

2019-12-17 Thread Thodoris Zois
Changeset: f648ea605100 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f648ea605100
Modified Files:
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_exception.h
monetdb5/modules/mal/tracer.c
Branch: gdk_tracer
Log Message:

Changed the way that exceptions are handled in tracer.c


diffs (101 lines):

diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -29,8 +29,7 @@ static char *exceptionNames[] = {
 /*11 */"ArithmeticException",
 /*12 */"PermissionDeniedException",
 /*13 */"SQLException",
-/*14 */ "TracerException",
-/*15 */"Deprecated operation",
+/*14 */"Deprecated operation",
 /*EOE*/NULL
 };
 
diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h
--- a/monetdb5/mal/mal_exception.h
+++ b/monetdb5/mal/mal_exception.h
@@ -26,8 +26,7 @@ enum malexception {
PARSE,
ARITH,
PERMD,
-   SQL,
-   TRACER
+   SQL
 };
 
 #define MAL_SUCCEED ((str) 0) /* no error */
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -36,7 +36,7 @@ TRACERset_component_level(void *ret, int
 (void) ret;
 GDK_result = GDKtracer_set_component_level(comp_id, lvl_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED; 
 }
@@ -48,7 +48,7 @@ TRACERreset_component_level(void *ret, i
 (void) ret;
 GDK_result = GDKtracer_reset_component_level(comp_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " OPERATION_FAILED"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -60,7 +60,7 @@ TRACERset_layer_level(void *ret, int *la
 (void) ret;
 GDK_result = GDKtracer_set_layer_level(layer_id, lvl_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED; 
 }
@@ -72,7 +72,7 @@ TRACERreset_layer_level(void *ret, int *
 (void) ret;
 GDK_result = GDKtracer_reset_layer_level(layer_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " OPERATION_FAILED"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -84,7 +84,7 @@ TRACERset_flush_level(void *ret, int *lv
 (void) ret;
 GDK_result = GDKtracer_set_flush_level(lvl_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -95,7 +95,7 @@ TRACERreset_flush_level(void)
 {
 GDK_result = GDKtracer_reset_flush_level();
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " OPERATION_FAILED"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -107,7 +107,7 @@ TRACERset_adapter(void *ret, int *adapte
 (void) ret;
 GDK_result = GDKtracer_set_adapter(adapter_id);
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " ILLEGAL_ARGUMENT"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
@@ -118,7 +118,7 @@ TRACERreset_adapter(void)
 {
 GDK_result = GDKtracer_reset_adapter();
 if(GDK_result == GDK_FAIL)
-throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
+GDK_TRACER_REPORT_EXCEPTION("[%s] " OPERATION_FAILED"\n", 
__FUNCTION__);
 
 return MAL_SUCCEED;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Updated comments

2019-12-17 Thread Thodoris Zois
Changeset: bc3d406b6ed2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc3d406b6ed2
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Updated comments


diffs (127 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -54,7 +54,8 @@ LOG_LEVEL LVL_PER_COMPONENT[] = {
 
 
 
-// Prepares a file in order to write the contents of the buffer when necessary
+// When BASIC adapter is active, all the log messages are getting output to a 
file. 
+// This function prepares a file in order to write the contents of the buffer 
when necessary.
 static gdk_return
 _GDKtracer_init_basic_adptr(void)
 {
@@ -498,9 +499,7 @@ GDKtracer_flush_buffer(void)
 // fwrite failed for whatever reason 
 // (e.g: disk is full) fallback to stream
 if(USE_STREAM)
-{
 GDK_TRACER_OSTREAM("%s", active_tracer->buffer);
-}
 
 // Reset buffer
 memset(active_tracer->buffer, 0, BUFFER_SIZE);
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -5,19 +5,26 @@
  *
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  * 
- * REWRITE ->
- * The tracer is the general logging system for the MonetDB stack.
- * It is modelled after well-known logging schems, eg. Python
- *
- * Internally, the logger uses a dual buffer to capture log messages
- * before they are written to a file. This way we avoid serial execution.
- *
- * The logger files come in two as well, where we switch them 
- * once the logger is full.
- * The logger file format is "tracer_YY-MM-DDTHH:MM:SS_number.log"
- * An option to consider is we need a rotating scheme over 2 files only,
- * Moreover, old log files might be sent in the background to long term 
storage as well.
+ * 
+ * // TODO: Complete it when documentation is accepted
  * 
+ * Tracer is the general logging system for the MonetDB stack modelled after 
the 
+ * well-known logging schemes (e.g: Python). It provides a number of logging 
levels 
+ * and options to increase or reduce the verbosity either of individual code 
parts 
+ * or of the codebase as a whole. It allows users to focus on logging messages 
+ * related to certain steps of execution, which can be proved handy when it 
comes 
+ * to debugging. The behavior of Tracer can be controlled at runtime using the 
+ * SQL API described later on. Certain calls require an “id” to operate 
which can 
+ * be found on the list of each section below.
+ * 
+ * Internally, the logger uses a buffer to capture log messages before they 
are 
+ * forwarded to the specific adapter.
+ * 
+ * - Sets the minimum flush level that an event will trigger the logger to 
flush the buffer
+ * - Produces messages to the output stream. It is also used as a fallback 
mechanism 
+ * in case GDKtracer fails to log for whatever reason.
+ * - Struct buffer with allocated space etc.
+ * - Flush buffer sends the messages to the selected adapter
  */
 
 #ifndef _GDK_TRACER_H_
@@ -271,7 +278,6 @@ extern LOG_LEVEL LVL_PER_COMPONENT[];
 TRC_CRITICAL_ENDIF(SQL_STORE, "Test\n")
 }
 */
-
 #define TRC_CRITICAL_IF(COMP) \
 IF_GDK_TRACER_LOG(M_CRITICAL, COMP)   \
 
@@ -305,7 +311,7 @@ extern LOG_LEVEL LVL_PER_COMPONENT[];
 
 
 
-// GDKtracer Buffer
+// GDKtracer struct - Buffer and info
 typedef struct GDKtracer
 {
 int id;
@@ -338,13 +344,10 @@ gdk_tracer;
 ## __VA_ARGS__);\
 
 
-
-// Produces messages to the output stream. It is also used as a fallback 
mechanism 
-// in case GDKtracer fails to log for whatever reason.
-#define GDK_TRACER_OSTREAM(MSG, ...)\
-do {\
-mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
-} while (0) \
+#define GDK_TRACER_OSTREAM(MSG, ...)\
+do {\
+mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
+} while (0) \
 
 
 
@@ -376,26 +379,21 @@ gdk_return GDKtracer_set_layer_level(int
 gdk_return GDKtracer_reset_layer_level(int *layer);
 
 
-// Sets the minimum flush level that an event will trigger the logger to flush 
the buffer
 gdk_return GDKtracer_set_flush_level(int *lvl);
 
 
 gdk_return GDKtracer_reset_flush_level(void);
 
 
-// Sets the adapter used when flush buffer takes place
 gdk_return GDKtracer_set_adapter(int *adapter);
 
 
-// Resets the adapter to the default
 gdk_return GDKtracer_reset_adapter(void);
 
 
-// Candidate for 'gnu_printf' format attribute 
[-Werror=suggest-attribute=format] 

MonetDB: gdk_tracer - Trimmed down components enum

2019-12-17 Thread Thodoris Zois
Changeset: 8960509393eb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8960509393eb
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Trimmed down components enum


diffs (56 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -133,14 +133,9 @@ typedef enum {
 COMP( SQL_BAT )   \
   \
 COMP( MAL_MEMO )  \
-COMP( MAL_SESSION )   \
 COMP( MAL_INTERPRETER )   \
 COMP( MAL_SCHEDULER ) \
-COMP( MAL_LISTING )   \
-COMP( MAL_FACTORY )   \
-COMP( MAL_PARSER )\
 COMP( MAL_WLC )   \
-COMP( MAL_REDUCE )\
 COMP( MAL_CLIENT )\
 COMP( MAL_OIDX )  \
 COMP( MAL_REMOTE )\
@@ -152,13 +147,11 @@ typedef enum {
 COMP( MAL_RESOLVE )   \
 COMP( MAL_FCN )   \
 COMP( MAL_DATAFLOW )  \
-COMP( MAL_MODULE )\
 COMP( MAL_SERVER )\
 COMP( MAL_EXCEPTION ) \
 COMP( MAL_NAMESPACE ) \
 COMP( MAL_PROFILER )  \
 COMP( MAL_MAL )   \
-COMP( MAL_DEBUGGER )  \
   \
 COMP( MAL_OPT_ALIASES )   \
 COMP( MAL_OPT_CANDIDATES )\
@@ -169,7 +162,6 @@ typedef enum {
 COMP( MAL_OPT_DATAFLOW )  \
 COMP( MAL_OPT_EVALUATE )  \
 COMP( MAL_OPT_INLINE )\
-COMP( MAL_OPT_JIT )   \
 COMP( MAL_OPT_MULTIPLEX ) \
 COMP( MAL_OPT_REORDER )   \
 COMP( MAL_OPT_PROJECTIONPATH )\
@@ -183,7 +175,6 @@ typedef enum {
 COMP( MAL_OPT_MATPACK )   \
 COMP( MAL_OPT_GC )\
 COMP( MAL_OPT_MERGETABLE )\
-COMP( MAL_OPT_MITOSIS )   \
 COMP( MAL_OPT_PUSHSELECT )\
 COMP( MAL_OPT_QUERYLOG )  \
 COMP( MAL_OPT_OLTP )  \
@@ -192,7 +183,6 @@ typedef enum {
 COMP( MAL_OPT_REMOTE )\
 COMP( MAL_OPT_VOLCANO )   \
 COMP( MAL_OPT_MACRO ) \
-COMP( MAL_OPT_POSTFIX )   \
   \
 COMP( GDK_TM )\
 COMP( GDK_UTILS ) \
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Merge with default

2019-12-13 Thread Thodoris Zois
Changeset: 3305f108809f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3305f108809f
Added Files:
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.sql
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.stable.err
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.stable.out

sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.sql

sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.stable.err

sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.stable.out
sql/test/miscellaneous/Tests/deallocate.sql
sql/test/miscellaneous/Tests/deallocate.stable.err
sql/test/miscellaneous/Tests/deallocate.stable.out
Modified Files:
.hgtags
MonetDB.spec
NT/monetdb_config.h.in
NT/rules.msc
clients/mapiclient/ReadlineTools.c
clients/mapiclient/mclient.c
clients/mapiclient/mhelp.c
clients/mapilib/mapi.rc
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
configure.ag
debian/changelog
gdk/libbat.rc
geom/monetdb5/geom.c
libversions
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_parser.c
monetdb5/modules/mal/orderidx.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_json.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_oltp.c
monetdb5/optimizer/opt_postfix.c
monetdb5/optimizer/opt_profiler.c
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_querylog.c
monetdb5/optimizer/opt_reduce.c
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_volcano.c
monetdb5/optimizer/opt_wlc.c
monetdb5/tools/libmonetdb5.rc
sql/ChangeLog
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_upgrades.c
sql/include/sql_relation.h
sql/scripts/51_sys_schema_extension.sql
sql/server/rel_unnest.c
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_parser.y
sql/server/sql_qc.c
sql/server/sql_qc.h
sql/server/sql_scan.c
sql/test/BugTracker-2019/Tests/All
sql/test/BugTracker-2019/Tests/date_trunc.sql
sql/test/BugTracker-2019/Tests/date_trunc.stable.out
sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
sql/test/mergetables/Tests/sqlsmith-exists.sql
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
sql/test/miscellaneous/Tests/All
vertoo.data
Branch: gdk_tracer
Log Message:

Merge with default


diffs (truncated from 3640 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -742,3 +742,5 @@ 90486f8f87ff0602f3ab143c629ba0aed2153d64
 13efc12c95a279d41dbc4440369defc1d7c21d0f Nov2019_3
 90486f8f87ff0602f3ab143c629ba0aed2153d64 Nov2019_release
 13efc12c95a279d41dbc4440369defc1d7c21d0f Nov2019_release
+fffd3aabeae5e2c5b535179471e5730742962a76 Nov2019_5
+fffd3aabeae5e2c5b535179471e5730742962a76 Nov2019_SP1_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -114,7 +114,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Nov2019/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Nov2019-SP1/%{name}-%{version}.tar.bz2
 
 # we need systemd for the _unitdir macro to exist
 # we need checkpolicy and selinux-policy-devel for the SELinux policy
@@ -1061,6 +1061,27 @@ fi
 %postun -p /sbin/ldconfig
 
 %changelog
+* Thu Dec 12 2019 Sjoerd Mullender  - 11.35.5-20191212
+- Rebuilt.
+- BZ#6723: columns aliases duplicates should not be 

MonetDB: gdk_tracer - Updated comments in SQL API to match the d...

2019-12-12 Thread Thodoris Zois
Changeset: 66893ab4af7e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=66893ab4af7e
Modified Files:
monetdb5/modules/mal/tracer.mal
sql/scripts/81_tracer.sql
Branch: gdk_tracer
Log Message:

Updated comments in SQL API to match the documentation


diffs (106 lines):

diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -12,39 +12,40 @@ comment "Flush the buffer";
 
 command setcomplevel(comp:int, lvl:int)
 address TRACERset_component_level
-comment "Set the log level for a specific component";
+comment "Sets the log level for a specific component";
 
 command resetcomplevel(comp:int)
 address TRACERreset_component_level
-comment "Reset the log level for a specific component";
+comment "Resets the log level for a specific component back to the default";
 
 command setlayerlevel(layer:int, lvl:int)
 address TRACERset_layer_level
-comment "Set the log level for a specific layer";
+comment "Sets the log level for a specific layer";
 
 command resetlayerlevel(layer:int)
 address TRACERreset_layer_level
-comment "Reset the log level for a specific layer";
+comment "Resets the log level for a specific layer back to the default";
 
 command setflushlevel(lvl:int)
 address TRACERset_flush_level
-comment "Set the flush level";
+comment "Sets the flush level";
 
 command resetflushlevel()
 address TRACERreset_flush_level
-comment "Reset the flush level";
+comment "Resets the flush level back to the default";
 
 command setadapter(adapter:int)
 address TRACERset_adapter
-comment "Set the adapter";
+comment "Sets the adapter";
 
 command resetadapter()
 address TRACERreset_adapter
-comment "Reset the adapter";
+comment "Resets the adapter back to the default";
 
 command showinfo()
 address TRACERshow_info
-comment "Show logging levels per component and available layers";
+comment "Dumps to the console all the available logging levels, layers and the 
components
+along with their current logging level being set";
 
 # Exposed only in MAL layer - for testing
 command log()
diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql
--- a/sql/scripts/81_tracer.sql
+++ b/sql/scripts/81_tracer.sql
@@ -10,38 +10,40 @@ CREATE SCHEMA logging;
 CREATE PROCEDURE logging.flush()
 EXTERNAL NAME logging.flush;
 
--- Set the log level for a specific component
+-- Sets the log level for a specific component
 CREATE PROCEDURE logging.setcomplevel(comp_id INT, lvl_id INT)
 EXTERNAL NAME logging.setcomplevel;
 
--- Reset the log level for a specific component
+-- Resets the log level for a specific component back to the default
 CREATE PROCEDURE logging.resetcomplevel(comp_id INT)
 EXTERNAL NAME logging.resetcomplevel;
 
--- Set the log level for a specific layer
+-- Sets the log level for a specific layer
 CREATE PROCEDURE logging.setlayerlevel(layer_id INT, lvl_id INT)
 EXTERNAL NAME logging.setlayerlevel;
 
--- Reset the log level for a specific layer
+-- Resets the log level for a specific layer back to the default
 CREATE PROCEDURE logging.resetlayerlevel(layer_id INT)
 EXTERNAL NAME logging.resetlayerlevel;
 
--- Set the flush level
+-- Sets the flush level
 CREATE PROCEDURE logging.setflushlevel(lvl_id INT)
EXTERNAL NAME logging.setflushlevel;
 
--- Reset the flush level
+-- Resets the flush level back to the default
 CREATE PROCEDURE logging.resetflushlevel()
EXTERNAL NAME logging.resetflushlevel;
 
--- Set the adapter
+-- Sets the adapter
 CREATE PROCEDURE logging.setadapter(adapter_id INT)
EXTERNAL NAME logging.setadapter;
 
--- Reset the adapter
+-- Resets the adapter back to the default
 CREATE PROCEDURE logging.resetadapter()
EXTERNAL NAME logging.resetadapter;
 
--- Show log level per component and available layers
+-- Dumps to the console all the available logging levels, 
+-- layers and the components along with their current logging 
+-- level being set
 CREATE PROCEDURE logging.showinfo()
EXTERNAL NAME logging.showinfo;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added _id to layer, adapter , log_level an...

2019-12-12 Thread Thodoris Zois
Changeset: a48ca4c3cd37 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a48ca4c3cd37
Modified Files:
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
sql/scripts/81_tracer.sql
Branch: gdk_tracer
Log Message:

Added _id to layer, adapter , log_level and component variables


diffs (145 lines):

diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -31,10 +31,10 @@ TRACERflush_buffer(void)
 
 
 str
-TRACERset_component_level(void *ret, int *comp, int *lvl)
+TRACERset_component_level(void *ret, int *comp_id, int *lvl_id)
 {
 (void) ret;
-GDK_result = GDKtracer_set_component_level(comp, lvl);
+GDK_result = GDKtracer_set_component_level(comp_id, lvl_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
@@ -43,9 +43,10 @@ TRACERset_component_level(void *ret, int
 
 
 str
-TRACERreset_component_level(int *comp)
+TRACERreset_component_level(void *ret, int *comp_id)
 {
-GDK_result = GDKtracer_reset_component_level(comp);
+(void) ret;
+GDK_result = GDKtracer_reset_component_level(comp_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
@@ -54,10 +55,10 @@ TRACERreset_component_level(int *comp)
 
 
 str
-TRACERset_layer_level(void *ret, int *layer, int *lvl)
+TRACERset_layer_level(void *ret, int *layer_id, int *lvl_id)
 {
 (void) ret;
-GDK_result = GDKtracer_set_layer_level(layer, lvl);
+GDK_result = GDKtracer_set_layer_level(layer_id, lvl_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
@@ -66,9 +67,10 @@ TRACERset_layer_level(void *ret, int *la
 
 
 str
-TRACERreset_layer_level(int *layer)
+TRACERreset_layer_level(void *ret, int *layer_id)
 {
-GDK_result = GDKtracer_reset_layer_level(layer);
+(void) ret;
+GDK_result = GDKtracer_reset_layer_level(layer_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
@@ -77,10 +79,10 @@ TRACERreset_layer_level(int *layer)
 
 
 str
-TRACERset_flush_level(void *ret, int *lvl)
+TRACERset_flush_level(void *ret, int *lvl_id)
 {
 (void) ret;
-GDK_result = GDKtracer_set_flush_level(lvl);
+GDK_result = GDKtracer_set_flush_level(lvl_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
@@ -100,10 +102,10 @@ TRACERreset_flush_level(void)
 
 
 str
-TRACERset_adapter(void *ret, int *adapter)
+TRACERset_adapter(void *ret, int *adapter_id)
 {
 (void) ret;
-GDK_result = GDKtracer_set_adapter(adapter);
+GDK_result = GDKtracer_set_adapter(adapter_id);
 if(GDK_result == GDK_FAIL)
 throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h
--- a/monetdb5/modules/mal/tracer.h
+++ b/monetdb5/modules/mal/tracer.h
@@ -18,13 +18,13 @@
 
 
 mal_export str TRACERflush_buffer(void);
-mal_export str TRACERset_component_level(void *ret, int *comp, int *lvl);
-mal_export str TRACERreset_component_level(int *comp);
-mal_export str TRACERset_layer_level(void *ret, int *layer, int *lvl);
-mal_export str TRACERreset_layer_level(int *layer);
-mal_export str TRACERset_flush_level(void *ret, int *lvl);
+mal_export str TRACERset_component_level(void *ret, int *comp_id, int *lvl_id);
+mal_export str TRACERreset_component_level(void *ret, int *comp_id);
+mal_export str TRACERset_layer_level(void *ret, int *layer_id, int *lvl_id);
+mal_export str TRACERreset_layer_level(void *ret, int *layer_id);
+mal_export str TRACERset_flush_level(void *ret, int *lvl_id);
 mal_export str TRACERreset_flush_level(void);
-mal_export str TRACERset_adapter(void *ret, int *adapter);
+mal_export str TRACERset_adapter(void *ret, int *adapter_id);
 mal_export str TRACERreset_adapter(void);
 mal_export str TRACERshow_info(void);
 
diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql
--- a/sql/scripts/81_tracer.sql
+++ b/sql/scripts/81_tracer.sql
@@ -11,23 +11,23 @@ CREATE PROCEDURE logging.flush()
 EXTERNAL NAME logging.flush;
 
 -- Set the log level for a specific component
-CREATE PROCEDURE logging.setcomplevel(comp INT, lvl INT)
+CREATE PROCEDURE logging.setcomplevel(comp_id INT, lvl_id INT)
 EXTERNAL NAME logging.setcomplevel;
 
 -- Reset the log level for a specific component
-CREATE PROCEDURE logging.resetcomplevel(comp INT)
+CREATE PROCEDURE logging.resetcomplevel(comp_id INT)
 EXTERNAL NAME logging.resetcomplevel;
 
 -- Set the log level for a specific layer
-CREATE PROCEDURE logging.setlayerlevel(layer INT, lvl INT)
+CREATE PROCEDURE logging.setlayerlevel(layer_id INT, lvl_id INT)
 EXTERNAL NAME logging.setlayerlevel;
 
 -- Reset the log level for a specific layer
-CREATE PROCEDURE logging.resetlayerlevel(layer INT)
+CREATE PROCEDURE logging.resetlayerlevel(layer_id INT)
   

MonetDB: gdk_tracer - Merge with default and replaced fprintf

2019-12-12 Thread Thodoris Zois
Changeset: 31702b3a51c6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=31702b3a51c6
Added Files:
sql/test/BugTracker-2019/Tests/json-text-empty-separator.Bug-6798.sql

sql/test/BugTracker-2019/Tests/json-text-empty-separator.Bug-6798.stable.err

sql/test/BugTracker-2019/Tests/json-text-empty-separator.Bug-6798.stable.out
sql/test/BugTracker-2019/Tests/python3-udf-modules.Bug-6797.sql
sql/test/BugTracker-2019/Tests/python3-udf-modules.Bug-6797.stable.err
sql/test/BugTracker-2019/Tests/python3-udf-modules.Bug-6797.stable.out
sql/test/mergetables/Tests/sqlsmith.Bug-6480.reqtests
sql/test/mergetables/Tests/transaction-conflict.py
sql/test/mergetables/Tests/transaction-conflict.stable.err
sql/test/mergetables/Tests/transaction-conflict.stable.out
Modified Files:
MonetDB.spec
buildtools/doc/windowsbuild.rst
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
common/utils/msabaoth.c
debian/monetdb5-server.install
debian/monetdb5-sql.install
geom/sql/functions/Tests/ST_AsEWKT.stable.out
geom/sql/functions/Tests/ST_AsText.stable.out
geom/sql/functions/Tests/ST_Boundary.stable.out
geom/sql/functions/Tests/ST_Contains.stable.out
geom/sql/functions/Tests/ST_CoordDim.stable.out
geom/sql/functions/Tests/ST_Dimension.stable.out
geom/sql/functions/Tests/ST_GeomFromText.stable.out
geom/sql/functions/Tests/ST_GeometryN.stable.out
geom/sql/functions/Tests/ST_GeometryType.stable.out
geom/sql/functions/Tests/ST_IsClosed.stable.out
geom/sql/functions/Tests/ST_IsEmpty.stable.out
geom/sql/functions/Tests/ST_IsRing.stable.out
geom/sql/functions/Tests/ST_IsSimple.stable.out
geom/sql/functions/Tests/ST_IsValid.stable.out
geom/sql/functions/Tests/ST_LineFromText.stable.out
geom/sql/functions/Tests/ST_MLineFromText.stable.out
geom/sql/functions/Tests/ST_MPointFromText.stable.out
geom/sql/functions/Tests/ST_MPolygonFromText.stable.out
geom/sql/functions/Tests/ST_MakeBox2D.stable.out
geom/sql/functions/Tests/ST_MakePoint.stable.out
geom/sql/functions/Tests/ST_NPoints.stable.out
geom/sql/functions/Tests/ST_NRings.stable.out
geom/sql/functions/Tests/ST_NumGeometries.stable.out
geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
geom/sql/functions/Tests/ST_NumPoints.stable.out
geom/sql/functions/Tests/ST_PointFromText.stable.out
geom/sql/functions/Tests/ST_PolygonFromText.stable.out
geom/sql/functions/Tests/XYZ.stable.out
geom/sql/functions/Tests/XYZMinMax.stable.out
monetdb5/mal/Makefile.ag
monetdb5/mal/mal.c
monetdb5/mal/mal.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/modules/atoms/json.c
monetdb5/modules/mal/wlc.c
monetdb5/modules/mal/wlc.h
monetdb5/modules/mal/wlc.mal
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_jit.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_volcano.c
monetdb5/optimizer/opt_wlc.c
monetdb5/optimizer/opt_wlc.h
monetdb5/optimizer/optimizer.c
monetdb5/optimizer/optimizer.h
monetdb5/optimizer/optimizer.mal
sql/backends/monet5/Tests/pyapi08.sql
sql/backends/monet5/UDF/udf/Tests/udf-fuse.stable.out
sql/backends/monet5/UDF/udf/Tests/udf-reverse.stable.out
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/vaults/bam/Tests/bam_lib.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.1.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.10.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.11.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.2.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.2.stable.out.int128
sql/backends/monet5/vaults/bam/Tests/query2.5.stable.out
sql/backends/monet5/vaults/bam/Tests/query2.5.stable.out.int128
sql/backends/monet5/vaults/bam/Tests/query2.8.stable.out
sql/benchmarks/tpcds/Tests/02.stable.out
sql/benchmarks/tpcds/Tests/02.stable.out.int128
sql/benchmarks/tpcds/Tests/03.stable.out
sql/benchmarks/tpcds/Tests/03.stable.out.int128
sql/benchmarks/tpcds/Tests/06.stable.out
sql/benchmarks/tpcds/Tests/07.stable.out

MonetDB: gdk_tracer - Changed logging.showinfo() output message

2019-12-12 Thread Thodoris Zois
Changeset: 267bbffea763 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=267bbffea763
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Changed logging.showinfo() output message


diffs (58 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -544,18 +544,28 @@ GDKtracer_show_info(void)
 max_width = comp_width;
 }
 
-GDK_TRACER_OSTREAM("# LOG level per component\n");
+
GDK_TRACER_OSTREAM("\n###\n");
+GDK_TRACER_OSTREAM("# Available logging levels\n");
+for(i = 0; i < LOG_LEVELS_COUNT; i++)
+{
+GDK_TRACER_OSTREAM("# (%d) %s\n", i, LEVEL_STR[i]);
+}
+
+GDK_TRACER_OSTREAM("\n# You can use one of the following layers to 
massively set the LOG level\n");
+for(i = 0; i < LAYERS_COUNT; i++)
+{
+GDK_TRACER_OSTREAM("# (%d) %s\n", i, LAYER_STR[i]);
+}
+
+GDK_TRACER_OSTREAM("\n# LOG level per component\n");
 for(i = 0; i < COMPONENTS_COUNT; i++)
 {
 space = (int) (max_width - strlen(COMPONENT_STR[i]) + 30);
-GDK_TRACER_OSTREAM("# %s %*s\n", COMPONENT_STR[i], space, 
LEVEL_STR[LVL_PER_COMPONENT[i]]);
+if(i < 10)
+GDK_TRACER_OSTREAM("# (%d)  %s %*s\n", i, COMPONENT_STR[i], space, 
LEVEL_STR[LVL_PER_COMPONENT[i]]);
+else
+GDK_TRACER_OSTREAM("# (%d) %s %*s\n", i, COMPONENT_STR[i], space, 
LEVEL_STR[LVL_PER_COMPONENT[i]]);
 }
-
-GDK_TRACER_OSTREAM("# You can use one of the following layers to massively 
set the LOG level\n");
-for(i = 0; i < LAYERS_COUNT; i++)
-{
-GDK_TRACER_OSTREAM("# %s\n", LAYER_STR[i]);
-}
-
+
GDK_TRACER_OSTREAM("###\n");
 return GDK_SUCCEED;
 }
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -351,8 +351,11 @@ gdk_tracer;
 
 // Produces messages to the output stream. It is also used as a fallback 
mechanism 
 // in case GDKtracer fails to log for whatever reason.
-#define GDK_TRACER_OSTREAM(MSG, ...)\
-mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
+#define GDK_TRACER_OSTREAM(MSG, ...)\
+do {\
+mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
+} while (0) \
+
 
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Removed tracer00 mal from modules/mal/Tests

2019-12-10 Thread Thodoris Zois
Changeset: 602610b5d967 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=602610b5d967
Removed Files:
monetdb5/modules/mal/Tests/tracer00.malC
Branch: gdk_tracer
Log Message:

Removed tracer00 mal from modules/mal/Tests


diffs (137 lines):

diff --git a/monetdb5/modules/mal/Tests/tracer00.malC 
b/monetdb5/modules/mal/Tests/tracer00.malC
deleted file mode 100644
--- a/monetdb5/modules/mal/Tests/tracer00.malC
+++ /dev/null
@@ -1,132 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
-#
-# Test SQL API for TRACER:
-# In some test cases (marked with #WARNING) the argument used is supposed to 
be 
-# an enum entry used to count the number of elements (e.g: COMPONENTS_COUNT in 
-# gdk_tracer.h). Thus, in those cases an error should be raised. However, 
adding 
-# new entries to the enum will affect the marked test cases and they won't 
fail.
-
-
-# logging.setcomplevel(...)
-logging.setcomplevel(-1, 1);# Should raise an error
-# Component -1 does not exist
-
-logging.setcomplevel(3, -1);# Should raise an error
-# Log level -1 does not exist
-
-logging.setcomplevel(-10, -1);  # Should raise an error
-# Component -10 does not exist
-# Log level -1 does not exist
-
-# WARNING
-logging.setcomplevel(1, 5); # Should raise an error
-# The last level is used for enum count
-
-# WARNING
-logging.setcomplevel(98, 3);# Should raise an error
-# The last component is used for enum count
-
-# WARNING
-logging.setcomplevel(98, 5);# Should raise an error
-# The last component is used for enum count
-# The last level is used for enum count
-
-logging.setcomplevel(1, 4); # OK
-
-
-
-# logging.resetcomplevel(...)
-logging.resetcomplevel(-1); # Should raise an error
-# Component -1 does not exist
-
-# WARNING
-logging.resetcomplevel(98); # Should raise an error
-# The last component is used for enum count
-
-logging.resetcomplevel(1);  # OK
-
-
-
-# logging.setlayerlevel(...)
-logging.setlayerlevel(-1, 1);   # Should raise an error
-# Layer -1 does not exist
-
-logging.setlayerlevel(2, -1);   # Should raise an error
-# Log level -1 does not exist
-
-logging.setlayerlevel(-10, -1); # Should raise an error
-# Layer -10 does not exist
-# Log level -1 does not exist
-
-# WARNING
-logging.setlayerlevel(4, 2);# Should raise an error
-# The last layer is used for enum count
-
-# WARNING
-logging.setlayerlevel(1, 5);# Should raise an error
-# The last level is used for enum count
-
-# WARNING
-logging.setlayerlevel(4, 5);# Should raise an error
-# The last layer is used for enum count
-# The last level is used for enum count
-
-logging.setlayerlevel(1, 2);# OK
-
-
-
-# logging.resetlayerlevel(...)
-logging.resetlayerlevel(-1);# Should raise an error
-# Layer -1 does not exist
-
-# WARNING
-logging.resetlayerlevel(4); # Should raise an error
-# The last layer is used for enum count   
-
-logging.resetlayerlevel(1); # OK
-
-
-
-# logging.setflushlevel(...)
-logging.setflushlevel(-1); # Should raise an error
-   # Level -1 does not exist
-
-# WARNING
-logging.setflushlevel(5);  # Should raise an error
-   # The last level is used for enum count
-
-logging.setflushlevel(3);  # OK
-
-
-
-logging.resetflushlevel();
-
-
-
-# logging.setadapter(...)
-logging.setadapter(-1);# Should raise an error
-   # Adapter -1 does not exist
-
-# WARNING
-logging.setadapter(2); # Should raise an error
-   # The last adapter is used for enum count
-
-logging.setadapter(1); # OK
-
-
-
-logging.resetadapter();
-
-
-
-# log & flush
-logging.log();
-logging.flush();
-
-
-# Show log levels etc
-logging.showinfo();
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added new line

2019-12-10 Thread Thodoris Zois
Changeset: e1cc20fe133b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e1cc20fe133b
Modified Files:
monetdb5/mal/Tests/All
Branch: gdk_tracer
Log Message:

Added new line


diffs (10 lines):

diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -196,4 +196,4 @@ pithole
 malids
 
 # Tracer
-tracer00
\ No newline at end of file
+tracer00
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added tracer00.malC to the test files and ...

2019-12-10 Thread Thodoris Zois
Changeset: 14c3f53e58d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=14c3f53e58d8
Added Files:
monetdb5/mal/Tests/tracer00.malC
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
monetdb5/mal/Tests/All
Branch: gdk_tracer
Log Message:

Added tracer00.malC to the test files and removed approved output (was done by 
hand)


diffs (189 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11252,7 +11252,6 @@ stdout of test 'MAL-signatures` in direc
 [ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Set the log level for 
a specific component"]
 [ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Set the 
flush level"   ]
 [ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Set the log level for a specific layer"
]
-[ "logging",   "showinfo", "command logging.showinfo():void ", 
"TRACERshow_info;", "Show logging levels per component and available 
layers"]
 [ "mal",   "manifold", "pattern mal.manifold(mod:str, fcn:str, 
a:any...):bat[:any] ",  "MANIFOLDevaluate;",""  ]
 [ "mal",   "multiplex","pattern mal.multiplex(mod:str, fcn:str, 
a:any...):any... ","MANIFOLDremapMultiplex;",  ""  ]
 [ "manual","functions","pattern manual.functions() (mod:bat[:str], 
fcn:bat[:str], sig:bat[:str], adr:bat[:str], com:bat[:str]) ",  
"MANUALcreateOverview;","Produces a table with all MAL functions known" 
]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -15654,7 +15654,6 @@ stdout of test 'MAL-signatures` in direc
 [ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Set the log level for 
a specific component"]
 [ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Set the 
flush level"   ]
 [ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Set the log level for a specific layer"
]
-[ "logging",   "showinfo", "command logging.showinfo():void ", 
"TRACERshow_info;", "Show logging levels per component and available 
layers"]
 [ "mal",   "manifold", "pattern mal.manifold(mod:str, fcn:str, 
a:any...):bat[:any] ",  "MANIFOLDevaluate;",""  ]
 [ "mal",   "multiplex","pattern mal.multiplex(mod:str, fcn:str, 
a:any...):any... ","MANIFOLDremapMultiplex;",  ""  ]
 [ "manual","functions","pattern manual.functions() (mod:bat[:str], 
fcn:bat[:str], sig:bat[:str], adr:bat[:str], com:bat[:str]) ",  
"MANUALcreateOverview;","Produces a table with all MAL functions known" 
]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -286,6 +286,7 @@ ssize_t GDKstrFromStr(unsigned char *res
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
+void GDKtracerinfo(void);
 size_t GDKuniqueid(size_t offset);
 gdk_return GDKupgradevarheap(BAT *b, var_t v, bool copyall, bool mayshare) 
__attribute__((__warn_unused_result__));
 lng GDKusec(void);
@@ -1882,7 +1883,6 @@ str TRACERset_adapter(void *ret, int *ad
 str TRACERset_component_level(void *ret, int *comp, int *lvl);
 str TRACERset_flush_level(void *ret, int *lvl);
 str TRACERset_layer_level(void *ret, int *layer, int *lvl);
-str TRACERshow_info(void);
 int TRACEtable(Client cntxt, BAT **r);
 str TRNglobal_abort(bit *ret);
 str TRNglobal_commit(bit *ret);
diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -194,3 +194,6 @@ flowchk
 dynamicload
 pithole
 malids
+
+# Tracer
+tracer00
\ No newline at end of file
diff --git a/monetdb5/mal/Tests/tracer00.malC b/monetdb5/mal/Tests/tracer00.malC
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tracer00.malC
@@ -0,0 +1,132 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this

MonetDB: gdk_tracer - Compilation fix

2019-12-09 Thread Thodoris Zois
Changeset: 2b1140b98555 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b1140b98555
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Compilation fix


diffs (17 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -348,11 +348,11 @@ gdk_tracer;
 ## __VA_ARGS__);\
 
 
-// mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
+
 // Produces messages to the output stream. It is also used as a fallback 
mechanism 
 // in case GDKtracer fails to log for whatever reason.
 #define GDK_TRACER_OSTREAM(MSG, ...)\
-fprintf(stderr, MSG, ## __VA_ARGS__);   \
+mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
 
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added conditional logging macros and compi...

2019-12-09 Thread Thodoris Zois
Changeset: 31ee834dc17e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=31ee834dc17e
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
gdk/gdk_utils.c
monetdb5/optimizer/opt_inline.c
monetdb5/scheduler/run_memo.c
sql/storage/store.c
Branch: gdk_tracer
Log Message:

Added conditional logging macros and compilation fixes


diffs (239 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -424,9 +424,8 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 {
 MT_lock_unset();
 
-// GDK_TRACER_OSTREAM("Failed to write to the buffer 
(bytes_written = %d)\n", bytes_written);
-// Fallback logging mechanism 
-GDK_TRACER_OSTREAM("FALLBACK MECHANISM\n");
+// Failed to write to the buffer - bytes_written < 0
+// Fallback logging mechanism
 va_list va;
 va_start(va, fmt);
 GDK_TRACER_OSTREAM(fmt, va);
@@ -438,12 +437,12 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 {
 MT_lock_unset();
 
-GDK_TRACER_OSTREAM("Failed to write to the buffer (bytes_written = 
%d)\n", bytes_written);
-// Fallback logging mechanism 
-// va_list va;
-// va_start(va, fmt);
-// GDK_TRACER_OSTREAM("%s", fmt);
-// va_end(va);
+// Failed to write to the buffer - bytes_written < 0
+// Fallback logging mechanism
+va_list va;
+va_start(va, fmt);
+GDK_TRACER_OSTREAM(fmt, va);
+va_end(va);
 }
 
 // Flush the current buffer in case the event is 
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -219,43 +219,100 @@ extern LOG_LEVEL LVL_PER_COMPONENT[];
 
 // If the LOG_LEVEL of the message is one of the following: CRITICAL, ERROR or 
WARNING 
 // it is logged no matter the component. In any other case the component is 
taken into account
-#define GDK_TRACER_LOG(LOG_LEVEL, COMP, MSG, ...)\
-if(LOG_LEVEL == M_CRITICAL ||\
-   LOG_LEVEL == M_ERROR||\
-   LOG_LEVEL == M_WARNING  ||\
-   (LVL_PER_COMPONENT[COMP] >= LOG_LEVEL))   \
-{\
-GDKtracer_log(LOG_LEVEL, \
-"[%s] "  \
-"%-"MXW"s "  \
-"%"MXW"s:%d "\
-"%"MXW"s "   \
-"%-"MXW"s "  \
-"%-"MXW"s # "MSG,\
-GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),\
-__FILENAME__,\
-__FUNCTION__,\
-__LINE__,\
-LEVEL_STR[LOG_LEVEL],\
-COMPONENT_STR[COMP], \
-MT_thread_getname(), \
-## __VA_ARGS__); \
-}\
+#define IF_GDK_TRACER_LOG(LOG_LEVEL, COMP)\
+if(LOG_LEVEL == M_CRITICAL || \
+   LOG_LEVEL == M_ERROR|| \
+   LOG_LEVEL == M_WARNING  || \
+   (LVL_PER_COMPONENT[COMP] >= LOG_LEVEL))\
+
+#define GDK_TRACER_LOG_BODY(LOG_LEVEL, COMP, MSG, ...)\
+  GDKtracer_log(LOG_LEVEL,\
+"[%s] "   \
+"%-"MXW"s "   \
+"%"MXW"s:%d " \
+"%"MXW"s "\
+"%-"MXW"s "   \
+"%-"MXW"s # "MSG, \
+GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"), \
+__FILENAME__, \
+__FUNCTION__, \
+__LINE__,  

MonetDB: gdk_tracer - Accept new signatures

2019-12-09 Thread Thodoris Zois
Changeset: 7ab296a376f2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ab296a376f2
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
monetdb5/modules/mal/tracer.mal
Branch: gdk_tracer
Log Message:

Accept new signatures


diffs (45 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11252,6 +11252,7 @@ stdout of test 'MAL-signatures` in direc
 [ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Set the log level for 
a specific component"]
 [ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Set the 
flush level"   ]
 [ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Set the log level for a specific layer"
]
+[ "logging",   "showinfo", "command logging.showinfo():void ", 
"TRACERshow_info;", "Show logging levels per component and available 
layers"]
 [ "mal",   "manifold", "pattern mal.manifold(mod:str, fcn:str, 
a:any...):bat[:any] ",  "MANIFOLDevaluate;",""  ]
 [ "mal",   "multiplex","pattern mal.multiplex(mod:str, fcn:str, 
a:any...):any... ","MANIFOLDremapMultiplex;",  ""  ]
 [ "manual","functions","pattern manual.functions() (mod:bat[:str], 
fcn:bat[:str], sig:bat[:str], adr:bat[:str], com:bat[:str]) ",  
"MANUALcreateOverview;","Produces a table with all MAL functions known" 
]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -15654,6 +15654,7 @@ stdout of test 'MAL-signatures` in direc
 [ "logging",   "setcomplevel", "command logging.setcomplevel(comp:int, 
lvl:int):void ","TRACERset_component_level;",   "Set the log level for 
a specific component"]
 [ "logging",   "setflushlevel","command 
logging.setflushlevel(lvl:int):void ", "TRACERset_flush_level;",   "Set the 
flush level"   ]
 [ "logging",   "setlayerlevel","command 
logging.setlayerlevel(layer:int, lvl:int):void ",  
"TRACERset_layer_level;",   "Set the log level for a specific layer"
]
+[ "logging",   "showinfo", "command logging.showinfo():void ", 
"TRACERshow_info;", "Show logging levels per component and available 
layers"]
 [ "mal",   "manifold", "pattern mal.manifold(mod:str, fcn:str, 
a:any...):bat[:any] ",  "MANIFOLDevaluate;",""  ]
 [ "mal",   "multiplex","pattern mal.multiplex(mod:str, fcn:str, 
a:any...):any... ","MANIFOLDremapMultiplex;",  ""  ]
 [ "manual","functions","pattern manual.functions() (mod:bat[:str], 
fcn:bat[:str], sig:bat[:str], adr:bat[:str], com:bat[:str]) ",  
"MANUALcreateOverview;","Produces a table with all MAL functions known" 
]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1882,6 +1882,7 @@ str TRACERset_adapter(void *ret, int *ad
 str TRACERset_component_level(void *ret, int *comp, int *lvl);
 str TRACERset_flush_level(void *ret, int *lvl);
 str TRACERset_layer_level(void *ret, int *layer, int *lvl);
+str TRACERshow_info(void);
 int TRACEtable(Client cntxt, BAT **r);
 str TRNglobal_abort(bit *ret);
 str TRNglobal_commit(bit *ret);
diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -44,7 +44,7 @@ comment "Reset the adapter";
 
 command showinfo()
 address TRACERshow_info
-comment "Show logging levels per component and layers";
+comment "Show logging levels per component and available layers";
 
 # Exposed only in MAL layer - for testing
 command log()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Renamed TRACERshowinfo to TRACERshow_info ...

2019-12-09 Thread Thodoris Zois
Changeset: 309b4a7a49a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=309b4a7a49a4
Modified Files:
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
Branch: gdk_tracer
Log Message:

Renamed TRACERshowinfo to TRACERshow_info to match the signature of the other 
functions in tracer.h


diffs (36 lines):

diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -123,7 +123,7 @@ TRACERreset_adapter(void)
 
 
 str
-TRACERshowinfo(void)
+TRACERshow_info(void)
 {
 GDKtracer_show_info();
 return MAL_SUCCEED;
diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h
--- a/monetdb5/modules/mal/tracer.h
+++ b/monetdb5/modules/mal/tracer.h
@@ -26,7 +26,7 @@ mal_export str TRACERset_flush_level(voi
 mal_export str TRACERreset_flush_level(void);
 mal_export str TRACERset_adapter(void *ret, int *adapter);
 mal_export str TRACERreset_adapter(void);
-mal_export str TRACERshowinfo(void);
+mal_export str TRACERshow_info(void);
 
 // Exposed only in MAL layer - for testing
 mal_export str TRACERlog(void);
diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -43,7 +43,7 @@ address TRACERreset_adapter
 comment "Reset the adapter";
 
 command showinfo()
-address TRACERshowinfo
+address TRACERshow_info
 comment "Show logging levels per component and layers";
 
 # Exposed only in MAL layer - for testing
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added newline to tracer00.malC

2019-12-09 Thread Thodoris Zois
Changeset: 98106779710d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=98106779710d
Modified Files:
monetdb5/modules/mal/Tests/tracer00.malC
Branch: gdk_tracer
Log Message:

Added newline to tracer00.malC


diffs (10 lines):

diff --git a/monetdb5/modules/mal/Tests/tracer00.malC 
b/monetdb5/modules/mal/Tests/tracer00.malC
--- a/monetdb5/modules/mal/Tests/tracer00.malC
+++ b/monetdb5/modules/mal/Tests/tracer00.malC
@@ -129,4 +129,4 @@ logging.flush();
 
 
 # Show log levels etc
-logging.showinfo();
\ No newline at end of file
+logging.showinfo();
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Removed define debug in GDKtracer, removed...

2019-12-09 Thread Thodoris Zois
Changeset: 228e7b60eabe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=228e7b60eabe
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_tracer.c
gdk/gdk_utils.c
gdk/gdk_utils.h
monetdb5/modules/mal/Tests/tracer00.malC
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
sql/scripts/81_tracer.sql
tools/mserver/mserver5.c
Branch: gdk_tracer
Log Message:

Removed define debug in GDKtracer, removed GDKtracerinfo() and added SQL call 
to dump trace info on demand


diffs (171 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -286,7 +286,6 @@ ssize_t GDKstrFromStr(unsigned char *res
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
 void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
-void GDKtracerinfo(void);
 size_t GDKuniqueid(size_t offset);
 gdk_return GDKupgradevarheap(BAT *b, var_t v, bool copyall, bool mayshare) 
__attribute__((__warn_unused_result__));
 lng GDKusec(void);
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -17,8 +17,6 @@
 #include "gdk.h"
 #include "gdk_tracer.h"
 
-#define _GDKTRACER_DEBUG_
-
 // We need to get rid of macros defined in gdk.h. Those are using GDKtracer in 
order to produce 
 // messages. At the point malloc is called in gdk_tracer.c (in function 
_GDKtracer_fill_tracer)
 // a lock has already being acquired. Using the macro malloc in gdk.h a call 
to GDKtracer 
@@ -225,10 +223,6 @@ static gdk_return
 }
 }
 
-#ifdef _GDKTRACER_DEBUG_
-GDKtracer_show_info();
-#endif
-
 return GDK_SUCCEED;
 }
 
@@ -281,10 +275,6 @@ GDKtracer_set_component_level(int *comp,
 
 LVL_PER_COMPONENT[*comp] = level;
 
-#ifdef _GDKTRACER_DEBUG_
-GDKtracer_show_info();
-#endif
-
 return GDK_SUCCEED;
 }
 
@@ -434,12 +424,13 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 {
 MT_lock_unset();
 
-GDK_TRACER_OSTREAM("Failed to write to the buffer 
(bytes_written = %d)\n", bytes_written);
+// GDK_TRACER_OSTREAM("Failed to write to the buffer 
(bytes_written = %d)\n", bytes_written);
 // Fallback logging mechanism 
-// va_list va;
-// va_start(va, fmt);
-// GDK_TRACER_OSTREAM(fmt, va);
-// va_end(va);
+GDK_TRACER_OSTREAM("FALLBACK MECHANISM\n");
+va_list va;
+va_start(va, fmt);
+GDK_TRACER_OSTREAM(fmt, va);
+va_end(va);
 }
 }
 }
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1700,12 +1700,6 @@ GDKversion(void)
return (_gdk_version_string);
 }
 
-void
-GDKtracerinfo(void)
-{
-   GDKtracer_show_info();
-}
-
 size_t
 GDKmem_cursize(void)
 {
diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h
--- a/gdk/gdk_utils.h
+++ b/gdk/gdk_utils.h
@@ -19,8 +19,6 @@ gdk_export bool GDKgetenv_istrue(const c
 
 gdk_export int GDKgetenv_int(const char *name, int def);
 
-gdk_export void GDKtracerinfo(void);
-
 gdk_export gdk_return GDKsetenv(const char *name, const char *value);
 gdk_export gdk_return GDKcopyenv(BAT **key, BAT **val, bool writable);
 
diff --git a/monetdb5/modules/mal/Tests/tracer00.malC 
b/monetdb5/modules/mal/Tests/tracer00.malC
--- a/monetdb5/modules/mal/Tests/tracer00.malC
+++ b/monetdb5/modules/mal/Tests/tracer00.malC
@@ -126,3 +126,7 @@ logging.resetadapter();
 # log & flush
 logging.log();
 logging.flush();
+
+
+# Show log levels etc
+logging.showinfo();
\ No newline at end of file
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -122,6 +122,14 @@ TRACERreset_adapter(void)
 }
 
 
+str
+TRACERshowinfo(void)
+{
+GDKtracer_show_info();
+return MAL_SUCCEED;
+}
+
+
 // Exposed only in MAL layer - for testing
 str
 TRACERlog(void)
diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h
--- a/monetdb5/modules/mal/tracer.h
+++ b/monetdb5/modules/mal/tracer.h
@@ -26,6 +26,7 @@ mal_export str TRACERset_flush_level(voi
 mal_export str TRACERreset_flush_level(void);
 mal_export str TRACERset_adapter(void *ret, int *adapter);
 mal_export str TRACERreset_adapter(void);
+mal_export str TRACERshowinfo(void);
 
 // Exposed only in MAL layer - for testing
 mal_export str TRACERlog(void);
diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -42,6 +42,10 @@ command resetadapter()
 

MonetDB: gdk_tracer - Added define for debugging GDKtracer

2019-12-09 Thread Thodoris Zois
Changeset: ebf0b00d384b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ebf0b00d384b
Modified Files:
gdk/gdk_tracer.c
Branch: gdk_tracer
Log Message:

Added define for debugging GDKtracer


diffs (42 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -17,6 +17,8 @@
 #include "gdk.h"
 #include "gdk_tracer.h"
 
+#define _GDKTRACER_DEBUG_
+
 // We need to get rid of macros defined in gdk.h. Those are using GDKtracer in 
order to produce 
 // messages. At the point malloc is called in gdk_tracer.c (in function 
_GDKtracer_fill_tracer)
 // a lock has already being acquired. Using the macro malloc in gdk.h a call 
to GDKtracer 
@@ -222,11 +224,10 @@ static gdk_return
 }
 }
 }
-
-/* CHECK 
- * this should only be called if you wish to trace the GDKtracer
+
+#ifdef _GDKTRACER_DEBUG_
 GDKtracer_show_info();
-*/
+#endif
 
 return GDK_SUCCEED;
 }
@@ -279,10 +280,11 @@ GDKtracer_set_component_level(int *comp,
 return GDK_FAIL;
 
 LVL_PER_COMPONENT[*comp] = level;
-/* CHECK 
- * this should only be called if you wish to trace the GDKtracer
+
+#ifdef _GDKTRACER_DEBUG_
 GDKtracer_show_info();
-*/
+#endif
+
 return GDK_SUCCEED;
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Merge with default

2019-12-09 Thread Thodoris Zois
Changeset: 90dfaf335ec2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=90dfaf335ec2
Added Files:
sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql
sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err
sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out
sql/test/BugTracker-2019/Tests/could-not-allocate-space.Bug-6795.sql

sql/test/BugTracker-2019/Tests/could-not-allocate-space.Bug-6795.stable.err

sql/test/BugTracker-2019/Tests/could-not-allocate-space.Bug-6795.stable.out
sql/test/BugTracker-2019/Tests/python-aggregate-no-groups.Bug-6726.sql

sql/test/BugTracker-2019/Tests/python-aggregate-no-groups.Bug-6726.stable.err

sql/test/BugTracker-2019/Tests/python-aggregate-no-groups.Bug-6726.stable.out
sql/test/scanner/Tests/mserver_with_raw_strings.options5
sql/test/scanner/Tests/mserver_with_raw_strings.sql
sql/test/scanner/Tests/mserver_with_raw_strings.stable.err
sql/test/scanner/Tests/mserver_with_raw_strings.stable.out
sql/test/scanner/Tests/mserver_without_raw_strings.options5
sql/test/scanner/Tests/mserver_without_raw_strings.sql
sql/test/scanner/Tests/mserver_without_raw_strings.stable.err
sql/test/scanner/Tests/mserver_without_raw_strings.stable.out
Modified Files:
ChangeLog
clients/mapiclient/dump.c
clients/mapiclient/msqldump.c
common/options/monet_options.c
monetdb5/modules/mal/querylog.c
monetdb5/modules/mal/wlc.h
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_pipes.c
sql/backends/monet5/Tests/pyapi05.stable.out
sql/backends/monet5/Tests/rapi05.stable.out
sql/backends/monet5/UDF/pyapi/conversion.c
sql/backends/monet5/UDF/pyapi/convert_loops.h
sql/backends/monet5/UDF/pyapi/pyapi.c
sql/backends/monet5/UDF/pyapi/pyloader.c
sql/backends/monet5/UDF/pyapi/pytypes.c
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_05.stable.out
sql/backends/monet5/sql.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_upgrades.c
sql/include/sql_relation.h
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/sql_scan.c

sql/test/BugDay_2005-12-19_2.9.3/Tests/cast_bigint_to_int.SF-1211903.stable.out

sql/test/BugTracker-2008/Tests/decimal_cast_in_view.SF-2075223.stable.out
sql/test/BugTracker-2013/Tests/numeric-column-alias.Bug-3279.stable.out
sql/test/BugTracker-2014/Tests/missing_alias.Bug-3626.stable.out
sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out
sql/test/BugTracker-2015/Tests/string-to-inet.Bug-3666.stable.out

sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out

sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6219.stable.out
sql/test/BugTracker-2017/Tests/sqlsmith01.stable.out
sql/test/BugTracker-2018/Tests/convert-key.Bug-6648.stable.out

sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out
sql/test/BugTracker-2019/Tests/All
sql/test/BugTracker-2019/Tests/prepare-types.Bug-6724.stable.out
sql/test/BugTracker/Tests/convert_dec2varchar.SF-1774312.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
sql/test/Tests/keys.stable.out
sql/test/Tests/window_functions.stable.out
sql/test/bugs/Tests/cast_varchar2int-bug-sf-964165.stable.out
sql/test/emptydb/Tests/check.SQL.py
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/mergetables/Tests/mergeinit.stable.err
sql/test/mergetables/Tests/sqlsmith-exists.sql
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
sql/test/pg_regress/Tests/date.stable.out
sql/test/pg_regress/Tests/int8.stable.out
sql/test/pg_regress/Tests/int8.stable.out.int128
sql/test/scanner/Tests/All
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.out
sql/test/sys-schema/Tests/bam_tables_checks.stable.out
sql/test/sys-schema/Tests/check_MaxStrLength_violations.stable.out
tools/merovingian/client/monetdb.1
tools/merovingian/daemon/forkmserver.c
tools/merovingian/utils/properties.c
tools/mserver/mserver5.1.in

MonetDB: gdk_tracer - Disabled fallback mechanism when bytes_wri...

2019-12-05 Thread Thodoris Zois
Changeset: 6bdd899a4fdd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6bdd899a4fdd
Modified Files:
gdk/gdk_tracer.c
Branch: gdk_tracer
Log Message:

Disabled fallback mechanism when bytes_written < 0


diffs (45 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -426,21 +426,25 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 {
 MT_lock_unset();
 
+GDK_TRACER_OSTREAM("Failed to write to the buffer 
(bytes_written = %d)\n", bytes_written);
 // Fallback logging mechanism 
-va_list va;
-va_start(va, fmt);
-GDK_TRACER_OSTREAM(fmt, va);
-va_end(va);
+// va_list va;
+// va_start(va, fmt);
+// GDK_TRACER_OSTREAM(fmt, va);
+// va_end(va);
 }
 }
 }
 else
 {
+MT_lock_unset();
+
+GDK_TRACER_OSTREAM("Failed to write to the buffer (bytes_written = 
%d)\n", bytes_written);
 // Fallback logging mechanism 
-va_list va;
-va_start(va, fmt);
-GDK_TRACER_OSTREAM("%s", fmt);
-va_end(va);
+// va_list va;
+// va_start(va, fmt);
+// GDK_TRACER_OSTREAM("%s", fmt);
+// va_end(va);
 }
 
 // Flush the current buffer in case the event is 
@@ -513,7 +517,6 @@ GDKtracer_flush_buffer(void)
 active_tracer->allocated_size = 0;
 MT_lock_unset();
 
-/* WHY THE FCK YOU GET PRINTED 7 TIMES? */
 GDK_TRACER_OSTREAM("Using adapter: %s\n", ADAPTER_STR[(int) 
ATOMIC_GET(_ADAPTER)]);
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Merge with default

2019-12-05 Thread Thodoris Zois
Changeset: 79524514d874 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=79524514d874
Modified Files:
gdk/gdk_logger.c
sql/backends/monet5/rel_bin.c
sql/include/sql_relation.h
sql/rel.txt
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_planner.c
sql/server/rel_propagate.c
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_sequence.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
sql/server/sql_partition.c

sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-coalesce-error-message.Bug-6608.stable.err
sql/test/analytics/Tests/analytics00.stable.out
sql/test/analytics/Tests/analytics01.stable.out
sql/test/mergetables/Tests/sqlsmith-exists.sql
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
sql/test/miscellaneous/Tests/groupby_expressions.stable.err
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.err
Branch: gdk_tracer
Log Message:

Merge with default


diffs (truncated from 1711 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -80,6 +80,7 @@
 #define LOG_DESTROY_ID 14
 #define LOG_USE_ID 15
 #define LOG_CLEAR_ID   16
+#define LOG_UPDATE_PAX 17
 
 #ifdef NATIVE_WIN32
 #define getfilepos _ftelli64
@@ -114,6 +115,7 @@ static const char *log_commands[] = {
"LOG_DESTROY_ID",
"LOG_USE_ID",
"LOG_CLEAR_ID",
+   "LOG_UPDATE_PAX",
 };
 
 typedef struct logformat_t {
@@ -471,7 +473,7 @@ timestampRead(void *dst, stream *s, size
 #endif
 
 static log_return
-log_read_updates(logger *lg, trans *tr, logformat *l, char *name, int tpe, oid 
id)
+log_read_updates(logger *lg, trans *tr, logformat *l, char *name, int tpe, oid 
id, int pax)
 {
log_bid bid = logger_find_bat(lg, name, tpe, id);
BAT *b = BATdescriptor(bid);
@@ -576,7 +578,8 @@ log_read_updates(logger *lg, trans *tr, 
BATtseqbase(r, 0);
 
if (ht == TYPE_void && l->flag == LOG_INSERT) {
-   for (; res == LOG_OK && l->nr > 0; l->nr--) {
+   lng nr = l->nr;
+   for (; res == LOG_OK && nr > 0; nr--) {
void *t = rt(tv, lg->log, 1);
 
if (t == NULL) {
@@ -602,22 +605,66 @@ log_read_updates(logger *lg, trans *tr, 
if (hv == NULL)
res = LOG_ERR;
 
-   for (; res == LOG_OK && l->nr > 0; l->nr--) {
-   void *h = rh(hv, lg->log, 1);
-   void *t = rt(tv, lg->log, 1);
-
-   if (h == NULL)
-   res = LOG_EOF;
-   else if (t == NULL) {
-   if (strstr(GDKerrbuf, "malloc") == NULL)
+   if (!pax) {
+   lng nr = l->nr;
+   for (; res == LOG_OK && nr > 0; nr--) {
+   void *h = rh(hv, lg->log, 1);
+   void *t = rt(tv, lg->log, 1);
+
+   if (h == NULL)
res = LOG_EOF;
-   else
+   else if (t == NULL) {
+   if (strstr(GDKerrbuf, "malloc") 
== NULL)
+   res = LOG_EOF;
+   else
+   res = LOG_ERR;
+   } else if (BUNappend(uid, h, true) != 
GDK_SUCCEED ||
+   BUNappend(r, t, true) != 
GDK_SUCCEED)
res = LOG_ERR;
-   } else if (BUNappend(uid, h, true) != 
GDK_SUCCEED ||
-  BUNappend(r, t, true) != GDK_SUCCEED)
-   res = LOG_ERR;
-   if (t != tv)
-   GDKfree(t);
+   if (t != tv)
+   GDKfree(t);
+   }
+   } else {
+   char compressed = 0;
+   lng nr = l->nr;
+
+   if (mnstr_read(lg->log, , 1, 1) != 1)
+   return LOG_ERR;
+
+   

MonetDB: gdk_tracer - Fixed a bug that was causing mserver5 to h...

2019-12-05 Thread Thodoris Zois
Changeset: 19095a899246 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=19095a899246
Modified Files:
gdk/gdk_tracer.c
Branch: gdk_tracer
Log Message:

Fixed a bug that was causing mserver5 to hang and added locks to flush_buffer - 
it can be called separately


diffs (190 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -28,8 +28,9 @@
 #undef free
 #endif
 
-static gdk_tracer tracer = { .allocated_size = 0, .id = 0 };
-static MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer");
+static gdk_tracer tracer = { .id = 0, .allocated_size = 0 };
+static gdk_tracer *active_tracer = 
+MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer_1");
 
 static FILE *output_file;
 static bool USE_STREAM = true;
@@ -383,52 +384,64 @@ GDKtracer_reset_adapter(void)
 gdk_return
 GDKtracer_log(LOG_LEVEL level, char *fmt, ...)
 {  
-gdk_tracer *fill_tracer;
 int bytes_written = 0;
 
 MT_lock_set();
+
+va_list va;
+va_start(va, fmt);
+bytes_written = _GDKtracer_fill_tracer(active_tracer, fmt, va);
+va_end(va);
+
+if(bytes_written >= 0)
 {
-fill_tracer = 
-
-va_list va;
-va_start(va, fmt);
-bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
-va_end(va);
-
-if(bytes_written < 0)
+// The message fits the buffer OR the buffer is empty but the message 
does not fit (we cut it off)
+if(bytes_written < (BUFFER_SIZE - active_tracer->allocated_size) || 
+active_tracer->allocated_size == 0)
 {
-// Catch the exception and use the fallback mechanism for logging
-va_list va;
-va_start(va, fmt);
-GDK_TRACER_OSTREAM(fmt, va);
-va_end(va);
+active_tracer->allocated_size += bytes_written;
+MT_lock_unset();
 }
 else
 {
-// The message fits the buffer OR the buffer is empty but the 
message does not fit (we cut it off)
-if(bytes_written < (BUFFER_SIZE - fill_tracer->allocated_size) || 
-fill_tracer->allocated_size == 0)
+MT_lock_unset();
+
+GDKtracer_flush_buffer();
+
+MT_lock_set();
+va_list va;
+va_start(va, fmt);
+bytes_written = _GDKtracer_fill_tracer(active_tracer, fmt, va);
+va_end(va);
+
+if(bytes_written >= 0)
 {
-fill_tracer->allocated_size += bytes_written;
+// The second buffer will always be empty at start
+// So if the message does not fit we cut it off
+// message might be > BUFFER_SIZE
+active_tracer->allocated_size += bytes_written;  
+MT_lock_unset();
 }
 else
 {
-GDKtracer_flush_buffer();
+MT_lock_unset();
 
-// Write to the new tracer
+// Fallback logging mechanism 
 va_list va;
 va_start(va, fmt);
-bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
+GDK_TRACER_OSTREAM(fmt, va);
 va_end(va);
-
-// The second buffer will always be empty at start
-// So if the message does not fit we cut it off
-// message might be > BUFFER_SIZE
-fill_tracer->allocated_size += bytes_written;  
 }
 }
 }
-MT_lock_unset();
+else
+{
+// Fallback logging mechanism 
+va_list va;
+va_start(va, fmt);
+GDK_TRACER_OSTREAM("%s", fmt);
+va_end(va);
+}
 
 // Flush the current buffer in case the event is 
 // important depending on the flush-level
@@ -450,43 +463,57 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 gdk_return
 GDKtracer_flush_buffer(void)
 {
-// Select a tracer
-gdk_tracer *fl_tracer = 
-
 // No reason to flush a buffer with no content 
-if(fl_tracer->allocated_size == 0)
+MT_lock_set();
+if(active_tracer->allocated_size == 0)
+{
+MT_lock_unset();
 return GDK_SUCCEED;
+}
+MT_lock_unset();
 
 if(ATOMIC_GET(_ADAPTER) == BASIC)
 {
-// Check if file is open - if not send the output to GDKstdout. There 
are cases that 
-// this is needed - e.g: on startup of mserver5 GDKmalloc is called 
before GDKinit. 
-// In GDKinit GDKtracer is getting initialized (open_file and 
initialize log level 
-// per component). Since the file is not open yet and there is an 
assert, we need 
-// to do something - and as a backup plan we send the logs to 
GDKstdout.
-if(output_file)
+MT_lock_set();
 {
-size_t nitems = 1;
-size_t w = fwrite(_tracer->buffer, fl_tracer->allocated_size, 
nitems, output_file);
+

MonetDB: gdk_tracer - Merge with default

2019-12-04 Thread Thodoris Zois
Changeset: c8afbe243112 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8afbe243112
Modified Files:
NT/monetdb_config.h.in
configure.ag
gdk/gdk_batop.c
gdk/gdk_posix.c
monetdb5/extras/rapi/rapi.c
sql/backends/monet5/sql_rank.c
sql/include/sql_catalog.h
sql/include/sql_relation.h
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/sql_semantic.c
sql/storage/bat/bat_logger.c

sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out

sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out
sql/test/analytics/Tests/analytics01.stable.out
sql/test/mergetables/Tests/sqlsmith-exists.sql
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.err
Branch: gdk_tracer
Log Message:

Merge with default


diffs (truncated from 1312 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -394,9 +394,6 @@
 /* Define if semtimedop exists */
 /* #undef HAVE_SEMTIMEDOP */
 
-/* Define to 1 if you have the `setenv' function. */
-/* #undef HAVE_SETENV */
-
 /* Define to 1 if you have the `setsid' function. */
 /* #undef HAVE_SETSID */
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2427,7 +2427,6 @@ AC_CHECK_FUNCS([\
posix_fallocate \
posix_madvise \
putenv \
-   setenv \
setsid \
shutdown \
sigaction \
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -840,6 +840,10 @@ BATdel(BAT *b, BAT *d)
 gdk_return
 BATreplace(BAT *b, BAT *p, BAT *n, bool force)
 {
+   lng t0 = 0;
+
+   ALGODEBUG t0 = GDKusec();
+
if (b == NULL || b->ttype == TYPE_void || p == NULL || n == NULL) {
return GDK_SUCCEED;
}
@@ -988,6 +992,87 @@ BATreplace(BAT *b, BAT *p, BAT *n, bool 
 #endif
}
}
+   } else if (BATtdense(p)) {
+   oid updid = BUNtoid(p, 0);
+
+   if (updid < b->hseqbase || updid + BATcount(p) > hseqend) {
+   GDKerror("BATreplace: id out of range\n");
+   return GDK_FAIL;
+   }
+   updid -= b->hseqbase;
+   if (!force && updid < b->batInserted) {
+   GDKerror("BATreplace: updating committed value\n");
+   return GDK_FAIL;
+   }
+
+   /* we copy all of n, so if there are nils in n we get
+* nils in b (and else we don't know) */
+   b->tnil = n->tnil;
+   /* we may not copy over all of b, so we only know that
+* there are no nils in b afterward if there weren't
+* any in either b or n to begin with */
+   b->tnonil &= n->tnonil;
+   if (n->ttype == TYPE_void) {
+   assert(b->ttype == TYPE_oid);
+   oid *o = Tloc(b, updid);
+   if (is_oid_nil(n->tseqbase)) {
+   /* we may or may not overwrite the old
+* min/max values */
+   BATrmprop(b, GDK_MAX_VALUE);
+   BATrmprop(b, GDK_MIN_VALUE);
+   for (BUN i = 0, j = BATcount(p); i < j; i++)
+   o[i] = oid_nil;
+   b->tnil = true;
+   } else {
+   oid v = n->tseqbase;
+   /* we know min/max of n, so we know
+* the new min/max of b if those of n
+* are smaller/larger than the old */
+   if (minprop && v <= minprop->v.val.oval)
+   BATsetprop(b, GDK_MIN_VALUE, TYPE_oid, 
);
+   else
+   BATrmprop(b, GDK_MIN_VALUE);
+   for (BUN i = 0, j = BATcount(p); i < j; i++)
+   o[i] = v++;
+   if (maxprop && --v >= maxprop->v.val.oval)
+   BATsetprop(b, GDK_MAX_VALUE, TYPE_oid, 
);
+   else
+   BATrmprop(b, GDK_MAX_VALUE);
+   }
+   } else {
+   /* if the extremes of n are at least as
+* extreme as those of b, we can replace b's
+

MonetDB: gdk_tracer - Aligned columns in log (as much as possible)

2019-12-04 Thread Thodoris Zois
Changeset: a9c537284069 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a9c537284069
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Aligned columns in log (as much as possible)


diffs (140 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -4,18 +4,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
- *
- * The tracer is the general logging system for the MonetDB stack.
- * It is modelled after well-known logging schems, eg. Python
- *
- * Internally, the logger uses a dual buffer to capture log messages
- * before they are written to a file. This way we avoid serial execution.
- *
- * The logger files come in two as well, where we switch them 
- * once the logger is full.
- * The logger file format is "tracer_YY-MM-DDTHH:MM:SS_number.log"
- * An option to consider is we need a rotating scheme over 2 files only,
- * Moreover, old log files might be sent in the background to long term 
storage as well.
  */
 
 #include 
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -4,6 +4,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+ * 
+ * REWRITE ->
+ * The tracer is the general logging system for the MonetDB stack.
+ * It is modelled after well-known logging schems, eg. Python
+ *
+ * Internally, the logger uses a dual buffer to capture log messages
+ * before they are written to a file. This way we avoid serial execution.
+ *
+ * The logger files come in two as well, where we switch them 
+ * once the logger is full.
+ * The logger file format is "tracer_YY-MM-DDTHH:MM:SS_number.log"
+ * An option to consider is we need a rotating scheme over 2 files only,
+ * Moreover, old log files might be sent in the background to long term 
storage as well.
+ * 
  */
 
 #ifndef _GDK_TRACER_H_
@@ -20,6 +34,10 @@
 #define NAME_SEP '_'
 #define NULL_CHAR '\0'
 #define NEW_LINE '\n'
+#define MXW "20"
+
+#define AS_STR(x) #x
+#define STR(x) AS_STR(x)
 
 #define __FILENAME__ (__builtin_strrchr(__FILE__, DIR_SEP) ? 
__builtin_strrchr(__FILE__, DIR_SEP) + 1 : __FILE__)
 
@@ -208,7 +226,12 @@ extern LOG_LEVEL LVL_PER_COMPONENT[];
(LVL_PER_COMPONENT[COMP] >= LOG_LEVEL))   \
 {\
 GDKtracer_log(LOG_LEVEL, \
-"[%s] %s %s:%d %s %s %s # "MSG,  \
+"[%s] "  \
+"%-"MXW"s "  \
+"%"MXW"s:%d "\
+"%"MXW"s "   \
+"%-"MXW"s "  \
+"%-"MXW"s # "MSG,\
 GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),\
 __FILENAME__,\
 __FUNCTION__,\
@@ -247,17 +270,25 @@ gdk_tracer;
 
 
 /*
- * GDKtracer Stream Usage
+ * GDKtracer Stream Macros
  */
 // Exception
-#define GDK_TRACER_REPORT_EXCEPTION(MSG, ...)\
-mnstr_printf(GDKstdout, "[%s] %s %s:%d M_CRITICAL GDK_TRACER %s # "MSG,  \
-GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),\
-__FILENAME__,\
-__FUNCTION__,\
-__LINE__,\
-MT_thread_getname(), \
-## __VA_ARGS__); \
+#define GDK_TRACER_REPORT_EXCEPTION(MSG, ...)   \
+mnstr_printf(GDKstdout, \
+   "[%s] "  \
+   "%-"MXW"s "  \
+   "%"MXW"s:%d "\
+   "%"MXW"s "   \
+   "%-"MXW"s "  \
+   "%-"MXW"s # "MSG,\
+GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),   \
+__FILENAME__,   \
+__FUNCTION__,  

MonetDB: gdk_tracer - Changes to exception handling & added a ma...

2019-12-04 Thread Thodoris Zois
Changeset: 393c48b0e61d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=393c48b0e61d
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Changes to exception handling & added a macro that sends messages to GDKstdout


diffs (105 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -409,9 +409,11 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 
 if(bytes_written < 0)
 {
-GDK_TRACER_REPORT_EXCEPTION("Cannot write data to the buffer, 
discarding this entry\n");
-/* CHECK */
-// Maybe here add return GDK_FAIL?
+// Catch the exception and use the fallback mechanism for logging
+va_list va;
+va_start(va, fmt);
+GDK_TRACER_OSTREAM(fmt, va);
+va_end(va);
 }
 else
 {
@@ -476,27 +478,20 @@ GDKtracer_flush_buffer(void)
 // to do something - and as a backup plan we send the logs to 
GDKstdout.
 if(output_file)
 {
-/* CHECK */
-// This should be working!
-// size_t w = fwrite(_tracer->buffer, 
fl_tracer->allocated_size, 1, output_file);
+size_t nitems = 1;
+size_t w = fwrite(_tracer->buffer, fl_tracer->allocated_size, 
nitems, output_file);
 
-// fwrite failed for whatever reason 
-// (e.g: disk is full) fallback to stream
-// if(w == (size_t) fl_tracer->allocated_size)
-// {   
-// USE_STREAM = false;
-// fflush(output_file);
-// }
-
-fwrite(_tracer->buffer, fl_tracer->allocated_size, 1, 
output_file);
-fflush(output_file);
-USE_STREAM = false;
+if(w == nitems)
+{   
+USE_STREAM = false;
+fflush(output_file);
+}
 }
 
-// Write buffer to a stream
+// fwrite failed for whatever reason 
+// (e.g: disk is full) fallback to stream
 if(USE_STREAM)
-mnstr_printf(GDKstdout, "%s", fl_tracer->buffer);
-
+GDK_TRACER_OSTREAM("%s", fl_tracer->buffer);
 
 // Reset buffer
 memset(fl_tracer->buffer, 0, BUFFER_SIZE);
@@ -504,7 +499,7 @@ GDKtracer_flush_buffer(void)
 }
 else
 {
-mnstr_printf(GDKstdout, "Using adapter: %s", ADAPTER_STR[(int) 
ATOMIC_GET(_ADAPTER)]);
+GDK_TRACER_OSTREAM("Using adapter: %s\n", ADAPTER_STR[(int) 
ATOMIC_GET(_ADAPTER)]);
 }
 
 // The file is kept open no matter the adapter
@@ -533,17 +528,17 @@ GDKtracer_show_info(void)
 max_width = comp_width;
 }
 
-mnstr_printf(GDKstdout, "# LOG level per component\n");
+GDK_TRACER_OSTREAM("# LOG level per component\n");
 for(i = 0; i < COMPONENTS_COUNT; i++)
 {
 space = (int) (max_width - strlen(COMPONENT_STR[i]) + 30);
-mnstr_printf(GDKstdout, "# %s %*s\n", COMPONENT_STR[i], space, 
LEVEL_STR[LVL_PER_COMPONENT[i]]);
+GDK_TRACER_OSTREAM("# %s %*s\n", COMPONENT_STR[i], space, 
LEVEL_STR[LVL_PER_COMPONENT[i]]);
 }
 
-mnstr_printf(GDKstdout, "# You can use one of the following layers to 
massively set the LOG level\n");
+GDK_TRACER_OSTREAM("# You can use one of the following layers to massively 
set the LOG level\n");
 for(i = 0; i < LAYERS_COUNT; i++)
 {
-mnstr_printf(GDKstdout, "# %s\n", LAYER_STR[i]);
+GDK_TRACER_OSTREAM("# %s\n", LAYER_STR[i]);
 }
 
 return GDK_SUCCEED;
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -259,6 +259,14 @@ gdk_tracer;
 MT_thread_getname(), \
 ## __VA_ARGS__); \
 
+
+// Produces messages to the output stream. It is also used as a fallback 
mechanism 
+// in case GDKtracer fails to log for whatever reason.
+#define GDK_TRACER_OSTREAM(MSG, ...)\
+mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__);   \
+
+
+
 /*
  *  GDKtracer API
  */
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added some test cases, exposed GDKtracer_l...

2019-12-03 Thread Thodoris Zois
Changeset: 94305ef7b1f1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94305ef7b1f1
Modified Files:
monetdb5/modules/mal/Tests/tracer00.malC
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.mal
Branch: gdk_tracer
Log Message:

Added some test cases, exposed GDKtracer_log for testing only to the MAL layer


diffs (30 lines):

diff --git a/monetdb5/modules/mal/Tests/tracer00.malC 
b/monetdb5/modules/mal/Tests/tracer00.malC
--- a/monetdb5/modules/mal/Tests/tracer00.malC
+++ b/monetdb5/modules/mal/Tests/tracer00.malC
@@ -125,4 +125,4 @@ logging.resetadapter();
 
 # log & flush
 logging.log();
-logging.flush();
\ No newline at end of file
+logging.flush();
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -130,4 +130,4 @@ TRACERlog(void)
 TRC_INFO(MAL_DATAFLOW, "An INFO message\n");
 
 return MAL_SUCCEED;
-}
\ No newline at end of file
+}
diff --git a/monetdb5/modules/mal/tracer.mal b/monetdb5/modules/mal/tracer.mal
--- a/monetdb5/modules/mal/tracer.mal
+++ b/monetdb5/modules/mal/tracer.mal
@@ -45,4 +45,4 @@ comment "Reset the adapter";
 # Exposed only in MAL layer - for testing
 command log()
 address TRACERlog
-comment "Create a log message";
\ No newline at end of file
+comment "Create a log message";
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added some test cases, exposed GDKtracer_l...

2019-12-03 Thread Thodoris Zois
Changeset: 427934ea7ca0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=427934ea7ca0
Modified Files:
gdk/gdk_tracer.c
monetdb5/modules/mal/Tests/tracer00.malC
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/tracer.h
monetdb5/modules/mal/tracer.mal
Branch: gdk_tracer
Log Message:

Added some test cases, exposed GDKtracer_log for testing only to the MAL layer


diffs (212 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -545,4 +545,6 @@ GDKtracer_show_info(void)
 {
 mnstr_printf(GDKstdout, "# %s\n", LAYER_STR[i]);
 }
+
+return GDK_SUCCEED;
 }
diff --git a/monetdb5/modules/mal/Tests/tracer00.malC 
b/monetdb5/modules/mal/Tests/tracer00.malC
--- a/monetdb5/modules/mal/Tests/tracer00.malC
+++ b/monetdb5/modules/mal/Tests/tracer00.malC
@@ -1,4 +1,15 @@
-# Test SQL API for TRACER
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#
+# Test SQL API for TRACER:
+# In some test cases (marked with #WARNING) the argument used is supposed to 
be 
+# an enum entry used to count the number of elements (e.g: COMPONENTS_COUNT in 
+# gdk_tracer.h). Thus, in those cases an error should be raised. However, 
adding 
+# new entries to the enum will affect the marked test cases and they won't 
fail.
+
 
 # logging.setcomplevel(...)
 logging.setcomplevel(-1, 1);# Should raise an error
@@ -11,9 +22,19 @@ logging.setcomplevel(-10, -1);  # Should
 # Component -10 does not exist
 # Log level -1 does not exist
 
+# WARNING
 logging.setcomplevel(1, 5); # Should raise an error
 # The last level is used for enum count
 
+# WARNING
+logging.setcomplevel(98, 3);# Should raise an error
+# The last component is used for enum count
+
+# WARNING
+logging.setcomplevel(98, 5);# Should raise an error
+# The last component is used for enum count
+# The last level is used for enum count
+
 logging.setcomplevel(1, 4); # OK
 
 
@@ -22,6 +43,10 @@ logging.setcomplevel(1, 4); # OK
 logging.resetcomplevel(-1); # Should raise an error
 # Component -1 does not exist
 
+# WARNING
+logging.resetcomplevel(98); # Should raise an error
+# The last component is used for enum count
+
 logging.resetcomplevel(1);  # OK
 
 
@@ -37,17 +62,20 @@ logging.setlayerlevel(-10, -1); # Should
 # Layer -10 does not exist
 # Log level -1 does not exist
 
+# WARNING
 logging.setlayerlevel(4, 2);# Should raise an error
 # The last layer is used for enum count
 
+# WARNING
 logging.setlayerlevel(1, 5);# Should raise an error
 # The last level is used for enum count
 
+# WARNING
 logging.setlayerlevel(4, 5);# Should raise an error
 # The last layer is used for enum count
 # The last level is used for enum count
 
-logging.setlayerlevel(1, 3);# OK
+logging.setlayerlevel(1, 2);# OK
 
 
 
@@ -55,6 +83,7 @@ logging.setlayerlevel(1, 3);# OK
 logging.resetlayerlevel(-1);# Should raise an error
 # Layer -1 does not exist
 
+# WARNING
 logging.resetlayerlevel(4); # Should raise an error
 # The last layer is used for enum count   
 
@@ -66,6 +95,7 @@ logging.resetlayerlevel(1); # OK
 logging.setflushlevel(-1); # Should raise an error
# Level -1 does not exist
 
+# WARNING
 logging.setflushlevel(5);  # Should raise an error
# The last level is used for enum count
 
@@ -81,6 +111,7 @@ logging.resetflushlevel();
 logging.setadapter(-1);# Should raise an error
# Adapter -1 does not exist
 
+# WARNING
 logging.setadapter(2); # Should raise an error
# The last adapter is used for enum count
 
@@ -89,3 +120,9 @@ logging.setadapter(1); # OK
 
 
 logging.resetadapter();
+
+
+
+# log & flush
+logging.log();
+logging.flush();
\ No newline at end of file
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -4,6 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+ * 
+ * 
+ * GDKtracer exposes routines where an occuring failure 

MonetDB: gdk_tracer - Merge with default

2019-12-03 Thread Thodoris Zois
Changeset: 997f91f8093f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=997f91f8093f
Modified Files:
NT/rules.msc
buildtools/doc/windowsbuild.rst
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
debian/monetdb5-server.install
gdk/ChangeLog
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
monetdb5/ChangeLog
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/bat5.h
monetdb5/modules/kernel/bat5.mal
monetdb5/modules/mal/Tests/inspect05.malC
monetdb5/modules/mal/Tests/inspect05.stable.out
monetdb5/modules/mal/Tests/inspect05.stable.out.int128
sql/backends/monet5/sql_statement.c
sql/include/sql_relation.h
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_unnest.h
sql/server/sql_atom.c
sql/server/sql_atom.h
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_table.c

sql/test/BugTracker-2013/Tests/cannot_use_columns_after_groupby.Bug-3340.sql

sql/test/BugTracker-2013/Tests/cannot_use_columns_after_groupby.Bug-3340.stable.err

sql/test/BugTracker-2013/Tests/cannot_use_columns_after_groupby.Bug-3340.stable.out
sql/test/BugTracker-2017/Tests/groupby_assertion.Bug-6338.stable.err

sql/test/BugTracker-2018/Tests/sqlitelogictest-groupby-coalesce-error-message.Bug-6608.stable.err
sql/test/mergetables/Tests/sqlsmith-exists.sql
sql/test/mergetables/Tests/sqlsmith-exists.stable.out
sql/test/scanner/Tests/raw_strings.stable.err
sql/test/scanner/Tests/raw_strings.stable.out
sql/test/subquery/Tests/subquery.sql
sql/test/subquery/Tests/subquery.stable.err
sql/test/subquery/Tests/subquery.stable.out
sql/test/subquery/Tests/subquery3.sql
sql/test/subquery/Tests/subquery3.stable.err
sql/test/subquery/Tests/subquery3.stable.out
Branch: gdk_tracer
Log Message:

Merge with default


diffs (truncated from 2672 to 300 lines):

diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -139,14 +139,19 @@ bzip2_CFLAGS = -DHAVE_LIBBZ2 "-I$(LIBBZI
 !IFNDEF LIBXML2
 LIBXML2 = C:\libxml2-2.6.30.win$(bits)
 !ENDIF
-libxml2_CFLAGS = -DHAVE_LIBXML "-I$(LIBXML2)\include" $(zlib_CFLAGS) 
$(ICONV_CFLAGS)
+# by default libxml2 include files get installed in ...\include\libxml2\libxml
+# but this has sometimes been moved to ...\include\libxml
+libxml2_CFLAGS = -DHAVE_LIBXML "-I$(LIBXML2)\include\libxml2" 
"-I$(LIBXML2)\include" $(zlib_CFLAGS) $(ICONV_CFLAGS)
 libxml2_LIBS = "$(LIBXML2)\lib\libxml2.lib" $(zlib_LIBS) $(ICONV_LIBS)
 !ENDIF
 
 !IFNDEF LIBGEOS
 LIBGEOS = C:\geos-3.0.win$(bits)
 !ENDIF
-GEOS_LIBS = $(LIBGEOS)\lib\geos_c_i.lib
+!IFNDEF GEOSFILE
+GEOSFILE = geos_c
+!ENDIF
+GEOS_LIBS = $(LIBGEOS)\lib\$(GEOSFILE).lib
 GEOS_INCS = -I$(LIBGEOS)\include
 
 !IFDEF HAVE_LIBR
diff --git a/buildtools/doc/windowsbuild.rst b/buildtools/doc/windowsbuild.rst
--- a/buildtools/doc/windowsbuild.rst
+++ b/buildtools/doc/windowsbuild.rst
@@ -243,6 +243,8 @@ PCRE (Perl Compatible Regular Expression
 The PCRE__ library is used to extend the string matching capabilities
 of MonetDB.  The PCRE library is required for the monetdb5 component.
 
+.. _pcre_cmake:
+
 Download the source from http://www.pcre.org/.  In order to build the
 library, you will need a program called ``cmake`` which you can
 download from http://www.cmake.org/ or by using Chocolatey_.  Follow
@@ -255,14 +257,14 @@ Configure button.  This pops up a dialog
 chose Visual Studio 14 2015.
 
 You need to configure some PCRE build options.  I chose to do build
-shared libs, to match newlines with the ``ANYCRLF`` option, and to do
-have UTF-8 support and support for Unicode properties.  When you're
-satisfied with the options, click on Generate.  Then in the build
-folder you've chosen, open the PCRE.sln file with Visual Studio, and
-build and install.  Make sure you set the Solution Configuration to
-Release if you want to build a releasable version of the MonetDB
-suite.  By default the library will be installed in ``C:\Program
-Files\PCRE``.
+shared libs, to match newlines with the ``ANYCRLF`` and
+``PCRE_SUPPORT_JIT`` options, and to do have UTF-8 support and support
+for Unicode properties.  When you're satisfied with the options, click
+on Generate.  Then in the build folder you've chosen, open the
+PCRE.sln file with Visual Studio, and build and install.  Make sure
+you set the Solution Configuration to Release if you want to build a
+releasable version of the MonetDB suite.  By default the library will
+be installed in ``C:\Program Files\PCRE``.
 
 For Windows64, select the correct compiler (``Visual 

MonetDB: gdk_tracer - Exception handling in GDKtracer & removed ...

2019-12-03 Thread Thodoris Zois
Changeset: 64e70976e111 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64e70976e111
Modified Files:
gdk/gdk_tracer.c
Branch: gdk_tracer
Log Message:

Exception handling in GDKtracer & removed 2nd buffer


diffs (291 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -41,16 +41,14 @@
 #endif
 
 static gdk_tracer tracer = { .allocated_size = 0, .id = 0 };
-static gdk_tracer secondary_tracer = { .allocated_size = 0, .id = 1 };
 static MT_Lock lock = MT_LOCK_INITIALIZER("GDKtracer");
-static ATOMIC_TYPE SELECTED_tracer_ID = 0;
 
 static FILE *output_file;
+static bool USE_STREAM = true;
+
 static ATOMIC_TYPE CUR_ADAPTER = DEFAULT_ADAPTER;
 
 static LOG_LEVEL CUR_FLUSH_LEVEL = DEFAULT_FLUSH_LEVEL;
-// LOG_LEVEL LVL_PER_COMPONENT[COMPONENTS_COUNT] = {[0 ... COMPONENTS_COUNT-1] 
= DEFAULT_LOG_LEVEL};
-
 static bool GDK_TRACER_STOP = false;
 
 static const char *LAYER_STR[] = {
@@ -66,34 +64,23 @@ LOG_LEVEL LVL_PER_COMPONENT[] = {
 };
 
 
-// Output error from snprintf of vsnprintf
-static void 
-_GDKtracer_log_output_error(int bytes_written)
-{
-assert(bytes_written >= 0);
-}
-
-
-static void 
-_GDKtracer_file_is_open(FILE *file)
-{
-assert(file);
-}
-
 
 // Prepares a file in order to write the contents of the buffer when necessary
-static void 
-_GDKtracer_create_file(void)
+static gdk_return
+_GDKtracer_init_basic_adptr(void)
 {
-char id[INT_MAX_LEN]; 
-snprintf(id, INT_MAX_LEN, "%d", 1);
-
 char file_name[FILENAME_MAX];
-sprintf(file_name, "%s%c%s%c%s%c%s%s", GDKgetenv("gdk_dbpath"), DIR_SEP, 
FILE_NAME, NAME_SEP, GDKtracer_get_timestamp("%Y-%m-%dT%H:%M:%S"), NAME_SEP, 
id, ".log");
+sprintf(file_name, "%s%c%s%c%s%s", GDKgetenv("gdk_dbpath"), DIR_SEP, 
FILE_NAME, NAME_SEP, GDKtracer_get_timestamp("%Y-%m-%dT%H:%M:%S"), ".log");
 
 output_file = fopen(file_name, "w");
 
-_GDKtracer_file_is_open(output_file);
+if(!output_file)
+{
+GDK_TRACER_REPORT_EXCEPTION("Failed to initialize BASIC adapter. Could 
not open file: %s\n", file_name);
+return GDK_FAIL;
+}
+
+return GDK_SUCCEED;
 }
 
 
@@ -165,9 +152,11 @@ static int
 if(fmt[fmt_len - 1] != NEW_LINE)
 {
 tmp = malloc(sizeof(char) * (fmt_len + 2));
-if(tmp == NULL)
+if(!tmp)
 {
-fprintf(stderr, "Memory allocation failed\n");
+// Let GDKtracer_log to know about the failure
+GDK_TRACER_REPORT_EXCEPTION("Memory allocation failed\n");
+return -1;
 }
 else
 {
@@ -189,7 +178,9 @@ static int
 if(tmp)
 free(tmp);
 
-_GDKtracer_log_output_error(bytes_written);
+// Let GDKtracer_log to know about the failure
+if(bytes_written < 0)
+return -1;
 
 // vsnprintf returned value -> does not include the null terminating 
character
 return bytes_written++;
@@ -269,8 +260,7 @@ GDKtracer_get_timestamp(char* fmt)
 gdk_return
 GDKtracer_init(void)
 {
-_GDKtracer_create_file();
-return GDK_SUCCEED;
+return _GDKtracer_init_basic_adptr();
 }
 
 
@@ -407,60 +397,45 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 {  
 gdk_tracer *fill_tracer;
 int bytes_written = 0;
-int GDK_result;
 
 MT_lock_set();
 {
-if((int) ATOMIC_GET(_tracer_ID) == tracer.id)
-fill_tracer = 
-else
-fill_tracer = _tracer;
+fill_tracer = 
 
 va_list va;
 va_start(va, fmt);
 bytes_written = _GDKtracer_fill_tracer(fill_tracer, fmt, va);
 va_end(va);
 
-// The message fits the buffer OR the buffer is empty (we don't care 
if it fits - just cut it off)
-if(bytes_written < (BUFFER_SIZE - fill_tracer->allocated_size) || 
-fill_tracer->allocated_size == 0)
+if(bytes_written < 0)
 {
-fill_tracer->allocated_size += bytes_written;
+GDK_TRACER_REPORT_EXCEPTION("Cannot write data to the buffer, 
discarding this entry\n");
+/* CHECK */
+// Maybe here add return GDK_FAIL?
 }
 else
 {
-/* CHECK */
-// Create thread for that
-// Flush the full tracer on a separate thread
-GDKtracer_flush_buffer();
-// MT_Id tid;
-// if(MT_create_thread(, (void(*) (void*)) 
GDKtracer_flush_buffer, NULL, MT_THR_JOINABLE, "GDKtracerFlush") < 0)
-// fprintf(stderr, "MT_create_thread FAILED!\n");
-// // return GDK_FAIL;
-// GDK_result = MT_join_thread(tid);
-// if(GDK_result == GDK_FAIL)
-// fprintf(stderr, "MT_join_thread FAILED!\n");
-// // return GDK_FAIL;
+// The message fits the buffer OR the buffer is empty but the 
message does not fit (we cut it off)
+if(bytes_written < 

MonetDB: gdk_tracer - Added VA args to GDK_TRACER_REPORT_EXCEPTI...

2019-12-03 Thread Thodoris Zois
Changeset: c6cdc624c280 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6cdc624c280
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Added VA args to GDK_TRACER_REPORT_EXCEPTION macro


diffs (29 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -219,7 +219,7 @@ extern LOG_LEVEL LVL_PER_COMPONENT[];
 ## __VA_ARGS__); \
 }\
 
-#define TRC_CRITICAL(COMP, MSG, ...) \
+#define TRC_CRITICAL(COMP, MSG, ...) \
 GDK_TRACER_LOG(M_CRITICAL, COMP, MSG, ## __VA_ARGS__)\
 
 #define TRC_ERROR(COMP, MSG, ...)\
@@ -250,13 +250,14 @@ gdk_tracer;
  * GDKtracer Stream Usage
  */
 // Exception
-#define GDK_TRACER_REPORT_EXCEPTION(MSG) \
+#define GDK_TRACER_REPORT_EXCEPTION(MSG, ...)\
 mnstr_printf(GDKstdout, "[%s] %s %s:%d M_CRITICAL GDK_TRACER %s # "MSG,  \
 GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),\
 __FILENAME__,\
 __FUNCTION__,\
 __LINE__,\
-MT_thread_getname());\
+MT_thread_getname(), \
+## __VA_ARGS__); \
 
 /*
  *  GDKtracer API
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Fix - compilation issue on macOS only

2019-12-03 Thread Thodoris Zois
Changeset: 804e71b4bac3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=804e71b4bac3
Modified Files:
monetdb5/scheduler/run_memo.c
Branch: gdk_tracer
Log Message:

Fix - compilation issue on macOS only


diffs (21 lines):

diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -176,7 +176,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
}
 
-   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), (long) mincost);
(void) cntxt;
 
/* remove non-qualifying variables */
@@ -188,7 +188,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
propagateNonTarget(mb, pc + 1);
 
-   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), (long) mincost);
debugFunction(MAL_MEMO, mb, stk, 1);
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Added macro for exception handling

2019-12-03 Thread Thodoris Zois
Changeset: 03f6ac5cb517 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03f6ac5cb517
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Added macro for exception handling


diffs (40 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -13,7 +13,7 @@
 #define BUFFER_SIZE 64000
 
 #define DEFAULT_ADAPTER BASIC
-#define DEFAULT_LOG_LEVEL M_DEBUG
+#define DEFAULT_LOG_LEVEL M_ERROR
 #define DEFAULT_FLUSH_LEVEL M_INFO
 
 #define FILE_NAME "trace"
@@ -200,7 +200,7 @@ static const char *COMPONENT_STR[] = {
 extern LOG_LEVEL LVL_PER_COMPONENT[];
 
 // If the LOG_LEVEL of the message is one of the following: CRITICAL, ERROR or 
WARNING 
-// it is logged no matter the component. In any other case the component is 
taken into account (needs fix)
+// it is logged no matter the component. In any other case the component is 
taken into account
 #define GDK_TRACER_LOG(LOG_LEVEL, COMP, MSG, ...)\
 if(LOG_LEVEL == M_CRITICAL ||\
LOG_LEVEL == M_ERROR||\
@@ -247,6 +247,18 @@ gdk_tracer;
 
 
 /*
+ * GDKtracer Stream Usage
+ */
+// Exception
+#define GDK_TRACER_REPORT_EXCEPTION(MSG) \
+mnstr_printf(GDKstdout, "[%s] %s %s:%d M_CRITICAL GDK_TRACER %s # "MSG,  \
+GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S"),\
+__FILENAME__,\
+__FUNCTION__,\
+__LINE__,\
+MT_thread_getname());\
+
+/*
  *  GDKtracer API
  */
 // Returns the timestamp in the form of datetime
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Exception handling for failing GDKtracer r...

2019-12-03 Thread Thodoris Zois
Changeset: 8211183b107e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8211183b107e
Modified Files:
monetdb5/mal/mal_errors.h
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_exception.h
monetdb5/modules/mal/tracer.c
Branch: gdk_tracer
Log Message:

Exception handling for failing GDKtracer routines in MAL layer


diffs (139 lines):

diff --git a/monetdb5/mal/mal_errors.h b/monetdb5/mal/mal_errors.h
--- a/monetdb5/mal/mal_errors.h
+++ b/monetdb5/mal/mal_errors.h
@@ -88,6 +88,7 @@
 #define RUNTIME_QRY_TIMEOUT "Query aborted due to timeout"
 #define RUNTIME_SESSION_TIMEOUT "Query aborted due to session timeout"
 #define OPERATION_FAILED "operation failed"
+#define _OPERATION_FAILED "Operation failed"
 
 #define BOX_CLOSED "Box is not open"
 
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -29,6 +29,7 @@ static char *exceptionNames[] = {
 /*11 */"ArithmeticException",
 /*12 */"PermissionDeniedException",
 /*13 */"SQLException",
+/*14 */ "TracerException",
 /*15 */"Deprecated operation",
 /*EOE*/NULL
 };
diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h
--- a/monetdb5/mal/mal_exception.h
+++ b/monetdb5/mal/mal_exception.h
@@ -26,7 +26,8 @@ enum malexception {
PARSE,
ARITH,
PERMD,
-   SQL
+   SQL,
+   TRACER
 };
 
 #define MAL_SUCCEED ((str) 0) /* no error */
diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c
--- a/monetdb5/modules/mal/tracer.c
+++ b/monetdb5/modules/mal/tracer.c
@@ -16,9 +16,9 @@ str
 TRACERflush_buffer(void)
 {
 GDK_result = GDKtracer_flush_buffer();
-// if(GDK_result == GDK_FAIL)
-
-
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
+
 return MAL_SUCCEED;
 }
 
@@ -28,8 +28,8 @@ TRACERset_component_level(void *ret, int
 {
 (void) ret;
 GDK_result = GDKtracer_set_component_level(comp, lvl);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
 return MAL_SUCCEED; 
 }
@@ -39,8 +39,8 @@ str
 TRACERreset_component_level(int *comp)
 {
 GDK_result = GDKtracer_reset_component_level(comp);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
 return MAL_SUCCEED;
 }
@@ -51,8 +51,8 @@ TRACERset_layer_level(void *ret, int *la
 {
 (void) ret;
 GDK_result = GDKtracer_set_layer_level(layer, lvl);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
 return MAL_SUCCEED; 
 }
@@ -62,8 +62,8 @@ str
 TRACERreset_layer_level(int *layer)
 {
 GDK_result = GDKtracer_reset_layer_level(layer);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
 return MAL_SUCCEED;
 }
@@ -74,8 +74,8 @@ TRACERset_flush_level(void *ret, int *lv
 {
 (void) ret;
 GDK_result = GDKtracer_set_flush_level(lvl);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
 return MAL_SUCCEED;
 }
@@ -85,8 +85,8 @@ str
 TRACERreset_flush_level(void)
 {
 GDK_result = GDKtracer_reset_flush_level();
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
 return MAL_SUCCEED;
 }
@@ -97,8 +97,8 @@ TRACERset_adapter(void *ret, int *adapte
 {
 (void) ret;
 GDK_result = GDKtracer_set_adapter(adapter);
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, ILLEGAL_ARGUMENT); 
 
 return MAL_SUCCEED;
 }
@@ -108,8 +108,8 @@ str
 TRACERreset_adapter(void)
 {
 GDK_result = GDKtracer_reset_adapter();
-// if(GDK_result == GDK_FAIL)
-// throw(TRACER, __FILE__, "%s:%s", __func__, OPERATION_FAILED);
+if(GDK_result == GDK_FAIL)
+throw(TRACER, __FUNCTION__, _OPERATION_FAILED); 
 
 return MAL_SUCCEED;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Initialize log levels in preprocessor

2019-12-03 Thread Thodoris Zois
Changeset: 72761bfeb2b8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=72761bfeb2b8
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Initialize log levels in preprocessor


diffs (87 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -27,6 +27,7 @@
 
 #include "monetdb_config.h"
 #include "gdk.h"
+#include "gdk_tracer.h"
 
 // We need to get rid of macros defined in gdk.h. Those are using GDKtracer in 
order to produce 
 // messages. At the point malloc is called in gdk_tracer.c (in function 
_GDKtracer_fill_tracer)
@@ -48,7 +49,8 @@ static FILE *output_file;
 static ATOMIC_TYPE CUR_ADAPTER = DEFAULT_ADAPTER;
 
 static LOG_LEVEL CUR_FLUSH_LEVEL = DEFAULT_FLUSH_LEVEL;
-LOG_LEVEL LVL_PER_COMPONENT[COMPONENTS_COUNT];
+// LOG_LEVEL LVL_PER_COMPONENT[COMPONENTS_COUNT] = {[0 ... COMPONENTS_COUNT-1] 
= DEFAULT_LOG_LEVEL};
+
 static bool GDK_TRACER_STOP = false;
 
 static const char *LAYER_STR[] = {
@@ -59,6 +61,10 @@ static const char *ADAPTER_STR[] = {
 FOREACH_ADPTR(GENERATE_STRING)
 };
 
+LOG_LEVEL LVL_PER_COMPONENT[] = {
+FOREACH_COMP(GENERATE_LOG_LEVEL)
+};
+
 
 // Output error from snprintf of vsnprintf
 static void 
@@ -91,16 +97,6 @@ static void
 }
 
 
-static void
-_GDKtracer_init_components(void)
-{
-for(int i = 0; i < COMPONENTS_COUNT; i++)
-{
-LVL_PER_COMPONENT[i] = DEFAULT_LOG_LEVEL;
-}
-}
-
-
 static bool
 _GDKtracer_adapter_exists(int *adapter)
 {
@@ -273,7 +269,6 @@ GDKtracer_get_timestamp(char* fmt)
 gdk_return
 GDKtracer_init(void)
 {
-_GDKtracer_init_components();
 _GDKtracer_create_file();
 return GDK_SUCCEED;
 }
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -13,7 +13,7 @@
 #define BUFFER_SIZE 64000
 
 #define DEFAULT_ADAPTER BASIC
-#define DEFAULT_LOG_LEVEL M_CRITICAL
+#define DEFAULT_LOG_LEVEL M_DEBUG
 #define DEFAULT_FLUSH_LEVEL M_INFO
 
 #define FILE_NAME "trace"
@@ -25,7 +25,7 @@
 
 #define GENERATE_ENUM(ENUM) ENUM,
 #define GENERATE_STRING(STRING) #STRING,
-
+#define GENERATE_LOG_LEVEL(COMP) DEFAULT_LOG_LEVEL,
 
 
 // ADAPTERS
@@ -197,7 +197,7 @@ static const char *COMPONENT_STR[] = {
 /*
  * Logging macros 
  */
-extern LOG_LEVEL LVL_PER_COMPONENT[COMPONENTS_COUNT];
+extern LOG_LEVEL LVL_PER_COMPONENT[];
 
 // If the LOG_LEVEL of the message is one of the following: CRITICAL, ERROR or 
WARNING 
 // it is logged no matter the component. In any other case the component is 
taken into account (needs fix)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Compilation fix

2019-12-02 Thread Thodoris Zois
Changeset: a52c7ac813ce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a52c7ac813ce
Modified Files:
monetdb5/scheduler/run_memo.c
Branch: gdk_tracer
Log Message:

Compilation fix


diffs (21 lines):

diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -176,7 +176,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
}
 
-   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), mincost);
(void) cntxt;
 
/* remove non-qualifying variables */
@@ -188,7 +188,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
propagateNonTarget(mb, pc + 1);
 
-   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), mincost);
debugFunction(MAL_MEMO, mb, stk, 1);
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Removed unnecessary includes of gdk_tracer

2019-12-02 Thread Thodoris Zois
Changeset: e2665a0215a1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2665a0215a1
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_align.c
gdk/gdk_batop.c
gdk/gdk_cand.c
gdk/gdk_cross.c
gdk/gdk_group.c
gdk/gdk_hash.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_posix.c
gdk/gdk_sample.c
gdk/gdk_select.c
gdk/gdk_storage.c
gdk/gdk_string.c
gdk/gdk_system.c
gdk/gdk_tm.c
gdk/gdk_tracer.c
gdk/gdk_utils.c
geom/monetdb5/geom.c
monetdb5/mal/mal.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_factory.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_function.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_listing.h
monetdb5/mal/mal_module.c
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_resolve.c
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_session.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/oltp.c
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_pipes.c
monetdb5/scheduler/run_memo.c
monetdb5/scheduler/run_pipeline.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_orderidx.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_statistics.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_user.c
sql/backends/monet5/vaults/bam/bam_wrapper.c
sql/backends/monet5/vaults/shp/shp.c
sql/backends/monet5/wlr.c
sql/include/sql_mem.h
sql/server/sql_atom.c
sql/server/sql_mvc.c
sql/server/sql_privileges.c
sql/server/sql_symbol.c
sql/storage/bat/bat_table.c
sql/storage/store.c
Branch: gdk_tracer
Log Message:

Removed unnecessary includes of gdk_tracer


diffs (truncated from 887 to 300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -10,7 +10,6 @@
 #include "gdk.h"
 #include "gdk_private.h"
 #include "gdk_calc_private.h"
-#include "gdk_tracer.h"
 #include 
 
 /* grouped aggregates
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -48,7 +48,6 @@
 #include "monetdb_config.h"
 #include "gdk.h"
 #include "gdk_private.h"
-#include "gdk_tracer.h"
 
 /* Return TRUE if the two BATs are aligned (same size, same
  * hseqbase). */
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -17,7 +17,6 @@
 #include "monetdb_config.h"
 #include "gdk.h"
 #include "gdk_private.h"
-#include "gdk_tracer.h"
 
 gdk_return
 unshare_string_heap(BAT *b)
diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -10,7 +10,6 @@
 #include "gdk.h"
 #include "gdk_private.h"
 #include "gdk_cand.h"
-#include "gdk_tracer.h"
 
 /* create a new, dense candidate list with values from `first' up to,
  * but not including, `last' */
diff --git a/gdk/gdk_cross.c b/gdk/gdk_cross.c
--- a/gdk/gdk_cross.c
+++ b/gdk/gdk_cross.c
@@ -9,7 +9,6 @@
 #include "monetdb_config.h"
 #include "gdk.h"
 #include "gdk_private.h"
-#include "gdk_tracer.h"
 
 /* Calculate a cross product between bats l and r with optional
  * candidate lists sl for l and sr for r.
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -10,7 +10,6 @@
 #include "gdk.h"
 #include "gdk_private.h"
 #include "gdk_cand.h"
-#include "gdk_tracer.h"
 
 /* how much to extend the extent and histo bats when we run out of space */
 #define GROUPBATINCR   8192
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -35,7 +35,6 @@
 #include "monetdb_config.h"
 #include "gdk.h"
 #include "gdk_private.h"
-#include "gdk_tracer.h"
 
 static int
 HASHwidth(BUN hashsize)
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -17,7 +17,6 @@
 

MonetDB: gdk_tracer - Minor

2019-12-02 Thread Thodoris Zois
Changeset: dfd5fb71036a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfd5fb71036a
Modified Files:
monetdb5/scheduler/run_memo.c
Branch: gdk_tracer
Log Message:

Minor


diffs (30 lines):

diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -138,7 +138,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
getFunctionId(p) == getFunctionId(q)) {
p = q;
break;
-   }
+   } 
}
if (i == mb->stop)
return MAL_SUCCEED;
@@ -177,7 +177,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
}
 
-   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), mincost);
(void) cntxt;
 
/* remove non-qualifying variables */
@@ -189,7 +189,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
propagateNonTarget(mb, pc + 1);
 
-   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %lld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), mincost);
debugFunction(MAL_MEMO, mb, stk, 1);
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Send messages to stderr if GDKtracer is no...

2019-12-02 Thread Thodoris Zois
Changeset: b4606c48fc8b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b4606c48fc8b
Modified Files:
gdk/gdk_tracer.c
monetdb5/scheduler/run_memo.c
Branch: gdk_tracer
Log Message:

Send messages to stderr if GDKtracer is not initialized or file is not open && 
always flush ERROR and CRITICAL messages


diffs (71 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -473,7 +473,13 @@ GDKtracer_log(LOG_LEVEL level, char *fmt
 
 // Flush the current buffer in case the event is 
 // important depending on the flush-level
-if(level == CUR_FLUSH_LEVEL)
+// Always flush CRITICAL and ERROR messages - prevent cases 
+// like mserver5 refusing to start due to allocated port 
+// and the error is never reported to the user because it 
+// is still in the buffer which it never gets flushed.
+if(level == CUR_FLUSH_LEVEL || 
+   level == M_CRITICAL  || 
+   level == M_ERROR)
 {
 GDK_result = GDKtracer_flush_buffer();
 if(GDK_result == GDK_FAIL)
@@ -503,11 +509,17 @@ GDKtracer_flush_buffer(void)
 
 if(ATOMIC_GET(_ADAPTER) == BASIC)
 {
-// Check if file is open
-_GDKtracer_file_is_open(output_file);
-
+// Check if file is open - if not send the output to stderr. There are 
cases that 
+// this is needed - e.g: on startup of mserver5 GDKmalloc is called 
before GDKinit. 
+// In GDKinit GDKtracer is getting initialized (open_file and 
initialize log level 
+// per component). Since the file is not open yet and there is an 
assert, we need 
+// to do something - and as a backup plan we send the logs to stderr.
+// _GDKtracer_file_is_open(output_file);
+if(!output_file)
+output_file = stderr;
+
 fwrite(_tracer->buffer, fl_tracer->allocated_size, 1, output_file);
-fflush(output_file);
+fflush(stderr);
 
 // Reset buffer
 memset(fl_tracer->buffer, 0, BUFFER_SIZE);
@@ -521,7 +533,8 @@ GDKtracer_flush_buffer(void)
 // The file is kept open no matter the adapter
 // When GDKtracer stops we need also to close the file
 if(GDK_TRACER_STOP)
-fclose(output_file);
+if(output_file)
+fclose(output_file);
 
 return GDK_SUCCEED;
 }
diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c
--- a/monetdb5/scheduler/run_memo.c
+++ b/monetdb5/scheduler/run_memo.c
@@ -177,7 +177,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
}
}
 
-   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %ld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Function target '%s' cost: %lld\n", getVarName(mb, 
target), mincost);
(void) cntxt;
 
/* remove non-qualifying variables */
@@ -189,7 +189,7 @@ RUNchoice(Client cntxt, MalBlkPtr mb, Ma
 
propagateNonTarget(mb, pc + 1);
 
-   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %ld\n", getVarName(mb, 
target), mincost);
+   TRC_DEBUG(MAL_MEMO, "Cost choice selected: %s %lld\n", getVarName(mb, 
target), mincost);
debugFunction(MAL_MEMO, mb, stk, 1);
 
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Change default flush level

2019-12-02 Thread Thodoris Zois
Changeset: 497ff0c321ec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=497ff0c321ec
Modified Files:
gdk/gdk_tracer.h
Branch: gdk_tracer
Log Message:

Change default flush level


diffs (12 lines):

diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -14,7 +14,7 @@
 
 #define DEFAULT_ADAPTER BASIC
 #define DEFAULT_LOG_LEVEL M_CRITICAL
-#define DEFAULT_FLUSH_LEVEL M_CRITICAL
+#define DEFAULT_FLUSH_LEVEL M_INFO
 
 #define FILE_NAME "trace"
 #define NAME_SEP '_'
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk_tracer - Merge with default

2019-12-02 Thread Thodoris Zois
Changeset: 9012a3c451b8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9012a3c451b8
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/count-distinct.Bug-6790.sql
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.err
sql/test/BugTracker-2019/Tests/count-distinct.Bug-6790.stable.out
sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.stable.err
sql/test/BugTracker-2019/Tests/jsonpath-validity.Bug-6792.sql
sql/test/BugTracker-2019/Tests/jsonpath-validity.Bug-6792.stable.err
sql/test/BugTracker-2019/Tests/jsonpath-validity.Bug-6792.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
sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.sql
sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.err
sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.out
sql/test/analytics/Tests/analytics10.sql
sql/test/analytics/Tests/analytics10.stable.err
sql/test/analytics/Tests/analytics10.stable.out
sql/test/analytics/Tests/analytics11.sql
sql/test/analytics/Tests/analytics11.stable.err
sql/test/analytics/Tests/analytics11.stable.out
sql/test/analytics/Tests/analytics12.sql
sql/test/analytics/Tests/analytics12.stable.err
sql/test/analytics/Tests/analytics12.stable.out
sql/test/analytics/Tests/analytics13.sql
sql/test/analytics/Tests/analytics13.stable.err
sql/test/analytics/Tests/analytics13.stable.out
sql/test/mapi/Tests/utf8test.stable.out.Windows
sql/test/scanner/Tests/All
sql/test/scanner/Tests/raw_strings.sql
sql/test/scanner/Tests/raw_strings.stable.err
sql/test/scanner/Tests/raw_strings.stable.out
Modified Files:
.hgtags
ChangeLog
MonetDB.spec
NT/monetdb_config.h.in
NT/rules.msc
buildtools/conf/Maddlog
buildtools/selinux/monetdb.te
clients/Tests/exports.stable.out
clients/mapiclient/eventparser.c
clients/mapiclient/mhelp.c
clients/mapilib/mapi.rc
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
configure.ag
debian/changelog
gdk/gdk_analytic.h
gdk/gdk_analytic_func.c
gdk/gdk_heap.c
gdk/gdk_join.c
gdk/gdk_storage.c
gdk/gdk_utils.c
gdk/libbat.rc
libversions
monetdb5/modules/atoms/json.c
monetdb5/modules/atoms/mtime.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/wlc.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_postfix.c
monetdb5/tools/libmonetdb5.rc
rpm.mk.in
sql/ChangeLog
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/wlr.c
sql/benchmarks/tpch/11.sql
sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out
sql/benchmarks/tpch/LOCKED/Tests/01-22.stable.out.int128
sql/benchmarks/tpch/LOCKED/Tests/11.stable.out
sql/benchmarks/tpch/LOCKED/Tests/11.stable.out.int128
sql/benchmarks/tpch/Tests/01-22.stable.out
sql/benchmarks/tpch/Tests/01-22.stable.out.int128
sql/benchmarks/tpch/Tests/11.stable.out
sql/benchmarks/tpch/Tests/11.stable.out.int128
sql/benchmarks/tpch/all.sql
sql/benchmarks/tpch/queries.sql
sql/common/sql_list.c
sql/common/sql_types.c
sql/common/sql_types.h
sql/include/sql_list.h
sql/include/sql_relation.h
sql/jdbc/tests/Tests/All
sql/scripts/25_debug.sql
sql/scripts/51_sys_schema_extension.sql
sql/server/Makefile.ag
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_prop.c
sql/server/rel_prop.h
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
sql/server/sql_atom.c
sql/server/sql_atom.h
sql/server/sql_mvc.c

  1   2   3   4   >