4099 Commits

Author SHA1 Message Date
Jan Nidzwetzki
9bbf521889 Remove Ubuntu Kinetic check on ARM64
We stopped to build packages for Ubuntu Kinetic on ARM64 due to the
limited support of PostgreSQL versions and the EOL of Kinetic in a few
weeks. This patch removes the check for up-to-date packages for this
version.
2023-06-30 11:35:15 +02:00
Jan Nidzwetzki
a7be1cc06a Fixed the ordering of merge_changelogs.sh script
The CHANGELOG.MD file contains the sections features, bugfixes, and
thanks. This patch adjusts the script merge_changelogs.sh to produce
the sections in the same order.
2023-06-30 11:33:57 +02:00
Jan Nidzwetzki
8a58101095 Post-release fixes for 2.11.1
Bumping the previous version and adding tests for 2.11.1.
2023-06-30 09:54:57 +02:00
Jan Nidzwetzki
8ae2da6260 Release 2.11.1
This release contains bug fixes since the 2.11.0 release. We recommend
that you upgrade at the next available opportunity.

**Features**
* #5679 Teach loader to load OSM extension

**Bugfixes**
* #5705 Scheduler accidentally getting killed when calling `delete_job`
* #5742 Fix Result node handling with ConstraintAwareAppend on
  compressed chunks
* #5750 Ensure tlist is present in decompress chunk plan
* #5754 Fixed handling of NULL values in bookend_sfunc
* #5798 Fixed batch look ahead in compressed sorted merge
* #5804 Mark cagg_watermark function as PARALLEL RESTRICTED
* #5807 Copy job config JSONB structure into current MemoryContext
* #5824 Improve continuous aggregate query chunk exclusion

**Thanks**
* @JamieD9 for reporting an issue with a wrong result ordering
* @xvaara for reporting an issue with Result node handling in
  ConstraintAwareAppend
2023-06-28 16:49:02 +02:00
Sven Klemm
118526e6ae Improve continuous aggregate query chunk exclusion
This patch changes the time_bucket exclusion in cagg queries to
distinguish between < and <=. Previously those were treated the
same leading to failure to exclude chunks when the constraints
where exactly at the bucket boundary.
2023-06-28 16:47:51 +02:00
Erik Nordström
e2e7e5f286 Make hypertables support replica identity
Add support for setting replica identity on hypertables via ALTER
TABLE. The replica identity is used in logical replication to identify
rows that have changed.

Currently, replica identity can only be altered on hypertables via the
root; changing it directly on chunks will raise an error.
2023-06-27 15:07:40 +02:00
Jan Nidzwetzki
33a3e10f48 Fixed batch look ahead in compressed sorted merge
In decompress_sorted_merge_get_next_tuple it is determine how many
batches need to be opened currently to perform a sorted merge. This is
done by checking if the first tuple from the last opened batch is larger
than the last returned tuple.

If a filter removes the first tuple, the first into the heap inserted
tuple from this batch can no longer be used to perform the check. This
patch fixes the wrong batch look ahead.

Fixes: #5797
2023-06-26 14:40:46 +02:00
Sven Klemm
da20d071cf Copy job config JSONB structure into current MemoryContext
The job config jsonb can be a nested structure of elements that
all need to reside in the same memory context as the other job
values. To ensure this we copy the structure on assignment.
2023-06-26 12:57:52 +02:00
Jan Nidzwetzki
f172679022 Added perltidy make target
This patch introduces the make target 'perltidy' to format Perl files
with perltidy. In addition, calling perltidy is added to 'make format'.
2023-06-26 10:59:19 +02:00
Ante Kresic
fb0df1ae4e Insert into indexes during chunk compression
If there any indexes on the compressed chunk, insert into them while
inserting the heap data rather than reindexing the relation at the
end. This reduces the amount of locking on the compressed chunk
indexes which created issues when merging chunks and should help
with the future updates of compressed data.
2023-06-26 09:37:12 +02:00
Zoltan Haindrich
81d4eb5cfb Add Ensure-s to reduce crashes in unexpected cases
It could happen that the Chunk is dropped in the middle of processing
another command. The test bgw_db_scheduler_fixed can crash due to that
reason. By making sure that the system will error out instead of
failing in an assertion could help avoid the situation in which
postmaster drop out all clients in these cases.
2023-06-26 09:29:52 +02:00
Jan Nidzwetzki
81e2f35d4b Mark cagg_watermark as PARALLEL RESTRICTED
This patch marks the function cagg_watermark as PARALLEL RESTRICTED. It
partially reverts the change of
c0f2ed18095f21ac737f96fe93e4035dbfeeaf2c. The reason is as follows: for
transaction isolation levels < REPEATABLE READ it can not be ensured
that parallel worker reads the same watermark (e.g., using read
committed isolation level: worker A reads the watermark, the CAGG is
refreshed and the watermark changes, worker B reads the newer
watermark). The different views on the CAGG can cause unexpected results
and crashes (e.g., the chunk exclusion excludes different chunks in
worker A and in worker B).

