2418 Commits

Author SHA1 Message Date
Sven Klemm
423e8fa527 Remove ORDER BY clause from timescaledb_information.jobs view
Remove the ORDER BY clause from timescaledb_information.jobs to
make it consistent with our other information views.
2020-09-29 17:07:51 +02:00
Sven Klemm
db0e210b8f Block REFRESH MATERIALIZED VIEW on caggs 2020-09-29 16:36:16 +02:00
gayyappan
98e1aa25ef Rename policy_stats view
Rename policy_stats view to job_stats
2020-09-29 10:00:17 -04:00
Mats Kindahl
02ad8b4e7e Turn debug messages into DEBUG1
We have some debug messages that are printed as notices, but are more
suitable to have at `DEBUG1` level. This commit removes a notice about
indexes being added and turns it into a `DEBUG1` notice.
2020-09-29 11:04:07 +02:00
Erik Nordström
d11256bad6 Rename policy parameters
Policy parameters are renamed to be more consistent and intuitive
across different policies.

Fixes #2442
2020-09-29 07:30:43 +02:00
Erik Nordström
882a247244 Support compiler-agnostic annotations
This change adds a compiler-agnostic annotation for fall-throughs in
switch statements. The definition is put in `annotations.h`, which can
be expanded to hold definitions for similar functionality in the
future.

The `clang` compiler (as of version 12) seems to have have dropped
support for the previous comment-based annotations to allow
fall-throughs in favor of native annotations or GCC-style attributes.
2020-09-29 06:54:24 +02:00
Sven Klemm
6cc9871be8 Make update test consistent
This patch changes the update test to use the same checks
between clean / updated install and dumped/restored install.
Previously only a small subset of the checks would be run against
the updated instance and most of the tests would only run against
the dumped and restored container.
2020-09-28 17:19:04 +02:00
Sven Klemm
9a5a4c0ede Replace heap_open by table_open
Starting with PG11 heap_open/_close is a macro that redirects to
table_open/_close. In PG13 those compatibility macros are being
removed so we have to use the actual function.
2020-09-28 15:08:52 +02:00
Sven Klemm
44a39dca85 Remove unused allocation in copy path
This patch removes allocation of 2 arrays in the copyfrom function
that were never used.
2020-09-28 15:08:52 +02:00
Sven Klemm
e1be29e161 Remove load-language pg_regress option
PL/pgSQL is installed by default starting with PostgreSQL 9.0 so
the parameter is not needed, additionally the parameter will
throw an error on PG13 pg_regress.
2020-09-28 12:15:42 +02:00
Sven Klemm
dbb9988eee Fix result ordering in tests
This patch fixes the result sorting in tests that had no ORDER BY
clause or where ORDER BY clause did not result in fixed ordering.
2020-09-28 12:15:42 +02:00
Sven Klemm
f874381e49 Set autovacuum_enabled to false for compressed chunks
Commit 8e1e6036 changed chunk compression to disable autovacuum
on compressed chunks but did not apply the setting to chunks
compressed before that change. So this patch changes chunks
compressed with previous version to disable autovacuum as well.
2020-09-28 11:43:54 +02:00
gayyappan
559007097f Rename continuous_aggregate_policy parameters
Continuous aggregate policy parameters start_interval/end_interval
are renamed to start_offset/end_offset
2020-09-25 23:34:01 -04:00
Brian Rowe
e79308218a Add invalidations for incomplete aggregates
As part of the 2.0 continous aggregate changes, we are removing the
continuous_aggs_completed_threshold table.  However, this may result
in currently running aggregates being considered complete even if
their completed threshold hadn't reached the invalidation threshold.
This change fixes this by adding an entry to the invalidation log
for any such aggregates.

Fixes #2314
2020-09-25 09:17:53 -07:00
Erik Nordström
2ecfefc2fd Cleanup invalidations tests
This change adds views for invalidation tables to simplify queries in
the test.
2020-09-25 13:38:01 +02:00
Erik Nordström
608d52dffc Merge adjacent invalidations during refresh
Since invalidations are inclusive in both ends, adjacent invalidations
can be merged. However, adjacency wasn't accounted for when merging
invalidations, which meant that a refresh could leave more
invalidations in the log than strictly necessary. Note that this
didn't otherwise affect the correctness of a refresh.
2020-09-25 13:38:01 +02:00
Erik Nordström
5f31fa53b3 Fix index attribute in invalidation scan
When setting up an index scan for invalidations, a table attribute
number was used instead of the corresponding index attribute
number. While the attribute numbers happened to be the same, it isn't
future proof to use the wrong attribute reference.
2020-09-25 13:38:01 +02:00
Mats Kindahl
fb4fec1834 Propagate grants in continuous aggregates
Before this commit, grants on continuous aggregates were not propagated
to the materialized hypertable, direct view, and partial view. With
this commit, grants on a continuous aggregate is propagated.

