Commit de7044c
feat: dynamic batch size recovery for storage operations (#181)
* feat(providers): add dynamic batch size recovery for storage operations
After a timeout reduces batch size, subsequent successful requests with smaller payloads automatically double the batch size back toward the original. This prevents one large-storage account from permanently slowing all subsequent operations.
Changes:
- get_account_storage_with_fallback: tracks last_successful_avg_bytes and failure_avg_bytes_ref, doubles batch on smaller payload (measured as avg bytes/key)
- set_state_with_batching: tracks failure_avg_bytes_ref from failed batch, doubles batch on smaller payload (measured as avg bytes/pair)
- Both operations reset batch size per account (per-operation isolation, no cross-account state)
- Increase is capped at original configured batch size, matching the symmetric ÷2 reduction rule
- INFO log on each batch size increase with old/new values and payload comparison reason
* test(providers): add tests for dynamic batch size increase and per-account reset
Add 14 new tests across 3 test classes:
TestGetAccountStorageWithFallbackBatchIncrease (6 tests):
- Batch increases on smaller payload (avg bytes/key strictly less)
- No increase on same or larger payload
- No increase when first request times out (no prior success reference)
- Recovery tracking resets on re-failure
- Increase capped at original batch size
- INFO log emitted with old/new sizes and payload comparison
TestSetStateWithBatchingBatchIncrease (5 tests):
- Batch increases on smaller avg bytes/pair
- No increase when avg bytes/pair same or larger
- Recovery reset on re-failure
- Increase capped at original
- INFO log emitted
TestBatchSizeResetBetweenAccounts (3 tests):
- Fetch batch size resets between account calls
- Push batch size resets between account calls
- Fetch fallback to standard endpoint doesn't affect next account's paginated batch
* docs(changelog): record dynamic batch size recovery and batch reset tests
* Bump version: 3.1.1-dev1 → 3.1.1-dev2
---------
Co-authored-by: github-actions <41898282+github-actions@users.noreply.github.com>1 parent 5bc147c commit de7044c
File tree
5 files changed
+729
-2
lines changed- docs/source/dev_documentation
- mxops/common
- tests
5 files changed
+729
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| |||
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
154 | 180 | | |
155 | 181 | | |
156 | 182 | | |
| |||
231 | 257 | | |
232 | 258 | | |
233 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
234 | 263 | | |
235 | 264 | | |
236 | 265 | | |
| |||
276 | 305 | | |
277 | 306 | | |
278 | 307 | | |
| 308 | + | |
279 | 309 | | |
280 | 310 | | |
281 | 311 | | |
| |||
296 | 326 | | |
297 | 327 | | |
298 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
299 | 351 | | |
300 | 352 | | |
301 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments