From 1373ec31f85857170827a019cc9352225916ea7d Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Fri, 9 Feb 2024 16:58:16 +0100 Subject: [PATCH] Rename compression TAM to hyperstore The access method and associated tests is renamed to "hyperstore". --- sql/compression.sql | 4 ++-- sql/updates/reverse-dev.sql | 2 +- src/utils.c | 2 +- tsl/src/process_utility.c | 4 ++-- .../{compression_tam.out => hyperstore.out} | 16 ++++++++-------- tsl/test/expected/hyperstore_scans.out | 2 +- tsl/test/sql/CMakeLists.txt | 2 +- .../sql/{compression_tam.sql => hyperstore.sql} | 10 +++++----- tsl/test/sql/hyperstore_scans.sql | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) rename tsl/test/expected/{compression_tam.out => hyperstore.out} (98%) rename tsl/test/sql/{compression_tam.sql => hyperstore.sql} (98%) diff --git a/sql/compression.sql b/sql/compression.sql index e1bd7aac4..c91aa99b4 100644 --- a/sql/compression.sql +++ b/sql/compression.sql @@ -5,5 +5,5 @@ CREATE FUNCTION ts_compressionam_handler(internal) RETURNS table_am_handler AS '@MODULE_PATHNAME@', 'ts_compressionam_handler' LANGUAGE C; -CREATE ACCESS METHOD tscompression TYPE TABLE HANDLER ts_compressionam_handler; -COMMENT ON ACCESS METHOD tscompression IS 'TimescaleDB columnar compression'; +CREATE ACCESS METHOD hyperstore TYPE TABLE HANDLER ts_compressionam_handler; +COMMENT ON ACCESS METHOD hyperstore IS 'TimescaleDB columnar compression'; diff --git a/sql/updates/reverse-dev.sql b/sql/updates/reverse-dev.sql index aa9ca0cae..91d3341c4 100644 --- a/sql/updates/reverse-dev.sql +++ b/sql/updates/reverse-dev.sql @@ -1,3 +1,3 @@ -- Hyperstore AM -DROP ACCESS METHOD IF EXISTS tscompression; +DROP ACCESS METHOD IF EXISTS hyperstore; DROP FUNCTION IF EXISTS ts_compressionam_handler; diff --git a/src/utils.c b/src/utils.c index 2c3a0cf9a..eb5a0c0f1 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1803,7 +1803,7 @@ bool ts_is_hypercore_am(Oid amoid) { if (!OidIsValid(hypercore_amoid)) - hypercore_amoid = get_table_am_oid("tscompression", true); + hypercore_amoid = get_table_am_oid("hyperstore", true); if (!OidIsValid(amoid) || !OidIsValid(hypercore_amoid)) return false; diff --git a/tsl/src/process_utility.c b/tsl/src/process_utility.c index b061cd728..e13034b3e 100644 --- a/tsl/src/process_utility.c +++ b/tsl/src/process_utility.c @@ -40,7 +40,7 @@ tsl_ddl_command_start(ProcessUtilityArgs *args) case AT_SetAccessMethod: { Oid relid = AlterTableLookupRelation(stmt, NoLock); - bool to_compressionam = (strcmp(cmd->name, "tscompression") == 0); + bool to_compressionam = (strcmp(cmd->name, "hyperstore") == 0); if (to_compressionam) compressionam_alter_access_method_begin(relid, false); @@ -204,7 +204,7 @@ tsl_ddl_command_end(EventTriggerData *command) case AT_SetAccessMethod: { Oid relid = AlterTableLookupRelation(stmt, NoLock); - bool to_compressionam = (strcmp(cmd->name, "tscompression") == 0); + bool to_compressionam = (strcmp(cmd->name, "hyperstore") == 0); compressionam_alter_access_method_finish(relid, !to_compressionam); break; } diff --git a/tsl/test/expected/compression_tam.out b/tsl/test/expected/hyperstore.out similarity index 98% rename from tsl/test/expected/compression_tam.out rename to tsl/test/expected/hyperstore.out index 47e6db702..f6c593bd2 100644 --- a/tsl/test/expected/compression_tam.out +++ b/tsl/test/expected/hyperstore.out @@ -74,15 +74,15 @@ WHERE location = 1; -- We should be able to set the table access method for a chunk, which -- will automatically compress the chunk. -ALTER TABLE :chunk SET ACCESS METHOD tscompression; +ALTER TABLE :chunk SET ACCESS METHOD hyperstore; SET timescaledb.enable_transparent_decompression TO false; -- Show access method used on chunk SELECT c.relname, a.amname FROM pg_class c INNER JOIN pg_am a ON (c.relam = a.oid) WHERE c.oid = :'chunk'::regclass; - relname | amname -------------------+--------------- - _hyper_1_1_chunk | tscompression + relname | amname +------------------+------------ + _hyper_1_1_chunk | hyperstore (1 row) -- This should show the chunk as compressed @@ -529,7 +529,7 @@ SELECT * FROM chunk_data_attrstats; -- ANALYZE also via hypertable root and show that it will -- recurse to another chunk -ALTER TABLE :chunk2 SET ACCESS METHOD tscompression; +ALTER TABLE :chunk2 SET ACCESS METHOD hyperstore; SELECT relname, reltuples, relpages FROM pg_class WHERE oid = :'chunk2'::regclass; @@ -668,9 +668,9 @@ FROM orig JOIN decomp USING (device) WHERE orig.count != decomp.count; 1 | 17384 | 17388 | 4 (1 row) --- Convert back to tscompression to check that metadata was cleaned up --- from last time this table used tscompression -ALTER TABLE :chunk SET ACCESS METHOD tscompression; +-- Convert back to hyperstore to check that metadata was cleaned up +-- from last time this table used hyperstore +ALTER TABLE :chunk SET ACCESS METHOD hyperstore; SET timescaledb.enable_transparent_decompression TO false; -- Get the chunk's corresponding compressed chunk SELECT format('%I.%I', c2.schema_name, c2.table_name)::regclass AS cchunk diff --git a/tsl/test/expected/hyperstore_scans.out b/tsl/test/expected/hyperstore_scans.out index 1f4391ceb..ef7434900 100644 --- a/tsl/test/expected/hyperstore_scans.out +++ b/tsl/test/expected/hyperstore_scans.out @@ -36,7 +36,7 @@ select format('%I.%I', chunk_schema, chunk_name)::regclass as chunk from timescaledb_information.chunks where format('%I.%I', hypertable_schema, hypertable_name)::regclass = 'readings'::regclass limit 1 \gset -alter table :chunk set access method tscompression; +alter table :chunk set access method hyperstore; -- -- Check that TID scan works for both compressed and non-compressed -- rows. diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index ff804960e..6ddad4d26 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -115,7 +115,7 @@ if((${PG_VERSION_MAJOR} GREATER_EQUAL "15")) merge_compress.sql cagg_query_using_merge.sql cagg_refresh_using_merge.sql - compression_tam.sql + hyperstore.sql hyperstore_scans.sql) endif() diff --git a/tsl/test/sql/compression_tam.sql b/tsl/test/sql/hyperstore.sql similarity index 98% rename from tsl/test/sql/compression_tam.sql rename to tsl/test/sql/hyperstore.sql index c8ee4f15a..1ae094f22 100644 --- a/tsl/test/sql/compression_tam.sql +++ b/tsl/test/sql/hyperstore.sql @@ -52,7 +52,7 @@ WHERE location = 1; -- We should be able to set the table access method for a chunk, which -- will automatically compress the chunk. -ALTER TABLE :chunk SET ACCESS METHOD tscompression; +ALTER TABLE :chunk SET ACCESS METHOD hyperstore; SET timescaledb.enable_transparent_decompression TO false; -- Show access method used on chunk @@ -256,7 +256,7 @@ SELECT * FROM chunk_data_attrstats; -- ANALYZE also via hypertable root and show that it will -- recurse to another chunk -ALTER TABLE :chunk2 SET ACCESS METHOD tscompression; +ALTER TABLE :chunk2 SET ACCESS METHOD hyperstore; SELECT relname, reltuples, relpages FROM pg_class WHERE oid = :'chunk2'::regclass; @@ -334,9 +334,9 @@ SELECT device, count(*) INTO decomp FROM readings GROUP BY device; SELECT device, orig.count AS orig_count, decomp.count AS decomp_count, (decomp.count - orig.count) AS diff FROM orig JOIN decomp USING (device) WHERE orig.count != decomp.count; --- Convert back to tscompression to check that metadata was cleaned up --- from last time this table used tscompression -ALTER TABLE :chunk SET ACCESS METHOD tscompression; +-- Convert back to hyperstore to check that metadata was cleaned up +-- from last time this table used hyperstore +ALTER TABLE :chunk SET ACCESS METHOD hyperstore; SET timescaledb.enable_transparent_decompression TO false; -- Get the chunk's corresponding compressed chunk diff --git a/tsl/test/sql/hyperstore_scans.sql b/tsl/test/sql/hyperstore_scans.sql index 0551d1ff4..26ff9f068 100644 --- a/tsl/test/sql/hyperstore_scans.sql +++ b/tsl/test/sql/hyperstore_scans.sql @@ -32,7 +32,7 @@ select format('%I.%I', chunk_schema, chunk_name)::regclass as chunk where format('%I.%I', hypertable_schema, hypertable_name)::regclass = 'readings'::regclass limit 1 \gset -alter table :chunk set access method tscompression; +alter table :chunk set access method hyperstore; -- -- Check that TID scan works for both compressed and non-compressed