Changeset: e7b17001fbb3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e7b17001fbb3
Modified Files:
common/stream/stdio_stream.c
common/stream/stream.c
sql/storage/store.c
Branch: Jan2022
Log Message:
merged with jul2021
diffs (65 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
@@ -55,7 +55,8 @@ file_write(stream *restrict s, const voi
if (elmsize && cnt) {
size_t rc = fwrite(buf, elmsize, cnt, fp);
- if (!rc && ferror(fp)) {
+ if (rc != cnt) {
+ // only happens if fwrite encountered an error.
mnstr_set_error_errno(s, MNSTR_WRITE_ERROR, "write
error");
return -1;
}
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -72,11 +72,25 @@ static struct tl_error_buf *get_tl_error
static pthread_key_t tl_error_key;
+static void
+clear_main_tl_error_buf(void)
+{
+ void *p = pthread_getspecific(tl_error_key);
+ if (p != NULL) {
+ pthread_setspecific(tl_error_key, NULL);
+ free(p);
+ }
+}
+
static int
tl_error_init(void)
{
if (pthread_key_create(&tl_error_key, free) != 0)
return -1;
+ // Turns out the destructor registered with pthread_key_create() does
not
+ // always run for the main thread. This atexit hook clears the main
thread's
+ // error buffer to avoid this being reported as a memory leak.
+ atexit(clear_main_tl_error_buf);
return 0;
}
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2229,6 +2229,7 @@ store_apply_deltas(sqlstore *store)
store_lock(store);
ulng oldest = store_oldest_pending(store);
store_unlock(store);
+ TRC_DEBUG(SQL_STORE, "Store aplly deltas (" ULLFMT ")\n", oldest-1);
if (oldest)
res = store->logger_api.flush(store, oldest-1);
flusher.working = false;
@@ -2347,8 +2348,10 @@ store_manager(sqlstore *store)
MT_sleep_ms(sleeptime);
flusher.countdown_ms -= sleeptime;
MT_lock_set(&store->flush);
- if (store->logger_api.changes(store) <= 0)
+ if (store->logger_api.changes(store) <= 0) {
+ TRC_DEBUG(SQL_STORE, "Store flusher, no changes\n");
continue;
+ }
if (GDKexiting())
break;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]