224 Commits

Author SHA1 Message Date
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
Nikhil
4efa51cd8d Add tap tests infrastructure support
The TAP testing PG framework meets our requirements for doing
multinode/stand-alone-binaries testing for scenarios which need
individual multiple PG instances (multi-node testing is a prime
example).

This commit adds the necessary wrappers to allow the use of the TAP
testing framework in timescale code base. The README in "test/perl"
directory gives a fair idea of how to write tap tests. A simple tap
test has been added to provide a reference point for developers to
write new ones.

One can go to "build/tsl/test" and invoke "make checkprove" to see
the tap test in action.

Also includes changes for enabling github CI to run these taptests by
installing the requisite dependencies.

Includes changes to license checking scripts to handle new *.pl and
*.pm files.

Also added a new scripts/perltidyrc to aid in formatting of these
files.
2021-05-19 13:49:02 +05:30
Sven Klemm
45384357bd Bump postgres versions used in CI
Change CI tests to run against pg 11.12, 12.7 and 13.3.

The latest postgres versions adjusts the event_trigger test to
output the list of currently defined event triggers making the
test output different when timescaledb is installed since we
define our own event triggers. Due to this change we have to
ignore the result of this test in our CI.

https://github.com/postgres/postgres/commit/f3c45378
2021-05-18 16:22:23 +02:00
Mats Kindahl
b788168e59 Propagate grants to compressed hypertable
Grants and revokes where not propagated to compressed hypertables, if
the hypertable had a compressed hypertable, meaning that `pg_dump` and
`pg_restore` would not be able to dump nor restore the compressed part
of a hypertable unless they were owners and/or was a superuser.

This commit fixes this by propagating grants and revokes on a
hypertable to the associated compressed hypertable, if one exists,
which will then include the compressed hypertable and the associated
chunks in the grant and revoke execution.

It also adds code to fix the permissions of compressed hypertables and
all associated chunks in an update and adds an update test to check
that the permissions match.

Fixes #3209
2021-05-13 08:43:07 +02:00
Mats Kindahl
ec65866890 Add 2.2.1 to update test scripts
The update tests scripts for PG11, PG12, and PG13 are updated to
include 2.2.1.
2021-05-06 15:19:01 +02:00
Mats Kindahl
aeb107659b Copy recreated object permissions on update
Tables, indexes, and sequences that are recreated as part of an update
does not propagate permissions to the recreated object. This commit
fixes that by saving away the permissions in `pg_class` temporarily and
then copying them back into the `pg_class` table.

If internal objects are created or re-created, they get the wrong
initial privileges, which result in privileges not being dumped when
using `pg_dump`. Save away the privileges before starting the update
and restore them afterwards to make sure that the privileges are
maintained over the update.

For new objects, we use the initial privileges of the `chunk` metadata
table, which should always have correct initial privileges.

Fixes #3078
2021-04-26 08:36:57 +02:00
Sven Klemm
ec733de130 Add GitHub action for posting daily CI summary
This patch adds a GitHub action that posts all failed CI jobs in
the last 24 hours with link to the failed job.
2021-04-25 16:13:31 +02:00
Mats Kindahl
e7ffedbec7 Add update smoke test script
The update smoke test script can be used to test that an extension
works correctly. It will run the normal update tests, but do it against
a single server.

It also makes some minor refactorings of the update tests to make it
possible to run the tests against different versions of the server and
also support the smoke tests where some features cannot be tested.
2021-04-23 09:57:41 +02:00
Ruslan Fomkin
baaa9abddd Add 2.2.0 to update test scripts 2021-04-13 12:37:20 +02:00
Sven Klemm
349b298a05 Install clang-8 for PG11.0 CI test
clang-8 is no longer installed by default in the ubuntu images so
we have to explicitly install it for any actions that require it.

