Use chunk status for is_compressed field in view

The timescaledb_information.chunks view used to return NULL in the
is_compressed field for distributed chunks. This changes the view to
always return true or false, depending on the chunk status flags in the
Access Node. This is a hint and cannot be used as a source of truth for
the compression state of the actual chunks in the Data Nodes.
This commit is contained in:
Markos Fountoulakis 2021-05-17 17:19:58 +03:00 committed by Markos Fountoulakis
parent 45384357bd
commit adde40f548
3 changed files with 10 additions and 12 deletions

View File

@ -206,12 +206,10 @@ FROM (
ELSE
dimsl.range_end
END AS integer_range_end,
CASE WHEN node_list IS NULL THEN
CASE WHEN srcch.compressed_chunk_id IS NOT NULL THEN
TRUE
ELSE FALSE
END
ELSE NULL --distributed chunk case
CASE WHEN (srcch.status & 1 = 1) THEN --distributed compress_chunk() has definitely been called
--remote chunk compression status still uncertain
TRUE
ELSE FALSE --remote chunk compression status uncertain
END AS is_compressed,
pgtab.spcname AS chunk_table_space,
chdn.node_list

View File

@ -379,7 +379,7 @@ range_start | Wed Feb 28 16:00:00 2018 PST
range_end | Wed Mar 07 16:00:00 2018 PST
range_start_integer |
range_end_integer |
is_compressed |
is_compressed | f
chunk_tablespace |
data_nodes | {db_dist_compression_1,db_dist_compression_2}
-[ RECORD 2 ]----------+----------------------------------------------
@ -393,7 +393,7 @@ range_start | Wed Feb 28 16:00:00 2018 PST
range_end | Wed Mar 07 16:00:00 2018 PST
range_start_integer |
range_end_integer |
is_compressed |
is_compressed | f
chunk_tablespace |
data_nodes | {db_dist_compression_2,db_dist_compression_3}
-[ RECORD 3 ]----------+----------------------------------------------
@ -407,7 +407,7 @@ range_start | Wed Feb 28 16:00:00 2018 PST
range_end | Wed Mar 07 16:00:00 2018 PST
range_start_integer |
range_end_integer |
is_compressed |
is_compressed | f
chunk_tablespace |
data_nodes | {db_dist_compression_1,db_dist_compression_3}

View File

@ -77,9 +77,9 @@ SELECT * from timescaledb_information.chunks
ORDER BY hypertable_name, chunk_name;
hypertable_schema | hypertable_name | chunk_schema | chunk_name | primary_dimension | primary_dimension_type | range_start | range_end | range_start_integer | range_end_integer | is_compressed | chunk_tablespace | data_nodes
-------------------+-----------------+-----------------------+-----------------------+-------------------+--------------------------+------------------------------+------------------------------+---------------------+-------------------+---------------+------------------+---------------------------
public | dist_table | _timescaledb_internal | _dist_hyper_1_1_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | | | {view_node_1,view_node_2}
public | dist_table | _timescaledb_internal | _dist_hyper_1_2_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | | | {view_node_2,view_node_3}
public | dist_table | _timescaledb_internal | _dist_hyper_1_3_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | | | {view_node_1,view_node_3}
public | dist_table | _timescaledb_internal | _dist_hyper_1_1_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | t | | {view_node_1,view_node_2}
public | dist_table | _timescaledb_internal | _dist_hyper_1_2_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | f | | {view_node_2,view_node_3}
public | dist_table | _timescaledb_internal | _dist_hyper_1_3_chunk | time | timestamp with time zone | Wed Feb 28 16:00:00 2018 PST | Wed Mar 07 16:00:00 2018 PST | | | f | | {view_node_1,view_node_3}
(3 rows)
SELECT * from timescaledb_information.dimensions