273 Commits

Author SHA1 Message Date
Sven Klemm
1f9bd81ee0 Adjust CI ignore lists to isolation test renames
Commit 6a8c2b66 renamed cagg tests in isolationcheck-t to have a
common prefix but did not adjust the CI ignorelists to reflect
that change.
2022-01-16 14:46:58 +01:00
Sven Klemm
69b267071a Bump copyright year in license descriptions
Bump year in copyright information to 2022 and adjust same scripts
to reference NOTICE that didn't have the reference yet.
This patch also removes orphaned test/expected/utils.out.
2022-01-14 18:35:46 +01:00
gayyappan
d8d392914a Support for compression on continuous aggregates
Enable ALTER MATERIALIZED VIEW (timescaledb.compress)
This enables compression on the underlying materialized
hypertable. The segmentby and orderby columns for
compression are based on the GROUP BY clause and time_bucket
clause used while setting up the continuous aggregate.

timescaledb_information.continuous_aggregate view defn
change

Add support for compression policy on continuous
aggregates

Move code from job.c to policy_utils.c
Add support functions to check compression
policy validity for continuous aggregates.
2021-12-17 10:51:33 -05:00
Duncan Moore
1bc1993c61 Post release 2.5.1 2021-12-03 13:51:11 -05:00
Mats Kindahl
210886e508 Ignore deadlock_recompress_chunk in early version
This isolation test will fail in early versions of the PG servers, just
like the other isolation tests, so ignoring failures for it.
2021-12-02 11:33:16 +01:00
Sven Klemm
0a82e7f0ab Add ABI test for minimum required pg version
This patch adds a test to detect changes in minimum required pg versions
for our packages. We build timescaledb against latest postgres version
and then run the tests with that library loaded into previous postgres
version. This patch also changes the ABI test for maximum compatible
postgres version to use the same format and removes the old ABI test
code.
2021-11-18 17:17:14 +01:00
Mats Kindahl
ecb59170d3 Add krb5-dev dependency to alpine build
The header file `gssapi/gssapi.h` is present in Alpine package
`krb5-dev` but for some reason it was not installed prior to building,
causing upgrade and downgrade test failures.
2021-11-17 11:41:09 +01:00
Alexander Kuzmenkov
4a17d4c402 Add shellcheck to CI
Writing a shell script correctly can be hard even for a skilled
programmer. shellcheck is a static analysis tool that helps catch
common errors in shell scripts. We now have 36 executable scripts in
our repository, for which shellcheck reports 126 errors (calculated
like find . -type f -executable -exec bash -c '[ "$(file --brief
--mime-type "$1")" == "text/x-shellscript" ]' sh {} \; -exec shellcheck
-f gcc --exclude=SC2086 {} \; | cut -d: -f1 | sort | uniq | wc -l).
This commit fixes these warnings and adds a GitHub actions workflow
that runs shellcheck on all the executable shell scripts in the
repository. The warning SC2086: Double quote to prevent globbing and
word splitting is disabled globally, because it has little practical
consequences, sometimes leads to false positives, and is general is too
widespread because people forget to quote.
2021-11-15 14:54:14 +03:00
Sven Klemm
c91faad221 Add coccinelle workflow to CI
This patch adds a workflow to run coccinelle scripts against our
codebase. This can be used to find errors in the code base.
The initial patch adds a check to find unbalanced heap_form_tuple
heap_freetuple occurances.

https://coccinelle.gitlabpages.inria.fr/website/
2021-11-15 10:56:12 +01:00
Sven Klemm
e4ec15d881 Bump postgres versions used in CI to 12.9, 13.5, 14.1 2021-11-14 20:43:39 +01:00
Fabrízio de Royes Mello
df7f058ad1 Post release 2.5.0
Add 2.5.0 to update test scripts for PG12 and PG13 and create update
test script for PG14.

Fix missing CHANGELOG thanks for external contributors.
2021-10-28 10:09:19 -03:00
Sven Klemm
0fecefdafa Skip chunk_utils for PG12
Skip the chunk_utils test on PG12 instead of ignoring it because
since the test segfaults it might actually cancel other tests
even though it doesn't run in parallel.
2021-10-26 20:48:41 +02:00
Sven Klemm
a9e00497a2 Improve memory tests
This patch implements various improvements to the memory tests.
Memory tests are split off into separate workflow to allow running
them separately from prerelease tests by pushing to branch
memory_test. The scripts are adjusted to no longer build docker
images to run the tests but instead running the tests directly.
The python script to monitor memory usage was improved and now
flushes after printing to make output appear consistently in CI.
This patch also changes the memory test to run on PG 12,13 and 14
instead of only 12.
2021-10-26 20:48:41 +02:00
Markos Fountoulakis
6d9715a951 Fix compiler warnings
Fix compiler warnings for MacOS 10.15 build.
2021-10-26 14:02:54 +03:00
Markos Fountoulakis
221437e8ef Continuous aggregates for distributed hypertables
Add support for continuous aggregates for distributed hypertables by
allowing a continuous aggregate to read from a distributed hypertable
so that the continuous aggregate is on the access node while the
hypertable data is on the data nodes.

