From f30d15a99779db4ee72fa4260e3e7d14a43b7e5f Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko Date: Tue, 8 Sep 2020 14:08:14 +0300 Subject: [PATCH] Block compression policy with dist hypertable Issue: #2193 --- tsl/src/bgw_policy/compression_api.c | 9 +++++++++ tsl/test/expected/dist_compression.out | 6 ++++++ tsl/test/sql/dist_compression.sql | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/tsl/src/bgw_policy/compression_api.c b/tsl/src/bgw_policy/compression_api.c index 8896cde24..8947c41e8 100644 --- a/tsl/src/bgw_policy/compression_api.c +++ b/tsl/src/bgw_policy/compression_api.c @@ -118,6 +118,15 @@ policy_compression_add(PG_FUNCTION_ARGS) /* check if this is a table with compression enabled */ hypertable = ts_hypertable_cache_get_cache_and_entry(ht_oid, CACHE_FLAG_NONE, &hcache); + + if (hypertable_is_distributed(hypertable)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("add_compression_policy not implemented for distributed hypertable"), + errdetail( + "Current version doesn't implement support for add_compression_policy() on " + "distributed hypertables."))); + if (!TS_HYPERTABLE_HAS_COMPRESSION(hypertable)) { ts_cache_release(hcache); diff --git a/tsl/test/expected/dist_compression.out b/tsl/test/expected/dist_compression.out index 84032fa22..7961c0730 100644 --- a/tsl/test/expected/dist_compression.out +++ b/tsl/test/expected/dist_compression.out @@ -319,3 +319,9 @@ SELECT * FROM hypertable_detailed_size('compressed'::regclass) ORDER BY node_nam 16384 | 65536 | 0 | 81920 | db_dist_compression_3 (3 rows) +-- Test compression policy with distributed hypertable +-- +\set ON_ERROR_STOP 0 +SELECT add_compression_policy('compressed', '60d'::interval); +ERROR: add_compression_policy not implemented for distributed hypertable +\set ON_ERROR_STOP 1 diff --git a/tsl/test/sql/dist_compression.sql b/tsl/test/sql/dist_compression.sql index 545e02b79..f570c1004 100644 --- a/tsl/test/sql/dist_compression.sql +++ b/tsl/test/sql/dist_compression.sql @@ -100,3 +100,8 @@ SELECT * FROM chunks_detailed_size('compressed'::regclass) ORDER BY chunk_name, node_name; SELECT * FROM hypertable_detailed_size('compressed'::regclass) ORDER BY node_name; +-- Test compression policy with distributed hypertable +-- +\set ON_ERROR_STOP 0 +SELECT add_compression_policy('compressed', '60d'::interval); +\set ON_ERROR_STOP 1