Skip to content

Commit

Permalink
Change show_chunks/drop_chunks using creation time
Browse files Browse the repository at this point in the history
- Updated show_chunks, drop_chunks APIs to get the affected
chunks using chunk creation time metadata based on the
"date/time/interval" like boundary specified for the INTEGER
columns.

- We honor "integer_now" function if it's specified so as to keep
backwards compatibility with the existing behavior

Co-authored-by: Dipesh Pandit <[email protected]>
  • Loading branch information
nikkhils and pdipesh02 committed Oct 23, 2023
1 parent bebd1ab commit 1981e8e
Show file tree
Hide file tree
Showing 28 changed files with 851 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .unreleased/feature_6177
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Implements: #6177 Change show_chunks/drop_chunks using chunk creation time
Thanks: @pdipesh02 for contributing to the implementation of this feature
8 changes: 6 additions & 2 deletions sql/ddl_api.sql
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ CREATE OR REPLACE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL,
verbose BOOLEAN = FALSE
verbose BOOLEAN = FALSE,
created_before "any" = NULL,
created_after "any" = NULL
) RETURNS SETOF TEXT AS '@MODULE_PATHNAME@', 'ts_chunk_drop_chunks'
LANGUAGE C VOLATILE PARALLEL UNSAFE;

Expand All @@ -136,7 +138,9 @@ LANGUAGE C VOLATILE PARALLEL UNSAFE;
CREATE OR REPLACE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL
newer_than "any" = NULL,
created_before "any" = NULL,
created_after "any" = NULL
) RETURNS SETOF REGCLASS AS '@MODULE_PATHNAME@', 'ts_chunk_show_chunks'
LANGUAGE C STABLE PARALLEL SAFE;

Expand Down
21 changes: 21 additions & 0 deletions sql/updates/latest-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,24 @@ DROP TABLE _timescaledb_internal.tmp_chunk_seq_value;
GRANT SELECT ON _timescaledb_catalog.chunk_id_seq TO PUBLIC;
GRANT SELECT ON _timescaledb_catalog.chunk TO PUBLIC;
-- end recreate _timescaledb_catalog.chunk table --

DROP FUNCTION @[email protected]_chunks(REGCLASS, "any", "any", BOOL);
CREATE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL,
verbose BOOLEAN = FALSE,
created_before "any" = NULL,
created_after "any" = NULL
) RETURNS SETOF TEXT AS '@MODULE_PATHNAME@', 'ts_chunk_drop_chunks'
LANGUAGE C VOLATILE PARALLEL UNSAFE;

DROP FUNCTION @[email protected]_chunks(REGCLASS, "any", "any");
CREATE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL,
created_before "any" = NULL,
created_after "any" = NULL
) RETURNS SETOF REGCLASS AS '@MODULE_PATHNAME@', 'ts_chunk_show_chunks'
LANGUAGE C STABLE PARALLEL SAFE;
18 changes: 18 additions & 0 deletions sql/updates/reverse-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,21 @@ GRANT SELECT ON _timescaledb_catalog.chunk_id_seq TO PUBLIC;
GRANT SELECT ON _timescaledb_catalog.chunk TO PUBLIC;

-- end recreate _timescaledb_catalog.chunk table --


DROP FUNCTION @[email protected]_chunks(REGCLASS, "any", "any", BOOL, "any", "any");
CREATE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL,
verbose BOOLEAN = FALSE
) RETURNS SETOF TEXT AS '@MODULE_PATHNAME@', 'ts_chunk_drop_chunks'
LANGUAGE C VOLATILE PARALLEL UNSAFE;

DROP FUNCTION @[email protected]_chunks(REGCLASS, "any", "any", "any", "any");
CREATE FUNCTION @[email protected]_chunks(
relation REGCLASS,
older_than "any" = NULL,
newer_than "any" = NULL
) RETURNS SETOF REGCLASS AS '@MODULE_PATHNAME@', 'ts_chunk_show_chunks'
LANGUAGE C STABLE PARALLEL SAFE;
Loading

0 comments on commit 1981e8e

Please sign in to comment.