135 Commits

Author SHA1 Message Date
Erik Nordström
176b616e37 Refactor insert and copy paths
The INSERT and COPY paths have been refactored to better handle
differences between PostgreSQL versions. In particular, PostgreSQL 12
introduced the new table access mangement (AM) API which ties tuple
table slots to specific table AM implementations, requiring more
careful management of those data structures.

The code tries to adopt the new (PG12) API to the extent possible,
providing compatibility layers and functions for older PostgreSQL
versions where needed.
2020-04-14 23:12:15 +02:00
Ruslan Fomkin
403782a589 Run regression test on latest PG versions
Docker images are build with latest versions of PostgreSQL, thus
updating regression tests to run on the latest PG versions. Fixing
authentication for PG docker images, since it is required after a
recent change in docker-library/postgres@42ce743.

Running isolation tests on new versions of PG produces additional
output:
- Notifications are not missed to print postgres/postgres@ebd4992
- Notifications are prefixed with session name
postgres/postgres@a28e10e
- Timeout cancellation is printed in isolation tests
postgres/postgres@b578404

The expected outputs are modified to succeed on latest PG versions,
while the affected isolation tests are disabled for earlier versions
of PG.
2020-04-02 08:57:28 +02:00
Sven Klemm
d9aa40d36d Merge 9.6 specific update test files 2020-03-21 20:55:06 +01:00
Sven Klemm
b38b0d05b0 Add 1.6.1 to update test scripts 2020-03-21 20:55:06 +01:00
Sven Klemm
442a173ad6 Add 1.5.1 and 1.6.0 to update test scripts 2020-01-20 14:36:22 +01:00
Matvey Arye
707bb9d584 Add compression to update tests
Add a test using cmpressed tables to our extension update
test suite.
2019-11-11 17:10:13 -05:00
Matvey Arye
e575cc2b88 Add tests for updates of catalog tables
PG11 added an optimization where columns that were added by
an ALTER TABLE that had a DEFAULT value did not cause a table
re-write. Instead, those columns are filled with the default
value on read.

But, this mechanism does not apply to catalog tables and does
not work with our catalog scanning code. This tests makes
sure we never have such alters in our updates.
2019-11-07 12:12:54 -05:00
Matvey Arye
d34731a4e3 Add update test on PG11
Change travis to to run update tests on PG11.
2019-11-07 12:12:54 -05:00
Sven Klemm
41209fd629 Add 1.5.0 to update test scripts 2019-11-07 15:56:20 +01:00
Mats Kindahl
b2918e58fe Fix permission issue in test_sanitizer
The `test_sanitizer.sh` test failed because source code was being
copied from the host to the container as user `postgres` and this user
did not have read permissions on the mounted directory. This is fixed
by copying the files as `root` and then changing the owner to
`postgres`.

The commit also removes `wait_for_pg` since PostgreSQL server status is
not relevant for the tests since they start their own temporary
instance.

The commit also switches to use here-is documents for the execution for
readability purposes.
2019-11-07 08:54:32 +01:00
Sven Klemm
81d5db662a Fix export_prefix_check script
The export_prefix_check script would not set proper exit code
depending on the found exported functions.
2019-10-15 14:42:02 +02:00
Mats Kindahl
3fa3822d08 Only update reformatted files
When running `make format` it will update all files. If a file does not
actually require reformatting, it will trigger a re-build of the entire
code base.

This commit instead compare the re-formatted file with the existing one
and does not update it unless it has actually changed.
2019-10-03 17:32:40 +02:00
Joshua Lockerman
1cc1b7c14e Fix memory leaks part 1: BGWs
This commit fixes memory leaks in the Background Worker infrastructure.
Notably, it fixes a leak in the launcher and BGW scheduler where shared
message queue handles would not be freed, and it fixes a leak where
BackgroundWorkerHandles were not freed in the scheduler.
2019-10-02 15:54:39 -04:00
Sven Klemm
b2d7be31bb Add 1.4.2 to update test scripts 2019-09-12 14:53:59 +02:00
Sven Klemm
ee9fc6af4c Add 1.4.1 to update test scripts 2019-08-02 15:00:05 +02:00
Sven Klemm
f8f5a73fd2 Add 1.4.0 to update test scripts 2019-07-18 21:14:14 +02:00
Sven Klemm
70fd8df015 Add missing license information
Add license information to files missing it and fix the license
check script to honor the return code of both the apache license
check and the TSL license check. Previously errors occurring during
apache license check would not be reflected in the return code of
the script, so only the TSL license check was effective.
2019-07-13 17:18:57 +02:00
Mats Kindahl
368a5c80cb Disable tool checks for test_sanitizers.sh
The `test_sanitizers.sh` script do not require regress tools, so
turning off regress tools check when calling CMake.
2019-07-09 15:40:35 +02:00
Mats Kindahl
d1f8f9d326 CMake check for necessary testing tools
Adding checks for `pg_isolation_regress` and `pg_regress` and not
running the tests if the programs cannot be found either installed in
default directories or provided with the `PG_PATH` variable, or the
`PG_SOURCE_DIR` variable.
2019-06-28 13:47:28 +02:00
Sven Klemm
743a22f1fa Add 1.3.2 to update test scripts 2019-06-25 05:11:32 +02:00
Matvey Arye
33d28d2217 Test continuous aggs with extension updates
Add a v3 update test that makes sure that continuous aggregates
continue to work after extensions are updated.
2019-06-12 09:43:35 -04:00
Sven Klemm
70a02b5410 Add 1.3.1 to update test scripts 2019-06-10 21:15:56 +02:00
Matvey Arye
5e10efdff3 Run ABI tests on consistent alpine versions
Previously the compile image for the ABI tests was based on a different
postgres image than the run image (e.g. 10-alpine vs 10.2-alpine). This
created dependency problems between different version of ssl packages
that may be available under different alpine versions.