For distributed hypertables, both the hypertable and continuous
aggregate invalidation log are kept on the data nodes and the refresh
window is computed at refresh time on each data node. Since the
continuous aggregate materialization hypertable is not present on the
data nodes, the invalidation log was extended to allow using a
non-local hypertable id on the data nodes. This means that you cannot
create continuous aggregates on the data nodes since those could clash
with continuous aggregates on the access node.

Some utility statements added entries to the invalidation logs
directly (truncating chunks and hypertables, as well as dropping
individual chunks), so to handle this case, internal functions were
added to allow logging invalidation on the data nodes from the access
node.

The commit also includes some fixes to memory context usage that
caused crashes for invalidation triggers and also disable per data
node queries during refresh since that would otherwise generate an
exception.

Fixes #3435

Co-authored-by: Mats Kindahl <mats@timescale.com>
2021-10-25 18:20:11 +03:00
Sven Klemm
4ff1bd3636 Ignore chunk_utils test results on PG 12.0
Postgres 12.0 has a use-after-free bug in the event trigger code
leading to a failing chunk_utils test in our nightly CI runs.
This patch ignores this test for runs on PG 12.0.

https://github.com/postgres/postgres/commit/93f726c0
2021-10-22 21:59:04 +02:00
Sven Klemm
01bf6518d4 Ignore pg_dump test result in macos PR tests
Since pg_dump fails very often on macos we ignore the result of
this test for PRs on macos.
2021-10-18 21:31:44 +02:00
Sven Klemm
e321d5212c Add more PG14 tests to CI
This patch adds PG14 coverity, release, apache and snapshot tests to CI.
2021-10-18 20:20:41 +02:00
Erik Nordström
57744c84ce Adjust cost estimates for distributed queries
To improve remote query push down, do the following:

* Import changes to remote cost estimates from PostgreSQL 14
  `postgres_fdw`. The cost estimations for distributed (remote)
  queries are originally based on the `postgres_fdw` code in
  PG11. However, fixes and changes have been applied in never
  PostgreSQL versions, which improves, among other things, costing of
  sorts and having clauses.
* Increase the cost of transferring tuples. This penalizes doing
  grouping/aggregation on the AN since it requires transferring more
  tuples, leading to the planner preferring the push-down plans.
* As a result of the above, the improved costing also makes
  distributed queries behave similar across all currently supported
  PostgreSQL versions for our test cases.
* Enable `dist_query` tests on PG14 (since it now passes).
* Update the `dist_partial_agg` test to use additional ordering
  columns so that there is no diff in the test output due to ordering
  of input to the `first` and `last` functions.
2021-10-15 15:34:08 +02:00
Sven Klemm
2f7bb43fe0 No longer require -DEXPERIMENTAL for PG14
Change cmake to no longer require -DEXPERIMENTAL when building
against PG14. Run more PG14 tests (32bit, windows, sanitizer).
2021-10-14 02:14:37 +02:00
Sven Klemm
bfe2b08350 Make dist_partial_agg output pg version specific
The plan output of the dist_partial_agg test is different on PG14
so we need to make it PG version specific. On PG14 sorts are pushed
down more often leading to better plans in some cases.
This also updates the dist_hypertable-14 test output which differs
to previous PG versions due to some renumbering of relation aliases.
2021-10-13 13:33:44 +02:00
Fabrízio de Royes Mello
de2d446cb2 Add handling of new ALTER TABLE options in PG14
PG14 introduced new `ALTER TABLE` sub-commands:

* `.. ALTER COLUMN .. SET COMPRESSION`: handled it properly on
  `process_utility` hook code and added related regression tests

* `.. DETACH PARTITION .. {CONCURRENTLY | FINALIZE}`: handled it
  properly on `process_utility` hook code but there's no need to add
  regression tests because we don't rely to native partitioning in
  hypertables.

Closes #3643
2021-10-12 19:01:20 -03:00
Sven Klemm
8d12b28a00 Fix UPSERT for PG14
Adjust code to upstream UPDATE/DELETE changes. PG14 refactored the way
UPDATEs and DELETEs are planned and executed.

