Changeset: 61ba1e5fc278 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/61ba1e5fc278
Modified Files:
        gdk/gdk_logger.c
        gdk/gdk_string.c
        gdk/gdk_tracer.c
        gdk/gdk_utils.c
        tools/mserver/mserver5.c
Branch: default
Log Message:

Merge with Dec2025 branch.


diffs (truncated from 770 to 300 lines):

diff --git a/ChangeLog.Dec2025 b/ChangeLog.Dec2025
--- a/ChangeLog.Dec2025
+++ b/ChangeLog.Dec2025
@@ -1,6 +1,11 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Tue May 12 2026 Lucas Pereira <[email protected]>
+- Fix using --logging option of mserver5 to change component levels
+  that are also used by --debug option. For overlapping components,
+  component level change via --logging was being discarded.
+
 * Thu Apr 23 2026 Sjoerd Mullender <[email protected]>
 - It is no longer allowed to run mserver5 or monetdbd as root.  There are
   important security concerns when these servers are run as root.
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -87,6 +87,7 @@ typedef struct trans {
        logaction *changes;
 
        struct trans *tr;
+       allocator_state ta_state;
 } trans;
 
 typedef struct logformat_t {
@@ -1042,22 +1043,25 @@ log_write_new_types(logger *lg, FILE *fp
 #define TR_SIZE                1024
 
 static trans *
-tr_create(trans *tr, int tid)
+tr_create(allocator *ta, trans *tr, int tid)
 {
-       trans *ntr = GDKmalloc(sizeof(trans));
-
-       if (ntr == NULL)
-               return NULL;
-       ntr->tid = tid;
-       ntr->sz = TR_SIZE;
-       ntr->nr = 0;
-       ntr->changes = GDKmalloc(sizeof(logaction) * TR_SIZE);
-       if (ntr->changes == NULL) {
-               GDKfree(ntr);
-               return NULL;
+       if (tr)
+               tr->ta_state = ma_open(ta);
+       trans *ntr = ma_alloc(ta, sizeof(trans));
+
+       if (ntr != NULL) {
+               ntr->tid = tid;
+               ntr->sz = TR_SIZE;
+               ntr->nr = 0;
+               ntr->changes = ma_alloc(ta, sizeof(logaction) * TR_SIZE);
+               if (ntr->changes != NULL) {
+                       ntr->tr = tr;
+                       return ntr;
+               }
        }
-       ntr->tr = tr;
-       return ntr;
+       if (tr)
+               ma_close(&tr->ta_state);
+       return NULL;
 }
 
 static gdk_return
@@ -1098,8 +1102,12 @@ tr_grow(trans *tr)
 {
        if (tr->nr == tr->sz) {
                logaction *changes;
+               int sz = tr->sz;
                tr->sz <<= 1;
-               changes = GDKrealloc(tr->changes, tr->sz * sizeof(logaction));
+               changes = ma_realloc(MT_thread_getallocator(),
+                                    tr->changes,
+                                    sz * sizeof(logaction),
+                                    tr->sz * sizeof(logaction));
                if (changes == NULL)
                        return GDK_FAIL;
                tr->changes = changes;
@@ -1113,9 +1121,8 @@ static trans *
 tr_destroy(trans *tr)
 {
        trans *r = tr->tr;
-
-       GDKfree(tr->changes);
-       GDKfree(tr);
+       if (r)
+               ma_close(&r->ta_state);
        return r;
 }
 
@@ -1401,6 +1408,8 @@ log_read_transaction(logger *lg, BAT *id
        ATOMIC_BASE_TYPE dbg = ATOMIC_GET(&GDKdebug);
        time_t t0 = 0;
        int64_t fs = 0;
+       allocator *ta = MT_thread_getallocator();
+       allocator_state ta_state = ma_open(ta);
 
        (void) maxupdated;      /* only used inside assert() */
 
@@ -1509,7 +1518,7 @@ log_read_transaction(logger *lg, BAT *id
                        assert(!lg->flushing || l.id <= lg->tid);
                        if (!lg->flushing && l.id > lg->tid)
                                lg->tid = l.id; /* should only happen during 
initialization */
-                       if ((tr = tr_create(tr, l.id)) == NULL) {
+                       if ((tr = tr_create(ta, tr, l.id)) == NULL) {
                                TRC_CRITICAL(GDK, "memory allocation failed\n");
                                err = LOG_ERR;
                                break;
@@ -1587,6 +1596,7 @@ log_read_transaction(logger *lg, BAT *id
                TRC_WARNING(GDK, "aborting transaction\n");
                tr = tr_abort(lg, tr);
        }
+       ma_close(&ta_state);
        if (!lg->flushing)
                ATOMIC_SET(&GDKdebug, dbg);
 
@@ -2931,6 +2941,8 @@ log_flush(logger *lg, ulng ts)
        log_return res = LOG_OK;
        ulng cid = olid;
        assert(lid <= lgid);
+       allocator *ta = MT_thread_getallocator();
+       allocator_state ta_state = ma_open(ta);
        uint32_t *updated = NULL;
        BUN nupdated = 0;
        size_t allocated = 0;
@@ -2939,23 +2951,23 @@ log_flush(logger *lg, ulng ts)
                        char filename[MAXPATH];
                        char id[32];
                        if (snprintf(id, sizeof(id), ULLFMT, cid + 1) >= (int) 
sizeof(id)) {
-                               GDKfree(updated);
+                               ma_close(&ta_state);
                                TRC_CRITICAL(GDK, "log_id filename is too 
large\n");
                                return GDK_FAIL;
                        }
                        if (GDKfilepath(filename, sizeof(filename), 
BBPselectfarm(PERSISTENT, 0, offheap), lg->dir, LOGFILE, id) != GDK_SUCCEED) {
-                               GDKfree(updated);
+                               ma_close(&ta_state);
                                return GDK_FAIL;
                        }
                        if (strlen(filename) >= FILENAME_MAX) {
-                               GDKfree(updated);
+                               ma_close(&ta_state);
                                TRC_CRITICAL(GDK, "Logger filename path is too 
large\n");
                                return GDK_FAIL;
                        }
 
                        bool filemissing = false;
                        if (log_open_input(lg, filename, &filemissing) != 
GDK_SUCCEED) {
-                               GDKfree(updated);
+                               ma_close(&ta_state);
                                return GDK_FAIL;
                        }
                }
@@ -2966,22 +2978,22 @@ log_flush(logger *lg, ulng ts)
                        allocated = ((nupdated + 31) & ~31) / 8;
                        if (allocated == 0)
                                allocated = 4;
-                       updated = GDKzalloc(allocated);
+                       updated = ma_zalloc(ta, allocated);
                        if (updated == NULL) {
                                log_unlock(lg);
+                               ma_close(&ta_state);
                                return GDK_FAIL;
                        }
                } else if (nupdated < BATcount(lg->catalog_id)) {
                        BUN n = BATcount(lg->catalog_id);
                        size_t a = ((n + 31) & ~31) / 8;
                        if (a > allocated) {
-                               uint32_t *p = GDKrealloc(updated, a);
-                               if (p == NULL) {
-                                       GDKfree(updated);
+                               updated = ma_realloc(ta, updated, allocated, a);
+                               if (updated == NULL) {
+                                       ma_close(&ta_state);
                                        log_unlock(lg);
                                        return GDK_FAIL;
                                }
-                               updated = p;
                                memset(updated + allocated / 4, 0, a - 
allocated);
                                allocated = a;
                        }
@@ -3018,7 +3030,7 @@ log_flush(logger *lg, ulng ts)
                if (res == LOG_OK)
                        log_cleanup_range(lg, lg->saved_id);
        }
-       GDKfree(updated);
+       ma_close(&ta_state);
        return res == LOG_ERR ? GDK_FAIL : GDK_SUCCEED;
 }
 
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -196,7 +196,7 @@ strLocate(Heap *h, const char *v)
        /* search the linked list */
        for (ref = ((stridx_t *) h->base) + off; *ref; ref = next) {
                next = (stridx_t *) (h->base + *ref);
-               if (strcmp(v, (str) (next + 1)) == 0)
+               if (strcmp(v, (char *) (next + 1)) == 0)
                        return (var_t) ((sizeof(stridx_t) + *ref));     /* 
found */
        }
        return (var_t) -2;
@@ -753,11 +753,11 @@ strToStr(allocator *ma, char **restrict 
        }
 }
 
-str
-strRead(allocator *ma, str A, size_t *dstlen, stream *s, size_t cnt)
+char *
+strRead(allocator *ma, char *A, size_t *dstlen, stream *s, size_t cnt)
 {
        int len;
-       str a = A;
+       char *a = A;
 
        (void) cnt;
        assert(cnt == 1);
@@ -812,7 +812,7 @@ concat_strings(allocator *ma, BAT **bnp,
        oid gid;
        BUN i, p, nils = 0;
        size_t *restrict lengths = NULL, separator_length = 0, next_length;
-       str *restrict astrings = NULL;
+       char **restrict astrings = NULL;
        BATiter bi, bis = {0};
        BAT *bn = NULL;
        gdk_return rres = GDK_FAIL;
@@ -976,7 +976,7 @@ concat_strings(allocator *ma, BAT **bnp,
                /* first used to calculated the total length of
                 * each group, then the the total offset */
                lengths = ma_zalloc(ta, ngrp * sizeof(*lengths));
-               astrings = ma_alloc(ta, ngrp * sizeof(str));
+               astrings = ma_alloc(ta, ngrp * sizeof(char *));
                if (lengths == NULL || astrings == NULL) {
                        goto finish;
                }
@@ -1225,177 +1225,111 @@ done:
        return bn;
 }
 
-#define compute_next_single_str(START, END)                            \
-       do {                                                            \
-               for (oid m = START; m < END; m++) {                     \
-                       const char *sb = BUNtvar(&bi, m);               \
-                                                                       \
-                       if (!strNil(sb)) {                              \
-                               if (separator) {                        \
-                                       next_group_length += strlen(sb); \
-                                       if (!empty)                     \
-                                               next_group_length += 
separator_length; \
-                               } else { /* sep case */                 \
-                                       assert(sep != NULL);            \
-                                       const char *sl = BUNtvar(&sepi, m); \
-                                                                       \
-                                       next_group_length += strlen(sb); \
-                                       if (!empty && !strNil(sl))      \
-                                               next_group_length += 
strlen(sl); \
-                               }                                       \
-                               empty = false;                          \
-                       }                                               \
-               }                                                       \
-               if (empty) {                                            \
-                       if (single_str == NULL) { /* reuse the same buffer, 
resize it when needed */ \
-                               max_group_length = 1;                   \
-                               if ((single_str = GDKmalloc(max_group_length + 
1)) == NULL) \
-                                       goto allocation_error;          \
-                       } else if (1 > max_group_length) {              \
-                               max_group_length = 1;                   \
-                               if ((next_single_str = GDKrealloc(single_str, 
max_group_length + 1)) == NULL) \
-                                       goto allocation_error;          \
-                               single_str = next_single_str;           \
-                       }                                               \
-                       strcpy(single_str, str_nil);                    \
-                       has_nils = true;                                \
-               } else {                                                \
-                       empty = true;                                   \
-                       if (single_str == NULL) { /* reuse the same buffer, 
resize it when needed */ \
-                               max_group_length = next_group_length;   \
-                               if ((single_str = GDKmalloc(max_group_length + 
1)) == NULL) \
-                                       goto allocation_error;          \
-                       } else if (next_group_length > max_group_length) { \
-                               max_group_length = next_group_length;   \
-                               if ((next_single_str = GDKrealloc(single_str, 
max_group_length + 1)) == NULL) \
-                                       goto allocation_error;          \
-                               single_str = next_single_str;           \
-                       }                                               \
-                                                                       \
-                       for (oid m = START; m < END; m++) {             \
-                               const char *sb = BUNtvar(&bi, m);       \
-                                                                       \
-                               if (strNil(sb))                         \
-                                       continue;                       \
-                               if (separator) {                        \
-                                       if (!empty) {                   \
-                                               memcpy(single_str + offset, 
separator, separator_length); \
-                                               offset += separator_length; \
-                                       }                               \
-                               } else { /* sep case */                 \
-                                       assert(sep != NULL);            \
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to