We fix this by forcing the run image to be based off of the same image
as the compile version.
2019-05-29 20:55:25 -04:00
Matvey Arye
5917938569 Fix ABI smoke test
This fix makes the smoke test return the correct exit code. It also
adds libssl1.0, which is needed for some openssl functionality.
2019-05-29 13:31:07 -04:00
Sven Klemm
bfabb30be0 Release 1.3.0 2019-05-07 02:47:13 +02:00
Joshua Lockerman
d5716fe200 Fix sanitizer and release tests
We were not building timescaledb with debug enabled in the sanitizer
tests, causing tests which needed debug symbols to fail. This commit
changes the sanitizer tests to include such symbols. We still enable
optimizations, as that results in more realistic build environment for
memory tests.
This commit also ensures some tests which should only be run in debug
builds are in fact only run in debug builds.
2019-04-29 15:02:05 -04:00
Sven Klemm
5695e32858 Fix syntax error in commit hook 2019-04-09 13:45:20 +02:00
Sven Klemm
0823498b25 Stop processing commit message on scissors line
The commit message template may include the actual diff to be
committed separated with a special scissors line. This patch adds
support for the scissors line to the commit hook otherwise
the diff content may trigger any of the rules.
2019-04-09 11:07:30 +02:00
Erik Nordström
18a8afd1f8 Add a gitignore for Git hook tests
Running the git hook tests will leave some Python byte code files
lying around. This change hides those using a gitignore file.
2019-04-08 14:01:00 +02:00
Erik Nordström
881e3729c4 Add a Git commit hook to validate commit messages
Our coding guidelines recommend following "The seven rules of a great
Git commit message" by Chris Beams:

https://chris.beams.io/posts/git-commit/

This change adds a Git commit hook that validates all Git commit
messages according to these rules (at least to the extent possible).
Currently, the hook simply prints a warning and a list of violations
in case of a non-conforming Git commit message. The commit is
otherwise accepted. This could be changed to entirely fail the commit,
or, via another hook, fail to push any code that is non-conformant.

The hook will be installed on a CMake run or when the hook source
changes.
2019-04-08 10:38:41 +02:00
Sven Klemm
e6dec5fff3 Improve information displayed on sanitizer test failure
Only print postgres log and regression diff for the instance
that actually failed for regresscheck and regresscheck-t
respectively.
2019-04-04 23:31:33 +02:00
Joshua Lockerman
dbe2bab392 Add array_unnest to alignment supressions it looks like trigger lookup triggers it 2019-04-01 12:14:16 -04:00
Sven Klemm
fcb5d8a41a Print regresscheck-t diff after sanitizer test
Change test_sanitizers.sh to always run regresscheck-t even when
regresscheck fails and print regresscheck-t diff on errors.
2019-03-30 02:11:51 +01:00
Sven Klemm
f2aea211bd Add 1.2.2 to update test scripts 2019-03-14 19:23:11 +01:00
Joshua Lockerman
72f4692c21 Add the ability to set the number of parallel tests from cmake and have sanitizer tests do so
With the forthcoming new sanitizer image running tests in parallel
causes machines to run out of resources, and fail tests spuriously
This commit forces test_sanitizers.sh to run tests sequentially to
prevent this.
2019-02-21 10:37:06 -05:00
Sven Klemm
33ef1de542 Add treat_null_as_missing option to locf
When doing a gapfill query with multiple columns that may contain
NULLs it is not trivial to remove NULL values from individual columns
with a WHERE clause, this new locf option allows those NULL values
to be ignored in gapfill queries with locf.