https://github.com/postgres/postgres/commit/86dc90056d
2021-10-12 14:11:13 +02:00
Sven Klemm
bfe3603d57 Move pg version specific part of create_hypertable test with custom partition type
Since custom types are hashable in PG14 the partition test will be
different on PG14. Since the only difference was testing whether
creating hypertable with custom type paritition throws errors
without partitioning function that specific test got moved to ddl
tests which already is pg version specific.
2021-10-11 21:07:02 +02:00
Sven Klemm
d959828155 Don't use VACUUM VERBOSE in vacuum tests
VACUUM VERBOSE is the source for flaky tests and we don't gain much
by including the verbose output in the test. Additionally removing
the verbose option prevents us from having to make the vacuum tests
pg-version specific as PG14 slightly changes the formatting of the
VACUUM VERBOSE output.
2021-10-09 00:36:10 +02:00
Sven Klemm
4d425d9470 Disable memoize node for append and transparent_decompression tests
With memoize enabled PG14 append tests produce a very different
plan compared to previous PG versions. To make comparing plans
between PG versions easier we disable memoize for PG14.
PG14 also modified how EXTRACT is shown in EXPLAIN output
so any query using EXTRACT will have different EXPLAIN output
between PG14 and previous versions.
2021-10-09 00:15:23 +02:00
Sven Klemm
90d1a390c7 Require successful PG14 tests for PRs
The previous PR enabling tests on PG14 did not actually require
tests to pass but with INSERT support merged and most of the tests
passing it makes sense to require tests to pass to not introduce
regression and explicitly not require the currently known failing
tests.
2021-10-08 22:35:46 +02:00
Sven Klemm
6b69c781ba Add PG14 to our CI 2021-10-05 20:20:57 +02:00
Sven Klemm
6838fcf906 Post 2.4.2 release
Update version numbers and add 2.4.2 to update tests.

We have to put the DROP FUNCTION back in latest-dev because
2.4.2 did not include the commit which removed the function
definitions.
2021-09-22 18:20:30 +02:00
Mats Kindahl
592e0bd46e Rename on all continuous aggregate objects
When renaming a column on a continuous aggregate, only the user view
column was renamed. This commit changes this by applying the rename on
the materialized table, the user view, the direct view, and the partial
view, as well as the column name in the dimension table.

Since this also changes some of the table definitions, we need to
perform the same rename in the update scripts as well, which is done by
comparing the direct view and the user view to decide what columns that
require a rename and then executing that rename on the direct view,
partial view, and materialization table, as well as updating the column
name in the dimension table.

When renaming columns in tables with indexes, the column in the table
is renamed but not the column in the index, which keeps the same name.
When restoring from a dump, however, the column name of the table is
used, which create a diff in the update test. For that reason, we
change the update tests to not list index definitions as part of the
comparison. The existance of the indexes is still tracked and compared
since the indexes for a hypertable is listed as part of the output.

If a downgrade does not revert some changes, this will cause a diff in
the downgrade test. Since the rename is benign and not easy to revert,
this will cause test failure. Instead, we add a file to do extra
actions during a clean-rerun to prevent these diffs. In this case,
applying the same renames as the update script.

Fixes #3405
2021-09-20 12:18:52 +02:00
Sven Klemm
2ee30f9d81 Run CI against PG snapshots
Run CI against PG snapshots to discover potential issues with
upcoming PG releases earlier.
2021-08-30 19:30:31 +02:00
Mats Kindahl
86cd8f6532 Post 2.4.1 release
Updates `version.config` and adds new version to update tests.
2021-08-24 10:42:29 +02:00
Sven Klemm
c5ecbbc25b Bump postgres versions used in CI to latest
Since the isolationtester got modified to improve the query result
output which got backported in to PG12 and PG13 we have to adjust
all isolationtester output.

https://github.com/postgres/postgres/commit/4a05406
2021-08-17 18:06:03 +02:00
Mats Kindahl
bff87a8e2b Disable tests by default if tools are not found
If tools like `pg_regress` or `pg_isolation_regress` are not found, an
error is generated telling you that you need to disable the tests
explicitly using `REGRESS_CHECKS`. This is an inconvenience for the
user since in most cases you just want to build the system with what
you have.

This commit changes that by automatically disabling regression tests,
isolation tests, TAP tests, and formatting targets when tools cannot be
found, which means that users do not normally have to disable tests
explicitly. A notice is still printed that the targets are not added.

In addition, the commit adds an option `REQUIRE_ALL_TESTS` for the rare
case when you want to make sure that all tests are indeed executed (for
example, in CI runs), which by default is off.
2021-08-11 15:28:09 +02:00
gayyappan
9ea77fb97f Post release 2.4.0
Add tests to update from 2.4.0
Fix up version.config
Fix view creation stmt in views_experimental.sql that
causes extension update failures.
2021-07-30 17:51:30 -04:00
Mats Kindahl
b5ffc71071 Post-release steps for release 2.3.1
Add 2.3.1 to the update tests and update the downgrade target for the
downgrade version. This commit also fixes two issues that were fixed in
the release branch:

