Changeset: 5ff93408e804 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5ff93408e804
Modified Files:
        sql/storage/store.c
Branch: iso
Log Message:

Merged with Jul2021


diffs (146 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2358,7 +2358,7 @@ decref(bat i, bool logical, bool release
                        }
                }
        }
-       if (b && b->batCount > b->batInserted) {
+       if (b && b->batCount > b->batInserted && !isVIEW(b)) {
                /* if batCount is larger than batInserted and the dirty
                 * bits are off, it may be that a (sub)commit happened
                 * in parallel to an update; we must undo the turning
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -1069,7 +1069,7 @@ HASHprobe(const Hash *h, const void *v)
        }
 }
 
-inline void
+void
 HASHappend_locked(BAT *b, BUN i, const void *v)
 {
        Hash *h = b->thash;
@@ -1140,7 +1140,7 @@ HASHappend(BAT *b, BUN i, const void *v)
 }
 
 /* insert value v at position p into the hash table of b */
-inline void
+void
 HASHinsert_locked(BAT *b, BUN p, const void *v)
 {
        Hash *h = b->thash;
@@ -1223,7 +1223,7 @@ HASHinsert(BAT *b, BUN p, const void *v)
 }
 
 /* delete value v at position p from the hash table of b */
-inline void
+void
 HASHdelete_locked(BAT *b, BUN p, const void *v)
 {
        Hash *h = b->thash;
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -168,9 +168,6 @@ gdk_return GDKunlink(int farmid, const c
        __attribute__((__visibility__("hidden")));
 void HASHappend(BAT *b, BUN i, const void *v)
        __attribute__((__visibility__("hidden")));
-#ifdef _MSC_VER
-inline
-#endif
 void HASHappend_locked(BAT *b, BUN i, const void *v)
        __attribute__((__visibility__("hidden")));
 void HASHfree(BAT *b)
@@ -179,16 +176,10 @@ bool HASHgonebad(BAT *b, const void *v)
        __attribute__((__visibility__("hidden")));
 void HASHdelete(BAT *b, BUN p, const void *v)
        __attribute__((__visibility__("hidden")));
-#ifdef _MSC_VER
-inline
-#endif
 void HASHdelete_locked(BAT *b, BUN p, const void *v)
        __attribute__((__visibility__("hidden")));
 void HASHinsert(BAT *b, BUN p, const void *v)
        __attribute__((__visibility__("hidden")));
-#ifdef _MSC_VER
-inline
-#endif
 void HASHinsert_locked(BAT *b, BUN p, const void *v)
        __attribute__((__visibility__("hidden")));
 BUN HASHmask(BUN cnt)
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2113,7 +2113,7 @@ store_exit(sqlstore *store)
                        MT_lock_set(&store->flush);
                }
                MT_lock_set(&store->commit);
-               if (store->changes) {
+               if (!list_empty(store->changes)) {
                        ulng oldest = store_timestamp(store)+1;
                        for(node *n=store->changes->h; n; n = n->next) {
                                sql_change *c = n->data;
@@ -2182,7 +2182,7 @@ store_resume_log(sqlstore *store)
 static void
 store_pending_changes(sqlstore *store, ulng oldest)
 {
-       ulng oldest_changes = TRANSACTION_ID_BASE;
+       ulng oldest_changes = store_get_timestamp(store);
        if (!list_empty(store->changes)) { /* lets first cleanup old stuff */
                for(node *n=store->changes->h; n; ) {
                        node *next = n->next;
@@ -2198,11 +2198,8 @@ store_pending_changes(sqlstore *store, u
                        }
                        n = next;
                }
-               if (oldest_changes < TRANSACTION_ID_BASE)
-                       store->oldest_pending = oldest_changes;
-       } else {
-               store->oldest_pending = store_get_timestamp(store);
-       }
+       }
+       store->oldest_pending = oldest_changes;
 }
 
 void
@@ -3391,7 +3388,7 @@ sql_trans_rollback(sql_trans *tr, int lo
                        n = next;
                }
        }
-       if (tr->changes) {
+       if (!list_empty(tr->changes)) {
                /* revert the change list */
                list *nl = SA_LIST(tr->sa, (fdestroy) NULL);
                for(node *n=tr->changes->h; n; n = n->next)
@@ -3634,7 +3631,7 @@ sql_trans_commit(sql_trans *tr)
                /* log changes should only be done if there is something to log 
*/
                if (!tr->parent && tr->logchanges > 0) {
                        int min_changes = GDKdebug & FORCEMITOMASK ? 5 : 100000;
-                       flush = (tr->logchanges > min_changes && 
!store->changes);
+                       flush = (tr->logchanges > min_changes && 
list_empty(store->changes));
                        if (flush)
                                MT_lock_set(&store->flush);
                        ok = store->logger_api.log_tstart(store, flush);
@@ -6522,17 +6519,15 @@ sql_trans_end(sql_session *s, int ok)
        store_lock(store);
        list_remove_data(store->active, NULL, s);
        (void) ATOMIC_DEC(&store->nr_active);
+       ulng oldest = store_get_timestamp(store);
        if (store->active && store->active->h) {
-               ulng oldest = TRANSACTION_ID_BASE;
                for(node *n = store->active->h; n; n = n->next) {
                        sql_session *s = n->data;
                        if (s->tr->ts < oldest)
                                oldest = s->tr->ts;
                }
-               store->oldest = oldest;
-       } else {
-               store->oldest = store_get_timestamp(store);
-       }
+       }
+       store->oldest = oldest;
        assert(list_length(store->active) == (int) 
ATOMIC_GET(&store->nr_active));
        store_unlock(store);
        return ok;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to