Changeset: c3b5a7b49205 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c3b5a7b49205
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_bbp.c
Branch: Dec2025
Log Message:
Remember query context in which transient bats were allocated for trimming.
When trimming, we need to update the query context's datasize value, but
the manager thread does not have access to the correct query context, so
we need to remember and set it.
diffs (41 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -428,6 +428,7 @@ typedef struct BAT {
MT_RWLock thashlock; /* lock specifically for hash management */
MT_Lock batIdxLock; /* lock to manipulate other indexes/properties
*/
Heap *oldtail; /* old tail heap, to be destroyed after commit
*/
+ QryCtx *qc; /* query context of owner if transient */
} BAT;
/* some access functions for the bitmask type */
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -121,6 +121,7 @@ BATcreatedesc(oid hseq, int tt, bool hea
.theap = h,
.tvheap = vh,
.creator_tid = MT_getpid(),
+ .qc = role == TRANSIENT ? MT_thread_get_qry_ctx() : NULL,
};
if (bn->theap) {
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1675,6 +1675,7 @@ BBPtrim(bool aggressive, bat nbat)
MT_lock_unset(&GDKswapLock(bid));
if (swap) {
TRC_DEBUG(BAT, "unload and free bat %d\n", bid);
+ MT_thread_set_qry_ctx(b->qc);
if (BBPfree(b) != GDK_SUCCEED)
GDKerror("unload failed for bat %d", bid);
n++;
@@ -1687,6 +1688,7 @@ BBPtrim(bool aggressive, bat nbat)
MT_sleep_ms(2);
}
}
+ MT_thread_set_qry_ctx(NULL);
if (n > 0)
TRC_INFO(BAT, "unloaded %d bats, %zu%s bytes in "LLFMT"
usec%s\n", n, mem, humansize(mem, (char[24]){0}, 24), GDKusec() - t0,
aggressive ? " (also hot)" : "");
return changed;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]