MonetDB: default - Add casts to debug prints.

2015-05-18 Thread Sjoerd Mullender
Changeset: 0b7f80b5f647 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0b7f80b5f647
Modified Files:
gdk/gdk_bbp.c
Branch: default
Log Message:

Add casts to debug prints.


diffs (65 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3289,14 +3289,14 @@ BBPprepare(bit subcommit)
if (mkdir(BAKDIR, 0755)  0  errno != EEXIST)
ret = GDK_FAIL;
/* if BAKDIR already exists, don't signal error */
-   IODEBUG fprintf(stderr, #mkdir %s = %d\n, BAKDIR, 
ret);
+   IODEBUG fprintf(stderr, #mkdir %s = %d\n, BAKDIR, 
(int) ret);
}
}
if (ret == GDK_SUCCEED  start_subcommit) {
/* make a new SUBDIR (subdir of BAKDIR) */
if (mkdir(SUBDIR, 0755)  0)
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #mkdir %s = %d\n, SUBDIR, ret);
+   IODEBUG fprintf(stderr, #mkdir %s = %d\n, SUBDIR, (int) ret);
}
if (ret == GDK_SUCCEED  backup_dir != set) {
/* a valid backup dir *must* at least contain BBP.dir */
@@ -3520,7 +3520,7 @@ BBPsync(int cnt, bat *subcommit)
ret = GDK_FAIL;
if (ret != GDK_SUCCEED)
GDKsyserror(BBPsync: rename(%s,%s) failed.\n, 
bakdir, DELDIR);
-   IODEBUG fprintf(stderr, #BBPsync: rename %s %s = 
%d\n, bakdir, DELDIR, ret);
+   IODEBUG fprintf(stderr, #BBPsync: rename %s %s = 
%d\n, bakdir, DELDIR, (int) ret);
}
 
/* AFTERMATH */
@@ -3592,14 +3592,14 @@ force_move(int farmid, const char *srcdi
srcpath = GDKfilepath(farmid, srcdir, name, NULL);
if (unlink(dstpath)  0)/* clear destination */
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #unlink %s = %d\n, dstpath, ret);
+   IODEBUG fprintf(stderr, #unlink %s = %d\n, dstpath, (int) 
ret);
 
if (GDKcreatedir(dstdir) == GDK_SUCCEED)
ret = GDK_SUCCEED;
ret = GDKmove(farmid, srcdir, name, NULL, dstdir, name, NULL);
if (ret != GDK_SUCCEED)
-   GDKsyserror(force_move: link(%s,%s)=%d\n, srcpath, 
dstpath, ret);
-   IODEBUG fprintf(stderr, #link %s %s = %d\n, srcpath, dstpath, 
ret);
+   GDKsyserror(force_move: link(%s,%s)=%d\n, srcpath, 
dstpath, (int) ret);
+   IODEBUG fprintf(stderr, #link %s %s = %d\n, srcpath, dstpath, 
(int) ret);
GDKfree(dstpath);
GDKfree(srcpath);
}
@@ -3689,7 +3689,7 @@ BBPrecover(int farmid)
if (ret == GDK_SUCCEED) {
if (rmdir(BAKDIR)  0)
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #rmdir %s = %d\n, BAKDIR, ret);
+   IODEBUG fprintf(stderr, #rmdir %s = %d\n, BAKDIR, (int) ret);
}
if (ret != GDK_SUCCEED)
GDKerror(BBPrecover: recovery failed. Please check whether 
your disk is full or write-protected.\n);
@@ -3736,7 +3736,7 @@ BBPrecover_subdir(void)
backup_dir = 0;
}
}
-   IODEBUG fprintf(stderr, #BBPrecover_subdir(end) = %d\n, ret);
+   IODEBUG fprintf(stderr, #BBPrecover_subdir(end) = %d\n, (int) ret);
 
if (ret != GDK_SUCCEED)
GDKerror(BBPrecover_subdir: recovery failed. Please check 
whether your disk is full or write-protected.\n);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Approved non-int128 output.

2015-05-18 Thread Sjoerd Mullender
Changeset: 6daae34cebc0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6daae34cebc0
Modified Files:
sql/benchmarks/tpch/Tests/07-plan.stable.out
sql/benchmarks/tpch/Tests/08-plan.stable.out
sql/benchmarks/tpch/Tests/11-explain.stable.out
sql/benchmarks/tpch/Tests/11-plan.stable.out
sql/benchmarks/tpch/Tests/14-plan.stable.out
sql/benchmarks/tpch/Tests/19-plan.stable.out
Branch: default
Log Message:

Approved non-int128 output.


diffs (256 lines):

diff --git a/sql/benchmarks/tpch/Tests/07-plan.stable.out 
b/sql/benchmarks/tpch/Tests/07-plan.stable.out
--- a/sql/benchmarks/tpch/Tests/07-plan.stable.out
+++ b/sql/benchmarks/tpch/Tests/07-plan.stable.out
@@ -74,15 +74,15 @@ project (
 | | | | | | | ) [ lineitem.%lineitem_l_orderkey_fkey NOT NULL = orders.%TID% 
NOT NULL JOINIDX sys.lineitem.lineitem_l_orderkey_fkey ],
 | | | | | | | select (
 | | | | | | | | table(sys.nation) [ nation.n_name NOT NULL as n1.n_name, 
nation.%TID% NOT NULL as n1.%TID% ] COUNT 
-| | | | | | | ) [ n1.n_name NOT NULL in (char(25)[char(6) FRANCE], 
char(25)[char(7) GERMANY]) ]
+| | | | | | | ) [ n1.n_name NOT NULL in (char(25) FRANCE, char(25) 
GERMANY) ]
 | | | | | | ) [ supplier.%supplier_s_nationkey_fkey NOT NULL = n1.%TID% NOT 
NULL JOINIDX sys.supplier.supplier_s_nationkey_fkey ],
 | | | | | | table(sys.customer) [ customer.%TID% NOT NULL, 
customer.%customer_c_nationkey_fkey NOT NULL JOINIDX 
sys.customer.customer_c_nationkey_fkey ] COUNT 
 | | | | | ) [ orders.%orders_o_custkey_fkey NOT NULL = customer.%TID% NOT NULL 
JOINIDX sys.orders.orders_o_custkey_fkey ],
 | | | | | select (
 | | | | | | table(sys.nation) [ nation.n_name NOT NULL as n2.n_name, 
nation.%TID% NOT NULL as n2.%TID% ] COUNT 
-| | | | | ) [ n2.n_name NOT NULL in (char(25)[char(7) GERMANY], 
char(25)[char(6) FRANCE]) ]
+| | | | | ) [ n2.n_name NOT NULL in (char(25) GERMANY, char(25) FRANCE) ]
 | | | | ) [ customer.%customer_c_nationkey_fkey NOT NULL = n2.%TID% NOT NULL 
JOINIDX sys.customer.customer_c_nationkey_fkey ]
-| | | ) [ (n1.n_name NOT NULL = char(25)[char(6) FRANCE], n2.n_name NOT NULL 
= char(25)[char(7) GERMANY]) or (n1.n_name NOT NULL = char(25)[char(7) 
GERMANY], n2.n_name NOT NULL = char(25)[char(6) FRANCE]) ]
+| | | ) [ (n1.n_name NOT NULL = char(25) FRANCE, n2.n_name NOT NULL = 
char(25) GERMANY) or (n1.n_name NOT NULL = char(25) GERMANY, n2.n_name NOT 
NULL = char(25) FRANCE) ]
 | | ) [ n1.n_name NOT NULL as shipping.supp_nation, n2.n_name NOT NULL as 
shipping.cust_nation, sys.year(lineitem.l_shipdate NOT NULL) as 
shipping.l_year, sys.sql_mul(lineitem.l_extendedprice NOT NULL, 
sys.sql_sub(decimal(15,2)[tinyint 1], lineitem.l_discount NOT NULL)) as 
shipping.volume ]
 | ) [ shipping.supp_nation NOT NULL, shipping.cust_nation NOT NULL, 
shipping.l_year ] [ shipping.supp_nation NOT NULL, shipping.cust_nation NOT 
NULL, shipping.l_year, sys.sum no nil (shipping.volume) as L1.L1 ]
 ) [ shipping.supp_nation NOT NULL, shipping.cust_nation NOT NULL, 
shipping.l_year, L1 as L1.revenue ] [ shipping.supp_nation ASC NOT NULL, 
shipping.cust_nation ASC NOT NULL, shipping.l_year ASC ]
diff --git a/sql/benchmarks/tpch/Tests/08-plan.stable.out 
b/sql/benchmarks/tpch/Tests/08-plan.stable.out
--- a/sql/benchmarks/tpch/Tests/08-plan.stable.out
+++ b/sql/benchmarks/tpch/Tests/08-plan.stable.out
@@ -56,7 +56,7 @@ Ready.
 % .plan # table_name
 % rel # name
 % clob # type
-% 498 # length
+% 480 # length
 project (
 | group by (
 | | project (
@@ -82,13 +82,13 @@ project (
 | | | | | | ) [ customer.%customer_c_nationkey_fkey NOT NULL = n1.%TID% NOT 
NULL JOINIDX sys.customer.customer_c_nationkey_fkey ],
 | | | | | | select (
 | | | | | | | table(sys.region) [ region.r_name NOT NULL, region.%TID% NOT 
NULL ] COUNT 
-| | | | | | ) [ region.r_name NOT NULL = char(25)[char(7) AMERICA] ]
+| | | | | | ) [ region.r_name NOT NULL = char(25) AMERICA ]
 | | | | | ) [ n1.%nation_n_regionkey_fkey NOT NULL = region.%TID% NOT NULL 
JOINIDX sys.nation.nation_n_regionkey_fkey ],
 | | | | | table(sys.supplier) [ supplier.s_suppkey NOT NULL HASHCOL , 
supplier.%supplier_s_nationkey_fkey NOT NULL JOINIDX 
sys.supplier.supplier_s_nationkey_fkey ] COUNT 
 | | | | ) [ supplier.s_suppkey NOT NULL HASHCOL  = lineitem.l_suppkey NOT NULL 
],
 | | | | table(sys.nation) [ nation.n_name NOT NULL as n2.n_name, nation.%TID% 
NOT NULL as n2.%TID% ] COUNT 
 | | | ) [ supplier.%supplier_s_nationkey_fkey NOT NULL = n2.%TID% NOT NULL 
JOINIDX sys.supplier.supplier_s_nationkey_fkey ]
-| | ) [ sys.year(orders.o_orderdate NOT NULL) as all_nations.o_year, 
sys.sql_mul(lineitem.l_extendedprice NOT NULL, 
sys.sql_sub(decimal(15,2)[tinyint 1], lineitem.l_discount NOT NULL)) as 
all_nations.volume, n2.n_name NOT NULL as all_nations.nation, 
sys.ifthenelse(sys.ifthenelse(sys.isnull(sys.=(all_nations.nation NOT NULL, 
char(25)[char(6) BRAZIL])), boolean false, sys.=(all_nations.nation NOT 
NULL, char(25)[char(6) BRAZIL])), 

MonetDB: default - use proper type

2015-05-18 Thread Niels Nes
Changeset: 6d0b8bf784d8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6d0b8bf784d8
Modified Files:
gdk/gdk_logger.h
Branch: default
Log Message:

use proper type


diffs (12 lines):

diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -70,7 +70,7 @@ typedef struct logger {
   directly (on transaction
   commit). */
void *buf;
-   void *bufsize;
+   size_t bufsize;
 } logger;
 
 #define BATSIZE 0
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Only persist hash if there are no uncommitted...

2015-05-18 Thread Sjoerd Mullender
Changeset: 27e07e118733 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=27e07e118733
Modified Files:
gdk/gdk_search.c
Branch: default
Log Message:

Only persist hash if there are no uncommitted inserts (appends).


diffs (21 lines):

diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -224,9 +224,6 @@ BATcheckhash(BAT *b)
int ret;
lng t;
 
-   if (b-T-hash == NULL)
-   return 0;
-
t = GDKusec();
MT_lock_set(GDKhashLock(abs(b-batCacheid)), BATcheckhash);
t = GDKusec() - t;
@@ -510,6 +507,7 @@ BAThash(BAT *b, BUN masksize)
break;
}
if ((BBP_status(b-batCacheid)  BBPEXISTING) 
+   b-batInserted == b-batCount 
HEAPsave(hp, nme, ext) == GDK_SUCCEED 
(fd = GDKfdlocate(hp-farmid, nme, rb+, ext)) = 0) {
ALGODEBUG fprintf(stderr, #BAThash: persisting hash 
%d\n, b-batCacheid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - merged

2015-05-18 Thread Niels Nes
Changeset: 23edf4a395e8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23edf4a395e8
Modified Files:
gdk/gdk_bbp.c
sql/benchmarks/tpch/Tests/07-plan.stable.out
sql/benchmarks/tpch/Tests/08-plan.stable.out
sql/benchmarks/tpch/Tests/11-explain.stable.out
sql/benchmarks/tpch/Tests/11-plan.stable.out
sql/benchmarks/tpch/Tests/14-plan.stable.out
sql/benchmarks/tpch/Tests/19-plan.stable.out
Branch: default
Log Message:

merged


diffs (truncated from 321 to 300 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3289,14 +3289,14 @@ BBPprepare(bit subcommit)
if (mkdir(BAKDIR, 0755)  0  errno != EEXIST)
ret = GDK_FAIL;
/* if BAKDIR already exists, don't signal error */
-   IODEBUG fprintf(stderr, #mkdir %s = %d\n, BAKDIR, 
ret);
+   IODEBUG fprintf(stderr, #mkdir %s = %d\n, BAKDIR, 
(int) ret);
}
}
if (ret == GDK_SUCCEED  start_subcommit) {
/* make a new SUBDIR (subdir of BAKDIR) */
if (mkdir(SUBDIR, 0755)  0)
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #mkdir %s = %d\n, SUBDIR, ret);
+   IODEBUG fprintf(stderr, #mkdir %s = %d\n, SUBDIR, (int) ret);
}
if (ret == GDK_SUCCEED  backup_dir != set) {
/* a valid backup dir *must* at least contain BBP.dir */
@@ -3520,7 +3520,7 @@ BBPsync(int cnt, bat *subcommit)
ret = GDK_FAIL;
if (ret != GDK_SUCCEED)
GDKsyserror(BBPsync: rename(%s,%s) failed.\n, 
bakdir, DELDIR);
-   IODEBUG fprintf(stderr, #BBPsync: rename %s %s = 
%d\n, bakdir, DELDIR, ret);
+   IODEBUG fprintf(stderr, #BBPsync: rename %s %s = 
%d\n, bakdir, DELDIR, (int) ret);
}
 
/* AFTERMATH */
@@ -3592,14 +3592,14 @@ force_move(int farmid, const char *srcdi
srcpath = GDKfilepath(farmid, srcdir, name, NULL);
if (unlink(dstpath)  0)/* clear destination */
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #unlink %s = %d\n, dstpath, ret);
+   IODEBUG fprintf(stderr, #unlink %s = %d\n, dstpath, (int) 
ret);
 
if (GDKcreatedir(dstdir) == GDK_SUCCEED)
ret = GDK_SUCCEED;
ret = GDKmove(farmid, srcdir, name, NULL, dstdir, name, NULL);
if (ret != GDK_SUCCEED)
-   GDKsyserror(force_move: link(%s,%s)=%d\n, srcpath, 
dstpath, ret);
-   IODEBUG fprintf(stderr, #link %s %s = %d\n, srcpath, dstpath, 
ret);
+   GDKsyserror(force_move: link(%s,%s)=%d\n, srcpath, 
dstpath, (int) ret);
+   IODEBUG fprintf(stderr, #link %s %s = %d\n, srcpath, dstpath, 
(int) ret);
GDKfree(dstpath);
GDKfree(srcpath);
}
@@ -3689,7 +3689,7 @@ BBPrecover(int farmid)
if (ret == GDK_SUCCEED) {
if (rmdir(BAKDIR)  0)
ret = GDK_FAIL;
-   IODEBUG fprintf(stderr, #rmdir %s = %d\n, BAKDIR, ret);
+   IODEBUG fprintf(stderr, #rmdir %s = %d\n, BAKDIR, (int) ret);
}
if (ret != GDK_SUCCEED)
GDKerror(BBPrecover: recovery failed. Please check whether 
your disk is full or write-protected.\n);
@@ -3736,7 +3736,7 @@ BBPrecover_subdir(void)
backup_dir = 0;
}
}
-   IODEBUG fprintf(stderr, #BBPrecover_subdir(end) = %d\n, ret);
+   IODEBUG fprintf(stderr, #BBPrecover_subdir(end) = %d\n, (int) ret);
 
if (ret != GDK_SUCCEED)
GDKerror(BBPrecover_subdir: recovery failed. Please check 
whether your disk is full or write-protected.\n);
diff --git a/sql/benchmarks/tpch/Tests/07-plan.stable.out 
b/sql/benchmarks/tpch/Tests/07-plan.stable.out
--- a/sql/benchmarks/tpch/Tests/07-plan.stable.out
+++ b/sql/benchmarks/tpch/Tests/07-plan.stable.out
@@ -74,15 +74,15 @@ project (
 | | | | | | | ) [ lineitem.%lineitem_l_orderkey_fkey NOT NULL = orders.%TID% 
NOT NULL JOINIDX sys.lineitem.lineitem_l_orderkey_fkey ],
 | | | | | | | select (
 | | | | | | | | table(sys.nation) [ nation.n_name NOT NULL as n1.n_name, 
nation.%TID% NOT NULL as n1.%TID% ] COUNT 
-| | | | | | | ) [ n1.n_name NOT NULL in (char(25)[char(6) FRANCE], 
char(25)[char(7) GERMANY]) ]
+| | | | | | | ) [ n1.n_name NOT NULL in (char(25) FRANCE, char(25) 
GERMANY) ]
 | | | | | | ) [ supplier.%supplier_s_nationkey_fkey NOT NULL = n1.%TID% NOT 
NULL JOINIDX sys.supplier.supplier_s_nationkey_fkey ],
 | | | | | | table(sys.customer) [ customer.%TID% NOT NULL, 
customer.%customer_c_nationkey_fkey NOT NULL JOINIDX 
sys.customer.customer_c_nationkey_fkey ] COUNT 
 | 

MonetDB: default - call same optimizers with and without caching...

2015-05-18 Thread Niels Nes
Changeset: f52a12f95b3b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f52a12f95b3b
Modified Files:
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_optimizer.h
sql/backends/monet5/sql_scenario.c
Branch: default
Log Message:

call same optimizers with and without caching (or recursive calls).


diffs (89 lines):

diff --git a/sql/backends/monet5/sql_optimizer.c 
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -240,7 +240,7 @@ addOptimizers(Client c, MalBlkPtr mb, ch
if (msg)
GDKfree(msg);   /* what to do with an error? */
/* point queries do not require mitosis and dataflow */
-   if (be-mvc-point_query)
+   if (be-mvc-point_query) {
for (i = mb-stop - 1; i  0; i--) {
q = getInstrPtr(mb, i);
if (q-token == ENDsymbol)
@@ -248,13 +248,16 @@ addOptimizers(Client c, MalBlkPtr mb, ch
if (getFunctionId(q) == mitosisRef || getFunctionId(q) 
== dataflowRef)
q-token = REMsymbol;   /* they are ignored */
}
+   }
+   SQLgetStatistics(c, be-mvc, mb);
+   if (be-mvc-emod  mod_debug)
+   addtoMalBlkHistory(mb, getStatistics);
 }
 
 void
 addQueryToCache(Client c)
 {
MalBlkPtr mb;
-   mvc *m;
backend *be;
str msg = 0, pipe;
 
@@ -267,7 +270,6 @@ addQueryToCache(Client c)
c-blkmode = 0;
mb = c-curprg-def;
chkProgram(c-fdout, c-nspace, mb);
-   m = ((backend *) c-sqlcontext)-mvc;
 #ifdef _SQL_OPTIMIZER_DEBUG
mnstr_printf(GDKout, ADD QUERY TO CACHE\n);
printFunction(GDKout, mb, 0, LIST_MAL_ALL);
@@ -282,7 +284,7 @@ addQueryToCache(Client c)
 
if (c-listing)
printFunction(c-fdout, mb, 0, c-listing);
-   if (m-debug) {
+   if (be-mvc-debug) {
msg = runMALDebugger(c, c-curprg);
if (msg != MAL_SUCCEED)
GDKfree(msg); /* ignore error */
@@ -290,10 +292,6 @@ addQueryToCache(Client c)
return;
}
addOptimizers(c, mb, pipe);
-   SQLgetStatistics(c, m, mb);
-   if (m-emod  mod_debug)
-   addtoMalBlkHistory(mb, getStatistics);
-
msg = optimizeMALBlock(c, mb);
if (msg != MAL_SUCCEED) {
showScriptException(c-fdout, mb, 0, MAL, %s, msg);
diff --git a/sql/backends/monet5/sql_optimizer.h 
b/sql/backends/monet5/sql_optimizer.h
--- a/sql/backends/monet5/sql_optimizer.h
+++ b/sql/backends/monet5/sql_optimizer.h
@@ -16,6 +16,6 @@ sql5_export void addQueryToCache(Client 
 sql5_export str SQLoptimizer(Client c);
 sql5_export void SQLsetAccessMode(Client c);
 sql5_export str getSQLoptimizer(mvc *m);
+sql5_export void addOptimizers(Client c, MalBlkPtr mb, char *pipe);
 
-sql5_export void addOptimizers(Client c, MalBlkPtr mb, char *pipe);
 #endif /* _SQL_OPTIMIZER_H_ */
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
@@ -37,6 +37,7 @@
 #include sql_readline.h
 #include sql_user.h
 #include sql_datetime.h
+#include sql_optimizer.h
 #include mal_io.h
 #include mal_parser.h
 #include mal_builder.h
@@ -1207,7 +1208,7 @@ recompilequery:
 
trimMalBlk(mb);
chkProgram(c-fdout, c-nspace, mb);
-   addOptimizerPipe(c, mb, default_pipe);
+   addOptimizers(c, mb, default_pipe);
msg = optimizeMALBlock(c, mb);
if (msg != MAL_SUCCEED) {
sqlcleanup(m, err);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - remove the 'explain' added will debuging ...

2015-05-18 Thread Niels Nes
Changeset: 58b948018b36 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=58b948018b36
Modified Files:
sql/test/Triggers/trigger_activation.sql
Branch: default
Log Message:

remove the 'explain' added will debuging ...


diffs (12 lines):

diff --git a/sql/test/Triggers/trigger_activation.sql 
b/sql/test/Triggers/trigger_activation.sql
--- a/sql/test/Triggers/trigger_activation.sql
+++ b/sql/test/Triggers/trigger_activation.sql
@@ -24,7 +24,7 @@ create trigger test_5_4
after update on t_5_1
insert into t_5_1 values(30, 'update_from_test_5_4');
 
-explain update t_5_1 set name = 'mo' where id = 11;
+update t_5_1 set name = 'mo' where id = 11;
 
 select * from t_5_1;
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - use correct types for result of strlen (size_t)

2015-05-18 Thread Niels Nes
Changeset: a4eaa8a75e7e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a4eaa8a75e7e
Modified Files:
monetdb5/mal/mal_parser.c
Branch: default
Log Message:

use correct types for result of strlen (size_t)


diffs (12 lines):

diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1385,7 +1385,7 @@ parseCommandPattern(Client cntxt, int ki
Symbol curPrg = 0;
InstrPtr curInstr = 0;
str modnme = NULL;
-   int l = 0;
+   size_t l = 0;
 
curBlk = fcnHeader(cntxt, kind);
if (curBlk == NULL) 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - use more hash tables in the logger, speeds up...

2015-05-18 Thread Niels Nes
Changeset: d5873065fc23 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5873065fc23
Modified Files:
gdk/gdk_logger.c
gdk/gdk_logger.h
gdk/gdk_search.c
Branch: default
Log Message:

use more hash tables in the logger, speeds up startup.
(for now disabled use of persistent hash as the case of updates before
loading the hash table isn't handled savely)


diffs (114 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -104,6 +104,7 @@ static int tr_grow(trans *tr);
 static BUN
 log_find_int(BAT *b, BAT *d, int val)
 {
+#if 0
BUN p, q;
int *t = (int *) Tloc(b, BUNfirst(b));
 
@@ -114,11 +115,25 @@ log_find_int(BAT *b, BAT *d, int val)
return pos;
}
return BUN_NONE;
+#else
+   BATiter cni = bat_iterator(b);
+   BUN p;
+
+   if (b-T-hash || BAThash(b, 0) == GDK_SUCCEED) {
+   HASHloop_int(cni, cni.b-T-hash, p, val) {
+   oid pos = p;
+   if (BUNfnd(d, pos) == BUN_NONE)
+   return p;
+   }
+   } 
+   return BUN_NONE;
+#endif
 }
 
 static BUN
 log_find_bid(BAT *b, BAT *d, log_bid val)
 {
+#if 0
BUN p, q;
log_bid *t = (log_bid *) Tloc(b, BUNfirst(b));
 
@@ -129,6 +144,19 @@ log_find_bid(BAT *b, BAT *d, log_bid val
return pos;
}
return BUN_NONE;
+#else
+   BATiter cni = bat_iterator(b);
+   BUN p;
+
+   if (b-T-hash || BAThash(b, 0) == GDK_SUCCEED) {
+   HASHloop_int(cni, cni.b-T-hash, p, val) {
+   oid pos = p;
+   if (BUNfnd(d, pos) == BUN_NONE)
+   return p;
+   }
+   } 
+   return BUN_NONE;
+#endif
 }
 
 static void
@@ -340,8 +368,12 @@ log_read_updates(logger *lg, trans *tr, 
BAT *uid = NULL;
BAT *r;
void *(*rt) (ptr, stream *, size_t) = BATatoms[tt].atomRead;
-   void *tv = ATOMnil(tt);
+   void *tv = NULL;
 
+   if (tt  TYPE_str)
+   tv = lg-buf;
+   else if (tt  TYPE_str)
+   tv = ATOMnil(tt);
 #if SIZEOF_OID == 8
if (tt == TYPE_oid  lg-read32bitoid)
rt = BATatoms[TYPE_int].atomRead;
@@ -444,7 +476,8 @@ log_read_updates(logger *lg, trans *tr, 
}
GDKfree(hv);
}
-   GDKfree(tv);
+   if (tv != lg-buf) 
+   GDKfree(tv);
logbat_destroy(b);
 
if (tr_grow(tr)) {
@@ -1185,6 +1218,7 @@ logger_new(int debug, const char *fn, co
lg-seqs_id = NULL;
lg-seqs_val = NULL;
lg-dseqs = NULL;
+   lg-buf = GDKmalloc(lg-bufsize = 64*1024);
 
snprintf(filename, sizeof(filename), %s%s, lg-dir, LOGFILE);
snprintf(bak, sizeof(bak), %s.bak, filename);
diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -69,6 +69,8 @@ typedef struct logger {
   These snapshot bats should be freed
   directly (on transaction
   commit). */
+   void *buf;
+   void *bufsize;
 } logger;
 
 #define BATSIZE 0
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -224,6 +224,9 @@ BATcheckhash(BAT *b)
int ret;
lng t;
 
+   if (b-T-hash == NULL)
+   return 0;
+
t = GDKusec();
MT_lock_set(GDKhashLock(abs(b-batCacheid)), BATcheckhash);
t = GDKusec() - t;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - small optimization and cleanup of exported ma...

2015-05-18 Thread Niels Nes
Changeset: 0df73662d747 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0df73662d747
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_parser.h
Branch: default
Log Message:

small optimization and cleanup of exported mal parser symbols


diffs (truncated from 338 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
@@ -1380,8 +1380,6 @@ str MALengine(Client c);
 str MALexitClient(Client c);
 str MALgarbagesink(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str MALinitClient(Client c);
-int MALkeyword(Client cntxt, str kw, int length);
-int MALlookahead(Client cntxt, str kw, int length);
 str MALoptimizer(Client c);
 str MALparser(Client c);
 str MALpass(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
@@ -2101,7 +2099,6 @@ int canBeCrackedProp;
 int canBeJoinselectProp;
 str catalogRef;
 str catchKernelException(Client cntxt, str ret);
-int charCst(Client cntxt, ValPtr val);
 void chkDeclarations(stream *out, MalBlkPtr mb);
 void chkFlow(stream *out, MalBlkPtr mb);
 int chkInstruction(stream *out, Module s, MalBlkPtr mb, InstrPtr p);
@@ -2141,7 +2138,6 @@ int cpyConstant(MalBlkPtr mb, VarPtr vr)
 str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
3, 4)));
 str createRef;
 str crossRef;
-int cstToken(Client cntxt, ValPtr val);
 str datacyclotronRef;
 str dataflowRef;
 str dateRef;
@@ -2154,7 +2150,6 @@ str dblRef;
 void debugFunction(stream *fd, MalBlkPtr mb, MalStkPtr stk, int flg, int 
first, int size);
 void debugLifespan(Client cntxt, MalBlkPtr mb, Lifespan span);
 str debugOptimizers(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-void debugParser(int i);
 str debugScheduler(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 int defConstant(MalBlkPtr mb, int type, ValPtr cst);
 str defineRef;
@@ -2176,7 +2171,6 @@ str divRef;
 void dumpExceptionsToStream(stream *out, str msg);
 void dumpHelpTable(stream *f, Module s, str text, int flag);
 void dumpSearchTable(stream *f, str text);
-void echoInput(Client cntxt);
 str eqRef;
 str escape_str(str *retval, str s);
 str evalFile(Client c, str fname, int listing);
@@ -2270,7 +2264,6 @@ str hgeRef;
 int hlbProp;
 int horiginProp;
 int hubProp;
-int idLength(Client cntxt);
 str identityRef;
 str ifthenelseRef;
 str ilikeRef;
@@ -2340,7 +2333,6 @@ str kdifferenceRef;
 int keepProp;
 str kunionRef;
 str languageRef;
-str lastline(Client cntxt);
 str leftfetchjoinPathRef;
 str leftfetchjoinRef;
 str leftjoinPathRef;
@@ -2488,8 +2480,6 @@ str openProfilerStream(stream *fd);
 str openRef;
 int open_block_stream(Stream *S, Stream *is);
 str open_block_streamwrap(Stream *S, Stream *is);
-str operatorCopy(Client cntxt, int length);
-int operatorLength(Client cntxt);
 str operatorName(int i);
 lng optDebug;
 str optimizeMALBlock(Client cntxt, MalBlkPtr mb);
@@ -2499,7 +2489,6 @@ str optimizer_prelude(Client cntxt, MalB
 str pack2Ref;
 str packRef;
 str parametersRef;
-str parseError(Client cntxt, str msg);
 int parseMAL(Client cntxt, Symbol curPrg, int skipcomments);
 str partitionRef;
 str passRef;
@@ -2510,7 +2499,6 @@ str pinRef;
 int pivotDisjunctiveProp;
 int pivotProp;
 str plusRef;
-ssize_t position(Client cntxt);
 str postludeRef;
 str preludeRef;
 MalStkPtr prepareMALstack(MalBlkPtr mb, int size);
@@ -2667,7 +2655,6 @@ str strEpilogue(void *ret);
 str strPrelude(void *ret);
 str strRef;
 str streamsRef;
-int stringLength(Client cntxt);
 str stringdiff_impl(int *res, str *s1, str *s2);
 str subantijoinRef;
 str subavgRef;
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -28,13 +28,14 @@
 static str idCopy(Client cntxt, int len);
 static str strCopy(Client cntxt, int len);
 
-
+static str parseError(Client cntxt, str msg);
 
 /* Before a line is parsed we check for a request to echo it.
  * This command should be executed at the beginning of a parse
  * request and each time we encounter EOL.
 */
-void echoInput(Client cntxt)
+static void 
+echoInput(Client cntxt)
 {
if (cntxt-listing == 1) {
char *c = CURRENT(cntxt);
@@ -112,7 +113,7 @@ initParser(void)
 #undef isdigit
 #define isdigit(X)  ((X) = '0'  (X) = '9')
 
-int
+static int
 idLength(Client cntxt)
 {
str s, t;
@@ -169,18 +170,7 @@ idCopy(Client cntxt, int length)
return s;
 }
 
-int
-MALkeyword(Client cntxt, str kw, int length)
-{
-   skipSpace(cntxt);
-   if (MALlookahead(cntxt, kw, length)) {
-   advance(cntxt, length);
-   return 1;
-   }
-   return 0;
-}
-
-int
+static int
 MALlookahead(Client cntxt, str kw, int length)
 {
int i;
@@ -203,6 +193,18 @@ MALlookahead(Client cntxt, str kw, int l
  

MonetDB: default - small startup optimizations (more dynamic has...

2015-05-18 Thread Niels Nes
Changeset: cacec59223a4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cacec59223a4
Modified Files:
sql/storage/bat/bat_table.c
sql/storage/sql_catalog.c
sql/storage/store.c
Branch: default
Log Message:

small startup optimizations (more dynamic hash tables for sql structures, ie 
properly handle the 20K tables case)


diffs (133 lines):

diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c
--- a/sql/storage/bat/bat_table.c
+++ b/sql/storage/bat/bat_table.c
@@ -105,7 +105,7 @@ delta_full_bat_( sql_trans *tr, sql_colu
}
(void)c;
if (!bat-cached /* !tr-parent*/) 
-   bat-cached = temp_descriptor(b-batCacheid);
+   bat-cached = b;
return b;
 }
 
@@ -113,7 +113,7 @@ static BAT *
 delta_full_bat( sql_trans *tr, sql_column *c, sql_delta *bat, int temp)
 {
if (bat-cached /* !tr-parent*/) 
-   return temp_descriptor(bat-cached-batCacheid);
+   return bat-cached;
return delta_full_bat_( tr, c, bat, temp);
 }
 
@@ -127,6 +127,15 @@ full_column(sql_trans *tr, sql_column *c
return delta_full_bat(tr, c, c-data, isTemp(c));
 }
 
+static void
+full_destroy(sql_column *c, BAT *b)
+{
+   sql_delta *d = c-data;
+   assert(d);
+   if (d-cached != b)
+   bat_destroy(b);
+}
+
 static oid column_find_row(sql_trans *tr, sql_column *c, const void *value, 
...);
 static oid
 column_find_row(sql_trans *tr, sql_column *c, const void *value, ...)
@@ -141,7 +150,7 @@ column_find_row(sql_trans *tr, sql_colum
r = BATsubselect(b, s, value, NULL, 1, 0, 0);
bat_destroy(s);
s = r;
-   bat_destroy(b);
+   full_destroy(c, b);
while ((c = va_arg(va, sql_column *)) != NULL) {
value = va_arg(va, void *);
 
@@ -149,7 +158,7 @@ column_find_row(sql_trans *tr, sql_colum
r = BATsubselect(b, s, value, NULL, 1, 0, 0);
bat_destroy(s);
s = r;
-   bat_destroy(b);
+   full_destroy(c, b);
}
va_end(va);
if (BATcount(s) == 1) {
@@ -176,11 +185,11 @@ column_find_value(sql_trans *tr, sql_col
 
res = BUNtail(bi, q);
sz = ATOMlen(b-ttype, res);
-   r = GDKzalloc(sz);
+   r = GDKmalloc(sz);
memcpy(r,res,sz);
res = r;
}
-   bat_destroy(b);
+   full_destroy(c, b);
return res;
 }
 
@@ -290,10 +299,12 @@ rids_select( sql_trans *tr, sql_column *
if (!kvh  key_value_low != ATOMnilptr(b-ttype))
kvh = ATOMnilptr(b-ttype);
hi = (kvl == kvh);
+   if (!b-T-hash)
+   BAThash(b, 0);
r = BATsubselect(b, s, kvl, kvh, 1, hi, 0);
bat_destroy(s);
s = r;
-   bat_destroy(b);
+   full_destroy(key, b);
if (key_value_low || key_value_high) {
va_start(va, key_value_high);
while ((key = va_arg(va, sql_column *)) != NULL) {
@@ -309,7 +320,7 @@ rids_select( sql_trans *tr, sql_column *
r = BATsubselect(b, s, kvl, kvh, 1, hi, 0);
bat_destroy(s);
s = r;
-   bat_destroy(b);
+   full_destroy(key, b);
}
va_end(va);
}
@@ -326,7 +337,7 @@ rids_orderby(sql_trans *tr, rids *r, sql
 
b = full_column(tr, orderby_col);
s = BATproject(r-data, b);
-   bat_destroy(b);
+   full_destroy(orderby_col, b);
BATsubsort(NULL, o, NULL, s, NULL, NULL, 0, 0);
bat_destroy(s);
s = BATproject(o, r-data);
diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -18,7 +18,7 @@ static void *
 
if (l) {
MT_lock_set(l-ht_lock, _list_find_name);
-   if (!l-ht  list_length(l)  HASH_MIN_SIZE  l-sa) {
+   if ((!l-ht || l-ht-size*16  list_length(l))  
list_length(l)  HASH_MIN_SIZE  l-sa) {
l-ht = hash_new(l-sa, list_length(l), 
(fkeyvalue)base_key);
 
for (n = l-h; n; n = n-next ) {
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2075,15 +2075,8 @@ sql_trans_copy_column( sql_trans *tr, sq
 static sql_table *
 schema_table_find(sql_schema *s, sql_table *ot)
 {
-   node *n;
-
if (s) 
-   for (n = s-tables.set-h; n; n = n-next) {
-   sql_table *t = n-data;
-
-   if (t-base.id == ot-base.id)
-   return t;
-   }
+   return find_sql_table(s, ot-base.name);
assert(NULL);
return NULL;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list