Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3269-docs-rfc-update-the-readme-…
Browse files Browse the repository at this point in the history
…in-the-timescaledb-github-repo-to-match-the-pgai-docs' into 3269-docs-rfc-update-the-readme-in-the-timescaledb-github-repo-to-match-the-pgai-docs
  • Loading branch information
atovpeko committed Dec 3, 2024
2 parents 3fce39e + 8b58a11 commit 33a521a
Show file tree
Hide file tree
Showing 32 changed files with 439 additions and 101 deletions.
37 changes: 6 additions & 31 deletions .github/workflows/abi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,18 @@ jobs:
strategy:
fail-fast: false
matrix:
dir: [ "forward", "backward" ]
pg: [ 14, 15, 16, 17 ]
include:
- dir: backward
pg: 14
builder: ${{ fromJson(needs.config.outputs.pg14_latest) }}-alpine3.19
tester: ${{ fromJson(needs.config.outputs.pg14_abi_min) }}-alpine
ignores: memoize
- dir: forward
pg: 14
- pg: 14
builder: ${{ fromJson(needs.config.outputs.pg14_abi_min) }}-alpine
tester: ${{ fromJson(needs.config.outputs.pg14_latest) }}-alpine3.19
- dir: backward
pg: 15
builder: ${{ fromJson(needs.config.outputs.pg15_latest) }}-alpine3.19
tester: ${{ fromJson(needs.config.outputs.pg15_abi_min) }}-alpine
- dir: forward
pg: 15
- pg: 15
builder: ${{ fromJson(needs.config.outputs.pg15_abi_min) }}-alpine
tester: ${{ fromJson(needs.config.outputs.pg15_latest) }}-alpine3.19
- dir: backward
pg: 16
builder: ${{ fromJson(needs.config.outputs.pg16_latest) }}-alpine3.19
tester: ${{ fromJson(needs.config.outputs.pg16_abi_min) }}-alpine
# this test has issues with 16.0 version of pg_dump binary
# which affects backwards test only
ignores: pg_dump_unprivileged
- dir: forward
pg: 16
- pg: 16
builder: ${{ fromJson(needs.config.outputs.pg16_abi_min) }}-alpine
tester: ${{ fromJson(needs.config.outputs.pg16_latest) }}-alpine3.19
- dir: backward
pg: 17
builder: ${{ fromJson(needs.config.outputs.pg17_latest) }}-alpine3.19
tester: ${{ fromJson(needs.config.outputs.pg17_abi_min) }}-alpine
- dir: forward
pg: 17
- pg: 17
builder: ${{ fromJson(needs.config.outputs.pg17_abi_min) }}-alpine
tester: ${{ fromJson(needs.config.outputs.pg17_latest) }}-alpine3.19

Expand All @@ -89,7 +64,7 @@ jobs:
- name: Checkout TimescaleDB
uses: actions/checkout@v4

- name: Build extension
- name: Build extension with ${{ matrix.builder }}
run: |
BUILDER_IMAGE="postgres:${{matrix.builder}}"
Expand All @@ -113,7 +88,7 @@ jobs:
cp `pg_config --pkglibdir`/timescaledb*.so build_abi/install_lib
EOF
- name: Run tests
- name: Run tests on server ${{ matrix.tester }}
run: |
TEST_IMAGE="postgres:${{ matrix.tester }}"
Expand Down
32 changes: 21 additions & 11 deletions .github/workflows/pr-approvals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,37 @@ jobs:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
run: |
echo "Event is: "
cat <<EOF
${{ toJSON(github.event) }}
EOF
echo "PR number is $PR_NUMBER"
echo "$BODY" | egrep -qsi '^disable-check:.*\<approval-count\>'
if [[ $? -ne 0 ]]; then
# Get the list of modified files in this pull request
echo "Modified files: "
gh pr view $PR_NUMBER --json files
# Get modified files, but exclude those that are workflow
# files or are related to Hypercore table access
# method. These require only a single reviewer.
files=$(gh pr view $PR_NUMBER --json files --jq '.files.[].path | select(startswith(".github") or test("hypercore|columnar_scan") | not)')
# Get the number of modified files, but exclude those that
# are workflow files or are related to Hypercore table
# access method. These require only a single reviewer.
files=$(gh pr view $PR_NUMBER --json files --jq '[.files.[].path | select(startswith(".github") or test("hypercore|columnar_scan") | not)] | length')
# Get the number of approvals in this pull request
echo "Reviews: "
gh pr view $PR_NUMBER --json reviews
approvals=$(gh pr view $PR_NUMBER --json reviews --jq '[.reviews.[] | select((.authorAssociation == "MEMBER" or .authorAssociation == "CONTRIBUTOR") and .state == "APPROVED")] | length')
if [[ $approvals -lt 2 ]] && [[ "${files}" ]] ; then
approvals=$(
gh pr view $PR_NUMBER --json reviews --jq '
[
.reviews.[]
| select(
(
.authorAssociation == "NONE"
or .authorAssociation == "MEMBER"
or .authorAssociation == "CONTRIBUTOR"
)
and .state == "APPROVED"
)
] | length
'
)
echo "approvals: $approvals, files: $files"
if [[ $approvals -lt 2 ]] && [[ $files -gt 0 ]] ; then
echo "This pull request requires 2 approvals before merging."
echo
echo "For trivial changes, you may disable this check by adding this trailer to the pull request message:"
Expand Down
1 change: 1 addition & 0 deletions .unreleased/pr_7443
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implements: #7443 Add Hypercore function and view aliases
13 changes: 13 additions & 0 deletions sql/maintenance_utils.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,24 @@ CREATE OR REPLACE FUNCTION @[email protected]_chunk(
hypercore_use_access_method BOOL = NULL
) RETURNS REGCLASS AS '@MODULE_PATHNAME@', 'ts_compress_chunk' LANGUAGE C VOLATILE;

