diff --git a/lib/storage/partition.go b/lib/storage/partition.go index b4cb31749..f2df3f85d 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -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 diff --git a/lib/storage/table_search_timing_test.go b/lib/storage/table_search_timing_test.go index 9025bef8a..a834924f1 100644 --- a/lib/storage/table_search_timing_test.go +++ b/lib/storage/table_search_timing_test.go @@ -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))