Skip to content

Commit c5f7e36

Browse files
Prevent rows that are too large (#1133)
1 parent ea71376 commit c5f7e36

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: parser/scamper1.go

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import (
1818

1919
const (
2020
scamper1 = "scamper1"
21+
22+
// BigQuery rows must be under 100MB. Use 90MB to allow for JSON export.
23+
// This is already an unusually large trace file.
24+
maxRowSize = 90000000
2125
)
2226

2327
// Scamper1Parser handles parsing for the scamper1 datatype.
@@ -99,6 +103,12 @@ func (p *Scamper1Parser) ParseAndInsert(meta etl.Metadata, testName string, rawC
99103
metrics.WorkerState.WithLabelValues(p.TableName(), scamper1).Inc()
100104
defer metrics.WorkerState.WithLabelValues(p.TableName(), scamper1).Dec()
101105

106+
// BigQuery rows must be under 100MB.
107+
if len(rawContent) > maxRowSize {
108+
metrics.TestTotal.WithLabelValues(p.TableName(), scamper1, "row too big").Inc()
109+
return fmt.Errorf("row size too big")
110+
}
111+
102112
trcParser, err := parser.New("mda")
103113
if err != nil {
104114
metrics.TestTotal.WithLabelValues(p.TableName(), scamper1, err.Error()).Inc()

0 commit comments

Comments
 (0)