We drop the old locf function because we dont want 2 locf functions.
Unfortunately this means any views using locf have to be dropped.
2019-02-16 00:09:38 +01:00
Joshua Lockerman
bf3b3b8a69 Add sanitizer based tests
This commit adds a sanitizer run script, and updates travis to
run it in our nightly builds. Valgrind has been very slow and
unstable, so much so that we only run it during pre-release
tests, and even then it doesn't necissarily provide useful
output. The sanitizer tests run about 10x faster, and seem
stable.

We currently only run ASan and UBSan, as MSan has too many
issues within postgres's own initialization functions. As MSan
cannot be added to a binary that enables ASan, it would require
separate jobs anyway.
2019-02-13 18:12:43 -05:00
Joshua Lockerman
73e4adb598 Prepare the repo for the next development cycle 2019-02-11 13:07:34 -05:00
Erik Nordström
ed30358f7b Exclude hidden and CMake directories when formatting code
The script for running clang-format on the source code now properly
excludes hidden directories and CMake directories from the source code
scan. Including these directories may otherwise break clang-format
because hidden directories are often used for IDE/tools caches (e.g.,
`cquery`) where the cache files have the same ending as the source
code.
2019-02-07 13:24:36 +01:00
Matvey Arye
cc52a78b9b Add scripts for clang-format
We are switching from pgindent to clang-format for several
reasons:
1) pgindent is harder to set up and depends on other tools
like gobjdump that differ between OSes making it harder
to set up a proper development environment.
2) clang-format is more standard and works better
with various IDEs and editors.

Our clang-format wrapper script is transactional in that this
version of the script copies all files to a temporary directory,
runs clang-format in the temp dir, and only then copies the files
back. This should prevent mis-formatting when the script is cancled
in the middle of running.

We changes travis to use clang-format instead of pgindent
and thus it uses a different docker image to do the format test.
We also changes travis to use the new clang docker
image for the license check and prefix checks for consistency.
This also paves the way for us to use more clang features for tests
in the future.
2019-02-05 16:55:16 -05:00
Joshua Lockerman
c7803730d8 Fix typo failing our update 9.6 update tests 2019-02-01 13:50:31 -05:00
Joshua Lockerman
57b1d11919 Prepare the repo for the next development cycle 2019-01-29 13:23:28 -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
a5bcefb0ee Copy tsl into build directory in smoketest
We need to ensure we have all the source in order
to build timescaledb. Lacking this breaks the test.
2019-01-04 13:48:23 -05:00
Rob Kiefer
f45ce14334 Remove out-dated and unused scripts
Nothing appears to use scripts/start-test-docker.sh, so it can be
safely removed. docker-run.sh was still referenced on our docs
page, but should soon be removed. It no longer actually provides
anything useful (i.e., any memory settings it used to have have
been removed) and is out-of-date with newer Docker setups. To
remove the burden of keeping it up to date, we should just remove.
2019-01-04 11:30:52 -05:00
Sven Klemm
192409257e Add update test for PostgreSQL 10
Add an update test for updating the extension on PostgreSQL 10.
Change PostgreSQL 9.6 update test to only run triggered by cron.
2019-01-04 15:37:03 +01:00
Joshua Lockerman
acc41a7712 Update license header
Only have the copyright in the NOTICE. Hopefully
only having to update one place each year will
keep it consistent.
2019-01-03 11:57:51 -05:00
Sven Klemm
f73d5931aa Fix ORS in check_file_license.sh 2019-01-02 15:43:48 -05:00
Amy Tai
1b41b14994 Update licensecheck to look for correct string
Previously, files under tsl/test/ were expected to have "Apache" rather than "Timescale" license in their license header. This has been fixed.
2019-01-02 15:43:48 -05:00
Joshua Lockerman
4ff6ac7b91 Initial Timescale-Licensed-Module and License-Key Implementation
This commit adds support for dynamically loaded submodules to timescaledb
as well an initial license-key implementation in the tsl subdirectory.
Dynamically loaded modules allow our users to determine which licenses they
wish to use for their version of timescaledb; if they wish to only use
Apache-Licensed code, they do not load the Timescale-Licensed submodule. Calls
from the Apache-Licensed code into the Timescale-Licensed submodule are
handled via dynamicaly-set function pointers; see tsl/src/Readme.module.md for
more details.

This commit also adds code for license keys for the ApacheOnly, Community, and
Enterprise editions. The license key determines which features are enabled,
and controls loading the submodule: when a license key that requires the
sub-module is installed, the module is automatically loaded.
Currently the ApacheOnly and Community license-keys are hardcoded to be
"ApacheOnly" and "Community" respectively. The first version of the enterprise
license-key is described in tsl/src/Readme.module.md
2019-01-02 15:43:48 -05:00