From 7750f387b066e279f656fdb05a751d1e3f7d6372 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 8 Apr 2015 16:08:48 -0700 Subject: [PATCH] wal: better log msg --- wal/util.go | 2 +- wal/wal.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wal/util.go b/wal/util.go index c80fbdef2..447129e72 100644 --- a/wal/util.go +++ b/wal/util.go @@ -67,7 +67,7 @@ func checkWalNames(names []string) []string { wnames := make([]string, 0) for _, name := range names { if _, _, err := parseWalName(name); err != nil { - log.Printf("wal: parse %s error: %v", name, err) + log.Printf("wal: ignored file %v in wal", name) continue } wnames = append(wnames, name) diff --git a/wal/wal.go b/wal/wal.go index c68d66f02..0c662da18 100644 --- a/wal/wal.go +++ b/wal/wal.go @@ -287,8 +287,8 @@ func (w *WAL) Cut() error { fpath := path.Join(w.dir, walName(w.seq+1, w.enti+1)) ftpath := fpath + ".tmp" - // create a temp wal file with name sequence + 1 - ft, err := os.OpenFile(ftpath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600) + // create a temp wal file with name sequence + 1, or tuncate the existing one + ft, err := os.OpenFile(ftpath, os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return err }