func (w *WAL) sync() error { if w.encoder != nil { if err := w.encoder.flush(); err != nil { return err } } start := time.Now() err := fileutil.Fdatasync(w.tail().File) syncDurations.Observe(float64(time.Since(start)) / float64(time.Second)) return err }
func (w *WAL) sync() error { if w.encoder != nil { if err := w.encoder.flush(); err != nil { return err } } start := time.Now() err := fileutil.Fdatasync(w.tail().File) duration := time.Since(start) if duration > warnSyncDuration { plog.Warningf("sync duration of %v, expected less than %v", duration, warnSyncDuration) } syncDurations.Observe(duration.Seconds()) return err }