-- Alias for compress_chunk above.
CREATE OR REPLACE PROCEDURE @[email protected]_to_columnstore(
chunk REGCLASS,
if_not_columnstore BOOLEAN = true,
recompress BOOLEAN = false,
hypercore_use_access_method BOOL = NULL
) AS '@MODULE_PATHNAME@', 'ts_compress_chunk' LANGUAGE C;

CREATE OR REPLACE FUNCTION @[email protected]_chunk(
uncompressed_chunk REGCLASS,
if_compressed BOOLEAN = true
) RETURNS REGCLASS AS '@MODULE_PATHNAME@', 'ts_decompress_chunk' LANGUAGE C STRICT VOLATILE;

CREATE OR REPLACE PROCEDURE @[email protected]_to_rowstore(
chunk REGCLASS,
if_columnstore BOOLEAN = true
) AS '@MODULE_PATHNAME@', 'ts_decompress_chunk' LANGUAGE C;

CREATE OR REPLACE FUNCTION _timescaledb_functions.recompress_chunk_segmentwise(
uncompressed_chunk REGCLASS,
if_compressed BOOLEAN = true
Expand Down
16 changes: 16 additions & 0 deletions sql/policy_api.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,26 @@ RETURNS INTEGER
AS '@MODULE_PATHNAME@', 'ts_policy_compression_add'
LANGUAGE C VOLATILE; -- not strict because we need to set different default values for schedule_interval

CREATE OR REPLACE PROCEDURE @[email protected]_columnstore_policy(
hypertable REGCLASS,
after "any" = NULL,
if_not_exists BOOL = false,
schedule_interval INTERVAL = NULL,
initial_start TIMESTAMPTZ = NULL,
timezone TEXT = NULL,
created_before INTERVAL = NULL,
hypercore_use_access_method BOOL = NULL
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_policy_compression_add';

CREATE OR REPLACE FUNCTION @[email protected]_compression_policy(hypertable REGCLASS, if_exists BOOL = false) RETURNS BOOL
AS '@MODULE_PATHNAME@', 'ts_policy_compression_remove'
LANGUAGE C VOLATILE STRICT;

CREATE OR REPLACE PROCEDURE @[email protected]_columnstore_policy(
hypertable REGCLASS,
if_exists BOOL = false
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_policy_compression_remove';

/* continuous aggregates policy */
CREATE OR REPLACE FUNCTION @[email protected]_continuous_aggregate_policy(
continuous_aggregate REGCLASS, start_offset "any",
Expand Down
37 changes: 37 additions & 0 deletions sql/size_utils.sql
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,25 @@ BEGIN
END;
$BODY$ SET search_path TO pg_catalog, pg_temp;

CREATE OR REPLACE FUNCTION @[email protected]_columnstore_stats (hypertable REGCLASS)
RETURNS TABLE (
chunk_schema name,
chunk_name name,
compression_status text,
before_compression_table_bytes bigint,
before_compression_index_bytes bigint,
before_compression_toast_bytes bigint,
before_compression_total_bytes bigint,
after_compression_table_bytes bigint,
after_compression_index_bytes bigint,
after_compression_toast_bytes bigint,
after_compression_total_bytes bigint,
node_name name)
LANGUAGE SQL
STABLE STRICT
AS 'SELECT * FROM @[email protected]_compression_stats($1)'
SET search_path TO pg_catalog, pg_temp;

-- Get compression statistics for a hypertable that has
-- compression enabled
CREATE OR REPLACE FUNCTION @[email protected]_compression_stats (hypertable REGCLASS)
Expand Down Expand Up @@ -581,6 +600,24 @@ $BODY$
ch.node_name;
$BODY$ SET search_path TO pg_catalog, pg_temp;

CREATE OR REPLACE FUNCTION @[email protected]_columnstore_stats (hypertable REGCLASS)
RETURNS TABLE (
total_chunks bigint,
number_compressed_chunks bigint,
before_compression_table_bytes bigint,
before_compression_index_bytes bigint,
before_compression_toast_bytes bigint,
before_compression_total_bytes bigint,
after_compression_table_bytes bigint,
after_compression_index_bytes bigint,
after_compression_toast_bytes bigint,
after_compression_total_bytes bigint,
node_name name)
LANGUAGE SQL
STABLE STRICT
AS 'SELECT * FROM @[email protected]_compression_stats($1)'
SET search_path TO pg_catalog, pg_temp;

-------------Get index size for hypertables -------
--schema_name - schema_name for hypertable index
-- index_name - index on hyper table
Expand Down
67 changes: 67 additions & 0 deletions sql/updates/latest-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,70 @@ LANGUAGE C VOLATILE;
DROP PROCEDURE IF EXISTS _timescaledb_functions.policy_compression_execute(job_id INTEGER, htid INTEGER, lag ANYELEMENT, maxchunks INTEGER, verbose_log BOOLEAN, recompress_enabled BOOLEAN, use_creation_time BOOLEAN);

DROP PROCEDURE IF EXISTS _timescaledb_functions.policy_compression(job_id INTEGER, config JSONB);

CREATE PROCEDURE @[email protected]_to_columnstore(
chunk REGCLASS,
if_not_columnstore BOOLEAN = true,
recompress BOOLEAN = false,
hypercore_use_access_method BOOL = NULL)
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
LANGUAGE C;

CREATE PROCEDURE @[email protected]_to_rowstore(
chunk REGCLASS,
if_columnstore BOOLEAN = true)
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
LANGUAGE C;

CREATE PROCEDURE @[email protected]_columnstore_policy(
hypertable REGCLASS,
after "any" = NULL,
if_not_exists BOOL = false,
schedule_interval INTERVAL = NULL,
initial_start TIMESTAMPTZ = NULL,
timezone TEXT = NULL,
created_before INTERVAL = NULL,
hypercore_use_access_method BOOL = NULL
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_update_placeholder';

CREATE PROCEDURE @[email protected]_columnstore_policy(
hypertable REGCLASS,
if_exists BOOL = false
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_update_placeholder';

CREATE FUNCTION @[email protected]_columnstore_stats (hypertable REGCLASS)
RETURNS TABLE (
chunk_schema name,
chunk_name name,
compression_status text,
before_compression_table_bytes bigint,
before_compression_index_bytes bigint,
before_compression_toast_bytes bigint,
before_compression_total_bytes bigint,
after_compression_table_bytes bigint,
after_compression_index_bytes bigint,
after_compression_toast_bytes bigint,
after_compression_total_bytes bigint,
node_name name)
LANGUAGE SQL
STABLE STRICT
AS 'SELECT * FROM @[email protected]_compression_stats($1)'
SET search_path TO pg_catalog, pg_temp;

CREATE FUNCTION @[email protected]_columnstore_stats (hypertable REGCLASS)
RETURNS TABLE (
total_chunks bigint,
number_compressed_chunks bigint,
before_compression_table_bytes bigint,
before_compression_index_bytes bigint,
before_compression_toast_bytes bigint,
before_compression_total_bytes bigint,
after_compression_table_bytes bigint,
after_compression_index_bytes bigint,
after_compression_toast_bytes bigint,
after_compression_total_bytes bigint,
node_name name)
LANGUAGE SQL
STABLE STRICT
AS 'SELECT * FROM @[email protected]_compression_stats($1)'
SET search_path TO pg_catalog, pg_temp;
3 changes: 1 addition & 2 deletions sql/updates/post-update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ BEGIN
format('%I.%I', user_view_schema, user_view_name)
FROM _timescaledb_catalog.continuous_agg
WHERE finalized IS FALSE
AND current_setting('server_version_num')::int >= 150000
ORDER BY 1
LOOP
RAISE WARNING 'Continuous Aggregate: % with old format will not be supported on PostgreSQL version greater or equal to 15. You should upgrade to the new format', cagg_name;
RAISE WARNING 'Continuous Aggregate "%" with old format will not be supported in the next version. You should use `cagg_migrate` procedure to migrate to the new format.', cagg_name;
END LOOP;
END $$;

Expand Down
13 changes: 13 additions & 0 deletions sql/updates/reverse-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ LANGUAGE C VOLATILE;
DROP PROCEDURE IF EXISTS _timescaledb_functions.policy_compression_execute(job_id INTEGER, htid INTEGER, lag ANYELEMENT, maxchunks INTEGER, verbose_log BOOLEAN, recompress_enabled BOOLEAN, use_creation_time BOOLEAN, useam BOOLEAN);

DROP PROCEDURE IF EXISTS _timescaledb_functions.policy_compression(job_id INTEGER, config JSONB);
DROP PROCEDURE IF EXISTS @[email protected]_to_columnstore(REGCLASS, BOOLEAN, BOOLEAN, BOOLEAN);
DROP PROCEDURE IF EXISTS @[email protected]_to_rowstore(REGCLASS, BOOLEAN);
DROP PROCEDURE IF EXISTS @[email protected]_columnstore_policy(REGCLASS, "any", BOOL, INTERVAL, TIMESTAMPTZ, TEXT, INTERVAL, BOOL);
DROP PROCEDURE IF EXISTS @[email protected]_columnstore_policy(REGCLASS, BOOL);
DROP FUNCTION IF EXISTS @[email protected]_columnstore_stats(REGCLASS);
DROP FUNCTION IF EXISTS @[email protected]_columnstore_stats(REGCLASS);

ALTER EXTENSION timescaledb DROP VIEW timescaledb_information.hypertable_columnstore_settings;
ALTER EXTENSION timescaledb DROP VIEW timescaledb_information.chunk_columnstore_settings;

DROP VIEW timescaledb_information.hypertable_columnstore_settings;
DROP VIEW timescaledb_information.chunk_columnstore_settings;

7 changes: 7 additions & 0 deletions sql/views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,12 @@ CREATE OR REPLACE VIEW timescaledb_information.chunk_compression_settings AS
FROM unnest(s.orderby, s.orderby_desc, s.orderby_nullsfirst) un(orderby, "desc", nullsfirst)
) un ON true;


CREATE OR REPLACE VIEW timescaledb_information.hypertable_columnstore_settings
AS SELECT * FROM timescaledb_information.hypertable_compression_settings;

CREATE OR REPLACE VIEW timescaledb_information.chunk_columnstore_settings AS
SELECT * FROM timescaledb_information.chunk_compression_settings;

GRANT SELECT ON ALL TABLES IN SCHEMA timescaledb_information TO PUBLIC;

8 changes: 4 additions & 4 deletions src/compression_with_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@

static const WithClauseDefinition compress_hypertable_with_clause_def[] = {
[CompressEnabled] = {
.arg_name = "compress",
.arg_names = {"compress", "enable_columnstore", NULL},
.type_id = BOOLOID,
.default_val = (Datum)false,
},
[CompressSegmentBy] = {
.arg_name = "compress_segmentby",
.arg_names = {"compress_segmentby", "segmentby", NULL},
.type_id = TEXTOID,
},
[CompressOrderBy] = {
.arg_name = "compress_orderby",
.arg_names = {"compress_orderby", "orderby", NULL},
.type_id = TEXTOID,
},
[CompressChunkTimeInterval] = {
.arg_name = "compress_chunk_time_interval",
.arg_names = {"compress_chunk_time_interval", NULL},
.type_id = INTERVALOID,
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/process_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -2960,10 +2960,10 @@ typedef enum HypertableIndexFlags
} HypertableIndexFlags;

static const WithClauseDefinition index_with_clauses[] = {
[HypertableIndexFlagMultiTransaction] = {.arg_name = "transaction_per_chunk", .type_id = BOOLOID,},
[HypertableIndexFlagMultiTransaction] = {.arg_names = {"transaction_per_chunk", NULL}, .type_id = BOOLOID,},
#ifdef DEBUG
[HypertableIndexFlagBarrierTable] = {.arg_name = "barrier_table", .type_id = REGCLASSOID,},
[HypertableIndexFlagMaxChunks] = {.arg_name = "max_chunks", .type_id = INT4OID, .default_val = (Datum)-1},
[HypertableIndexFlagBarrierTable] = {.arg_names = {"barrier_table", NULL}, .type_id = REGCLASSOID,},
[HypertableIndexFlagMaxChunks] = {.arg_names = {"max_chunks", NULL}, .type_id = INT4OID, .default_val = (Datum)-1},
#endif
};

Expand Down
Loading

0 comments on commit 33a521a

Please sign in to comment.