Fixes #2413
2020-09-25 13:01:21 +02:00
Michael J. Freedman
c2fb4ab753 Update Timescale License
* Add right-to-repair
* Add right-to-improve
* Remove Enterprise tier
* Remove Usage Limits from Community
* Other rights and simplifications
2020-09-24 10:01:48 -04:00
Ruslan Fomkin
9fedb63f80 Remove unused refresh arguments from invalidation
After recent refactoring the refresh window arguments are not used in
many invalidation functions. This fixes the code and removes unused
arguments to avoid future confusions.
2020-09-24 15:34:21 +02:00
Sven Klemm
eb30e54d92 Fix format strings used in tests
This patch fixes the format strings used to construct object names
in tests. The format strings used in those tests would break when
object names are involved that require quoting.
2020-09-24 12:54:45 +02:00
Mats Kindahl
6aae14c11f Allow owner change of continuous aggregate
Implements support for changing the owner of the continuous aggregate.
This will change the owner of the materialized hypertable, the
user view, the partial view, and the direct view.

Fixes #2414
Fixes #1277
2020-09-23 21:56:27 +02:00
Sven Klemm
6c59f57ccf Add timescaledb_information.jobs view
This patch adds a convenience view to list all configured jobs.
2020-09-22 18:53:24 +02:00
Erik Nordström
519863f460 Remove catalog options for continuous aggregates
This change removes the catalog options `refresh_lag`,
`max_interval_per_job` and `ignore_invalidation_older_than`, which are
no longer used.

Closes #2396
2020-09-22 14:39:01 +02:00
gayyappan
ecffe5af7d Add test for dimensions view
Create more than 2 dimensions and verify
that dimensions view displays information correctly.
2020-09-21 14:18:41 -04:00
Mats Kindahl
c321fe0ca0 Check insert privileges to create chunk
To create a chunk in a hypertable, it is currently necessary to be the
owner of the hypertable of the chunk. If a user has insert privileges
only, it will fail with an error message, which causes problems when
inserting data into distributed hypertables since the user cannot
create new chunks.

This commit changes this and only requires that the user has insert
privileges on the hypertable of the chunk for allowing creation of a
new chunk.

Closes #2393
2020-09-21 18:16:40 +02:00
Dmitry Simonenko
c15d8be7f7 Avoid having to cast time arg for cagg policy
This patch does a minor refactoring and adds a way to guess
interval argument type based on used cagg

Issue: #2286
2020-09-21 14:44:05 +03:00
Sven Klemm
e1a00eb517 Remove obsolete function definitions and macros
During refactoring continuous aggregates some function defintions
for functions that got removed were not removed from the header
file. Additionally a few other header files had function definitions
that no longer had an implementation or macros that were not used.
2020-09-21 13:22:47 +02:00
Sven Klemm
c85a0c4c33 Remove ts_dimension_info_create_open_interval_usec
Remove ts_dimension_info_create_open_interval_usec function because
it was no longer used. This patch also moves the add_dimension record
attribute numbers into the c file because it does not need to be
exported.
2020-09-21 13:22:47 +02:00
Sven Klemm
ddd6ce21e4 Remove duplicate find_em_expr_for_rel function
The functions find_em_expr_for_rel and ts_find_em_expr_for_rel are
identical. This patch removes find_em_expr_for_rel and changes all
call-sites to use ts_find_em_expr_for_rel.
2020-09-21 13:22:47 +02:00
Sven Klemm
6d7d99a588 Fix alter_job not updating new job fields
Fix bgw_job_tuple_update_by_id to also update scheduled and config
field of bgw_job.
2020-09-19 01:58:14 +02:00
Sven Klemm
17cc6f6bd7 Fix ApacheOnly regression test
The recently added test for hypertable detection used compression
which is not available in ApacheOnly tests so we move that test
to regresscheck-t. Additionally we move the other test in
plan_hypertable_cache to plan_expand_hypertable to reduce the number
of tests.
2020-09-18 20:27:56 +02:00
Erik Nordström
1c2142fd6c Check owner when refreshing a continuous aggregate
This change checks for ownership of the user view when refreshing a
continuous aggregate (it's assumed the other objects have the same
owner). This mimics the checks done when refreshing a regular
materialized view.

Fixes #2408
2020-09-18 15:59:22 +02:00
Erik Nordström
e2cefd9a80 Update README for continuous aggregates
The README that gives an overview of the implementation of continuous
aggregates is updated to reflect changes to the feature.

