2418 Commits

Author SHA1 Message Date
Sven Klemm
43f2c31b3e Add proc, hypertable index to bgw_job
This patch adds a proc_name, proc_schema, hypertable_id index to
bgw_job. 3 functions using the new index are added as well:
ts_bgw_job_find_by_proc
ts_bgw_job_find_by_hypertable_id
ts_bgw_job_find_by_proc_and_hypertable_id

These functions are required for migrating the existing policies
to store their configuration in bgw_job directly.
2020-07-27 20:17:56 +02:00
Sven Klemm
82bf1c458f Refactor jsonb_utils
Adjust jsonb utility functions to always take and return char *
as string types to reduce conversion requirements on caller.
2020-07-27 20:17:56 +02:00
Sven Klemm
cde5af31b8 Make scheduler ignore jobs where scheduled = false
This patch makes the scheduler ignore all jobs where scheduled = false.
The schedule flag can be used to disable jobs without deleting the job
entry.

This patch also changes the job retrieval to use an index scan to
satisfy the assumption of the scheduler to receive a list ordered
by job_id.
2020-07-27 20:17:56 +02:00
gayyappan
dc61466aef Add chunks and dimensions view
timescaledb_information.chunks view shows metadata
related to chunks.
timescaledb_information.dimensions shows metadata
related to hypertable's dimensions.
2020-07-26 17:10:05 -04:00
Dmitry Simonenko
fca7e36898 Support moving compressed chunks
Allow move_chunk() to work with uncompressed chunk and
automatically move associated compressed chunk to specified
tablespace.

Block move_chunk() execution for compressed chunks.

Issue: #2067
2020-07-24 19:26:15 +03:00
प्रथमेश Sonpatki
4506c1e6fe Fix typo in detach tablespace error message 2020-07-24 13:43:21 +02:00
gayyappan
926a1c9850 Add compression settings view
Add informational view that lists the settings
used while enabling compression on a hypertable.
2020-07-23 12:40:12 -04:00
gayyappan
88f693887a Cleanup index on hypertable catalog table
Reorder schema_name + table_name index. Remove
unnecessary constraint.
2020-07-23 11:08:11 -04:00
Mats Kindahl
40d284fe76 Remove include of pg_config.h
The `pg_config.h` file in the PostgreSQL include directory does not
contain any include guards, so including it will generate errors when
building from PGDG-distributed packages.

