Skip to content

Commit

Permalink
Merge pull request #14506 from SimFG/main
Browse files Browse the repository at this point in the history
wal: Fix the `walWriteBytes` metric
  • Loading branch information
ahrtr authored Sep 26, 2022
2 parents 4513671 + 5702765 commit 434c7c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
5 changes: 0 additions & 5 deletions pkg/ioutil/pagewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ func (pw *PageWriter) Flush() error {
return err
}

// FlushN flushes buffered data and returns the number of written bytes.
func (pw *PageWriter) FlushN() (int, error) {
return pw.flush()
}

func (pw *PageWriter) flush() (int, error) {
if pw.bufferedBytes == 0 {
return 0, nil
Expand Down
6 changes: 2 additions & 4 deletions server/storage/wal/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ func encodeFrameSize(dataBytes int) (lenField uint64, padBytes int) {

func (e *encoder) flush() error {
e.mu.Lock()
n, err := e.bw.FlushN()
e.mu.Unlock()
walWriteBytes.Add(float64(n))
return err
defer e.mu.Unlock()
return e.bw.Flush()
}

func writeUint64(w io.Writer, n uint64, buf []byte) error {
Expand Down

0 comments on commit 434c7c4

Please sign in to comment.