Changeset: f70db48d5bd9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f70db48d5bd9
Modified Files:
        gdk/gdk.h
        gdk/gdk_bbp.c
        gdk/gdk_strimps.c
        monetdb5/optimizer/opt_pipes.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_wrapper.c
        monetdb5/optimizer/optimizer.c
        sql/backends/monet5/sql.c
Branch: string_imprints
Log Message:

Merge with default


diffs (truncated from 8029 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/common/stream/fwf.c b/common/stream/fwf.c
--- a/common/stream/fwf.c
+++ b/common/stream/fwf.c
@@ -149,21 +149,18 @@ stream_fwf_create(stream *restrict s, si
        }
        fsd->in_buf = malloc(fsd->line_len);
        if (fsd->in_buf == NULL) {
-               close_stream(fsd->s);
                free(fsd);
                mnstr_set_open_error(STREAM_FWF_NAME, errno, NULL);
                return NULL;
        }
        fsd->out_buf = malloc(fsd->line_len * 3);
        if (fsd->out_buf == NULL) {
-               close_stream(fsd->s);
                free(fsd->in_buf);
                free(fsd);
                mnstr_set_open_error(STREAM_FWF_NAME, errno, NULL);
                return NULL;
        }
        if ((ns = create_stream(STREAM_FWF_NAME)) == NULL) {
-               close_stream(fsd->s);
                free(fsd->in_buf);
                free(fsd->out_buf);
                free(fsd);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -535,14 +535,14 @@ typedef enum {
 
 /* Heap storage modes */
 typedef enum {
-       STORE_MEM     = 0,      /* load into GDKmalloced memory */
-       STORE_MMAP    = 1,      /* mmap() into virtual memory */
-       STORE_PRIV    = 2,      /* BAT copy of copy-on-write mmap */
-       STORE_CMEM    = 3,      /* load into malloc (not GDKmalloc) memory*/
-       STORE_NOWN    = 4,      /* memory not owned by the BAT */
-       STORE_MMAPABS = 5,      /* mmap() into virtual memory from an
+       STORE_INVALID = 0,      /* invalid value, used to indicate error */
+       STORE_MEM,              /* load into GDKmalloced memory */
+       STORE_MMAP,             /* mmap() into virtual memory */
+       STORE_PRIV,             /* BAT copy of copy-on-write mmap */
+       STORE_CMEM,             /* load into malloc (not GDKmalloc) memory*/
+       STORE_NOWN,             /* memory not owned by the BAT */
+       STORE_MMAPABS,          /* mmap() into virtual memory from an
                                 * absolute path (not part of dbfarm) */
-       STORE_INVALID           /* invalid value, used to indicate error */
 } storage_t;
 
 typedef struct {
@@ -2151,9 +2151,8 @@ gdk_export void VIEWbounds(BAT *b, BAT *
  * correct for the reversed view.
  */
 #define isVIEW(x)                                                      \
-       (assert((x)->batCacheid > 0),                                   \
-        (((x)->theap && (x)->theap->parentid != (x)->batCacheid) ||    \
-         ((x)->tvheap && (x)->tvheap->parentid != (x)->batCacheid)))
+       (((x)->theap && (x)->theap->parentid != (x)->batCacheid) ||     \
+        ((x)->tvheap && (x)->tvheap->parentid != (x)->batCacheid))
 
 #define VIEWtparent(x) ((x)->theap == NULL || (x)->theap->parentid == 
(x)->batCacheid ? 0 : (x)->theap->parentid)
 #define VIEWvtparent(x)        ((x)->tvheap == NULL || (x)->tvheap->parentid 
== (x)->batCacheid ? 0 : (x)->tvheap->parentid)
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -178,7 +178,6 @@ BATmaterialize(BAT *b)
        cnt = BATcapacity(b);
        if ((tail = GDKmalloc(sizeof(Heap))) == NULL)
                return GDK_FAIL;
-       *tail = *b->theap;
        p = 0;
        q = BUNlast(b);
        assert(cnt >= q - p);
@@ -279,7 +278,6 @@ VIEWunlink(BAT *b)
                BAT *tpb = NULL;
                BAT *vtpb = NULL;
 
-               assert(b->batCacheid > 0);
                if (tp)
                        tpb = BBP_cache(tp);
                if (tp && !vtp)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -96,6 +96,7 @@ BATcreatedesc(oid hseq, int tt, bool hea
 
                .batRole = role,
                .batTransient = true,
+               .batRestricted = BAT_WRITE,
        };
        if (heapnames && (bn->theap = GDKmalloc(sizeof(Heap))) == NULL) {
                GDKfree(bn);
@@ -114,8 +115,6 @@ BATcreatedesc(oid hseq, int tt, bool hea
         * fill in heap names, so HEAPallocs can resort to disk for
         * very large writes.
         */
-       assert(bn->batCacheid > 0);
-
        if (heapnames) {
                assert(bn->theap != NULL);
                *bn->theap = (Heap) {
@@ -662,7 +661,6 @@ BATfree(BAT *b)
                return;
 
        /* deallocate all memory for a bat */
-       assert(b->batCacheid > 0);
        if (b->tident && !default_ident(b->tident))
                GDKfree(b->tident);
        b->tident = BATstring_t;
@@ -1636,10 +1634,10 @@ BUNinplacemulti(BAT *b, const oid *posit
        MT_lock_set(&b->theaplock);
        b->tminpos = minpos;
        b->tmaxpos = maxpos;
-       MT_lock_unset(&b->theaplock);
        b->theap->dirty = true;
        if (b->tvheap)
                b->tvheap->dirty = true;
+       MT_lock_unset(&b->theaplock);
 
        return GDK_SUCCEED;
 }
@@ -1900,7 +1898,6 @@ gdk_return
 BATkey(BAT *b, bool flag)
 {
        BATcheck(b, GDK_FAIL);
-       assert(b->batCacheid > 0);
        if (b->ttype == TYPE_void) {
                if (BATtdense(b) && !flag) {
                        GDKerror("dense column must be unique.\n");
@@ -1941,7 +1938,6 @@ BAThseqbase(BAT *b, oid o)
        if (b != NULL) {
                assert(o <= GDK_oid_max);       /* i.e., not oid_nil */
                assert(o + BATcount(b) <= GDK_oid_max);
-               assert(b->batCacheid > 0);
                if (b->hseqbase != o) {
                        b->batDirtydesc = true;
                        b->hseqbase = o;
@@ -1956,7 +1952,6 @@ BATtseqbase(BAT *b, oid o)
        if (b == NULL)
                return;
        assert(is_oid_nil(o) || o + BATcount(b) <= GDK_oid_max);
-       assert(b->batCacheid > 0);
        if (b->tseqbase != o) {
                b->batDirtydesc = true;
        }
@@ -2128,7 +2123,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 +2134,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 +2155,8 @@ backup_new(Heap *hp)
                } else {
                        ret = 0;
                }
-               MT_lock_unset(&GDKtmLock);
+               if (lock)
+                       MT_lock_unset(&GDKtmLock);
        }
        GDKfree(batpath);
        GDKfree(bakpath);
@@ -2182,7 +2179,7 @@ HEAPchangeaccess(Heap *hp, int dstmode, 
        }
        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 +2191,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 */
        }
@@ -2210,7 +2207,7 @@ HEAPcommitpersistence(Heap *hp, bool wri
 }
 
 
-#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
@@ -21,7 +21,6 @@
 gdk_return
 unshare_varsized_heap(BAT *b)
 {
-       assert(b->batCacheid > 0);
        if (ATOMvarsized(b->ttype) &&
            b->tvheap->parentid != b->batCacheid) {
                Heap *h = GDKzalloc(sizeof(Heap));
@@ -329,7 +328,6 @@ insert_string_bat(BAT *b, BAT *n, struct
        BATsetcount(b, oldcnt + ci->ncand);
        bat_iterator_end(&ni);
        assert(b->batCapacity >= b->batCount);
-       b->theap->dirty = true;
        /* maintain hash */
        MT_rwlock_wrlock(&b->thashlock);
        for (r = oldcnt, cnt = BATcount(b); b->thash && r < cnt; r++) {
@@ -402,7 +400,6 @@ append_varsized_bat(BAT *b, BAT *n, stru
                                *dst++ = src[canditer_next(ci) - hseq];
                        }
                }
-               b->theap->dirty = true;
                BATsetcount(b, BATcount(b) + ci->ncand);
                /* maintain hash table */
                MT_rwlock_wrlock(&b->thashlock);
@@ -459,7 +456,6 @@ append_varsized_bat(BAT *b, BAT *n, stru
        MT_rwlock_wrunlock(&b->thashlock);
        BATsetcount(b, r);
        bat_iterator_end(&ni);
-       b->theap->dirty = true;
        return GDK_SUCCEED;
 }
 
@@ -650,7 +646,6 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
        if (b == NULL || n == NULL || BATcount(n) == 0) {
                return GDK_SUCCEED;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to