96 Commits

Author SHA1 Message Date
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
Lee Hampton
b376fc3b25 Prepare the repo for next development cycle 2018-08-09 13:18:16 -04:00
Hyeong Joon Suh
24296d21b1 Add memory spike test for out of order inserts
Out of order, random inserts into TimescaleDB in the past
sometimes caused continuously increasing memory usage.
These checks are being added to ensure that there are no
memory spike regressions via a cron Travis job.
2018-08-07 11:35:35 -04:00
Rob Kiefer
005813da21 Make update tests more composable.
This removes a lot of duplicated code across the two versions of
update tests (one with testing of constraints vs one without) and
potentially allows for further additions more easily. Also, this
splits Travis testing of updates into two jobs so they can run
concurrently and reduce the amount of turnaround time for PRs.
Finally, added versions since 0.8.0 that were not previously being
tested.
2018-08-03 10:07:09 -04:00
Rob Kiefer
c810be99ef Remove unused files from scripts/
Both setup-db.sh and sql/setup_sample_hypertable.psql don't appear
to be used anywhere in our repo or mentioned in the docs. We have
code snippets and guides to replace them, so they are no longer
needed.
2018-07-24 10:03:30 -04:00
Amy Tai
472bf6a298 Add runtime error for pgindent if objdump is not installed 2018-07-11 12:17:46 -04:00
Matvey Arye
38f8e0c9d0 Add ABI compatibility tests
Test the ABI compatibility of postgres across minor version updates
wrt timescale. Namely, compile the extension on an early minor version
of postgres and test it on the latest snapshot of the major branch.
2018-03-21 10:02:08 -04:00
Erik Nordström
ddd61bc86d Fix update to 0.9.0
This fixes a bug in the upgrade script to 0.9.0 that was caused by a
bad query to delete orphaned dimension slices.
2018-02-28 10:55:43 -05:00
Rob Kiefer
905e1c58e2 Update test suite to check upgradability for all versions
Previously we just checked that we could upgrade from 0.1.0 until
latest but this missed some issues upgrading from intermediate
versions to latest. Now we check that all released versions can
successfully update.
2018-02-26 11:02:56 -05:00
Matvey Arye
a9e18ae4f8 fix docker-run-tests 2018-01-05 12:15:54 -05:00
Matvey Arye
9c7191e898 Change TIMESTAMP partitioning to be completely tz-independent
Previously, for timezones w/o tz. The range_end and range_start were
defined as UTC, but the constraints on the table were written as as
the local time at the time of chunk creation. This does not work well
if timezones change over the life of the hypertable.

This change removes the dependency on local time for all timestamp
partitioning. Namely, the range_start and range_end remain as UTC
but the constraints are now always written in UTC too. Since old
constraints correctly describe the data currently in the chunks, the
update script to handle this change changes range_start and range_end
instead of the constraints.

Fixes #300.
2017-11-20 09:27:30 -05: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
Matvey Arye
81510987d0 Improve update testing by adding a rerun test
The rerun test recreates the hypertable in the newest version
of the extension. This allows us to test correctness of the data
in the catalog.
2017-10-24 11:26:04 -04:00