76 Commits

Author SHA1 Message Date
Mats Kindahl
92b6c03e43 Remove cascade option from drop_chunks
This commit removes the `cascade` option from the function
`drop_chunks` and `add_drop_chunk_policy`, which will now never cascade
drops to dependent objects.  The tests are fixed accordingly and
verbosity turned up to ensure that the dependent objects are printed in
the error details.
2020-06-02 16:08:51 +02:00
Brian Rowe
3d3824dbc1 Fix some issues with num_dist_tables
This change fixes a couple issues with the num_dist_tables column of
the timescaledb_information.data_node view.  The first fix will
allow the column to correctly report 0 when no tables are yet created
(it currently will count a NULL table as 1 in this case).  The second
fix addresses a bug in the dist_util_remote_hypertable_info function
which was causing the code to only see the first hypertable returned.
This second bug will also cause incorrect results for many of our usage
reporting views and utilities when there are multiple distributed
hypertables.
2020-05-27 17:31:09 +02:00
Brian Rowe
79fb46456f Rename server to data node
The timescale clustering code so far has been written referring to the
remote databases as 'servers'.  This terminology is a bit overloaded,
and in particular we don't enforce any network topology limitations
that the term 'server' would suggest.  In light of this we've decided
to change to use the term 'node' when referring to the different
databases in a distributed database.  Specifically we refer to the
frontend as an 'access node' and to the backends as 'data nodes',
though we may omit the access or data qualifier where it's unambiguous.

As the vast bulk of the code so far has been written for the case where
there was a single access node, almost all instances of 'server' were
references to data nodes.  This change has updated the code to rename
those instances.
2020-05-27 17:31:09 +02:00
Brian Rowe
e110a42a2b Add space usage utilities to distributed database
This change adds a new utility function for postgres
`server_hypertable_info`.  This function will contact a provided node
and pull down the space information for all the distributed hypertables
on that node.

Additionally, a new view `distributed_server_info` has been added to
timescaledb_information.  This view leverages the new
remote_hypertable_data function to display a list of nodes, along with
counts of tables, chunks, and total bytes used by distributed data.

Finally, this change also adds a `hypertable_server_relation_size`
function, which, given the name of a distributed hypertable, will print
the space information for that hypertable on each node of the
distributed database.
2020-05-27 17:31:09 +02:00
niksa
6f3848e744 Add function to check server liveness
Try connecting to a server and running `SELECT 1`. It returns true
if succeed. If fails false is returned. There can be many reasons to
fail: no valid UserMapping, server is down or failed running `SELECT 1`.
More information about failure is written to server log.

`timescaledb_information.server` view is updated to show server status.
2020-05-27 17:31:09 +02:00
niksa
538e27d140 Add Noop Foreign Data Wrapper
This adds a skeleton TimescaleDB foreign data wrapper (FDW) for
scale-out clustering. It currently works as a noop FDW that can be
used for testing, although the intention is to develop it into a
full-blown implementation.
2020-05-27 17:31:09 +02:00
Erik Nordström
eca7cc337a Add server management API and functionality
Servers for a scale-out clustering setup can now be added and deleted
with `add_server()` and `delete_server()`, providing a convenience API
for server management.

While similar functionality can be achieved using the standard
PostgreSQL `CREATE SERVER` and `CREATE USER MAPPING` commands, this
new API makes it easier to add clustering servers and user mappings
consistent with the needs of TimescaleDBs particular clustering setup.

The API currently works with the `postgres_fdw` foreign data
wrapper. It will be updated to use our own foreign data wrapper once
it is available.
2020-05-27 17:31:09 +02:00
Derek Marsh
88773323f4 Ignore dropped chunks in compressed_chunk_stats 2020-04-16 16:34:46 +02:00
Sven Klemm
cbda1acd4f Record cagg view state in catalog
Record materialized_only state of continuous aggregate view in
catalog and show state in timescaledb_information.continuous_aggregates.
2020-04-14 06:57:33 +02:00
gayyappan
baaa41bf91 Modify continuous_aggregate_stats view definition
last_run_success value is reset when a job is started.
So mask the value if the status of a job is
running, otherwise it will show an incorrect state.

Fixes #1781
2020-03-31 13:34:24 -04:00
Mats Kindahl
cbe06c3b72 Handle undefined ignore_invalidation_older_than
If `ignore_invalidation_older_than` is undefined, it is set to maximum
for `BIGINT` type. This is not handled in `continuous_aggregates`
information schema so the column shows up as a very strange value.

