109 Commits

Author SHA1 Message Date
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
Sven Klemm
43eb4ffba6 Fix update test script
Remove EXIT trap handler because it seems to occasionally capture exit
code from something that is not an update test resulting in error
state even though all update tests were successful.
2018-12-31 18:15:10 +01:00
Erik Nordström
73b81bb892 Do not exit immediately on failure in update test script
This fixes a number of issues with the update test script that
prohibited it from displaying a log of any failing tests. In
particular, the script needs to be run with `set +e` to ensure a test
error doesn't immediately cause an exit without recording the failed
log.
2018-12-21 10:31:31 +01:00
Joshua Lockerman
d4f0cbd0d3 Prepare the repo for the 1.2.0 development cycle 2018-12-14 10:01:03 -05:00
Joshua Lockerman
a7b54b159b Have prefix check verify all functions in headers and clean up missings
This commit makes four changes:
1. Adds the ts_ prefix to some functions that were missed in the last
   pass
2. Adds static to some variables that were confined to a single file but
   missing it
3. Adds the ability to disable using "hidden" visibility by default by
   setting the USE_DEFAULT_VISIBILITY variable
4. Switches the prefix-check in travis to use the flag defined in 3 so
   that the checker now checks all non-static symbols we define
2018-12-12 17:22:24 -05:00
Sven Klemm
981147fd8b Fall back to commit hash in update tests
Travis CI occasionally has trouble figuring out the branch, so this
change makes sure it falls back to using at least a commit hash
2018-12-12 19:55:57 +01:00
Joshua Lockerman
bb6efbef0d Check that functions start with the ts_ prefix in travis 2018-12-11 17:02:00 -05:00
Sven Klemm
3686ff5b81 Set ORS to empty string instead of NUL in license check script
This fixes multiple warnings in bash 4.4:
scripts/check_file_license_apache.sh: line 22: warning: command substitution: ignored null byte in input
and is also more correct since we dont want to inject 0-Bytes into the string
2018-11-26 16:38:17 +01:00
Joshua Lockerman
e06733acf0 Fix casing in SQL license header to be consistent with elsewhere 2018-11-15 15:18:58 -05:00
Rob Kiefer
cac0791a5c Prepare the repo for next development cycle 2018-11-01 10:34:08 -04:00
Joshua Lockerman
d4f2a37e4b Add automated license check to travis 2018-10-29 13:28:19 -04:00
Joshua Lockerman
eaa796eeba Add license headers to the more interesting scripts 2018-10-29 13:28:19 -04:00
Joshua Lockerman
20ec6914c0 Add license headers to SQL files and test code 2018-10-29 13:28:19 -04:00
Erik Nordström
b7a4851cd0 Run update tests in parallel
This change makes the update tests from each prior version of
TimescaleDB to run in parallel instead of in serial order.

This speeds up the testing significantly.
2018-10-29 15:19:16 +01:00
Erik Nordström
7fb6fbacdd Refactor docker-build.sh to reuse images
The docker-build.sh script, which is used to build a Docker image from
the currently checked-out source code, has been refactored to make
better use of cached images. This speeds up the build process and allows
faster Travis builds.
2018-10-29 15:19:16 +01:00
Rob Kiefer
2a8cdafb32 Prepare the repo for next development cycle 2018-10-18 18:01:06 -04:00
Sven Klemm
119963a334 Replace hardcoded bash path in shell scripts 2018-10-10 17:55:39 +02:00
Amy Tai
4464b3674a Turn off telemetry in Docker images used in CI
Using the new flag available in Docker images, turn off telemetry in Timescale-built Docker images used by Travis. We do not pass the flag to Postgres Docker images.
2018-10-09 09:51:28 -04:00
Rob Kiefer
bff0d4e405 Prepare the repo for the next development cycle 2018-10-01 10:56:02 -04:00
Joshua Lockerman
83eb99f90f Disable isolation tests on the ABI smoke test
We have no need to run the pg_isolation_regress tests with the ABI smoke
test. This commit disables them.
2018-09-27 14:17:04 -04:00
Rob Kiefer
7c105af02c Fix ABI test, correctly this time
The previous fix did not actually include openssl-dev when trying
to build TimescaleDB. Also, this fixes broken tests due to lack
of permissions.
2018-09-14 09:48:04 -04:00
Rob Kiefer
6c8a9c1b33 Update ABI test Docker image to have OpenSSL dev headers 2018-09-13 10:58:34 -04:00
Rob Kiefer
c0e68b0d95 Prepare the repo for the next development cycle 2018-09-12 10:26:34 -04:00
Lee Hampton
2b5bc30937 Prepare the repo for the next development cycle 2018-09-11 11:00:35 -04:00
Matvey Arye
f662ae1191 Add telemetry job and turn off default jobs in tests
This adds the telemetry job to the job scheduler. Telemetry is
scheduled to run every 24 hours with a 1 hour exponential backoff
retry period. Additional fixes related to the  telemetry job:

- Add separate ID space to the bgw_job table for default jobs. We do not dump this ID space inside pg_dump to prevent job insertion conflicts.
- Add check to update scripts for default jobs.
- Change shmem_callback so that it doesn't modify state since state transitions are not atomic with respect to interrupts and interrupt callbacks.
- Disable default telemetry job in regression and docker tests.
2018-09-10 13:29:59 -04:00
Erik Nordström
ebe0915669 Refactor telemetry and fixes
The installation metadata has been refactored:

- The installation metadata store now takes Datums of any
  type as input and output
- Move metadata functions from uuid.c -> metadata.c
- Make metadata functions return native types rather than text,
  including for tests

Telemetry tests for ssl and nossl have been combined.

Note that PG 9.6 does not have pg_backend_random() that gives us a
secure random numbers for UUIDs that we send in telemetry. Therefore,
we fall back to the generating the UUID from the timestamp if we are
on PG 9.6.

This change also fixes a number of test issues. For instance, in the
telemetry test the escape char `E` was passed on as part of the
response string when set as a variable with `\set`. This was not
detected before because the response parser didn't parse the start of
the response properly.

A number of fixes have been made to the formatting of log messages for
telemetry to conform to the PostgreSQL standard as well as being
consistent with other messages.

Numerous build issues on Windows have been resolved. There is also new
functionality to get OS version info on Windows (for telemetry),
including a SQL function get_os_info() to retrieve this information.

The net library will now allow connecting to a servicename, e.g., http
or https. A port is resolved from this service name via getaddrinfo().
An explicit port can still be given, and it that case it will not
resolve the service name.

Databases the are updated to the new version of the extension will
have an install_timestamp in their installation metadata that does not
reflect the actual original install date of the extension. To be able
to distinguish these updated installations from those that are freshly
installed, we add a bogus "epoch" install_timestamp in the update
script.

Parsing of the version string in the telemetry response has been
refactored to be more amenable to testing. Tests have been added.
2018-09-10 13:29:59 -04:00
David Kohn
55a7141953 Implement a cluster-wide launcher for background workers
The launcher controls how Timescale DB schedulers for each database are stopped/started
both at server start time and if they are started or stopped while the server is running
which can happen when, say, an update of the extension is performed.
Includes tests for multiple types of behavior within the launcher, but only a mock for the
db schedulers which will be dealt with in future commits. This launcher code is mostly in the loader,
as such it must remain backwards compatible for the foreseeable future, so significant thought and design
has gone into making interactions with this code well defined and consistent so that maintaining
backwards compatibility is relatively easy.
2018-09-10 13:29:59 -04:00