Changeset: bb3cf11c3363 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bb3cf11c3363
Branch: default
Log Message:
Merge with Mar2025 branch
diffs (195 lines):
diff --git a/common/stream/stdio_stream.c b/common/stream/stdio_stream.c
--- a/common/stream/stdio_stream.c
+++ b/common/stream/stdio_stream.c
@@ -142,7 +142,7 @@ file_fsync(stream *s)
#endif
#endif
)) {
- mnstr_set_error(s, MNSTR_WRITE_ERROR, "fsync failed");
+ mnstr_set_error_errno(s, MNSTR_WRITE_ERROR, "fsync failed");
return -1;
}
return 0;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -239,7 +239,7 @@ log_write_format(logger *lg, logformat *
mnstr_write(lg->current->output_log, &data->flag, 1, 1) == 1 &&
mnstr_writeInt(lg->current->output_log, data->id))
return GDK_SUCCEED;
- TRC_CRITICAL(GDK, "write failed\n");
+ /* error message is generated by caller */
return GDK_FAIL;
}
@@ -292,7 +292,8 @@ log_write_id(logger *lg, int id)
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");
+ const char *err = mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " : "", err ? err :
"");
return GDK_FAIL;
}
@@ -3065,6 +3066,8 @@ log_bat_persists(logger *lg, BAT *b, log
if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR ||
log_write_format(lg, &l) != GDK_SUCCEED ||
mnstr_write(lg->current->output_log, &ta, 1, 1) != 1) {
+ const char *err =
mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " :
"", err ? err : "");
log_unlock(lg);
ATOMIC_DEC(&lg->current->refcount);
return GDK_FAIL;
@@ -3099,7 +3102,8 @@ log_bat_transient(logger *lg, log_id id)
if (!LOG_DISABLED(lg)) {
if (log_write_format(lg, &l) != GDK_SUCCEED) {
- TRC_CRITICAL(GDK, "write failed\n");
+ const char *err =
mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " :
"", err ? err : "");
log_unlock(lg);
ATOMIC_DEC(&lg->current->refcount);
return GDK_FAIL;
@@ -3127,6 +3131,10 @@ log_bat_group(logger *lg, log_id id)
l.flag = LOG_BAT_GROUP;
l.id = id;
gdk_return r = log_write_format(lg, &l);
+ if (r != GDK_SUCCEED) {
+ const char *err = mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " : "", err ?
err : "");
+ }
return r;
}
@@ -3275,6 +3283,10 @@ log_tend(logger *lg)
if ((result = log_write_format(lg, &l)) == GDK_SUCCEED)
ATOMIC_INC(&lg->nr_flushers);
+ else {
+ const char *err = mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " : "", err ?
err : "");
+ }
return result;
}
@@ -3289,8 +3301,11 @@ do_flush(logged_range *range)
ulng ts = ATOMIC_GET(&range->last_ts);
if (mnstr_flush(output_log, MNSTR_FLUSH_DATA) ||
- (!(ATOMIC_GET(&GDKdebug) & NOSYNCMASK) && mnstr_fsync(output_log)))
+ (!(ATOMIC_GET(&GDKdebug) & NOSYNCMASK) && mnstr_fsync(output_log)))
{
+ const char *err = mnstr_peek_error(output_log);
+ TRC_CRITICAL(GDK, "flush failed%s%s\n", err ? ": " : "", err ?
err : "");
return GDK_FAIL;
+ }
ATOMIC_SET(&range->flushed_ts, ts);
return GDK_SUCCEED;
}
@@ -3339,6 +3354,7 @@ log_tflush(logger *lg, ulng file_id, uln
}
log_tdone(lg, frange, commit_ts);
+ gdk_return rc = GDK_SUCCEED;
if ((ulng) ATOMIC_GET(&frange->flushed_ts) < commit_ts) {
/* delay needed ? */
@@ -3346,7 +3362,7 @@ log_tflush(logger *lg, ulng file_id, uln
flush_lock(lg);
/* check it one more time */
if ((ulng) ATOMIC_GET(&frange->flushed_ts) < commit_ts)
- do_flush(frange);
+ rc = do_flush(frange);
flush_unlock(lg);
}
/* else somebody else has flushed our log file */
@@ -3367,7 +3383,7 @@ log_tflush(logger *lg, ulng file_id, uln
}
rotation_unlock(lg);
- return GDK_SUCCEED;
+ return rc;
}
static gdk_return
@@ -3386,7 +3402,8 @@ log_tsequence_(logger *lg, int seq, lng
if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR ||
log_write_format(lg, &l) != GDK_SUCCEED ||
!mnstr_writeLng(lg->current->output_log, val)) {
- TRC_CRITICAL(GDK, "write failed\n");
+ const char *err = mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " : "", err ?
err : "");
ATOMIC_DEC(&lg->current->refcount);
return GDK_FAIL;
}
@@ -3573,6 +3590,8 @@ log_tstart(logger *lg, bool flushnow, ul
TRC_DEBUG(WAL, "tstart %d\n", lg->tid);
if (log_write_format(lg, &l) != GDK_SUCCEED) {
+ const char *err = mnstr_peek_error(lg->current->output_log);
+ TRC_CRITICAL(GDK, "write failed%s%s\n", err ? ": " : "", err ?
err : "");
ATOMIC_DEC(&lg->current->refcount);
return GDK_FAIL;
}
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
@@ -92,10 +92,10 @@ static str master_password = NULL;
static void
CLIENTprintinfo(void)
{
- int nrun = 0, nfinish = 0, nblock = 0;
+ int nrun = 0, nfinish = 0, nblock = 0, i = 0;
char mmbuf[64];
char tmbuf[64];
- char trbuf[64];
+ char trbuf[128];
char chbuf[64];
char cabuf[64];
char clbuf[64];
@@ -125,8 +125,14 @@ CLIENTprintinfo(void)
strftime(tmbuf, sizeof(tmbuf), ", busy since %F
%H:%M:%S%z", &tm);
} else
tmbuf[0] = 0;
- if (c->sqlcontext && ((backend *) c->sqlcontext)->mvc
&& ((backend *) c->sqlcontext)->mvc->session && ((backend *)
c->sqlcontext)->mvc->session->tr && ((backend *)
c->sqlcontext)->mvc->session->tr->active)
- snprintf(trbuf, sizeof(trbuf), ", active
transaction, ts: "ULLFMT, ((backend *) c->sqlcontext)->mvc->session->tr->ts);
+ if (c->sqlcontext && ((backend *) c->sqlcontext)->mvc &&
+ ((backend *) c->sqlcontext)->mvc->session &&
+ ((backend *) c->sqlcontext)->mvc->session->tr) {
+ if (((backend *)
c->sqlcontext)->mvc->session->tr->active)
+ i = snprintf(trbuf, sizeof(trbuf), ",
active transaction, ts: "ULLFMT, ((backend *)
c->sqlcontext)->mvc->session->tr->ts);
+ i += snprintf(trbuf + i, sizeof(trbuf) - i, ",
prepared queries: %d", qc_size(((backend *) c->sqlcontext)->mvc->qc));
+ snprintf(trbuf + i, sizeof(trbuf) - i, ", open
resultsets: %d", res_tables_count(((backend *) c->sqlcontext)->results));
+ }
else
trbuf[0] = 0;
if (c->client_hostname)
diff --git a/sql/storage/bat/res_table.c b/sql/storage/bat/res_table.c
--- a/sql/storage/bat/res_table.c
+++ b/sql/storage/bat/res_table.c
@@ -174,3 +174,14 @@ res_tables_find(res_table *results, int
}
return NULL;
}
+
+int
+res_tables_count(res_table *results)
+{
+ int i = 0;
+ while (results) {
+ i++;
+ results = results->next;
+ }
+ return i;
+}
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
@@ -330,6 +330,7 @@ extern void res_table_destroy(res_table
extern res_table *res_tables_remove(res_table *results, res_table *t);
sql_export void res_tables_destroy(res_table *results);
extern res_table *res_tables_find(res_table *results, int res_id);
+extern int res_tables_count(res_table *results);
extern struct sqlstore *store_init(int debug, store_type store, int readonly,
int singleuser);
extern void store_exit(struct sqlstore *store);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]