This commit fixes this by checking if `ignore_invalidation_older_than`
is set to maximum, and uses `NULL` in the view in that case, which will
show up as empty.
2020-03-19 16:55:04 +01:00
gayyappan
a2629cbff2 Add ignore_invalidation_older_than to view
Add ignore_invalidation_older_than parameter to
timescaledb_information.continuous_aggregates view

Fixes #1664
2020-02-03 11:31:12 -05:00
Matvey Arye
e44be9c03a Add jobs to timescaledb_information.policy_stats
Add the compression and continuous aggs job types to the
timescaledb_information.policy_stats view. It is a bug
that it wasn't there before.
2020-01-03 14:18:13 -05:00
gayyappan
87786f1520 Add compressed table size to existing views
Some information views report hypertable sizes. Include
compressed table size in the calculation when applicable.
2019-10-29 19:02:58 -04:00
gayyappan
43aa49ddc0 Add more information in compression views
Rename compression views to compressed_hypertable_stats and
compressed_chunk_stats and summarize information about compression
status for chunks.
2019-10-29 19:02:58 -04:00
gayyappan
7a728dc15f Add view for compression size
View for compressed_chunk_size and compressed_hypertable_size
2019-10-29 19:02:58 -04:00
Matvey Arye
7ea492f29e Add last_successful_finish to bgw_job_stats
This allows people to better monitor the bgw job health. It
indicates when the last time the job made progress was.
2019-10-15 19:14:14 -04:00
gayyappan
5a0a73eabd Add columns to continuous_aggregate_stats view
Add more information about job history for continuous aggregate
background worker jobs.
2019-07-08 12:54:10 -04:00
Joshua Lockerman
899cd0538d Allow scheduled drop_chunks to cascade to aggs
This commit adds a cascade_to_materializations flag to the scheduled
version of drop_chunks that behaves much like the one from manual
drop_chunks: if a hypertable that has a continuous aggregate tries to
drop chunks, and this flag is not set, the chunks will not be dropped.
2019-04-30 15:46:49 -04:00
Joshua Lockerman
ae3480c2cb Fix continuous_aggs info
This commit switches the remaining JOIN in the continuous_aggs_stats
view to LEFT JOIN. This way we'll still see info from the other columns
even when the background worker has not run yet.
This commit also switches the time fields to output text in the correct
format for the underlying time type.
2019-04-26 13:08:00 -04:00
gayyappan
b8f9b91e60 Add user view query definition for cont aggs
Add the query definition to
timescaledb_information.continuous_aggregates.

The user query (specified in the CREATE VIEW stmt of a continuous
aggregate) is transformed in the process of creating a continuous
aggregate and this modified query is saved in the pg_rewrite catalog
tables. In order to display the original query, we create an internal
view which is a replica of the user query. This is used to display the
definition in timescaledb_information.continuous_aggregates.

As an alternative we could save the original user query in our internal
catalogs.  But this approach involves replicating a lot of postgres code
and causes portability problems.
2019-04-26 13:08:00 -04:00
gayyappan
18d1607909 Add timescaledb_information views for continuous aggregates
Add timescaledb_information.continuous_aggregate_settings and timescaledb_information.continuous_aggregate_job_stats views
2019-04-26 13:08:00 -04:00
David Kohn
cf67ddd9b0 Add informational views for policies
Add views so that users can see what the parameters are for policies they have created
and a separate view so that they can see policies that have been created and scheduled on hypertables.
2019-01-25 13:51:52 -05:00
Sven Klemm
f89fd07c5b Remove year from SQL file license text
This changes the license text for SQL files to be identical
with the license text for C files.
2019-01-13 23:30:22 +01:00
Joshua Lockerman
65894f08cf Add view displaying info about the current license
Currently the view displays the current edition, expiry date, and
whether the license is expired. We're not displaying the license key
itself in the view as it can get rather long, and get be read via SHOW.
We also do not display the license's ID since that is for internal use.
2019-01-10 17:29:59 -05:00
Sven Klemm
d4619598a9 Add view to show hypertable information
Add timescaledb_information.hypertable view that lists
hypertables, their owner, number of chunks and storage size
2018-11-28 17:02:56 +01:00