-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional force
argument to refresh_continuous_aggregate
#7521
base: main
Are you sure you want to change the base?
Conversation
af8c263
to
bde8617
Compare
I think we discussed this previously, and one idea was to invalidate the region covered by the tiered data when the GUC to enable tiered refreshing was changed to "true/on". This would not require changes to our API and is the natural way to make the region refresh with current mechanisms. Was that approach discarded for some reason? If so, can someone explain what disqualified it? |
I probably didn't catch that. Do you mean that in the GUC callback we set some sort of a flag that would indicate that we should insert an invalidation record whenever we refresh a range? I see a couple of issues:
In both cases it feels like not a clear UX. |
The problem with this approach is the case when the tiered data is already materialized that will generate unnecessary invalidation logs. |
I meant adding the invalidations in the GUC, not setting a flag. Nothing else needs to change.
Not sure I follow why they'd have to turn off and on again. I believe guc callbacks are called on parsing the server config file as well.
I don't think this would be necessary if the invalidations are added via the guc callback.
The idea is that this would be completely transparent and no need for user to learn about a With the other approach, the user first has to enable the GUC for tiered caggs to work, then use the |
That's just one large invalidation entry per affected cagg. It should not be an issue right? Also, can't we detect whether it is up-to-date or not and avoid adding the invalidation? If we can't detect it, it would be "correct" to add the invalidation AFAICT. |
It is a problem (actually this is exact the problem I want to avoid) because the current architecture don't deal with large ranges very well and doing that will make things worse for the customer.
We can check if exists some tiered data already materialized but it don't guarantee that everything is actually materialized and this is the reason to have this |
Ok, sounds like a bigger problem then. It is just that my alarm bells start to ring when I see that we are trying to build around the current architecture. I'd prefer we fix the underlying problem, but maybe this is not possible in the short term.
But it will only work for one cagg, so you'd have to manually force refresh all caggs that are connected to a tiered hypertable. If you forget one or more, you are now actually in a bad state where some caggs aren't accurately representing the data even if you refresh normally. In contrast, adding the invalidation will add the proper state to remember that this region is no longer valid and needs a refresh. This is what invalidations are for. But now we are saying we cannot use invalidations because they don't work well. So, now we use them sometimes, but in other times we don't. To me that sounds like a system where you cannot fully trust that a refresh is actually a refresh, which might lead to users always forcing a refresh just to be sure. Anyway, I am just pointing these things out to make sure we thought this through, but if you are convinced that relying on the user forcing a refresh is the best option right now, then I trust you that there is no better option. |
Unfortunately no... the short term solution we're working on is build some custom jobs to execute the refresh in small ranges instead of a big one and this new option will be used by OSM team when they have this situation when the tiered reads are disabled then they enable it and want to materialize the data.
Your points are valid and many thanks to jump into the discussion, but this option is not for wide audience but instead to ourselves use it in some custom jobs to execute the refresh in an incremental fashion. We don't want to rely on users to make sure that their data is in the correct state. Anyway all of this is for short term solution but starting on Q1 2025 Mats and I will start to work on a new architecture for refreshing caggs to address all this write amplification we have nowadays, but it is not a small project. |
bde8617
to
40f1986
Compare
40f1986
to
d932511
Compare
@akuzm, @fabriziomello: please review this pull request.
|
d932511
to
742ec32
Compare
DELETE FROM :mat_ht; | ||
|
||
-- Run regular refresh, it should not touch previously materialized range | ||
-- CALL refresh_continuous_aggregate('daily_temp', '2020-05-04 00:00 UTC', '2020-05-05 00:00 UTC'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover?
7b1f47a
to
70e7628
Compare
70e7628
to
e977ffe
Compare
Continuous aggregates that are built on top of tiered hypertables cannot access and materialize tiered data when `timescaledb.enable_tiered_reads` GUC is disabled at the server level. And there is no way for a user to manually force the refresh with tiered reads enabled. Here we add an optional `force` parameter to the `refresh_continuous_aggregate` procedure that would allow user to partially re-materialize cagg within a time window that has been previously materialized.
e977ffe
to
23f851d
Compare
Following the SDC. Continuous aggregates that are built on top of tiered hypertables cannot access and materialize tiered data when the
timescaledb.enable_tiered_reads
GUC is disabled at the server level. And there is no way for a user to manually force the refresh with tiered reads enabled. Here we add an optionalforce
parameter to therefresh_continuous_aggregate
procedure that would allow user to partially re-materialize cagg within a time window that has already been materialized.