34 Commits

Author SHA1 Message Date
Ante Kresic
ba3ccc46db Post-release fixes for 2.14.0
Bumping the previous version and adding tests for 2.14.0.
2024-02-12 09:32:40 +01:00
Jan Nidzwetzki
683e2bcf18 Schedule compression policy more often
By default, the compression policy is scheduled for every
chunk_time_interval / 2 in the current implementation, equal to three
days and twelve hours with our default settings. This schedule interval
was sufficient for previous versions of TimescaleDB. However, with the
introduction of features like mutable compression and ON CONFLICT .. DO
UPDATE queries, regular DML operations decompress data. To ensure that
modified data is compressed earlier, this patch reduces the schedule
interval of the compression policy to run at least every 12 hours.
2023-09-22 12:30:57 +02:00
Mats Kindahl
71b0168ab7 Add debug utilities to debug builds
This will move the definitions of `debug_waitpoint_enable`,
`debug_waitpoint_disable`, and `debug_waitpoint_id` to always be
defined for debug builds and modify existing tests accordingly.

This means that it is no longer necessary to generate isolation test
files from templates (in most cases), and it will be straightforward to
use these functions in debug builds.

The debug utilities can be disabled by setting the option
`ENABLE_DEBUG_UTILS` to `OFF`.
2023-08-14 14:42:47 +02:00
Sven Klemm
08bb21f7e6 2.9.0 Post-release adjustments
Add 2.9.0 to update test scripts and adjust downgrade scripts for
2.9.0. Additionally adjust CHANGELOG to sync with the actual release
CHANGELOG and add PG15 to CI.
2022-12-19 19:10:24 +01:00
Sven Klemm
a7c8641e04 Bump postgres versions used in CI
Bump postgres versions used in CI to 14.3, 13.7 and 12.11.
2022-05-17 15:24:38 +02:00
Sven Klemm
ca6122e01a Fix downgrade test git failure
Due to a security vulnerability in git recent git versions now check
ownership of files and error out if it doesnt match current user.
Since we bind mount the source checkout into the build container
the user of the checkout is unlikely to match the user inside the
container. This patch configures git to skip the owner check for
the bind-mounted directory.

https://github.blog/2022-04-12-git-security-vulnerability-announced/
2022-04-18 07:50:49 +02:00
Fabrízio de Royes Mello
bb6dc173a0 Set PG14 as default scripts version
Set latest PG14 as the default Postgres version for scripts and some
minor fixes.
2022-04-13 09:39:07 -03: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
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
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
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
e9066d5531 Remove PG11 from CI
Remove all CI runs against postgres 11
2021-06-01 20:21:06 +02: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
gayyappan
dd90ffd009 Report docker build failures for update test
The update tests use the scripts for building the
timescaledb image. Build errors should be reported
and return a failure code. This will force the failure
of the rest of the pipeline.
2020-09-09 17:54:14 -04:00
Sven Klemm
666369ea2e Migrate update test to GitHub actions
This patch migrates the update tests from Travis to GitHub actions.
2020-07-06 14:21:00 +02:00
Erik Nordström
f64fd4247f Make image build script work with remote Docker
This change tweaks the `docker-build.sh` script to work against remote
Docker daemons. This is useful when testing on minikube and you want
to quickly build and deploy a new image with the current code without
having to push to a remote registry.
2020-05-27 17:31:09 +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
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
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
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
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
Sven Klemm
119963a334 Replace hardcoded bash path in shell scripts 2018-10-10 17:55:39 +02: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
Erik Nordström
69d7d5800c Add pgindent target to format C source
The C source files can now be formatted with pgindent using
a new CMake build target.

The location of pgindent and dependencies are auto-discovered
by CMake or can be overridden on the command line.
2017-11-17 09:43:04 +01:00
Erik Nordström
500563ffe5 Add support for PostgreSQL 10
The extension now works with PostgreSQL 10, while
retaining compatibility with version 9.6.

PostgreSQL 10 has numerous internal changes to functions and
APIs, which necessitates various glue code and compatibility
wrappers to seamlessly retain backwards compatiblity with older
versions.

Test output might also differ between versions. In particular,
the psql client generates version-specific output with `\d` and
EXPLAINs might differ due to new query optimizations. The test
suite has been modified as follows to handle these issues. First,
tests now use version-independent functions to query system
catalogs instead of using `\d`. Second, changes have been made to
the test suite to be able to verify some test outputs against
version-dependent reference files.
2017-11-10 09:44:20 +01:00
Erik Nordström
b1ec4fa179 Refactor build system to use CMake
Moving the build system to CMake allows easy cross-platform
compiles, dependency checks, and more. In particular, CMake
allows us to easily build on Windows, and Visual Studio now
has native CMake support.
2017-10-16 20:50:16 +02:00
Erik Nordström
bf6fd3158f Tweak the docker image build script
- Save an intermediate build image to avoid having to download APK
  packages for every build
- Add debug symbols and assertions to extension build
- Install git and gdb by default for easier debugging
2017-10-02 11:01:31 +02:00
Olof Rensfelt
6cc5aa19bb Add update scripts from earlier versions to the extension.
To allow upgrading versions older than the most recent one,
update scripts from older versions need to be added to the
extension. This is now done by including all files in the
file extra_extension_files.txt to the extension. Currently
that file needs to be manually updated when a new release
is built.
2017-07-18 10:27:36 +02:00
Matvey Arye
3c1f7522bb Make travis run update tests 2017-07-13 08:33:08 -04:00
Olof Rensfelt
4d2a65daa6 Add infrastructure to build update script files.
SQL code is now split into setup, functions, and init files to
allow a subset to be run when the extension is updated. During
build, an update script is now also generated.
2017-07-12 13:00:29 -04:00
Erik Nordström
3192c8a6bf Remove Dockerfile and docker.mk
Release Docker builds are now provided in a separate repository,
https://github.com/timescale/timescaledb-docker.

Tests and development builds for Docker are now provided
by two new scripts in the scripts directory:

- `docker-build.sh` to build a development image from current sources.
- `docker-run-tests.sh` to run tests for current sources through a Docker container.
2017-06-19 22:30:46 +02:00