Always use bucketed refresh window internally

This change makes sure we always use the bucketed refresh window
internally for processing invalidations, moving thresholds and doing
the actual materialization.
This commit is contained in:
Erik Nordström 2020-08-14 02:07:36 +02:00 committed by Erik Nordström
parent c4ca66b76c
commit e9cf0add49
2 changed files with 16 additions and 17 deletions

View File

@ -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);

View File

@ -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;