mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
4c457cf20f
commit
fb2a280077
3 changed files with 6 additions and 4 deletions
|
@ -226,7 +226,7 @@ func (b *block) assertValid() {
|
|||
//
|
||||
// It is expected that timestamps are sorted.
|
||||
//
|
||||
// b is valid until timestamps and rows are changed.
|
||||
// b is valid until rows are changed.
|
||||
func (b *block) MustInitFromRows(timestamps []int64, rows [][]Field) {
|
||||
b.reset()
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ func (bd *blockData) mustWriteTo(bh *blockHeader, sw *streamWriters) {
|
|||
|
||||
a := getArena()
|
||||
csh := getColumnsHeader()
|
||||
|
||||
chs := csh.resizeColumnHeaders(len(cds))
|
||||
for i := range cds {
|
||||
cds[i].mustWriteTo(a, &chs[i], sw)
|
||||
|
@ -124,6 +125,7 @@ func (bd *blockData) mustWriteTo(bh *blockHeader, sw *streamWriters) {
|
|||
|
||||
bb := longTermBufPool.Get()
|
||||
bb.B = csh.marshal(bb.B)
|
||||
|
||||
putColumnsHeader(csh)
|
||||
putArena(a)
|
||||
|
||||
|
|
|
@ -169,11 +169,11 @@ func TestBlockMustInitFromRowsFullBlock(t *testing.T) {
|
|||
b := getBlock()
|
||||
defer putBlock(b)
|
||||
b.MustInitFromRows(timestamps, rows)
|
||||
b.assertValid()
|
||||
if n := b.Len(); n != len(rows) {
|
||||
t.Fatalf("unexpected total log entries; got %d; want %d", n, len(rows))
|
||||
}
|
||||
if b.uncompressedSizeBytes() < maxUncompressedBlockSize {
|
||||
t.Fatalf("expecting full block")
|
||||
if n := b.uncompressedSizeBytes(); n < maxUncompressedBlockSize {
|
||||
t.Fatalf("expecting full block with %d bytes; got %d bytes", maxUncompressedBlockSize, n)
|
||||
}
|
||||
b.assertValid()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue