2418 Commits

Author SHA1 Message Date
Erik Nordström
ce6387aa90 Allow only integer intervals for custom time types
Fix a check for a compatible chunk time interval type when creating a
hypertable with a custom time type.

Previously, the check allowed `Interval` type intervals for any
dimension type that is not an integer type, including custom time
types. The check is now changed so that it only accepts an `Interval`
for timestamp and date type dimensions.

A number of related error messages are also cleaned up so that they
are more consistent and conform to the error style guide.
2020-10-15 18:58:01 +02:00
Erik Nordström
c4a91e5ae8 Assume custom time type range is same as bigint
The database must know the valid time range of a custom time type,
similar to how it knows the time ranges of officially supported time
types. However, the only way to "know" the valid time range of a
custom time type is to assume it is the same as the one of a supported
time type.

A previous commit tried to make such assumptions by finding an
appropriate cast from the custom time type to a supported time
type. However, this fails in case there are multiple casts available
that each could return a different type and range.

This change restricts the choice of valid time ranges to only that of
the bigint time type.

Fixes #2523
2020-10-15 18:58:01 +02:00
Sven Klemm
e33a72a607 Fix flaky remote_txn test
The error message about closed connections varies between
platforms/environments leading to flaky tests. This patch
changes expected test output to sqlstate only in tests
affected by this.
2020-10-15 05:01:15 +02:00
Sven Klemm
b1c28c9c7c Remove unreferenced steps from isolation tests
Some isolation tests had steps that were not referenced in
any of the permutations so this patch removes those.
2020-10-15 04:03:48 +02:00
Mats Kindahl
0e507affc1 Remove modification time from invalidation log
The `modification_time` column is hard to maintain with any level of
consistency over merges and splits of invalidation ranges so this
commit removes it from the invalidation log entries for both
hypertables and continuous aggregates. If the modification time is
needed in the future, we need to re-introduce it in a manner that can
maintain it over both merges and splits.

THe function `ts_get_now_internal` is also removed since it is not used
any more.

Part of #2521
2020-10-14 17:36:51 +02:00
gayyappan
cf34f7d2ce Pass correct status to lock_job
lock_job is passed incorrect Status as argument.
The lock is incorrectly interpreted as a session
lock when a transaction lock is desired.
2020-10-14 09:43:30 -04:00
Sven Klemm
e79c0648cf Fix member access within misaligned address in chunk_update_colstats
The array argument passed to array_length is treated as AnyArrayType
which is a union of ArrayType and ExpandedArrayHeader, which lead to
member access within misaligned address when used on the argument
passed to array_length by chunk_update_colstats which is ArrayType.
2020-10-13 21:05:23 +02:00
Sven Klemm
4b4db04c1e Clean up update tests
Refactor update test files and remove obsolete test files.
2020-10-13 18:06:28 +02:00
Sven Klemm
336d8f9c47 Check function linkage in update test
This patch adds a check that all c functions link to the correct
library after an update.
2020-10-13 18:06:28 +02:00
Mats Kindahl
7b8203fc53 Update test dist_ddl to execute in parallel
Change database names to be unique over the test suite by adding the
test database name in front of the created database names in the test.
This will allow the test to be executed in parallel with other tests
since it will not have conflicting databases in the same cluster.
2020-10-13 16:44:31 +02:00
Sven Klemm
ccfca446f2 Fix timescaledb_fdw function handling in update script
This patch splits the timescaledb_fdw sql file into two parts to
separate the idempotent parts from the non-idempotent ones so
the function definitions can be included in the regular update
script.
2020-10-13 14:59:27 +02:00
Sven Klemm
87f78b4844 Move distributed insert tests to shared test
Change the distributed insert test to shared test so it can run in
parallel and doesn't require dedicated distributed setup.
2020-10-13 14:22:17 +02:00
Sven Klemm
d22799e21c Use unique datanode name in read_only test 2020-10-13 14:22:17 +02:00
Sven Klemm
d8048f2a33 Use environment files for github actions
GitHub deprecates use of set-env in workflows so switch to using
environment files.

