From 49223b2df217f4c5db24126b00f82a623f0f91f7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 15 Sep 2012 14:38:39 +0200 Subject: [PATCH] avoid that a system crash can cause messages to be propagated twice fdatasync() the journal after creating the pair record and recording the TUID, but before the message propagation actually starts. all other writes to the journal are not flushed, as they will at worst cause some unnecessary network traffic without visible effect. --- src/sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sync.c b/src/sync.c index cf67ae1..3a1f386 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1202,6 +1202,7 @@ box_loaded( int sts, void *aux ) cv->srec = srec; cv->msg = tmsg; Fprintf( svars->jfp, "# %d %d %." stringify(TUIDL) "s\n", srec->uid[M], srec->uid[S], srec->tuid ); + fdatasync( fileno( svars->jfp ) ); debug( " -> %sing message, TUID %." stringify(TUIDL) "s\n", str_hl[t], srec->tuid ); if (copy_msg( cv )) return;