mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
lib/storage: validate rows in partition.AddRows() only during tests
This commit is contained in:
parent
292b6a851f
commit
0a11c46cd2
2 changed files with 13 additions and 8 deletions
|
@ -431,20 +431,24 @@ func (pt *partition) AddRows(rows []rawRow) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate all the rows.
|
if isDebug {
|
||||||
for i := range rows {
|
// Validate all the rows.
|
||||||
r := &rows[i]
|
for i := range rows {
|
||||||
if !pt.HasTimestamp(r.Timestamp) {
|
r := &rows[i]
|
||||||
logger.Panicf("BUG: row %+v has Timestamp outside partition %q range %+v", r, pt.smallPartsPath, &pt.tr)
|
if !pt.HasTimestamp(r.Timestamp) {
|
||||||
}
|
logger.Panicf("BUG: row %+v has Timestamp outside partition %q range %+v", r, pt.smallPartsPath, &pt.tr)
|
||||||
if err := encoding.CheckPrecisionBits(r.PrecisionBits); err != nil {
|
}
|
||||||
logger.Panicf("BUG: row %+v has invalid PrecisionBits: %s", r, err)
|
if err := encoding.CheckPrecisionBits(r.PrecisionBits); err != nil {
|
||||||
|
logger.Panicf("BUG: row %+v has invalid PrecisionBits: %s", r, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt.rawRows.addRows(pt, rows)
|
pt.rawRows.addRows(pt, rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isDebug = false
|
||||||
|
|
||||||
type rawRowsShards struct {
|
type rawRowsShards struct {
|
||||||
shardIdx uint32
|
shardIdx uint32
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
isDebug = true
|
||||||
n := m.Run()
|
n := m.Run()
|
||||||
if err := os.RemoveAll("benchmarkTableSearch"); err != nil {
|
if err := os.RemoveAll("benchmarkTableSearch"); err != nil {
|
||||||
panic(fmt.Errorf("cannot remove benchmark tables: %w", err))
|
panic(fmt.Errorf("cannot remove benchmark tables: %w", err))
|
||||||
|
|
Loading…
Reference in a new issue