Changeset: c37f17766c6b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c37f17766c6b
Modified Files:
MonetDB5/src/optimizer/opt_mitosis.mx
sql/src/backends/monet5/merovingian/client/Makefile.ag
sql/src/backends/monet5/merovingian/daemon/Makefile.ag
sql/src/backends/monet5/merovingian/utils/Makefile.ag
sql/src/server/rel_schema.c
sql/src/server/rel_semantic.c
sql/src/server/sql_scan.c
Branch: sciql
Log Message:
Merge from default
diffs (truncated from 3489 to 300 lines):
diff -r bb0ae5e1fd53 -r c37f17766c6b MonetDB/src/common/monet_options.mx
--- a/MonetDB/src/common/monet_options.mx Mon Oct 25 16:23:03 2010 +0200
+++ b/MonetDB/src/common/monet_options.mx Mon Oct 25 16:36:12 2010 +0200
@@ -69,7 +69,8 @@
/* the option values can contain ${variable} (or %variable%), these
will be substituted using the mo_substitute function. The return
- value is a newly allocated buffer, it is the caller's responsibility to
free the buffer. */
+ value is a newly allocated buffer, it is the caller's
+ responsibility to free the buffer. */
#ifdef WIN32
/* on Windows, the option values can also contain %prefix% and
%exec_prefix% which will be substituted as well. */
@@ -368,7 +369,7 @@
if (Set == NULL)
return 0;
-#define N_OPTIONS 23 /*MUST MATCH # OPTIONS BELOW */
+#define N_OPTIONS 26 /*MUST MATCH # OPTIONS BELOW */
set = malloc(sizeof(opt) * N_OPTIONS);
if (set == NULL)
return 0;
@@ -468,6 +469,18 @@
set[i].value = strdup("false");
i++;
set[i].kind = opt_builtin;
+ set[i].name = strdup("default_pipe");
+ set[i].value =
strdup("inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector");
+ i++;
+ set[i].kind = opt_builtin;
+ set[i].name = strdup("minimal_pipe");
+ set[i].value =
strdup("inline,remap,deadcode,multiplex,garbageCollector");
+ i++;
+ set[i].kind = opt_builtin;
+ set[i].name = strdup("sql_optimizer");
+ set[i].value = strdup("default_pipe");
+ i++;
+ set[i].kind = opt_builtin;
set[i].name = strdup("sql_debug");
set[i].value = strdup("0");
i++;
diff -r bb0ae5e1fd53 -r c37f17766c6b MonetDB/src/gdk/gdk_batop.mx
--- a/MonetDB/src/gdk/gdk_batop.mx Mon Oct 25 16:23:03 2010 +0200
+++ b/MonetDB/src/gdk/gdk_batop.mx Mon Oct 25 16:36:12 2010 +0200
@@ -445,7 +445,7 @@
}
b->batDirty = 1;
- BATaccessBegin(b, USE_HHASH | USE_THASH, MMAP_SEQUENTIAL);
+ BATaccessBegin(b, USE_HHASH | USE_THASH, MMAP_WILLNEED);
BATaccessBegin(n, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
if (sz > BATcapacity(b) - BUNlast(b)) {
@@ -991,7 +991,6 @@
BBPreclaim(bn);
return NULL;
}
- BATaccessBegin(b, USE_HEAD | USE_HHASH | USE_TAIL, MMAP_WILLNEED);
while (bn) {
BUN q = BUNfirst(bn);
BUN r;
@@ -1012,7 +1011,6 @@
BBPreclaim(bn);
bn = BATnew(ht, tt, size);
}
- BATaccessEnd(b, USE_HEAD | USE_HHASH | USE_TAIL, MMAP_WILLNEED);
return bn;
}
diff -r bb0ae5e1fd53 -r c37f17766c6b MonetDB/src/gdk/gdk_bbp.mx
--- a/MonetDB/src/gdk/gdk_bbp.mx Mon Oct 25 16:23:03 2010 +0200
+++ b/MonetDB/src/gdk/gdk_bbp.mx Mon Oct 25 16:36:12 2010 +0200
@@ -2106,6 +2106,12 @@
if (!bs->P.lview) {
b = getBBPdescriptor(hp, lock);
bs->B.H->heap.base = b->H->heap.base + (size_t)
bs->B.H->heap.base;
+ /* if we shared the hash before, share
+ it again note that if the parent's
+ hash is destroyed, we also don't
+ have a hash anymore */
+ if (bs->B.H->hash == (Hash *) -1)
+ bs->B.H->hash = b->H->hash;
}
}
if (tp) {
@@ -2114,6 +2120,12 @@
bs->B.H != bs->B.T) { /* mirror? */
b = getBBPdescriptor(tp, lock);
bs->B.T->heap.base = b->H->heap.base + (size_t)
bs->B.T->heap.base;
+ /* if we shared the hash before, share
+ it again note that if the parent's
+ hash is destroyed, we also don't
+ have a hash anymore */
+ if (bs->B.T->hash == (Hash *) -1)
+ bs->B.T->hash = b->H->hash;
}
}
if (hvp)
@@ -2205,6 +2217,15 @@
b->H != b->T &&
!b->P->lview)
b->T->heap.base = (char *)
(b->T->heap.base - BBP_cache(tp)->H->heap.base);
+ /* if a view shared the hash with its
+ parent, indicate this, but only if
+ view isn't getting destroyed */
+ if (hp && b->H->hash &&
+ b->H->hash == BBP_cache(hp)->H->hash)
+ b->H->hash = (Hash *) -1;
+ if (tp && b->T->hash &&
+ b->T->hash == BBP_cache(tp)->H->hash)
+ b->T->hash = (Hash *) -1;
hvp = VIEWvhparent(b);
tvp = VIEWvtparent(b);
}
diff -r bb0ae5e1fd53 -r c37f17766c6b MonetDB/src/gdk/gdk_logger.mx
--- a/MonetDB/src/gdk/gdk_logger.mx Mon Oct 25 16:23:03 2010 +0200
+++ b/MonetDB/src/gdk/gdk_logger.mx Mon Oct 25 16:36:12 2010 +0200
@@ -1006,47 +1006,48 @@
bm_subcommit(BAT *list, BAT *catalog, BAT *extra, int debug)
{
BUN p, q;
- bat *n = (bat*)GDKmalloc(sizeof(bat) * (2 + BATcount(list) * 2 + (extra
? BATcount(extra) : 0)));
+ BUN nn = 2 + (list->batFirst > list->batDeleted ? list->batFirst -
list->batDeleted : 0) + BATcount(list) + (extra ? BATcount(extra) : 0);
+ bat *n = (bat*)GDKmalloc(sizeof(bat) * nn);
int i = 0;
- BAT *b = list;
- BATiter bi = bat_iterator(b);
+ BATiter iter = bat_iterator(list);
int res;
n[i++] = 0; /* n[0] is not used */
/* first loop over deleted then over current and new */
- for (p = b->batDeleted; p < b->batFirst; p++) {
- bat col = *(log_bid *) BUNhead(bi, p);
+ for (p = list->batDeleted; p < list->batFirst; p++) {
+ bat col = *(log_bid *) BUNhead(iter, p);
if (debug & 1)
fprintf(stderr, "commit deleted %s (%d) %s\n",
BBPname(col), col,
- (b == catalog) ? BUNtail(bi, p) : "snapshot");
+ (list == catalog) ? BUNtail(iter, p) :
"snapshot");
n[i++] = ABS(col);
}
- BATloop(b, p, q) {
- bat col = *(log_bid *) BUNhead(bi, p);
+ BATloop(list, p, q) {
+ bat col = *(log_bid *) BUNhead(iter, p);
if (debug & 1)
fprintf(stderr, "commit new %s (%d) %s\n",
BBPname(col), col,
- (b == catalog) ? BUNtail(bi, p) : "snapshot");
+ (list == catalog) ? BUNtail(iter, p) :
"snapshot");
n[i++] = ABS(col);
}
if (extra) {
- bi = bat_iterator(extra);
+ iter = bat_iterator(extra);
BATloop(extra, p, q) {
- str name = (str) BUNtail(bi, p);
+ str name = (str) BUNtail(iter, p);
if (debug & 1)
fprintf(stderr, "commit extra %s %s\n",
name,
- (b == catalog) ? BUNtail(bi, p) :
"snapshot");
+ (list == catalog) ? BUNtail(iter, p) :
"snapshot");
n[i++] = ABS(BBPindex(name));
}
}
/* now commit catalog, so it's also up to date on disk */
n[i++] = ABS(catalog->batCacheid);
+ assert((BUN) i <= nn);
BATcommit(catalog);
res = TMsubcommit_list(n, i);
GDKfree(n);
diff -r bb0ae5e1fd53 -r c37f17766c6b MonetDB/src/gdk/gdk_relop.mx
--- a/MonetDB/src/gdk/gdk_relop.mx Mon Oct 25 16:23:03 2010 +0200
+++ b/MonetDB/src/gdk/gdk_relop.mx Mon Oct 25 16:36:12 2010 +0200
@@ -288,7 +288,10 @@
return NULL;
}
BATaccessBegin(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessBegin(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL :
MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessBegin(r, USE_HEAD | USE_TAIL, r_scan > 0 ?
MMAP_SEQUENTIAL : MMAP_WILLNEED);
if (bn == NULL) {
@:joinbat(JOIN_EQ,mergejoin(l,r,NULL,nil_on_miss,BUN_NONE,NULL),estimate)@
}
@@ -366,7 +369,10 @@
/* propagate properties */
bunins_done:
BATaccessEnd(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL :
MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ?
MMAP_SEQUENTIAL : MMAP_WILLNEED);
bn->hsorted = BAThordered(l);
if (r->hkey) {
if (BATcount(bn) == BATcount(l)) {
@@ -393,7 +399,10 @@
return bn;
bunins_failed:
BATaccessEnd(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL :
MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ?
MMAP_SEQUENTIAL : MMAP_WILLNEED);
BBPreclaim(bn);
return NULL;
}
@@ -486,7 +495,10 @@
return NULL;
}
BATaccessEnd(r, USE_HEAD, MMAP_SEQUENTIAL);
- BATaccessBegin(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessBegin(r, USE_HEAD | USE_TAIL | USE_HHASH,
MMAP_WILLNEED);
switch (any = ATOMstorage(l->ttype)) {
#ifndef NOEXPAND_CHR
case TYPE_chr:
@@ -518,7 +530,10 @@
default:
@:hashjoin(atom,any,tail,any)@
}
- BATaccessEnd(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessEnd(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
/* propagate alignment info */
bn->hsorted = BAThordered(l);
@@ -677,7 +692,10 @@
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin:
defaultfetchjoin(@1,@2);\n");
BATaccessBegin(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
/*BATaccessBegin(bn, MMAP_SEQUENTIAL);*/
BATloop(l, l_cur, l_end) {
yy = (BUN) (offset + *(oid *) BUNtail(li, l_cur));
@@ -692,7 +710,10 @@
goto bunins_failed;
bunins_failed:
BATaccessEnd(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
/*BATaccessEnd(bn, MMAP_SEQUENTIAL);*/
BATsetcount(bn, dst);
if (!ret)
@@ -809,7 +830,10 @@
@= defaultvoidfetchjoin
ALGODEBUG THRprintf(GDKout, "#BATfetchjoin:
defaultvoidfetchjoin(@1);\n");
BATaccessBegin(l, USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
BATloop(l, l_cur, l_end) {
BUN _yy = (BUN) (offset + * (oid *) BUNtloc(li, l_cur));
@@ -824,7 +848,10 @@
dst++;
}
BATaccessEnd(l, USE_TAIL, MMAP_SEQUENTIAL);
- BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
if (nondense) {
BATiter bni;
/* not (yet?) completely type-optimized ! */
@@ -1516,7 +1543,10 @@
BUN p, q;
@4
- BATaccessBegin(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+ /* use MMAP_WILLNEED only if random access is not too scattered, *
+ * i.e., only if number of lookups is more than 10% of inner BAT */
+ if (BATcount(l) > BATcount(r)/10)
+ BATaccessBegin(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
BATloop(l, p, q) {
BUN i = 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list