13 Commits

Author SHA1 Message Date
Matvey Arye
d52b48e0c3 Delete compression policy when drop hypertable
Previously we could have a dangling policy and job referring
to a now-dropped hypertable.

We also block changing the compression options if a policy exists.

Fixes #1570
2020-01-02 16:40:59 -05:00
Matvey Arye
2f7d69f93b Make continuous agg relative to now()
Previously, refresh_lag in continuous aggs was calculated
relative to the maximum timestamp in the table. Change the
semantics so that it is relative to now(). This is more
intuitive.

Requires an integer_now function applied to hypertables
with integer-based time dimensions.
2019-11-21 14:17:37 -05:00
Joshua Lockerman
e9e7c5f38e Add missing tests discovered by Codecov 3
Tests for continuous aggregates over compressed data, which also tests
selecting tableoids from compressed tables.
2019-10-29 19:02:58 -04:00
gayyappan
940d5aa3ac Compression related ddl tests
Trigger tests with compress/decompress_chunk
2019-10-29 19:02:58 -04:00
Matvey Arye
85d30e404d Add ability to turn off compression
Since enabling compression creates limits on the hypertable
(e.g. types of constraints allowed) even if there are no
compressed chunks, we add the ability to turn off compression.
This is only possible if there are no compressed chunks.
2019-10-29 19:02:58 -04:00
Matvey Arye
7380efa0fe Add tests that constraint adding is blocked
Adding constraints to tables that have compression enabled should
be blocked for now.
2019-10-29 19:02:58 -04:00
Matvey Arye
b8a98c1f18 Make compressed chunks use same tablespace as uncompressed
For tablepaces with compressed chunks the semantics are the following:
  - compressed chunks get put into the same tablespace as the
    uncommpressed chunk on compression.
 - set tablespace on uncompressed hypertable cascades to compressed hypertable+chunks
 - set tablespace on all chunks is blocked (same as w/o compression)
 - move chunks on a uncompressed chunk errors
 - move chunks on compressed chunk works

In the future we will:
 - add tablespace option to compress_chunk function and policy (this will override the setting
   of the uncompressed chunk). This will allow changing tablespaces upon compression
 - Note: The current plan is to never listen to the setting on compressed hypertable. In fact,
   we will block setting tablespace on  compressed hypertables
2019-10-29 19:02:58 -04:00
Matvey Arye
4d65a01a57 Handle change owner on ht with compressio
Pass down the change owner command to the compressed hypertable.
2019-10-29 19:02:58 -04:00
Matvey Arye
c5d4ce7f90 Handle set tablespace on ht with compression
Pass down the set tablespace command to the compressed hypertable.
2019-10-29 19:02:58 -04:00
Matvey Arye
a399a57af9 Block most DDL on hypertable with compression
Block most DDL commands on hypertables with compression enabled.
This restriction will be relaxed over time.

The only alter table commands currently allowed are:
Add/Remove index, Set storage options, clustering index,
set statistics and set tablespace.

We also disallow reseting compression options.
2019-10-29 19:02:58 -04:00
Matvey Arye
8250714a29 Add fixes for Windows
- Fix declaration of functions wrt TSDLLEXPORT consistency
- Empty structs need to be created with '{ 0 }' syntax.
- Alignment sentinels have to use uint64 instead of a struct
  with a 0-size member
- Add some more ORDER BY clauses in the tests to constrain
  the order of results
- Add ANALYZE after running compression in
  transparent-decompression test
2019-10-29 19:02:58 -04:00
Matvey Arye
df4c444551 Delete related rows for compression
This fixes delete of relate rows when we have compressed
hypertables. Namely we delete rows from:

- compression_chunk_size
- hypertable_compression

We also fix hypertable_compression to handle NULLS correctly.

We add a stub for tests with continuous aggs as well as compression.
But, that's broken for now so it's commented out. Will be fixed
in another PR.
2019-10-29 19:02:58 -04:00
Matvey Arye
0db50e7ffc Handle drops of compressed chunks/hypertables
This commit add handling for dropping of chunks and hypertables
in the presence of associated compressed objects. If the uncompressed
chunk/hypertable is dropped than drop the associated compressed object
using DROP_RESTRICT unless cascading is explicitly enabled.

Also add a compressed_chunk_id index on compressed tables for
figuring out whether a chunk is compressed or not.

Change a bunch of APIs to use DropBehavior instead of a cascade bool
to be more explicit.

Also test the drop chunks policy.
2019-10-29 19:02:58 -04:00