Changeset: 24fa96929ec9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/24fa96929ec9
Modified Files:
gdk/gdk_logger.c
Branch: Jun2023
Log Message:
Close output_log as soon as we don't need it open anymore.
I.e. when the refcount is 1 and the logged_range struct is not the
current.
diffs (37 lines):
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2421,10 +2421,15 @@ log_cleanup_range(logger *lg, ulng id)
static void
do_rotate(logger *lg)
{
- logged_range *next = lg->current->next;
+ logged_range *cur = lg->current;
+ logged_range *next = cur->next;
if (next) {
assert(ATOMIC_GET(&next->refcount) == 1);
- lg->current = lg->current->next;
+ lg->current = next;
+ if (ATOMIC_GET(&cur->refcount) == 1) {
+ close_stream(cur->output_log);
+ cur->output_log = NULL;
+ }
}
}
@@ -3099,7 +3104,14 @@ log_tflush(logger *lg, ulng file_id, uln
}
/* else somebody else has flushed our log file */
- ATOMIC_DEC(&frange->refcount);
+ if (ATOMIC_DEC(&frange->refcount) == 1) {
+ rotation_lock(lg);
+ if (frange != lg->current) {
+ close_stream(frange->output_log);
+ frange->output_log = NULL;
+ }
+ rotation_unlock(lg);
+ }
if (ATOMIC_DEC(&lg->nr_flushers) == 0) {
/* I am the last flusher
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]