https://github.com/actions/virtual-environments/issues/2950
2021-04-05 17:33:09 +02:00
Ruslan Fomkin
574ef87426 Add 2.1.1 to update test scripts 2021-03-31 09:36:12 +02:00
Sven Klemm
4d871cbd26 Make readme names consistant
Most places in the source tree use README.md as filename for
additional documentation. This patch changes the filenames of
files using a different capitalization.
2021-03-26 10:03:44 +01:00
Sven Klemm
c5c24616f8 Switch CI to Ubuntu 20.04
Switch CI tasks currently running on Ubuntu 18.04 to 20.04 and
also switch some tasks that dont require specific version because
they run in docker containers to use ubuntu-latest instead.
All tasks switched to ubuntu-latest are expected to be ubuntu-version
agnostic because they run their actions in docker containers.
2021-03-22 12:42:58 +01:00
Sven Klemm
f18d9bf38b Add mangle_path to ignored symbols
When building timescaledb on Ubuntu 20.04 mangle_path is present
as exported symbol in binaries, making the export prefix check fail.
This patch changes the export prefix check to ignore mangle_path.
2021-03-22 12:42:58 +01:00
Dmitry Simonenko
c09f7e4252 Add script to test recovery using restore points 2021-03-19 17:55:01 +03:00
Mats Kindahl
0bc3f0b55a Factor out repair test from update test
In order to implement repair tests, changes are made to the
`constraint_check` table to simulate a broken dependency, which
requires the constraints on that table to be dropped. This means that
the repair runs without constraints, and a bug in the update test could
potentially not get caught.

This commit fixes this by factoring out the repair tests from the
update tests and run them as a separate pass. This means that the
contraints are not dropped in the update tests and bugs there will be
caught.

In addition, some bash functions are factored out into a separate file
to avoid duplication.
2021-03-17 17:57:44 +01:00
Sven Klemm
ed62df721f Run update test in GMT timezone
Due to a validation bug involving interval validation and the current
daylight savings time switch in the 1.7 releases the update tests that
includes 1.7 versions is currently failing. This patch changes CI
to run in GMT instead.
2021-03-16 02:57:42 +01:00
Sven Klemm
72c6114c68 Add update test for PG13 2021-03-16 02:57:42 +01:00
Mats Kindahl
231549184c Break out superuser operations in update tests
In order to support smoke-testing with a single server, the update
tests are refactored to not require a `postgres` user with full
privileges.

To support both running smoke tests and update tests, the following
changes where made:

- Database creation code was factored out of tests and is only executed
  for update tests.
- Since the default for `docker_pgscript` was to use the `postgres`
  database and the database creation code also switched database to
  `single` as part of the exection, the default of `docker_pgscript` is
  now changed to `single`.
- Parts of tests that changes roles during execution was removed since
  it is more suitable for a regression test. Some `GRANT` statements
  were kept for the update tests since they test that non-superuser
  privileges are propagated correctly.
- Operations that require escalated privileges are factored out into
  support functions that execute the original code for update tests and
  are no-ops for smoke tests.
- A dedicated `test_update_smoke` script was added that can run a smoke
  test against a single server.
2021-03-05 17:50:14 +01:00
Mats Kindahl
10b3da03ec Break out multinode update tests
This commit is part of a longer sequence to refactor the update tests
for use with smoke testing.

The multinode parts of the tests are broken out into a new version to
make the logic simpler.

- All multinode tests are now added to a new version, `v7` which allow
  us to create multinode objects only for versions that support
  multinode.
- Test script `test_updates_pg11` and `test_updates_pg12` are changed
  to use `v6` for updates from versions preceeding 2.0 and `v7` for
  versions 2.0 and later.
- Setup file `post.update.sql` is not needed any more since it was used
  to "fix" a pre-2.0 updated version to add data nodes so that it
  matched the clean setup. This is not necessary any more since v6 does
  not add data nodes for some versions and not for others.
2021-03-04 11:48:49 +01:00
Mats Kindahl
38493e9ab7 Refactor update tests for smoke testing
In order to support smoke-testing with a single server, the update
tests are refactored. This is part of a longer sequence of changes to
support both running smoke tests and update tests and contain the
following changes:

- All timestamp columns now have `not null` added to avoid spamming the
  output file and help finding the real issue.
- Extension of dump files are changed from `sql` to `dump` since they
  use the custom format and are not SQL files.
