12 Commits

Author SHA1 Message Date
Sven Klemm
4ad2a2f46a Add database to log_line_prefix used for tests
This patch adds the database to log_line_prefix to make it easier
to correlate test output with entries in the postgres log.
2019-10-13 19:51:17 +02:00
Ruslan Fomkin
0d9e6425dc Disable autovacuum in tests
The tests do not expect that autovacuum is run. The most of the tests
finishes before it runs, but some ARM tests might fail due if autovacuum
is executed.
2019-10-10 15:07:00 +02:00
Matvey Arye
08d9f84736 Add testing for bgw delete
Adds test infrastructure for deleting bgw jobs. We do this
using isolation tests. We add infrastructure for running bgws
in isolation tests. We also add infrastructure to control which
user runs the bgw scheduler and jobs during the tests. We
test the bgw delete as non-superuser.
2019-09-06 15:32:43 -04:00
Sven Klemm
0c346f17ab Add content of installation_metadata to telemetry
Add all entries from _timescaledb_catalog.installation_metadata
to the telemetry report under the key `db_metadata`.

Add new GUC timescaledb_telemetry.cloud which is sent in telemetry
under instance_metadata.cloud when set.
2019-04-12 22:53:56 +02:00
Sven Klemm
300b05daf0 Set random_page_cost to 1.0 for tests
Set random_page_cost to 1.0 to produce more reasonable plans.
This is similar to what timescaledb-tune would set.

This patch also adds test/pgtest.conf which is only used as
postgresql.conf for running the PostgreSQL test suite, because
the random_page_cost change lead to test failures in the PostgreSQL
test suite.
2019-03-07 19:11:17 +01:00
Joshua Lockerman
ff0225f0f7 Add dummy values to test last_tuned telemetry
Adds dummy values so that last_tuned telemetry gets
reported in our tests. Also moves the location of
the telemetry adding code to prevent a segfault
2019-01-03 16:00:54 -05:00
Joshua Lockerman
0436d3b4b0 Edit launcher to load TSL strictly after timescale itself
Reloading shared libraries (which is done to start parallel
workers) is done is the order in which load_file completes.
If we try to load the TSL from PG_init, this causes postgres to
attempt to load the TSL before timescale itself, which causes an
error.

Also disables the warning on normal TSL startup.
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
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
Matvey Arye
5d8c7cc6f6 Add a scheduler for background jobs
TimescaleDB will want to run multiple background jobs. This PR
adds a simple scheduler so that jobs inserted into a jobs table
could be run on a schedule. This first implementation has two limitations:

1) The list of jobs to be run is read from the database when the scheduler
is first started. We do not update this list if the jobs table changes.

2) There is no prioritization for when to run jobs.

There design of the scheduler is as follows:
The scheduler itself is a background job that continuously runs and waits
for a time when  jobs need to be scheduled. It then launches jobs as new
background workers that it controls through the background worker handle.

Aggregate statistics about a job are kept in the job_stat catalog table.
These statistics include the start and finish times of the last run of the job
as well as whether or not the job succeeded. The next_start is used to
figure out when next to run a job after a scheduler is restarted.

The statistics table also tracks consecutive failures and crashes for the job
which is used for calculating the exponential backoff after a crash or failure
(which is used to set the next_start after the crash/failure). Note also that
there is a minimum time after the db scheduler starts up and a crashed job
is restarted. This is to allow the operator enough time to disable the job
if needed.

Note that the number of crashes is an overestimate of the actual number of crashes
for a job. This is so that we are conservative and never miss a crash and fail to
use the appropriate backoff logic.  Note that there is some complexity
in ensuring that all crashes are counted since a crash in Postgres causes /all/
processes to SIGQUIT: we must commit changes to the stats
table /before/ a job starts so that we can then deduce after a job has crashed
and the scheduler comes back up that a job was started, and not finished before
the crash (meaning that it could have been the crashing process).
2018-09-10 13:29:59 -04: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
d17976538b Run tests on temp Postgres instance
Tests are now run on a temporary Postgres instance, which is launched
by the `pg_regress` test runner. This allows running tests without
having an existing running instance with a matching configuration and
also obviates the need for preloading the TimescaleDB extension. As a
result, tests are simpler to setup and run, and are more reliable and
consistent.
2017-06-01 17:22:37 +02:00