https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-10-13 12:18:05 +02:00
Ruslan Fomkin
85095b6eef Cleanup public API
Removes unlrelated column schedule_interval from
timescaledb_information.continuous_aggregates view and simplifies it.
Renames argument cagg in refresh_continuous_aggregate into
continuous_aggregate as in add_continuous_aggregate_policy.

Part of #2521
2020-10-13 09:41:12 +02:00
Mats Kindahl
85428bc383 Support non-transactional distibuted_exec
Before this commit, executions of `distributed_exec` was always
transactional and this could not be disabled. This cause problems when
executing statements that cannot be executed inside a transaction, such
as `CREATE DATABASE`.

With this commit, we introduce a parameter `transactional` to
`distributed_exec` that allow non-transactional executions on data
nodes. The parameter defaults to `TRUE`.  Generates an error if
`distributed_exec` is non-transactional and inside a transaction.

It also changes `distributed_exec` to be a procedure, which better
matches it's usage (it returns `VOID`).

Closes #1660
2020-10-13 08:36:06 +02:00
Sven Klemm
967a10afcb Fix flaky update test
Disable background workers during update tests to prevent deadlocks
in continuous aggregates on 1.7.x
2020-10-12 16:15:29 +02:00
Sven Klemm
03deb65b0f Fix update test diff display
The latest update test refactoring renamed some of the output files
to better state their origin but not all places in the github
workflow were adjusted to handle the new names.
2020-10-12 16:15:29 +02:00
Dmitry Simonenko
ebc4fd9b9e Add if_attached argument to detach_data_node()
This change makes detach_data_node() function consistent with
other data node management functions by adding missing
if_attach argument.

The function will not show an error in case if data node is not
attached and if_attached is set to true.

Issue: #2506
2020-10-08 20:53:14 +03:00
Mats Kindahl
8ddaef66ea Remove error for correct bootstrap of data node
If the database exists on the data node when executing `add_data_node`
it will generate an error in the data node log, which can cause
problems since there is an error indication in the log but there are no
failing operations.

This commit fixes this by first validating the database and only if it
does not exist, create the database.

Closes #2503
2020-10-08 09:03:15 +02:00
niksa
65f31122ee Fix validation logic when adding a new data node
We stop enforcing an extension owner to be the same as a user adding a
data node since that's not strictly necessary. In multi-node setups
it is common that a data node is pre bootstrapped and an extension owner
is already set. This will prevent getting an error when a non
extension owner tries to add a data node.
2020-10-07 21:11:30 +02:00
gayyappan
2347ebd123 Overflow handling for refresh policy with integer time
When we compute the start and end intervals for the
refresh job execution, there is a potential to
run into overflow with integer computations. In such cases,
clamp the start/end boundaries to the MIN and MAX for that
datatype ( i.e. PG_INT64_MIN or PG_INT64_MAX for int64,
PG_INT16_MIN or PG_INT16_MAX for int16 and so on).
2020-10-06 10:26:53 -04:00
Dmitry Simonenko
3f2297b173 Block reorder policy for distributed hypertables 2020-10-06 15:46:38 +03:00
Sven Klemm
641eb4e86b Ignore details of telemetry job in update test
Since handling of telemetry differs between timescaledb versions
when telemetry is disabled via environment variable we ignore the
scheduled flag in the post update diff.
2020-10-06 01:50:53 +02:00
Sven Klemm
c3b9ca9e49 Fix compression_settings view definition 2020-10-06 01:50:53 +02:00
Sven Klemm
5b97d8b3a9 Fix update script generation for versions with suffix 2020-10-06 01:50:53 +02:00
Sven Klemm
cc94d56d0e Add 2.0.0-rc1 to update test scripts 2020-10-06 01:50:53 +02:00
Sven Klemm
46f7914e19 Release 2.0.0-rc1
This release adds major new features and bugfixes since the 1.7.4 release.
We deem it moderate priority for upgrading.