Fixes #2147
2020-09-18 12:09:48 +02:00
Mats Kindahl
7abe65d87e Fix field name in continuous_aggregate view
Rename the `refresh_interval` field in
`timescaledb_information.continuous_aggregate` view to match the
parameter name in `add_continuous_aggregate_policy`.
2020-09-18 10:13:23 +02:00
gayyappan
149d45289d Fix typo in chunks view
The is_compressed column for timescaledb_information.chunks
view is defined as TEXT instead of BOOLEAN
as true and false were specified using string literals.

Fixes #2409
2020-09-17 17:30:51 -04:00
gayyappan
c21839ddb9 Add test for tablespaces with views
Add test for chunks and hypertables view that shows
tablespaces.
2020-09-17 16:35:25 -04:00
Sven Klemm
c1bd79ebc7 Fix caggs width expression handling on int based hypertables
This patch changes the time_bucket validation to constify the width
argument so any immutable expression will be allowed. This change
allows continuous aggregates on hypertables with int8 time dimension
without requiring a workaround from a user to get the time_bucket
call accepted.
2020-09-16 20:32:48 +02:00
Sven Klemm
e79158e717 Run postgres regression test suite as part of our CI
During migration of CI from travis to github actions running
postgres regression test suite was missed. This patch changes
our regression workflow to run postgres regression test suite
as well.
2020-09-16 04:07:07 +02:00
Erik Nordström
5179447613 Remove completed threshold
The completed threshold in the TimescaleDB catalog is no longer used
by the refactored continuous aggregates, so it is removed.

Fixes #2178
2020-09-15 17:18:59 +02:00
Erik Nordström
c884fe43f0 Remove unused materializer code
The new refresh functionality for continuous aggregates replaces the
old materializer, which means some code is no longer used and should
be removed.

Closes #2395
2020-09-15 17:18:59 +02:00
Erik Nordström
27e44f20ac Cleanup functions to find continuous aggregates
This change cleans up and removes duplicate code for internal lookups
of continuous aggregates. A number of related error messages have also
been cleaned up and made conformant with the error style guide.
2020-09-15 17:18:59 +02:00
Ruslan Fomkin
01fc0de040 Fix failing isolation test on PG11.0
Early version of PG11 produces slightly different output for isolation
tests. Thus the affected tests are ignored.
continuous_aggs_concurrent_refresh is one of them and this commit adds
it to the ignored test list.
2020-09-15 15:30:07 +02:00
Ruslan Fomkin
555e6458f8 Release 2.0.0-beta6 2.0.0-beta6 2020-09-14 22:08:27 +02:00
gayyappan
602d9a9bf5 Remove continuous_aggregate_stats view
Stats for policies are exposed via
the policy_stats view. Remove continuous aggregate
stats view - the thresholds exposed via this
view are not relevant with the new API.
2020-09-14 15:13:37 -04:00
Erik Nordström
94dd9a33bf Allow REFRESH MATERIALIZED VIEW to refresh caggs
It is now possible to use `REFRESH MATERIALIZED VIEW` as an
alternative to `refresh_continuous_aggregate` when doing "infinite"
refreshes.
2020-09-14 20:47:04 +02:00
Ruslan Fomkin
6f1a0bd24a Remove options from continuous aggregate
Removes options refresh_lag, max_interval_per_job and
ignore_invalidation_older_than from continuous aggregate creation with
CREATE MATERIALIZED VIEW, since they are not related this statement
any more. They are already replaced with the corresponding options in
add_continuous_aggregate_policy.

This commit removes only options, while the options are still stored
in the catalog and need to be removed from there in a separate PR.
2020-09-14 19:14:04 +02:00
gayyappan
d5446dfcfd Update policy_stats view with additional fields
Update policy_stats view to make it more end user
friendly. These changes mirror the fields in
continuous_aggregate_stats.
2020-09-14 11:51:49 -04:00
Mats Kindahl
61b5d91c0e Error on create continuous aggregate with data
If a continuous aggregate is created using `CREATE MATERIALIZED VIEW`
using the `WITH DATA` option, it will fail with a segmentation fault if
executed inside a transaction or block. This is because starting a new
transaction in the middle of the statement will reset the SPI stack.

This commit fixes this by raising an error if `CREATE MATERIALIZED
VIEW` is not executed on top-level and `WITH DATA` is used either
directly or indirectly.

Closes #2371
2020-09-14 17:29:50 +02:00
Erik Nordström
4f74262991 Filter materialized hypertables in view
This change filters materialized hypertables from the hypertables
view, similar to how internal compression hypertables are
filtered.

Materialized hypertables are internal objects created as a side effect
of creating a continuous aggregate, and these internal hypertables are
still listed in the continuous_aggregates view.

Fixes #2383
2020-09-14 13:04:59 +02:00