2021-03-03 08:57:29 +01:00
Sven Klemm
22870cfec6 Add 2.1.0 to update test scripts 2021-02-23 17:25:40 +01:00
Sven Klemm
ab736fda90 Add 2.0.2 to update test scripts 2021-02-21 20:13:09 +01:00
Dmitry Simonenko
2fb7034c8f Add 1.7.5 to update test scripts 2021-02-18 15:28:51 +03:00
Sven Klemm
39cb98bcc4 Fix sanitizer test
The sanitizer test is running on PG11.1 where the cluster test is
expected to fail. This patch changes the sanitizer test to ignore
the test result of the cluster test.
2021-02-18 12:13:14 +01:00
Sven Klemm
240df3262b Add PG13 to 32bit tests, coverity and cron tests 2021-02-16 19:30:51 +01:00
Sven Klemm
d6cd54b5a7 Bump postgres versions used in CI
Run tests on PG 11.11, 12.6 and 13.2
2021-02-12 22:54:32 +01:00
Sven Klemm
9c7b024705 Run regresscheck-t on PG13
This patch enables running regresscheck-t on PG13
2021-02-12 22:18:06 +01:00
Mats Kindahl
63a66524dd Change bootstrap and CMake defaults
In contrast to the default for CMake files, `Release` is used as the
default in `CMakeFiles.txt` which causes the `bootstrap` script to do a
release build with development flags, in particular `-Werror`. Since
warnings are triggered in a release build, this cause the build to
fail while a debug build works fine.

This commit fixes this by removing the `-Werror` flag (by setting
`WARNINGS_AS_ERRORS` to `OFF`) on anything that is not a debug build
and also disable the warnings that (currently) trigger the warnings in
the release build.

The commit also changes some of the GitHub workflows to run without
`WARNINGS_AS_ERRORS` since it should always work without this option
regardless of build type (on release build this should be disabled, on
debug builds this should be enabled).  But it is set to `ON` for the
full release and debug builds to ensure that we do not generate any
warnings, which will capture new surfacing warnings.

Fixes #2770
2021-02-09 15:00:13 +01:00
Sven Klemm
fa42b973f1 Fix typo in CI config
When adding the bugfix for clustered hypertables a typo was
introduced making the PG12.0 test run with PG11 settings.
2021-02-08 10:06:23 +01:00
Sven Klemm
d823987fe9 Fix changing column type of clustered hypertables
When changing the column type of a column that is part of an index
that is being clustered on with either postgres CLUSTER or reorder
the alter type operation would fail with a segfault because it
couldn't lookup the index.
2021-02-06 14:51:04 +01:00
Sven Klemm
99e450d2a3 Add 2.0.1 to update test scripts 2021-01-28 20:54:02 +01:00
Mats Kindahl
c71632542c Fix repair in update scripts
The commit fixes two bugs in the repair scripts that could
prevent an update in rare circumstances.

For the 1.7.1--1.7.2 repair script: if there were several missing
dimension slices in different hypertables with the same column name,
the repair script would be confused on what constraint had what type
and generate an error.

For the 2.0.0-rc1--2.0.0-rc2 repair script: if a partition constraint
was broken, it would generate an error rather than repairing the
dimension slices because BIGINT_MIN would be cast to a double float and
then an attempt would be made to cast it back to bigint, causing an
overflow error.

This commit also creates an update repair test that breaks a few tables
for pre-2.0 versions to ensure that the repair script actually fixes
them.  The integrity check for the update tests already contain a check
that dimension slices are valid, so there is no need to add a test for
that.

This commit adds an extra dimension in the workflow to test updates
with repair and run that separately. It also changes the update test
scripts to by default run without repair tests and add the additional
option `-r` for running repair tests in addition to the normal tests.

Fixes #2824
2021-01-28 15:04:30 +01:00
Erik Nordström
86f8e30ae0 Fix continuous aggregate privileges during update
Copy ACL privileges (grants) from the query view (user-facing object)
to the internal objects (e.g., materialized hypertable, direct view,
and partial view) when updating the extension to the new version. A
previous change added such propagation of privileges when executing
`GRANT` statements, but didn't apply it retrospectively to the
internal objects of existing continuous aggregates.

Having the right permissions on internal objects is also necessary for
the watermark function used by real-time aggregation since it queries
the materialized hypertable directly.

The update script copies the ACL information from the user-facing view
of every continuous aggregate to its internal objects (including the
materialized hypertable and its chunks). This is done by direct insert
into `pg_class` instead of executing a `GRANT` statement in the update
script, since the latter will record the grant/ACL as an init
privilege (i.e., the system believes the GRANT is for an extension
object). The init privilege will prevent this ACL from being included
in future dump files, since `pg_dump` only includes non-init
privileges as it believes such privileges will be recreated with the
extension.

