mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: move fixupTimestamps() call to Block.Init()
This is a follow-up for 0bf7921721
This commit is contained in:
parent
517334f747
commit
66f37935a3
2 changed files with 3 additions and 2 deletions
|
@ -95,6 +95,9 @@ func (b *Block) Init(tsid *TSID, timestamps, values []int64, scale int16, precis
|
||||||
b.bh.PrecisionBits = precisionBits
|
b.bh.PrecisionBits = precisionBits
|
||||||
b.timestamps = append(b.timestamps[:0], timestamps...)
|
b.timestamps = append(b.timestamps[:0], timestamps...)
|
||||||
b.values = append(b.values[:0], values...)
|
b.values = append(b.values[:0], values...)
|
||||||
|
if len(b.timestamps) > 0 {
|
||||||
|
b.fixupTimestamps()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nextRow advances to the next row.
|
// nextRow advances to the next row.
|
||||||
|
|
|
@ -124,7 +124,6 @@ func (rrm *rawRowsMarshaler) marshalToInmemoryPart(mp *inmemoryPart, rows []rawR
|
||||||
|
|
||||||
rrm.auxValues, scale = decimal.AppendFloatToDecimal(rrm.auxValues[:0], rrm.auxFloatValues)
|
rrm.auxValues, scale = decimal.AppendFloatToDecimal(rrm.auxValues[:0], rrm.auxFloatValues)
|
||||||
tmpBlock.Init(tsid, rrm.auxTimestamps, rrm.auxValues, scale, precisionBits)
|
tmpBlock.Init(tsid, rrm.auxTimestamps, rrm.auxValues, scale, precisionBits)
|
||||||
tmpBlock.fixupTimestamps()
|
|
||||||
rrm.bsw.WriteExternalBlock(tmpBlock, ph, &rowsMerged)
|
rrm.bsw.WriteExternalBlock(tmpBlock, ph, &rowsMerged)
|
||||||
|
|
||||||
tsid = &r.TSID
|
tsid = &r.TSID
|
||||||
|
@ -135,7 +134,6 @@ func (rrm *rawRowsMarshaler) marshalToInmemoryPart(mp *inmemoryPart, rows []rawR
|
||||||
|
|
||||||
rrm.auxValues, scale = decimal.AppendFloatToDecimal(rrm.auxValues[:0], rrm.auxFloatValues)
|
rrm.auxValues, scale = decimal.AppendFloatToDecimal(rrm.auxValues[:0], rrm.auxFloatValues)
|
||||||
tmpBlock.Init(tsid, rrm.auxTimestamps, rrm.auxValues, scale, precisionBits)
|
tmpBlock.Init(tsid, rrm.auxTimestamps, rrm.auxValues, scale, precisionBits)
|
||||||
tmpBlock.fixupTimestamps()
|
|
||||||
rrm.bsw.WriteExternalBlock(tmpBlock, ph, &rowsMerged)
|
rrm.bsw.WriteExternalBlock(tmpBlock, ph, &rowsMerged)
|
||||||
if rowsMerged != uint64(len(rows)) {
|
if rowsMerged != uint64(len(rows)) {
|
||||||
logger.Panicf("BUG: unexpected rowsMerged; got %d; want %d", rowsMerged, len(rows))
|
logger.Panicf("BUG: unexpected rowsMerged; got %d; want %d", rowsMerged, len(rows))
|
||||||
|
|
Loading…
Reference in a new issue