MonetDB: Dec2023 - Updated BATsample, remove BATcreatesample (wh...

2023-11-15 Thread Sjoerd Mullender via checkin-list
Changeset: ed3714394359 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ed3714394359
Modified Files:
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_private.h
gdk/gdk_sample.c
gdk/xoshiro256starstar.h
sql/test/sample/Tests/sample.10.test
sql/test/sample/Tests/sample.11.test
sql/test/sample/Tests/sample.12.test
sql/test/sample/Tests/sample.13.test
sql/test/sample/Tests/sample.2.test
sql/test/sample/Tests/sample.3.test
sql/test/sample/Tests/sample.4.test
sql/test/sample/Tests/sample.5.test
sql/test/sample/Tests/sample.6.test
sql/test/sample/Tests/sample.9.test
sql/test/sys-schema/Tests/webExamplesMathematicalFunctionsOperators.test
Branch: Dec2023
Log Message:

Updated BATsample, remove BATcreatesample (which was private anyway).


diffs (truncated from 579 to 300 lines):

diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -523,7 +523,7 @@ BATimprints(BAT *b)
imprints->imprints.parentid = b->batCacheid;
 
 #define SMP_SIZE 2048
-   s1 = BATsample_with_seed(b, SMP_SIZE, (uint64_t) GDKusec() * 
(uint64_t) b->batCacheid);
+   s1 = BATsample(b, SMP_SIZE);
if (s1 == NULL) {
GDKfree(imprints);
bat_iterator_end(&bi);
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3559,11 +3559,9 @@ guess_uniques(BAT *b, struct canditer *c
  ALGOBATPAR(b));
return unique_est;
}
-   s1 = BATcreatesample(b->hseqbase, batcount, 1000,
-(uint64_t) GDKusec() * (uint64_t) 
b->batCacheid);
+   s1 = BATsample(b, 1000);
} else {
-   BAT *s2 = BATcreatesample(ci->s->hseqbase, ci->ncand, 1000,
- (uint64_t) GDKusec() * (uint64_t) 
b->batCacheid);
+   BAT *s2 = BATsample(ci->s, 1000);
if (s2 == NULL)
return -1;
s1 = BATproject(s2, ci->s);
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -67,8 +67,6 @@ gdk_return BATcheckmodes(BAT *b, bool pe
__attribute__((__visibility__("hidden")));
 BAT *BATcreatedesc(oid hseq, int tt, bool heapnames, role_t role, uint16_t 
width)
__attribute__((__visibility__("hidden")));
-BAT *BATcreatesample(oid hseq, BUN cnt, BUN n, uint64_t seed)
-   __attribute__((__visibility__("hidden")));
 void BATdelete(BAT *b)
__attribute__((__visibility__("hidden")));
 void BATdestroy(BAT *b)
diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -42,7 +42,7 @@ struct oidtreenode {
};
 };
 
-static int
+static bool
 OIDTreeMaybeInsert(struct oidtreenode *tree, oid o, BUN allocated)
 {
struct oidtreenode **nodep;
@@ -50,12 +50,12 @@ OIDTreeMaybeInsert(struct oidtreenode *t
if (allocated == 0) {
tree->left = tree->right = NULL;
tree->o = o;
-   return 1;
+   return true;
}
nodep = &tree;
while (*nodep) {
if (o == (*nodep)->o)
-   return 0;
+   return false;
if (o < (*nodep)->o)
nodep = &(*nodep)->left;
else
@@ -64,7 +64,7 @@ OIDTreeMaybeInsert(struct oidtreenode *t
*nodep = &tree[allocated];
tree[allocated].left = tree[allocated].right = NULL;
tree[allocated].o = o;
-   return 1;
+   return true;
 }
 
 /* inorder traversal, gives us a sorted BAT */
@@ -134,19 +134,14 @@ do_batsample(oid hseq, BUN cnt, BUN n, r
return NULL;
}
 
+   if (lock)
+   MT_lock_set(lock);
/* generate a list of random numbers; note we use the
 * "tree" array, but we use the value from each location
 * before it is overwritten by the use as part of the
 * binary tree */
-   if (lock) {
-   MT_lock_set(lock);
-   for (rescnt = 0; rescnt < n; rescnt++)
-   tree[rescnt].r = next(rse);
-   MT_lock_unset(lock);
-   } else {
-   for (rescnt = 0; rescnt < n; rescnt++)
-   tree[rescnt].r = next(rse);
-   }
+   for (rescnt = 0; rescnt < n; rescnt++)
+   tree[rescnt].r = next(rse);
 
/* while we do not have enough sample OIDs yet */
BUN rnd = 0;
@@ -156,12 +151,8 @@ do_batsample(oid hseq, BUN cnt, BUN n, r
if (rnd == n) {
   

MonetDB: Dec2023 - Print some client information on SIGUSR1.

2023-11-15 Thread Sjoerd Mullender via checkin-list
Changeset: 43fd275d9f3c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/43fd275d9f3c
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_private.h
Branch: Dec2023
Log Message:

Print some client information on SIGUSR1.


diffs (58 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -54,7 +54,7 @@ mal_version(void)
 static void
 MALprintinfo(void)
 {
-   /* we need to start printing MAL info here... */
+   MCprintinfo();
 }
 
 /*
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
@@ -585,3 +585,32 @@ MCvalid(Client tc)
MT_lock_unset(&mal_contextLock);
return 0;
 }
+
+void
+MCprintinfo(void)
+{
+   int nrun = 0, nfinish = 0, nblock = 0;
+   MT_lock_set(&mal_contextLock);
+   for (Client c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
+   switch (c->mode) {
+   case RUNCLIENT:
+   /* running */
+   nrun++;
+   printf("client %d, user %s, using %"PRIu64" bytes of 
transient space\n", c->idx, c->username, (uint64_t) 
ATOMIC_GET(&c->qryctx.datasize));
+   break;
+   case FINISHCLIENT:
+   /* finishing */
+   nfinish++;
+   break;
+   case BLOCKCLIENT:
+   /* blocked */
+   nblock++;
+   break;
+   case FREECLIENT:
+   break;
+   }
+   }
+   MT_lock_unset(&mal_contextLock);
+   printf("%d active clients, %d finishing clients, %d blocked clients\n",
+  nrun, nfinish, nblock);
+}
diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h
--- a/monetdb5/mal/mal_private.h
+++ b/monetdb5/mal/mal_private.h
@@ -78,3 +78,6 @@ void mal_runtime_reset(void)
 
 char *dupError(const char *err)
__attribute__((__visibility__("hidden"), __returns_nonnull__));
+
+void MCprintinfo(void)
+   __attribute__((__visibility__("hidden")));
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Print since when a client is idle (if indeed ...

2023-11-15 Thread Sjoerd Mullender via checkin-list
Changeset: fd971fd3d855 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fd971fd3d855
Modified Files:
monetdb5/mal/mal_client.c
Branch: Dec2023
Log Message:

Print since when a client is idle (if indeed it is).


diffs (22 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
@@ -590,13 +590,17 @@ void
 MCprintinfo(void)
 {
int nrun = 0, nfinish = 0, nblock = 0;
+
MT_lock_set(&mal_contextLock);
for (Client c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
switch (c->mode) {
case RUNCLIENT:
/* running */
nrun++;
-   printf("client %d, user %s, using %"PRIu64" bytes of 
transient space\n", c->idx, c->username, (uint64_t) 
ATOMIC_GET(&c->qryctx.datasize));
+   if (c->idle)
+   printf("client %d, user %s, using %"PRIu64" 
bytes of transient space, idle since %s", c->idx, c->username, (uint64_t) 
ATOMIC_GET(&c->qryctx.datasize), ctime(&c->idle));
+   else
+   printf("client %d, user %s, using %"PRIu64" 
bytes of transient space\n", c->idx, c->username, (uint64_t) 
ATOMIC_GET(&c->qryctx.datasize));
break;
case FINISHCLIENT:
/* finishing */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Removed unused logger fields.

2023-11-15 Thread Sjoerd Mullender via checkin-list
Changeset: ec18220e70d7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ec18220e70d7
Modified Files:
gdk/gdk_logger_internals.h
Branch: Dec2023
Log Message:

Removed unused logger fields.


diffs (12 lines):

diff --git a/gdk/gdk_logger_internals.h b/gdk/gdk_logger_internals.h
--- a/gdk/gdk_logger_internals.h
+++ b/gdk/gdk_logger_internals.h
@@ -40,8 +40,6 @@ struct logger {
int8_t type_id[128];/* mapping from GDK type nr to logger type id */
 
// CHECK writer only
-   lng end;
-   ulng* writer_end;
lng total_cnt; /* When logging the content of a bats in multiple runs, 
total_cnt is used the very first to signal this and keep track in the logging*/
void *rbuf;
size_t rbufsize;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Dec2023 branch.

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

Merge with Dec2023 branch.


diffs (truncated from 975 to 300 lines):

diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c
--- a/clients/mapilib/connect.c
+++ b/clients/mapilib/connect.c
@@ -111,7 +111,9 @@ scan_sockets(Mapi mid)
errmsg = allocated_errmsg;
}
if (errmsg) {
-   return mapi_setError(mid, errmsg, __func__, MERROR);
+   MapiMsg err = mapi_setError(mid, errmsg, __func__, MERROR);
+   free(allocated_errmsg);
+   return err;
}
return establish_connection(mid);
 }
@@ -697,11 +699,13 @@ mapi_handshake(Mapi mid)
) {
mapi_close_handle(hdl);
close_connection(mid);
-   return mapi_printError(
+   MapiMsg err = mapi_printError(
mid, __func__, MERROR,
"%s: %s",
error_message ? error_message : 
"invalid redirect",
red);
+   free(error_message);
+   return err;
}
 
if (strncmp("mapi:merovingian", red, 16) == 0) {
diff --git a/clients/mapilib/connect_openssl.c 
b/clients/mapilib/connect_openssl.c
--- a/clients/mapilib/connect_openssl.c
+++ b/clients/mapilib/connect_openssl.c
@@ -342,21 +342,25 @@ wrap_tls(Mapi mid, SOCKET sock)
BIO_free_all(bio); // drops first ref
BIO_free_all(bio); // drops second ref
free(hostcolonport);
-   return croak_openssl(mid, __func__, "openssl_rstream: %s", 
mnstr_peek_error(rstream));
+   msg = croak_openssl(mid, __func__, "openssl_rstream: %s", 
mnstr_peek_error(rstream));
+   close_stream(rstream);
+   return msg;
}
// On error: free 'bio' and close 'rstream'.
stream *wstream = openssl_wstream(hostcolonport ? hostcolonport : "ssl 
wstream", bio);
free(hostcolonport);
if (wstream == NULL || mnstr_errnr(wstream) != MNSTR_NO__ERROR) {
BIO_free_all(bio);
-   mnstr_close(rstream);
-   return croak_openssl(mid, __func__, "openssl_wstream: %s", 
mnstr_peek_error(wstream));
+   close_stream(rstream);
+   msg = croak_openssl(mid, __func__, "openssl_wstream: %s", 
mnstr_peek_error(wstream));
+   close_stream(wstream);
+   return msg;
}
// On error: free 'rstream' and 'wstream'.
msg = mapi_wrap_streams(mid, rstream, wstream);
if (msg != MOK) {
-   mnstr_close(rstream);
-   mnstr_close(wstream);
+   close_stream(rstream);
+   close_stream(wstream);
return msg;
}
// 'rstream' and 'wstream' are part of 'mid' now.
diff --git a/clients/mapilib/connect_unix.c b/clients/mapilib/connect_unix.c
--- a/clients/mapilib/connect_unix.c
+++ b/clients/mapilib/connect_unix.c
@@ -70,6 +70,7 @@ scan_unix_sockets(Mapi mid)
candidates[ncandidates].port = port;
candidates[ncandidates++].priority = st.st_uid == me ? 
0 : 1;
}
+   closedir(dir);
}
 
mapi_log_record(mid, "CONN", "Found %d Unix domain sockets", 
ncandidates);
@@ -180,5 +181,3 @@ connect_socket_unix(Mapi mid)
 
return wrap_socket(mid, s);
 }
-
-
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1847,7 +1847,7 @@ set_uri(Mapi mid)
const char *host = msetting_string(mid->settings, MP_HOST);
const char *database = msetting_string(mid->settings, MP_DATABASE);
int port = msetting_long(mid->settings, MP_PORT);
-   size_t urilen = strlen(host) + strlen(database) + 32;
+   size_t urilen = strlen(host) + (database ? strlen(database) : 0) + 32;
char *uri = malloc(urilen);
 
/* uri looks as follows:
diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c
--- a/clients/mapilib/msettings.c
+++ b/clients/mapilib/msettings.c
@@ -572,7 +572,7 @@ validate_certhash(msettings *mp)
if (i < sizeof(mp->certhash_digits_buffer) - 1)
mp->certhash_digits_buffer[i++] = tolower(*r);
}
-   mp->certhash_digits_buffer[i++] = '\0';
+   mp->certhash_digits_buffer[i] = '\0';
if (i == 0)
return "certhash: need at least one digit";
 
@@ -844,4 +844,3 @@ msettings_lang_is_sql(const msettings *m
 {
return mp->lang_is_sql;
 }
-
diff --git a/documentation/source/manual_pages/monetdb.rst 
b/documentation/source

MonetDB: Dec2023 - Clean up code a little.

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

Clean up code a little.


diffs (16 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3052,10 +3052,8 @@ check_rotation_conditions(logger *lg)
const lng p = (lng) getfilepos(getFile(lg->current->output_log));
 
const lng log_large = (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) ? 
LOG_MINI : LOG_LARGE;
-   bool res = (lg->saved_id + 1 >= lg->id && 
ATOMIC_GET(&lg->current->drops) > 10) || (p > log_large);
-   if (res)
-   return (ATOMIC_GET(&lg->nr_open_files) < 8);
-   return res;
+   bool res = (p > log_large) || (lg->saved_id + 1 >= lg->id && 
ATOMIC_GET(&lg->current->drops) > 10);
+   return res && (ATOMIC_GET(&lg->nr_open_files) < 8);
 }
 
 gdk_return
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Print some more USR1 information.

2023-11-15 Thread Sjoerd Mullender via checkin-list
Changeset: e136e08c2da6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e136e08c2da6
Modified Files:
gdk/gdk_logger.c
sql/storage/store.c
Branch: Dec2023
Log Message:

Print some more USR1 information.


diffs (30 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3387,8 +3387,12 @@ log_printinfo(logger *lg)
printf("number of catalog entries "BUNFMT", of which "BUNFMT" 
deleted\n",
   lg->catalog_bid->batCount, lg->dcatalog->batCount);
int npend = 0;
-   for (logged_range *p = lg->pending; p; p = p->next)
+   for (logged_range *p = lg->pending; p; p = p->next) {
+   char buf[32];
+   if (p->output_log == NULL ||
+   snprintf(buf, sizeof(buf), ", file size %"PRIu64, 
(uint64_t) getfilepos(getFile(lg->current->output_log))) >= (int) sizeof(buf))
+   buf[0] = 0;
+   printf("pending range "ULLFMT": drops %"PRIu64", last_ts 
%"PRIu64", flushed_ts %"PRIu64", refcount %"PRIu64"%s%s\n", p->id, (uint64_t) 
ATOMIC_GET(&p->drops), (uint64_t) ATOMIC_GET(&p->last_ts), (uint64_t) 
ATOMIC_GET(&p->flushed_ts), (uint64_t) ATOMIC_GET(&p->refcount), buf, p == 
lg->current ? " (current)" : "");
npend++;
-   if (npend > 1)
-   printf("number of pending ranges %d\n", npend);
+   }
 }
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -7392,6 +7392,7 @@ void
 store_printinfo(sqlstore *store)
 {
MT_lock_set(&store->commit);
+   printf("SQL store oldest pending "ULLFMT"\n", store->oldest_pending);
log_printinfo(store->logger);
MT_lock_unset(&store->commit);
 }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Dec2023 - Add tests for new information_schema views

2023-11-15 Thread Martin van Dinther via checkin-list
Changeset: 13403d6262c5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/13403d6262c5
Added Files:
sql/test/information-schema/Tests/check_constraints.test
sql/test/information-schema/Tests/parameters.test
sql/test/information-schema/Tests/referential_constraints.test
sql/test/information-schema/Tests/routines.test
sql/test/information-schema/Tests/sequences.test
sql/test/information-schema/Tests/table_constraints.test
Modified Files:
sql/ChangeLog.Dec2023
sql/test/information-schema/Tests/All
sql/test/information-schema/Tests/character_sets.test
sql/test/information-schema/Tests/columns.test
sql/test/information-schema/Tests/schemata.test
sql/test/information-schema/Tests/tables.test
sql/test/information-schema/Tests/views.test
Branch: Dec2023
Log Message:

Add tests for new information_schema views


diffs (truncated from 605 to 300 lines):

diff --git a/sql/ChangeLog.Dec2023 b/sql/ChangeLog.Dec2023
--- a/sql/ChangeLog.Dec2023
+++ b/sql/ChangeLog.Dec2023
@@ -12,6 +12,7 @@
information_schema.table_constraints
information_schema.referential_constraints
information_schema.routines
+   information_schema.parameters
information_schema.sequences
 
   Most views have been extended (after the standard columns) with MonetDB
diff --git a/sql/test/information-schema/Tests/All 
b/sql/test/information-schema/Tests/All
--- a/sql/test/information-schema/Tests/All
+++ b/sql/test/information-schema/Tests/All
@@ -3,4 +3,9 @@ schemata
 tables
 views
 columns
-
+check_constraints
+table_constraints
+referential_constraints
+routines
+parameters
+sequences
diff --git a/sql/test/information-schema/Tests/character_sets.test 
b/sql/test/information-schema/Tests/character_sets.test
--- a/sql/test/information-schema/Tests/character_sets.test
+++ b/sql/test/information-schema/Tests/character_sets.test
@@ -20,7 +20,8 @@ NULL
 NULL
 
 query ITTT rowsort
-SELECT COUNT(*) AS duplicates, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, 
CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.CHARACTER_SETS
+SELECT COUNT(*) AS duplicates, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, 
CHARACTER_SET_NAME
+ FROM INFORMATION_SCHEMA.CHARACTER_SETS
  GROUP BY CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_NAME
  HAVING COUNT(*) > 1
 
diff --git a/sql/test/information-schema/Tests/check_constraints.test 
b/sql/test/information-schema/Tests/check_constraints.test
new file mode 100644
--- /dev/null
+++ b/sql/test/information-schema/Tests/check_constraints.test
@@ -0,0 +1,17 @@
+query  rowsort
+SELECT
+  CONSTRAINT_CATALOG,
+  CONSTRAINT_SCHEMA,
+  CONSTRAINT_NAME,
+  CHECK_CLAUSE
+FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
+WHERE CONSTRAINT_SCHEMA = '' OR CONSTRAINT_NAME = ''
+
+
+query ITTT rowsort
+SELECT COUNT(*) AS duplicates, CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, 
CONSTRAINT_NAME
+ FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
+ GROUP BY CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME
+ HAVING COUNT(*) > 1
+
+
diff --git a/sql/test/information-schema/Tests/columns.test 
b/sql/test/information-schema/Tests/columns.test
--- a/sql/test/information-schema/Tests/columns.test
+++ b/sql/test/information-schema/Tests/columns.test
@@ -104,7 +104,7 @@ NULL
 NULL
 NULL
 
-query ITTTIITITTTIIIT rowsort
+query ITTTIITITTTIIIIT rowsort
 SELECT
   TABLE_CATALOG,
   TABLE_SCHEMA,
@@ -159,6 +159,7 @@ SELECT
   schema_id,
   table_id,
   column_id,
+  sequence_id,
   is_system,
   comments
 FROM INFORMATION_SCHEMA.COLUMNS
@@ -166,7 +167,8 @@ WHERE TABLE_SCHEMA = '' OR TABLE_NAME = 
 
 
 query I rowsort
-SELECT COUNT(*) AS duplicates, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, 
COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+SELECT COUNT(*) AS duplicates, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, 
COLUMN_NAME
+ FROM INFORMATION_SCHEMA.COLUMNS
  GROUP BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME
  HAVING COUNT(*) > 1
 
diff --git a/sql/test/information-schema/Tests/parameters.test 
b/sql/test/information-schema/Tests/parameters.test
new file mode 100644
--- /dev/null
+++ b/sql/test/information-schema/Tests/parameters.test
@@ -0,0 +1,107 @@
+query TTTITTTIITTTITTITTIIT rowsort
+SELECT
+  SPECIFIC_CATALOG,
+  SPECIFIC_SCHEMA,
+  SPECIFIC_NAME,
+  ORDINAL_POSITION,
+  PARAMETER_MODE,
+  IS_RESULT,
+  AS_LOCATOR,
+  PARAMETER_NAME,
+  FROM_SQL_SPECIFIC_CATALOG,
+  FROM_SQL_SPECIFIC_SCHEMA,
+  FROM_SQL_SPECIFIC_NAME,
+  TO_SQL_SPECIFIC_CATALOG,
+  TO_SQL_SPECIFIC_SCHEMA,
+  TO_SQL_SPECIFIC_NAME,
+  DATA_TYPE,
+  CHARACTER_MAXIMUM_LENGTH,
+  CHARACTER_OCTET_LENGTH,
+  CHARACTER_SET_CATALOG,
+  CHARACTER_SET_SCHEMA,
+  CHARACTER_SET_NAME,
+  COLLATION_CATALOG,
+  COLLATION_SCHEMA,
+  COLLATION_NAME,
+  NUMERIC_PRECISION,
+  NUMERIC_PRECISION_RADIX,
+  NUMERIC_SCALE,
+  DATETIME_PRECISION,
+  INTERVAL_TYPE,
+  INTE

MonetDB: default - Merge with Dec2023 branch.

2023-11-15 Thread Martin van Dinther via checkin-list
Changeset: c0bab5f1f1fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c0bab5f1f1fe
Branch: default
Log Message:

Merge with Dec2023 branch.


diffs (truncated from 648 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
@@ -3052,10 +3052,8 @@ check_rotation_conditions(logger *lg)
const lng p = (lng) getfilepos(getFile(lg->current->output_log));
 
const lng log_large = (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) ? 
LOG_MINI : LOG_LARGE;
-   bool res = (lg->saved_id + 1 >= lg->id && 
ATOMIC_GET(&lg->current->drops) > 10) || (p > log_large);
-   if (res)
-   return (ATOMIC_GET(&lg->nr_open_files) < 8);
-   return res;
+   bool res = (p > log_large) || (lg->saved_id + 1 >= lg->id && 
ATOMIC_GET(&lg->current->drops) > 10);
+   return res && (ATOMIC_GET(&lg->nr_open_files) < 8);
 }
 
 gdk_return
@@ -3389,8 +3387,12 @@ log_printinfo(logger *lg)
printf("number of catalog entries "BUNFMT", of which "BUNFMT" 
deleted\n",
   lg->catalog_bid->batCount, lg->dcatalog->batCount);
int npend = 0;
-   for (logged_range *p = lg->pending; p; p = p->next)
+   for (logged_range *p = lg->pending; p; p = p->next) {
+   char buf[32];
+   if (p->output_log == NULL ||
+   snprintf(buf, sizeof(buf), ", file size %"PRIu64, 
(uint64_t) getfilepos(getFile(lg->current->output_log))) >= (int) sizeof(buf))
+   buf[0] = 0;
+   printf("pending range "ULLFMT": drops %"PRIu64", last_ts 
%"PRIu64", flushed_ts %"PRIu64", refcount %"PRIu64"%s%s\n", p->id, (uint64_t) 
ATOMIC_GET(&p->drops), (uint64_t) ATOMIC_GET(&p->last_ts), (uint64_t) 
ATOMIC_GET(&p->flushed_ts), (uint64_t) ATOMIC_GET(&p->refcount), buf, p == 
lg->current ? " (current)" : "");
npend++;
-   if (npend > 1)
-   printf("number of pending ranges %d\n", npend);
+   }
 }
diff --git a/sql/ChangeLog.Dec2023 b/sql/ChangeLog.Dec2023
--- a/sql/ChangeLog.Dec2023
+++ b/sql/ChangeLog.Dec2023
@@ -12,6 +12,7 @@
information_schema.table_constraints
information_schema.referential_constraints
information_schema.routines
+   information_schema.parameters
information_schema.sequences
 
   Most views have been extended (after the standard columns) with MonetDB
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -7392,6 +7392,7 @@ void
 store_printinfo(sqlstore *store)
 {
MT_lock_set(&store->commit);
+   printf("SQL store oldest pending "ULLFMT"\n", store->oldest_pending);
log_printinfo(store->logger);
MT_lock_unset(&store->commit);
 }
diff --git a/sql/test/information-schema/Tests/All 
b/sql/test/information-schema/Tests/All
--- a/sql/test/information-schema/Tests/All
+++ b/sql/test/information-schema/Tests/All
@@ -3,4 +3,9 @@ schemata
 tables
 views
 columns
-
+check_constraints
+table_constraints
+referential_constraints
+routines
+parameters
+sequences
diff --git a/sql/test/information-schema/Tests/character_sets.test 
b/sql/test/information-schema/Tests/character_sets.test
--- a/sql/test/information-schema/Tests/character_sets.test
+++ b/sql/test/information-schema/Tests/character_sets.test
@@ -20,7 +20,8 @@ NULL
 NULL
 
 query ITTT rowsort
-SELECT COUNT(*) AS duplicates, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, 
CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.CHARACTER_SETS
+SELECT COUNT(*) AS duplicates, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, 
CHARACTER_SET_NAME
+ FROM INFORMATION_SCHEMA.CHARACTER_SETS
  GROUP BY CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_NAME
  HAVING COUNT(*) > 1
 
diff --git a/sql/test/information-schema/Tests/check_constraints.test 
b/sql/test/information-schema/Tests/check_constraints.test
new file mode 100644
--- /dev/null
+++ b/sql/test/information-schema/Tests/check_constraints.test
@@ -0,0 +1,17 @@
+query  rowsort
+SELECT
+  CONSTRAINT_CATALOG,
+  CONSTRAINT_SCHEMA,
+  CONSTRAINT_NAME,
+  CHECK_CLAUSE
+FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
+WHERE CONSTRAINT_SCHEMA = '' OR CONSTRAINT_NAME = ''
+
+
+query ITTT rowsort
+SELECT COUNT(*) AS duplicates, CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, 
CONSTRAINT_NAME
+ FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
+ GROUP BY CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME
+ HAVING COUNT(*) > 1
+
+
diff --git a/sql/test/information-schema/Tests/columns.test 
b/sql/test/information-schema/Tests/columns.test
--- a/sql/test/information-schema/Tests/columns.test
+++ b/sql/test/information-schema/Tests/columns.test
@@ -104,7 +104,7 @@ NULL
 NULL
 NULL
 
-query ITTTIITITTTIIIT rowsort
+query ITTTIITITTTIIIIT rowsort
 SELECT
   TABLE_CATALOG,
   TABLE_SCHEMA,
@@ -159,6 +159,7 @@ SELECT
   schema_id,
   table_id,
   column_id,
+  sequence_id,
   is_system,
   co