This release adds the long-awaited support for distributed hypertables to
TimescaleDB. With 2.0, users can create distributed hypertables across
multiple instances of TimescaleDB, configured so that one instance serves
as an access node and multiple others as data nodes. All queries for a
distributed hypertable are issued to the access node, but inserted data
and queries are pushed down across data nodes for greater scale and
performance.

This release also adds support for user-defined actions allowing users to
define actions that are run by the TimescaleDB automation framework.

In addition to these major new features, the 2.0 branch introduces _breaking_ changes
to APIs and existing features, such as continuous aggregates. These changes are not
backwards compatible and might require changes to clients and/or scripts that rely on
the previous APIs. Please review our updated documentation and do proper testing to
ensure compatibility with your existing applications.

The noticeable breaking changes in APIs are:
- Redefined functions for policies
- A continuous aggregate is now created with `CREATE MATERIALIZED VIEW`
  instead of `CREATE VIEW` and automated refreshing requires adding a policy
  via `add_continuous_aggregate_policy`
- Redesign of informational views, including new (and more general) views for
  information about policies and user-defined actions

This release candidate is upgradable, so if you are on a previous release (e.g., 1.7.4)
you can upgrade to the release candidate and later expect to be able to upgrade to the
final 2.0 release. However, please carefully consider your compatibility requirements
_before_ upgrading.

**Major Features**
* #1923 Add support for distributed hypertables
* #2006 Add support for user-defined actions
* #2435 Move enterprise features to community
* #2437 Update Timescale License

**Minor Features**
* #2011 Constify TIMESTAMPTZ OP INTERVAL in constraints
* #2105 Support moving compressed chunks

**Bugfixes**
* #1843 Improve handling of "dropped" chunks
* #1886 Change ChunkAppend leader to use worker subplan
* #2116 Propagate privileges from hypertables to chunks
* #2263 Fix timestamp overflow in time_bucket optimization
* #2270 Fix handling of non-reference counted TupleDescs in gapfill
* #2325 Fix rename constraint/rename index
* #2370 Fix detection of hypertables in subqueries
* #2376 Fix caggs width expression handling on int based hypertables
* #2416 Check insert privileges to create chunk
* #2428 Allow owner change of continuous aggregate
* #2436 Propagate grants in continuous aggregates
2020-10-05 22:00:16 +02:00
Sven Klemm
3f5872ec61 Run pg_format on SQL files 2020-10-05 21:33:42 +02:00
Sven Klemm
dbd707b17e Fix datanode sql function script
This patch merge data_node and remote_txn sql scripts and fixes
the CREATE FUNCTION statement to use CREATE OR REPLACE FUNCTION.
2020-10-05 19:35:51 +02:00
Brian Rowe
2dc15ee345 Show unscheduled jobs as paused in job_stats
This change updates the timescaledb_information.job_stats view to
check whether a job is currently scheduled in the bgw_config table.
If it is not, the `job_status` field will show `Paused` and the
`next_start` field will be NULL.

