Changeset: 56b8fd7e94c0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=56b8fd7e94c0
Modified Files:
        gdk/gdk_logger.c
Branch: Jul2015
Log Message:

Reduce number of I/Os.


diffs (47 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2294,7 +2294,7 @@ log_abort(logger *lg)
 }
 
 static int
-log_sequence_(logger *lg, int seq, lng val)
+log_sequence_(logger *lg, int seq, lng val, int flush)
 {
        logformat l;
 
@@ -2307,8 +2307,8 @@ log_sequence_(logger *lg, int seq, lng v
 
        if (log_write_format(lg, &l) == LOG_ERR ||
            !mnstr_writeLng(lg->log, val) ||
-           mnstr_flush(lg->log) ||
-           mnstr_fsync(lg->log) ||
+           (flush && mnstr_flush(lg->log)) ||
+           (flush && mnstr_fsync(lg->log)) ||
            pre_allocate(lg) != GDK_SUCCEED) {
                fprintf(stderr, "!ERROR: log_sequence_: write failed\n");
                return LOG_ERR;
@@ -2330,7 +2330,13 @@ log_sequence_nrs(logger *lg)
                oid pos = p;
 
                if (BUNfnd(lg->dseqs, &pos) == BUN_NONE)
-                       ok &= log_sequence_(lg, *id, *val);
+                       ok |= log_sequence_(lg, *id, *val, 0);
+       }
+       if (ok != LOG_OK ||
+           mnstr_flush(lg->log) ||
+           mnstr_fsync(lg->log)) {
+               fprintf(stderr, "!ERROR: log_sequence_nrs: write failed\n");
+               return LOG_ERR;
        }
        return ok;
 }
@@ -2355,7 +2361,7 @@ log_sequence(logger *lg, int seq, lng va
                BUNappend(lg->seqs_id, &seq, FALSE);
                BUNappend(lg->seqs_val, &val, FALSE);
        }
-       return log_sequence_(lg, seq, val);
+       return log_sequence_(lg, seq, val, 1);
 }
 
 static int
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to