Changeset: e1f798a3b2fa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e1f798a3b2fa
Modified Files:
        gdk/gdk_bbp.c
        gdk/gdk_logger.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
Branch: default
Log Message:

Merge with Mar2025 branch.


diffs (truncated from 477 to 300 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1190,7 +1190,6 @@ fixhashashbat(BAT *b)
        char srcdir[MAXPATH];
 
        if (GDKfilepath(srcdir, sizeof(srcdir), NOFARM, BATDIR, nme, NULL) != 
GDK_SUCCEED) {
-               TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                return GDK_FAIL;
        }
        char *s;
@@ -1406,7 +1405,6 @@ jsonupgradebat(BAT *b, json_storage_conv
        char srcdir[MAXPATH];
 
        if (GDKfilepath(srcdir, sizeof(srcdir), NOFARM, BATDIR, nme, NULL) != 
GDK_SUCCEED) {
-               TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                return GDK_FAIL;
        }
 
@@ -1755,14 +1753,12 @@ BBPinit(bool allow_hge_upgrade, bool no_
                BBPtmlock();
 
                if (GDKfilepath(bbpdirstr, sizeof(bbpdirstr), 0, BATDIR, "BBP", 
"dir") != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKmalloc failed\n");
                        BBPtmunlock();
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
                }
 
                if (GDKfilepath(backupbbpdirstr, sizeof(backupbbpdirstr), 0, 
BAKDIR, "BBP", "dir") != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKmalloc failed\n");
                        BBPtmunlock();
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
@@ -1921,7 +1917,6 @@ BBPinit(bool allow_hge_upgrade, bool no_
                char jsonupgradestr[MAXPATH];
 
                if (GDKfilepath(jsonupgradestr, sizeof(jsonupgradestr), 0, 
BATDIR, "jsonupgradeneeded", NULL) != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
                }
@@ -3796,7 +3791,7 @@ BBPcheckBBPdir(void)
  * The BBP.dir is also moved into the BAKDIR.
  */
 gdk_return
-BBPsync(int cnt, bat *restrict subcommit, BUN *restrict sizes, lng logno)
+BBPsync(int cnt, const bat *restrict subcommit, const BUN *restrict sizes, lng 
logno)
 {
        gdk_return ret = GDK_SUCCEED;
        lng t0 = 0, t1 = 0;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -576,6 +576,11 @@ log_read_updates(logger *lg, trans *tr, 
                        for (; res == LOG_OK && nr > 0; nr--) {
                                size_t hlen = sizeof(oid);
                                void *h = rh(hv, &hlen, lg->input_log, 1);
+                               if (h == NULL) {
+                                       res = LOG_EOF;
+                                       TRC_CRITICAL(GDK, "read failed\n");
+                                       break;
+                               }
                                assert(hlen == sizeof(oid));
                                assert(h == hv);
                                if ((uid && BUNappend(uid, h, true) != 
GDK_SUCCEED)) {
@@ -583,52 +588,54 @@ log_read_updates(logger *lg, trans *tr, 
                                        res = LOG_ERR;
                                }
                        }
-                       nr = pnr;
-                       if (tpe == TYPE_msk) {
-                               if (r) {
-                                       if (mnstr_readIntArray(lg->input_log, 
Tloc(r, 0), (size_t) ((nr + 31) / 32)))
-                                               BATsetcount(r, (BUN) nr);
-                                       else {
-                                               TRC_CRITICAL(GDK, "read 
failed\n");
-                                               res = LOG_EOF;
-                                       }
-                               } else {
-                                       for (lng i = 0; i < nr; i += 32) {
-                                               int v;
-                                               switch 
(mnstr_readInt(lg->input_log, &v)) {
-                                               case 1:
-                                                       continue;
-                                               case 0:
+                       if (res == LOG_OK) {
+                               nr = pnr;
+                               if (tpe == TYPE_msk) {
+                                       if (r) {
+                                               if 
(mnstr_readIntArray(lg->input_log, Tloc(r, 0), (size_t) ((nr + 31) / 32)))
+                                                       BATsetcount(r, (BUN) 
nr);
+                                               else {
+                                                       TRC_CRITICAL(GDK, "read 
failed\n");
                                                        res = LOG_EOF;
-                                                       break;
-                                               default:
-                                                       res = LOG_ERR;
+                                               }
+                                       } else {
+                                               for (lng i = 0; i < nr; i += 
32) {
+                                                       int v;
+                                                       switch 
(mnstr_readInt(lg->input_log, &v)) {
+                                                       case 1:
+                                                               continue;
+                                                       case 0:
+                                                               res = LOG_EOF;
+                                                               break;
+                                                       default:
+                                                               res = LOG_ERR;
+                                                               break;
+                                                       }
+                                                       TRC_CRITICAL(GDK, "read 
failed\n");
                                                        break;
                                                }
-                                               TRC_CRITICAL(GDK, "read 
failed\n");
-                                               break;
                                        }
-                               }
-                       } else if (tpe == TYPE_str) {
-                               /* efficient string */
-                               res = string_reader(lg, r, nr);
-                       } else {
-                               for (; res == LOG_OK && nr > 0; nr--) {
-                                       size_t tlen = lg->rbufsize;
-                                       void *t = rt(lg->rbuf, &tlen, 
lg->input_log, 1);
-
-                                       if (t == NULL) {
-                                               if (strstr(GDKerrbuf, "malloc") 
== NULL)
-                                                       res = LOG_EOF;
-                                               else
-                                                       res = LOG_ERR;
-                                               TRC_CRITICAL(GDK, "read 
failed\n");
-                                       } else {
-                                               lg->rbuf = t;
-                                               lg->rbufsize = tlen;
-                                               if ((r && BUNappend(r, t, true) 
!= GDK_SUCCEED)) {
-                                                       TRC_CRITICAL(GDK, 
"append to bat failed\n");
-                                                       res = LOG_ERR;
+                               } else if (tpe == TYPE_str) {
+                                       /* efficient string */
+                                       res = string_reader(lg, r, nr);
+                               } else {
+                                       for (; res == LOG_OK && nr > 0; nr--) {
+                                               size_t tlen = lg->rbufsize;
+                                               void *t = rt(lg->rbuf, &tlen, 
lg->input_log, 1);
+
+                                               if (t == NULL) {
+                                                       if (strstr(GDKerrbuf, 
"malloc") == NULL)
+                                                               res = LOG_EOF;
+                                                       else
+                                                               res = LOG_ERR;
+                                                       TRC_CRITICAL(GDK, "read 
failed\n");
+                                               } else {
+                                                       lg->rbuf = t;
+                                                       lg->rbufsize = tlen;
+                                                       if ((r && BUNappend(r, 
t, true) != GDK_SUCCEED)) {
+                                                               
TRC_CRITICAL(GDK, "append to bat failed\n");
+                                                               res = LOG_ERR;
+                                                       }
                                                }
                                        }
                                }
@@ -1186,7 +1193,6 @@ log_open_output(logger *lg)
                        return GDK_FAIL;
                }
                if (GDKfilepath(filename, sizeof(filename), 
BBPselectfarm(PERSISTENT, 0, offheap), lg->dir, LOGFILE, id) != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "allocation failure\n");
                        GDKfree(new_range);
                        return GDK_FAIL;
                }
@@ -1991,7 +1997,6 @@ static gdk_return
 log_filename(logger *lg, char bak[FILENAME_MAX], char filename[FILENAME_MAX])
 {
        if (GDKfilepath(filename, FILENAME_MAX, 0, lg->dir, LOGFILE, NULL) != 
GDK_SUCCEED) {
-               GDKerror("Logger filename path is too large\n");
                return GDK_FAIL;
        }
        if (bak) {
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -99,8 +99,10 @@ void BBPprintinfo(void)
        __attribute__((__visibility__("hidden")));
 int BBPselectfarm(role_t role, int type, enum heaptype hptype)
        __attribute__((__visibility__("hidden")));
-gdk_return BBPsync(int cnt, bat *restrict subcommit, BUN *restrict sizes, lng 
logno)
-       __attribute__((__visibility__("hidden")));
+gdk_return BBPsync(int cnt, const bat *restrict subcommit, const BUN *restrict 
sizes, lng logno)
+       __attribute__((__visibility__("hidden")))
+       __attribute__((__access__(read_only, 2, 1)))
+       __attribute__((__access__(read_only, 3, 1)));
 BUN binsearch(const oid *restrict indir, oid offset, int type, const void 
*restrict vals, const char * restrict vars, int width, BUN lo, BUN hi, const 
void *restrict v, int ordering, int last)
        __attribute__((__visibility__("hidden")));
 BUN binsearch_bte(const oid *restrict indir, oid offset, const bte *restrict 
vals, BUN lo, BUN hi, bte v, int ordering, int last)
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -63,8 +63,10 @@ GDKfilepath(char *path, size_t pathlen, 
        const char *sep;
 
        if (GDKinmemory(farmid)) {
-               if (strcpy_len(path, ":memory:", pathlen) >= pathlen)
+               if (strcpy_len(path, ":memory:", pathlen) >= pathlen) {
+                       GDKerror("buffer too small\n");
                        return GDK_FAIL;
+               }
                return GDK_SUCCEED;
        }
 
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -629,7 +629,7 @@ JSONprelude(void)
        char jsonupgrade[MAXPATH];
        struct stat st;
        if (GDKfilepath(jsonupgrade, sizeof(jsonupgrade), 0, BATDIR, 
"jsonupgradeneeded", NULL) != GDK_SUCCEED)
-               throw(MAL, "json.prelude", "cannot allocate filename for json 
upgrade signal file");
+               throw(MAL, "json.prelude", GDK_EXCEPTION);
        int r = stat(jsonupgrade, &st);
        if (r == 0) {
                /* The file exists so we need to run the upgrade code */
diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -686,7 +686,7 @@ static str CUDFeval(Client cntxt, MalBlk
                }
                buf[i] = '\0';
                if (GDKfilepath(fname, sizeof(fname), 0, BATDIR, buf, "c") != 
GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
                oname = GDKstrdup(fname);
@@ -701,13 +701,13 @@ static str CUDFeval(Client cntxt, MalBlk
                memcpy(buf + prefix_size, SO_PREFIX, sizeof(char) * 
strlen(SO_PREFIX));
                char libname[MAXPATH];
                if (GDKfilepath(libname, sizeof(libname), 0, BATDIR, buf, 
SO_EXT[0] == '.' ? &SO_EXT[1] : SO_EXT) != GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
 
                // if TEMPDIR directory does not exist, create it
                if (GDKfilepath(tempdirpath, sizeof(tempdirpath), 0, NULL, 
TEMPDIR, NULL) != GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
                if (MT_mkdir(tempdirpath) < 0 && errno != EEXIST) {
diff --git a/sql/test/2025/Tests/All b/sql/test/2025/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/2025/Tests/All
@@ -0,0 +1,1 @@
+empty_bind_opt_on_sys_tables
diff --git a/sql/test/2025/Tests/empty_bind_opt_on_sys_tables.test 
b/sql/test/2025/Tests/empty_bind_opt_on_sys_tables.test
new file mode 100644
--- /dev/null
+++ b/sql/test/2025/Tests/empty_bind_opt_on_sys_tables.test
@@ -0,0 +1,191 @@
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE allnewtriples (id integer NOT NULL, subject integer NOT NULL, 
predicate integer NOT NULL, object integer NOT NULL, explicit boolean NOT NULL, 
PRIMARY KEY(id), CONSTRAINT unique_key UNIQUE(subject, predicate, object))
+
+statement ok
+CREATE INDEX allnewtriples_subject_idx ON allnewtriples (subject)
+
+statement ok
+CREATE INDEX allnewtriples_predicate_idx ON allnewtriples (predicate)
+
+statement ok
+CREATE INDEX allnewtriples_object_idx ON allnewtriples (object)
+
+statement ok
+CREATE TABLE "foreign" (id integer NOT NULL, subject integer NOT NULL, 
predicate integer NOT NULL, object integer NOT NULL, FOREIGN KEY (id) 
REFERENCES allnewtriples (id), FOREIGN KEY (subject, predicate, object) 
REFERENCES allnewtriples (subject, predicate, object))
+
+statement ok
+CREATE TABLE "triples" ("id" int NOT NULL, "subject" int NOT NULL, "predicate" 
int NOT NULL, "object" int NOT NULL, "explicit"  boolean NOT NULL, CONSTRAINT 
"triples_subject_predicate_object_unique" UNIQUE ("subject", "predicate", 
"object"))
+
+statement ok
+CREATE INDEX "triples_object_idx" ON "triples" ("object")
+
+statement ok
+CREATE INDEX "triples_predicate_idx" ON "triples" ("predicate")
+
+statement ok
+CREATE INDEX "triples_predicate_object_idx" ON "triples" ("predicate", 
"object")
+
+statement ok
+CREATE INDEX "triples_subject_idx" ON "triples" ("subject")
+
+statement ok
+CREATE INDEX "triples_subject_object_idx" ON "triples" ("subject", "object")
+
+statement ok
+CREATE INDEX "triples_subject_predicate_idx" ON "triples" ("subject", 
"predicate")
+
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to