mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14506 from SimFG/main
wal: Fix the `walWriteBytes` metric
This commit is contained in:
commit
434c7c4309
@ -104,11 +104,6 @@ func (pw *PageWriter) Flush() error {
|
|||||||
return err
|
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) {
|
func (pw *PageWriter) flush() (int, error) {
|
||||||
if pw.bufferedBytes == 0 {
|
if pw.bufferedBytes == 0 {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
|
@ -109,10 +109,8 @@ func encodeFrameSize(dataBytes int) (lenField uint64, padBytes int) {
|
|||||||
|
|
||||||
func (e *encoder) flush() error {
|
func (e *encoder) flush() error {
|
||||||
e.mu.Lock()
|
e.mu.Lock()
|
||||||
n, err := e.bw.FlushN()
|
defer e.mu.Unlock()
|
||||||
e.mu.Unlock()
|
return e.bw.Flush()
|
||||||
walWriteBytes.Add(float64(n))
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeUint64(w io.Writer, n uint64, buf []byte) error {
|
func writeUint64(w io.Writer, n uint64, buf []byte) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user