Skip to content

Commit 9a47b63

Browse files
authored
Improve pending materializations search (#8647)
PR #8607 addressed the issue when a failed refresh left behind pending materializations (i.e., rows in _timescaledb_catalog.continuous_aggs_materialization_ranges). The patch searched for those pending materializations that had some overlap with the current refresh's refresh window. However that PR used the refresh window that was passed as reference to process_cagg_invalidations_and_refresh and as such, was modified by that function to match with the invalidated buckets. This PR changes it to use the original refresh window (from the policy) so that it is more likely to overlap with the pending materializations (and more deterministic, since it doesn't depend on the data being materialized) Disable-check: force-changelog-file
1 parent 1429367 commit 9a47b63

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

tsl/src/continuous_aggs/refresh.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,11 @@ continuous_agg_refresh_internal(const ContinuousAgg *cagg,
925925
INVALID_CHUNK_ID,
926926
force);
927927

928+
/* check if we have any pending materializations in our refresh window range,
929+
* if so, we need to process them
930+
* Note that we use the original refresh window range here, not the one that has been processed
931+
* by the refresh function*/
932+
refresh_window = *refresh_window_arg;
928933
bool has_pending_materializations =
929934
continuous_agg_has_pending_materializations(cagg, refresh_window);
930935

tsl/test/isolation/expected/cagg_concurrent_refresh.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ debug_waitpoint_release
704704

705705
step R3_refresh: <... completed>
706706
step R13_refresh:
707-
CALL refresh_continuous_aggregate('cond_10', 25, 70);
707+
CALL refresh_continuous_aggregate('cond_10', 65, 100);
708708

709709
step R6_pending_materialization_ranges:
710710
SELECT * FROM pending_materialization_ranges WHERE user_view_name = 'cond_10';

tsl/test/isolation/specs/cagg_concurrent_refresh.spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@ step "R12_refresh"
218218
session "R13"
219219
step "R13_refresh"
220220
{
221-
CALL refresh_continuous_aggregate('cond_10', 25, 70);
221+
CALL refresh_continuous_aggregate('cond_10', 65, 100);
222222
}
223223

224+
224225
# Refresh that overlaps with R1
225226
session "R2"
226227
setup

0 commit comments

Comments
 (0)