Commit Graph

3324 Commits (ccc042a9d4fb7a4da49d3fee402f11e6394ae42f)

Author SHA1 Message Date
Onur Tirtir ccc042a9d4 Add changelog for 9.2.7
(cherry picked from commit 2535d15121)

 Conflicts:
	CHANGELOG.md
2021-11-03 11:23:17 +03:00
Onur Tirtir 13748d1eb7 Bump citus version to 9.2.7 2021-11-03 11:20:55 +03:00
Halil Ozan Akgul 5c157a5357 Fixes create index concurrently bug
(cherry picked from commit 38b72ddd66)

Changed IsCitusTable to IsDistributedTable
2020-07-27 12:04:04 +03:00
SaitTalhaNisanci c6c31e0f1f Fix int32 overflow and use PG macros for INT32_XX (#4061)
* Use CalculateUniformHashRangeIndex in HashPartitionId

INT32_MIN definition can change among different platforms hence it is
possible to get overflow, we would see crashes because of this in debian
distros. We have already solved a similar problem with introducing
CalculateUniformHashRangeIndex method, hence to solve it we can use the
same method, this also removes some duplication and has a single place
to decide that.

* Use PG_INT32_XX instead of INT32_XX to be safer

(cherry picked from commit ef841115de)

 Conflicts:
	src/backend/distributed/commands/multi_copy.c
2020-07-27 11:59:33 +03:00
Halil Ozan Akgül b504b749a6 Fixes the non existing table bug (#4058)
(cherry picked from commit e9f89ed651)
2020-07-27 11:40:37 +03:00
Marco Slot 683279cc36 Prevent integer overflow in FindShardIntervalIndex 2020-07-17 13:29:51 +02:00
Nils Dijk f2ec1563c2
fix flappy tests due to undeterministic order of test output (#4029)
As reported on #4011 https://github.com/citusdata/citus/pull/4011/files#r453804702 some of the tests were flapping due to an indeterministic order for test outputs.

This PR makes the test output ordered for all tests returning non-zero rows.

Needs to be backported to 9.2, 9.3, 9.4
2020-07-14 15:49:57 +02:00
Nils Dijk 313a489856
force aliases in deparsing for queries with anonymous column references (#4011)
DESCRIPTION: Force aliases in deparsing for queries with anonymous column references

Fixes: #3985

The root cause has todo with discrepancies in the query tree we create. I think in the future we should spend some time on categorising all changes we made to ruleutils and see if we can change the data structure `query` we pass to the deparser to have an actual valid postgres query for the deparser to render.

For now the fix is to keep track, besides changing the names of the entries in the target list, also if we have a reference to an anonymous columns. If there are anonymous columns we set the `printaliases` flag to true which forces the deparser to add the aliases.
2020-07-13 18:32:05 +02:00
Hadi Moshayedi a2e9a59007 Fix Subtransaction memory leak
(cherry picked from commit 3651fc64ee)

 Conflicts:
	src/test/regress/expected/multi_test_helpers_superuser.out
	src/test/regress/sql/multi_test_helpers_superuser.sql

 This helper sql file was not in release-9.2. So create helper file
 only with top_transaction_context_size and add this to multi_schedule
2020-07-10 11:03:29 +03:00
Onur Tirtir 0419d340b6
Merge pull request #3931 from citusdata/release-9.2-push-1592827722
Bump version to 9.2.6 in release-9.2 & Update CHANGELOG
2020-06-22 16:59:45 +03:00
Onur Tirtir f7a0e3b64d Update CHANGELOG for 9.2.6
(cherry picked from commit 4a38685744)

Conflicts:
	CHANGELOG.md
2020-06-22 16:27:53 +03:00
Onur Tirtir efa572009f Bump version to 9.2.6 2020-06-22 15:08:48 +03:00
Onur Tirtir 7beea1417c
Bump version to 9.2.5 (#3929) 2020-06-22 13:19:28 +03:00
Onur Tirtir eb699ecec6 Update CHANGELOG for 9.2.5
(cherry picked from commit 74f20149cd)

Conflicts:
	CHANGELOG.md
2020-06-17 19:10:53 +03:00
Nils Dijk 006df8fef3
fix test output for tdigest (#3909)
Due to the problem described in #3908 we don't cover the tdigest integration (and other extensions) on CI.

Due to this a bug got in the patch due to a change in `EXPLAIN VERBOSE` being merged concurrently with the tdigest integration. This PR fixes the test output that missed the newly added information.

(cherry picked from commit f57711b3d2)
2020-06-17 14:34:17 +02:00
Nils Dijk 4ce6c9d8b9
Feature: tdigest aggregate (#3897)
DESCRIPTION: Adds support to partially push down tdigest aggregates

tdigest extensions: https://github.com/tvondra/tdigest

This PR implements the partial pushdown of tdigest calculations when possible. The extension adds a tdigest type which can be combined into the same structure. There are several aggregate functions that can be used to get;
 - a quantile
 - a list of quantiles
 - the quantile of a hypothetical value
 - a list of quantiles for a list of hypothetical values

These function can work both on values or tdigest types.

Since we can create tdigest values either by combining them, or based on a group of values we can rewrite the aggregates in such a way that most of the computation gets delegated to the compute on the shards. This both speeds up the percentile calculations because the values don't have to be sorted while at the same time making the transfer size from the shards to the coordinator significantly less.

(cherry picked from commit da8f2b0134)
2020-06-17 14:31:37 +02:00
Philip Dubé ea4549a4c0
Fix create_distributed_table on a table using GENERATED ALWAYS AS
If the generated column does not come at the end of the column list,
columnNameList doesn't line up with the column indexes. Seek past

CREATE TABLE test_table (
    test_id int PRIMARY KEY,
    gen_n int GENERATED ALWAYS AS (1) STORED,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
SELECT create_distributed_table('test_table', 'test_id');

Would raise ERROR: cannot cast 23 to 1184

(cherry picked from commit 34f241af16)
2020-05-12 16:20:56 +03:00
Onur Tirtir 453d363ec3 Fix build issue in GCC 10 (#3790)
As reported in #3787, we were having issues while building citus with "GCC Red Hat 10" (maybe in some other versions of gcc as well).
Fixes "multiple definition of 'CitusNodeTagNames'" error by explicitly specifying storage of CitusNodeTagNames to be extern.
(cherry picked from commit b8dd8f50d1)
2020-04-22 17:45:02 +03:00
Onur Tirtir 103887024d
Update CHANGELOG for 9.2.4 (#3675)
(cherry picked from commit aedfc99b62)
2020-03-31 10:20:43 +03:00
Önder Kalacı e63435def5
Downgrade from 9.3-1 to 9.2-4 AND upgrade from 9.2-2 to 9.2-4 (#3673)
* Downgrade from 9.3-1 to 9.2-4 AND upgrade from 9.2-2 to 9.2-4

We have accidentally tagged master branch with v9.2-3. However master branch
was already bumped to v9.3-1, with this commit, we are undoing the catalog
changes that have happened between 9.2-2 to 9.3-1, and making 9.2-4 as the
release that we can use as the continuation of 9.2 series.

Similarly, we have a path to upgrade from 9.2-2 to 9.2-4
2020-03-31 09:18:25 +02:00
Jelte Fennema 5c6df97e92 Update version to 9.2.3 2020-03-25 14:40:56 +01:00
Jelte Fennema feb37dab62 Update CHANGELOG for v9.2.3 (#3648)
(cherry picked from commit 36ff150465)
2020-03-25 14:33:54 +01:00
Philip Dubé d693bc1b0c Also check aggregates in havingQual when scanning for non pushdownable aggregates
Came across this while coming up with test cases,
'result "68_1" does not exist' I'll seek to address in a future PR,
for now avoid segfault

(cherry picked from commit 4b68ee12c6)
2020-03-25 13:38:29 +01:00
Nils Dijk 535b0804be Fix left join shard pruning (#3569)
DESCRIPTION: Fix left join shard pruning in pushdown planner

Due to #2481 which moves outer join planning through the pushdown planner we caused a regression on the shard pruning behaviour for outer joins.

In the pushdown planner we make a union of the placement groups for all shards accessed by a query based on the filters we see during planning. Unfortunately implicit filters for left joins are not available during this part. This causes the inner part of an outer join to not prune any shards away. When we take the union of the placement groups it shows the behaviour of not having any shards pruned.

Since the inner part of an outer query will not return any rows if the outer part does not contain any rows we have observed we do not have to add the shard intervals of the inner part of an outer query to the list of shard intervals to query.

Fixes: #3512
(cherry picked from commit e5237b9e20)
2020-03-25 13:38:07 +01:00
Philip Dubé 2452a899bd
9.2: First phase of addressing HAVING subquery issues (#3599)
Add failing tests, make changes to avoid crashes at least

Fix HAVING subquery pushdown ignoring reference table only subqueries,
also include HAVING in recursive planning

Given that we have a function IsDistributedTable which includes reference tables,
it seems best to have IsDistributedTableRTE & QueryContainsDistributedTableRTE
reflect that they do not include reference tables in their check

Similarly SublinkList's name should reflect that it only scans WHERE

contain_agg_clause asserts that we don't have SubLinks,
use contain_aggs_of_level as suggested by pg sourcecode

(cherry-picked from commit 81cfa05d3d)
2020-03-25 10:19:18 +01:00
Jelte Fennema fc4e64ed9a Use Microsoft approved cipher string (#3639)
This cipher string is approved by the Microsoft security team and only enables
TLSv1.2 ciphers.

(cherry picked from commit 149f0b2122)
2020-03-25 09:24:37 +01:00
Jelte Fennema 8ed792cdb4 Mark all connections for shutdown when citus.node_conninfo chan… (#3642)
We cache connections between nodes in our connection management code.
This is good for speed. For security this can be a problem though. If
the user changes settings related to TLS encryption they want those to
be applied to future queries. This is especially important when they did
not have TLS enabled before and now they want to enable it. This can
normally be achieved by changing citus.node_conninfo.  However, because
connections are not reopened there will still be old connections that
might not be encrypted at all.

This commit changes that by marking all connections to be shutdown at
the end of their current transaction. This way running transactions will
succeed, even if placement requires connections to be reused for this
transaction. But after this transaction completes any future statements
will use a connection created with the new connection options.

If a connection is requested and a connection is found that is marked
for shutdown, then we don't return this connection. Instead a new one is
created. This is needed to make sure that if there are no running
transactions, then the next statement will not use an old cached
connection, since connections are only actually shutdown at the end of a
transaction.

(cherry picked from commit 2aabe3e2ef)
2020-03-25 09:24:30 +01:00
Nils Dijk 6f767ac04b Revert: Semmle: Protect against theoretical race in recursive d… (#3619)
As discussed with @JelteF; #3559 caused consistent errors on BSD (OSX). Given a group of people use this environment to develop on it is an undesirable change.

This reverts commit ca8f7119fe.

(cherry picked from commit 6ff79c5ea9)
2020-03-25 09:23:22 +01:00
Jelte Fennema 43421d4043 Ignore safestringlib sourcefiles in coverage (#3632)
This is not our code, so we don't care about the coverage our tests generate
for it.

(cherry picked from commit 8deb805338)
2020-03-25 09:23:15 +01:00
Jelte Fennema a573e0df95 Really ignore -Wgnu-variable-sized-type-not-at-end (#3627)
(cherry picked from commit 56863e8f0b)
2020-03-25 09:23:09 +01:00
Jelte Fennema 56c8389495 Unparallelize tests (#3629)
We're getting a lot of random failures on CI regarding connection errors. This
works around that by not running that create lots of connections in parallel.

(cherry picked from commit ed0376bb41)
2020-03-25 09:23:02 +01:00
Jelte Fennema e91be43de1 Ignore symlinks and directories editorconfig CI script
(cherry picked from commit a3513c8902)
2020-03-25 09:22:57 +01:00
Jelte Fennema 913978235a Update cherry-pick hash in vendor README
(cherry picked from commit 605b901637)
2020-03-25 09:22:52 +01:00
Jelte Fennema 2abbc8fa32 Fix compilation issues with safestringlib
Based on 92d7a40d1d

(cherry picked from commit dc2a371d9f)
2020-03-25 09:22:46 +01:00
Jelte Fennema d86e4d2587 Update safestringlib
(cherry picked from commit 9a79935f1f)
2020-03-25 09:22:41 +01:00
Jelte Fennema 909711548b Compile safestringlib using regular configure
This is needed to automatically generate .bc (bitcode) files when
postgres is compiled with llvmjit support.

It also has the advantage that cmake is not required for the build
anymore.

(cherry picked from commit 6db7d87618)
2020-03-25 09:22:33 +01:00
Jelte Fennema 0103fed310 Make building safestringlib on some distros easier (#3616)
On some distros (e.g. Redhat 7) there is cmake version 2 and cmake version 3,
safestringlib requires cmake version 3. On those distros the binary is called
cmake3, so try to use that one before falling back to regular cmake binary.

(cherry picked from commit 99c5b0add7)
2020-03-25 09:22:26 +01:00
Jelte Fennema 9e5c84514a Semmle: Protect against theoretical race in recursive directory… (#3559)
In between stat at the start of the loop and unlink/rmdir at the end the
item that the filename references might have changed. In some cases this
can be a security bug, but since we only delete the file/directory it
should not be for us as far as I can tell. It could in theory still
cause errors though if the a file is changed into a directory by some
other process. This commit makes the code robust against that, by not
using stat and only rely on error codes and retries.

(cherry picked from commit ca8f7119fe)
2020-03-25 09:22:07 +01:00
Jelte Fennema 2eea8cb741 Fix some bugs in string to int functions (#3602)
This fixes 3 bugs:
1. `strtoul` never underflows, so that branch was useless
2. `strtoul` has ULONG_MAX instead of LONG_MAX when it overflows
3. `long` and `unsigned long` are not necessarily 64bit, they can be
    either more or less. So now `strtoll` and `strtoull` are used 
    and 64 bit bounds are checked.

(cherry picked from commit c7aa6eddf3)
2020-03-25 09:20:34 +01:00
Philip Dubé c45589bbcd Add runtime type checking to AGGREGATE_CUSTOM_COMBINE helper functions
(cherry picked from commit 11b968bc30)
2020-03-25 09:20:29 +01:00
Jelte Fennema bab0f268d3 Semmle: Ensure stack memory is not leaked through uninitialized… (#3561)
New stack memory can contain anything including passwords/private keys.
In these functions we return structs that can have their padding
bytes uninitialized. By first zeroing out the struct fully, we try to
ensure that any data that is in these padding bytes is at least
overwritten once. It might not be zero anymore after setting the fields,
but at least it shouldn't be private data anymore.

(cherry picked from commit c4cc26ed37)
2020-03-25 09:20:22 +01:00
Jelte Fennema 20782c5ff5 Semmle: Actively check one possible NULL deref case (#3560)
Calling ErrorIfUnsupportedConstraint was still giving errors on Semmle. This
makes sure that we check for NULL at runtime. This way we can safely ignore all
errors created by this function.

(cherry picked from commit e0bbe1ca38)
2020-03-25 09:20:15 +01:00
Jelte Fennema e4e0c65203 Semmle: Check for NULL in some places where it might occur (#3509)
Semmle reported quite some places where we use a value that could be NULL. Most of these are not actually a real issue, but better to be on the safe side with these things and make the static analysis happy.

(cherry picked from commit 685b54b3de)
2020-03-25 09:19:15 +01:00
Jelte Fennema 0a1845a05c Add new vendor README update instructions
(cherry picked from commit 0cad263c82)
2020-03-25 09:17:27 +01:00
Jelte Fennema 5dd61c8319 Fix Makefile so that it builds safestringlib correctly on OSX
(cherry picked from commit eb8e099f09)
2020-03-25 09:17:22 +01:00
Jelte Fennema 2ad9ca6726 Add clean-full to also clean full builds of vendored libraries
(cherry picked from commit 8e7eaaf949)
2020-03-25 09:17:16 +01:00
Jelte Fennema 7969849598 Fix safestringlib build on OSX
(cherry picked from commit 92d7a40d1d)
2020-03-25 09:17:10 +01:00
Jelte Fennema 1d0c3f36fc Make SafeSnprintf work on PG11
(cherry picked from commit 62bf571ced)
2020-03-25 09:16:51 +01:00
Jelte Fennema d0e4bc5d22 Add pg11 snprintf file to repo for use in pg11 when it's not compiled
(cherry picked from commit 7d24cebc80)
2020-03-25 09:16:43 +01:00
Jelte Fennema 2f063d0316 Convert unsafe APIs to safe ones
(cherry picked from commit 8de8b62669)
2020-03-25 09:16:31 +01:00