Since `pg_config.h` is included from `c.h` (which has include guards)
which in turn is included from `postgres.h` (which also has include
guards), we remove usage of `pg_config.h` from all places where
`postgres.h` is included and replace it with `postgres.h` where it is
not included.
2020-07-23 12:14:48 +02:00
Sven Klemm
2f2e5ae68b Change bgw_job catalog table to enable custom jobs
This patch adds the columns required for custom jobs to the bgw_job
catalog table.
2020-07-22 18:24:02 +02:00
Brian Rowe
6b62ed543c Fetch collations from data nodes during ANALYZE
This change fixes the stats collecting code to also return the slot
collation fields for PG12. This fixes a bug (#2093) where running an
ANALYZE in PG12 would break queries on distributed tables.
2020-07-20 10:54:44 -07:00
Ruslan Fomkin
bdced2b722 Add test of drop_chunks on distributed hypertable
Testing that drop_chunks works correctly on a distributed hypertable.
Tests of different arguments are assumed to be done on a usual
hypertable previously.
2020-07-20 16:21:45 +02:00
Sven Klemm
5c70dfcc0e Add isolation test files to license check
This patch enhances the license check script to check for a
license header in isolation test files
2020-07-20 13:22:49 +02:00
Sven Klemm
70408cd325 Add missing license header to spec files 2020-07-20 13:22:49 +02:00
Sven Klemm
3d1a7ca3ac Fix delete on tables involving hypertables with compression
The DML blocker to block INSERTs and UPDATEs on compressed hypertables
would trigger if the UPDATE or DELETE referenced any hypertable with
compressed chunks. This patch changes the logic to only block if the
target of the UPDATE or DELETE is a compressed chunk.
2020-07-20 13:22:49 +02:00
Ruslan Fomkin
13aa729f68 Add license note to TSL isolation test
Adding Timescale License header to specs of isolation TSL tests.
2020-07-18 09:19:24 +02:00
Sven Klemm
dd51b09f3e Fix index creation with IF NOT EXISTS for existing indexes
When creating an index with IF NOT EXISTS we still tried to
create indexes for all the chunks but since no index was created
on the parent table the meta data did not have the object id of
the main table index leading to an error when trying to open
the main table index. This patch adjusts the logic to check
for IF NOT EXISTS and does an early return when no index was
created on the parent table.
2020-07-17 15:12:06 +02:00
Sven Klemm
8801781fd6 Move coverity scan to github actions
Migrate the travis coverity config to github actions. This new workflow
will depend on the cached postgres build of the main regression workflow
so we don't have to duplicate the build matrix in this workflow. Since
the main regression workflow runs at least once a day there should
always be a cache hit. In case of a cache miss this workflow will abort.

Since there is a quota on coverity runs this workflow is configured to
run once a week every saturday. Additional runs can be triggered by
pushing to the coverity_scan branch.
2020-07-16 13:20:06 +02:00
Dmitry Simonenko
add97fbadf Apply SET TABLESPACE for compressed chunks
Allow ALTER SET TABLESPACE on an uncompressed chunk and
automatically execute it on the associated compressed chunk,
if any. Block SET TABLESPACE command for compressed chunks.

Issue #2068
2020-07-15 15:14:25 +03:00
Mats Kindahl
795e050d5f Fix update tests
The update test checks that default jobs are the same before and after
an upgrade, but does not order the jobs in any specific way. This means
that if the database order is different before and after the update, it
will result in a false negative even if the jobs are identical.

This commit fixes this by ordering the jobs by id.
2020-07-14 19:53:02 +02:00
Sven Klemm
665d56be47 Improve infering start and stop arguments from gapfill query
Infering start and stop parameter used to only work for top
level constraints. However even when constraints are at the
toplevel in the query they might not end up at the top-level
of the jointree depending on the plan shape. This patch
changes the gapfill code to traverse the jointree to find
valid start and stop arguments.
2020-07-10 11:19:58 +02:00
Sven Klemm
c4aa8cf7cf Move cron tests to GitHub actions
This patch moves the sanitizer, abi breakage and memory leak
tests from travis to github actions.
2020-07-08 19:58:38 +02:00
Sven Klemm
5bb4bfdf50 Ignore results of flaky tests 2020-07-08 19:16:37 +02:00
Sven Klemm
dc5ed1a92d Remove debian 8 from package test
This patch removes Debian 8 from the package test since its no
longer supported. This patch also fixes the repository URL for
centos 8.
2020-07-08 19:16:37 +02:00
Sven Klemm
fa223ae701 Use macros to define crossmodule wrapper functions
This patch adds a helper macro to define cross module
wrapper functions to reduce code repetition. It also
changes the crossmodule struct names to match the function
names where this wasn't the case already.
2020-07-07 16:55:35 +02:00
Sven Klemm
41c89b5648 Add 1.7.2 to update test scripts 2020-07-06 17:59:15 +02:00
Sven Klemm
d1fda03473 Fix github action cache handling on macOS
On macOS the path used is depending on the runner version leading to cache
failure when the runner version changes or is different from the one used to
build the cache. This patch extracts the runner version and adds it as
suffix to the cache key on macOS.
2020-07-06 14:21:00 +02: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
cb789a5eff Cleanup unused code paths
This change removes some code paths that are no longer used after the
removal of PG10 and PG9.6 support.
2020-07-06 13:07:29 +02:00
Mats Kindahl
76648557bb Remove ts_dimension_slice_insert_multi parameter
One parameter was always true. This commit remove the parameter and
update the logic to match the existing usage.
2020-07-06 12:36:44 +02:00
Sven Klemm
e6020e88d8 Fix syntax error in apt package test
The notification configuration for the apt package test was missing
a dollar sign in front of the variables leading to failing variable
interpolation.
2020-07-06 11:09:23 +02:00
Sven Klemm
9c026b2194 Add missing ORDER BY clause to chunk_api test
The chunk_api test fails sometimes because of inconsistent resultset
ordering in one of the queries. This patch adds the missing ORDER BY
clause to that query.
2020-07-06 11:09:23 +02:00
Sven Klemm
7fc7b2c360 Release 1.7.2
This maintenance release contains bugfixes since the 1.7.1 release. We deem it medium
priority for upgrading.

In particular the fixes contained in this maintenance release address bugs in continuous
aggregates, drop_chunks and compression.

**Features**
* #1877 Add support for fast pruning of inlined functions

**Bugfixes**
* #1908 Fix drop_chunks with unique constraints when cascade_to_materializations is false
* #1915 Check for database in extension_current_state
* #1918 Unify chunk index creation
* #1932 Change compression locking order
* #1938 Fix gapfill locf treat_null_as_missing
* #1982 Check for disabled telemetry earlier
* #1984 Fix compression bit array left shift count
* #1997 Add checks for read-only transactions
* #2002 Reset restoring gucs rather than explicitly setting 'off'
* #2028 Fix locking in drop_chunks
* #2031 Enable compression for tables with compound foreign key
* #2039 Fix segfault in create_trigger_handler
* #2043 Fix segfault in cagg_update_view_definition
* #2046 Use index tablespace during chunk creation
* #2047 Better handling of chunk insert state destruction
* #2049 Fix handling of PlaceHolderVar in DecompressChunk
* #2051 Fix tuple concurrently deleted error with multiple continuous aggregates

**Thanks**
* @akamensky for reporting an issue with telemetry and an issue with drop_chunks
* @darko408 for reporting an issue with decompression
* @dmitri191 for reporting an issue with failing background workers
* @eduardotsj for reporting an issue with indexes not inheriting tablespace settings
* @fourseventy for reporting an issue with multiple continuous aggregrates
* @fvannee for contributing optimizations for pruning inlined functions
* @jflambert for reporting an issue with failing telemetry jobs
* @nbouscal for reporting an issue with compression jobs locking referenced tables
* @nicolai6120 for reporting an issue with locf and treat_null_as_missing
* @nomanor for reporting an issue with expression index with table references
* @olernov for contributing a fix for compressing tables with compound foreign keys
* @werjo for reporting an issue with drop_chunks and unique constraints
2020-07-04 11:54:10 +02:00
gayyappan
43edbf8639 Fix concurrent tuple deletes for continuous aggregates
When we have multiple continuous aggregates defined on
the same hypertable, they could try to delete the hypertable
invalidation logs concurrently. Resolve this by serializing
invalidation log deletes by raw hypertable id.

Fixes #1940
2020-07-03 23:46:01 -04:00
Sven Klemm
d649d493f6 Add testing for RPM packages
This workflow will install our rpm packages and then try to enable
timescaledb in the database and also check the version installed
from the package against the expected version.
2020-07-03 16:10:18 +02:00
Sven Klemm
68ba6e073c Add regresscheck-shared sql files to license check
This adds the directories used by regresscheck-shared to the license
check and adds a license where it is currently missing.
2020-07-03 13:00:36 +02:00
Mats Kindahl
73ffc466cb Add isolation test for drop_chunks and insert
If a new chunk is created as part of an insert and drop_chunks runs
concurrently with the insert, there is a risk of a race. This is a test
for this.

Add locks for dimension slice tuples

If a dimension slice tuple is found while adding new chunk constraints
as part of a chunk creation it is not locked prior to adding the chunk
constraint. Hence a concurrently executing `drop_chunks` can find a
dimension slice unused (because there is no chunk constraint that
references it) and subsequently remove it. The insert will the continue
to add the chunk constraint with a reference to a now non-existent
dimension slice.

This commit fixes this by locking the dimension slice tuple with a
share lock when creating chunks and locking the dimension slice with an
exclusive lock prior to scanning for existing chunk constraints.

The commit also contains a script that repair the `dimension_slice`
table if it is broken by extracting information about dimension slices
that are mentioned in `chunk_constraint` table but not present in
`dimension_slice` table and re-create the rows from the constraints on
the chunks.
2020-07-02 19:20:07 +02:00
Ruslan Fomkin
cfb3331cab Use index tablespace during chunk creation
If a tablespace is provided for an index on a hypertable, it will be
also used for the index on new chunks. This is done when constraints
are created on new chunk from the hypertable constraints.

Fixes #903
2020-07-02 16:22:44 +02:00
Sven Klemm
9c49a47fbb Fix handling of PlaceHolderVar in DecompressChunk
When the relation targetlist of the uncompressed chunk contained
PlaceHolderVars the construction of the relation targetlist of
the compressed chunk would fail with an error. This patch changes
the behaviour to recurse into those PlaceHolderVar.
2020-07-02 14:07:39 +02:00
Oleg Smirnov
0e9f1ee9f5 Enable compression for tables with compound foreign key
When enabling compression on a hypertable the existing
constraints are being cloned to the new compressed hypertable.
During validation of existing constraints a loop
through the conkey array is performed, and constraint name
is erroneously added to the list multiple times. This fix
moves the addition to the list outside the conkey loop.

Fixes #2000
2020-07-02 12:22:30 +02:00
Mats Kindahl
4cd90789da Add tests for hypertable unique constraint crash
If a unique constraint is created on a hypertable, it could under some
circumstance crash. This commit adds a test for this situation even
though it was already fixed (but was reported on the 1.7 branch).
2020-07-01 19:38:37 +02:00
Sven Klemm
3823db1218 Merge pg_regress.sh and pg_isolation_regress.sh
Since pg_regress.sh and pg_isolation_regress.sh were almost
identical this patch combines them into a single script.
This patch also changes the dynamic schedule generation
so make installcheck TESTS='foo' is supported again which
was broken by previous refactoring and you needed to specify
the exact suite your test was in if you wanted to use TESTS.
2020-07-01 13:55:28 +02:00
Sven Klemm
d85309d268 Add testing for released apt packages
This workflow will install our apt package and then try to enable
timescaledb in the database and also check the version installed
from the package against the expected version.
2020-06-30 22:57:03 +02:00
Brian Rowe
029b4e867e Fix potential mem corruption in distributed copy
This change copies the chunk object into the distributed copy's
memory context before caching it in the ChunkConnectionList. This
resolves an issue where the chunk was being modified after being
stored which was resulting in rows being sent to the incorrect
data node.

This fixes github issue #2037
2020-06-30 12:05:03 -07:00
Sven Klemm
3e5e5255f2 Fix segfault in cagg_update_view_definition
Since relation_close will decrease the reference counter this
might lead to the relation being freed while we are still using
the view query. This patch changes cagg_update_view_definition
to release the relations later and also keeps the locks till
the end of the transaction.
2020-06-30 20:22:00 +02:00
Sven Klemm
4e41672161 Remove unused functions
Remove functions that are no longer used due to refactorings.
Removes the following functions:
- hypertable_tuple_match_name
- ts_hypertable_get_all_by_name
- ts_hypertable_has_tuples
2020-06-30 18:05:16 +02:00
Sven Klemm
586f057ad0 Retain parallel schedule when using IGNORES
When either TESTS, SKIPS or IGNORES is set for a regression check
run we would generate a new temporary schedule based on those
variables without any parallelity. This patch changes the behaviour
to keep the original test schedule when only IGNORES is specified
and just prepend the ignore lines to a copy of the original schedule.
2020-06-30 17:47:40 +02:00
Sven Klemm
0e8adc97f4 Fix segfault in create_trigger_handler
The TriggerDesc from rel->trigdesc seems to be modified during
iterations of the loop and sometimes gets reallocated leading
to a situation where the local variable trigdesc no longer matches
rel->trigdesc leading to a segfault in create_trigger_handler.

Fixes #2013
2020-06-30 12:03:40 +02:00
Sven Klemm
8a1976a6b9 Upload coredumps as artifact
This patch adds collecting coredumps to the regression workflow
in addition to the binary all shared libraries used by the coredump
are collected as well.
2020-06-29 21:48:12 +02:00
Sven Klemm
c96216e631 Improve github action stacktrace handling
Check for coredumps and only execute the stracktrace if there are
actually coredumps. This patch also changes the log handling to
always collect logs and upload them cause they might have useful
information even when all steps succeed. Additionally a list
of all failed tests is shown before the regression diff.
This patch also disables fail-fast so a single failed job does
not cancel other jobs still in progress.
2020-06-29 17:50:53 +02:00