In addition, a correct snapshot is used when the watermark is read from
the CAGG and a TAP test is added, which detects inconsistent watermark
reads.

Co-authored-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Co-authored-by: Zoltan Haindrich <zoltan@timescale.com>
2023-06-23 20:07:26 +02:00
Konstantina Skovola
a22e732c02 Fix flaky test bgw_db_scheduler_fixed
The flakiness was due to two inserts falling into the
same chunk instead of distinct ones, so inserted data
further apart to ensure they fall in different chunks.
2023-06-23 18:11:09 +03:00
Zoltan Haindrich
d223000036 Chunk_create must add existing table or fail
Earlier this function have completed successfully if the requested
range already existed - regardless an existing table was supplied
or not.
2023-06-23 13:39:17 +02:00
Zoltan Haindrich
b2132f00a7 Make validate_chunk_status accept Chunk as argument
This makes the calls to this method more straightforward and could
help to do better checks inside the method.
2023-06-22 11:47:31 +02:00
Lakshmi Narayanan Sreethar
8b0ab41643 PG16: Use new function to check vacuum permission
postgres/postgres@b5d63824
2023-06-21 22:52:22 +05:30
Lakshmi Narayanan Sreethar
d96e72af60 PG16: Rename RelFileNode references to RelFileNumber or RelFileLocator
postgres/postgres@b0a55e4
2023-06-21 22:52:22 +05:30
Lakshmi Narayanan Sreethar
933285e646 PG16: Remove MemoryContextContains usage
Remove the usage of MemoryContextContains as it has been removed in PG16.

postgres/postgres@9543eff
2023-06-21 22:52:22 +05:30
Konstantina Skovola
1eb7e38d2d Enable ChunkAppend for space partitioned partial chunks
This is a follow-up patch for timescale#5599 which handles space
partitioned hypertables.
2023-06-20 11:41:59 +03:00
Bharathy
c48f905f78 Index scan support for UPDATE/DELETE.
During UPDATE/DELETE on compressed hypertables, we do a sequential
scan which can be improved by supporting index scans.

