Repository navigation
Commit 2740979
authored
Check TestChangesetBatchSize buffer growth without AllocsPerRun (#4426)
`TestChangesetBatchSize` occasionally reports one allocation for the
sized batch on the race shard. It measures buffer growth with
`testing.AllocsPerRun`, which divides the process-wide malloc count by
the number of runs. So allocations made by other goroutines during the
measured window count as the code under test, and with only 5 runs a
handful of them is enough to round up to 1. Locally the zero check
failed 9 of 300 runs under `-race -count=300` and never without `-race`.
The test now checks growth directly. It fills a batch sized by
`changesetBatchSize` and requires its buffer capacity to be unchanged
afterwards (pebble's `Batch.grow` always reallocates to a larger
capacity). As the non-vacuity control, a batch whose buffer is one byte
smaller than what the fill wrote must grow. Both checks are
deterministic, so they run under `-race` as well, which matters because
CI runs this package only with `-race`. The control also no longer
depends on what the batch pool hands back, which made the old unsized
control fail under `-count` > 1.
Flaked in:
https://github.com/sei-protocol/sei-chain/actions/runs/36553689722/job/1093576429031 parent 7e5857e commit 2740979
1 file changed
Lines changed: 33 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
110 | | - | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | | - | |
| 127 | + | |
127 | 128 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
148 | 135 | | |
149 | 136 | | |
150 | | - | |
151 | | - | |
152 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
153 | 148 | | |
154 | 149 | | |
155 | | - | |
156 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
0 commit comments