Fixes #2488
2020-10-05 10:14:56 -07:00
Sven Klemm
a1cf324063 Fix timescaledb_fdw sql script
Since CREATE FOREIGN DATA WRAPPER is not idempotent it must not be
grouped with the normal sql scripts but has to be in the pre_install
group.
2020-10-05 18:42:32 +02:00
Sven Klemm
ec41593978 Ignore memory leaks in openssl code
Ignore memory leaks in openssl code when running sanitizer tests
in CI.
2020-10-05 17:38:00 +02:00
Erik Nordström
4623db14ad Use consistent column names in views
Make all views that reference hypertables use `hypertable_schema` and
`hypertable_name`.
2020-10-05 15:18:47 +02:00
Mats Kindahl
c029a7be02 Remove use of REGCLASS in views
Removing usage of `REGCLASS` from view `continuous_aggregates` and
splitting it into schema and name.
2020-10-05 14:07:22 +02:00
Erik Nordström
7a406fa690 Make data nodes view consistent with other views
Rename the data_node view to data_nodes to be consistent with other
views that all use the plural form.
2020-10-05 12:24:54 +02:00
gayyappan
5a5cbe1a93 Rename column in job_stats view
Rename next_scheduled_run to next_start so that
jobs and job_stats views have the same column names
2020-10-02 13:36:47 -04:00
Sven Klemm
b0a1f63969 Fix application_name for user-defined actions 2020-10-02 18:13:35 +02:00
Erik Nordström
f7e26ebb62 Fix parameter names in policy API code
A previous change updated the public function definitions, but didn't
update the code and error messages to match these changes.
2020-10-02 17:11:06 +02:00
Sven Klemm
544d3af522 Improve check for fallthrough support
Change the check for fallthrough support to check for the attribute
instead of specific compiler versions.
2020-10-02 16:28:33 +02:00
Mats Kindahl
da97ce6e8b Make function parameter names consistent
Renaming the parameter `hypertable_or_cagg` in functions `drop_chunks`
and `show_chunks` to `relation` and changing parameter name from
`main_table` to `hypertable` or `relation` depending on context.
2020-10-02 08:52:20 +02:00
gayyappan
b341506cb2 Enable continuous_aggs_policy test
Disable NOTICE messages for time based tables in
continuous_aggs_policy test. The refresh sometimes
does not have anything to update as the intervals
are computed based off now(). This causes intermittent
failures due to NOTICEs that the cagg is up to date.

Remove continuous_aggs_policy from ignores list in CI
scripts.
2020-10-01 16:47:10 -04:00
gayyappan
05355ab0be Check start > end for refresh policy
Add check to verify that start_interval >
end_interval specified by the refresh continuous
aggregate policy
2020-10-01 16:47:10 -04:00
Brian Rowe
0703822a83 Create low end invalidation when updating caggs
This change will add an invalidation to the
materialization_invalidation_log for any region earlier than the
ignore_invalidation_older_than parameter when updating a continuous
aggregate to 2.0. This is needed as we do not record invalidations
in this region prior to 2.0 and there is no way to ensure the
aggregate is up to date within this range.

Fixes #2450
2020-10-01 10:39:41 -07:00
gayyappan
ef7f21df6d Modify job_stats and continuous_aggregates view
Use hypertable_schema and hypertable_name instead
of regclass hypertable in job_stats and
continuous_aggregates views.
2020-10-01 11:39:10 -04:00
Ruslan Fomkin
7f98d7fa0c Test Apache license on Windows
Fixes the regression test of Apache license on Windows.
2020-10-01 12:56:37 +02:00
Ruslan Fomkin
cdb4c8fa4f Ignore flaky test for now
continuous_aggs_policy is flaky and prevents to proceed with current
PRs. This commit ignores it until it is fixed.
2020-10-01 12:40:19 +02:00
Sven Klemm
7fa8b1c06f Use postgres implementation of estimate_hashagg_tablesize
Only use our own implementation of estimate_hashagg_tablesize on
versions where the postgres implementation is static.
2020-09-30 14:33:52 +02:00
Dmitry Simonenko
a51aa6d04b Move enterprise features to community
This patch removes enterprise license support and moves
move_chunk() function under community license (TSL).

Licensing validation code been reworked and simplified.
Previously used timescaledb.license_key guc been renamed to
timescaledb.license.

This change also makes testing code more strict against
used license. Apache test suite now can test only apache-licensed
functions.

Fixes #2359
2020-09-30 15:14:17 +03:00
Ruslan Fomkin
66c63476e5 Change cagg refresh to cover buckets
Refresh of a continuous aggregate was expanding refresh window to
include buckets, which contain the start and end of the window. This
was leading to refreshing dropped data into the first bucket in the
corner case, when drop_before of a retention policy is the same as
start_offset of a continuous aggregate policy and the last dropped
chunk happens to intersect with the first bucket. See #2198 for
detailed discussion.

A behavior of a refresh, which is called when chunks are dropped, is
not changed, i.e., buckets, which fully cover chunks ot be dropped,
are refreshed if needed (i.e., there were changes in the chunks, which
were not refreshed yet). It can be done separately if needed.

Fixes #2198
2020-09-29 22:03:07 +02:00