In this patch for a given UPDATE/DELETE query, if there are any
WHERE conditions specified using SEGMENT BY columns, we use index
scan to fetch all matching rows. Fetched rows will be decompressed
and moved to uncompressed chunk and a regular UPDATE/DELETE is
performed on the uncompressed chunk.
2023-06-15 19:59:04 +05:30
Jan Nidzwetzki
77318dced8 Fix broken download links
The download links for several platforms are broken. This patch removes
the links for the individual platforms and adds a link that points to
the self-hosted install docs instead (as proposed by the docs team, see
the discussion in #5762).

Fixes: #5762
2023-06-15 15:13:22 +02:00
Jan Nidzwetzki
f05b7f8105 Fixed the naming of the Windows GitHub action
The ignored workflow for windows-build-and-test does not set the name of
the actions properly. Therefore, these actions use the default naming.
For example, 'Regression Windows / build (15, windows-2022, Debug)'.
However, our CI expects names like 'PG15 Debug windows-2022' in the
required checks. This PR corrects the name of the jobs.
2023-06-15 14:25:30 +02:00
Valery Meleshkin
4273a27461 Ensure pg_config --cppflags are passed
CMAKE_CPP_FLAGS is not a thing at all. Furthermore,
CMAKE_CXX_FLAGS is not passed to a C compiler.
pg_config uses CPPGLAGS for all includes, and needs
to be passed into CMAKE_C_FLAGS as well.
2023-06-15 11:31:57 +02:00
Sotiris Stamokostas
14d08576fb Allow flaky-test label
With this PR we allow issues with flaky-test label
to be added to our bugs board.
2023-06-15 10:16:12 +03:00
Sven Klemm
e302aa2ae9 Fix handling of Result nodes below Sort nodes in ConstraintAwareAppend
With PG 15 Result nodes can appear between Sort nodes and
DecompressChunk when postgres tries to adjust the targetlist.
2023-06-13 18:42:02 +02:00
Jan Nidzwetzki
9c7ae3e8a9 Fixed two bugs in decompression sorted merge code
SQLSmith found two bugs in the compression sorted merge code.

* The unused_batch_states are not initialized properly. Therefore,
  non-existing unused batch states can be part of the BMS. This patch
  fixes the initialization.

* For performance reasons, We reuse the same TupleDesc across all
  TupleTableSlots. PostgreSQL sometimes uses TupleDesc data structures
  with active reference counting. The way we use the TupleDesc
  structures collides with the reference counting of PostgreSQL. This
  patch introduces a private TupleDesc copy without reference counting.
2023-06-12 20:30:13 +02:00
Lakshmi Narayanan Sreethar
4dce87a1c4 PG16: Refactor handling of PGDLLEXPORT macro definition
PG16 defines the PGDLLEXPORT macro as a proper visibility attribute. In
the previous versions from PG12 to PG16, the PGDLLEXPORT was always
defined as an empty macro. Considering all this, the code has been now
updated to skip defining PGDLLEXPORT if it has been already defined
properly. If not, the macro is redefined without any additional checks.

postgres/postgres@089480c
2023-06-12 17:25:49 +05:30
Lakshmi Narayanan Sreethar
0f1fde8d31 Mark PG16 as a supported version
Note that this change in combination with -DEXPERIMENTAL=ON cmake flag
will just allow us to compile timescaledb code with PG16 and this
doesn't mean PG16 is supported by the extension.
2023-06-12 17:25:49 +05:30
Sotiris Stamokostas
7df16ee560 Renamed need-more-info label
We plan to rename the need-more-info label to waiting-for-author.
This PR performs the needed adjustments in our GitHub actions.
2023-06-12 13:05:18 +03:00
Sotiris Stamokostas
8b10a6795c Compression test changes for PG14.0
We have changed the compression test by disabling parallel append
in some test cases because the regression test was falling only
in PG14.0 but not in PG14.8 or any other PostgreSQL version
2023-06-12 10:44:41 +03:00
Alexander Kuzmenkov
f26e656c0f Bulk decompression of compressed batches
Add a function to decompress a compressed batch entirely in one go, and
use it in some query plans. As a result of decompression, produce
ArrowArrays. They will be the base for the subsequent vectorized
computation of aggregates.

As a side effect, some heavy queries to compressed hypertables speed up
by about 15%. Point queries with LIMIT 1 can regress by up to 1 ms. If
the absolute highest performace is desired for such queries, bulk
decompression can be disabled by a GUC.
2023-06-07 16:21:50 +02:00
Alexander Kuzmenkov
c96870c91b Update gorilla and deltadelta fuzzing corpuses 2023-06-07 16:21:50 +02:00
Zoltan Haindrich
769646bdb6 Fix issues with scripts/test_update_smoke.sh
The test was failing on first run by leaving a database behind as a
sideeffect.
Between two steps the extension was dropped; without a proper cleanup.
A non-existent sql function was called during cleanup.

This patch also removes the "debug mode" and every execution will leave
the logs/etc in the /tmp directory for further inspection.
2023-06-07 13:30:21 +02:00
Jan Nidzwetzki
b8e674c137 Fixed handling of NULL values in bookend_sfunc
In the function bookend_sfunc values are compared. If the first
processed value is a NULL value, it was copied into the state of the
sfunc. A following comparison between the NULL value of the state and a
non-NULL value could lead to a crash.

This patch improves the handling of NULL values in bookend_sfunc.
2023-06-07 12:38:40 +02:00
Jan Nidzwetzki
f2eac72e2b Ensure tlist is present in decompress chunk plan
In PostgreSQL < 15, CustomScan nodes are projection capable. The planner
invokes create_plan_recurse with the flag CP_IGNORE_TLIST. So, the
target list of a CustomScan node can be NIL. However, we rely on the
target list to derive information for sorting.

This patch ensures that the target list is always populated before the
sort functions are called.

Fixes: #5738
2023-06-06 13:25:39 +02:00
Zoltan Haindrich
ac7090653e Ensure PR number is referenced in the .unreleased files
Adds a simple check to ensure that the PR number is present at least once
in the added changelog file.
Also fixes an earlier PR which introduced a typo.
2023-06-02 18:33:53 +02:00
Fabrízio de Royes Mello
4cef387f85 Replace heap_endscan to table_endscan 2023-06-02 11:15:11 -04:00
Sotiris Stamokostas
1a93c2d482 Improve parallel workers for decompression
So far, we have set the number of desired workers for decompression to
1. If a query touches only one chunk, we end up with one worker in a
parallel plan. Only if the query touches multiple chunks PostgreSQL
spins up multiple workers. These workers could then be used to process
the data of one chunk.

This patch removes our custom worker calculation and relies on
PostgreSQL logic to calculate the desired parallelity.

Co-authored-by: Jan Kristof Nidzwetzki <jan@timescale.com>
2023-06-02 16:16:08 +03:00
Jan Nidzwetzki
10cab43e6c Enable compressed merge append for partial chunks
This patch enables the compressed merge optimization (see #5530) also
for partially compressed chunks.
2023-06-02 11:16:10 +02:00
Dipesh Pandit
c507f31069
Internal Server Error when loading Explorer tab (#5723)
Internal Server Error when loading Explorer tab (SDC #995)
    
    This is with reference to a weird scenarios where chunk table entry exist in
    timescaledb catalog but it does not exist in PG catalog. The stale entry blocks
    executing hypertable_size function on the hypertable.
    
    The changes in this patch are related to improvements suggested for
    hypertable_size function which involves:
    1. Locking the hypertable in ACCESS SHARE mode in function hypertable_size to
    avoid risk of chunks being dropped by another concurrent process.
    2. Joining the hypertable and inherited chunk tables with "pg_class" to make
    sure that a stale table without an entry is pg_catalog is not included as part
    of hypertable size calculation.
    3. An additional filter (schema_name) is required on pg_class to avoid
    calculating size of multiple hypertables with same in different schema.
    
    NOTE: With this change calling hypertable_size function will require select
    privilege on the table.

Disable-check: force-changelog-file
2023-06-01 19:34:47 +05:30
Konstantina Skovola
ecc1b7b11a Enable ChunkAppend for partial chunks
This patch enables ChunkAppend optimization for partially
compressed chunks on hypertables without space partitioning,
allowing for more efficient processing of LIMIT order by
queries.
A follow-up patch is required to handle space partitioned
hypertables.
2023-05-31 21:29:51 +03:00
epgts
d6030a32d8
Teach loader to load OSM extension (#5679) 2023-05-31 13:18:48 -05:00
Bharathy
b38c920266 MERGE support on hypertables
This patch does following:

1. Planner changes to create ChunkDispatch node when MERGE command
   has INSERT action.
2. Changes to map partition attributes from a tuple returned from
   child node of ChunkDispatch against physical targetlist, so that
   ChunkDispatch node can read the correct value from partition column.
3. Fixed issues with MERGE on compressed hypertable.
4. Added more testcases.
5. MERGE in distributed hypertables is not supported.
6. Since there is no Custom Scan (HypertableModify) node for MERGE
   with UPDATE/DELETE on compressed hypertables, we don't support this.

Fixes #5139
2023-05-27 10:29:11 +05:30
Zoltan Haindrich
ab2cccb6e2 Post-release 2.11.0
Adjust the upgrade/downgrade scripts and add the tests.

(cherry picked from commit d5fea0a842cbd38d2d72db16e9e67f1c9b1ccf36)
2023-05-25 18:22:32 +02:00
Rafia Sabih
70d0704368 Refactor continuous aggregate code 2023-05-25 17:13:12 +02:00
Alexander Kuzmenkov
29154b29d1 Ignore the telemetry test for the time begin
It's the fifths run and it still fails in some jobs.
2023-05-25 11:35:07 +02:00
Alexander Kuzmenkov
6589f43160 Compression fuzzing in CI
This serves as a way to exercise the decompression fuzzing code, which
will be useful when we need to change the decompression functions. Also
this way we'll have a check in CI that uses libfuzzer, and it will be
easier to apply it to other areas of code in the future.
2023-05-25 11:35:07 +02:00
Fabrízio de Royes Mello
54d4c3de6b Introduce utility function ts_get_relation_relid
In several places of our code base we use a combination of
`get_namespace_oid` and `get_relname_relid` to return the Oid of a
schema qualified relation, so refactored the code to encapsulate this
behavior in a single function.
2023-05-24 18:55:38 -03:00
Eric Gillespie
f2743648df Update emacs configuration
Use postgres for sql-mode, which makes it easier to connect to local
postgresql with C-c C-z and also sets up postgresql extensions for
font-lock.

Copy the 4-space tab-width setting to diff-mode so that, for example,
diffs of lines containing 18 TABs don't display with 144-space indent.
2023-05-23 12:57:27 -05:00
Sven Klemm
f14ff40d63 Bump PG version used in CI
Use PG 12.15, 13.11, 14.8 and 15.3 in CI.
2023-05-23 16:46:30 +02:00