Changeset: 78fb24e315ba for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/78fb24e315ba
Branch: sch_rename_more_permissive
Log Message:

Merge with default


diffs (truncated from 633 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
@@ -25330,122 +25330,62 @@ SQLvar_pop;
 return the variance population of groups
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:bte]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:dbl]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:bte]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:flt]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:int]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:lng]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:dbl]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat[:sht]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bte):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:flt]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:dbl):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:int]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:flt):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:int):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:lng):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:lng]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:sht):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:bte]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:any_1], X_1:int, X_2:int, X_3:int, 
X_4:bat?[:sht]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:dbl]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:bte]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:flt]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:int]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:lng]):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:dbl]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat[:sht]):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bte):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:dbl):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:flt]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:flt):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:int]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:int):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:lng]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batsql
 window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:lng):bat[:oid]
-SQLwindow_bound;
-computes window ranges for each row
-batsql
-window_bound
-pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:sht):bat[:oid]
+pattern batsql.window_bound(X_0:bat[:bit], X_1:bat[:any_1], X_2:int, X_3:int, 
X_4:int, X_5:bat?[:sht]):bat[:oid]
 SQLwindow_bound;
 computes window ranges for each row
 batstr
@@ -37445,7 +37385,7 @@ mvc_clear_table_wrap;
 Clear the table sname.tname.
 sql
 copy_from
-unsafe pattern sql.copy_from(X_0:ptr, X_1:str, X_2:str, X_3:str, X_4:str, 
X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, X_10:int, X_11:int):bat[:any]...
+unsafe pattern sql.copy_from(X_0:ptr, X_1:str, X_2:str, X_3:str, X_4:str, 
X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, X_10:int, X_11:int, X_12:str, 
X_13:str):bat[:any]...
 mvc_import_table_wrap;
 Import a table from bstream s with the @given tuple and seperators (sep/rsep)
 sql
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1132,6 +1132,17 @@ bat_iterator_nolock(BAT *b)
        return (BATiter) {0};
 }
 
+static inline void
+bat_iterator_incref(BATiter *bi)
+{
+#ifndef NDEBUG
+       bi->locked = true;
+#endif
+       HEAPincref(bi->h);
+       if (bi->vh)
+               HEAPincref(bi->vh);
+}
+
 static inline BATiter
 bat_iterator(BAT *b)
 {
@@ -1158,12 +1169,7 @@ bat_iterator(BAT *b)
                        MT_lock_set(&pvb->theaplock);
                }
                bi = bat_iterator_nolock(b);
