Changeset: 33081d749148 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/33081d749148
Modified Files:
        gdk/gdk_logger.c
Branch: pax-log
Log Message:

Rotate only after last commit message has been written to log file.


diffs (40 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2969,8 +2969,8 @@ log_tend(logger *lg)
        l.flag = LOG_END;
        l.id = lg->tid;
 
-       result = log_write_format(lg, &l);
-       (void) ATOMIC_DEC(&lg->refcount);
+       if ((result = log_write_format(lg, &l)) != GDK_SUCCEED)
+               (void) ATOMIC_DEC(&lg->refcount);
 
        return result;
 }
@@ -3017,12 +3017,6 @@ log_tcommit(logger *lg, ulng commit_ts, 
                 * Only used for checking consistency when replaying the log.*/
                l.id = cql;
 
-               /* if the log file being rotated at the moment,
-                * wait for it to finish*/
-               MT_lock_set(&lg->rotation_lock);
-               (void) ATOMIC_INC(&lg->refcount);
-               MT_lock_unset(&lg->rotation_lock);
-
                if ((result = log_write_format(lg, &l)) != GDK_SUCCEED) {
                        (void) ATOMIC_DEC(&lg->refcount);
                        return result;
@@ -3030,10 +3024,10 @@ log_tcommit(logger *lg, ulng commit_ts, 
                else {
                        log_queue_truncate_left(cq, cql);
                }
-
-               (void) ATOMIC_DEC(&lg->refcount);
        }
 
+       (void) ATOMIC_DEC(&lg->refcount);
+
        return GDK_SUCCEED;
 }
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to