mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: validate rows in partition.AddRows() only during tests
This commit is contained in:
parent
df619bdff0
commit
60d92894c5
2 changed files with 13 additions and 8 deletions
|
@ -431,20 +431,24 @@ func (pt *partition) AddRows(rows []rawRow) {
|
|||
return
|
||||
}
|
||||
|
||||
// Validate all the rows.
|
||||
for i := range rows {
|
||||
r := &rows[i]
|
||||
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 isDebug {
|
||||
// Validate all the rows.
|
||||
for i := range rows {
|
||||
r := &rows[i]
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pt.rawRows.addRows(pt, rows)
|
||||
}
|
||||
|
||||
var isDebug = false
|
||||
|
||||
type rawRowsShards struct {
|
||||
shardIdx uint32
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
isDebug = true
|
||||
n := m.Run()
|
||||
if err := os.RemoveAll("benchmarkTableSearch"); err != nil {
|
||||
panic(fmt.Errorf("cannot remove benchmark tables: %w", err))
|
||||
|
|
Loading…
Reference in a new issue