1. Drop `_timescaledb_internal.refresh_continuous_aggregate`
2. Update the changelog to match the release branch.
2021-07-08 14:31:01 +02:00
Mats Kindahl
a58ebdb3b4 Split update and downgrade version
During an update, it is not possible to run the downgrade scripts until
the release has been tagged, but the update scripts can be run. This
means that we need to split the previous version into two different
fields: one for running the update tests and one for running the
downgrade tests.
2021-07-01 16:05:31 +02:00
Mats Kindahl
e28b9d0d60 Export variables to docker-build
This commit export the `GENERATE_DOWNGRADE_SCRIPT` and `PG_VERSION`
variables from `test_downgrade_to_tag.sh` to `docker-build.sh`.
2021-06-29 09:42:35 +02:00
Markos Fountoulakis
20db06891a Fix ABI breakage test in CI
Add the files that had been missing from the docker environment since
the introduction of the downgrade scripts.
2021-06-25 12:13:54 +03:00
Mats Kindahl
15b46818ea Generate downgrade script
This commit add functions and code to generate a downgrade script from
the current version to the previous version. This requires execution
from a Git repository since it retrieves the prolog and epilog for the
"downgrade" file from the version given by `update_from_version` in the
`version.config` file.

The commit adds several CMake functions that simplifies the composition
of script files, but these are not used to generate the update scripts.
A potential improvement is to use the scripts to also generate the
update scripts.

This commit supports generating a downgrade script from the
current version to the previous version. Other versions are handled
using a variable containing file names of reverse update
scripts and  the source and target version is extracted from the file
names, which is assumed to be of the form
`<source-version>--<target-version>.sql`.

In addition to adding support for generating downgrade scripts, the
commit adds a downgrade test file that tests a release in a similar way
to the update script and adds it as a workflow.
2021-06-24 11:10:25 +02:00
Markos Fountoulakis
59d868bdf1 Run sanitizer tests on PG12
Change sanitizer test to run on PG12 and make it use the same
infrastructure as the other linux regression tests.

Co-authored-by: Sven Klemm <sven@timescale.com>
2021-06-22 11:42:48 +03:00
Nikhil
8aaef4ae14 Fix update tests to handle sequences
The post-update script was handling preserving initprivs for newly
added catalog tables and views. However, newly added catalog sequences
need separate handling otherwise update tests start failing. We also
now grant privileges for all future sequences in the update tests.

In passing, default the PG_VERSION in the update tests to 12 since we
don't work with PG11 anymore.
2021-06-21 13:22:08 +05:30
Mats Kindahl
71e8f13871 Add workflow and CMake support for formatting
Add a workflow to check that CMake files are correctly formatted as
well as a custom target to format CMake files in the repository. This
commit also runs the formatting on all CMake files in the repository.
2021-06-17 22:52:29 +02:00
Erik Nordström
a1cf610d3c Run ABI tests with TAP support
Install the Perl prerequisites when building the image for ABI tests,
including the `prove` binary.

Although the ABI tests currently don't run TAP tests, CMake still
failed the configuration since it expects the prerequisites to be
installed unless it is run with `-DTAP_CHECKS=off`.
2021-06-07 15:20:52 +02:00
Erik Nordström
8e1273cd13 Detect TAP test prerequisites with CMake
CMake now detects if the necessary prerequisites for running TAP
tests are installed on the local system. This includes perl
installation and other dependencies, such as the IPC::Run module and
prove binary.
2021-06-05 12:08:21 +02:00
Sven Klemm
fb863f12c7 Remove support for PG11
Remove support for compiling against PostgreSQL 11. This patch also
removes PG11 specific compatibility macros.
2021-06-01 20:21:06 +02:00
Sven Klemm
22ceabcb83 Remove PG11 specific test output files 2021-06-01 20:21:06 +02:00
Sven Klemm
e9066d5531 Remove PG11 from CI
Remove all CI runs against postgres 11
2021-06-01 20:21:06 +02:00
Erik Nordström
ec06f9a7d0 Add 2.3.0 to update test scripts
The update tests for PG11, PG12, and PG13 are updated to include
release 2.3.0.
2021-05-27 16:41:28 +02:00
Sven Klemm
72ed3a81c5 Explicitly install clang-9 in CI ubuntu images
GitHub removed default installation of clang-9 from the ubuntu
images but those are required to build postgres with llvm so we have
to explicitly install the required packages.

https://github.com/actions/virtual-environments/pull/3381
2021-05-20 21:26:47 +02:00