Changeset: eed741702c53 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eed741702c53
Modified Files:
gdk/gdk_logger.c
Branch: Sep2022
Log Message:
synchronize log_tdone
diffs (55 lines):
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2826,17 +2826,14 @@ new_logfile(logger *lg, stream* output_l
{
assert(!LOG_DISABLED(lg));
- MT_lock_set(&lg->rotation_lock);
assert(lg->flushing_output_log);
lg->flushing_output_log = false;
if (lg->id != id) {
/* lg->output_log was rotated during the flush */
assert(lg->output_log != output_log && lg->id > id);
close_stream(output_log);
- MT_lock_unset(&lg->rotation_lock);
return GDK_SUCCEED;
}
- MT_lock_unset(&lg->rotation_lock);
const lng log_large = (GDKdebug & FORCEMITOMASK)?LOG_MINI:LOG_LARGE;
@@ -2845,7 +2842,6 @@ new_logfile(logger *lg, stream* output_l
if (p == -1)
return GDK_FAIL;
if (((!lg->pending || !lg->pending->next) && lg->drops > 100000) || p >
log_large || (lg->end*1024) > log_large) {
- log_lock(lg);
if (ATOMIC_GET(&lg->refcount) == 1) {
lg->id++;
log_close_output(lg);
@@ -2856,7 +2852,6 @@ new_logfile(logger *lg, stream* output_l
// Delegate wal rotation to next writer or last flusher.
lg->request_rotation = true;
}
- log_unlock(lg);
}
return result;
}
@@ -2937,6 +2932,8 @@ flush_queue_length(logger *lg)
static void
log_tdone(logger *lg, ulng commit_ts)
{
+ MT_lock_set(&lg->rotation_lock);
+ log_lock(lg);
if (lg->debug & 1)
fprintf(stderr, "#log_tdone " LLFMT "\n", commit_ts);
@@ -2947,6 +2944,8 @@ log_tdone(logger *lg, ulng commit_ts)
ulng id = lg->id;
if (lg->flushing_output_log && new_logfile(lg, output_log, id) !=
GDK_SUCCEED)
GDKfatal("Could not create new log file\n");
+ log_unlock(lg);
+ MT_lock_unset(&lg->rotation_lock);
}
gdk_return
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]