Changeset: 5e2ae7afa523 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5e2ae7afa523
Modified Files:
gdk/gdk_bat.c
gdk/gdk_bbp.c
monetdb5/modules/kernel/bat5.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql.h
Branch: strheapvacuum
Log Message:
merge default
diffs (truncated from 7409 to 300 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
@@ -9110,6 +9110,8 @@
[ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",
"", "" ]
[ "optimizer", "wlc", "pattern optimizer.wlc():str ", "OPTwrapper;", ""
]
[ "optimizer", "wlc", "pattern optimizer.wlc(X_0:str, X_1:str):str ",
"OPTwrapper;", "Inject the workload capture-replay primitives" ]
+[ "optimizer", "wrapper", "pattern optimizer.wrapper():str ",
"OPTwrapper;", "" ]
+[ "optimizer", "wrapper", "pattern optimizer.wrapper(X_0:str,
X_1:str):str ", "OPTwrapper;", "Fake optimizer" ]
[ "pcre", "imatch", "command pcre.imatch(X_0:str, X_1:str):bit ",
"PCREimatch;", "Caseless Perl Compatible Regular Expression pattern matching
against a string" ]
[ "pcre", "index", "command pcre.index(X_0:pcre, X_1:str):int ",
"PCREindex;", "match a pattern, return matched position (or 0 when not
found)" ]
[ "pcre", "match", "command pcre.match(X_0:str, X_1:str):bit ",
"PCREmatch;", "Perl Compatible Regular Expression pattern matching against a
string" ]
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
@@ -12410,6 +12410,8 @@
[ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",
"", "" ]
[ "optimizer", "wlc", "pattern optimizer.wlc():str ", "OPTwrapper;", ""
]
[ "optimizer", "wlc", "pattern optimizer.wlc(X_0:str, X_1:str):str ",
"OPTwrapper;", "Inject the workload capture-replay primitives" ]
+[ "optimizer", "wrapper", "pattern optimizer.wrapper():str ",
"OPTwrapper;", "" ]
+[ "optimizer", "wrapper", "pattern optimizer.wrapper(X_0:str,
X_1:str):str ", "OPTwrapper;", "Fake optimizer" ]
[ "pcre", "imatch", "command pcre.imatch(X_0:str, X_1:str):bit ",
"PCREimatch;", "Caseless Perl Compatible Regular Expression pattern matching
against a string" ]
[ "pcre", "index", "command pcre.index(X_0:pcre, X_1:str):int ",
"PCREindex;", "match a pattern, return matched position (or 0 when not
found)" ]
[ "pcre", "match", "command pcre.match(X_0:str, X_1:str):bit ",
"PCREmatch;", "Perl Compatible Regular Expression pattern matching against a
string" ]
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
@@ -773,7 +773,8 @@ void MPresetProfiler(stream *fdout);
char *MSP_locate_sqlscript(const char *mod_name, bit recurse);
str MSinitClientPrg(Client cntxt, const char *mod, const char *nme);
void MSresetInstructions(MalBlkPtr mb, int start);
-void MSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start);
+void MSresetStack(Client cntxt, MalBlkPtr mb, MalStkPtr glb);
+void MSresetVariables(MalBlkPtr mb);
void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout,
protocol_version protocol, size_t blocksize);
str MSserveClient(Client cntxt);
str OIDXcreateImplementation(Client cntxt, int tpe, BAT *b, int pieces);
@@ -1137,6 +1138,7 @@ const char *mdbRef;
void mdbSetBreakRequest(Client cntxt, MalBlkPtr mb, str request, char cmd);
const char *mergecandRef;
const char *mergepackRef;
+const char *mergetableRef;
const char *minRef;
const char *min_no_nilRef;
const char *minusRef;
@@ -1227,7 +1229,6 @@ const char *plusRef;
const char *postludeRef;
const char *preludeRef;
MalStkPtr prepareMALstack(MalBlkPtr mb, int size);
-int prepareMalBlk(MalBlkPtr mb, str s);
void printFunction(stream *fd, MalBlkPtr mb, MalStkPtr stk, int flg);
void printInstruction(stream *fd, MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int
flg);
const char *printRef;
@@ -1386,6 +1387,7 @@ const char *thetajoinRef;
const char *thetaselectRef;
const char *tidRef;
const char *timestampRef;
+const char *totalRef;
void traceFunction(component_t comp, MalBlkPtr mb, MalStkPtr stk, int flg);
void traceInstruction(component_t comp, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p, int flg);
const char *transactionRef;
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2128,7 +2128,7 @@ BATroles(BAT *b, const char *tnme)
/* rather than deleting X.new, we comply with the commit protocol and
* move it to backup storage */
static gdk_return
-backup_new(Heap *hp)
+backup_new(Heap *hp, bool lock)
{
int batret, bakret, ret = -1;
char *batpath, *bakpath;
@@ -2139,7 +2139,8 @@ backup_new(Heap *hp)
bakpath = GDKfilepath(hp->farmid, BAKDIR, hp->filename, ".new");
if (batpath != NULL && bakpath != NULL) {
/* file actions here interact with the global commits */
- MT_lock_set(&GDKtmLock);
+ if (lock)
+ MT_lock_set(&GDKtmLock);
batret = MT_stat(batpath, &st);
bakret = MT_stat(bakpath, &st);
@@ -2159,7 +2160,8 @@ backup_new(Heap *hp)
} else {
ret = 0;
}
- MT_lock_unset(&GDKtmLock);
+ if (lock)
+ MT_lock_unset(&GDKtmLock);
}
GDKfree(batpath);
GDKfree(bakpath);
@@ -2178,11 +2180,12 @@ HEAPchangeaccess(Heap *hp, int dstmode,
if (dstmode == BAT_WRITE) {
if (hp->storage != STORE_PRIV)
hp->dirty = true; /* exception c does not make it
dirty */
- return STORE_PRIV; /* 4=>6,5=>7,c=>6 persistent BAT_WRITE
needs STORE_PRIV */
+// return STORE_PRIV; /* 4=>6,5=>7,c=>6 persistent BAT_WRITE
needs STORE_PRIV */
+ return STORE_MMAP;
}
if (hp->storage == STORE_MMAP) { /* 6=>4 */
hp->dirty = true;
- return backup_new(hp) != GDK_SUCCEED ? STORE_INVALID :
STORE_MMAP; /* only called for existing bats */
+ return backup_new(hp, true) != GDK_SUCCEED ? STORE_INVALID :
STORE_MMAP; /* only called for existing bats */
}
return hp->storage; /* 7=>5 */
}
@@ -2194,7 +2197,7 @@ HEAPcommitpersistence(Heap *hp, bool wri
if (existing) { /* existing, ie will become transient */
if (hp->storage == STORE_MMAP && hp->newstorage == STORE_PRIV
&& writable) { /* 6=>2 */
hp->dirty = true;
- return backup_new(hp) != GDK_SUCCEED ? STORE_INVALID :
STORE_MMAP; /* only called for existing bats */
+ return backup_new(hp, false) != GDK_SUCCEED ?
STORE_INVALID : STORE_MMAP; /* only called for existing bats */
}
return hp->newstorage; /* 4=>0,5=>1,7=>3,c=>a no change */
}
@@ -2206,11 +2209,12 @@ HEAPcommitpersistence(Heap *hp, bool wri
if (hp->newstorage == STORE_MMAP)
hp->dirty = true; /* 2=>6 */
- return STORE_PRIV; /* 1=>5,2=>6,3=>7,a=>c,b=>6 states */
+// return STORE_PRIV; /* 1=>5,2=>6,3=>7,a=>c,b=>6 states */
+ return STORE_MMAP;
}
-#define ATOMappendpriv(t, h) (ATOMstorage(t) != TYPE_str || GDK_ELIMDOUBLES(h))
+#define ATOMappendpriv(t, h) (ATOMstorage(t) != TYPE_str /*||
GDK_ELIMDOUBLES(h) */)
/* change the heap modes at a commit */
gdk_return
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1467,7 +1467,6 @@ BATappend_or_update(BAT *b, BAT *p, cons
goto bailout;
}
if (BUNappend(b, new, force) != GDK_SUCCEED) {
- MT_rwlock_wrunlock(&b->thashlock);
bat_iterator_end(&ni);
return GDK_FAIL;
}
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3625,7 +3625,9 @@ BBPsync(int cnt, bat *restrict subcommit
BATiter bi = bat_iterator(b);
if (size > bi.count)
size = bi.count;
+ MT_rwlock_rdlock(&b->thashlock);
ret = BATsave_locked(b, &bi, size);
+ MT_rwlock_rdunlock(&b->thashlock);
bat_iterator_end(&bi);
BBP_status_off(i, BBPSAVING);
}
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -560,7 +560,7 @@ GDKload(int farmid, const char *nme, con
/* we couldn't read all, error
* already generated */
GDKfree(ret);
- GDKerror("short read from heap %s%s\n",
nme, ext ? ext : "");
+ GDKerror("short read from heap %s%s%s,
expected %zu, missing %zd\n", nme, ext ? "." : "", ext ? ext : "", size,
n_expected);
ret = NULL;
}
#ifndef NDEBUG
@@ -881,17 +881,8 @@ BATsave_locked(BAT *b, BATiter *bi, BUN
b->batDirtydesc = false;
}
MT_lock_unset(&b->theaplock);
- if (MT_rwlock_rdtry(&b->thashlock)) {
- /* if we can't get the lock, don't bother saving
- * the hash (normally, the hash lock should not
- * be acquired when the heap lock has already
- * been acquired, and here we have the heap
- * lock, so we must be careful with the hash
- * lock) */
- if (b->thash && b->thash != (Hash *) 1)
- BAThashsave(b, dosync);
- MT_rwlock_rdunlock(&b->thashlock);
- }
+ if (b->thash && b->thash != (Hash *) 1)
+ BAThashsave(b, dosync);
}
return err;
}
@@ -901,11 +892,11 @@ BATsave(BAT *b)
{
gdk_return rc;
+ BATiter bi = bat_iterator(b);
MT_rwlock_rdlock(&b->thashlock);
- BATiter bi = bat_iterator(b);
rc = BATsave_locked(b, &bi, bi.count);
+ MT_rwlock_rdunlock(&b->thashlock);
bat_iterator_end(&bi);
- MT_rwlock_rdunlock(&b->thashlock);
return rc;
}
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -248,17 +248,10 @@ OPTsql_appendImplementation(Client cntxt
static str
OPTsql_append(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
- str modnme;
- str fcnnme;
- str msg= MAL_SUCCEED;
- Symbol s= NULL;
- char buf[256];
- lng clk= GDKusec();
+ str modnme, fcnnme, msg = MAL_SUCCEED;
+ Symbol s = NULL;
int actions = 0;
- (void) cntxt;
- if( p )
- removeInstruction(mb, p);
#ifdef DEBUG_OPT_OPTIMIZERS
mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER sql_append\n");
#endif
@@ -279,11 +272,8 @@ OPTsql_append(Client cntxt, MalBlkPtr mb
}
s= findSymbol(cntxt->usermodule,
putName(modnme),putName(fcnnme));
- if( s == NULL) {
- char buf[1024];
- snprintf(buf,1024, "%s.%s",modnme,fcnnme);
- throw(MAL, "optimizer.sql_append",
RUNTIME_OBJECT_UNDEFINED ":%s", buf);
- }
+ if( s == NULL)
+ throw(MAL, "optimizer.sql_append",
RUNTIME_OBJECT_UNDEFINED ":%s.%s",modnme,fcnnme);
mb = s->def;
stk= 0;
}
@@ -292,21 +282,21 @@ OPTsql_append(Client cntxt, MalBlkPtr mb
addtoMalBlkHistory(mb);
return MAL_SUCCEED;
}
- actions= OPTsql_appendImplementation(cntxt, mb,stk,p);
+ actions = OPTsql_appendImplementation(cntxt, mb,stk,p);
- /* 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);
+ /* Defense line against incorrect plans */
+ if( actions > 0 && msg == MAL_SUCCEED){
+ msg = chkTypes(cntxt->usermodule, mb, FALSE);
+ if( msg == MAL_SUCCEED) msg = chkFlow(mb);
+ if( msg == MAL_SUCCEED) msg = chkDeclarations(mb);
+ }
#ifdef DEBUG_OPT_OPTIMIZERS
- mnstr_printf(cntxt->fdout,"=FINISHED sql_append %d\n",actions);
- printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL );
- mnstr_printf(cntxt->fdout,"#opt_reduce: " LLFMT " ms\n",t);
+ mnstr_printf(cntxt->fdout,"=FINISHED sql_append %d\n",actions);
+ printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL );
+ mnstr_printf(cntxt->fdout,"#opt_reduce: " LLFMT " ms\n",t);
#endif
- clk = GDKusec()- clk;
- snprintf(buf,256,"%-20s actions=%2d time=" LLFMT "
usec","optimizer.sql_append",actions, clk);
- newComment(mb,buf);
- addtoMalBlkHistory(mb);
+ /* keep actions taken as a fake argument*/
+ (void) pushInt(mb, p, actions);
return msg;
}
diff --git a/monetdb5/extras/rapi/Tests/rapi01.maltest
b/monetdb5/extras/rapi/Tests/rapi01.maltest
--- a/monetdb5/extras/rapi/Tests/rapi01.maltest
+++ b/monetdb5/extras/rapi/Tests/rapi01.maltest
@@ -75,4 +75,6 @@ r:bat[:dbl] := rapi.eval(nil:ptr,"ret0 <
statement error
io.print(r)
+----
+nil
diff --git a/monetdb5/mal/Tests/tst024.maltest
b/monetdb5/mal/Tests/tst024.maltest
--- a/monetdb5/mal/Tests/tst024.maltest
+++ b/monetdb5/mal/Tests/tst024.maltest
@@ -1,8 +1,8 @@
statement ok
function foo();
-X_5:=32;
-X_5:=23;
-io.print(X_5);
+GLB_5:=32;
+GLB_5:=23;
+io.print(GLB_5);
end foo;
query T rowsort
diff --git a/monetdb5/mal/Tests/tst034.maltest
b/monetdb5/mal/Tests/tst034.maltest
--- a/monetdb5/mal/Tests/tst034.maltest
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list