提交 9336c01d 编写于 作者: E Erfan Besharat 提交者: Krasi Georgiev

Add methods to fetch page's buf data in tsdb WAL (#5967)

* move the WAL page buf reset in its own func
Signed-off-by: NErfan Besharat <erbesharat@gmail.com>
上级 21c97890
......@@ -64,6 +64,14 @@ func (p *page) full() bool {
return pageSize-p.alloc < recordHeaderSize
}
func (p *page) reset() {
for i := range p.buf {
p.buf[i] = 0
}
p.alloc = 0
p.flushed = 0
}
// Segment represents a segment file.
type Segment struct {
*os.File
......@@ -494,11 +502,7 @@ func (w *WAL) flushPage(clear bool) error {
// We flushed an entire page, prepare a new one.
if clear {
for i := range p.buf {
p.buf[i] = 0
}
p.alloc = 0
p.flushed = 0
p.reset()
w.donePages++
w.pageCompletions.Inc()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册