Fixes #2825
2021-01-27 13:57:34 +01:00
Sven Klemm
3afdf7cc72 Add pg13 to CI build matrix
Since the actual tests have not been adjusted for PG13 yet this
only checks compiling against PG13. A subsequent PR will enable
tests for PG13.
2021-01-15 13:07:52 +01:00
Michael J. Freedman
2c4584c71a Update copyright year to 2021 2021-01-13 17:01:32 -05:00
Ruslan Fomkin
71633c3388 Add 2.0.0 to update test scripts 2020-12-22 09:23:13 +01:00
Erik Nordström
973263a4f1 Add multi-node update test
The update scripts now test extension updates for a multi-node setup
with one access node and one data node. Currently the following is
tested:

* A distributed hypertable is created in the database where the update
  process is normally tested.
* A new database representing a data node is created. This database is
  updated and restored in the same way as the other database. However,
  no integrity or other validation checks are currently run on the
  datanode database; only the ability to update the extension is
  tested.
2020-12-21 12:31:43 +01:00
Sven Klemm
7eb6a9d752 Add 2.0.0-rc4 to update test scripts 2020-12-17 14:25:33 +01:00
Mats Kindahl
c6d64e3e8d Fix compile issues in prerelease tests
There are some flags that cannot be used in preprelease tests, which
this commit fixes. It uses the flag `-DWARNINGS_AS_ERRORS=OFF` to not
turn warnings into errors for release builds. In addition, explicit
checks for compiler flags are added instead of using a function, which
for some reason causes problems.

Note that the prerelease tests run on a regular schedule as well.
2020-12-16 11:53:51 +01:00
Mats Kindahl
9b5f20dd74 Fix ABI check build dependencies and tests
Some tests contain code that only work if the build is based on a Git
clone, which caused these tests to fail when Git was not available.
This commit splits out those tests and only enabling them if Git is
found and Git information can be retrieved.
2020-12-07 18:10:26 +01:00
Mats Kindahl
3544e33fb4 Fix clang-format wrapper
The clang-format wrapper is always using `clang-format` even if a
different version of `clang-format` has been found and has the correct
version.

This commit fixes the issue by passing the name of the found version of
`clang-format` to the wrapper script using the `CLANG_FORMAT` varible.
It will default to use `clang-format` if `CLANG_FORMAT` is unset.
2020-12-02 10:02:31 +01:00
Mats Kindahl
1e7f961055 Show more information in get_git_commit
The command `get_git_commit` shows quite a little information and
especially if mistakes are made it is hard to verify what the binary is
actually based on.

This commit extends the function to provide some more information:
specifically the SHA of the HEAD regardless of whether there is a tag
on it or not and the time for the HEAD commit.

```
postgres=# select * from _timescaledb_internal.get_git_commit();
        commit_tag        | commit_hash |      commit_time
--------------------------+-------------+------------------------
 1.7.4-10-g09b0b778-dirty | 09b0b778    | 2020-09-13 17:50:38+02
(1 row)
```

If git is not installed, the function `get_git_commit` will return an
error indicating that no git information is available. If some of the
fields are available, they will be emitted and the remaining fields
will be NULL.

Fixes #2457
2020-11-26 21:43:13 +01:00
Ruslan Fomkin
47da8790bc Test latest PG 11.10 and 12.5 2020-11-18 15:26:57 +01:00
Erik Nordström
acb8732922 Add 2.0.0-rc3 to update tests
Add the latest release candidate to the update tests.
2020-11-16 17:13:29 +01:00
Sven Klemm
374c405db3 Add 2.0.0-rc2 to update tests 2020-10-21 01:30:01 +02:00
Sven Klemm
cc94d56d0e Add 2.0.0-rc1 to update test scripts 2020-10-06 01:50:53 +02:00
Sven Klemm
ec41593978 Ignore memory leaks in openssl code
Ignore memory leaks in openssl code when running sanitizer tests
in CI.
2020-10-05 17:38:00 +02:00
gayyappan
b341506cb2 Enable continuous_aggs_policy test
Disable NOTICE messages for time based tables in
continuous_aggs_policy test. The refresh sometimes
does not have anything to update as the intervals
are computed based off now(). This causes intermittent
failures due to NOTICEs that the cagg is up to date.

Remove continuous_aggs_policy from ignores list in CI
scripts.
2020-10-01 16:47:10 -04:00
Ruslan Fomkin
cdb4c8fa4f Ignore flaky test for now
continuous_aggs_policy is flaky and prevents to proceed with current
PRs. This commit ignores it until it is fixed.
2020-10-01 12:40:19 +02:00