Changeset: 1e456d348320 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1e456d348320
Modified Files:
        gdk/gdk_align.c
        gdk/gdk_batop.c
        gdk/gdk_logger.c
        gdk/gdk_storage.c
        sql/storage/objectset.c
Branch: Jan2022
Log Message:

merged with jul2021


diffs (150 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -140,6 +140,7 @@ VIEWcreate(oid seq, BAT *b)
                }
                if (bn->tvheap) {
                        BBPunshare(bn->tvheap->parentid);
+                       BBPunfix(bn->tvheap->parentid);
                        HEAPdecref(bn->tvheap, false);
                }
                HEAPdecref(bn->theap, false);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -91,8 +91,10 @@ insert_string_bat(BAT *b, BAT *n, struct
                /* we can share the vheaps, so we then only need to
                 * append the offsets */
                MT_lock_set(&b->theaplock);
-               if (b->tvheap->parentid != b->batCacheid)
+               if (b->tvheap->parentid != b->batCacheid) {
                        BBPunshare(b->tvheap->parentid);
+                       BBPunfix(b->tvheap->parentid);
+               }
                HEAPdecref(b->tvheap, b->tvheap->parentid == b->batCacheid);
                HEAPincref(ni.vh);
                b->tvheap = ni.vh;
@@ -374,8 +376,10 @@ append_varsized_bat(BAT *b, BAT *n, stru
                 * is read-only, we replace b's vheap with a reference
                 * to n's */
                MT_lock_set(&b->theaplock);
-               if (b->tvheap->parentid != b->batCacheid)
+               if (b->tvheap->parentid != b->batCacheid) {
                        BBPunshare(b->tvheap->parentid);
+                       BBPunfix(b->tvheap->parentid);
+               }
                BBPshare(ni.vh->parentid);
                HEAPdecref(b->tvheap, true);
                HEAPincref(ni.vh);
@@ -433,12 +437,14 @@ append_varsized_bat(BAT *b, BAT *n, stru
                        GDKfree(h);
                        return GDK_FAIL;
                }
-               BBPunshare(b->tvheap->parentid);
+               bat parid = b->tvheap->parentid;
+               BBPunshare(parid);
                MT_lock_set(&b->theaplock);
                HEAPdecref(b->tvheap, false);
                ATOMIC_INIT(&h->refs, 1);
                b->tvheap = h;
                MT_lock_unset(&b->theaplock);
+               BBPunfix(parid);
        }
        if (BATcount(b) == 0 && BATatoms[b->ttype].atomFix == NULL &&
            ci->tpe == cand_dense && ci->ncand == ni.count) {
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2236,7 +2236,7 @@ logger_next_logfile(logger *lg, ulng ts)
 {
        if (!lg->pending || !lg->pending->next)
                return 0;
-       if (lg->pending->last_ts < ts)
+       if (lg->pending->last_ts <= ts)
                return lg->pending->id;
        return 0;
 }
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -892,7 +892,9 @@ BATload_intern(bat bid, bool lock)
        /* LOAD bun heap */
        if (b->ttype != TYPE_void) {
                b->theap->storage = b->theap->newstorage = STORE_INVALID;
-               if (HEAPload(b->theap, b->theap->filename, NULL, 
b->batRestricted == BAT_READ) != GDK_SUCCEED) {
+               if ((b->batCount == 0 ?
+                    HEAPalloc(b->theap, b->batCapacity, b->twidth, 
ATOMsize(b->ttype)) :
+                    HEAPload(b->theap, b->theap->filename, NULL, 
b->batRestricted == BAT_READ)) != GDK_SUCCEED) {
                        HEAPfree(b->theap, false);
                        return NULL;
                }
@@ -909,7 +911,9 @@ BATload_intern(bat bid, bool lock)
        /* LOAD tail heap */
        if (ATOMvarsized(b->ttype)) {
                b->tvheap->storage = b->tvheap->newstorage = STORE_INVALID;
-               if (HEAPload(b->tvheap, nme, "theap", b->batRestricted == 
BAT_READ) != GDK_SUCCEED) {
+               if ((b->tvheap->free == 0 ?
+                    ATOMheap(b->ttype, b->tvheap, b->batCapacity) :
+                    HEAPload(b->tvheap, nme, "theap", b->batRestricted == 
BAT_READ)) != GDK_SUCCEED) {
                        HEAPfree(b->theap, false);
                        HEAPfree(b->tvheap, false);
                        return NULL;
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -766,6 +766,7 @@ os_add_name_based(objectset *os, struct 
                objectversion *co = name_based_node->ov;
                objectversion *oo = get_valid_object_name(tr, co);
                if (co != oo) { /* conflict ? */
+                       TRC_WARNING(SQL_STORE, "%s" "if (co != oo) { /* 
conflict ? */", __func__);
                        return -3;
                }
 
@@ -780,6 +781,7 @@ os_add_name_based(objectset *os, struct 
                        */
                        ATOMIC_BASE_TYPE expected_deleted = deleted;
                        if (!ATOMIC_CAS(&oo->state, &expected_deleted, 
block_destruction)) {
+                               TRC_WARNING(SQL_STORE, "%s: " "if 
(!ATOMIC_CAS(&oo->state, &expected_deleted, block_destruction)) { /*conflict 
with cleaner or write-write conflict*/ ", __func__);
                                return -3; /*conflict with cleaner or 
write-write conflict*/
                        }
                }
@@ -816,6 +818,7 @@ os_add_id_based(objectset *os, struct sq
                objectversion *co = id_based_node->ov;
                objectversion *oo = get_valid_object_id(tr, co);
                if (co != oo) { /* conflict ? */
+                       TRC_WARNING(SQL_STORE, "%s" "if (co != oo) { /* 
conflict ? */", __func__);
                        return -3;
                }
 
@@ -830,6 +833,7 @@ os_add_id_based(objectset *os, struct sq
                        */
                        ATOMIC_BASE_TYPE expected_deleted = deleted;
                        if (!ATOMIC_CAS(&oo->state, &expected_deleted, 
block_destruction)) {
+                               TRC_WARNING(SQL_STORE, "%s" "if 
(!ATOMIC_CAS(&oo->state, &expected_deleted, block_destruction)) { /*conflict 
with cleaner or write-write conflict*/", __func__);
                                return -3; /*conflict with cleaner or 
write-write conflict*/
                        }
                }
@@ -870,6 +874,7 @@ os_add_(objectset *os, struct sql_trans 
                if (os->destroy)
                        os->destroy(os->store, ov->b);
                _DELETE(ov);
+               TRC_WARNING(SQL_STORE, "%s" "if (!os->concurrent && 
os_has_changes(os, tr)) { /* for object sets without concurrent support, 
conflict if concurrent changes are there */", __func__);
                return -3; /* conflict */
        }
 
@@ -912,6 +917,7 @@ os_del_name_based(objectset *os, struct 
                objectversion *oo = get_valid_object_name(tr, co);
                ov->name_based_head = oo->name_based_head;
                if (co != oo) { /* conflict ? */
+                       TRC_WARNING(SQL_STORE, "%s: " "if (co != oo) { /* 
conflict ? */", __func__);
                        return -3;
                }
                ov->name_based_older = oo;
@@ -943,6 +949,7 @@ os_del_id_based(objectset *os, struct sq
                objectversion *oo = get_valid_object_id(tr, co);
                ov->id_based_head = oo->id_based_head;
                if (co != oo) { /* conflict ? */
+                       TRC_WARNING(SQL_STORE, "%s" "if (co != oo) { /* 
conflict ? */", __func__);
                        return -3;
                }
                ov->id_based_older = oo;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to