Changeset: b4f297675ec0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b4f297675ec0
Modified Files:
        gdk/gdk_logger.c
Branch: multi-cachelock
Log Message:

Back to the main suspect: e3bf73edad44


diffs (45 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2789,12 +2789,9 @@ new_logfile(logger *lg)
        const lng log_large = (GDKdebug & FORCEMITOMASK)?LOG_MINI:LOG_LARGE;
 
        gdk_return result = GDK_SUCCEED;
-       MT_lock_set(&lg->rotation_lock);
        const lng p = (lng) getfilepos(getFile(lg->output_log));
-       if (p == -1) {
-               MT_lock_unset(&lg->rotation_lock);
+       if (p == -1)
                return GDK_FAIL;
-       }
        if (( p > log_large || (lg->end*1024) > log_large )) {
                log_lock(lg);
                if (ATOMIC_GET(&lg->refcount) == 1) {
@@ -2809,7 +2806,6 @@ new_logfile(logger *lg)
                }
                log_unlock(lg);
        }
-       MT_lock_unset(&lg->rotation_lock);
        return result;
 }
 
@@ -2916,16 +2912,19 @@ log_tflush(logger* lg, ulng log_file_id,
                        /* number of transactions in the group commit */
                        const int fqueue_length = flush_queue_length(lg);
                        /* flush + fsync */
+                       MT_lock_set(&lg->rotation_lock);
                        if (mnstr_flush(lg->output_log, MNSTR_FLUSH_DATA) ||
                                        (!(GDKdebug & NOSYNCMASK) && 
mnstr_fsync(lg->output_log)) ||
                                        new_logfile(lg) != GDK_SUCCEED) {
                                /* flush failed */
+                               MT_lock_unset(&lg->rotation_lock);
                                MT_lock_unset(&lg->flush_lock);
                                (void) ATOMIC_DEC(&lg->refcount);
                                return GDK_FAIL;
                        }
                        else {
                                /* flush succeeded */
+                               MT_lock_unset(&lg->rotation_lock);
                                left_truncate_flush_queue(lg, fqueue_length);
                        }
                }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to