diff --git a/tsl/src/continuous_aggs/refresh.c b/tsl/src/continuous_aggs/refresh.c index 5c5687969..e49ca0d20 100644 --- a/tsl/src/continuous_aggs/refresh.c +++ b/tsl/src/continuous_aggs/refresh.c @@ -372,6 +372,13 @@ continuous_agg_refresh(PG_FUNCTION_ARGS) errmsg("invalid refresh window"), errhint("The start of the window must be before the end."))); + refresh_window = compute_bucketed_refresh_window(&refresh_window, cagg->data.bucket_width); + + elog(DEBUG1, + "computed refresh window at [ " INT64_FORMAT ", " INT64_FORMAT "]", + refresh_window.start, + refresh_window.end); + /* Perform the refresh across two transactions. * * The first transaction moves the invalidation threshold (if needed) and @@ -410,14 +417,6 @@ continuous_agg_refresh(PG_FUNCTION_ARGS) * windows. */ LockRelationOid(cagg_ht->main_table_relid, ExclusiveLock); - - refresh_window = compute_bucketed_refresh_window(&refresh_window, cagg->data.bucket_width); - - elog(DEBUG1, - "computed refresh window at [ " INT64_FORMAT ", " INT64_FORMAT "]", - refresh_window.start, - refresh_window.end); - invalidation_process_cagg_log(cagg, &refresh_window); continuous_agg_refresh_with_window(cagg, &refresh_window); diff --git a/tsl/test/isolation/expected/continuous_aggs_concurrent_refresh.out b/tsl/test/isolation/expected/continuous_aggs_concurrent_refresh.out index 83d7b160b..94715641e 100644 --- a/tsl/test/isolation/expected/continuous_aggs_concurrent_refresh.out +++ b/tsl/test/isolation/expected/continuous_aggs_concurrent_refresh.out @@ -26,7 +26,7 @@ cagg_bucket_count 4 hypertable threshold -conditions 62 +conditions 70 step R3_refresh: CALL refresh_continuous_aggregate('cond_10', 71, 97); @@ -55,7 +55,7 @@ cagg_bucket_count 7 hypertable threshold -conditions 97 +conditions 100 step L2_read_unlock_threshold_table: ROLLBACK; @@ -99,7 +99,7 @@ cagg_bucket_count 3 hypertable threshold -conditions 97 +conditions 100 step L3_unlock_cagg_table: ROLLBACK; @@ -147,7 +147,7 @@ cagg_bucket_count 7 hypertable threshold -conditions 97 +conditions 100 step L3_unlock_cagg_table: ROLLBACK; @@ -195,7 +195,7 @@ cagg_bucket_count 7 hypertable threshold -conditions 97 +conditions 100 step L3_unlock_cagg_table: ROLLBACK; @@ -239,7 +239,7 @@ cagg_bucket_count 4 hypertable threshold -conditions 62 +conditions 70 step L1_unlock_threshold_table: ROLLBACK; @@ -287,7 +287,7 @@ cagg_bucket_count 4 hypertable threshold -conditions 62 +conditions 70 step L1_unlock_threshold_table: ROLLBACK; @@ -338,7 +338,7 @@ cagg_bucket_count 7 hypertable threshold -conditions 97 +conditions 100 step L1_unlock_threshold_table: ROLLBACK; @@ -384,7 +384,7 @@ cagg_bucket_count 3 hypertable threshold -conditions 97 +conditions 100 step L1_unlock_threshold_table: ROLLBACK;