Merge pull request #14506 from SimFG/main

wal: Fix the `walWriteBytes` metric
This commit is contained in:
Benjamin Wang 2022-09-26 09:36:07 +08:00 committed by GitHub
commit 434c7c4309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -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

View File

@ -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 {