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
Rename add_drop_chunks_policy #2148
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -21,13 +21,21 @@ INSERT INTO _timescaledb_config.bgw_job (id, application_name, job_type, schedul | |||||||||||||||||||||
(1, 'Telemetry Reporter', 'telemetry_and_version_check_if_enabled', INTERVAL '24h', INTERVAL '100s', -1, INTERVAL '1h') | ||||||||||||||||||||||
ON CONFLICT (id) DO NOTHING; | ||||||||||||||||||||||
|
||||||||||||||||||||||
CREATE OR REPLACE FUNCTION add_drop_chunks_policy( | ||||||||||||||||||||||
-- Add a retention policy to a hypertable or continuous aggregate. | ||||||||||||||||||||||
-- The retention_window (typically an INTERVAL) determines the | ||||||||||||||||||||||
-- window beyond which data is dropped at the time | ||||||||||||||||||||||
-- of execution of the policy (e.g., '1 week'). Note that the retention | ||||||||||||||||||||||
-- window will always align with chunk boundaries, thus the window | ||||||||||||||||||||||
-- might be larger than the given one, but never smaller. In other | ||||||||||||||||||||||
-- words, some data beyond the retention window | ||||||||||||||||||||||
-- might be kept, but data within the window will never be deleted. | ||||||||||||||||||||||
CREATE OR REPLACE FUNCTION add_retention_policy( | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should take the opportunity to also add a description of this function:
Suggested change
Looking at this signature, it is unclear what the time epoch is from here the retention window starts. I assume it is wall clock (system clock), but I am not sure that always fits the data. We might need to add a separate parameter that allows the user to specify a function that gives the epoch, typically defaulting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I see the case where one wouldn't assume this was wall clock? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is probably not the common case, but if the data ingested is not aligned with the wall clock, then the retention policy won't work. Let's say, for instance, you are importing data in Or, let's say your data uses some completely different notion of time, e.g., an integer that is an increasing counter, e.g., event number. The question is if the retention internally uses the |
||||||||||||||||||||||
hypertable REGCLASS, | ||||||||||||||||||||||
older_than "any", | ||||||||||||||||||||||
retention_window "any", | ||||||||||||||||||||||
if_not_exists BOOL = false, | ||||||||||||||||||||||
cascade_to_materializations BOOL = false | ||||||||||||||||||||||
) | ||||||||||||||||||||||
RETURNS INTEGER AS '@MODULE_PATHNAME@', 'ts_add_drop_chunks_policy' | ||||||||||||||||||||||
RETURNS INTEGER AS '@MODULE_PATHNAME@', 'ts_add_retention_policy' | ||||||||||||||||||||||
LANGUAGE C VOLATILE STRICT; | ||||||||||||||||||||||
|
||||||||||||||||||||||
CREATE OR REPLACE FUNCTION add_reorder_policy(hypertable REGCLASS, index_name NAME, if_not_exists BOOL = false) RETURNS INTEGER | ||||||||||||||||||||||
|
@@ -47,8 +55,9 @@ RETURNS INTEGER | |||||||||||||||||||||
AS '@MODULE_PATHNAME@', 'ts_add_compress_chunks_policy' | ||||||||||||||||||||||
LANGUAGE C VOLATILE STRICT; | ||||||||||||||||||||||
|
||||||||||||||||||||||
CREATE OR REPLACE FUNCTION remove_drop_chunks_policy(hypertable REGCLASS, if_exists BOOL = false) RETURNS VOID | ||||||||||||||||||||||
AS '@MODULE_PATHNAME@', 'ts_remove_drop_chunks_policy' | ||||||||||||||||||||||
-- Remove the retention policy from a hypertable | ||||||||||||||||||||||
CREATE OR REPLACE FUNCTION remove_retention_policy(hypertable REGCLASS, if_exists BOOL = false) RETURNS VOID | ||||||||||||||||||||||
AS '@MODULE_PATHNAME@', 'ts_remove_retention_policy' | ||||||||||||||||||||||
LANGUAGE C VOLATILE STRICT; | ||||||||||||||||||||||
|
||||||||||||||||||||||
CREATE OR REPLACE FUNCTION remove_compress_chunks_policy(hypertable REGCLASS, if_exists BOOL = false) RETURNS BOOL | ||||||||||||||||||||||
|
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.
Nit (on my own suggestion):