MonetDB: Jun2023 - Streamline code (backport from default).

2023-08-22 Thread Sjoerd Mullender via checkin-list
Changeset: 158d78b84988 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/158d78b84988
Modified Files:
monetdb5/mal/mal_prelude.c
Branch: Jun2023
Log Message:

Streamline code (backport from default).


diffs (77 lines):

diff --git a/monetdb5/mal/mal_prelude.c b/monetdb5/mal/mal_prelude.c
--- a/monetdb5/mal/mal_prelude.c
+++ b/monetdb5/mal/mal_prelude.c
@@ -245,12 +245,8 @@ addFunctions(mel_func *fcn)
if (mod == NULL)
throw(LOADER, __func__, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
c = getModule(mod);
-   if (c == NULL) {
-   if (globalModule(mod) == NULL)
-   throw(LOADER, __func__, "Module %s can not be 
created",
- fcn->mod);
-   c = getModule(mod);
-   }
+   if (c == NULL && (c = globalModule(mod)) == NULL)
+   throw(LOADER, __func__, "Module %s can not be created", 
fcn->mod);
 
s = newSymbol(fcn->fcn, fcn->command ? COMMANDsymbol : 
PATTERNsymbol);
if (s == NULL)
@@ -382,11 +378,8 @@ melFunction(bool command, const char *mo
assert(mod);
mod = putName(mod);
c = getModule(mod);
-   if (c == NULL) {
-   if (globalModule(mod) == NULL)
-   return MEL_ERR;
-   c = getModule(mod);
-   }
+   if (c == NULL && (c = globalModule(mod)) == NULL)
+   return MEL_ERR;
 
s = newSymbol(fcn, command ? COMMANDsymbol : PATTERNsymbol);
if (s == NULL)
@@ -491,36 +484,34 @@ malPrelude(Client c, int listing, int *s
 
/* Add the signatures, where we now have access to all atoms */
for (i = 0; i < mel_modules; i++) {
-   (void) putName(mel_module[i].name);
-   if (!malLibraryEnabled(mel_module[i].name))
+   const char *name = putName(mel_module[i].name);
+   if (!malLibraryEnabled(name))
continue;
if (mel_module[i].funcs) {
msg = addFunctions(mel_module[i].funcs);
-   if (!msg && mel_module[i].code) /* some modules may 
also have some function definitions */
-   msg = malIncludeString(c, mel_module[i].name,
-  
(str) mel_module[i].code, listing, NULL);
+   if (!msg && mel_module[i].code) /* some modules may 
also have some function definitions */
+   msg = malIncludeString(c, name, (str) 
mel_module[i].code, listing, NULL);
if (msg)
return msg;
 
/* mapi should be last, and sql last before mapi */
-   if (strcmp(mel_module[i].name, "sql") == 0) {
+   if (strcmp(name, "sql") == 0) {
*sql = i;
continue;
}
-   if (strcmp(mel_module[i].name, "mapi") == 0) {
+   if (strcmp(name, "mapi") == 0) {
*mapi = i;
continue;
}
if (!mel_module[i].inits) {
-   msg = initModule(c, mel_module[i].name, NULL);
+   msg = initModule(c, name, NULL);
if (msg)
return msg;
}
}
if (mel_module[i].inits) {
/* mapi should be last, and sql last before mapi */
-   if (strcmp(mel_module[i].name, "sql") == 0
-   || strcmp(mel_module[i].name, "mapi") == 0)
+   if (strcmp(name, "sql") == 0 || strcmp(name, "mapi") == 
0)
continue;
msg = mel_module[i].inits();
if (msg)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Layout.

2023-08-22 Thread Sjoerd Mullender via checkin-list
Changeset: d95dd109da9e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d95dd109da9e
Modified Files:
monetdb5/optimizer/opt_mitosis.c
Branch: default
Log Message:

Layout.


diffs (15 lines):

diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -77,8 +77,9 @@ OPTmitosisImplementation(Client cntxt, M
goto bailout;
}
 
-   /* rtree functions should not be optimized by mitosis 
(single-threaded execution) */
-   if ( getModuleId(p) == rtreeRef){
+   /* rtree functions should not be optimized by mitosis
+* (single-threaded execution) */
+   if (getModuleId(p) == rtreeRef) {
pieces = 0;
goto bailout;
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Reenable assert.

2023-08-21 Thread Sjoerd Mullender via checkin-list
Changeset: 62e30aed0c7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/62e30aed0c7c
Modified Files:
monetdb5/mal/mal_client.c
Branch: default
Log Message:

Reenable assert.


diffs (12 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -431,7 +431,7 @@ MCcloseClient(Client c)
free(c->handshake_options);
c->handshake_options = NULL;
MT_thread_set_qry_ctx(NULL);
-   //assert(c->qryctx.datasize == 0);
+   assert(c->qryctx.datasize == 0);
MT_sema_destroy(>s);
MT_lock_set(_contextLock);
if (shutdowninprogress) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Use the actual type to determine what is the ...

2023-08-21 Thread Sjoerd Mullender via checkin-list
Changeset: 40e321991a15 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/40e321991a15
Modified Files:
gdk/gdk_private.h
sql/storage/sql_storage.h
Branch: default
Log Message:

Use the actual type to determine what is the highest bit.


diffs (38 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -525,15 +525,9 @@ extern size_t GDK_mmap_pagesize; /* mmap
 
 #define GDKswapLock(x)  GDKbatLock[(x)_BATMASK].swap
 
-#if ATOMIC_LLONG_LOCK_FREE == 2
-#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << 63)
-#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << 62)
-#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << 62) - 1)
-#else
-#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << 31)
-#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << 30)
-#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << 30) - 1)
-#endif
+#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 1))
+#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 2))
+#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 2)) - 1)
 
 /* when the number of updates to a BAT is less than 1 in this number, we
  * keep the unique_est property */
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -474,11 +474,7 @@ extern sql_table *globaltmp_instantiate(
 
 #define NR_TABLE_LOCKS 64
 #define NR_COLUMN_LOCKS 512
-#if ATOMIC_LLONG_LOCK_FREE == 2
-#define TRANSACTION_ID_BASE(1ULL<<63)
-#else
-#define TRANSACTION_ID_BASE(1UL<<31)
-#endif
+#define TRANSACTION_ID_BASE(1ULL<<(sizeof(ATOMIC_BASE_TYPE) * 8 - 1))
 
 typedef struct sqlstore {
int catalog_version;/* software version of the catalog */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: groupjoin - Merge with default branch.

2023-08-21 Thread Sjoerd Mullender via checkin-list
Changeset: 30b4bdfa35cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/30b4bdfa35cd
Modified Files:
gdk/gdk.h
monetdb5/modules/kernel/algebra.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_support.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
Branch: groupjoin
Log Message:

Merge with default branch.


diffs (truncated from 71819 to 300 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
new file mode 100644
--- /dev/null
+++ b/.github/workflows/linux.yml
@@ -0,0 +1,57 @@
+name: MonetDB build and test
+
+on:
+  push:
+branches: 
+  - '*'
+  - 'branches/*'
+  pull_request:
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+  schedule:
+- cron:  '15 1 * * *'
+
+jobs:
+  test:
+strategy:
+  fail-fast: false  # don't stop other jobs
+  matrix:
+branch: [ master ]
+os: [ ubuntu-latest, macos-latest ]
+runs-on: ${{ matrix.os }}
+steps:
+  - name: Checkout
+uses: actions/checkout@v3
+with:
+  ref: ${{ matrix.branch }}
+
+  - name: make MonetDB on linux
+run: |
+  mkdir build
+  cd build 
+  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF
+  make install -j3
+if: runner.os == 'Linux'
+  -
+name: brew packages
+run: brew install bison
+if: runner.os == 'macOS'
+  - name: make MonetDB on macos
+run: |
+  mkdir build
+  cd build 
+  cmake ..  -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.branch }} 
-DPY3INTEGRATION=OFF -DCMAKE_BUILD_TYPE=Release -DASSERT=OFF -DRINTEGRATION=OFF 
 \
+-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
+  make install -j3
+if: runner.os == 'macOS'
+  - name: ctest 
+run: |
+  cd build 
+  cmake --build . --target test
+  #-
+  #uses: actions/upload-artifact@v3
+  #name: Publish Linux binary wheels
+  #with:
+  #name: monetdbe-linux-wheel-${{ matrix.branch }}-${{ 
matrix.python-version }}
+  #path: dist/*.whl
diff --git a/ChangeLog.Jun2023 b/ChangeLog.Jun2023
--- a/ChangeLog.Jun2023
+++ b/ChangeLog.Jun2023
@@ -1,3 +1,8 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Thu Aug 10 2023 Panagiotis Koutsourakis 
+- Improve performance of the ILIKE operator when the pattern contains only
+  ASCII characters. In this case we do not need to treat any characters as
+  UTF-8 and we can use much faster routines that perform byte comparisons.
+
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3482,6 +3482,11 @@ main(int argc, char **argv)
 #endif
mnstr_printf(toConsole, "using mapi library %s\n",
 mapi_get_mapi_version());
+   free(dotfile.user);
+   free(dotfile.passwd);
+   free(dotfile.dbname);
+   free(dotfile.host);
+   free(dotfile.output);
return 0;
}
case 'w':
diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c
--- a/clients/odbc/driver/SQLTables.c
+++ b/clients/odbc/driver/SQLTables.c
@@ -234,7 +234,7 @@ MNDBTables(ODBCStmt *stmt,
strcpy(buf, "LOCAL TEMPORARY 
TABLE");
}
pos += snprintf(query + pos, querylen - 
pos, "'%s',", buf);
-   j = 0;
+   j = 0;
} else if (j < sizeof(buf) &&
   TableType[i] != '\'' &&
   (TableType[i] != ' ' ||
diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -114,7 +114,7 @@ nameofSQLtype(SQLSMALLINT dataType)
case SQL_REAL:  return "REAL";
case SQL_FLOAT: return "FLOAT";
case SQL_DOUBLE:return "DOUBLE";
-   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
+   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
case SQL_TINYINT:   return "TINYINT";
case SQL_BIGINT: 

MonetDB: default - Initialize last CharPair's psize so that STRM...

2023-08-21 Thread Sjoerd Mullender via checkin-list
Changeset: cd8e78c74b42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cd8e78c74b42
Modified Files:
gdk/gdk_strimps.c
Branch: default
Log Message:

Initialize last CharPair's psize so that STRMPcreateStrimpHeap uses aligned 
pointer.


diffs (11 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -284,6 +284,7 @@ STRMPchoosePairs(const PairHistogramElem
cp[i].psize = 2;
cp[i].mask = ((uint64_t)0x1) << (STRIMP_PAIRS - i - 1);
}
+   cp[STRIMP_PAIRS] = (CharPair) {.psize = 2};
 
TRC_DEBUG(ACCELERATOR, LLFMT " usec\n", GDKusec() - t0);
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Various fixes to strimps code.

2023-08-18 Thread Sjoerd Mullender via checkin-list
Changeset: bb0c354be880 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bb0c354be880
Modified Files:
gdk/gdk_strimps.c
Branch: default
Log Message:

Various fixes to strimps code.
Added a few const qualifiers to indicate read-only access.
Added a few inline specifiers to small static functions.
Cast input to tolower to unsigned char.
Removed some superfluous (unused or unnecessary) members and variables.
Fixes a shift with a shift value that was not within range.


diffs (196 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -114,8 +114,6 @@ typedef struct {
 
 typedef struct {
uint64_t cnt;
-   uint64_t mask;
-   size_t idx;
 } PairHistogramElem;
 
 
@@ -128,12 +126,13 @@ typedef struct {
 #undef UTF8STRIMPS /* Not using utf8 for now */
 #ifdef UTF8STRIMPS
 static bool
-pair_equal(CharPair *p1, CharPair *p2) {
+pair_equal(const CharPair *p1, const CharPair *p2)
+{
if(p1->psize != p2->psize)
return false;
 
for(size_t i = 0; i < p1->psize; i++)
-   if (*(p1->pbytes + i) != *(p2->pbytes + i))
+   if (p1->pbytes[i] != p2->pbytes[i])
return false;
 
return true;
@@ -154,19 +153,20 @@ pair_equal(CharPair *p1, CharPair *p2) {
 #define pairToIndex(b1, b2) (size_t)(((uint16_t)b2)<<8 | ((uint16_t)b1))
 
 inline static size_t
-bytes2histindex(uint8_t *bytes, uint8_t psize) {
+bytes2histindex(uint8_t *bytes, uint8_t psize)
+{
(void)psize;
return pairToIndex(bytes[0], bytes[1]);
 }
 
 inline static bool
-pair_at(PairIterator *pi, CharPair *p)
+pair_at(const PairIterator *pi, CharPair *p)
 {
if (pi->pos >= pi->lim - 1)
return false;
 
-   p->pbytes[0] = (uint8_t)tolower(*(pi->s + pi->pos));
-   p->pbytes[1] = (uint8_t)tolower(*(pi->s + pi->pos + 1));
+   p->pbytes[0] = (uint8_t)tolower((unsigned char) pi->s[pi->pos]);
+   p->pbytes[1] = (uint8_t)tolower((unsigned char) pi->s[pi->pos + 1]);
 
p->psize = 2;
p->idx = pairToIndex(p->pbytes[0], p->pbytes[1]);
@@ -185,19 +185,19 @@ next_pair(PairIterator *pi)
 /* Returns true if the specified char is ignored.
  */
 inline static bool
-ignored(CharPair *p, uint8_t elm)
+ignored(const CharPair *p, uint8_t elm)
 {
assert(elm == 0 || elm == 1);
return isIgnored(p->pbytes[elm]);
 }
 
-static strimp_masks_t
-STRMPget_mask(Strimps *r, uint64_t idx)
+inline static strimp_masks_t
+STRMPget_mask(const Strimps *r, uint64_t idx)
 {
return r->masks[idx];
 }
 
-static void
+inline static void
 STRMPset_mask(Strimps *r, uint64_t idx, strimp_masks_t val)
 {
r->masks[idx] = val;
@@ -208,10 +208,10 @@ STRMPset_mask(Strimps *r, uint64_t idx, 
  * corresponding to the index of the pair in the strimp header, or is 0
  * if the pair does not occur.
  */
-static uint64_t
-STRMPpairLookup(Strimps *s, CharPair *p)
+inline static uint64_t
+STRMPpairLookup(const Strimps *s, const CharPair *p)
 {
-   return STRMPget_mask(s, pairToIndex(p->pbytes[0], p->pbytes[1]));
+   return STRMPget_mask(s, p->idx);
 }
 
 
@@ -255,7 +255,7 @@ STRMPmakebitstring(const char *s, Strimp
 
 
 static void
-STRMPchoosePairs(PairHistogramElem *hist, size_t hist_size, CharPair *cp)
+STRMPchoosePairs(const PairHistogramElem *hist, size_t hist_size, CharPair *cp)
 {
lng t0 = 0;
size_t i;
@@ -277,10 +277,10 @@ STRMPchoosePairs(PairHistogramElem *hist
}
}
 
-   for(i = 0; i < STRIMP_HEADER_SIZE; i++) {
-   cp[i].pbytes[1] = (uint8_t)(hist[indices[i]].idx & 0xFF);
-   cp[i].pbytes[0] = (uint8_t)((hist[indices[i]].idx >> 8) & 0xFF);
-   cp[i].idx = hist[indices[i]].idx;
+   for(i = 0; i < STRIMP_PAIRS; i++) {
+   cp[i].pbytes[1] = (uint8_t)(indices[i] & 0xFF);
+   cp[i].pbytes[0] = (uint8_t)((indices[i] >> 8) & 0xFF);
+   cp[i].idx = indices[i];
cp[i].psize = 2;
cp[i].mask = ((uint64_t)0x1) << (STRIMP_PAIRS - i - 1);
}
@@ -304,8 +304,8 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai
oid x;
size_t hlen;
PairHistogramElem *hist;
-   PairIterator pi, *pip;
-   CharPair cp, *cpp;
+   PairIterator pi;
+   CharPair cp;
struct canditer ci;
size_t values = 0;
bool res;
@@ -319,20 +319,12 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai
}
 
hlen = STRIMP_HISTSIZE;
-   if ((hist = (PairHistogramElem 
*)GDKmalloc(hlen*sizeof(PairHistogramElem))) == NULL) {
+   if ((hist = (PairHistogramElem 
*)GDKzalloc(hlen*sizeof(PairHistogramElem))) == NULL) {
return false;
}
 
-   for(hidx = 0; hidx < hlen; hidx++) {
-   hist[hidx].cnt = 0;
-   hist[hidx].mask = 0;
-   hist[hidx].idx = hidx;
-   }
-
// Create Histogram
bi = 

MonetDB: default - Test needs proj library.

2023-08-18 Thread Sjoerd Mullender via checkin-list
Changeset: 12020bac3885 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/12020bac3885
Modified Files:
geom/sql/functions/Tests/All
Branch: default
Log Message:

Test needs proj library.


diffs (13 lines):

diff --git a/geom/sql/functions/Tests/All b/geom/sql/functions/Tests/All
--- a/geom/sql/functions/Tests/All
+++ b/geom/sql/functions/Tests/All
@@ -92,7 +92,7 @@ HAVE_GEOM?ST_MakeBox2D
 
 HAVE_GEOM?dropTestGeometries
 HAVE_GEOM?ST_DWithin2
-HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_Transform
-HAVE_GEOM_VERSION>=3.12.0?ST_Transform-3.12
+HAVE_GEOM&!GEOS_VERSION>=3.12.0_PROJ?ST_Transform
+HAVE_GEOM_VERSION>=3.12.0_PROJ?ST_Transform-3.12
 
 HAVE_GEOM?geomcasts
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: c038c6971c41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c038c6971c41
Modified Files:
cmake/monetdb-defines.cmake
monetdb5/mal/mal_linker.c
monetdb_config.h.in
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (179 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3482,6 +3482,11 @@ main(int argc, char **argv)
 #endif
mnstr_printf(toConsole, "using mapi library %s\n",
 mapi_get_mapi_version());
+   free(dotfile.user);
+   free(dotfile.passwd);
+   free(dotfile.dbname);
+   free(dotfile.host);
+   free(dotfile.output);
return 0;
}
case 'w':
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -105,6 +105,7 @@ function(monetdb_configure_defines)
   check_function_exists("setsid" HAVE_SETSID)
   check_function_exists("shutdown" HAVE_SHUTDOWN)
   check_function_exists("sigaction" HAVE_SIGACTION)
+  check_function_exists("siglongjmp" HAVE_SIGLONGJMP)
   check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY)
   check_function_exists("strcasestr" HAVE_STRCASESTR)
   check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP)
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -71,7 +71,6 @@ fileexists(const char *path)
 MALfcn
 getAddress(const char *modname, const char *fcnname)
 {
-   void *dl;
MALfcn adr;
int idx = 0;
static int prev = -1;
@@ -103,46 +102,23 @@ getAddress(const char *modname, const ch
}
}
 
-   if (lastfile) {
-   /* first should be monetdb5 */
-   assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0
-  || strcmp(filesLoaded[0].modname, "embedded") == 0);
-   adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname);
-   if (adr != NULL) {
-   prev = 0;
-   return adr; /* found it */
+   if (lastfile == 0) {
+   char *msg = loadLibrary("monetdb5", 1);
+   if (msg) {
+   freeException(msg);
+   return NULL;
}
-   return NULL;
}
-   /*
-* Try the program libraries at large or run through all
-* loaded files and try to resolve the functionname again.
-*
-* the first argument must be the same as the base name of the
-* library that is created in src/tools */
-#ifdef __APPLE__
-   dl = mdlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL);
-#else
-   dl = dlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL);
-#endif
-   if (dl == NULL)
-   return NULL;
 
-   adr = (MALfcn) dlsym(dl, fcnname);
-   filesLoaded[lastfile].modname = GDKstrdup("libmonetdb5");
-   if (filesLoaded[lastfile].modname == NULL) {
-   dlclose(dl);
-   return NULL;
+   /* first should be monetdb5 */
+   assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0
+  || strcmp(filesLoaded[0].modname, "embedded") == 0);
+   adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname);
+   if (adr != NULL) {
+   prev = 0;
+   return adr; /* found it */
}
-   filesLoaded[lastfile].fullname = GDKstrdup("libmonetdb5");
-   if (filesLoaded[lastfile].fullname == NULL) {
-   dlclose(dl);
-   GDKfree(filesLoaded[lastfile].modname);
-   return NULL;
-   }
-   filesLoaded[lastfile].handle = dl;
-   lastfile++;
-   return adr;
+   return NULL;
 }
 
 /*
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -157,6 +157,7 @@
 #cmakedefine HAVE_SETSID 1
 #cmakedefine HAVE_SHUTDOWN 1
 #cmakedefine HAVE_SIGACTION 1
+#cmakedefine HAVE_SIGLONGJMP 1
 #cmakedefine HAVE_STPCPY 1
 #cmakedefine HAVE_STRCASESTR 1
 #cmakedefine HAVE_STRNCASECMP 1
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1201,8 +1201,6 @@ backend_dumpproc(backend *be, Client c, 
*be = bebackup;
c->curprg = symbackup;
m->sa->eb = ebsave;
-   if (m->sa->eb.enabled)
-   eb_error(>sa->eb, m->errstr[0] ? m->errstr : be->mb->errors 
? be->mb->errors : *GDKerrbuf ? GDKerrbuf : "out of 

MonetDB: Jun2023 - Use sigsetjmp/siglongjmp when available, and ...

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: e80aacbcdea1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e80aacbcdea1
Modified Files:
cmake/monetdb-defines.cmake
monetdb_config.h.in
sql/common/exception_buffer.c
sql/include/exception_buffer.h
Branch: Jun2023
Log Message:

Use sigsetjmp/siglongjmp when available, and don't save signal mask.
Not saving the mask is default on Linux and the desired behavior, but on
the Mac, it is not the default and causes mserver5 to be unstoppable
after a call to eb_error (longjmp).


diffs (56 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -106,6 +106,7 @@ function(monetdb_configure_defines)
   check_function_exists("setsid" HAVE_SETSID)
   check_function_exists("shutdown" HAVE_SHUTDOWN)
   check_function_exists("sigaction" HAVE_SIGACTION)
+  check_function_exists("siglongjmp" HAVE_SIGLONGJMP)
   check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY)
   check_function_exists("strcasestr" HAVE_STRCASESTR)
   check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP)
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -158,6 +158,7 @@
 #cmakedefine HAVE_SETSID 1
 #cmakedefine HAVE_SHUTDOWN 1
 #cmakedefine HAVE_SIGACTION 1
+#cmakedefine HAVE_SIGLONGJMP 1
 #cmakedefine HAVE_STPCPY 1
 #cmakedefine HAVE_STRCASESTR 1
 #cmakedefine HAVE_STRNCASECMP 1
diff --git a/sql/common/exception_buffer.c b/sql/common/exception_buffer.c
--- a/sql/common/exception_buffer.c
+++ b/sql/common/exception_buffer.c
@@ -29,5 +29,9 @@ eb_error( exception_buffer *eb, char *ms
eb->code = val;
eb->msg = msg;
eb->enabled = 0;/* not any longer... */
+#ifdef HAVE_SIGLONGJMP
+   siglongjmp(eb->state, eb->code);
+#else
longjmp(eb->state, eb->code);
+#endif
 }
diff --git a/sql/include/exception_buffer.h b/sql/include/exception_buffer.h
--- a/sql/include/exception_buffer.h
+++ b/sql/include/exception_buffer.h
@@ -21,10 +21,14 @@ typedef struct exception_buffer {
int enabled;
 } exception_buffer;
 
-extern exception_buffer *eb_init( exception_buffer *eb );
+extern exception_buffer *eb_init(exception_buffer *eb);
 
 /* != 0 on when we return to the savepoint */
-#define eb_savepoint(eb) ((eb)->enabled=1,setjmp((eb)->state))
-extern _Noreturn void eb_error( exception_buffer *eb, char *msg, int val );
+#ifdef HAVE_SIGLONGJMP
+#define eb_savepoint(eb) ((eb)->enabled = 1, sigsetjmp((eb)->state, 0))
+#else
+#define eb_savepoint(eb) ((eb)->enabled = 1, setjmp((eb)->state))
+#endif
+extern _Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
 
 #endif /* EXCEPTION_BUFFER_H */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Give the caller of backend_dumpproc a chance ...

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: 9e464581a7ed for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9e464581a7ed
Modified Files:
sql/backends/monet5/sql_gencode.c
Branch: Jun2023
Log Message:

Give the caller of backend_dumpproc a chance to clean up.


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1201,8 +1201,6 @@ backend_dumpproc(backend *be, Client c, 
*be = bebackup;
c->curprg = symbackup;
m->sa->eb = ebsave;
-   if (m->sa->eb.enabled)
-   eb_error(>sa->eb, m->errstr[0] ? m->errstr : be->mb->errors 
? be->mb->errors : *GDKerrbuf ? GDKerrbuf : "out of memory", 1000);
return -1;
 }
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Disable longjmp whichever way we exit the fun...

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: 8a5118c6bfeb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8a5118c6bfeb
Modified Files:
tools/monetdbe/monetdbe.c
Branch: Jun2023
Log Message:

Disable longjmp whichever way we exit the function.


diffs (13 lines):

diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -754,8 +754,8 @@ monetdbe_startup(monetdbe_database_inter
monetdbe_embedded_url = dbdir?GDKstrdup(dbdir):NULL;
if (dbdir && !monetdbe_embedded_url)
set_error(mdbe, createException(MAL, 
"monetdbe.monetdbe_startup", MAL_MALLOC_FAIL));
+cleanup:
GDKfataljumpenable = 0;
-cleanup:
if (mdbe->msg)
monetdbe_shutdown_internal();
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Typo.

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: 2ebf3757955e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2ebf3757955e
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: Jun2023
Log Message:

Typo.


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -101,7 +101,7 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M
const char *caller_revision = (const char *) (void *) mb;
const char *p = mercurial_revision();
if (p && strcmp(p, caller_revision) != 0) {
-   throw(MAL, "sq;.start", "incompatible versions: caller 
is %s, GDK is %s\n", caller_revision, p);
+   throw(MAL, "sql.start", "incompatible versions: caller 
is %s, GDK is %s\n", caller_revision, p);
}
}
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Reuse code.

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: 4580449c46cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4580449c46cd
Modified Files:
monetdb5/mal/mal_linker.c
Branch: Jun2023
Log Message:

Reuse code.


diffs (71 lines):

diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -71,7 +71,6 @@ fileexists(const char *path)
 MALfcn
 getAddress(const char *modname, const char *fcnname)
 {
-   void *dl;
MALfcn adr;
int idx = 0;
static int prev = -1;
@@ -103,46 +102,23 @@ getAddress(const char *modname, const ch
}
}
 
-   if (lastfile) {
-   /* first should be monetdb5 */
-   assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0
-  || strcmp(filesLoaded[0].modname, "embedded") == 0);
-   adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname);
-   if (adr != NULL) {
-   prev = 0;
-   return adr; /* found it */
+   if (lastfile == 0) {
+   char *msg = loadLibrary("monetdb5", 1);
+   if (msg) {
+   freeException(msg);
+   return NULL;
}
-   return NULL;
}
-   /*
-* Try the program libraries at large or run through all
-* loaded files and try to resolve the functionname again.
-*
-* the first argument must be the same as the base name of the
-* library that is created in src/tools */
-#ifdef __APPLE__
-   dl = mdlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL);
-#else
-   dl = dlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL);
-#endif
-   if (dl == NULL)
-   return NULL;
 
-   adr = (MALfcn) dlsym(dl, fcnname);
-   filesLoaded[lastfile].modname = GDKstrdup("libmonetdb5");
-   if (filesLoaded[lastfile].modname == NULL) {
-   dlclose(dl);
-   return NULL;
+   /* first should be monetdb5 */
+   assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0
+  || strcmp(filesLoaded[0].modname, "embedded") == 0);
+   adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname);
+   if (adr != NULL) {
+   prev = 0;
+   return adr; /* found it */
}
-   filesLoaded[lastfile].fullname = GDKstrdup("libmonetdb5");
-   if (filesLoaded[lastfile].fullname == NULL) {
-   dlclose(dl);
-   GDKfree(filesLoaded[lastfile].modname);
-   return NULL;
-   }
-   filesLoaded[lastfile].handle = dl;
-   lastfile++;
-   return adr;
+   return NULL;
 }
 
 /*
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Free memory before exiting.

2023-08-17 Thread Sjoerd Mullender via checkin-list
Changeset: dcb87f7615cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dcb87f7615cd
Modified Files:
clients/mapiclient/mclient.c
Branch: Jun2023
Log Message:

Free memory before exiting.


diffs (15 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3482,6 +3482,11 @@ main(int argc, char **argv)
 #endif
mnstr_printf(toConsole, "using mapi library %s\n",
 mapi_get_mapi_version());
+   free(dotfile.user);
+   free(dotfile.passwd);
+   free(dotfile.dbname);
+   free(dotfile.host);
+   free(dotfile.output);
return 0;
}
case 'w':
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-16 Thread Sjoerd Mullender via checkin-list
Changeset: 84fa4ef91888 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/84fa4ef91888
Modified Files:
cmake/monetdb-toolchain.cmake
gdk/gdk_utils.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_prelude.c
monetdb5/optimizer/opt_mitosis.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/storage/objectset.c
sql/storage/store.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 8353 to 300 lines):

diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -128,7 +128,6 @@ function(monetdb_default_compiler_option
   add_option_if_available("-fstack-protector-all")
   add_option_if_available("-Wpacked-bitfield-compat")
   add_option_if_available("-Wsync-nand")
-  add_option_if_available("-Wjump-misses-init")
   add_option_if_available("-Wmissing-include-dirs")
   add_option_if_available("-Wlogical-op")
   add_option_if_available("-Wduplicated-cond")
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -646,14 +646,26 @@ MT_init(void)
break;
*p = 0;
if (strncmp(buf, "0::", 3) == 0) {
-   size_t l;
-
/* cgroup v2 entry */
-   l = strconcat_len(pth, sizeof(pth),
- cgr2, buf + 3, "/", NULL);
+   p = stpcpy(pth, cgr2);
+   q = stpcpy(stpcpy(p, buf + 3), "/");
/* hard limit */
-   strcpy(pth + l, "memory.max");
+   strcpy(q, "memory.max");
f = fopen(pth, "r");
+   while (f == NULL && q > p) {
+   /* go up the hierarchy until we
+* find the file or the
+* hierarchy runs out */
+   *--q = 0; /* zap the slash */
+   q = strrchr(p, '/');
+   if (q == NULL || q == p) {
+   /* position after the slash */
+   q = p + 1;
+   break;
+   }
+   strcpy(++q, "memory.max");
+   f = fopen(pth, "r");
+   }
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem < (uint64_t) _MT_pagesize * _MT_npages) {
_MT_npages = (size_t) (mem / 
_MT_pagesize);
@@ -663,7 +675,7 @@ MT_init(void)
fclose(f);
}
/* soft high limit */
-   strcpy(pth + l, "memory.high");
+   strcpy(q, "memory.high");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem < (uint64_t) _MT_pagesize * _MT_npages) {
@@ -674,7 +686,7 @@ MT_init(void)
fclose(f);
}
/* soft low limit */
-   strcpy(pth + l, "memory.low");
+   strcpy(q, "memory.low");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem > 0 && mem < (uint64_t) _MT_pagesize * _MT_npages) {
@@ -686,7 +698,7 @@ MT_init(void)
}
/* limit of memory+swap usage
 * we use this as maximum virtual memory size */
-   strcpy(pth + l, "memory.swap.max");
+   strcpy(q, "memory.swap.max");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ 

MonetDB: Jun2023 - Revert some unneeded changes.

2023-08-16 Thread Sjoerd Mullender via checkin-list
Changeset: 86d162714b44 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/86d162714b44
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: Jun2023
Log Message:

Revert some unneeded changes.


diffs (26 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1319,18 +1319,16 @@ SQLparser_body(Client c, backend *be)
 
Tbegin = GDKusec();
 
-   int opt = ((m->emod & mod_exec) == 0); /* no need to 
optimze prepare - execute */
+   int opt = 0;
if (backend_dumpstmt(be, c->curprg->def, r, !(m->emod & 
mod_exec), 0, c->query) < 0) {
-   if (m->sa->eb.msg)
-   msg = createException(SQL, "SQLparser", 
"%s", m->sa->eb.msg);
-   else
-   msg = handle_error(m, 0, MAL_SUCCEED);
+   msg = handle_error(m, 0, msg);
err = 1;
MSresetInstructions(c->curprg->def, oldstop);
freeVariables(c, c->curprg->def, NULL, oldvtop, 
oldvid);
freeException(c->curprg->def->errors);
c->curprg->def->errors = NULL;
-   }
+   } else
+   opt = ((m->emod & mod_exec) == 0); /* no need 
to optimze prepare - execute */
 
Tend = GDKusec();
if(profilerStatus > 0)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - More contortions to make setjmp/longjmp work.

2023-08-16 Thread Sjoerd Mullender via checkin-list
Changeset: e5adba1aea41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e5adba1aea41
Modified Files:
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
Branch: Jun2023
Log Message:

More contortions to make setjmp/longjmp work.


diffs (truncated from 1133 to 300 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -137,51 +137,15 @@ relational_func_create_result_part2(MalB
 }
 
 static int
-_create_relational_function(mvc *m, const char *mod, const char *name, sql_rel 
*r, stmt *call, list *rel_ops, int inline_func)
+_create_relational_function_body(mvc *m, sql_rel *r, stmt *call, list 
*rel_ops, int inline_func)
 {
Client c = MCgetClient(m->clientid);
backend *be = (backend *) c->sqlcontext;
MalBlkPtr curBlk = 0;
InstrPtr curInstr = 0;
-   Symbol symbackup = NULL;
-   int res = 0, added_to_cache;
+   int res = 0, added_to_cache = 0;
str msg = MAL_SUCCEED;
-   backend bebackup;
-   exception_buffer ebsave = m->sa->eb;
-
-   if (strlen(mod) >= IDLENGTH) {
-   (void) sql_error(m, 10, SQLSTATE(42000) "Module name '%s' too 
large for the backend", mod);
-   res = -1;
-   goto bailout;
-   }
-   if (strlen(name) >= IDLENGTH) {
-   (void) sql_error(m, 10, SQLSTATE(42000) "Function name '%s' too 
large for the backend", name);
-   res = -1;
-   goto bailout;
-   }
-   symbackup = c->curprg;
-   bebackup = *be; /* backup current backend */
-   backend_reset(be);
 
-   int nargs;
-   relational_func_create_result_part1(m, , );
-   nargs += (call && call->type == st_list) ? list_length(call->op4.lval) 
: rel_ops ? list_length(rel_ops) : 0;
-
-   c->curprg = newFunctionArgs(putName(mod), putName(name), 
FUNCTIONsymbol, nargs);
-   if(c->curprg  == NULL) {
-   added_to_cache = 0;
-   sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
-   res = -1;
-   goto cleanup;
-   }
-   if (eb_savepoint(>sa->eb)) {
-   added_to_cache = 0;
-   sql_error(m, 10, "%s", m->sa->eb.msg);
-   res = -1;
-   goto cleanup;
-   }
-
-   added_to_cache = 0;
curBlk = c->curprg->def;
curInstr = getInstrPtr(curBlk, 0);
 
@@ -300,13 +264,55 @@ cleanup:
else
SQLremoveQueryFromCache(c);
}
+   return res;
+}
+
+static int
+_create_relational_function(mvc *m, const char *mod, const char *name, sql_rel 
*r, stmt *call, list *rel_ops, int inline_func)
+{
+   Client c = MCgetClient(m->clientid);
+   backend *be = (backend *) c->sqlcontext;
+   Symbol symbackup = c->curprg;
+   backend bebackup = *be; /* backup current backend */
+   exception_buffer ebsave = m->sa->eb;
+
+   if (strlen(mod) >= IDLENGTH) {
+   (void) sql_error(m, 10, SQLSTATE(42000) "Module name '%s' too 
large for the backend", mod);
+   goto bailout;
+   }
+   if (strlen(name) >= IDLENGTH) {
+   (void) sql_error(m, 10, SQLSTATE(42000) "Function name '%s' too 
large for the backend", name);
+   goto bailout;
+   }
+
+   backend_reset(be);
+
+   int nargs;
+   relational_func_create_result_part1(m, , );
+   nargs += (call && call->type == st_list) ? list_length(call->op4.lval) 
: rel_ops ? list_length(rel_ops) : 0;
+
+   c->curprg = newFunctionArgs(putName(mod), putName(name), 
FUNCTIONsymbol, nargs);
+   if (c->curprg == NULL) {
+   sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   goto bailout;
+   } else if (eb_savepoint(>sa->eb)) {
+   sql_error(m, 10, "%s", m->sa->eb.msg);
+   freeSymbol(c->curprg);
+   goto bailout;
+   } else if (_create_relational_function_body(m, r, call, rel_ops, 
inline_func) < 0) {
+   goto bailout;
+   }
*be = bebackup;
c->curprg = symbackup;
m->sa->eb = ebsave;
+   return 0;
   bailout:
-   if (res < 0 && m->sa->eb.enabled)
+   *be = bebackup;
+   c->curprg = symbackup;
+   m->sa->eb = ebsave;
+   if (m->sa->eb.enabled)
eb_error(>sa->eb, m->errstr[0] ? m->errstr : be->mb->errors 
? be->mb->errors : *GDKerrbuf ? GDKerrbuf : "out of memory", 1000);
-   return res;
+   return -1;
 }
 
 static str
@@ -342,42 +348,23 @@ cleanup:
 
 /* stub and remote function */
 static int
-_create_relational_remote(mvc *m, const char *mod, const char *name, sql_rel 
*rel, stmt *call, prop *prp)
+_create_relational_remote_body(mvc *m, const char *mod, const char *name, 
sql_rel *rel, sql_rel *rel2, stmt *call, prop *prp)
 {
Client c = 

MonetDB: Jun2023 - Contortions to get the compiler to not compla...

2023-08-15 Thread Sjoerd Mullender via checkin-list
Changeset: d87f381818e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d87f381818e5
Modified Files:
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
Branch: Jun2023
Log Message:

Contortions to get the compiler to not complain about clobbering after longjmp.


diffs (170 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -144,7 +144,7 @@ static int
MalBlkPtr curBlk = 0;
InstrPtr curInstr = 0;
Symbol symbackup = NULL;
-   int res = 0, added_to_cache = 0;
+   int res = 0, added_to_cache;
str msg = MAL_SUCCEED;
backend bebackup;
exception_buffer ebsave = m->sa->eb;
@@ -169,16 +169,19 @@ static int
 
c->curprg = newFunctionArgs(putName(mod), putName(name), 
FUNCTIONsymbol, nargs);
if(c->curprg  == NULL) {
+   added_to_cache = 0;
sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
res = -1;
goto cleanup;
}
if (eb_savepoint(>sa->eb)) {
+   added_to_cache = 0;
sql_error(m, 10, "%s", m->sa->eb.msg);
res = -1;
goto cleanup;
}
 
+   added_to_cache = 0;
curBlk = c->curprg->def;
curInstr = getInstrPtr(curBlk, 0);
 
@@ -347,7 +350,7 @@ static int
Symbol backup = NULL;
sqlid table_id = prp->id;
node *n;
-   int i, q, v, res = 0, added_to_cache = 0,  *lret, *rret;
+   int i, q, v, res = 0, added_to_cache,  *lret, *rret;
size_t len = 1024, nr, pwlen = 0;
char *lname = NULL, *buf = NULL, *mal_session_uuid, *err = NULL, 
*pwhash = NULL;
str username = NULL, password = NULL, msg = NULL;
@@ -409,10 +412,12 @@ static int
goto bailout;
}
if (eb_savepoint(>sa->eb)) {
+   added_to_cache = 0;
sql_error(m, 10, "%s", m->sa->eb.msg);
res = -1;
goto cleanup;
}
+   added_to_cache = 0;
lname[0] = 'l';
curBlk = c->curprg->def;
curInstr = getInstrPtr(curBlk, 0);
@@ -1115,7 +1120,7 @@ backend_dumpproc(backend *be, Client c, 
Symbol symbackup = NULL;
InstrPtr curInstr = 0;
char arg[IDLENGTH];
-   int argc = 1, res = 0, added_to_cache = 0;
+   int argc = 1, res = 0, added_to_cache;
backend bebackup;
const char *sql_private_module = putName(sql_private_module_name);
exception_buffer ebsave = m->sa->eb;
@@ -1131,16 +1136,19 @@ backend_dumpproc(backend *be, Client c, 
assert(cq && strlen(cq->name) < IDLENGTH);
c->curprg = newFunctionArgs(sql_private_module, cq->name = 
putName(cq->name), FUNCTIONsymbol, argc);
if (c->curprg == NULL) {
+   added_to_cache = 0;
sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
res = -1;
goto cleanup;
}
if (eb_savepoint(>sa->eb)) {
+   added_to_cache = 0;
sql_error(m, 10, "%s", m->sa->eb.msg);
res = -1;
goto cleanup;
}
 
+   added_to_cache = 0;
mb = c->curprg->def;
curInstr = getInstrPtr(mb, 0);
/* we do not return anything */
@@ -1465,11 +1473,11 @@ backend_create_sql_func(backend *be, sql
InstrPtr curInstr = NULL;
Client c = be->client;
Symbol symbackup = NULL;
-   int res = 0, i, nargs, retseen = 0, sideeffects = 0, no_inline = 0, 
added_to_cache = 0, needstoclean = 0;
-   str msg = MAL_SUCCEED;
+   int res = 0, i, nargs, retseen, sideeffects = 0, no_inline, 
added_to_cache, needstoclean;
+   str msg;
backend bebackup;
sql_func *pf = NULL;
-   str fimp = NULL;
+   str fimp;
char befname[IDLENGTH];
const char *sql_shared_module;
Module mod;
@@ -1500,21 +1508,32 @@ backend_create_sql_func(backend *be, sql
nargs = (f->res && f->type == F_UNION ? list_length(f->res) : 1) + 
(f->vararg && ops ? list_length(ops) : f->ops ? list_length(f->ops) : 0);
c->curprg = newFunctionArgs(sql_shared_module, putName(befname), 
FUNCTIONsymbol, nargs);
if (c->curprg == NULL) {
+   added_to_cache = 0;
+   needstoclean = 0;
+   fimp = NULL;
sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
res = -1;
goto cleanup;
}
if (eb_savepoint(>sa->eb)) {
+   added_to_cache = 0;
+   needstoclean = 0;
+   fimp = NULL;
sql_error(m, 10, "%s", m->sa->eb.msg);
res = -1;
goto cleanup;
}
+   msg = MAL_SUCCEED;
+   added_to_cache = 0;
+   needstoclean = 0;
if (!(fimp = _STRDUP(befname))) {

MonetDB: Jun2023 - cgroup v2 is a hierarchy: search up it to fin...

2023-08-15 Thread Sjoerd Mullender via checkin-list
Changeset: d36bd76c491f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d36bd76c491f
Modified Files:
gdk/gdk_utils.c
Branch: Jun2023
Log Message:

cgroup v2 is a hierarchy: search up it to find the controller we need.


diffs (62 lines):

diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -646,14 +646,26 @@ MT_init(void)
break;
*p = 0;
if (strncmp(buf, "0::", 3) == 0) {
-   size_t l;
-
/* cgroup v2 entry */
-   l = strconcat_len(pth, sizeof(pth),
- cgr2, buf + 3, "/", NULL);
+   p = stpcpy(pth, cgr2);
+   q = stpcpy(stpcpy(p, buf + 3), "/");
/* hard limit */
-   strcpy(pth + l, "memory.max");
+   strcpy(q, "memory.max");
f = fopen(pth, "r");
+   while (f == NULL && q > p) {
+   /* go up the hierarchy until we
+* find the file or the
+* hierarchy runs out */
+   *--q = 0; /* zap the slash */
+   q = strrchr(p, '/');
+   if (q == NULL || q == p) {
+   /* position after the slash */
+   q = p + 1;
+   break;
+   }
+   strcpy(++q, "memory.max");
+   f = fopen(pth, "r");
+   }
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem < (uint64_t) _MT_pagesize * _MT_npages) {
_MT_npages = (size_t) (mem / 
_MT_pagesize);
@@ -663,7 +675,7 @@ MT_init(void)
fclose(f);
}
/* soft high limit */
-   strcpy(pth + l, "memory.high");
+   strcpy(q, "memory.high");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem < (uint64_t) _MT_pagesize * _MT_npages) {
@@ -674,7 +686,7 @@ MT_init(void)
fclose(f);
}
/* soft low limit */
-   strcpy(pth + l, "memory.low");
+   strcpy(q, "memory.low");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1 && 
mem > 0 && mem < (uint64_t) _MT_pagesize * _MT_npages) {
@@ -686,7 +698,7 @@ MT_init(void)
}
/* limit of memory+swap usage
 * we use this as maximum virtual memory size */
-   strcpy(pth + l, "memory.swap.max");
+   strcpy(q, "memory.swap.max");
f = fopen(pth, "r");
if (f != NULL) {
if (fscanf(f, "%" SCNu64, ) == 1
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Just to be sure, check that allocator exists ...

2023-08-15 Thread Sjoerd Mullender via checkin-list
Changeset: 954cc7f19d54 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/954cc7f19d54
Modified Files:
sql/backends/monet5/sql_scenario.c
Branch: Jun2023
Log Message:

Just to be sure, check that allocator exists before use.


diffs (31 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1222,7 +1222,7 @@ SQLparser(Client c, backend *be)
throw(SQL, "SQLparser", SQLSTATE(HY013) MAL_MALLOC_FAIL " for 
SQL allocator");
}
int err = 0;
-   if (eb_savepoint(>sa->eb)) {
+   if (m->sa && eb_savepoint(>sa->eb)) {
/* in case m->sa->eb.msg is actually c->curprg->def->errors, we
 * free the latter after copying the former into a new error
 * message */
@@ -1346,7 +1346,7 @@ SQLparser(Client c, backend *be)
Tbegin = GDKusec();
 
int opt = ((m->emod & mod_exec) == 0); /* no need to 
optimze prepare - execute */
-   if (eb_savepoint(>sa->eb) ||
+   if ((m->sa && eb_savepoint(>sa->eb)) ||
backend_dumpstmt(be, c->curprg->def, r, 
!(m->emod & mod_exec), 0, c->query) < 0) {
if (m->sa->eb.msg && msg == NULL)
msg = createException(SQL, "SQLparser", 
"%s", m->sa->eb.msg);
@@ -1466,7 +1466,8 @@ SQLparser(Client c, backend *be)
}
}
 finalize:
-   eb_init(>sa->eb); /* exiting the scope where the exception buffer 
can be used */
+   if (m->sa)
+   eb_init(>sa->eb); /* exiting the scope where the exception 
buffer can be used */
if (msg) {
sqlcleanup(be, 0);
c->query = NULL;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Do a log (and I mean a *lot*) of error checking.

2023-08-15 Thread Sjoerd Mullender via checkin-list
Changeset: c579cab524f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c579cab524f3
Modified Files:
cmake/monetdb-toolchain.cmake
monetdb5/extras/mal_optimizer_template/opt_sql_append.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_builder.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_module.c
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_prelude.c
monetdb5/mal/mal_resolve.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/orderidx.c
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_dict.c
monetdb5/optimizer/opt_emptybind.c
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_matpack.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_wrapper.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/sql_statement.c
sql/common/exception_buffer.c
sql/common/sql_hash.c
sql/storage/objectset.c
sql/storage/store.c
Branch: Jun2023
Log Message:

Do a log (and I mean a *lot*) of error checking.
We also now use the exception buffer (i.e. longjmp) more in case of
errors during parsing and optimization.


diffs (truncated from 7614 to 300 lines):

diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -98,7 +98,6 @@ function(monetdb_default_compiler_option
   add_option_if_available("-fstack-protector-all")
   add_option_if_available("-Wpacked-bitfield-compat")
   add_option_if_available("-Wsync-nand")
-  add_option_if_available("-Wjump-misses-init")
   add_option_if_available("-Wmissing-include-dirs")
   add_option_if_available("-Wlogical-op")
   add_option_if_available("-Wduplicated-cond")
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -201,6 +201,12 @@ OPTsql_appendImplementation(Client cntxt
q2 = pushArgument(mb, q2, getArg(p, 5));
q2 = pushLng(mb, q2, 0);
q2 = pushArgument(mb, q2, getArg(q1, 0));
+   if (mb->errors) {
+   freeInstruction(q1);
+   freeInstruction(q2);
+   i--;
+   break;
+   }
pushInstruction(mb, q1);
pushInstruction(mb, q2);
 
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -219,6 +219,8 @@ newExitStmt(MalBlkPtr mb, const char *nm
 InstrPtr
 pushEndInstruction(MalBlkPtr mb)
 {
+   if (mb->errors)
+   return NULL;
InstrPtr q = newInstruction(mb, NULL, NULL);
 
if (q == NULL)
@@ -229,6 +231,8 @@ pushEndInstruction(MalBlkPtr mb)
q->retc = 0;
q->argv[0] = 0;
pushInstruction(mb, q);
+   if (mb->errors)
+   return NULL;
return q;
 }
 
@@ -253,8 +257,8 @@ pushInt(MalBlkPtr mb, InstrPtr q, int va
int _t;
ValRecord cst;
 
-   if (q == NULL)
-   return NULL;
+   if (q == NULL || mb->errors)
+   return q;
cst.vtype = TYPE_int;
cst.val.ival = val;
cst.len = 0;
@@ -285,8 +289,8 @@ pushBte(MalBlkPtr mb, InstrPtr q, bte va
int _t;
ValRecord cst;
 
-   if (q == NULL)
-   return NULL;
+   if (q == NULL || mb->errors)
+   return q;
cst.vtype = TYPE_bte;
cst.val.btval = val;
cst.len = 0;
@@ -317,8 +321,8 @@ pushOid(MalBlkPtr mb, InstrPtr q, oid va
int _t;
ValRecord cst;
 
-   if (q == NULL)
-   return NULL;
+   if (q == NULL || mb->errors)
+   return q;
cst.vtype = TYPE_oid;
cst.val.oval = val;
cst.len = 0;
@@ -334,8 +338,8 @@ pushVoid(MalBlkPtr mb, InstrPtr q)
int _t;
ValRecord cst;
 
-   if (q == NULL)
-   return NULL;
+   if (q == NULL || mb->errors)
+   return q;
cst.vtype = TYPE_void;
cst.val.oval = oid_nil;

MonetDB: default - Get this to compile again on Windows.

2023-08-15 Thread Sjoerd Mullender via checkin-list
Changeset: 2b629c58e715 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2b629c58e715
Modified Files:
sql/backends/monet5/vaults/csv/CMakeLists.txt
sql/server/sql_parser.y
Branch: default
Log Message:

Get this to compile again on Windows.


diffs (23 lines):

diff --git a/sql/backends/monet5/vaults/csv/CMakeLists.txt 
b/sql/backends/monet5/vaults/csv/CMakeLists.txt
--- a/sql/backends/monet5/vaults/csv/CMakeLists.txt
+++ b/sql/backends/monet5/vaults/csv/CMakeLists.txt
@@ -24,6 +24,7 @@ target_link_libraries(csv
 sql
 monetdb5
 bat
+stream
   )
 
 set_target_properties(csv
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -5048,7 +5048,7 @@ literal:
  int precision = $2;

  if (precision == 1 && strlen($4) > 9)
-   precision += strlen($4) - 9;
+   precision += (int) strlen($4) - 9;
  r = sql_find_subtype(, ($3)?"timetz":"time", precision, 0);
  if (!r || (a = atom_general(SA, , $4)) == NULL) {
sqlformaterror(m, SQLSTATE(22007) "Incorrect time value 
(%s)", $4);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Add option to stop testing when a crash was d...

2023-08-14 Thread Sjoerd Mullender via checkin-list
Changeset: ca1bb6a27f31 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ca1bb6a27f31
Modified Files:
testing/Mtest.py.in
Branch: Jun2023
Log Message:

Add option to stop testing when a crash was detected.
This may help in debugging by not modifying the database by restarting
after a crash.


diffs (38 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -41,6 +41,7 @@ MonetDB_VERSION = '@MONETDB_VERSION@'.sp
 procdebug = False
 verbosity = 0
 approve = False
+stop_crash = False
 
 initdb = None
 single_in_memory = False
@@ -1442,6 +1443,9 @@ def PerformDir(env, testdir, testlist, t
 body_bad.append(bodyline)
 if FtOut in (F_OK, F_WARN) and FtErr in (F_OK, F_WARN):
 oktests.append(TST)
+if stop_crash and FtErr in (F_SEGV, F_ABRT):
+interrupted = True
+break
 except KeyboardInterrupt:
 print('\nInterrupted')
 interrupted = True
@@ -3484,6 +3488,7 @@ def main(argv) :
 parser.add_argument('--initdb', action='store', dest='initdb', 
metavar='', help='zip file with contents for initial database')
 parser.add_argument('--single-in-memory', action='store_true', 
dest='single_in_memory', help='use --in-memory for SingleServer directories')
 parser.add_argument('--approve', action='store_true', help='produce 
.newtest file in testing directory with calculated content')
+parser.add_argument('--stop-at-crash', action='store_true', 
dest='stop_crash', help='stop testing when the server crashes')
 global produce_html
 if produce_html:
 parser.add_argument('--no-html', action='store_false', 
dest='produce_html', help='do not produce HTML files')
@@ -3503,6 +3508,8 @@ def main(argv) :
 procdebug = opts.procdebug
 global approve
 approve = opts.approve
+global stop_crash
+stop_crash = opts.stop_crash
 produce_html = opts.produce_html
 addreqs = False
 testweb = opts.testweb
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-11 Thread Sjoerd Mullender via checkin-list
Changeset: f7883423070b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f7883423070b
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (11 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1200,6 +1200,7 @@ log_read_transaction(logger *lg, uint32_
break;
default:
/* do nothing */
+   break;
}
/* the functions we call here can succeed (LOG_OK),
 * but they can also fail for two different reasons:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Visual Studio needs a statement here.

2023-08-11 Thread Sjoerd Mullender via checkin-list
Changeset: 1aff9dd1e735 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1aff9dd1e735
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Visual Studio needs a statement here.


diffs (11 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1200,6 +1200,7 @@ log_read_transaction(logger *lg, uint32_
break;
default:
/* do nothing */
+   break;
}
/* the functions we call here can succeed (LOG_OK),
 * but they can also fail for two different reasons:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-11 Thread Sjoerd Mullender via checkin-list
Changeset: b80b69e84cb8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b80b69e84cb8
Modified Files:
gdk/gdk_bbp.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 2190 to 300 lines):

diff --git a/ChangeLog.Jun2023 b/ChangeLog.Jun2023
--- a/ChangeLog.Jun2023
+++ b/ChangeLog.Jun2023
@@ -1,3 +1,8 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Thu Aug 10 2023 Panagiotis Koutsourakis 
+- Improve performance of the ILIKE operator when the pattern contains only
+  ASCII characters. In this case we do not need to treat any characters as
+  UTF-8 and we can use much faster routines that perform byte comparisons.
+
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3073,11 +3073,14 @@ BATdescriptor(bat i)
}
if (incref(i, false, false) > 0) {
b = BBP_cache(i);
-   if (b == NULL)
+   if (b == NULL) {
b = getBBPdescriptor(i);
-   } else {
-   /* if incref fails, we must return NULL */
-   b = NULL;
+   if (b == NULL) {
+   /* if loading failed, we need to
+* compensate for the incref */
+   decref(i, false, false, __func__);
+   }
+   }
}
if (lock)
MT_lock_unset((i));
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -35,7 +35,7 @@ static gdk_return log_del_bat(logger *lg
 #define LOG_CREATE 5
 #define LOG_DESTROY6
 #define LOG_SEQ7
-#define LOG_CLEAR  8 /* DEPRECATED */
+#define LOG_CLEAR  8   /* DEPRECATED */
 #define LOG_BAT_GROUP  9
 
 #ifdef NATIVE_WIN32
@@ -61,7 +61,7 @@ static const char *log_commands[] = {
"LOG_CREATE",
"LOG_DESTROY",
"LOG_SEQ",
-   "", /* LOG_CLEAR IS DEPRECATED */
+   "", /* LOG_CLEAR IS DEPRECATED */
"LOG_BAT_GROUP",
 };
 
@@ -92,9 +92,9 @@ typedef struct logformat_t {
int id;
 } logformat;
 
-typedef enum {LOG_OK, LOG_EOF, LOG_ERR} log_return;
-
-static gdk_return bm_commit(logger *lg);
+typedef enum { LOG_OK, LOG_EOF, LOG_ERR } log_return;
+
+static gdk_return bm_commit(logger *lg, uint32_t *updated, BUN maxupdated);
 static gdk_return tr_grow(trans *tr);
 
 #define log_lock(lg)   MT_lock_set(&(lg)->lock)
@@ -300,10 +300,10 @@ string_reader(logger *lg, BAT *b, lng nr
lng SZ = 0;
log_return res = LOG_OK;
 
-   for (; nr && res == LOG_OK; ) {
+   while (nr && res == LOG_OK) {
if (mnstr_readLng(lg->input_log, ) != 1)
return LOG_EOF;
-   sz = (size_t)SZ;
+   sz = (size_t) SZ;
char *buf = lg->rbuf;
if (lg->rbufsize < sz) {
if (!(buf = GDKrealloc(lg->rbuf, sz)))
@@ -321,18 +321,22 @@ string_reader(logger *lg, BAT *b, lng nr
char *strings[CHUNK_SIZE];
int cur = 0;
 
-   for(; nr>0 && res == LOG_OK && t < (buf+sz); nr--) {
+   for (; nr > 0 && res == LOG_OK && t < (buf + sz); nr--) {
strings[cur++] = t;
-   if (cur == CHUNK_SIZE && b && BUNappendmulti(b, 
strings, cur, true) != GDK_SUCCEED)
+   if (cur == CHUNK_SIZE &&
+   b &&
+   BUNappendmulti(b, strings, cur, true) != 
GDK_SUCCEED)
res = LOG_ERR;
if (cur == CHUNK_SIZE)
cur = 0;
/* find next */
-   while(*t)
+   while (*t)
t++;
t++;
}
-   if (cur && b && BUNappendmulti(b, strings, cur, true) != 
GDK_SUCCEED)
+   if (cur &&
+   b &&
+   BUNappendmulti(b, strings, cur, true) != GDK_SUCCEED)
res = LOG_ERR;
}
return res;
@@ -340,13 +344,13 @@ string_reader(logger *lg, BAT *b, lng nr
 
 
 struct offset {
-   lng os /*offset within source BAT in logfile */;
-   lng nr /*number of values to be copied*/;
-   lng od /*offset within destination BAT in database*/;
+   lng os;   /* offset within source BAT in logfile */
+   lng nr;   /* number of values to be copied */
+   lng od;   /* offset within destination BAT in database */
 };
 
 static log_return
-log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, BAT** cands)
+log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, BAT **cands)
 {
  

MonetDB: Jun2023 - Layout.

2023-08-11 Thread Sjoerd Mullender via checkin-list
Changeset: 22422db3e8fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/22422db3e8fe
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Layout.


diffs (truncated from 1141 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -35,7 +35,7 @@ static gdk_return log_del_bat(logger *lg
 #define LOG_CREATE 5
 #define LOG_DESTROY6
 #define LOG_SEQ7
-#define LOG_CLEAR  8 /* DEPRECATED */
+#define LOG_CLEAR  8   /* DEPRECATED */
 #define LOG_BAT_GROUP  9
 
 #ifdef NATIVE_WIN32
@@ -61,7 +61,7 @@ static const char *log_commands[] = {
"LOG_CREATE",
"LOG_DESTROY",
"LOG_SEQ",
-   "", /* LOG_CLEAR IS DEPRECATED */
+   "", /* LOG_CLEAR IS DEPRECATED */
"LOG_BAT_GROUP",
 };
 
@@ -92,7 +92,7 @@ typedef struct logformat_t {
int id;
 } logformat;
 
-typedef enum {LOG_OK, LOG_EOF, LOG_ERR} log_return;
+typedef enum { LOG_OK, LOG_EOF, LOG_ERR } log_return;
 
 static gdk_return bm_commit(logger *lg, uint32_t *updated, BUN maxupdated);
 static gdk_return tr_grow(trans *tr);
@@ -300,10 +300,10 @@ string_reader(logger *lg, BAT *b, lng nr
lng SZ = 0;
log_return res = LOG_OK;
 
-   for (; nr && res == LOG_OK; ) {
+   while (nr && res == LOG_OK) {
if (mnstr_readLng(lg->input_log, ) != 1)
return LOG_EOF;
-   sz = (size_t)SZ;
+   sz = (size_t) SZ;
char *buf = lg->rbuf;
if (lg->rbufsize < sz) {
if (!(buf = GDKrealloc(lg->rbuf, sz)))
@@ -321,18 +321,22 @@ string_reader(logger *lg, BAT *b, lng nr
char *strings[CHUNK_SIZE];
int cur = 0;
 
-   for(; nr>0 && res == LOG_OK && t < (buf+sz); nr--) {
+   for (; nr > 0 && res == LOG_OK && t < (buf + sz); nr--) {
strings[cur++] = t;
-   if (cur == CHUNK_SIZE && b && BUNappendmulti(b, 
strings, cur, true) != GDK_SUCCEED)
+   if (cur == CHUNK_SIZE &&
+   b &&
+   BUNappendmulti(b, strings, cur, true) != 
GDK_SUCCEED)
res = LOG_ERR;
if (cur == CHUNK_SIZE)
cur = 0;
/* find next */
-   while(*t)
+   while (*t)
t++;
t++;
}
-   if (cur && b && BUNappendmulti(b, strings, cur, true) != 
GDK_SUCCEED)
+   if (cur &&
+   b &&
+   BUNappendmulti(b, strings, cur, true) != GDK_SUCCEED)
res = LOG_ERR;
}
return res;
@@ -340,13 +344,13 @@ string_reader(logger *lg, BAT *b, lng nr
 
 
 struct offset {
-   lng os /*offset within source BAT in logfile */;
-   lng nr /*number of values to be copied*/;
-   lng od /*offset within destination BAT in database*/;
+   lng os;   /* offset within source BAT in logfile */
+   lng nr;   /* number of values to be copied */
+   lng od;   /* offset within destination BAT in database */
 };
 
 static log_return
-log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, BAT** cands)
+log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, BAT **cands)
 {
log_return res = LOG_OK;
lng nr, pnr;
@@ -365,12 +369,12 @@ log_read_updates(logger *lg, trans *tr, 
if (tpe >= 0) {
BAT *uid = NULL;
BAT *r = NULL;
-   void *(*rt) (ptr, size_t *, stream *, size_t) = 
BATatoms[tpe].atomRead;
+   void *(*rt)(ptr, size_t *, stream *, size_t) = 
BATatoms[tpe].atomRead;
lng offset;
 
assert(nr <= (lng) BUN_MAX);
if (!lg->flushing && l->flag == LOG_UPDATE) {
-   uid = COLnew(0, TYPE_oid, (BUN)nr, PERSISTENT);
+   uid = COLnew(0, TYPE_oid, (BUN) nr, PERSISTENT);
if (uid == NULL) {
return LOG_ERR;
}
@@ -387,20 +391,17 @@ log_read_updates(logger *lg, trans *tr, 
assert((*cands)->ttype == TYPE_void);
BATtseqbase(*cands, (oid) offset);
BATsetcount(*cands, (BUN) nr);
-   }
-   else if (!lg->flushing) {
+   } else if (!lg->flushing) {
assert(BATcount(*cands) > 0);
-   BAT* dense = BATdense(0, (oid) offset, 
(BUN) nr);
-   BAT* newcands = NULL;
-   if 

MonetDB: Jun2023 - Try not to subcommit every bat in the catalog...

2023-08-11 Thread Sjoerd Mullender via checkin-list
Changeset: fb5c89b34e10 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fb5c89b34e10
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Try not to subcommit every bat in the catalog everytime.


diffs (truncated from 319 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -94,7 +94,7 @@ typedef struct logformat_t {
 
 typedef enum {LOG_OK, LOG_EOF, LOG_ERR} log_return;
 
-static gdk_return bm_commit(logger *lg);
+static gdk_return bm_commit(logger *lg, uint32_t *updated, BUN maxupdated);
 static gdk_return tr_grow(trans *tr);
 
 #define log_lock(lg)   MT_lock_set(&(lg)->lock)
@@ -1149,7 +1149,7 @@ log_open_input(logger *lg, const char *f
 }
 
 static log_return
-log_read_transaction(logger *lg)
+log_read_transaction(logger *lg, uint32_t *updated, BUN maxupdated)
 {
logformat l;
trans *tr = NULL;
@@ -1176,6 +1176,30 @@ log_read_transaction(logger *lg)
else
TRC_DEBUG_ENDIF(WAL, "%d %d", l.flag, l.id);
}
+   switch (l.flag) {
+   case LOG_UPDATE_CONST:
+   case LOG_UPDATE_BULK:
+   case LOG_UPDATE:
+   case LOG_CREATE:
+   case LOG_DESTROY:
+   if (updated &&
+   BAThash(lg->catalog_id) == GDK_SUCCEED) {
+   BATiter cni = bat_iterator(lg->catalog_id);
+   BUN p;
+   MT_rwlock_rdlock(>thashlock);
+   HASHloop_int(cni, cni.b->thash, p, ) {
+   assert(p < maxupdated);
+   updated[p / 32] |= 1U << (p % 32);
+   /* there should only be one hit */
+   break;
+   }
+   MT_rwlock_rdunlock(>thashlock);
+   bat_iterator_end();
+   }
+   break;
+   default:
+   /* do nothing */
+   }
/* the functions we call here can succeed (LOG_OK),
 * but they can also fail for two different reasons:
 * they can run out of input (LOG_EOF -- this is not
@@ -1307,7 +1331,7 @@ log_readlog(logger *lg, const char *file
}
}
}
-   err = log_read_transaction(lg);
+   err = log_read_transaction(lg, NULL, 0);
}
log_close_input(lg);
lg->input_log = NULL;
@@ -1356,11 +1380,11 @@ log_readlogs(logger *lg, const char *fil
 }
 
 static gdk_return
-log_commit(logger *lg)
+log_commit(logger *lg, uint32_t *updated, BUN maxupdated)
 {
TRC_DEBUG(WAL, "commit");
 
-   return bm_commit(lg);
+   return bm_commit(lg, updated, maxupdated);
 }
 
 static gdk_return
@@ -1509,7 +1533,7 @@ subcommit_list_add(int next, bat *n, BUN
 }
 
 static int
-cleanup_and_swap(logger *lg, int *r, const log_bid *bids, lng *lids, lng 
*cnts, BAT *catalog_bid, BAT *catalog_id, BAT *dcatalog, BUN cleanup)
+cleanup_and_swap(logger *lg, int *r, const log_bid *bids, lng *lids, lng 
*cnts, BAT *catalog_bid, BAT *catalog_id, BAT *dcatalog, BUN cleanup, uint32_t 
*updated, BUN maxupdated)
 {
BAT *nbids, *noids, *ncnts, *nlids, *ndels;
BUN p, q;
@@ -1519,6 +1543,9 @@ cleanup_and_swap(logger *lg, int *r, con
BATloop(dcatalog, p, q) {
oid pos = poss[p];
 
+   if (updated && pos < maxupdated && (updated[pos / 32] & (1U << 
(pos % 32))) == 0) {
+   continue;
+   }
if (lids[pos] == lng_nil || lids[pos] > lg->saved_tid)
continue;
 
@@ -1562,7 +1589,7 @@ cleanup_and_swap(logger *lg, int *r, con
 
/* only project out the deleted with lid == -1
 * update dcatalog */
-   if (lid == -1)
+   if ((updated == NULL || p >= maxupdated || (updated[p / 32] & 
(1U << (p % 32))) != 0) && lid == -1)
continue; /* remove */
 
if (BUNappend(nbids, , false) != GDK_SUCCEED ||
@@ -1570,9 +1597,11 @@ cleanup_and_swap(logger *lg, int *r, con
BUNappend(nlids, , false) != GDK_SUCCEED ||
BUNappend(ncnts, , false) != GDK_SUCCEED)
err=1;
-   pos = (oid)(BATcount(nbids)-1);
-   if (lid != lng_nil && BUNappend(ndels, , false) != 
GDK_SUCCEED)
-   err=1;
+   if (BUNfnd(lg->dcatalog, ) != BUN_NONE) {
+   pos = (oid)(BATcount(nbids)-1);
+   if (BUNappend(ndels, , false) != GDK_SUCCEED)
+   err = 1;
+   }
}
 
if 

MonetDB: Jun2023 - Do not warn about unknown bat in production c...

2023-08-10 Thread Sjoerd Mullender via checkin-list
Changeset: f732786bbd96 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f732786bbd96
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Do not warn about unknown bat in production code.
If a SQL object (table/column) is dropped, the row is added to
sql_dcatalog and an entry is written to the WAL.  It may happen that the
dcatalog bat is written to disk but the WAL has not been rotated yet.
If the server restarts in this window, you get this now disabled
warning when the WAL is processed.  After reading the WAL, the bat is
actually deleted in the subcommit phase since that goes through the
catalog, including the deleted rows, and destroys any bats that are
associated with deleted entries.


diffs (13 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -757,7 +757,9 @@ la_bat_destroy(logger *lg, logaction *la
if (bid < 0)
return GDK_FAIL;
if (!bid) {
+#ifndef NDEBUG
GDKwarning("failed to find bid for object %d\n", la->cid);
+#endif
return GDK_SUCCEED;
}
if (bid && log_del_bat(lg, bid) != GDK_SUCCEED)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - If loading the heap fails, we need to unfix.

2023-08-09 Thread Sjoerd Mullender via checkin-list
Changeset: cd7ecfec101b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cd7ecfec101b
Modified Files:
gdk/gdk_bbp.c
Branch: Jun2023
Log Message:

If loading the heap fails, we need to unfix.


diffs (22 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3078,11 +3078,14 @@ BATdescriptor(bat i)
}
if (incref(i, false, false) > 0) {
b = BBP_cache(i);
-   if (b == NULL)
+   if (b == NULL) {
b = getBBPdescriptor(i);
-   } else {
-   /* if incref fails, we must return NULL */
-   b = NULL;
+   if (b == NULL) {
+   /* if loading failed, we need to
+* compensate for the incref */
+   decref(i, false, false, __func__);
+   }
+   }
}
if (lock)
MT_lock_unset((i));
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-08 Thread Sjoerd Mullender via checkin-list
Changeset: 2add8edb72d1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2add8edb72d1
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_heap.c
gdk/gdk_storage.c
gdk/gdk_strimps.c
gdk/gdk_utils.c
gdk/gdk_utils.h
sql/server/rel_select.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 1330 to 300 lines):

diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c
--- a/clients/odbc/driver/SQLTables.c
+++ b/clients/odbc/driver/SQLTables.c
@@ -234,7 +234,7 @@ MNDBTables(ODBCStmt *stmt,
strcpy(buf, "LOCAL TEMPORARY 
TABLE");
}
pos += snprintf(query + pos, querylen - 
pos, "'%s',", buf);
-   j = 0;
+   j = 0;
} else if (j < sizeof(buf) &&
   TableType[i] != '\'' &&
   (TableType[i] != ' ' ||
diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -114,7 +114,7 @@ nameofSQLtype(SQLSMALLINT dataType)
case SQL_REAL:  return "REAL";
case SQL_FLOAT: return "FLOAT";
case SQL_DOUBLE:return "DOUBLE";
-   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
+   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
case SQL_TINYINT:   return "TINYINT";
case SQL_BIGINT:return "BIGINT";
case SQL_BINARY:return "BINARY";
@@ -125,7 +125,7 @@ nameofSQLtype(SQLSMALLINT dataType)
case SQL_TYPE_TIME: return "TIME";
case SQL_TYPE_TIMESTAMP:return "TIMESTAMP";
case SQL_INTERVAL_MONTH:return "INTERVAL MONTH";
-   case SQL_INTERVAL_YEAR: return "INTERVAL YEAR";
+   case SQL_INTERVAL_YEAR: return "INTERVAL YEAR";
case SQL_INTERVAL_YEAR_TO_MONTH: return "INTERVAL YEAR TO MONTH";
case SQL_INTERVAL_DAY:  return "INTERVAL DAY";
case SQL_INTERVAL_HOUR: return "INTERVAL HOUR";
diff --git a/ctest/monetdb5/mal/test_malEmbeddedBoot.c 
b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
--- a/ctest/monetdb5/mal/test_malEmbeddedBoot.c
+++ b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
@@ -21,7 +21,7 @@ main(void)
if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
/* set in memory dbfarm */
createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
-   return 1;
+   return 1;
}
 
 gdk_res = GDKinit(NULL, 0, true, NULL);
diff --git a/ctest/monetdb5/mal/test_malInclude.c 
b/ctest/monetdb5/mal/test_malInclude.c
--- a/ctest/monetdb5/mal/test_malInclude.c
+++ b/ctest/monetdb5/mal/test_malInclude.c
@@ -21,13 +21,13 @@ main(void)
if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
/* set in memory dbfarm */
createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
-   return 1;
+   return 1;
}
 
 gdk_res = GDKinit(NULL, 0, true, NULL);
 if (gdk_res != GDK_SUCCEED) {
createException(MAL, "embedded.monetdb_startup", "GDKinit() 
failed");
-   return 1;
+   return 1;
 }
 char *modules[2];
 modules[0] = "sql";
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -797,7 +797,7 @@ typedef struct BAT {
 batTransient:1,/* should the BAT persist on disk? */
 batCopiedtodisk:1; /* once written */
uint16_t selcnt;/* how often used in equi select without hash */
-   uint16_t unused;/* value=0 for now (sneakily used by mat.c) */
+   uint16_t unused;/* value=0 for now (sneakily used by mat.c) */
 
/* delta status administration */
BUN batInserted;/* start of inserted elements */
@@ -1644,20 +1644,20 @@ BATsettrivprop(BAT *b)
 static inline void
 BATnegateprops(BAT *b)
 {
-/* disable all properties here */
-b->tnonil = false;
-b->tnil = false;
-if (b->ttype) {
-b->tsorted = false;
-b->trevsorted = false;
-b->tnosorted = 0;
-b->tnorevsorted = 0;
-}
-b->tseqbase = oid_nil;
-b->tkey = false;
-b->tnokey[0] = 0;
-b->tnokey[1] = 0;
-b->tmaxpos = b->tminpos = BUN_NONE;
+   /* disable all properties here */
+   b->tnonil = false;
+   b->tnil = false;
+   if (b->ttype) {
+   

MonetDB: Jun2023 - Layout changes.

2023-08-08 Thread Sjoerd Mullender via checkin-list
Changeset: 244ba4fb3dfc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/244ba4fb3dfc
Modified Files:
clients/odbc/driver/SQLTables.c
clients/odbc/tests/ODBCmetadata.c
ctest/monetdb5/mal/test_malEmbeddedBoot.c
ctest/monetdb5/mal/test_malInclude.c
gdk/gdk.h
gdk/gdk_analytic.h
gdk/gdk_analytic_bounds.c
gdk/gdk_analytic_func.c
gdk/gdk_analytic_statistics.c
gdk/gdk_atoms.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_cand.c
gdk/gdk_group.c
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_logger.c
gdk/gdk_logger_internals.h
gdk/gdk_logger_old.c
gdk/gdk_sample.c
gdk/gdk_storage.c
gdk/gdk_strimps.c
gdk/gdk_system.h
gdk/gdk_utils.c
gdk/gdk_utils.h
monetdb5/extras/rapi/rapi.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mel.h
monetdb5/modules/atoms/mtime.c
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
sql/backends/monet5/mal_backend.h
Branch: Jun2023
Log Message:

Layout changes.


diffs (truncated from 1222 to 300 lines):

diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c
--- a/clients/odbc/driver/SQLTables.c
+++ b/clients/odbc/driver/SQLTables.c
@@ -234,7 +234,7 @@ MNDBTables(ODBCStmt *stmt,
strcpy(buf, "LOCAL TEMPORARY 
TABLE");
}
pos += snprintf(query + pos, querylen - 
pos, "'%s',", buf);
-   j = 0;
+   j = 0;
} else if (j < sizeof(buf) &&
   TableType[i] != '\'' &&
   (TableType[i] != ' ' ||
diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -114,7 +114,7 @@ nameofSQLtype(SQLSMALLINT dataType)
case SQL_REAL:  return "REAL";
case SQL_FLOAT: return "FLOAT";
case SQL_DOUBLE:return "DOUBLE";
-   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
+   case SQL_BIT:   return "BOOLEAN";   /* MonetDB boolean type 
is mapped to SQL_BIT in ODBC (see msql_types[] in SQLExecute.c) */
case SQL_TINYINT:   return "TINYINT";
case SQL_BIGINT:return "BIGINT";
case SQL_BINARY:return "BINARY";
@@ -125,7 +125,7 @@ nameofSQLtype(SQLSMALLINT dataType)
case SQL_TYPE_TIME: return "TIME";
case SQL_TYPE_TIMESTAMP:return "TIMESTAMP";
case SQL_INTERVAL_MONTH:return "INTERVAL MONTH";
-   case SQL_INTERVAL_YEAR: return "INTERVAL YEAR";
+   case SQL_INTERVAL_YEAR: return "INTERVAL YEAR";
case SQL_INTERVAL_YEAR_TO_MONTH: return "INTERVAL YEAR TO MONTH";
case SQL_INTERVAL_DAY:  return "INTERVAL DAY";
case SQL_INTERVAL_HOUR: return "INTERVAL HOUR";
diff --git a/ctest/monetdb5/mal/test_malEmbeddedBoot.c 
b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
--- a/ctest/monetdb5/mal/test_malEmbeddedBoot.c
+++ b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
@@ -21,7 +21,7 @@ main(void)
if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
/* set in memory dbfarm */
createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
-   return 1;
+   return 1;
}
 
 gdk_res = GDKinit(NULL, 0, true, NULL);
diff --git a/ctest/monetdb5/mal/test_malInclude.c 
b/ctest/monetdb5/mal/test_malInclude.c
--- a/ctest/monetdb5/mal/test_malInclude.c
+++ b/ctest/monetdb5/mal/test_malInclude.c
@@ -21,13 +21,13 @@ main(void)
if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
/* set in memory dbfarm */
createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
-   return 1;
+   return 1;
}
 
 gdk_res = GDKinit(NULL, 0, true, NULL);
 if (gdk_res != GDK_SUCCEED) {
createException(MAL, "embedded.monetdb_startup", "GDKinit() 
failed");
-   return 1;
+   return 1;
 }
 char *modules[2];
 modules[0] = "sql";
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -783,7 +783,7 @@ typedef struct BAT {
 batTransient:1,/* should the BAT persist on disk? */
 batCopiedtodisk:1; /* once written */
uint16_t selcnt;/* how often used in equi select without hash */
-   uint16_t unused;/* value=0 for now (sneakily 

MonetDB: Jun2023 - Only op_groupby has an associated list.

2023-08-08 Thread Sjoerd Mullender via checkin-list
Changeset: f92a8d3dc3aa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f92a8d3dc3aa
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
sql/test/SQLancer/Tests/sqlancer17.test
Branch: Jun2023
Log Message:

Only op_groupby has an associated list.


diffs (108 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1000,7 +1000,7 @@ table_ref(sql_query *query, symbol *tabl
if (sql->emode != m_deps) {
assert(is_project(rel->op));
set_processed(rel);
-   if ((is_set(rel->op) || 
is_simple_project(rel->op) || is_groupby(rel->op)) && !list_empty(rel->r)) {
+   if (is_set(rel->op) || 
is_simple_project(rel->op) || (is_groupby(rel->op) && !list_empty(rel->r))) {
/* it's unsafe to set the projection 
names because of possible dependent sorting/grouping columns */
rel = rel_project(sql->sa, rel, 
rel_projections(sql, rel, NULL, 1, 0));
set_processed(rel);
diff --git a/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test 
b/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
--- a/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
+++ b/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
@@ -45,25 +45,27 @@ PLAN select * from r
 
 project (
 | project (
-| | crossproduct (
-| | | table("sys"."v") [ "v"."a1" UNIQUE, "v"."a2" ],
-| | | project (
-| | | | crossproduct (
-| | | | | project (
-| | | | | | select (
-| | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
-| | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "latitude") ]
-| | | | | ) [ "input_double"."a2" UNIQUE as "tmp_2"."a2" ],
-| | | | | project (
-| | | | | | select (
-| | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
-| | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "longitude") ]
-| | | | | ) [ "input_double"."a2" UNIQUE as "tmp_3"."a2" ]
-| | | | ) [  ]
-| | | ) [ "sys"."st_point"("tmp_2"."a2", "tmp_3"."a2") as "p"."a1" ]
-| | ) [  ]
-| ) [ "v"."a1" as "r"."a1", "sys"."st_distance"("v"."a2", "p"."a1") as 
"r"."prob" ]
-) [ "r"."a1", "r"."prob" ]
+| | project (
+| | | crossproduct (
+| | | | table("sys"."v") [ "v"."a1" UNIQUE, "v"."a2" ],
+| | | | project (
+| | | | | crossproduct (
+| | | | | | project (
+| | | | | | | select (
+| | | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
+| | | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "latitude") ]
+| | | | | | ) [ "input_double"."a2" UNIQUE as "tmp_2"."a2" ],
+| | | | | | project (
+| | | | | | | select (
+| | | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
+| | | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "longitude") ]
+| | | | | | ) [ "input_double"."a2" UNIQUE as "tmp_3"."a2" ]
+| | | | | ) [  ]
+| | | | ) [ "sys"."st_point"("tmp_2"."a2", "tmp_3"."a2") as "a1" ]
+| | | ) [  ]
+| | ) [ "v"."a1", "v"."a2", "a1" as "p"."a1" ]
+| ) [ "v"."a1" as "a1", "sys"."st_distance"("v"."a2", "p"."a1") as "prob" ]
+) [ "a1" as "r"."a1", "prob" as "r"."prob" ]
 
 statement ok
 rollback
diff --git a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test 
b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
--- a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
+++ b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
@@ -125,8 +125,8 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest0") [ "plantest0"."id" ]
 | | | | | | | ) [ ("plantest0"."id") >= (bigint(64) "15000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") 
NOT NULL as "v"."id_div" ]
-| | | | | ) [ "v"."id_div" NOT NULL as "t"."id_r" ]
+| | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
+| | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
 | | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ],
 | | | | group by (
 | | | | | project (
@@ -134,8 +134,8 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest1") [ "plantest1"."id" ]
 | | | | | | | ) [ ("plantest1"."id") >= (bigint(64) "15000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") 
NOT NULL as "v"."id_div" ]
-| | | | | ) [ "v"."id_div" NOT NULL as "t"."id_r" ]
+| | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "1000") 
NOT NULL as "id_div" ]
+| | | | 

MonetDB: default - Allocate Space together with Module.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: c1de96124f28 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c1de96124f28
Modified Files:
monetdb5/mal/mal_module.c
monetdb5/mal/mal_module.h
monetdb5/modules/mal/manual.c
monetdb5/optimizer/opt_macro.c
Branch: default
Log Message:

Allocate Space together with Module.
They're always both allocated, and always of the same size, so might as
well do it in one go.


diffs (212 lines):

diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -39,7 +39,7 @@ MALfcn
 findFunctionImplementation(const char *cname)
 {
for (int i = 0; i < MODULE_HASH_SIZE; i++) {
-   if (moduleIndex[i] != NULL && moduleIndex[i]->space != NULL) {
+   if (moduleIndex[i] != NULL) {
for (int j = 0; j < MAXSCOPE; j++) {
Symbol s;
if ((s = moduleIndex[i]->space[j]) != NULL) {
@@ -221,11 +221,6 @@ globalModule(const char *nme)
return NULL;
cur->name = nme;
cur->link = NULL;
-   cur->space = (Symbol *) GDKzalloc(MAXSCOPE * sizeof(Symbol));
-   if (cur->space == NULL) {
-   GDKfree(cur);
-   return NULL;
-   }
addModuleToIndex(cur);
return cur;
 }
@@ -242,12 +237,6 @@ userModule(void)
return NULL;
cur->name = putName("user");
cur->link = NULL;
-   cur->space = NULL;
-   cur->space = (Symbol *) GDKzalloc(MAXSCOPE * sizeof(Symbol));
-   if (cur->space == NULL) {
-   GDKfree(cur);
-   return NULL;
-   }
return cur;
 }
 
@@ -276,8 +265,6 @@ freeSubScope(Module scope)
int i;
Symbol s;
 
-   if (scope->space == NULL)
-   return;
for (i = 0; i < MAXSCOPE; i++) {
if (scope->space[i]) {
s = scope->space[i];
@@ -285,8 +272,6 @@ freeSubScope(Module scope)
freeSymbolList(s);
}
}
-   GDKfree(scope->space);
-   scope->space = 0;
 }
 
 void
@@ -340,12 +325,6 @@ insertSymbol(Module scope, Symbol prg)
scope = c;
}
t = getSymbolIndex(getFunctionId(sig));
-   if (scope->space == NULL) {
-   scope->space = (Symbol *) GDKzalloc(MAXSCOPE * sizeof(Symbol));
-   if (scope->space == NULL)
-   return;
-   }
-   assert(scope->space);
if (scope->space[t] == prg) {
/* already known, last inserted */
} else {
diff --git a/monetdb5/mal/mal_module.h b/monetdb5/mal/mal_module.h
--- a/monetdb5/mal/mal_module.h
+++ b/monetdb5/mal/mal_module.h
@@ -12,16 +12,15 @@
 #define _MAL_SCOPE_H_
 
 #include "mal.h"
-/* #define MAL_SCOPE_DEBUG  */
 
 #define MAXSCOPE 256
 
 typedef struct SCOPEDEF {
struct SCOPEDEF *link;  /* module with same index value */
const char *name;   /* index in namespace */
-   Symbol *space;  /* type dispatcher table */
int isAtomModule;   /* atom module definition ? */
str help;   /* short description of 
module functionality */
+   Symbol space[MAXSCOPE]; /* type dispatcher table */
 } *Module, ModuleRecord;
 
 mal_export Module userModule(void);
diff --git a/monetdb5/modules/mal/manual.c b/monetdb5/modules/mal/manual.c
--- a/monetdb5/modules/mal/manual.c
+++ b/monetdb5/modules/mal/manual.c
@@ -31,13 +31,10 @@ MANUALcreateOverview(Client cntxt, MalBl
bat *sx = getArgReference_bat(stk, pci, 2);
bat *ax = getArgReference_bat(stk, pci, 3);
bat *cx = getArgReference_bat(stk, pci, 4);
-   Module s;
Module *moduleList;
int length;
-   int j, k, top = 0;
-   Symbol t;
+   int top = 0;
Module list[256];
-   char buf[BUFSIZ], *tt;
 
mod = COLnew(0, TYPE_str, 0, TRANSIENT);
fcn = COLnew(0, TYPE_str, 0, TRANSIENT);
@@ -63,31 +60,30 @@ MANUALcreateOverview(Client cntxt, MalBl
}
freeModuleList(moduleList);
 
-   for (k = 0; k < top; k++) {
-   s = list[k];
-   if (s->space) {
-   for (j = 0; j < MAXSCOPE; j++) {
-   if (s->space[j]) {
-   for (t = s->space[j]; t != NULL; t = 
t->peer) {
-   if (t->def->stmt[0]->fcnname[0] 
== '#')
-   continue;
-   (void) fcnDefinition(t->def, 
getInstrPtr(t->def, 0),
-   
 buf, TRUE, buf, sizeof(buf));
-   tt = strstr(buf, "address ");
-

MonetDB: default - Merge with Jun2023 branch layout changes.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: b84e469202a2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b84e469202a2
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_embedded.c
monetdb5/mal/mal_linker.c
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_prelude.c
monetdb5/modules/mal/txtsim.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_support.c
tools/mserver/mserver5.c
Branch: default
Log Message:

Merge with Jun2023 branch layout changes.


diffs (truncated from 60339 to 300 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -12,8 +12,9 @@
 #include "monetdb_config.h"
 #include "mal.h"
 
-char   monet_cwd[FILENAME_MAX] = { 0 };
-char   monet_characteristics[4096];
+char monet_cwd[FILENAME_MAX] = { 0 };
+
+char monet_characteristics[4096];
 stream *maleventstream = 0;
 
 /* The compile time debugging flags are turned into bit masks, akin to GDK */
@@ -26,7 +27,7 @@ lng MALdebug;
 #include "mal_scenario.h"
 #include "mal_parser.h"
 #include "mal_interpreter.h"
-#include "mal_namespace.h"  /* for initNamespace() */
+#include "mal_namespace.h" /* for initNamespace() */
 #include "mal_profiler.h"
 #include "mal_client.h"
 #include "msabaoth.h"
@@ -38,10 +39,10 @@ lng MALdebug;
 #include "mal_atom.h"
 #include "mutils.h"
 
-MT_Lock mal_contextLock = MT_LOCK_INITIALIZER(mal_contextLock);
-MT_Lock mal_profileLock = MT_LOCK_INITIALIZER(mal_profileLock);
-MT_Lock mal_copyLock = MT_LOCK_INITIALIZER(mal_copyLock);
-MT_Lock mal_delayLock = MT_LOCK_INITIALIZER(mal_delayLock);
+MT_Lock mal_contextLock = MT_LOCK_INITIALIZER(mal_contextLock);
+MT_Lock mal_profileLock = MT_LOCK_INITIALIZER(mal_profileLock);
+MT_Lock mal_copyLock = MT_LOCK_INITIALIZER(mal_copyLock);
+MT_Lock mal_delayLock = MT_LOCK_INITIALIZER(mal_delayLock);
 
 
 const char *
@@ -55,7 +56,8 @@ mal_version(void)
  */
 
 int
-mal_init(char *modules[], bool embedded, const char *initpasswd, const char 
*caller_revision)
+mal_init(char *modules[], bool embedded, const char *initpasswd,
+const char *caller_revision)
 {
 /* Any error encountered here terminates the process
  * with a message sent to stderr
@@ -68,7 +70,8 @@ mal_init(char *modules[], bool embedded,
const char *version = GDKlibversion();
sscanf(version, "%d.%d.%d", , , );
if (maj != GDK_VERSION_MAJOR || min < GDK_VERSION_MINOR) {
-   TRC_CRITICAL(MAL_SERVER, "Linked GDK library not compatible 
with the one this was compiled with\n");
+   TRC_CRITICAL(MAL_SERVER,
+"Linked GDK library not compatible 
with the one this was compiled with\n");
TRC_CRITICAL(MAL_SERVER, "Linked version: %s, compiled version: 
%s\n",
 version, GDK_VERSION);
return -1;
@@ -77,7 +80,9 @@ mal_init(char *modules[], bool embedded,
if (caller_revision) {
const char *p = mercurial_revision();
if (p && strcmp(p, caller_revision) != 0) {
-   TRC_CRITICAL(MAL_SERVER, "incompatible versions: caller 
is %s, MAL is %s\n", caller_revision, p);
+   TRC_CRITICAL(MAL_SERVER,
+"incompatible versions: caller 
is %s, MAL is %s\n",
+caller_revision, p);
return -1;
}
}
@@ -87,7 +92,7 @@ mal_init(char *modules[], bool embedded,
initNamespace();
 
err = malBootstrap(modules, embedded, initpasswd);
-   if (err != MAL_SUCCEED) {
+   if (err !=MAL_SUCCEED) {
mal_client_reset();
TRC_CRITICAL(MAL_SERVER, "%s\n", err);
freeException(err);
@@ -108,7 +113,8 @@ mal_init(char *modules[], bool embedded,
  * activity first.
  * This function should be called after you have issued sql_reset();
  */
-void mal_reset(void)
+void
+mal_reset(void)
 {
GDKprepareExit();
MCstopClients(0);
@@ -118,29 +124,29 @@ void mal_reset(void)
if (!GDKinmemory(0) && !GDKembedded()) {
str err = 0;
 
-   if ((err = msab_wildRetreat()) != NULL) {
+   if ((err = msab_wildRetreat()) !=NULL) {
TRC_ERROR(MAL_SERVER, "%s\n", err);
free(err);
}
-   if ((err = msab_registerStop()) != NULL) {
+   if ((err = msab_registerStop()) !=NULL) {
TRC_ERROR(MAL_SERVER, "%s\n", err);
free(err);
}
}
mal_dataflow_reset();
mal_client_reset();
-   mal_linker_reset();
+   mal_linker_reset();
mal_resource_reset();

MonetDB: Jun2023 - Layout: ran indent on monetdb5 sources.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: ddbca66372e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ddbca66372e5
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal.h
monetdb5/mal/mal_atom.c
monetdb5/mal/mal_atom.h
monetdb5/mal/mal_authorize.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_builder.h
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_dataflow.h
monetdb5/mal/mal_embedded.c
monetdb5/mal/mal_embedded.h
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_exception.h
monetdb5/mal/mal_function.c
monetdb5/mal/mal_function.h
monetdb5/mal/mal_import.c
monetdb5/mal/mal_import.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_internal.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_interpreter.h
monetdb5/mal/mal_linker.c
monetdb5/mal/mal_linker.h
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_listing.h
monetdb5/mal/mal_module.c
monetdb5/mal/mal_module.h
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_namespace.h
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_parser.h
monetdb5/mal/mal_prelude.c
monetdb5/mal/mal_prelude.h
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_profiler.h
monetdb5/mal/mal_resolve.c
monetdb5/mal/mal_resolve.h
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_resource.h
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_runtime.h
monetdb5/mal/mal_scenario.c
monetdb5/mal/mal_session.c
monetdb5/mal/mal_session.h
monetdb5/mal/mal_stack.c
monetdb5/mal/mal_type.c
monetdb5/mal/mal_type.h
monetdb5/mal/mal_utils.c
monetdb5/mal/mel.h
monetdb5/modules/atoms/batxml.c
monetdb5/modules/atoms/blob.c
monetdb5/modules/atoms/color.c
monetdb5/modules/atoms/color.h
monetdb5/modules/atoms/identifier.c
monetdb5/modules/atoms/inet.c
monetdb5/modules/atoms/json.c
monetdb5/modules/atoms/mtime.c
monetdb5/modules/atoms/mtime.h
monetdb5/modules/atoms/str.c
monetdb5/modules/atoms/str.h
monetdb5/modules/atoms/streams.c
monetdb5/modules/atoms/strptime.c
monetdb5/modules/atoms/url.c
monetdb5/modules/atoms/utf8.h
monetdb5/modules/atoms/uuid.c
monetdb5/modules/atoms/xml.c
monetdb5/modules/kernel/aggr.c
monetdb5/modules/kernel/aggr.h
monetdb5/modules/kernel/alarm.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/bat5.h
monetdb5/modules/kernel/batcolor.c
monetdb5/modules/kernel/batmmath.c
monetdb5/modules/kernel/batstr.c
monetdb5/modules/kernel/group.c
monetdb5/modules/kernel/group.h
monetdb5/modules/kernel/microbenchmark.c
monetdb5/modules/kernel/mmath.c
monetdb5/modules/kernel/mmath_private.h
monetdb5/modules/mal/batExtensions.c
monetdb5/modules/mal/batMask.c
monetdb5/modules/mal/batcalc.c
monetdb5/modules/mal/bbp.c
monetdb5/modules/mal/calc.c
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/clients.h
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/inspect.c
monetdb5/modules/mal/iterator.c
monetdb5/modules/mal/language.c
monetdb5/modules/mal/mal_io.c
monetdb5/modules/mal/mal_mapi.c
monetdb5/modules/mal/manifold.c
monetdb5/modules/mal/manifold.h
monetdb5/modules/mal/manual.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/mdb.c
monetdb5/modules/mal/mkey.c
monetdb5/modules/mal/orderidx.c
monetdb5/modules/mal/orderidx.h
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/profiler.c
monetdb5/modules/mal/projectionpath.c
monetdb5/modules/mal/querylog.c
monetdb5/modules/mal/remote.c
monetdb5/modules/mal/remote.h
monetdb5/modules/mal/sample.c
monetdb5/modules/mal/sysmon.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/tablet.h
monetdb5/modules/mal/tokenizer.c
monetdb5/modules/mal/tracer.c
monetdb5/modules/mal/txtsim.c
monetdb5/optimizer/opt_aliases.c
monetdb5/optimizer/opt_aliases.h
monetdb5/optimizer/opt_candidates.c
monetdb5/optimizer/opt_candidates.h
monetdb5/optimizer/opt_coercion.c
monetdb5/optimizer/opt_coercion.h
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_commonTerms.h
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_constants.h
monetdb5/optimizer/opt_costModel.c
monetdb5/optimizer/opt_costModel.h

MonetDB: default - Merge with Jun2023 branch.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: da0fb863ad36 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/da0fb863ad36
Modified Files:
monetdb5/mal/mal_prelude.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 650 to 300 lines):

diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -192,13 +192,12 @@ OPTsql_appendImplementation(Client cntxt
/* use mal_builder.h primitives
 * q1 = newStmt(mb, algebraRef,sliceRef); */
q2 = newInstruction(mb,algebraRef, sliceRef);
-   if (q1 == NULL || q2 == NULL) {
+   if (q1 == NULL || q2 == NULL || (getArg(q2,0) = 
newTmpVariable(mb, TYPE_any)) < 0) {
freeInstruction(q1);
freeInstruction(q2);
i--;
break;
}
-   getArg(q2,0) = newTmpVariable(mb, TYPE_any);
q2 = pushArgument(mb, q2, getArg(p, 5));
q2 = pushLng(mb, q2, 0);
q2 = pushArgument(mb, q2, getArg(q1, 0));
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -36,10 +36,10 @@ newAssignmentArgs(MalBlkPtr mb, int args
str msg = createException(MAL, "newAssignment", "Can not 
allocate variable");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
-   } else
-   getArg(q,0) =  k;
+   }
+   getArg(q, 0) = k;
return q;
 }
 
@@ -61,16 +61,19 @@ newStmtArgs(MalBlkPtr mb, const char *mo
InstrPtr q;
const char *mName = putName(module), *nName = putName(name);
 
+   if (mName == NULL || nName == NULL)
+   return NULL;
+
q = newInstructionArgs(mb, mName, nName, args);
if (q == NULL)
return NULL;
 
setDestVar(q, newTmpVariable(mb, TYPE_any));
-   if (getDestVar(q) < 0 || mb->errors != MAL_SUCCEED) {
+   if (getDestVar(q) < 0) {
str msg = createException(MAL, "newStmtArgs", "Can not allocate 
variable");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
}
return q;
@@ -79,33 +82,25 @@ newStmtArgs(MalBlkPtr mb, const char *mo
 InstrPtr
 newReturnStmt(MalBlkPtr mb)
 {
-   InstrPtr q = newInstruction(mb, NULL, NULL);
-   int k;
+   InstrPtr q = newAssignment(mb);
 
-   if (q == NULL)
-   return NULL;
-   k = newTmpVariable(mb,TYPE_any);
-   if (k < 0 ){
-   str msg = createException(MAL, "newReturnStmt", "Can not 
allocate return variable");
-   addMalException(mb, msg);
-   freeException(msg);
-   GDKfree(q);
-   return NULL;
-   } else
-   getArg(q,0) = k;
-   q->barrier= RETURNsymbol;
+   if (q != NULL)
+   q->barrier = RETURNsymbol;
return q;
 }
 
 InstrPtr
 newFcnCallArgs(MalBlkPtr mb, const char *mod, const char *fcn, int args)
 {
+   const char *fcnName, *modName;
+   modName = putName(mod);
+   fcnName = putName(fcn);
+   if (modName == NULL || fcnName == NULL)
+   return NULL;
+
InstrPtr q = newAssignmentArgs(mb, args);
-   const char *fcnName, *modName;
 
if (q != NULL) {
-   modName = putName(mod);
-   fcnName = putName(fcn);
setModuleId(q, modName);
setFunctionId(q, fcnName);
}
@@ -133,18 +128,17 @@ newComment(MalBlkPtr mb, const char *val
str msg = createException(MAL, "newComment", "Can not allocate 
comment");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
-   } else {
-   k = defConstant(mb, TYPE_str, );
-   if (k < 0) {
-   GDKfree(q);
-   return NULL;
-   }
-   getArg(q,0) = k;
-   clrVarConstant(mb,getArg(q,0));
-   setVarDisabled(mb,getArg(q,0));
}
+   k = defConstant(mb, TYPE_str, );
+   if (k < 0) {
+   freeInstruction(q);
+   return NULL;
+   }
+   getArg(q, 0) = k;
+   clrVarConstant(mb, getArg(q, 0));
+   

MonetDB: Jun2023 - Clear arguments.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: c31cad44d36d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c31cad44d36d
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: Jun2023
Log Message:

Clear arguments.


diffs (11 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -474,6 +474,7 @@ newInstructionArgs(MalBlkPtr mb, const c
 * with modifier */
.token = ASSIGNsymbol,
};
+   memset(p->argv, 0, args * sizeof(p->argv[0]));
p->argv[0] = -1;
return p;
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Some code improvements.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: 86f2941b27f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/86f2941b27f9
Modified Files:
monetdb5/extras/mal_optimizer_template/opt_sql_append.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_exception.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_prelude.c
Branch: Jun2023
Log Message:

Some code improvements.


diffs (truncated from 501 to 300 lines):

diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -192,13 +192,12 @@ OPTsql_appendImplementation(Client cntxt
/* use mal_builder.h primitives
 * q1 = newStmt(mb, algebraRef,sliceRef); */
q2 = newInstruction(mb,algebraRef, sliceRef);
-   if (q1 == NULL || q2 == NULL) {
+   if (q1 == NULL || q2 == NULL || (getArg(q2,0) = 
newTmpVariable(mb, TYPE_any)) < 0) {
freeInstruction(q1);
freeInstruction(q2);
i--;
break;
}
-   getArg(q2,0) = newTmpVariable(mb, TYPE_any);
q2 = pushArgument(mb, q2, getArg(p, 5));
q2 = pushLng(mb, q2, 0);
q2 = pushArgument(mb, q2, getArg(q1, 0));
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -36,10 +36,10 @@ newAssignmentArgs(MalBlkPtr mb, int args
str msg = createException(MAL, "newAssignment", "Can not 
allocate variable");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
-   } else
-   getArg(q,0) =  k;
+   }
+   getArg(q, 0) = k;
return q;
 }
 
@@ -61,16 +61,19 @@ newStmtArgs(MalBlkPtr mb, const char *mo
InstrPtr q;
const char *mName = putName(module), *nName = putName(name);
 
+   if (mName == NULL || nName == NULL)
+   return NULL;
+
q = newInstructionArgs(mb, mName, nName, args);
if (q == NULL)
return NULL;
 
setDestVar(q, newTmpVariable(mb, TYPE_any));
-   if (getDestVar(q) < 0 || mb->errors != MAL_SUCCEED) {
+   if (getDestVar(q) < 0) {
str msg = createException(MAL, "newStmtArgs", "Can not allocate 
variable");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
}
return q;
@@ -79,33 +82,25 @@ newStmtArgs(MalBlkPtr mb, const char *mo
 InstrPtr
 newReturnStmt(MalBlkPtr mb)
 {
-   InstrPtr q = newInstruction(mb, NULL, NULL);
-   int k;
+   InstrPtr q = newAssignment(mb);
 
-   if (q == NULL)
-   return NULL;
-   k = newTmpVariable(mb,TYPE_any);
-   if (k < 0 ){
-   str msg = createException(MAL, "newReturnStmt", "Can not 
allocate return variable");
-   addMalException(mb, msg);
-   freeException(msg);
-   GDKfree(q);
-   return NULL;
-   } else
-   getArg(q,0) = k;
-   q->barrier= RETURNsymbol;
+   if (q != NULL)
+   q->barrier = RETURNsymbol;
return q;
 }
 
 InstrPtr
 newFcnCallArgs(MalBlkPtr mb, const char *mod, const char *fcn, int args)
 {
+   const char *fcnName, *modName;
+   modName = putName(mod);
+   fcnName = putName(fcn);
+   if (modName == NULL || fcnName == NULL)
+   return NULL;
+
InstrPtr q = newAssignmentArgs(mb, args);
-   const char *fcnName, *modName;
 
if (q != NULL) {
-   modName = putName(mod);
-   fcnName = putName(fcn);
setModuleId(q, modName);
setFunctionId(q, fcnName);
}
@@ -133,18 +128,17 @@ newComment(MalBlkPtr mb, const char *val
str msg = createException(MAL, "newComment", "Can not allocate 
comment");
addMalException(mb, msg);
freeException(msg);
-   GDKfree(q);
+   freeInstruction(q);
return NULL;
-   } else {
-   k = defConstant(mb, TYPE_str, );
-   if (k < 0) {
-   GDKfree(q);
-   return NULL;
-   }
-   getArg(q,0) = k;
-   clrVarConstant(mb,getArg(q,0));
-   setVarDisabled(mb,getArg(q,0));
}
+   k 

MonetDB: Jun2023 - Remove experimental and commented out code.

2023-08-07 Thread Sjoerd Mullender via checkin-list
Changeset: b27a4f95a033 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b27a4f95a033
Modified Files:
monetdb5/optimizer/opt_projectionpath.c
Branch: Jun2023
Log Message:

Remove experimental and commented out code.


diffs (159 lines):

diff --git a/monetdb5/optimizer/opt_projectionpath.c 
b/monetdb5/optimizer/opt_projectionpath.c
--- a/monetdb5/optimizer/opt_projectionpath.c
+++ b/monetdb5/optimizer/opt_projectionpath.c
@@ -15,132 +15,6 @@
 #include "opt_deadcode.h"
 #include "opt_projectionpath.h"
 
-
-// Common prefix reduction was not effective it is retained for
-// future experiments.
-//#define ELIMCOMMONPREFIX
-
-#ifdef ELIMCOMMONPREFIX
-static int
-OPTprojectionPrefix(Client cntxt, MalBlkPtr mb)
-{
-   int i, j, k, maxmatch, actions=0;
-   InstrPtr p,q,*old = NULL;
-   int limit, slimit;
-   InstrPtr *paths = NULL;
-   int *alias = NULL;
-
-   (void) cntxt;
-   limit = mb->stop;
-   slimit= mb->ssize;
-
-   paths = (InstrPtr *) GDKzalloc(mb->vsize * sizeof(InstrPtr));
-   if (paths == NULL)
-   return 0;
-   alias = (int*) GDKzalloc(mb->vsize * sizeof(int));
-   if( alias == NULL){
-   GDKfree(paths);
-   return 0;
-   }
-
-   maxmatch = 0; // to collect maximum common paths
-   old = mb->stmt;
-   /* Collect the projection paths achored at the same start */
-   for( i=0; i< limit; i++){
-   p = old[i];
-   if ( getFunctionId(p) == projectionpathRef && p->argc > 3){
-   k = getArg(p,1);
-   if( paths[k] == 0)
-   paths[k] = p;
-   q = paths[k];
-   // Calculate the number of almost identical paths
-   if( q->argc == p->argc){
-   for(j = q->retc; jargc - 1; j++)
-   if( getArg(p,j) != getArg(q,j))
-   break;
-   if( j == q->argc -1 ){
-   alias[k] = alias[k] -1;
-   if (alias[k] < maxmatch)
-   maxmatch = alias[k];
-   }
-   }
-   }
-   }
-   if (maxmatch == -1){
-   GDKfree(alias);
-   GDKfree(paths);
-   return 0;
-   }
-
-   if (newMalBlkStmt(mb,mb->ssize) < 0){
-   GDKfree(paths);
-   GDKfree(alias);
-   return 0;
-   }
-
-
-   for( i = 0; i < limit; i++){
-   p = old[i];
-   if ( getFunctionId(p) != projectionpathRef ){
-   pushInstruction(mb,p);
-   continue;
-   }
-   if( p->argc < 3){
-   pushInstruction(mb,p);
-   continue;
-   }
-
-   actions++;
-   // the first one should be split if there is interest
-   k = getArg(p,1);
-   q = paths[k];
-   if( alias[k] < 0){
-   // inject the join prefix calculation
-   q= copyInstruction(q);
-   q->argc = q->argc -1;
-   getArg(q,0) = newTmpVariable(mb, getArgType(mb,q, 
q->argc -1));
-   pushInstruction(mb, q);
-   alias[k] = getArg(q,0);
-   q = copyInstruction(p);
-   getArg(q,1) = alias[k];
-   getArg(q,2) = getArg(q, q->argc -1);
-   q->argc = 3;
-   pushInstruction(mb,q);
-   continue;
-   }
-   // check if we can replace the projectionpath with an alias
-   k = getArg(p,1);
-   q = paths[k];
-   if( alias[k] >  0 && q->argc == p->argc){
-   for(j = q->retc; jargc - 1; j++)
-   if( getArg(p,j) != getArg(q,j))
-   break;
-   if( j == q->argc - 1){
-   // we found a common prefix, and it is the 
first one?
-   getArg(p,1) = alias[k];
-   getArg(p,2) = getArg(p, p->argc -1);
-   p->argc = 3;
-   pushInstruction(mb,p);
-   }
-   } else {
-   pushInstruction(mb,p);
-   continue;
-   }
-
-   }
-
-   for(; ifdout, mb, 0, LIST_MAL_ALL);
-   return actions;
-}
-#endif
-
 str
 OPTprojectionpathImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
@@ -280,19 +154,9 @@ OPTprojectionpathImplementation(Client c
if(old[i])
  

MonetDB: Jun2023 - Server exiting is not an error.

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: 52468ef1516e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/52468ef1516e
Modified Files:
gdk/gdk_tracer.c
monetdb5/mal/mal_exception.c
Branch: Jun2023
Log Message:

Server exiting is not an error.


diffs (50 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -513,6 +513,7 @@ GDKtracer_log(const char *file, const ch
va_list va;
char ts[TS_SIZE];
char *msg = NULL;
+   bool isexit;
static char file_prefix[] = __FILE__;
static size_t prefix_length = (size_t) -1;
 
@@ -550,6 +551,7 @@ GDKtracer_log(const char *file, const ch
  sizeof(buffer) - bytes_written,
  fmt, va);
}
+   isexit = strstr(msg, EXITING_MSG) != NULL;
va_end(va);
if (bytes_written < 0) {
if ((adapter_t) ATOMIC_GET(_adapter) != MBEDDED)
@@ -567,7 +569,8 @@ GDKtracer_log(const char *file, const ch
size_t n = strlen(buf);
snprintf(buf + n, GDKMAXERRLEN - n,
 "%s%s: %s%s%s\n",
-GDKERROR, func, msg,
+isexit ? "" : GDKERROR,
+func, msg,
 syserr ? ": " : "",
 syserr ? syserr : "");
}
@@ -582,7 +585,7 @@ GDKtracer_log(const char *file, const ch
reinit();
 
if (level <= M_WARNING || (ATOMIC_GET() & FORCEMITOMASK)) {
-   fprintf(level <= M_ERROR ? stderr : stdout,
+   fprintf(level <= M_ERROR && !isexit ? stderr : stdout,
"#%s%s%s: %s: %s: %s%s%s\n",
add_ts ? ts : "",
add_ts ? ": " : "",
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -159,7 +159,7 @@ createException(enum malexception type, 
ret = createException(type, fcn, "%s", q + 2);
}
if (ret == NULL)
-   ret = createException(type, fcn, "GDK reported error: 
%s", p);
+   ret = createException(type, fcn, "GDK reported%s: %s", 
strstr(p, EXITING_MSG) == NULL ? " error" : "", p);
GDKclrerr();
assert(ret);
return ret;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Added test for bug in older versions.

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: bef7876f1d6e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bef7876f1d6e
Added Files:
sql/test/bugs/Tests/delete-or-not-in-bug.test
Modified Files:
sql/test/bugs/Tests/All
Branch: Jun2023
Log Message:

Added test for bug in older versions.


diffs (63 lines):

diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -115,3 +115,4 @@ rtrim_bug
 savepoint-release
 procedure-recompile
 rse_bug
+delete-or-not-in-bug
diff --git a/sql/test/bugs/Tests/delete-or-not-in-bug.test 
b/sql/test/bugs/Tests/delete-or-not-in-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/delete-or-not-in-bug.test
@@ -0,0 +1,50 @@
+statement ok
+CREATE TABLE "sys"."foo" (
+"id"  INTEGER   NOT NULL,
+"cid" INTEGER,
+"ak"  INTEGER,
+"bk"  INTEGER,
+CONSTRAINT "foo_id_unique" UNIQUE ("id")
+);
+
+statement ok
+CREATE TABLE "sys"."bar" (
+"cid" INTEGER,
+"akr" INTEGER,
+"bkr" INTEGER
+);
+
+statement ok
+INSERT INTO foo VALUES (1, 9, 10, 12), (2, 9, 11, 13), (3, 10, 20, 25), (4, 
10, 452, 435), (5, 9, 130, 140);
+
+statement ok
+INSERT INTO bar VALUES (9, 120, 180), (3, 111, 134), (5, 183, 154), (9, 142, 
182), (9, 102, 134);
+
+query  
+select * FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid 
= 9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9)));
+
+1
+9
+10
+12
+2
+9
+11
+13
+5
+9
+130
+140
+
+statement ok
+DELETE FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid = 
9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9)));
+
+query  
+select * FROM foo WHERE cid = 9 AND ((ak NOT IN (SELECT akr FROM bar WHERE cid 
= 9)) OR (bk NOT IN (SELECT bkr FROM bar WHERE cid = 9)));
+
+
+statement ok
+drop table foo;
+
+statement ok
+drop table bar;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Unexport functions getBBPlogno and getBBPtran...

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: c36a76cae346 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c36a76cae346
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_bbp.c
gdk/gdk_bbp.h
gdk/gdk_private.h
Branch: default
Log Message:

Unexport functions getBBPlogno and getBBPtransid.


diffs (51 lines):

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
@@ -522,9 +522,7 @@ ssize_t fltToStr(str *dst, size_t *len, 
 const flt flt_nil;
 gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int argc, void 
*argv[], int interval);
 gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
-lng getBBPlogno(void);
 bat getBBPsize(void);
-lng getBBPtransid(void);
 char *get_bin_path(void);
 int gettimeofday(struct timeval *tv, int *ignore_zone);
 struct tm *gmtime_r(const time_t *restrict, struct tm *restrict);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -130,7 +130,7 @@ static gdk_return BBPdir_init(void);
 static void BBPcallbacks(void);
 
 /* two lngs of extra info in BBP.dir */
-/* these two need to be atomic because of their use in AUTHcommit() */
+/* these two are atomic because of their use in log_new() */
 static ATOMIC_TYPE BBPlogno = ATOMIC_VAR_INIT(0);
 static ATOMIC_TYPE BBPtransid = ATOMIC_VAR_INIT(0);
 
diff --git a/gdk/gdk_bbp.h b/gdk/gdk_bbp.h
--- a/gdk/gdk_bbp.h
+++ b/gdk/gdk_bbp.h
@@ -59,8 +59,6 @@
 #define BBPTRIM_ALL(((size_t)1) << (sizeof(size_t)*8 - 2)) /* very large 
positive size_t */
 
 gdk_export bat getBBPsize(void); /* current occupied size of BBP array */
-gdk_export lng getBBPlogno(void); /* two lng of extra info in BBP.dir */
-gdk_export lng getBBPtransid(void);
 gdk_export unsigned BBPheader(FILE *fp, int *lineno, bat *bbpsize, lng *logno, 
lng *transid);
 gdk_export int BBPreadBBPline(FILE *fp, unsigned bbpversion, int *lineno, BAT 
*bn,
 #ifdef GDKLIBRARY_HASHASH
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -184,6 +184,10 @@ gdk_return GDKunlink(int farmid, const c
 #define GDKwarning(format, ...)\
GDKtracer_log(__FILE__, __func__, __LINE__, M_WARNING,  \
  GDK, NULL, format, ##__VA_ARGS__)
+lng getBBPlogno(void)
+   __attribute__((__visibility__("hidden")));
+lng getBBPtransid(void)
+   __attribute__((__visibility__("hidden")));
 BUN HASHappend(BAT *b, BUN i, const void *v)
__attribute__((__visibility__("hidden")));
 void HASHappend_locked(BAT *b, BUN i, const void *v)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: 3cb408452974 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3cb408452974
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 1001 to 300 lines):

diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -207,6 +207,10 @@ TMsubcommit_list(bat *restrict subcommit
}
/* lock just prevents other global (sub-)commits */
BBPtmlock();
+   if (logno < 0)
+   logno = getBBPlogno();
+   if (transid < 0)
+   transid = getBBPtransid();
if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /* 
write BBP.dir (++) */
epilogue(cnt, subcommit, false);
ret = GDK_SUCCEED;
@@ -239,7 +243,7 @@ TMsubcommit(BAT *b)
}
bat_iterator_end();
 
-   ret = TMsubcommit_list(subcommit, NULL, cnt, getBBPlogno(), 
getBBPtransid());
+   ret = TMsubcommit_list(subcommit, NULL, cnt, -1, -1);
GDKfree(subcommit);
return ret;
 }
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -456,17 +456,7 @@ newInstructionArgs(MalBlkPtr mb, const c
 
p = GDKzalloc(args * sizeof(p->argv[0]) + offsetof(InstrRecord, argv));
if (p == NULL) {
-#if 0
-   /* We are facing an hard problem.
-* The upper layers of the code base assume that this routine 
will always produce a structure.
-* Furthermore, failure to allocate such a small data structure 
indicates we are in serious trouble.
-* The only way out is declare it a fatal error, terminate the 
system to avoid crashes in all kind of places.
-*/
-   GDKfatal(SQLSTATE(HY013) MAL_MALLOC_FAIL);
-   exit(1);
-#else
return NULL;
-#endif
}
p->maxarg = args;
p->typechk = TYPE_UNKNOWN;
diff --git a/monetdb5/modules/mal/querylog.c b/monetdb5/modules/mal/querylog.c
--- a/monetdb5/modules/mal/querylog.c
+++ b/monetdb5/modules/mal/querylog.c
@@ -256,7 +256,7 @@ static str
}
 
QLOG_init = true;
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
throw(MAL, "querylog.init", GDK_EXCEPTION);
return MAL_SUCCEED;
 }
@@ -344,7 +344,7 @@ QLOGempty(void *ret)
BATclear(QLOG_calls_cpuload,true);
BATclear(QLOG_calls_iowait,true);
 
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog.empty", GDK_EXCEPTION);
MT_lock_unset();
return MAL_SUCCEED;
@@ -384,7 +384,7 @@ QLOGappend(Client cntxt, MalBlkPtr mb, M
throw(MAL, "querylog.append", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
}
}
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog", GDK_EXCEPTION);
MT_lock_unset();
return msg;
@@ -446,7 +446,7 @@ QLOGcall(Client cntxt, MalBlkPtr mb, Mal
MT_lock_unset();
throw(MAL, "querylog.call", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog", GDK_EXCEPTION);
MT_lock_unset();
return msg;
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2399,6 +2399,10 @@ rel2bin_table(backend *be, sql_rel *rel,
q = pushStr(be->mb, q, mod);
q = pushStr(be->mb, q, fcn);
psub = stmt_direct_func(be, q);
+   if (psub == NULL) {
+   freeInstruction(q);
+   return NULL;
+   }
 
if (ids) /* push input rowids column */
q = pushArgument(be->mb, q, 
ids->nr);
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ 

MonetDB: Jun2023 - Remove dead code.

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: b6b3e4d220a3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b6b3e4d220a3
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: Jun2023
Log Message:

Remove dead code.


diffs (21 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -456,17 +456,7 @@ newInstructionArgs(MalBlkPtr mb, const c
 
p = GDKzalloc(args * sizeof(p->argv[0]) + offsetof(InstrRecord, argv));
if (p == NULL) {
-#if 0
-   /* We are facing an hard problem.
-* The upper layers of the code base assume that this routine 
will always produce a structure.
-* Furthermore, failure to allocate such a small data structure 
indicates we are in serious trouble.
-* The only way out is declare it a fatal error, terminate the 
system to avoid crashes in all kind of places.
-*/
-   GDKfatal(SQLSTATE(HY013) MAL_MALLOC_FAIL);
-   exit(1);
-#else
return NULL;
-#endif
}
p->maxarg = args;
p->typechk = TYPE_UNKNOWN;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Delay getting logno and transid until we have...

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: 4c207416995f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4c207416995f
Modified Files:
gdk/gdk_tm.c
monetdb5/modules/mal/querylog.c
sql/backends/monet5/sql_upgrades.c
Branch: Jun2023
Log Message:

Delay getting logno and transid until we have a lock.


diffs (83 lines):

diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -207,6 +207,10 @@ TMsubcommit_list(bat *restrict subcommit
}
/* lock just prevents other global (sub-)commits */
BBPtmlock();
+   if (logno < 0)
+   logno = getBBPlogno();
+   if (transid < 0)
+   transid = getBBPtransid();
if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /* 
write BBP.dir (++) */
epilogue(cnt, subcommit, false);
ret = GDK_SUCCEED;
@@ -239,7 +243,7 @@ TMsubcommit(BAT *b)
}
bat_iterator_end();
 
-   ret = TMsubcommit_list(subcommit, NULL, cnt, getBBPlogno(), 
getBBPtransid());
+   ret = TMsubcommit_list(subcommit, NULL, cnt, -1, -1);
GDKfree(subcommit);
return ret;
 }
diff --git a/monetdb5/modules/mal/querylog.c b/monetdb5/modules/mal/querylog.c
--- a/monetdb5/modules/mal/querylog.c
+++ b/monetdb5/modules/mal/querylog.c
@@ -256,7 +256,7 @@ static str
}
 
QLOG_init = true;
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
throw(MAL, "querylog.init", GDK_EXCEPTION);
return MAL_SUCCEED;
 }
@@ -344,7 +344,7 @@ QLOGempty(void *ret)
BATclear(QLOG_calls_cpuload,true);
BATclear(QLOG_calls_iowait,true);
 
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog.empty", GDK_EXCEPTION);
MT_lock_unset();
return MAL_SUCCEED;
@@ -384,7 +384,7 @@ QLOGappend(Client cntxt, MalBlkPtr mb, M
throw(MAL, "querylog.append", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
}
}
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog", GDK_EXCEPTION);
MT_lock_unset();
return msg;
@@ -446,7 +446,7 @@ QLOGcall(Client cntxt, MalBlkPtr mb, Mal
MT_lock_unset();
throw(MAL, "querylog.call", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
-   if (TMsubcommit_list(commitlist, NULL, committop, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)
+   if (TMsubcommit_list(commitlist, NULL, committop, -1, -1) != 
GDK_SUCCEED)
msg = createException(MAL, "querylog", GDK_EXCEPTION);
MT_lock_unset();
return msg;
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -4666,7 +4666,7 @@ sql_update_sep2022(Client c, mvc *sql, s
 BBPrename(u, NULL) != 0 ||
 BBPrename(p, NULL) != 0 ||
 BBPrename(d, NULL) != 0 ||
-TMsubcommit_list(authbats, NULL, 4, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED)) {
+TMsubcommit_list(authbats, NULL, 4, -1, -1) != 
GDK_SUCCEED)) {
fprintf(stderr, "Committing removal of old 
user/password BATs failed\n");
}
BBPunfix(u->batCacheid);
@@ -5738,7 +5738,7 @@ sql_update_jun2023(Client c, mvc *sql, s
BBPrename(rt_uri, NULL) != 0 ||
BATmode(rt_deleted, true) != GDK_SUCCEED ||
BBPrename(rt_deleted, NULL) != 0 ||
-   TMsubcommit_list(rtauthbats, NULL, 6, getBBPlogno(), 
getBBPtransid()) != GDK_SUCCEED) {
+   TMsubcommit_list(rtauthbats, NULL, 6, -1, -1) != 
GDK_SUCCEED) {
fprintf(stderr, "Committing removal of old remote 
user/password BATs failed\n");
}
BBPunfix(rt_key->batCacheid);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Either push an instruction or free it. Not b...

2023-08-02 Thread Sjoerd Mullender via checkin-list
Changeset: 3f2a75979d98 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3f2a75979d98
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
Branch: Jun2023
Log Message:

Either push an instruction or free it.  Not both.


diffs (truncated from 897 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2336,6 +2336,10 @@ rel2bin_table(backend *be, sql_rel *rel,
q = pushStr(be->mb, q, mod);
q = pushStr(be->mb, q, fcn);
psub = stmt_direct_func(be, q);
+   if (psub == NULL) {
+   freeInstruction(q);
+   return NULL;
+   }
 
if (ids) /* push input rowids column */
q = pushArgument(be->mb, q, 
ids->nr);
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -215,7 +215,6 @@ stmt_group(backend *be, stmt *s, stmt *g
q = pushArgument(mb, q, s->nr);
if (grp)
q = pushArgument(mb, q, grp->nr);
-   pushInstruction(mb, q);
if (q) {
stmt *ns = stmt_create(be->mvc->sa, st_group);
if (ns == NULL) {
@@ -234,6 +233,7 @@ stmt_group(backend *be, stmt *s, stmt *g
ns->key = 0;
ns->q = q;
ns->nr = getDestVar(q);
+   pushInstruction(mb, q);
return ns;
}
return NULL;
@@ -254,7 +254,6 @@ stmt_unique(backend *be, stmt *s)
 
q = pushArgument(mb, q, s->nr);
q = pushNil(mb, q, TYPE_bat); /* candidate list */
-   pushInstruction(mb, q);
if (q) {
stmt *ns = stmt_create(be->mvc->sa, st_unique);
if (ns == NULL) {
@@ -267,6 +266,7 @@ stmt_unique(backend *be, stmt *s)
ns->key = 1;
ns->q = q;
ns->nr = getDestVar(q);
+   pushInstruction(mb, q);
return ns;
}
return NULL;
@@ -332,7 +332,6 @@ stmt_var(backend *be, const char *sname,
if (q == NULL)
return NULL;
setVarType(mb, getArg(q, 0), tt);
-   pushInstruction(mb, q);
} else if (!declare) {
char levelstr[16];
 
@@ -344,7 +343,6 @@ stmt_var(backend *be, const char *sname,
stpcpy(stpcpy(stpcpy(stpcpy(buf, "A"), levelstr), "%"), 
varname); /* mangle variable name */
q = newAssignment(mb);
q = pushArgumentId(mb, q, buf);
-   pushInstruction(mb, q);
} else {
int tt = t->type->localtype;
char levelstr[16];
@@ -363,7 +361,6 @@ stmt_var(backend *be, const char *sname,
q->argc = q->retc = 0;
q = pushArgumentId(mb, q, buf);
q = pushNil(mb, q, tt);
-   pushInstruction(mb, q);
if (q == NULL)
return NULL;
q->retc++;
@@ -383,6 +380,7 @@ stmt_var(backend *be, const char *sname,
s->key = 1;
s->q = q;
s->nr = getDestVar(q);
+   pushInstruction(mb, q);
return s;
}
return NULL;
@@ -392,7 +390,6 @@ stmt *
 stmt_vars(backend *be, const char *varname, sql_table *t, int declare, int 
level)
 {
MalBlkPtr mb = be->mb;
-   InstrPtr q = NULL;
int *l;
 
(void)varname;
@@ -401,7 +398,6 @@ stmt_vars(backend *be, const char *varna
stmt *s = stmt_create(be->mvc->sa, st_var);
 
if (s == NULL) {
-   freeInstruction(q);
return NULL;
}
 
@@ -430,7 +426,6 @@ stmt_varnr(backend *be, int nr, sql_subt
 
(void) snprintf(buf, sizeof(buf), "A%d", nr);
q = pushArgumentId(mb, q, buf);
-   pushInstruction(mb, q);
if (q) {
stmt *s = stmt_create(be->mvc->sa, st_var);
if (s == NULL) {
@@ -447,6 +442,7 @@ stmt_varnr(backend *be, int nr, sql_subt
s->key = 1;
s->q = q;
s->nr = getDestVar(q);
+   pushInstruction(mb, q);
return s;
}
return NULL;
@@ -491,7 +487,6 @@ stmt_temp(backend *be, sql_subtype *t)
return NULL;
setVarType(mb, getArg(q, 0), newBatType(tt));
q = pushType(mb, q, tt);
-   pushInstruction(mb, q);
if (q) {
stmt *s = stmt_create(be->mvc->sa, st_temp);
 
@@ 

MonetDB: Jun2023 - Don't free stream twice.

2023-07-31 Thread Sjoerd Mullender via checkin-list
Changeset: a95b0143d895 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a95b0143d895
Modified Files:
monetdb5/mal/mal_session.c
Branch: Jun2023
Log Message:

Don't free stream twice.


diffs (15 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -360,10 +360,7 @@ MSscheduleClient(str command, str challe
if ((msg = setScenario(c, lang)) != NULL) {
mnstr_printf(c->fdout, "!%s\n", msg);
mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
-   GDKfree(s);
-   exit_streams(fin, fout);
-   GDKfree(command);
-   MCcloseClient(c);
+   cleanUpScheduleClient(c, , );
return;
}
if (!GDKgetenv_isyes(mal_enableflag) &&
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Cleanup. Second arg to cleanUpScheduleClient...

2023-07-31 Thread Sjoerd Mullender via checkin-list
Changeset: 63abe918f4ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/63abe918f4ee
Modified Files:
monetdb5/mal/mal_session.c
Branch: Jun2023
Log Message:

Cleanup.  Second arg to cleanUpScheduleClient was always NULL.


diffs (64 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -181,16 +181,9 @@ static str MSserveClient(Client cntxt);
 
 
 static inline void
-cleanUpScheduleClient(Client c, Scenario s, str *command, str *err)
+cleanUpScheduleClient(Client c, str *command, str *err)
 {
if(c) {
-   if (s) {
-   str msg = NULL;
-   if((msg = s->exitClientCmd(c)) != MAL_SUCCEED) {
-   mnstr_printf(c->fdout, "!%s\n", msg);
-   freeException(msg);
-   }
-   }
MCcloseClient(c);
}
if (command) {
@@ -359,13 +352,13 @@ MSscheduleClient(str command, str challe
c->curmodule = c->usermodule = userModule();
if(c->curmodule  == NULL) {
mnstr_printf(fout, "!could not allocate 
space\n");
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
}
 
-   if ((s = setScenario(c, lang)) != NULL) {
-   mnstr_printf(c->fdout, "!%s\n", s);
+   if ((msg = setScenario(c, lang)) != NULL) {
+   mnstr_printf(c->fdout, "!%s\n", msg);
mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
GDKfree(s);
exit_streams(fin, fout);
@@ -378,14 +371,14 @@ MSscheduleClient(str command, str challe
 
mnstr_printf(fout, "!only the 'monetdb' user can use 
non-sql languages. "
   "run mserver5 with --set 
%s=yes to change this.\n", mal_enableflag);
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
}
 
if((msg = MSinitClientPrg(c, "user", "main")) != MAL_SUCCEED) {
mnstr_printf(fout, "!could not allocate space\n");
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
 
@@ -423,7 +416,7 @@ MSscheduleClient(str command, str challe
GDKfree(algo);
if (c->exitClient)
c->exitClient(c);
-   cleanUpScheduleClient(c, NULL, NULL, );
+   cleanUpScheduleClient(c, NULL, );
return;
}
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Deal with version 3.12 of the geos library.

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: 85babf396b8f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/85babf396b8f
Added Files:
geom/sql/functions/Tests/ST_Collect-3.12.test
geom/sql/functions/Tests/ST_Transform-3.12.reqtests
geom/sql/functions/Tests/ST_Transform-3.12.test
Modified Files:
geom/sql/functions/Tests/All
Branch: default
Log Message:

Deal with version 3.12 of the geos library.


diffs (271 lines):

diff --git a/geom/sql/functions/Tests/All b/geom/sql/functions/Tests/All
--- a/geom/sql/functions/Tests/All
+++ b/geom/sql/functions/Tests/All
@@ -13,7 +13,8 @@ HAVE_GEOM_VERSION>=3.12.0?ST_GeomFr
 HAVE_GEOM?dropTestWKT
 
 HAVE_GEOM?ST_MakePoint
-HAVE_GEOM?ST_Collect
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_Collect
+HAVE_GEOM_VERSION>=3.12.0?ST_Collect-3.12
 HAVE_GEOM?ST_MakeLine
 HAVE_GEOM?loadTestPolygons
 HAVE_GEOM?ST_Intersects
@@ -91,6 +92,7 @@ HAVE_GEOM?ST_MakeBox2D
 
 HAVE_GEOM?dropTestGeometries
 HAVE_GEOM?ST_DWithin2
-HAVE_GEOM?ST_Transform
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_Transform
+HAVE_GEOM_VERSION>=3.12.0?ST_Transform-3.12
 
 HAVE_GEOM?geomcasts
diff --git a/geom/sql/functions/Tests/ST_Collect-3.12.test 
b/geom/sql/functions/Tests/ST_Collect-3.12.test
new file mode 100644
--- /dev/null
+++ b/geom/sql/functions/Tests/ST_Collect-3.12.test
@@ -0,0 +1,185 @@
+# column aggregation
+
+## points
+query T rowsort
+SELECT
+ST_COLLECT(pts)
+FROM (
+VALUES
+(ST_GeomFromText('POINT(1 1)')),
+(ST_GeomFromText('POINT(2 2)'))
+) AS REL(pts)
+
+MULTIPOINT ((1 1), (2 2))
+
+## lines
+query T rowsort
+SELECT
+ST_COLLECT(lns)
+FROM (
+VALUES
+(ST_GeomFromText('LINESTRING(10 20, 30 40, 60 40, 10 20)')),
+(ST_GeomFromText('LINESTRING(10 10, 50 50)'))
+) AS REL(lns)
+
+MULTILINESTRING ((10 20, 30 40, 60 40, 10 20), (10 10, 50 50))
+
+## polygons
+query T rowsort
+SELECT
+ST_COLLECT(pgs)
+FROM (
+VALUES
+(ST_GeomFromText('POLYGON((10 10, 30 40, 50 50, 40 30, 10 10))')),
+(ST_GeomFromText('POLYGON( EMPTY )')),
+(ST_GeomFromText('POLYGON((30 30, 30 50, 50 30, 30 30))'))
+) AS REL(pgs)
+
+MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 10)), EMPTY, ((30 30, 30 50, 50 
30, 30 30)))
+
+## multi-types
+query T rowsort
+SELECT
+ST_COLLECT(pgs)
+FROM (
+VALUES
+(ST_GeomFromText('MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 10)), 
EMPTY, ((30 30, 30 50, 50 30, 30 30)))')),
+(ST_GeomFromText('MULTILINESTRING ((10 20, 30 40, 60 40, 10 20), (10 
10, 50 50))')),
+(ST_GeomFromText('POLYGON((30 30, 30 50, 50 30, 30 30))'))
+) AS REL(pgs)
+
+GEOMETRYCOLLECTION (MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 10)), 
EMPTY, ((30 30, 30 50, 50 30, 30 30))), MULTILINESTRING ((10 20, 30 40, 60 40, 
10 20), (10 10, 50 50)), POLYGON ((30 30, 30 50, 50 30, 30 30)))
+
+query T rowsort
+SELECT
+ST_COLLECT(pgs)
+FROM (
+VALUES
+(ST_GeomFromText('MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 10)), 
EMPTY, ((30 30, 30 50, 50 30, 30 30)))')),
+(ST_GeomFromText('MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 
10)))')),
+(ST_GeomFromText('MULTIPOLYGON( EMPTY )'))
+) AS REL(pgs)
+
+GEOMETRYCOLLECTION (MULTIPOLYGON (((10 10, 30 40, 50 50, 40 30, 10 10)), 
EMPTY, ((30 30, 30 50, 50 30, 30 30))), MULTIPOLYGON (((10 10, 30 40, 50 50, 40 
30, 10 10))), MULTIPOLYGON EMPTY)
+
+# per row aggregation
+
+## points-points
+query T rowsort
+SELECT
+ST_COLLECT(p1, p2) AS points
+FROM (
+VALUES
+(
+ST_GeomFromText('POINT(1 2)'),
+ST_GeomFromText('POINT(3 4)')
+),
+(
+ST_GeomFromText('POINT(10 20)'),
+ST_GeomFromText('POINT(30 40)')
+)
+) AS REL(p1, p2)
+
+MULTIPOINT ((1 2), (3 4))
+MULTIPOINT ((10 20), (30 40))
+
+## points-lines
+query T rowsort
+SELECT
+ST_COLLECT(p1, p2) AS points
+FROM (
+VALUES
+(
+ST_GeomFromText('POINT(1 2)'),
+ST_GeomFromText('LINESTRING(10 20, 30 40, 60 40, 10 20)')
+),
+(
+ST_GeomFromText('POINT(10 20)'),
+ST_GeomFromText('LINESTRING(10 10, 50 50)')
+)
+) AS REL(p1, p2)
+
+GEOMETRYCOLLECTION (POINT (1 2), LINESTRING (10 20, 30 40, 60 40, 10 20))
+GEOMETRYCOLLECTION (POINT (10 20), LINESTRING (10 10, 50 50))
+
+## points-polygons
+query T rowsort
+SELECT
+ST_COLLECT(p1, p2) AS points
+FROM (
+VALUES
+(
+ST_GeomFromText('POINT(1 2)'),
+ST_GeomFromText('POLYGON( EMPTY )')
+),
+(
+ST_GeomFromText('POINT(10 20)'),
+ST_GeomFromText('POLYGON((10 10, 30 40, 50 50, 40 30, 10 10))')
+)
+) AS REL(p1, p2)
+
+GEOMETRYCOLLECTION (POINT (1 2), POLYGON EMPTY)
+GEOMETRYCOLLECTION (POINT (10 20), POLYGON ((10 10, 30 40, 50 50, 40 30, 10 
10)))
+
+## lines-lines
+query T rowsort
+SELECT
+ST_COLLECT(p1, p2) AS points
+FROM (
+VALUES
+(
+ST_GeomFromText('LINESTRING(0 0, 30 30, 40 

MonetDB: default - Merge with Jun2023 branch.

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: 609009d02a6d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/609009d02a6d
Modified Files:
geom/sql/functions/Tests/All
sql/scripts/52_describe.sql
sql/storage/store.c
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 2569 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -225,7 +225,9 @@ log_write_format(logger *lg, logformat *
 {
assert(data->id || data->flag);
assert(!lg->inmemory);
-   if (mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
mnstr_writeInt(lg->current->output_log, data->id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
@@ -271,7 +273,9 @@ log_write_id(logger *lg, int id)
 {
assert(!lg->inmemory);
assert(id >= 0);
-   if (mnstr_writeInt(lg->current->output_log, id))
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_writeInt(lg->current->output_log, id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
return GDK_FAIL;
@@ -2373,7 +2377,12 @@ log_activate(logger *lg)
bool flush_cleanup = false;
gdk_return res = GDK_SUCCEED;
rotation_lock(lg);
-   if (!lg->flushnow && !lg->current->next && lg->current->drops > 10 
&& (ulng) ATOMIC_GET(>current->last_ts) > 0 && lg->saved_id+1 == lg->id && 
ATOMIC_GET(>current->refcount) == 1 /* no pending work on this file */) {
+   if (!lg->flushnow &&
+   !lg->current->next &&
+   lg->current->drops > 10 &&
+   (ulng) ATOMIC_GET(>current->last_ts) > 0 &&
+   lg->saved_id + 1 == lg->id &&
+   ATOMIC_GET(>current->refcount) == 1 /* no pending work on this 
file */) {
lg->id++;
/* start new file */
res = log_open_output(lg);
@@ -2521,7 +2530,9 @@ log_constant(logger *lg, int type, ptr v
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[type].atomWrite;
 
-   if (log_write_format(lg, ) != GDK_SUCCEED ||
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR ||
+   log_write_format(lg, ) != GDK_SUCCEED ||
!mnstr_writeLng(lg->current->output_log, nr) ||
mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
!mnstr_writeLng(lg->current->output_log, offset)) {
@@ -2552,6 +2563,9 @@ string_writer(logger *lg, BAT *b, lng of
 
if (!buf)
return GDK_FAIL;
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR)
+   return GDK_FAIL;
BATiter bi = bat_iterator(b);
BUN p = (BUN)offset;
for ( ; p < end; ) {
@@ -2579,7 +2593,9 @@ string_writer(logger *lg, BAT *b, lng of
sz += len;
}
}
-   if (sz && (!mnstr_writeLng(lg->current->output_log, (lng) sz) 
|| mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
+   if (sz &&
+   (!mnstr_writeLng(lg->current->output_log, (lng) sz) ||
+mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
res = GDK_FAIL;
break;
}
@@ -2609,11 +2625,17 @@ internal_log_bat(logger *lg, BAT *b, log
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[b->ttype].atomWrite;
 
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR) {
+   ok = GDK_FAIL;
+   goto bailout;
+   }
+
if (lg->total_cnt == 0) /* signals single bulk message or first part of 
bat logged in parts */
if (log_write_format(lg, ) != GDK_SUCCEED ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
-   mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?-1:offset)) { /* offset = -1 indicates bat was logged in parts */
+   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
+   mnstr_write(lg->current->output_log, , 1, 1) != 

MonetDB: Jun2023 - Backed out changeset 1129290efb9c: we don't w...

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: afcc5016977e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/afcc5016977e
Modified Files:
sql/scripts/52_describe.sql
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/sql_dump/Tests/dump.test
Branch: Jun2023
Log Message:

Backed out changeset 1129290efb9c: we don't want the necessary upgrade code.


diffs (103 lines):

diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql
--- a/sql/scripts/52_describe.sql
+++ b/sql/scripts/52_describe.sql
@@ -171,8 +171,7 @@ CREATE VIEW sys.describe_constraints AS
AND k.table_id = t.id
AND s.id = t.schema_id
AND t.system = FALSE
-   AND k.type in (0, 1)
-   ORDER BY k.name, kc.nr;
+   AND k.type in (0, 1);
 
 CREATE VIEW sys.describe_indices AS
WITH it (id, idx) AS (VALUES (0, 'INDEX'), (4, 'IMPRINTS INDEX'), (5, 
'ORDERED INDEX')) --UNIQUE INDEX wraps to INDEX.
diff --git a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test 
b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
--- a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
+++ b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
@@ -129,7 +129,7 @@ DEP_FUNC
 query TTT rowsort
 SELECT c.name, v.name, 'DEP_VIEW' from sys.columns as c, sys.tables as v, 
sys.dependencies as dep where c.id = dep.id AND v.id = dep.depend_id AND 
dep.depend_type = 5 AND v.type in (1, 11, 21, 31) order by c.name, v.name
 
-2292 values hashing to 4ee99a9b4d0f0c8db6376eb0be833f01
+2289 values hashing to e640ec7c86f357c8f9135af496fc3b2b
 
 query TTT rowsort
 SELECT c.name, k.name, 'DEP_KEY' from sys.columns as c,  sys.objects as kc, 
sys.keys as k where kc."name" = c.name AND kc.id = k.id AND k.table_id = 
c.table_id AND k.rkey = -1 order by c.name, k.name
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -482,7 +482,7 @@ select 'null in fkeys.delete_action', de
 [ "sys._tables",   "sys",  "dependency_views_on_views","create view 
sys.dependency_views_on_views as select v1.schema_id as view1_schema_id, v1.id 
as view1_id, v1.name as view1_name, v2.schema_id as view2_schema_id, v2.id as 
view2_id, v2.name as view2_name, dep.depend_type as depend_type from sys.tables 
as v1, sys.tables as v2, sys.dependencies as dep where v1.id = dep.id and v2.id 
= dep.depend_id and dep.depend_type = 5 and v1.type in (1, 11) and v2.type in 
(1, 11) order by v1.schema_id, v1.name, v2.schema_id, v2.name;","VIEW", 
true,   "COMMIT",   "WRITABLE", NULL]
 [ "sys._tables",   "sys",  "describe_column_defaults", "create view 
sys.describe_column_defaults as select s.name sch, t.name tbl, c.name col, 
c.\"default\" def from sys.schemas s, sys.tables t, sys.columns c where s.id = 
t.schema_id and t.id = c.table_id and s.name <> 'tmp' and not t.system and 
c.\"default\" is not null;",  "VIEW", true,   "COMMIT",   "WRITABLE", 
NULL]
 [ "sys._tables",   "sys",  "describe_comments","create view 
sys.describe_comments as select o.id id, o.tpe tpe, o.nme fqn, c.remark rem 
from (select id, 'SCHEMA', sys.dq(name) from sys.schemas union all select t.id, 
ifthenelse(ts.table_type_name = 'VIEW', 'VIEW', 'TABLE'), sys.fqn(s.name, 
t.name) from sys.schemas s join sys.tables t on s.id = t.schema_id join 
sys.table_types ts on t.type = ts.table_type_id where s.name <> 'tmp' union all 
select c.id, 'COLUMN', sys.fqn(s.name, t.name) || '.' || sys.dq(c.name) from 
sys.columns c, sys.tables t, sys.schemas s where c.table_id = t.id and 
t.schema_id = s.id union all select idx.id, 'INDEX', sys.fqn(s.name, idx.name) 
from sys.idxs idx, sys._tables t, sys.schemas s where idx.table_id = t.id and 
t.schema_id = s.id union all select seq.id, 'SEQUENCE', sys.fqn(s.name, 
seq.name) from sys.sequences seq, sys.schemas s where seq.schema_id = s.id 
union all select f.id, ft.function_type_keyword, qf.nme from sys.functions f, 
sys.function_types ft, sys.
 schemas s, sys.fully_qualified_functions qf where f.type = ft.function_type_id 
and f.schema_id = s.id and qf.id = f.id) as o(id, tpe, nme) join sys.comments c 
on c.id = o.id;",   "VIEW", true,   "COMMIT",   "WRITABLE", NULL
]
-[ "sys._tables",   "sys",  "describe_constraints", "create view 
sys.describe_constraints as select s.name sch, t.name tbl, kc.name col, k.name 
con, case k.type when 0 then 'PRIMARY KEY' when 1 then 'UNIQUE' end tpe from 
sys.schemas s, sys._tables t, sys.objects kc, sys.keys k where kc.id = k.id and 
k.table_id = t.id and s.id = t.schema_id and t.system = false and k.type in (0, 
1) order by k.name, kc.nr;",   "VIEW", true,   "COMMIT",   "WRITABLE",

MonetDB: Jun2023 - Deal with version 3.12 of the geos library.

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: 9476815fdb6a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9476815fdb6a
Added Files:
geom/sql/functions/Tests/ST_AsEWKT-3.12.reqtests
geom/sql/functions/Tests/ST_AsEWKT-3.12.test
geom/sql/functions/Tests/ST_AsText-3.12.reqtests
geom/sql/functions/Tests/ST_AsText-3.12.test
geom/sql/functions/Tests/ST_Boundary-3.12.reqtests
geom/sql/functions/Tests/ST_Boundary-3.12.test
geom/sql/functions/Tests/ST_Contains-3.12.reqtests
geom/sql/functions/Tests/ST_Contains-3.12.test
geom/sql/functions/Tests/ST_CoordDim-3.12.reqtests
geom/sql/functions/Tests/ST_CoordDim-3.12.test
geom/sql/functions/Tests/ST_GeomFromText-3.12.reqtests
geom/sql/functions/Tests/ST_GeomFromText-3.12.test
geom/sql/functions/Tests/ST_GeometryN-3.12.reqtests
geom/sql/functions/Tests/ST_GeometryN-3.12.test
geom/sql/functions/Tests/ST_GeometryType-3.12.reqtests
geom/sql/functions/Tests/ST_GeometryType-3.12.test
geom/sql/functions/Tests/ST_IsClosed-3.12.reqtests
geom/sql/functions/Tests/ST_IsClosed-3.12.test
geom/sql/functions/Tests/ST_IsSimple-3.12.reqtests
geom/sql/functions/Tests/ST_IsSimple-3.12.test
geom/sql/functions/Tests/ST_IsValid-3.12.reqtests
geom/sql/functions/Tests/ST_IsValid-3.12.test
geom/sql/functions/Tests/ST_MPointFromText-3.12.reqtests
geom/sql/functions/Tests/ST_MPointFromText-3.12.test
geom/sql/functions/Tests/ST_NRings-3.12.reqtests
geom/sql/functions/Tests/ST_NRings-3.12.test
geom/sql/functions/Tests/ST_NumInteriorRings-3.12.reqtests
geom/sql/functions/Tests/ST_NumInteriorRings-3.12.test
geom/sql/pg_regression/Tests/boundary-3.12.test
Modified Files:
geom/sql/functions/Tests/All
geom/sql/pg_regression/Tests/All
sql/test/testdb-previous-upgrade-chain-hge/Tests/All
sql/test/testdb-previous-upgrade-chain/Tests/All
sql/test/testdb-previous-upgrade-hge/Tests/All
sql/test/testdb-previous-upgrade/Tests/All
sql/test/testdb-upgrade-chain-hge/Tests/All
sql/test/testdb-upgrade-chain/Tests/All
sql/test/testdb-upgrade-hge/Tests/All
sql/test/testdb-upgrade/Tests/All
sql/test/testdb/Tests/All
Branch: Jun2023
Log Message:

Deal with version 3.12 of the geos library.


diffs (truncated from 2132 to 300 lines):

diff --git a/geom/sql/functions/Tests/All b/geom/sql/functions/Tests/All
--- a/geom/sql/functions/Tests/All
+++ b/geom/sql/functions/Tests/All
@@ -3,10 +3,12 @@ HAVE_GEOM?loadTestWKT
 HAVE_GEOM?ST_PointFromText
 HAVE_GEOM?ST_LineFromText
 HAVE_GEOM?ST_PolygonFromText
-HAVE_GEOM?ST_MPointFromText
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_MPointFromText
+HAVE_GEOM_VERSION>=3.12.0?ST_MPointFromText-3.12
 HAVE_GEOM?ST_MLineFromText
 HAVE_GEOM?ST_MPolygonFromText
-HAVE_GEOM?ST_GeomFromText
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_GeomFromText
+HAVE_GEOM_VERSION>=3.12.0?ST_GeomFromText-3.12
 
 HAVE_GEOM?dropTestWKT
 
@@ -15,38 +17,50 @@ HAVE_GEOM?ST_MakePoint
 HAVE_GEOM?loadTestGeometries
 
 
-HAVE_GEOM?ST_GeometryType
-HAVE_GEOM?ST_AsText
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_GeometryType
+HAVE_GEOM_VERSION>=3.12.0?ST_GeometryType-3.12
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_AsText
+HAVE_GEOM_VERSION>=3.12.0?ST_AsText-3.12
 
-HAVE_GEOM?ST_IsClosed
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_IsClosed
+HAVE_GEOM_VERSION>=3.12.0?ST_IsClosed-3.12
 HAVE_GEOM?ST_IsEmpty
-HAVE_GEOM_VERSION>=3.8?ST_IsSimple
-HAVE_GEOM?ST_IsValid
+HAVE_GEOM_VERSION>=3.8&!GEOS_VERSION>=3.12.0?ST_IsSimple
+HAVE_GEOM_VERSION>=3.8_VERSION>=3.12.0?ST_IsSimple-3.12
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_IsValid
+HAVE_GEOM_VERSION>=3.12.0?ST_IsValid-3.12
 HAVE_GEOM?ST_IsRing
 
 HAVE_GEOM?XYZ
 HAVE_GEOM?XYZMinMax
 #HAVE_GEOM?srid
-HAVE_GEOM?ST_GeometryN
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_GeometryN
+HAVE_GEOM_VERSION>=3.12.0?ST_GeometryN-3.12
 HAVE_GEOM?ST_NumGeometries
 HAVE_GEOM?ST_NumPoints
 HAVE_GEOM?ST_NPoints
 
-HAVE_GEOM?ST_NumInteriorRings
-HAVE_GEOM?ST_NRings
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_NumInteriorRings
+HAVE_GEOM_VERSION>=3.12.0?ST_NumInteriorRings-3.12
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_NRings
+HAVE_GEOM_VERSION>=3.12.0?ST_NRings-3.12
 
 #HAVE_GEOM?transform
 
-HAVE_GEOM?ST_Contains
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_Contains
+HAVE_GEOM_VERSION>=3.12.0?ST_Contains-3.12
 
 #HAVE_GEOM?equals
 
-HAVE_GEOM_VERSION>=3.11.1?ST_Boundary
+HAVE_GEOM_VERSION>=3.11.1&!GEOS_VERSION>=3.12.0?ST_Boundary
+HAVE_GEOM_VERSION>=3.11.1_VERSION>=3.12.0?ST_Boundary-3.12
 
 HAVE_GEOM?ST_Dimension
-HAVE_GEOM?ST_CoordDim
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_CoordDim
+HAVE_GEOM_VERSION>=3.12.0?ST_CoordDim-3.12
 
-HAVE_GEOM?ST_AsEWKT
+HAVE_GEOM&!GEOS_VERSION>=3.12.0?ST_AsEWKT
+HAVE_GEOM_VERSION>=3.12.0?ST_AsEWKT-3.12
 
 #HAVE_GEOM?ST_Covers #Look at ST_Covers.sql for more details on the problem
 #HAVE_GEOM?ST_CoveredBy #Look at ST_CoveredBy.sql for more details on the 
problem

MonetDB: Jun2023 - Fix negated version test.

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: 8e87d6376494 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e87d6376494
Modified Files:
testing/Mtest.py.in
Branch: Jun2023
Log Message:

Fix negated version test.


diffs (22 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2047,6 +2047,8 @@ def RunTest(env, TST, COND, oktests, len
 else:
 for i in range(len(geos_version)):
 if i >= len(req_vers):
+reason = "geos version too high"
+elem = SkipTest(env, TST, EXT, reason, length)
 break
 if int(geos_version[i]) < int(req_vers[i]):
 break
@@ -2054,6 +2056,9 @@ def RunTest(env, TST, COND, oktests, len
 reason = "geos version too high"
 elem = SkipTest(env, TST, EXT, reason, length)
 break
+else:
+reason = "geos version too high"
+elem = SkipTest(env, TST, EXT, reason, length)
 if reason is not None:
 break
 elif cond.startswith('R_VERSION>='):
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Make sure we don't write to a WAL file after ...

2023-07-28 Thread Sjoerd Mullender via checkin-list
Changeset: 92bd79411168 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/92bd79411168
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Make sure we don't write to a WAL file after an earlier write failed.
Also, a write failure is a reason to rotate the log files.


diffs (134 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -225,7 +225,9 @@ log_write_format(logger *lg, logformat *
 {
assert(data->id || data->flag);
assert(!lg->inmemory);
-   if (mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
mnstr_writeInt(lg->current->output_log, data->id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
@@ -271,7 +273,9 @@ log_write_id(logger *lg, int id)
 {
assert(!lg->inmemory);
assert(id >= 0);
-   if (mnstr_writeInt(lg->current->output_log, id))
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_writeInt(lg->current->output_log, id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
return GDK_FAIL;
@@ -2373,7 +2377,12 @@ log_activate(logger *lg)
bool flush_cleanup = false;
gdk_return res = GDK_SUCCEED;
rotation_lock(lg);
-   if (!lg->flushnow && !lg->current->next && lg->current->drops > 10 
&& (ulng) ATOMIC_GET(>current->last_ts) > 0 && lg->saved_id+1 == lg->id && 
ATOMIC_GET(>current->refcount) == 1 /* no pending work on this file */) {
+   if (!lg->flushnow &&
+   !lg->current->next &&
+   lg->current->drops > 10 &&
+   (ulng) ATOMIC_GET(>current->last_ts) > 0 &&
+   lg->saved_id + 1 == lg->id &&
+   ATOMIC_GET(>current->refcount) == 1 /* no pending work on this 
file */) {
lg->id++;
/* start new file */
res = log_open_output(lg);
@@ -2521,7 +2530,9 @@ log_constant(logger *lg, int type, ptr v
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[type].atomWrite;
 
-   if (log_write_format(lg, ) != GDK_SUCCEED ||
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR ||
+   log_write_format(lg, ) != GDK_SUCCEED ||
!mnstr_writeLng(lg->current->output_log, nr) ||
mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
!mnstr_writeLng(lg->current->output_log, offset)) {
@@ -2552,6 +2563,9 @@ string_writer(logger *lg, BAT *b, lng of
 
if (!buf)
return GDK_FAIL;
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR)
+   return GDK_FAIL;
BATiter bi = bat_iterator(b);
BUN p = (BUN)offset;
for ( ; p < end; ) {
@@ -2579,7 +2593,9 @@ string_writer(logger *lg, BAT *b, lng of
sz += len;
}
}
-   if (sz && (!mnstr_writeLng(lg->current->output_log, (lng) sz) 
|| mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
+   if (sz &&
+   (!mnstr_writeLng(lg->current->output_log, (lng) sz) ||
+mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
res = GDK_FAIL;
break;
}
@@ -2609,11 +2625,17 @@ internal_log_bat(logger *lg, BAT *b, log
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[b->ttype].atomWrite;
 
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR) {
+   ok = GDK_FAIL;
+   goto bailout;
+   }
+
if (lg->total_cnt == 0) /* signals single bulk message or first part of 
bat logged in parts */
if (log_write_format(lg, ) != GDK_SUCCEED ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
-   mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?-1:offset)) { /* offset = -1 indicates bat was logged in parts */
+   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
+   mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
+   !mnstr_writeLng(lg->current->output_log, 
total_cnt?-1:offset)) { /* offset = -1 indicates bat was logged in parts */
ok = GDK_FAIL;
goto bailout;
  

MonetDB: Jun2023 - Remove dead code.

2023-07-27 Thread Sjoerd Mullender via checkin-list
Changeset: 93776e0e0f42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/93776e0e0f42
Modified Files:
monetdb5/modules/mal/pcre.c
Branch: Jun2023
Log Message:

Remove dead code.

utfc8touc does not return -2, and we already checked for -1.


diffs (31 lines):

diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -208,8 +208,6 @@ mywstrncaseeq(const char *restrict s1, c
return (*s2 == 0);
if (*s2 == 0)
return false;
-   if (nn1 == (size_t) -1 || nn1 == (size_t) -2)
-   return true; /* actually an error that shouldn't 
happen */
 #if SIZEOF_WCHAR_T == 2
if (c1 > 0x || *s2 > 0x) {
if (c1 != *s2)
@@ -237,9 +235,6 @@ mystrcasecmp(const char *s1, const char 
return -(nn2 != 0 && nn2 != (size_t) -1);
if (nn2 == 0 || nn2 == (size_t) -1)
return 1;
-   if (nn1 == (size_t) -1 || nn1 == (size_t) -2 ||
-   nn2 == (size_t) -1 || nn2 == (size_t) -2)
-   return 0;/* actually an error that shouldn't 
happen */
 #if SIZEOF_WCHAR_T == 2
if (c1 > 0x || c2 > 0x) {
if (c1 != c2)
@@ -264,8 +259,6 @@ mywstrcasecmp(const char *restrict s1, c
return -(*s2 != 0);
if (*s2 == 0)
return 1;
-   if (nn1 == (size_t) -1 || nn1 == (size_t) -2)
-   return 0;/* actually an error that shouldn't 
happen */
 #if SIZEOF_WCHAR_T == 2
if (c1 > 0x || *s2 > 0x) {
if (c1 != *s2)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-07-26 Thread Sjoerd Mullender via checkin-list
Changeset: f36ade978e31 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f36ade978e31
Modified Files:
gdk/gdk.h
gdk/gdk_batop.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 1067 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2430,20 +2430,32 @@ gdk_export BAT *BATsample_with_seed(BAT 
  * on each iteration */
 #define TIMEOUT_LOOP_IDX(IDX, REPEATS, TIMEOFFSET) \
for (BUN REPS = (IDX = 0, (REPEATS)); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* declare and use IDX as a loop variable, initializing it to 0 and
  * incrementing it on each iteration */
 #define TIMEOUT_LOOP_IDX_DECL(IDX, REPEATS, TIMEOFFSET)
\
for (BUN IDX = 0, REPS = (REPEATS); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* there is no user-visible loop variable */
 #define TIMEOUT_LOOP(REPEATS, TIMEOFFSET)  \
-   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++, TIMEOFFSET = GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
+   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET)) 
{ \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
 
 /* break out of the loop (cannot use do/while trick here) */
 #define TIMEOUT_LOOP_BREAK \
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2008,6 +2008,12 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
BUN i;
oid o;
 
+   lng timeoffset = 0;
+   QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+   if (qry_ctx != NULL) {
+   timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+   }
+
if ((err = BATgroupaggrinit(b, g, e, s, , , , )) != 
NULL) {
GDKerror("%s\n", err);
return GDK_FAIL;
@@ -2053,7 +2059,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_bte: {
const bte *vals = (const bte *) bi.base;
bte *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o 

MonetDB: Jun2023 - Indent.

2023-07-26 Thread Sjoerd Mullender via checkin-list
Changeset: 37a797128c76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/37a797128c76
Modified Files:
gdk/gdk_string.c
Branch: Jun2023
Log Message:

Indent.


diffs (12 lines):

diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -789,7 +789,7 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
}
 
bi = bat_iterator(b);
-   bis = bat_iterator(sep);
+   bis = bat_iterator(sep);
if (separator)
separator_length = strlen(separator);
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Replace almost all CAND_LOOP calls to TIMEOUT...

2023-07-26 Thread Sjoerd Mullender via checkin-list
Changeset: bc93cebd6cd5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bc93cebd6cd5
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_batop.c
gdk/gdk_calc_convert.c
gdk/gdk_string.c
Branch: Jun2023
Log Message:

Replace almost all CAND_LOOP calls to TIMEOUT_LOOP calls.
This way, the calling functions also obey the timeout.


diffs (truncated from 913 to 300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2008,6 +2008,12 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
BUN i;
oid o;
 
+   lng timeoffset = 0;
+   QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+   if (qry_ctx != NULL) {
+   timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+   }
+
if ((err = BATgroupaggrinit(b, g, e, s, , , , )) != 
NULL) {
GDKerror("%s\n", err);
return GDK_FAIL;
@@ -2053,7 +2059,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_bte: {
const bte *vals = (const bte *) bi.base;
bte *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
gid = gids ? gids[o] - min : o;
@@ -2070,7 +2076,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
AVERAGE_ITER(bte, vals[o], avgs[gid], 
rems[gid], cnts[gid]);
}
}
-   for (i = 0; i < ngrp; i++) {
+   TIMEOUT_LOOP_IDX(i, ngrp, timeoffset) {
if (cnts[i] == 0) {
avgs[i] = bte_nil;
bn->tnil = true;
@@ -2101,7 +2107,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_sht: {
const sht *vals = (const sht *) bi.base;
sht *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
gid = gids ? gids[o] - min : o;
@@ -2118,7 +2124,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
AVERAGE_ITER(sht, vals[o], avgs[gid], 
rems[gid], cnts[gid]);
}
}
-   for (i = 0; i < ngrp; i++) {
+   TIMEOUT_LOOP_IDX(i, ngrp, timeoffset) {
if (cnts[i] == 0) {
avgs[i] = sht_nil;
bn->tnil = true;
@@ -2149,7 +2155,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_int: {
const int *vals = (const int *) bi.base;
int *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
gid = gids ? gids[o] - min : o;
@@ -2166,7 +2172,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
AVERAGE_ITER(int, vals[o], avgs[gid], 
rems[gid], cnts[gid]);
}
}
-   for (i = 0; i < ngrp; i++) {
+   TIMEOUT_LOOP_IDX(i, ngrp, timeoffset) {
if (cnts[i] == 0) {
avgs[i] = int_nil;
bn->tnil = true;
@@ -2197,7 +2203,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_lng: {
const lng *vals = (const lng *) bi.base;
lng *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
gid = gids ? gids[o] - min : o;
@@ -2214,7 +2220,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
AVERAGE_ITER(lng, vals[o], avgs[gid], 
rems[gid], cnts[gid]);
}
}
-   for (i = 0; i < ngrp; i++) {
+   TIMEOUT_LOOP_IDX(i, ngrp, timeoffset) {
if (cnts[i] == 0) {
avgs[i] = lng_nil;
bn->tnil = true;
@@ -2246,7 +2252,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_hge: {
const hge *vals = (const hge *) bi.base;
hge *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
gid = gids ? gids[o] - min : o;
@@ -2263,7 +2269,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
 

MonetDB: Jun2023 - Fix some potential leaks and simplify the cod...

2023-07-26 Thread Sjoerd Mullender via checkin-list
Changeset: a8f7fe83bdae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a8f7fe83bdae
Modified Files:
gdk/gdk_string.c
Branch: Jun2023
Log Message:

Fix some potential leaks and simplify the code a little.


diffs (140 lines):

diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -769,32 +769,30 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
str *restrict astrings = NULL;
BATiter bi, bis = (BATiter) {0};
BAT *bn = NULL;
-   gdk_return rres = GDK_SUCCEED;
+   gdk_return rres = GDK_FAIL;
 
/* exactly one of bnp and pt must be NULL, the other non-NULL */
assert((bnp == NULL) != (pt == NULL));
/* if pt not NULL, only a single group allowed */
assert(pt == NULL || ngrp == 1);
 
-   bi = bat_iterator(b);
-   if (sep)
-   bis = bat_iterator(sep);
-   else
-   separator_length = strlen(separator);
-
if (bnp) {
-   if ((bn = COLnew(min, TYPE_str, ngrp, TRANSIENT)) == NULL) {
-   rres = GDK_FAIL;
-   goto finish;
-   }
+   if ((bn = COLnew(min, TYPE_str, ngrp, TRANSIENT)) == NULL)
+   return GDK_FAIL;
*bnp = bn;
}
 
+   bi = bat_iterator(b);
+   bis = bat_iterator(sep);
+   if (separator)
+   separator_length = strlen(separator);
+
if (ngrp == 1) {
size_t offset = 0, single_length = 0;
bool empty = true;
 
if (separator) {
+   assert(sep == NULL);
CAND_LOOP_IDX(ci, i) {
p = canditer_next(ci) - seqb;
const char *s = BUNtvar(bi, p);
@@ -843,8 +841,8 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
 
if ((single_str = GDKmalloc(single_length + 1)) == 
NULL) {
bat_iterator_end();
-   if (sep)
-   bat_iterator_end();
+   bat_iterator_end();
+   BBPreclaim(bn);
return GDK_FAIL;
}
empty = true;
@@ -888,8 +886,8 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
if (BUNappend(bn, single_str, false) != 
GDK_SUCCEED) {
GDKfree(single_str);
bat_iterator_end();
-   if (sep)
-   bat_iterator_end();
+   bat_iterator_end();
+   BBPreclaim(bn);
return GDK_FAIL;
}
} else {
@@ -901,21 +899,19 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
} else if (bn) {
if (BUNappend(bn, str_nil, false) != GDK_SUCCEED) {
bat_iterator_end();
-   if (sep)
-   bat_iterator_end();
+   bat_iterator_end();
+   BBPreclaim(bn);
return GDK_FAIL;
}
} else {
if (VALinit(pt, TYPE_str, str_nil) == NULL) {
bat_iterator_end();
-   if (sep)
-   bat_iterator_end();
+   bat_iterator_end();
return GDK_FAIL;
}
}
bat_iterator_end();
-   if (sep)
-   bat_iterator_end();
+   bat_iterator_end();
return GDK_SUCCEED;
} else {
/* first used to calculated the total length of
@@ -925,7 +921,6 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
if (sep)
lastseplength = GDKzalloc(ngrp * 
sizeof(*lastseplength));
if (lengths == NULL || astrings == NULL || (sep && 
lastseplength == NULL)) {
-   rres = GDK_FAIL;
goto finish;
}
/* at first, set astrings[i] to str_nil, then for each
@@ -985,7 +980,6 @@ concat_strings(BAT **bnp, ValPtr pt, BAT
for (i = 0; i < ngrp; i++) {
if (astrings[i] == NULL) {
if ((astrings[i] = GDKmalloc(lengths[i] 
+ 1 - separator_length)) == NULL) {
-   rres = GDK_FAIL;
goto finish;
  

MonetDB: Jun2023 - Write the TIMEOUT_LOOP macros slightly differ...

2023-07-26 Thread Sjoerd Mullender via checkin-list
Changeset: 92cc396a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/92cc396a
Modified Files:
gdk/gdk.h
Branch: Jun2023
Log Message:

Write the TIMEOUT_LOOP macros slightly differently, but equivalently.


diffs (42 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2392,20 +2392,32 @@ gdk_export BAT *BATsample_with_seed(BAT 
  * on each iteration */
 #define TIMEOUT_LOOP_IDX(IDX, REPEATS, TIMEOFFSET) \
for (BUN REPS = (IDX = 0, (REPEATS)); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* declare and use IDX as a loop variable, initializing it to 0 and
  * incrementing it on each iteration */
 #define TIMEOUT_LOOP_IDX_DECL(IDX, REPEATS, TIMEOFFSET)
\
for (BUN IDX = 0, REPS = (REPEATS); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* there is no user-visible loop variable */
 #define TIMEOUT_LOOP(REPEATS, TIMEOFFSET)  \
-   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++, TIMEOFFSET = GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
+   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET)) 
{ \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
 
 /* break out of the loop (cannot use do/while trick here) */
 #define TIMEOUT_LOOP_BREAK \
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-07-25 Thread Sjoerd Mullender via checkin-list
Changeset: daeeecd85e29 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/daeeecd85e29
Modified Files:
.hgtags
gdk/gdk_imprints.c
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 615 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -808,3 +808,4 @@ aba8c31c60480148cd388a09ac99b42679406258
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_3
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_release
 573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_5
+573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_SP1_release
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3678,7 +3678,6 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
}
MT_lock_unset(>theaplock);
}
-   bat_iterator_end();
} else {
r = 0;
}
diff --git a/gdk/gdk_analytic_bounds.c b/gdk/gdk_analytic_bounds.c
--- a/gdk/gdk_analytic_bounds.c
+++ b/gdk/gdk_analytic_bounds.c
@@ -956,6 +956,7 @@ GDKanalyticalrowbounds(BAT *r, BAT *b, B
if (limit == GDK_lng_max) {
bat_iterator_end();
bat_iterator_end();
+   bat_iterator_end();
return GDKanalyticalallbounds(r, b, p, preceding);
} else if (is_lng_nil(limit) || limit < 0) { /* this check is 
needed if the input is empty */
goto invalid_bound;
diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -1487,6 +1487,7 @@ BATunmask(BAT *b)
Heap *dels;
if ((dels = GDKmalloc(sizeof(Heap))) == NULL) {
BBPreclaim(bn);
+   bat_iterator_end();
return NULL;
}
*dels = (Heap) {
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -306,8 +306,10 @@ BATcheckimprints(BAT *b)
if (VIEWtparent(b)) {
assert(b->timprints == NULL);
b = BATdescriptor(VIEWtparent(b));
-   if (b == NULL)
+   if (b == NULL) {
+   bat_iterator_end();
return false;
+   }
}
 
if (b->timprints == (Imprints *) 1) {
diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c
--- a/monetdb5/modules/atoms/batxml.c
+++ b/monetdb5/modules/atoms/batxml.c
@@ -969,26 +969,23 @@ BATXMLforest(Client cntxt, MalBlkPtr mb,
/* collect the admin for the xml elements */
for (i = pci->retc; i < pci->argc; i++) {
BAT *b = BATdescriptor(*getArgReference_bat(stk, pci, i));
-   if (b == NULL)
-   break;
+   if (b == NULL) {
+   while (i > pci->retc) {
+   i--;
+   b = bi[i].b;
+   bat_iterator_end([i]);
+   BBPunfix(b->batCacheid);
+   }
+   GDKfree(bi);
+   GDKfree(p);
+   GDKfree(q);
+   GDKfree(buf);
+   throw(MAL, "xml.forest", INTERNAL_BAT_ACCESS);
+   }
bi[i] = bat_iterator(b);
p[i] = 0;
q[i] = BATcount(bi[i].b);
}
-   /* check for errors */
-   if (i != pci->argc) {
-   for (i--; i >= pci->retc; i--)
-   if (bi[i].b) {
-   BAT *b = bi[i].b;
-   bat_iterator_end([i]);
-   BBPunfix(b->batCacheid);
-   }
-   GDKfree(bi);
-   GDKfree(p);
-   GDKfree(q);
-   GDKfree(buf);
-   throw(MAL, "xml.forest", INTERNAL_BAT_ACCESS);
-   }
 
prepareResult(bn, bi[pci->retc].b, TYPE_xml, "forest",
  for (i = pci->retc; i < pci->argc; i++) {BAT 
*b = bi[i].b; bat_iterator_end([i]); BBPunfix(b->batCacheid);}
diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c
--- a/monetdb5/modules/atoms/blob.c
+++ b/monetdb5/modules/atoms/blob.c
@@ -190,8 +190,7 @@ BLOBblob_blob_bulk(bat *res, const bat *
 
if (tfastins_nocheckVAR(dst, i, v) != GDK_SUCCEED) {
msg = createException(SQL, 
"batcalc.blob_blob_bulk", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-   bat_iterator_end();
-   goto bailout;
+   goto bailout1;
   

MonetDB: Jun2023 - BAT iterator fixes and cleanup.

2023-07-25 Thread Sjoerd Mullender via checkin-list
Changeset: 4dc8f3e4375b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4dc8f3e4375b
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_analytic_bounds.c
gdk/gdk_cand.c
gdk/gdk_imprints.c
monetdb5/modules/atoms/batxml.c
monetdb5/modules/atoms/blob.c
monetdb5/modules/atoms/json.c
monetdb5/modules/atoms/uuid.c
monetdb5/modules/kernel/batstr.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_rank.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_subquery.c
sql/common/sql_hash.c
Branch: Jun2023
Log Message:

BAT iterator fixes and cleanup.


diffs (truncated from 607 to 300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3678,7 +3678,6 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
}
MT_lock_unset(>theaplock);
}
-   bat_iterator_end();
} else {
r = 0;
}
diff --git a/gdk/gdk_analytic_bounds.c b/gdk/gdk_analytic_bounds.c
--- a/gdk/gdk_analytic_bounds.c
+++ b/gdk/gdk_analytic_bounds.c
@@ -956,6 +956,7 @@ GDKanalyticalrowbounds(BAT *r, BAT *b, B
if (limit == GDK_lng_max) {
bat_iterator_end();
bat_iterator_end();
+   bat_iterator_end();
return GDKanalyticalallbounds(r, b, p, preceding);
} else if (is_lng_nil(limit) || limit < 0) { /* this check is 
needed if the input is empty */
goto invalid_bound;
diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -1487,6 +1487,7 @@ BATunmask(BAT *b)
Heap *dels;
if ((dels = GDKmalloc(sizeof(Heap))) == NULL) {
BBPreclaim(bn);
+   bat_iterator_end();
return NULL;
}
*dels = (Heap) {
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -306,8 +306,10 @@ BATcheckimprints(BAT *b)
if (VIEWtparent(b)) {
assert(b->timprints == NULL);
b = BATdescriptor(VIEWtparent(b));
-   if (b == NULL)
+   if (b == NULL) {
+   bat_iterator_end();
return false;
+   }
}
 
if (b->timprints == (Imprints *) 1) {
diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c
--- a/monetdb5/modules/atoms/batxml.c
+++ b/monetdb5/modules/atoms/batxml.c
@@ -969,26 +969,23 @@ BATXMLforest(Client cntxt, MalBlkPtr mb,
/* collect the admin for the xml elements */
for (i = pci->retc; i < pci->argc; i++) {
BAT *b = BATdescriptor(*getArgReference_bat(stk, pci, i));
-   if (b == NULL)
-   break;
+   if (b == NULL) {
+   while (i > pci->retc) {
+   i--;
+   b = bi[i].b;
+   bat_iterator_end([i]);
+   BBPunfix(b->batCacheid);
+   }
+   GDKfree(bi);
+   GDKfree(p);
+   GDKfree(q);
+   GDKfree(buf);
+   throw(MAL, "xml.forest", INTERNAL_BAT_ACCESS);
+   }
bi[i] = bat_iterator(b);
p[i] = 0;
q[i] = BATcount(bi[i].b);
}
-   /* check for errors */
-   if (i != pci->argc) {
-   for (i--; i >= pci->retc; i--)
-   if (bi[i].b) {
-   BAT *b = bi[i].b;
-   bat_iterator_end([i]);
-   BBPunfix(b->batCacheid);
-   }
-   GDKfree(bi);
-   GDKfree(p);
-   GDKfree(q);
-   GDKfree(buf);
-   throw(MAL, "xml.forest", INTERNAL_BAT_ACCESS);
-   }
 
prepareResult(bn, bi[pci->retc].b, TYPE_xml, "forest",
  for (i = pci->retc; i < pci->argc; i++) {BAT 
*b = bi[i].b; bat_iterator_end([i]); BBPunfix(b->batCacheid);}
diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c
--- a/monetdb5/modules/atoms/blob.c
+++ b/monetdb5/modules/atoms/blob.c
@@ -190,8 +190,7 @@ BLOBblob_blob_bulk(bat *res, const bat *
 
if (tfastins_nocheckVAR(dst, i, v) != GDK_SUCCEED) {
msg = createException(SQL, 
"batcalc.blob_blob_bulk", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-  

MonetDB: Jun2023 - Jun2023-SP1 was released.

2023-07-25 Thread Sjoerd Mullender via checkin-list
Changeset: 926ced618877 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/926ced618877
Modified Files:
.hgtags
Branch: Jun2023
Log Message:

Jun2023-SP1 was released.


diffs (8 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -808,3 +808,4 @@ aba8c31c60480148cd388a09ac99b42679406258
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_3
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_release
 573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_5
+573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_SP1_release
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 80be6b7adaf4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80be6b7adaf4
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (173 lines):

diff --git a/monetdb5/mal/mal_namespace.c b/monetdb5/mal/mal_namespace.c
--- a/monetdb5/mal/mal_namespace.c
+++ b/monetdb5/mal/mal_namespace.c
@@ -23,21 +23,23 @@
 MT_Lock mal_namespaceLock = MT_LOCK_INITIALIZER(mal_namespaceLock);
 
 /* taken from gdk_atoms */
-#define NME_HASH(_key,y,K) 
\
-   do {
\
-   size_t _i;  
\
-   for (_i = y = 0; _i < K && _key[_i]; _i++) {\
-   y += _key[_i];  
\
-   y += (y << 10); 
\
-   y ^= (y >> 6);  
\
-   }   
\
-   y += (y << 3);  
\
-   y ^= (y >> 11); 
\
-   y += (y << 15); 
\
-   y = y & HASHMASK;   
\
-   } while (0)
+static inline size_t __attribute__((__pure__))
+nme_hash(const char *key, size_t len)
+{
+   size_t y = 0;
 
-typedef struct NAME{
+   for (size_t i = 0; i < len && key[i]; i++) {
+   y += key[i];
+   y += (y << 10);
+   y ^= (y >> 6);
+   }
+   y += (y << 3);
+   y ^= (y >> 11);
+   y += (y << 15);
+   return y & HASHMASK;
+}
+
+typedef struct NAME {
struct NAME *next;
char nme[IDLENGTH + 1];
unsigned short length;
@@ -51,15 +53,18 @@ static struct namespace {
struct namespace *next;
int count;
struct NAME data[4096];
-} *namespace;
+} namespace1, *namespace = 
 
-void initNamespace(void) {
-   namespace = NULL;
+void
+initNamespace(void)
+{
optimizerRef = putName("optimizer");
totalRef = putName("total");
 }
 
-void mal_namespace_reset(void) {
+void
+mal_namespace_reset(void)
+{
struct namespace *ns;
 
/* assume we are at the end of the server session */
@@ -67,9 +72,13 @@ void mal_namespace_reset(void) {
memset(hash, 0, sizeof(hash));
while (namespace) {
ns = namespace->next;
-   GDKfree(namespace);
+   if (namespace != )
+   GDKfree(namespace);
namespace = ns;
}
+   namespace1.count = 0;
+   namespace1.next = NULL;
+   namespace = 
MT_lock_unset(_namespaceLock);
 }
 
@@ -80,7 +89,8 @@ void mal_namespace_reset(void) {
  * is conflict free.
  */
 
-static const char *findName(const char *nme, size_t len, bool allocate)
+static const char *
+findName(const char *nme, size_t len, bool allocate)
 {
NamePtr *n, m;
size_t key;
@@ -91,31 +101,13 @@ static const char *findName(const char *
if (len > IDLENGTH) {
len = IDLENGTH;
}
-   NME_HASH(nme, key, len);
+   key = nme_hash(nme, len);
MT_lock_set(_namespaceLock);
for (n = [key]; *n; n = &(*n)->next) {
-#ifdef KEEP_SORTED
-   /* keep each list sorted on length, then name */
-   if (len < (*n)->length)
-   continue;
-   if (len == (*n)->length) {
-   int c;
-   if ((c = strncmp(nme, (*n)->nme, len)) < 0)
-   continue;
-   if (c == 0) {
-   MT_lock_unset(_namespaceLock);
-   return (*n)->nme;
-   }
-   break;
-   }
-   break;
-#else
-   /* append entries to list */
if (len == (*n)->length && strncmp(nme, (*n)->nme, len) == 0) {
MT_lock_unset(_namespaceLock);
return (*n)->nme;
}
-#endif
}
/* item not found */
if (!allocate) {
@@ -127,7 +119,6 @@ static const char *findName(const char *
if (ns == NULL) {
/* error we cannot recover from */
GDKfatal(MAL_MALLOC_FAIL);
-   exit(1);
}
ns->next = namespace;
ns->count = 0;
@@ -140,23 +131,33 @@ static const char *findName(const char *
m->next = *n;
*n = m;

MonetDB: default - Layout and some very minor changes.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 405b8fd4a303 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/405b8fd4a303
Modified Files:
monetdb5/mal/mal_module.c
monetdb5/mal/mal_prelude.c
Branch: default
Log Message:

Layout and some very minor changes.


diffs (truncated from 428 to 300 lines):

diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -123,11 +123,15 @@ mal_module_reset(void)
}
 }
 
-static int getModuleIndex(const char *name) {
+static int
+getModuleIndex(const char *name)
+{
return (int) (strHash(name) % MODULE_HASH_SIZE);
 }
 
-static void clrModuleIndex(Module cur){
+static void
+clrModuleIndex(Module cur)
+{
int index = getModuleIndex(cur->name);
Module prev = NULL;
Module m = moduleIndex[index];
@@ -145,16 +149,20 @@ static void clrModuleIndex(Module cur){
}
 }
 
-static void addModuleToIndex(Module cur){
+static void
+addModuleToIndex(Module cur)
+{
int index = getModuleIndex(cur->name);
cur->link = moduleIndex[index];
moduleIndex[index] = cur;
 }
 
-Module getModule(const char *name) {
+Module
+getModule(const char *name)
+{
int index = getModuleIndex(name);
Module m = moduleIndex[index];
-   while(m) {
+   while (m) {
if (name == m->name)
return m;
m = m->link;
@@ -162,7 +170,9 @@ Module getModule(const char *name) {
return NULL;
 }
 
-void getModuleList(Module** out, int* length) {
+void
+getModuleList(Module** out, int* length)
+{
int i;
int moduleCount = 0;
int currentIndex = 0;
@@ -188,7 +198,9 @@ void getModuleList(Module** out, int* le
}
 }
 
-void freeModuleList(Module* list) {
+void
+freeModuleList(Module* list)
+{
GDKfree(list);
 }
 
@@ -196,11 +208,13 @@ void freeModuleList(Module* list) {
  * Module scope management
  * It will contain the symbol table of all globally accessible functions.
  */
-Module globalModule(const char *nme)
-{  Module cur;
+Module
+globalModule(const char *nme)
+{
+   Module cur;
 
// Global modules are not named 'user'
-   assert (strcmp(nme, "user"));
+   assert(strcmp(nme, "user"));
nme = putName(nme);
cur = (Module) GDKzalloc(sizeof(ModuleRecord));
if (cur == NULL)
@@ -218,7 +232,9 @@ Module globalModule(const char *nme)
 
 /* Every client record has a private module name 'user'
  * for keeping around non-shared functions */
-Module userModule(void){
+Module
+userModule(void)
+{
Module cur;
 
cur = (Module) GDKzalloc(sizeof(ModuleRecord));
@@ -238,7 +254,9 @@ Module userModule(void){
  * The scope can be fixed. This is used by the parser.
  * Reading a module often calls for creation first.
  */
-Module fixModule(const char *nme) {
+Module
+fixModule(const char *nme)
+{
Module m;
 
m = getModule(nme);
@@ -249,7 +267,8 @@ Module fixModule(const char *nme) {
  * The freeModule operation throws away a symbol without
  * concerns on it whereabouts in the scope structure.
  */
-static void freeSubScope(Module scope)
+static void
+freeSubScope(Module scope)
 {
int i;
Symbol s;
@@ -267,7 +286,8 @@ static void freeSubScope(Module scope)
scope->space = 0;
 }
 
-void freeModule(Module m)
+void
+freeModule(Module m)
 {
Symbol s;
 
@@ -300,7 +320,9 @@ void freeModule(Module m)
  * This speeds up searching provided the modules adhere to the
  * structure and group the functions as well.
  */
-void insertSymbol(Module scope, Symbol prg){
+void
+insertSymbol(Module scope, Symbol prg)
+{
InstrPtr sig;
int t;
Module c;
@@ -341,7 +363,9 @@ void insertSymbol(Module scope, Symbol p
  * moment of removal. This situation can not easily
  * checked at runtime, without tremendous overhead.
  */
-void deleteSymbol(Module scope, Symbol prg){
+void
+deleteSymbol(Module scope, Symbol prg)
+{
InstrPtr sig;
int t;
 
@@ -379,7 +403,9 @@ void deleteSymbol(Module scope, Symbol p
  * The 'user' module is an alias for the scope attached
  * to the current user.
  */
-Module findModule(Module scope, const char *name){
+Module
+findModule(Module scope, const char *name)
+{
Module def = scope;
Module m;
if (name == NULL) return scope;
@@ -402,7 +428,9 @@ Module findModule(Module scope, const ch
  * The variation on this routine is to dump the definition of
  * all matching definitions.
  */
-Symbol findSymbolInModule(Module v, const char *fcn) {
+Symbol
+findSymbolInModule(Module v, const char *fcn)
+{
Symbol s;
if (v == NULL || fcn == NULL) return NULL;
s = v->space[(int)(*fcn)];
@@ -413,7 +441,9 @@ Symbol findSymbolInModule(Module v, cons
return NULL;
 }
 
-Symbol findSymbol(Module usermodule, const char *mod, const char *fcn) {
+Symbol
+findSymbol(Module usermodule, const char *mod, const char *fcn)
+{
  

MonetDB: Jun2023 - One (biggish) malloc less. Also some cleanup.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: bc90f8a2b19d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bc90f8a2b19d
Modified Files:
monetdb5/mal/mal_namespace.c
Branch: Jun2023
Log Message:

One (biggish) malloc less.  Also some cleanup.


diffs (171 lines):

diff --git a/monetdb5/mal/mal_namespace.c b/monetdb5/mal/mal_namespace.c
--- a/monetdb5/mal/mal_namespace.c
+++ b/monetdb5/mal/mal_namespace.c
@@ -23,21 +23,23 @@
 MT_Lock mal_namespaceLock = MT_LOCK_INITIALIZER(mal_namespaceLock);
 
 /* taken from gdk_atoms */
-#define NME_HASH(_key,y,K) 
\
-   do {
\
-   size_t _i;  
\
-   for (_i = y = 0; _i < K && _key[_i]; _i++) {\
-   y += _key[_i];  
\
-   y += (y << 10); 
\
-   y ^= (y >> 6);  
\
-   }   
\
-   y += (y << 3);  
\
-   y ^= (y >> 11); 
\
-   y += (y << 15); 
\
-   y = y & HASHMASK;   
\
-   } while (0)
+static inline size_t __attribute__((__pure__))
+nme_hash(const char *key, size_t len)
+{
+   size_t y = 0;
 
-typedef struct NAME{
+   for (size_t i = 0; i < len && key[i]; i++) {
+   y += key[i];
+   y += (y << 10);
+   y ^= (y >> 6);
+   }
+   y += (y << 3);
+   y ^= (y >> 11);
+   y += (y << 15);
+   return y & HASHMASK;
+}
+
+typedef struct NAME {
struct NAME *next;
char nme[IDLENGTH + 1];
unsigned short length;
@@ -51,15 +53,18 @@ static struct namespace {
struct namespace *next;
int count;
struct NAME data[4096];
-} *namespace;
+} namespace1, *namespace = 
 
-void initNamespace(void) {
-   namespace = NULL;
+void
+initNamespace(void)
+{
optimizerRef = putName("optimizer");
totalRef = putName("total");
 }
 
-void mal_namespace_reset(void) {
+void
+mal_namespace_reset(void)
+{
struct namespace *ns;
 
/* assume we are at the end of the server session */
@@ -67,9 +72,13 @@ void mal_namespace_reset(void) {
memset(hash, 0, sizeof(hash));
while (namespace) {
ns = namespace->next;
-   GDKfree(namespace);
+   if (namespace != )
+   GDKfree(namespace);
namespace = ns;
}
+   namespace1.count = 0;
+   namespace1.next = NULL;
+   namespace = 
MT_lock_unset(_namespaceLock);
 }
 
@@ -80,7 +89,8 @@ void mal_namespace_reset(void) {
  * is conflict free.
  */
 
-static const char *findName(const char *nme, size_t len, bool allocate)
+static const char *
+findName(const char *nme, size_t len, bool allocate)
 {
NamePtr *n, m;
size_t key;
@@ -91,31 +101,13 @@ static const char *findName(const char *
if (len > IDLENGTH) {
len = IDLENGTH;
}
-   NME_HASH(nme, key, len);
+   key = nme_hash(nme, len);
MT_lock_set(_namespaceLock);
for (n = [key]; *n; n = &(*n)->next) {
-#ifdef KEEP_SORTED
-   /* keep each list sorted on length, then name */
-   if (len < (*n)->length)
-   continue;
-   if (len == (*n)->length) {
-   int c;
-   if ((c = strncmp(nme, (*n)->nme, len)) < 0)
-   continue;
-   if (c == 0) {
-   MT_lock_unset(_namespaceLock);
-   return (*n)->nme;
-   }
-   break;
-   }
-   break;
-#else
-   /* append entries to list */
if (len == (*n)->length && strncmp(nme, (*n)->nme, len) == 0) {
MT_lock_unset(_namespaceLock);
return (*n)->nme;
}
-#endif
}
/* item not found */
if (!allocate) {
@@ -127,7 +119,6 @@ static const char *findName(const char *
if (ns == NULL) {
/* error we cannot recover from */
GDKfatal(MAL_MALLOC_FAIL);
-   exit(1);
}
ns->next = namespace;
ns->count = 0;
@@ -140,23 +131,33 @@ static const 

MonetDB: Jun2020-mmt - Closing branch Jun2020-mmt.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 615ed3919f48 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/615ed3919f48
Branch: Jun2020-mmt
Log Message:

Closing branch Jun2020-mmt.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: copyintobinary - Closing branch copyintobinary.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: c30efe9a8d56 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c30efe9a8d56
Branch: copyintobinary
Log Message:

Closing branch copyintobinary.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: copybinary - Closing branch copybinary.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: baa1fc842d3f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/baa1fc842d3f
Branch: copybinary
Log Message:

Closing branch copybinary.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: parquet - Closing branch parquet.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 5df1ab46427c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5df1ab46427c
Branch: parquet
Log Message:

Closing branch parquet.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: geo-update-dev - Closing branch geo-update-dev.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: abd1b3144c2e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/abd1b3144c2e
Branch: geo-update-dev
Log Message:

Closing branch geo-update-dev.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: unlogged - Closing branch unlogged.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 3b9b081381ad for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3b9b081381ad
Branch: unlogged
Log Message:

Closing branch unlogged.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: strimps-updates - Closing branch strimps-updates.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 45331cd852db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/45331cd852db
Branch: strimps-updates
Log Message:

Closing branch strimps-updates.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: join-idx-improvements - Closing branch join-idx-improve...

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 531c93887976 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/531c93887976
Branch: join-idx-improvements
Log Message:

Closing branch join-idx-improvements.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: tempscs2os - Closing branch tempscs2os.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 618995415b9c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/618995415b9c
Branch: tempscs2os
Log Message:

Closing branch tempscs2os.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: smart-merge - Closing branch smart-merge.

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 8d13ace6b96c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8d13ace6b96c
Branch: smart-merge
Log Message:

Closing branch smart-merge.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: transaction_layer_revamp - Closing branch transaction_l...

2023-07-20 Thread Sjoerd Mullender via checkin-list
Changeset: 1c097d96ef04 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1c097d96ef04
Branch: transaction_layer_revamp
Log Message:

Closing branch transaction_layer_revamp.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 8d0141a68711 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8d0141a68711
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 605 to 300 lines):

diff --git a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c 
b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
--- a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
+++ b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
@@ -9,6 +9,7 @@
  */
 
 #include "monetdb_config.h"
+#define PY_SSIZE_T_CLEAN
 #include "type_conversion.h"
 #include "unicode.h"
 
@@ -42,6 +43,7 @@ int hge_to_string(char *str, hge x)
 
 PyObject *PyLong_FromHge(hge h)
 {
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 10
PyLongObject *z;
size_t size = 0;
hge shift = h >= 0 ? h : -h;
@@ -65,6 +67,15 @@ PyObject *PyLong_FromHge(hge h)
 #endif
}
return (PyObject *)z;
+#else
+   return PyObject_CallMethod((PyObject *) _Type, "from_bytes", 
"(y#s)", , (Py_ssize_t) sizeof(h),
+#ifdef WORDS_BIGENDIAN
+  "big"
+#else
+  "little"
+#endif
+   );
+#endif
 }
 #endif
 
@@ -255,23 +266,23 @@ wrapup:
return msg;
 }
 
-#define STRING_TO_NUMBER_FACTORY(tpe)  
\
-   str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value)   
   \
-   {   
   \
-   size_t len = sizeof(tpe);   
   \
-   char buf[256];  
   \
-   if (maxsize > 0) {  
   \
-   if (maxsize >= sizeof(buf)) 
   \
-   maxsize = sizeof(buf) - 1;  
   \
-   strncpy(buf, ptr, maxsize); 
   \
-   buf[maxsize] = 0;   
   \
-   if (strlen(buf) >= sizeof(buf) - 1) 
   \
-   return GDKstrdup("string too long to 
convert.");   \
-   ptr = buf;  
   \
-   }   
   \
+#define STRING_TO_NUMBER_FACTORY(tpe)  
\
+   str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value)   
\
+   {   
\
+   size_t len = sizeof(tpe);   
\
+   char buf[256];  
\
+   if (maxsize > 0) {  
\
+   if (maxsize >= sizeof(buf)) 
\
+   maxsize = sizeof(buf) - 1;  
\
+   strncpy(buf, ptr, maxsize); 
\
+   buf[maxsize] = 0;   
\
+   if (strlen(buf) >= sizeof(buf) - 1) 
\
+   return GDKstrdup("string too long to 
convert.");\
+   ptr = buf;  
\
+   }   
\
if (BATatoms[TYPE_##tpe].atomFromStr(ptr, , (void 
**), false) < 0) \
-   return GDKstrdup("Error converting string.");   
   \
-   return MAL_SUCCEED; 
   \
+   return GDKstrdup("Error converting string.");   
\
+   return MAL_SUCCEED; 
\
}
 
 str str_to_date(const char *ptr, size_t maxsize, date *value)
@@ -329,53 +340,118 @@ str unicode_to_timestamp(Py_UNICODE *ptr
 }
 
 
-#define PY_TO_(type, inttpe)   \
+#if 

MonetDB: Nov2019 - Closing branch Nov2019.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: b38903cf2313 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b38903cf2313
Branch: Nov2019
Log Message:

Closing branch Nov2019.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2020_prof_ext - Closing branch Jun2020_prof_ext.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 98111576e463 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/98111576e463
Branch: Jun2020_prof_ext
Log Message:

Closing branch Jun2020_prof_ext.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jul2021_debug - Closing branch Jul2021_debug.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 47efc272081c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/47efc272081c
Branch: Jul2021_debug
Log Message:

Closing branch Jul2021_debug.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Oct2020 - Closing branch Oct2020.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 80cdd4c67788 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80cdd4c67788
Branch: Oct2020
Log Message:

Closing branch Oct2020.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jan2022_prof_ext - Closing branch Jan2022_prof_ext.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 368a04b34a2c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/368a04b34a2c
Branch: Jan2022_prof_ext
Log Message:

Closing branch Jan2022_prof_ext.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jul2021_prof_ext - Closing branch Jul2021_prof_ext.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 3ad19679f9d7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3ad19679f9d7
Branch: Jul2021_prof_ext
Log Message:

Closing branch Jul2021_prof_ext.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jan2022 - Closing branch Jan2022.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 1e2f01e7d974 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1e2f01e7d974
Branch: Jan2022
Log Message:

Closing branch Jan2022.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2020 - Closing branch Jun2020.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: a4c2a2aac48b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a4c2a2aac48b
Branch: Jun2020
Log Message:

Closing branch Jun2020.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Sep2022 - Closing the branch.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 4534b6d79a20 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4534b6d79a20
Branch: Sep2022
Log Message:

Closing the branch.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jul2021 - Closing the branch.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: ba5fa29b240c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ba5fa29b240c
Branch: Jul2021
Log Message:

Closing the branch.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Turn segment next pointer into an atomic.

2023-07-19 Thread Sjoerd Mullender via checkin-list
Changeset: 92c641b07606 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/92c641b07606
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
Branch: Jun2023
Log Message:

Turn segment next pointer into an atomic.
This seems to fix the occasional problem that we get a crash when
concurrent work (changes and lookups) are done on segment chains that
are due to the compiler/CPU doing things out of the written order (which
they may).


diffs (truncated from 371 to 300 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -121,6 +121,7 @@ tc_gc_seg( sql_store Store, sql_change *
if (s->ts <= oldest) {
while(s) {
segment *n = s->prev;
+   ATOMIC_PTR_DESTROY(>next);
_DELETE(s);
s = n;
}
@@ -158,10 +159,10 @@ new_segment(segment *o, sql_trans *tr, s
n->start = 0;
n->end = cnt;
}
-   n->next = NULL;
+   ATOMIC_PTR_INIT(>next, NULL);
n->prev = NULL;
if (o)
-   o->next = n;
+   ATOMIC_PTR_SET(>next, n);
}
return n;
 }
@@ -197,19 +198,19 @@ split_segment(segments *segs, segment *o
 * inserted before */
n->start = o->start;
n->end = n->start + cnt;
-   n->next = o;
+   ATOMIC_PTR_INIT(>next, o);
if (segs->h == o)
segs->h = n;
if (p)
-   p->next = n;
+   ATOMIC_PTR_SET(>next, n);
o->start = n->end;
} else if (start+cnt == o->end) {
/* 2-way split: o remains first part of segment, new one is
 * added after */
n->start = o->end - cnt;
n->end = o->end;
-   n->next = o->next;
-   o->next = n;
+   ATOMIC_PTR_INIT(>next, ATOMIC_PTR_GET(>next));
+   ATOMIC_PTR_SET(>next, n);
if (segs->t == o)
segs->t = n;
o->end = n->start;
@@ -221,15 +222,16 @@ split_segment(segments *segs, segment *o
GDKfree(n);
return NULL;
}
-   n->next = n2;
+   ATOMIC_PTR_INIT(>next, n2);
n->start = start;
n->end = start + cnt;
*n2 = *o;
+   ATOMIC_PTR_INIT(>next, ATOMIC_PTR_GET(>next));
n2->start = n->end;
n2->prev = NULL;
if (segs->t == o)
segs->t = n2;
-   o->next = n;
+   ATOMIC_PTR_SET(>next, n);
o->end = start;
}
return n;
@@ -239,7 +241,7 @@ static void
 rollback_segments(segments *segs, sql_trans *tr, sql_change *change, ulng 
oldest)
 {
segment *cur = segs->h, *seg = NULL;
-   for (; cur; cur = cur->next) {
+   for (; cur; cur = ATOMIC_PTR_GET(>next)) {
if (cur->ts == tr->tid) { /* revert */
cur->deleted = !cur->deleted || (cur->ts == cur->oldts);
cur->ts = cur->oldts==tr->tid?0:cur->oldts; /* need old 
ts */
@@ -251,7 +253,7 @@ rollback_segments(segments *segs, sql_tr
} else if (seg->end == cur->start && seg->deleted == 
cur->deleted) {
/* merge with previous */
seg->end = cur->end;
-   seg->next = cur->next;
+   ATOMIC_PTR_SET(>next, 
ATOMIC_PTR_GET(>next));
if (cur == segs->t)
segs->t = seg;
mark4destroy(cur, change, 
store_get_timestamp(tr->store));
@@ -269,7 +271,7 @@ segs_end_include_deleted( segments *segs
size_t cnt = 0;
segment *s = segs->h, *l = NULL;
 
-   for(;s; s = s->next) {
+   for(;s; s = ATOMIC_PTR_GET(>next)) {
if (s->ts == tr->tid || SEG_IS_VALID(s, tr))
l = s;
}
@@ -312,7 +314,7 @@ segments2cs(sql_trans *tr, segments *seg
uint32_t *restrict dst;
/* why hashlock ?? */
MT_rwlock_wrlock(>thashlock);
-   for (; s ; s=s->next) {
+   for (; s ; s=ATOMIC_PTR_GET(>next)) {
if (s->start >= nr)
break;
if (s->ts == tr->tid && s->end != s->start) {
@@ -395,7 +397,7 @@ merge_segments(storage *s, sql_trans *tr
 {
sqlstore* store = tr->store;
segment *cur = s->segs->h, *seg = NULL;
-   for (; cur; cur = cur->next) {
+   for (; cur; cur = 

MonetDB: Jun2023 - Ported to Python 3.12, new code also used on ...

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 2ddcea96061c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2ddcea96061c
Modified Files:
sql/backends/monet5/UDF/pyapi3/type_conversion3.c
Branch: Jun2023
Log Message:

Ported to Python 3.12, new code also used on 3.10 and 3.11.
On 3.12 the representation of the Python Long was changed, so now we
avoid looking into the object completely and use slightly higher level
interfaces to get at needed information.


diffs (234 lines):

diff --git a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c 
b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
--- a/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
+++ b/sql/backends/monet5/UDF/pyapi3/type_conversion3.c
@@ -9,6 +9,7 @@
  */
 
 #include "monetdb_config.h"
+#define PY_SSIZE_T_CLEAN
 #include "type_conversion.h"
 #include "unicode.h"
 
@@ -42,6 +43,7 @@ int hge_to_string(char *str, hge x)
 
 PyObject *PyLong_FromHge(hge h)
 {
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 10
PyLongObject *z;
size_t size = 0;
hge shift = h >= 0 ? h : -h;
@@ -65,6 +67,15 @@ PyObject *PyLong_FromHge(hge h)
 #endif
}
return (PyObject *)z;
+#else
+   return PyObject_CallMethod((PyObject *) _Type, "from_bytes", 
"(y#s)", , (Py_ssize_t) sizeof(h),
+#ifdef WORDS_BIGENDIAN
+  "big"
+#else
+  "little"
+#endif
+   );
+#endif
 }
 #endif
 
@@ -255,23 +266,23 @@ wrapup:
return msg;
 }
 
-#define STRING_TO_NUMBER_FACTORY(tpe)  
\
-   str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value)   
   \
-   {   
   \
-   size_t len = sizeof(tpe);   
   \
-   char buf[256];  
   \
-   if (maxsize > 0) {  
   \
-   if (maxsize >= sizeof(buf)) 
   \
-   maxsize = sizeof(buf) - 1;  
   \
-   strncpy(buf, ptr, maxsize); 
   \
-   buf[maxsize] = 0;   
   \
-   if (strlen(buf) >= sizeof(buf) - 1) 
   \
-   return GDKstrdup("string too long to 
convert.");   \
-   ptr = buf;  
   \
-   }   
   \
+#define STRING_TO_NUMBER_FACTORY(tpe)  
\
+   str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value)   
\
+   {   
\
+   size_t len = sizeof(tpe);   
\
+   char buf[256];  
\
+   if (maxsize > 0) {  
\
+   if (maxsize >= sizeof(buf)) 
\
+   maxsize = sizeof(buf) - 1;  
\
+   strncpy(buf, ptr, maxsize); 
\
+   buf[maxsize] = 0;   
\
+   if (strlen(buf) >= sizeof(buf) - 1) 
\
+   return GDKstrdup("string too long to 
convert.");\
+   ptr = buf;  
\
+   }   
\
if (BATatoms[TYPE_##tpe].atomFromStr(ptr, , (void 
**), false) < 0) \
-   return GDKstrdup("Error converting string.");   
   \
-   return MAL_SUCCEED; 
   \
+   return GDKstrdup("Error converting string.");   
\
+   return MAL_SUCCEED; 
 

MonetDB: default - Merge with Jun2023 branch, not changing any f...

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 81b0a97051b6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/81b0a97051b6
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

Merge with Jun2023 branch, not changing any files..

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jun2023 branch.

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: f1e05acecfa3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f1e05acecfa3
Modified Files:
.hgtags
MonetDB.spec
cmake/monetdb-versions.cmake
debian/changelog
misc/packages/deb/changelog
misc/packages/rpm/changelog
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (231 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -807,3 +807,4 @@ 8b736d6dcfd63d0560c99fc5427b504c116b74b0
 aba8c31c60480148cd388a09ac99b42679406258 Jun2023_1
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_3
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_release
+573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_5
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -89,7 +89,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Jun2023/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jun2023-SP1/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -860,6 +860,24 @@ fi
 %endif
 
 %changelog
+* Tue Jul 18 2023 Sjoerd Mullender  - 11.47.5-20230718
+- Rebuilt.
+- GH#7388: Query results in large cross product
+- GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+  (16384)
+
+* Thu Jun 22 2023 Sjoerd Mullender  - 11.47.5-20230718
+- sql: An upgrade that both creates a new .snapshot user and extends the
+  sys.db_user_info table with (among others) a password column did
+  these in such a way that the passord value for the new user was NULL.
+  This is fixed by updating the password.
+
+* Thu Jun 22 2023 Sjoerd Mullender  - 11.47.5-20230718
+- monetdb5: There is now a new option --set tablet_threads=N to limit the 
number
+  of threads used for a COPY INTO from CSV file query.  This option can
+  also be set for a specific database using the monetdb command using
+  the ncopyintothreads property.
+
 * Thu Jun 22 2023 Sjoerd Mullender  - 11.47.3-20230622
 - Rebuilt.
 - GH#7344: Database upgrade failure due to user object dependency on
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -42,7 +42,7 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "27")
 set(GDK_VERSION_MINOR "0")
-set(GDK_VERSION_PATCH "1")
+set(GDK_VERSION_PATCH "2")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
@@ -54,13 +54,13 @@ set(MAPI_VERSION "${MAPI_VERSION_MAJOR}.
 # version of the MONETDB5 library (subdirectory monetdb5, not including extras 
or sql)
 set(MONETDB5_VERSION_MAJOR "34")
 set(MONETDB5_VERSION_MINOR "0")
-set(MONETDB5_VERSION_PATCH "1")
+set(MONETDB5_VERSION_PATCH "2")
 set(MONETDB5_VERSION 
"${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}")
 
 # version of the MONETDBE library (subdirectory tools/monetdbe)
 set(MONETDBE_VERSION_MAJOR "26")
 set(MONETDBE_VERSION_MINOR "0")
-set(MONETDBE_VERSION_PATCH "2")
+set(MONETDBE_VERSION_PATCH "3")
 set(MONETDBE_VERSION 
"${MONETDBE_VERSION_MAJOR}.${MONETDBE_VERSION_MINOR}.${MONETDBE_VERSION_PATCH}")
 
 # version of the STREAM library (subdirectory common/stream)
@@ -72,5 +72,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ
 # version of the SQL library (subdirectory sql)
 set(SQL_VERSION_MAJOR "14")
 set(SQL_VERSION_MINOR "0")
-set(SQL_VERSION_PATCH "1")
+set(SQL_VERSION_PATCH "2")
 set(SQL_VERSION 
"${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}")
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,30 @@
+monetdb (11.47.5) unstable; urgency=low
+
+  * Rebuilt.
+  * GH#7388: Query results in large cross product
+  * GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+(16384)
+
+ -- Sjoerd Mullender   Tue, 18 Jul 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * sql: An upgrade that both creates a new .snapshot user and extends the
+sys.db_user_info table with (among others) a password column did
+these in such a way that the passord value for the new user was NULL.
+This is fixed by updating the password.
+
+ -- Sjoerd Mullender   Thu, 22 Jun 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * monetdb5: There is now a new option --set tablet_threads=N to limit the 
number
+of threads used for a COPY INTO from CSV file query.  This option can
+also be se

MonetDB: Jun2023 - Post release build.

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 0cd53dcc5c70 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0cd53dcc5c70
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: Jun2023
Log Message:

Post release build.


diffs (191 lines):

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 11.47.5
+current_version = 11.47.6
 commit = False
 tag = False
 
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -7,7 +7,7 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V.
 
 %global name MonetDB
-%global version 11.47.5
+%global version 11.47.6
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
diff --git a/clients/mapilib/mapi.rc b/clients/mapilib/mapi.rc
--- a/clients/mapilib/mapi.rc
+++ b/clients/mapilib/mapi.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,47,5)
-  PRODUCTVERSION version(11,47,5)
+  FILEVERSION version(11,47,6)
+  PRODUCTVERSION version(11,47,6)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB B.V.\0"
   VALUE "FileDescription", "MonetDB Application Interface DLL\0"
-  VALUE "FileVersion", sversion(11,47,5)
+  VALUE "FileVersion", sversion(11,47,6)
   VALUE "InternalName", "Mapi\0"
   VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "Mapi.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB Client Libraries\0"
-  VALUE "ProductVersion", sversion(11,47,5)
+  VALUE "ProductVersion", sversion(11,47,6)
   VALUE "SpecialBuild", "\0"
 END
   END
diff --git a/clients/odbc/driver/driver.rc b/clients/odbc/driver/driver.rc
--- a/clients/odbc/driver/driver.rc
+++ b/clients/odbc/driver/driver.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,47,5)
-  PRODUCTVERSION version(11,47,5)
+  FILEVERSION version(11,47,6)
+  PRODUCTVERSION version(11,47,6)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB B.V.\0"
   VALUE "FileDescription", "MonetDB ODBC Driver DLL\0"
-  VALUE "FileVersion", sversion(11,47,5)
+  VALUE "FileVersion", sversion(11,47,6)
   VALUE "InternalName", "MonetODBC\0"
   VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "MonetODBC.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB SQL Server\0"
-  VALUE "ProductVersion", sversion(11,47,5)
+  VALUE "ProductVersion", sversion(11,47,6)
   VALUE "SpecialBuild", "\0"
 END
   END
diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc
--- a/clients/odbc/winsetup/setup.rc
+++ b/clients/odbc/winsetup/setup.rc
@@ -65,8 +65,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION version(11,47,5)
- PRODUCTVERSION version(11,47,5)
+ FILEVERSION version(11,47,6)
+ PRODUCTVERSION version(11,47,6)
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -83,12 +83,12 @@ BEGIN
 BEGIN
 VALUE "CompanyName", "MonetDB B.V."
 VALUE "FileDescription", "MonetDB ODBC Setup DLL"
-VALUE "FileVersion", sversion(11,47,5)
+VALUE "FileVersion", sversion(11,47,6)
 VALUE "InternalName", "MonetODBCs.dll"
 VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023"
 VALUE "OriginalFilename", "MonetODBCs.dll"
 VALUE "ProductName", "MonetDB SQL Server"
-VALUE "ProductVersion", sversion(11,47,5)
+VALUE "ProductVersion", sversion(11,47,6)
 END
 END
 BLOCK "VarFileInfo"
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -10,10 +10,10 @@
 
 set(MONETDB_VERSION_MAJOR "11")
 set(MONETDB_VERSION_MINOR "47")
-set(MONETDB_VERSION_PATCH "5")
+set(MONETDB_VERSION_PATCH "6")
 
 if(RELEASE_VERSION)
-  set(MONETDB_RELEASE "Jun2023-SP1")
+  set(MONETDB_RELEASE "unreleased")
 endif()
 set(MONETDB_VERSION 
"${MONETDB_VERSION_MAJOR}.${MONETDB_VERSION_MINOR}.${MONETDB_VERSION_PATCH}")
 
diff --git a/gdk/libbat.rc b/gdk/libbat.rc
--- a/gdk/libbat.rc
+++ b/gdk/libbat.rc
@@ -6,8 +6,8 @@ 

MonetDB: Jun2023 - Setting tag Jun2023_5 for the release build.

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 49df889d99c5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/49df889d99c5
Modified Files:
.hgtags
Branch: Jun2023
Log Message:

Setting tag Jun2023_5 for the release build.


diffs (8 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -807,3 +807,4 @@ 8b736d6dcfd63d0560c99fc5427b504c116b74b0
 aba8c31c60480148cd388a09ac99b42679406258 Jun2023_1
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_3
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_release
+573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_5
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Moved contents of ChangeLog.Jun2023 to MonetD...

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 573511e0e7bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/573511e0e7bf
Modified Files:
MonetDB.spec
debian/changelog
misc/packages/deb/changelog
misc/packages/rpm/changelog
monetdb5/ChangeLog-Archive
monetdb5/ChangeLog.Jun2023
sql/ChangeLog-Archive
sql/ChangeLog.Jun2023
Branch: Jun2023
Log Message:

Moved contents of ChangeLog.Jun2023 to MonetDB.spec, debian/changelog and 
ChangeLog-Archive.


diffs (188 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -89,7 +89,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Jun2023/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jun2023-SP1/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -860,6 +860,24 @@ fi
 %endif
 
 %changelog
+* Tue Jul 18 2023 Sjoerd Mullender  - 11.47.5-20230718
+- Rebuilt.
+- GH#7388: Query results in large cross product
+- GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+  (16384)
+
+* Thu Jun 22 2023 Sjoerd Mullender  - 11.47.5-20230718
+- sql: An upgrade that both creates a new .snapshot user and extends the
+  sys.db_user_info table with (among others) a password column did
+  these in such a way that the passord value for the new user was NULL.
+  This is fixed by updating the password.
+
+* Thu Jun 22 2023 Sjoerd Mullender  - 11.47.5-20230718
+- monetdb5: There is now a new option --set tablet_threads=N to limit the 
number
+  of threads used for a COPY INTO from CSV file query.  This option can
+  also be set for a specific database using the monetdb command using
+  the ncopyintothreads property.
+
 * Thu Jun 22 2023 Sjoerd Mullender  - 11.47.3-20230622
 - Rebuilt.
 - GH#7344: Database upgrade failure due to user object dependency on
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,30 @@
+monetdb (11.47.5) unstable; urgency=low
+
+  * Rebuilt.
+  * GH#7388: Query results in large cross product
+  * GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+(16384)
+
+ -- Sjoerd Mullender   Tue, 18 Jul 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * sql: An upgrade that both creates a new .snapshot user and extends the
+sys.db_user_info table with (among others) a password column did
+these in such a way that the passord value for the new user was NULL.
+This is fixed by updating the password.
+
+ -- Sjoerd Mullender   Thu, 22 Jun 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * monetdb5: There is now a new option --set tablet_threads=N to limit the 
number
+of threads used for a COPY INTO from CSV file query.  This option can
+also be set for a specific database using the monetdb command using
+the ncopyintothreads property.
+
+ -- Sjoerd Mullender   Thu, 22 Jun 2023 13:12:19 +0200
+
 monetdb (11.47.3) unstable; urgency=low
 
   * Rebuilt.
diff --git a/misc/packages/deb/changelog b/misc/packages/deb/changelog
--- a/misc/packages/deb/changelog
+++ b/misc/packages/deb/changelog
@@ -1,3 +1,30 @@
+monetdb (11.47.5) unstable; urgency=low
+
+  * Rebuilt.
+  * GH#7388: Query results in large cross product
+  * GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+(16384)
+
+ -- Sjoerd Mullender   Tue, 18 Jul 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * sql: An upgrade that both creates a new .snapshot user and extends the
+sys.db_user_info table with (among others) a password column did
+these in such a way that the passord value for the new user was NULL.
+This is fixed by updating the password.
+
+ -- Sjoerd Mullender   Thu, 22 Jun 2023 13:12:19 +0200
+
+monetdb (11.47.5) unstable; urgency=low
+
+  * monetdb5: There is now a new option --set tablet_threads=N to limit the 
number
+of threads used for a COPY INTO from CSV file query.  This option can
+also be set for a specific database using the monetdb command using
+the ncopyintothreads property.
+
+ -- Sjoerd Mullender   Thu, 22 Jun 2023 13:12:19 +0200
+
 monetdb (11.47.3) unstable; urgency=low
 
   * Rebuilt.
diff --git a/misc/packages/rpm/changelog b/misc/packages/rpm/changelog
--- a/misc/packages/rpm/changelog
+++ b/misc/packages/rpm/changelog
@@ -1,3 +1,21 @@
+* Tue Jul 18 2023 Sjoerd Mullender  - 11.47.5-20230718
+- Rebuilt.
+- GH#7388: Query results in large cross product
+- GH#7394: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+  (16384)
+
+* Thu Jun 22 2023 Sjoerd Mullender  - 11.47.5-20230718
+- sql: An upgrade that both creates a new .snapshot user and extends the
+  sys.db_user_info table with (among others

MonetDB: default - Merge with Jun2023 branch, not changing any f...

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 7057b40701a5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7057b40701a5
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

Merge with Jun2023 branch, not changing any files.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Updated library versions.

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 78fea3abc2f0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/78fea3abc2f0
Modified Files:
cmake/monetdb-versions.cmake
Branch: Jun2023
Log Message:

Updated library versions.


diffs (35 lines):

diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -42,7 +42,7 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "27")
 set(GDK_VERSION_MINOR "0")
-set(GDK_VERSION_PATCH "1")
+set(GDK_VERSION_PATCH "2")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
@@ -54,13 +54,13 @@ set(MAPI_VERSION "${MAPI_VERSION_MAJOR}.
 # version of the MONETDB5 library (subdirectory monetdb5, not including extras 
or sql)
 set(MONETDB5_VERSION_MAJOR "34")
 set(MONETDB5_VERSION_MINOR "0")
-set(MONETDB5_VERSION_PATCH "1")
+set(MONETDB5_VERSION_PATCH "2")
 set(MONETDB5_VERSION 
"${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}")
 
 # version of the MONETDBE library (subdirectory tools/monetdbe)
 set(MONETDBE_VERSION_MAJOR "26")
 set(MONETDBE_VERSION_MINOR "0")
-set(MONETDBE_VERSION_PATCH "2")
+set(MONETDBE_VERSION_PATCH "3")
 set(MONETDBE_VERSION 
"${MONETDBE_VERSION_MAJOR}.${MONETDBE_VERSION_MINOR}.${MONETDBE_VERSION_PATCH}")
 
 # version of the STREAM library (subdirectory common/stream)
@@ -72,5 +72,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ
 # version of the SQL library (subdirectory sql)
 set(SQL_VERSION_MAJOR "14")
 set(SQL_VERSION_MINOR "0")
-set(SQL_VERSION_PATCH "1")
+set(SQL_VERSION_PATCH "2")
 set(SQL_VERSION 
"${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}")
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Pre-release version number update.

2023-07-18 Thread Sjoerd Mullender via checkin-list
Changeset: 25889c65b7ea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/25889c65b7ea
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: Jun2023
Log Message:

Pre-release version number update.


diffs (191 lines):

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 11.47.4
+current_version = 11.47.5
 commit = False
 tag = False
 
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -7,7 +7,7 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V.
 
 %global name MonetDB
-%global version 11.47.4
+%global version 11.47.5
 %{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # Use bcond_with to add a --with option; i.e., "without" is default.
diff --git a/clients/mapilib/mapi.rc b/clients/mapilib/mapi.rc
--- a/clients/mapilib/mapi.rc
+++ b/clients/mapilib/mapi.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,47,4)
-  PRODUCTVERSION version(11,47,4)
+  FILEVERSION version(11,47,5)
+  PRODUCTVERSION version(11,47,5)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB B.V.\0"
   VALUE "FileDescription", "MonetDB Application Interface DLL\0"
-  VALUE "FileVersion", sversion(11,47,4)
+  VALUE "FileVersion", sversion(11,47,5)
   VALUE "InternalName", "Mapi\0"
   VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "Mapi.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB Client Libraries\0"
-  VALUE "ProductVersion", sversion(11,47,4)
+  VALUE "ProductVersion", sversion(11,47,5)
   VALUE "SpecialBuild", "\0"
 END
   END
diff --git a/clients/odbc/driver/driver.rc b/clients/odbc/driver/driver.rc
--- a/clients/odbc/driver/driver.rc
+++ b/clients/odbc/driver/driver.rc
@@ -6,8 +6,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 #define sversion(major,minor,patch)#major "." #minor "." #patch "\0"
 
 1 VERSIONINFO
-  FILEVERSION version(11,47,4)
-  PRODUCTVERSION version(11,47,4)
+  FILEVERSION version(11,47,5)
+  PRODUCTVERSION version(11,47,5)
   FILEFLAGSMASK 0x3fL
   FILEFLAGS 0
   FILEOS VOS_NT_WINDOWS32
@@ -21,14 +21,14 @@ BEGIN
   VALUE "Comments", "\0"
   VALUE "CompanyName", "MonetDB B.V.\0"
   VALUE "FileDescription", "MonetDB ODBC Driver DLL\0"
-  VALUE "FileVersion", sversion(11,47,4)
+  VALUE "FileVersion", sversion(11,47,5)
   VALUE "InternalName", "MonetODBC\0"
   VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023\0"
   VALUE "LegalTrademarks", "\0"
   VALUE "OriginalFilename", "MonetODBC.dll\0"
   VALUE "PrivateBuild", "\0"
   VALUE "ProductName", "MonetDB SQL Server\0"
-  VALUE "ProductVersion", sversion(11,47,4)
+  VALUE "ProductVersion", sversion(11,47,5)
   VALUE "SpecialBuild", "\0"
 END
   END
diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc
--- a/clients/odbc/winsetup/setup.rc
+++ b/clients/odbc/winsetup/setup.rc
@@ -65,8 +65,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION version(11,47,4)
- PRODUCTVERSION version(11,47,4)
+ FILEVERSION version(11,47,5)
+ PRODUCTVERSION version(11,47,5)
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -83,12 +83,12 @@ BEGIN
 BEGIN
 VALUE "CompanyName", "MonetDB B.V."
 VALUE "FileDescription", "MonetDB ODBC Setup DLL"
-VALUE "FileVersion", sversion(11,47,4)
+VALUE "FileVersion", sversion(11,47,5)
 VALUE "InternalName", "MonetODBCs.dll"
 VALUE "LegalCopyright", "Copyright (c) MonetDB B.V. 2008-2023"
 VALUE "OriginalFilename", "MonetODBCs.dll"
 VALUE "ProductName", "MonetDB SQL Server"
-VALUE "ProductVersion", sversion(11,47,4)
+VALUE "ProductVersion", sversion(11,47,5)
 END
 END
 BLOCK "VarFileInfo"
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -10,10 +10,10 @@
 
 set(MONETDB_VERSION_MAJOR "11")
 set(MONETDB_VERSION_MINOR "47")
-set(MONETDB_VERSION_PATCH "4")
+set(MONETDB_VERSION_PATCH "5")
 
 if(RELEASE_VERSION)
-  set(MONETDB_RELEASE "unreleased")
+  set(MONETDB_RELEASE "Jun2023-SP1")
 endif()
 set(MONETDB_VERSION 
"${MONETDB_VERSION_MAJOR}.${MONETDB_VERSION_MINOR}.${MONETDB_VERSION_PATCH}")
 
diff --git a/gdk/libbat.rc b/gdk/libbat.rc
--- a/gdk/libbat.rc
+++ b/gdk/libbat.rc
@@ 

<    4   5   6   7   8   9   10   11   12   13   >