Changeset: e66dfce52422 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e66dfce52422
Modified Files:
        clients/Tests/MAL-signatures-hge.test
        clients/Tests/MAL-signatures.test
        clients/Tests/exports.stable.out
        gdk/gdk.h
        gdk/gdk_analytic_func.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_hash.c
        gdk/gdk_heap.c
        gdk/gdk_join.c
        gdk/gdk_logger.c
        gdk/gdk_private.h
        gdk/gdk_select.c
        gdk/gdk_unique.c
        gdk/gdk_utils.c
        sql/backends/monet5/rel_physical.c
        sql/backends/monet5/rel_pphash.c
        sql/backends/monet5/sql_pp_statement.c
        sql/backends/monet5/vaults/parquet/parquet.c
        sql/include/sql_relation.h
        sql/server/rel_distribute.c
        sql/server/rel_optimize_proj.c
        sql/server/rel_optimize_sel.c
        sql/server/rel_optimizer_private.h
        sql/server/rel_rel.c
        sql/server/rel_unnest.c
        sql/storage/bat/bat_storage.c
        tools/mserver/mserver5.c
Branch: nested
Log Message:

merged with default


diffs (truncated from 4664 to 300 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -46,7 +46,9 @@ jobs:
         if: runner.os == 'macOS'
 
       - name: install packages
-        run: sudo apt-get install -y bison libbz2-dev libpcre2-dev liblzma-dev 
liblz4-dev libxml2-dev pkg-config libxxhash-dev unixodbc-dev zlib1g-dev 
libssl-dev
+        run: | 
+          sudo apt-get update
+          sudo apt-get install -y bison libbz2-dev libpcre2-dev liblzma-dev 
liblz4-dev libxml2-dev pkg-config libxxhash-dev unixodbc-dev zlib1g-dev 
libssl-dev
         if: runner.os == 'Linux'
 
       - name: Patch /etc/hosts on Unix
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Wed Oct 21 2026 Sjoerd Mullender <[email protected]>
+- There is a new type of database farm, like the --dbextra farm, for
+  temporary heaps.  Temporary heaps are heaps which are created and
+  destroyed in the same function, so they never need to be saved to disk.
+  By using the new --dbtemp option in mserver5, it is possible to choose
+  a separate directory in case the heap needs to be memory mapped, or by
+  specifying `in-memory` it is possible to direct the server to never
+  use a file-backed memory map (in this case, there should be enough
+  memory for these heaps).
+
 * Tue Oct  6 2026 Sjoerd Mullender <[email protected]>
 - The function sys.local_timezone() has been renamed to
   sys.system_timezone() since it returns the time zone of the server.
diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c
--- a/buildtools/coverity_model.c
+++ b/buildtools/coverity_model.c
@@ -124,7 +124,7 @@ GDKmmap(const char *path, int mode, size
 }
 
 gdk_return
-GDKmunmap(void *p, int mode, size_t size)
+GDKmunmap(void *p, size_t size)
 {
        int failed;
        __coverity_free__(p);
@@ -137,7 +137,7 @@ GDKmremap(const char *path, int mode, vo
 {
        void *p = GDKmmap(path, mode, new_size);
        if (p) {
-               (void) GDKmunmap(old_address, mode, old_size);
+               (void) GDKmunmap(old_address, old_size);
        }
        return p;
 }
diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -9694,7 +9694,8 @@ iaggr     sum     command iaggr.sum(X_0:bat[:flt
 iaggr  sum     command iaggr.sum(X_0:bat[:dbl], X_1:bit) (X_2:dbl, X_3:dbl, 
X_4:lng)   IALGfsum_skipnil        Return the Kahan/Neumaier summation or nil.
 iaggr  sum     command iaggr.sum(X_0:bat[:flt], X_1:bit) (X_2:dbl, X_3:dbl, 
X_4:lng)   IALGfsum_skipnil        Return the Kahan/Neumaier summation or nil.
 iaggr  sum     command iaggr.sum(X_0:bat[:flt], X_1:bit) (X_2:flt, X_3:flt, 
X_4:lng)   IALGfsum_skipnil_flt    Return the Kahan/Neumaier summation or nil.
-ialgebra       matched command ialgebra.matched(X_0:bat[:bit], 
X_1:bat[:oid]):bat[:oid]        OAHASHmatched   Mark matched rows, only return 
rows matched rows on first match.
+ialgebra       matched unsafe command ialgebra.matched(X_0:bat[:bit], 
X_1:bat[:bit], X_2:bat[:oid]):bat[:oid]  OAHASHmark_nils Mark rows (nil no 
value, 1 nil, 0 rest), return rows.
+ialgebra       matched unsafe command ialgebra.matched(X_0:bat[:bit], 
X_1:bat[:oid]):bat[:oid] OAHASHmatched   Mark matched rows, only return rows 
matched rows on first match.
 ialgebra       project pattern ialgebra.project(X_0:bat[:oid], 
X_1:any_1):bat[:any_1]  LALGconstant    Project a single value
 ialgebra       projection      command ialgebra.projection(X_0:bat[:oid], 
X_1:bat[:any_1]):bat[:any_1] LALGprojection  Project.
 ialgebra       unique  command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid], X_3:bit) (X_4:bat[:oid], X_5:bat[:any_1])        
LALGgroup_unique        Unique rows per group.
@@ -10125,6 +10126,7 @@ oahash  combined_oprobe command oahash.co
 oahash combined_oprobe command oahash.combined_oprobe(X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid], X_3:bat[:any_1], X_4:bat[:lng], X_5:bit, X_6:bit) 
(X_7:bat[:oid], X_8:bat[:oid], X_9:bat[:bit])   OAHASHoprobe_cmbd_single        
Probe the selected `key`-s in the hash table. For a matched item, return its 
OID in the 'key' column and the slot ID in the hash table
 oahash combined_probe  command oahash.combined_probe(X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid], X_3:bat[:any_1], X_4:bit, X_5:bit) 
(X_6:bat[:oid], X_7:bat[:oid])  OAHASHprobe_cmbd        Probe the selected 
`key`-s in the hash table. For a matched item, return its OID in the 'key' 
column and the slot ID in the hash table
 oahash combined_probe  command oahash.combined_probe(X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid], X_3:bat[:any_1], X_4:bat[:lng], X_5:bit, X_6:bit) 