-#ifndef NDEBUG
-               bi.locked = true;
-#endif
-               HEAPincref(bi.h);
-               if (bi.vh)
-                       HEAPincref(bi.vh);
+               bat_iterator_incref(&bi);
                if (pvb)
                        MT_lock_unset(&pvb->theaplock);
                if (pb)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -822,12 +822,7 @@ COLcopy(BAT *b, int tt, bool writable, r
        if (ATOMstorage(b->ttype) == TYPE_str && b->tvheap->free >= 
GDK_STRHASHSIZE)
                memcpy(strhash, b->tvheap->base, GDK_STRHASHSIZE);
 
-#ifndef NDEBUG
-       bi.locked = true;
-#endif
-       HEAPincref(bi.h);
-       if (bi.vh)
-               HEAPincref(bi.vh);
+       bat_iterator_incref(&bi);
        MT_lock_unset(&b->theaplock);
 
        /* first try case (1); create a view, possibly with different
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2464,7 +2464,8 @@ BBPdir_step(bat bid, BUN size, int n, ch
                        }
                }
        }
-       if (BBP_status(bid) & BBPPERSISTENT) {
+       if (bi) {
+               assert(BBP_status(bid) & BBPPERSISTENT);
                if (new_bbpentry(nbbpf, bid, size, bi) != GDK_SUCCEED)
                        goto bailout;
        }
@@ -3871,12 +3872,7 @@ BBPbackup(BAT *b, bool subcommit)
                bi.h = b->oldtail;
                bi.hdirty = b->oldtail->dirty;
        }
-#ifndef NDEBUG
-       bi.locked = true;
-#endif
-       HEAPincref(bi.h);
-       if (bi.vh)
-               HEAPincref(bi.vh);
+       bat_iterator_incref(&bi);
        MT_lock_unset(&b->theaplock);
 
        /* determine location dir and physical suffix */
@@ -4038,9 +4034,15 @@ BBPsync(int cnt, bat *restrict subcommit
 
        ret = BBPprepare(subcommit != NULL);
 
-       /* PHASE 1: safeguard everything in a backup-dir */
+       if (ret == GDK_SUCCEED) {
+               ret = BBPdir_first(subcommit != NULL, logno, &obbpf, &nbbpf);
+       }
+
        for (int idx = 1; ret == GDK_SUCCEED && idx < cnt; idx++) {
                bat i = subcommit ? subcommit[idx] : idx;
+               BUN size = sizes ? sizes[idx] : BUN_NONE;
+               BATiter bi, *bip;
+
                const bat bid = i;
                if (lock)
                        MT_lock_set(&GDKswapLock(bid));
@@ -4059,40 +4061,27 @@ BBPsync(int cnt, bat *restrict subcommit
                                MT_lock_set(&GDKswapLock(bid));
                }
                BAT *b = dirty_bat(&i, subcommit != NULL);
-               if (i <= 0 ||
-                   (BBP_status(bid) & BBPEXISTING &&
-                    b != NULL &&
-                    b->batInserted > 0 &&
-                    BBPbackup(b, subcommit != NULL) != GDK_SUCCEED)) {
+               if (i <= 0)
                        ret = GDK_FAIL;
-               }
+               else if (BBP_status(bid) & BBPEXISTING &&
+                        b != NULL &&
+                        b->batInserted > 0)
+                       ret = BBPbackup(b, subcommit != NULL);
+
                if (lock)
                        MT_lock_unset(&GDKswapLock(bid));
-       }
-       TRC_DEBUG(PERF, "move time "LLFMT" usec, %d files\n", (t1 = GDKusec()) 
- t0, backup_files);
-
-       /* PHASE 2: save the repository and write new BBP.dir file */
-       if (ret == GDK_SUCCEED) {
-               ret = BBPdir_first(subcommit != NULL, logno, &obbpf, &nbbpf);
-       }
-
-       for (int idx = 1; ret == GDK_SUCCEED && idx < cnt; idx++) {
-               bat i = subcommit ? subcommit[idx] : idx;
-               BUN size = sizes ? sizes[idx] : BUN_NONE;
-               BATiter bi;
+
+               if (ret != GDK_SUCCEED)
+                       break;
 
                if (BBP_status(i) & BBPPERSISTENT) {
-                       BAT *b = dirty_bat(&i, subcommit != NULL);
-                       if (i <= 0) {
-                               ret = GDK_FAIL;
-                               break;
-                       }
-                       bi = bat_iterator(BBP_desc(i));
+                       MT_lock_set(&BBP_desc(i)->theaplock);
+                       bi = bat_iterator_nolock(BBP_desc(i));
+                       bat_iterator_incref(&bi);
                        assert(sizes == NULL || size <= bi.count);
                        assert(sizes == NULL || bi.width == 0 || (bi.type == 
TYPE_msk ? ((size + 31) / 32) * 4 : size << bi.shift) <= bi.hfree);
                        if (size > bi.count) /* includes sizes==NULL */
                                size = bi.count;
-                       MT_lock_set(&bi.b->theaplock);
                        bi.b->batInserted = size;
                        if (bi.b->ttype >= 0 && ATOMvarsized(bi.b->ttype)) {
                                /* see epilogue() for other part of this */
@@ -4127,15 +4116,17 @@ BBPsync(int cnt, bat *restrict subcommit
                                ret = BATsave_iter(b, &bi, size);
                                BBP_status_off(i, BBPSAVING);
                        }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to