Commit 787cc4e
committed
Fix batch cutting for incremental refresh
Currently, incremental refresh uses 30days as the length
for the monthly bucket, which results in batches misaligned with
bucket boundary. Circumscription extends the batch to match
bucket boundary to ensure correctness, but leads to overlapping
between adjacent batches.
This patch fixes the batch cutting to use the exact number of days
in a calendar month.
The patch also makes the following modifications:
- Generated batches will start right at the latest bucket that overlaps
both a chunk and invalidations. Before, we generated batches first
and picked those with overlapping, resulting in batches that started
earlier than needed. For example, if invalidations is (-inf , +inf)
and chunks are [10,30) , [50,70). With refresh windows [0,90),
bucket = 10, and bucket_per_batch = 2, previously we would enumerate
batches of [0,20), [20,40], [40,60), [60,80), [80,100), then select
batches [0,20), [20,40), [40,60), [60,80) because these overlap with
chunk slices and invalidations. With the new logic, we skip forward
to the next max(dimension slice, invalidations), so we only generate
batches [10,30) and [50,70). This explains some test diffs on existing
tests, because we will have fewer batches in some cases.
- Bug fix: Previously, when the refresh window had null start/end, we
capped it using the min/max dimension slice, then inscribed the
window. So if the chunk boundary is not at the bucket boundary, we
will generate batches based on a window range that is smaller than
the original window. We restored null at the end so it's still correct
with respect to the data range being refreshed, but the batches at
the two ends could be a bucket bigger. Fix by capping to the start/end
of the bucket that contains the boundary.1 parent 0273d49 commit 787cc4e
13 files changed
Lines changed: 1106 additions & 356 deletions
File tree
- .unreleased
- src
- tsl
- src
- bgw_policy
- continuous_aggs
- test
- expected
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
| 517 | + | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| |||
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
973 | | - | |
| 973 | + | |
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
453 | 451 | | |
454 | 452 | | |
455 | 453 | | |
| |||
461 | 459 | | |
462 | 460 | | |
463 | 461 | | |
464 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
465 | 467 | | |
466 | | - | |
467 | | - | |
468 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
469 | 476 | | |
470 | 477 | | |
471 | 478 | | |
| |||
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
| 563 | + | |
556 | 564 | | |
557 | 565 | | |
558 | 566 | | |
| |||
0 commit comments