(X_7:bat[:oid], X_8:bat[:oid])   OAHASHprobe_cmbd_single Probe the selected 
`key`-s in the hash table. For a matched item, return its OID in the 'key' 
column and the slot ID in the hash table
+oahash empty   command oahash.empty(X_0:bat[:any_1]):bit       OAHASHempty     
Hash empty.
 oahash expand  pattern oahash.expand(X_0:bat[:oid], X_1:bat[:oid], 
X_2:bat[:lng], X_3:bit):bat[:oid]   OAHASHexpand    Expand the probe-side OIDs 
according to their matching hash-side GIDs and frequencies. If 'leftouter' is 
true, include the not matched OIDs
 oahash expand_cartesian        command 
oahash.expand_cartesian(X_0:bat[:any_1], X_1:bat[:any_2], X_2:bit):bat[:oid]    
OAHASHexpand_cart       Duplicate each value in 'col' the number of times as 
the count of 'rowrepeat'. For a left/right-outer join, if 'rowrepeat' is empty, 
output the values in 'col' once.
 oahash explode command oahash.explode(X_0:bat[:oid], X_1:bat[:lng], 
X_2:bat[:any_2], X_3:bit):bat[:oid]        OAHASHexplode   Explode the result 
vector 'frequency' times and return payload heap slot ids. If 'left_outer' is 
true, fill the not 'selected' slot with oid_nil
@@ -10148,6 +10150,7 @@ oahash  oprobe  command oahash.oprobe(X_0:
 oahash oprobe  command oahash.oprobe(X_0:bat[:any_1], X_1:bat[:any_1], 
X_2:bat[:lng], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:oid], X_7:bat[:bit])  
OAHASHoprobe_single     Probe the `key`-s in the hash table. For a matched key, 
return its OID in the 'key' column and the slot ID in the hash table
 oahash probe   command oahash.probe(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bit, 
X_3:bit) (X_4:bat[:oid], X_5:bat[:oid]) OAHASHprobe     Probe the `key` in the 
hash table. For a matched key, return its OID in the 'key' column and the slot 
ID in the hash table
 oahash probe   command oahash.probe(X_0:bat[:any_1], X_1:bat[:any_1], 
X_2:bat[:lng], X_3:bit, X_4:bit) (X_5:bat[:oid], X_6:bat[:oid])  
OAHASHprobe_single      Probe the `key`-s in the hash table. For a matched key, 
return its OID in the 'key' column and the slot ID in the hash table
+oahash select_unmatched        command oahash.select_unmatched(X_0:bat[:bit], 
X_1:lng):bat[:oid]       OAHASHselect_unmatched  Select unmatched rows, if cnt 
== 0 return all.
 optimizer      aliases pattern optimizer.aliases():str OPTwrapper      (empty)
 optimizer      aliases pattern optimizer.aliases(X_0:str, X_1:str):str 
OPTwrapper      Alias removal optimizer
 optimizer      candidates      pattern optimizer.candidates():str      
OPTwrapper      (empty)
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
@@ -7322,7 +7322,7 @@ iaggr     sum     command iaggr.sum(X_0:bat[:flt
 iaggr  sum     command iaggr.sum(X_0:bat[:dbl], X_1:bit) (X_2:dbl, X_3:dbl, 
X_4:lng)   IALGfsum_skipnil        Return the Kahan/Neumaier summation or nil.
 iaggr  sum     command iaggr.sum(X_0:bat[:flt], X_1:bit) (X_2:dbl, X_3:dbl, 
X_4:lng)   IALGfsum_skipnil        Return the Kahan/Neumaier summation or nil.
 iaggr  sum     command iaggr.sum(X_0:bat[:flt], X_1:bit) (X_2:flt, X_3:flt, 
X_4:lng)   IALGfsum_skipnil_flt    Return the Kahan/Neumaier summation or nil.
-ialgebra       matched command ialgebra.matched(X_0:bat[:bit], 
X_1:bat[:oid]):bat[:oid]        OAHASHmatched   Mark matched rows, only return 
rows matched rows on first match.
+ialgebra       matched command ialgebra.matched(X_0:bat[:bit], 
X_1:bat[:oid]):bat[:oid]        OAHASHmatched   Mark matched rows, only return 
rows matched rows on first match.
 ialgebra       project pattern ialgebra.project(X_0:bat[:oid], 
X_1:any_1):bat[:any_1]  LALGconstant    Project a single value
 ialgebra       projection      command ialgebra.projection(X_0:bat[:oid], 
X_1:bat[:any_1]):bat[:any_1] LALGprojection  Project.
 ialgebra       unique  command ialgebra.unique(X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid], X_3:bit) (X_4:bat[:oid], X_5:bat[:any_1])        
LALGgroup_unique        Unique rows per group.
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
@@ -235,6 +235,7 @@ void BBPrelinquishbats(void);
 int BBPrename(BAT *b, const char *nme);
 int BBPretain(bat b);
 gdk_return BBPsave(BAT *b);
+int BBPselectfarm(role_t role, int type, enum heaptype hptype);
 void BBPtmlock(void);
 void BBPtmunlock(void);
 int BBPunfix(bat b);
@@ -312,7 +313,7 @@ size_t GDKmem_cursize(void);
 gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
 void *GDKmmap(const char *path, int mode, size_t len);
 int GDKms(void);
-gdk_return GDKmunmap(void *addr, int mode, size_t len);
+gdk_return GDKmunmap(void *addr, size_t len);
 int GDKnr_threads;
 void GDKprepareExit(void);
 void GDKprintinfo(void);
@@ -363,7 +364,7 @@ gdk_return HEAP_initialize(Heap *heap, s
 var_t HEAP_malloc(BAT *b, size_t nbytes);
 gdk_return HEAPalloc(Heap *h, size_t nitems, size_t itemsize);
 void HEAPdecref(Heap *h, bool remove);
-gdk_return HEAPextend(Heap *h, size_t size, bool mayshare);
+gdk_return HEAPextend(Heap *h, size_t size);
 void HEAPincref(Heap *h);
 size_t HEAPmemsize(const Heap *h);
 size_t HEAPvmsize(const Heap *h);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -173,52 +173,38 @@
 typedef enum gdk_return { GDK_FAIL, GDK_SUCCEED } gdk_return;
 
 /* basic GDK types */
-typedef bool msk;
-typedef int8_t bit;
-typedef int8_t bte;
-typedef int16_t sht;
-typedef int64_t lng;
-typedef uint64_t ulng;
+typedef bool msk;              /* one bit Boolean */
+typedef int8_t bit;            /* three-value Boolean (8 bits) */
+typedef int8_t bte;            /* 8 bit signed integer */
+typedef int16_t sht;           /* 16 bit signed integer */
+/* standard type int is used for 32 bit signed integer */
+typedef int64_t lng;           /* 64 bit signed integer */
+typedef uint64_t ulng;         /* 64 bit unsigned integer */
 #ifdef HAVE_HGE
-typedef int128_t hge;
-typedef uint128_t uhge;
+typedef int128_t hge;          /* 128 bit signed integer */
+typedef uint128_t uhge;                /* 128 bit unsigned integer */
 #endif
-
-#define SIZEOF_LNG             8
-#define LL_CONSTANT(val)       INT64_C(val)
-#define PRIdLNG                        PRId64
-#define PRIuLNG                        PRIu64
-#define PRIxLNG                        PRIx64
-#define PRIoLNG                        PRIo64
-#define LLFMT                  "%" PRIdLNG
-#define ULLFMT                 "%" PRIuLNG
-#define LLSCN                  "%" SCNd64
-#define ULLSCN                 "%" SCNu64
-
-#ifdef HAVE_HGE
-#define SIZEOF_HGE             16
-/* constants, printf format, scanf format: not supported for 128 bit
- * integers */
-#endif
-
-#define SIZEOF_OID     SIZEOF_SIZE_T
-typedef size_t oid;
-/* macro in the style of <inttypes.h> for formatting oid */
-#define PRIuOID                "zu"
-#define OIDFMT         "%" PRIuOID
-
 typedef int bat;               /* Index into BBP */
-typedef void *ptr;             /* Internal coding of types */
-
-#define SIZEOF_PTR     SIZEOF_VOID_P
-typedef float flt;
-typedef double dbl;
-typedef char *str;
+typedef void *ptr;             /* generic pointer */
+typedef float flt;             /* 32 bit floating point */
+typedef double dbl;            /* 64 bit floating point */
+typedef char *str;             /* null terminated UTF-8 string */
+typedef size_t oid;            /* object identifier */
+typedef oid var_t;             /* type used for heap index of var-sized BAT */
+typedef oid BUN;               /* BUN position */
+
+/* The types `oid`, `BUN` and `var_t` are all defined as `size_t`, but
+ * they serve different purposes.  `oid` is the *logical* row number of
+ * a BAT; `BUN` is the *physical* row number of a BAT and is therefore
+ * also used for the total number of rows and the potential capacity of
+ * a BAT; `var_t` is an *offset* into the var-size heap (vheap).  The
+ * difference between the *logical* and *physical* row number is the
+ * value of the head sequence base (`hseqbase`) of the BAT. */
 
 typedef union {
        uint32_t align;         /* force alignment, only used for equality */
        uint8_t quad[4] __attribute__((__nonstring__));
-} inet4;
+} inet4;                       /* IPv4 internet address */
 
 typedef union {
 #ifdef HAVE_HGE
@@ -227,7 +213,7 @@ typedef union {
        uint64_t align[2];      /* force alignment, not otherwise used */
 #endif
        uint8_t hex[16] __attribute__((__nonstring__));
-} inet6;
+} inet6;                       /* IPv6 internet address */
 
 #define UUID_SIZE      16      /* size of a UUID */
 #define UUID_STRLEN    36      /* length of string representation */
@@ -260,15 +246,30 @@ typedef union {
        uint8_t data[64*1024*4] __attribute__((__nonstring__));
 } fblock;
 
-/* The types `oid`, `BUN` and `var_t` are all defined as `size_t`, but
- * they serve different purposes.  `oid` is the *logical* row number of
- * a BAT; `BUN` is the *physical* row number of a BAT and is therefore
- * also used for the total number of rows and the potential capacity of
- * a BAT; `var_t` is an *offset* into the var-size heap (vheap).  The
- * difference between the *logical* and *physical* row number is the
- * value of the head sequence base (`hseqbase`) of the BAT. */
-
-typedef oid var_t;             /* type used for heap index of var-sized BAT */
+#define SIZEOF_LNG             8
+#define LL_CONSTANT(val)       INT64_C(val)
+#define PRIdLNG                        PRId64
+#define PRIuLNG                        PRIu64
+#define PRIxLNG                        PRIx64
+#define PRIoLNG                        PRIo64
+#define LLFMT                  "%" PRIdLNG
+#define ULLFMT                 "%" PRIuLNG
+#define LLSCN                  "%" SCNd64
+#define ULLSCN                 "%" SCNu64
+
+#ifdef HAVE_HGE
+#define SIZEOF_HGE             16
+/* constants, printf format, scanf format: not supported for 128 bit
+ * integers */
+#endif
+
+#define SIZEOF_OID     SIZEOF_SIZE_T
+/* macro in the style of <inttypes.h> for formatting oid */
+#define PRIuOID                "zu"
+#define OIDFMT         "%" PRIuOID
+
+#define SIZEOF_PTR     SIZEOF_VOID_P
+
 #define SIZEOF_VAR_T   SIZEOF_OID
 #define VARFMT         OIDFMT
 
@@ -278,7 +279,6 @@ typedef oid var_t;          /* type used for hea
 #define VAR_MAX                ((var_t) INT64_MAX)
 #endif
 
-typedef oid BUN;               /* BUN position */
 #define SIZEOF_BUN     SIZEOF_OID
 #define PRIuBUN                PRIuOID
 #define BUNFMT         OIDFMT
@@ -1270,7 +1270,6 @@ gdk_export void MT_cond_broadcast(MT_Con
 
 #define MMAP_READ      1024    /* region is readable (default if omitted) */
 #define MMAP_WRITE     2048    /* region may be written into */
-#define MMAP_COPY      4096    /* writable, but changes never reach file */
 
 /* in order to be sure of madvise and msync modes, pass them to mmap()
  * call as well */
@@ -1457,6 +1456,7 @@ typedef enum {
        PERSISTENT = 0,
        TRANSIENT,
        SYSTRANS,
+       TEMPFARM,
 } role_t;
 
 /* Heap storage modes */
@@ -1464,11 +1464,7 @@ typedef enum {
        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) */
 } storage_t;
 
 typedef struct {
@@ -1482,14 +1478,14 @@ typedef struct {
 #endif
 
        ATOMIC_TYPE refs;       /* reference count for this heap */
-       bte farmid;             /* id of farm where heap is located */
+       int8_t farmid;          /* id of farm where heap is located */
+       role_t role;            /* role of this heap */
        bool cleanhash;         /* string heaps must clean hash */
        bool dirty;             /* specific heap dirty marker */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to