Commit Graph

3795 Commits (9747961c04d99823896fdcf67ba1ea985da5b98e)

Author SHA1 Message Date
Marco Slot 9747961c04 Small fix to PG12 compatibility 2021-09-10 14:20:43 +02:00
Marco Slot 0da06876a3 Avoid switch to superuser in worker_merge_files_into_table 2021-09-10 13:46:24 +02:00
Marco Slot 7915f15637 Add worker_append_table_to_shard permissions tests 2021-09-10 13:46:24 +02:00
Marco Slot 13f78d0a2b Perform copy command as regular user in worker_append_table_to_shard 2021-09-10 13:46:24 +02:00
Hanefi Onaldi a9c5925d2e
Bump Citus version to 9.4.6 2021-08-11 11:03:35 +03:00
Hanefi Onaldi 800bb6289d
Add changelog entries for 9.4.6
(cherry picked from commit c6e428896a)
2021-08-11 11:01:19 +03:00
Onder Kalaci 1f1fd4434d Guard against hard WaitEvenSet errors
In short, add wrappers around Postgres' AddWaitEventToSet() and
ModifyWaitEvent().

AddWaitEventToSet()/ModifyWaitEvent*() may throw hard errors. For
example, when the underlying socket for a connection is closed by
the remote server and already reflected by the OS, however
Citus hasn't had a chance to get this information. In that case,
if replication factor is >1, Citus can failover to other nodes
for executing the query. Even if replication factor = 1, Citus
can give much nicer errors.

So CitusAddWaitEventSetToSet()/CitusModifyWaitEvent() simply puts
AddWaitEventToSet()/ModifyWaitEvent() into a PG_TRY/PG_CATCH block
in order to catch any hard errors, and returns this information to
the caller.
2021-08-10 09:48:59 +02:00
naisila c272bfcd63 Bump use of new sql function 2021-08-03 16:44:12 +03:00
naisila c2c71eec9e Fix master_update_table_statistics scripts for 9.4 2021-08-03 16:44:12 +03:00
naisila 81bed61b4e Reimplement master_update_table_statistics to detect dist. deadlocks
(ALL CODE BORROWED from commit 2f30614fe3)
2021-08-03 16:44:12 +03:00
Onur Tirtir acdecc8fe5 Remove fkey graph visited flags & rework GetConnectedListHelper (#4446)
With this commit, we remove visited flags from ForeignConstraintRelationshipNode
struct since keeping local state in global object is both dangerous and
meaningless.

Also to improve readability, this commit also converts needless recursion to
iterative DFS to avoid passing local hash-map as another parameter to
GetConnectedListHelper function.
(cherry picked from commit 0db21bbe14)
2021-08-03 16:44:12 +03:00
Onur Tirtir 6b1a146df1 Refactor foreign_key_relationship.c (#4438)
(cherry picked from commit 3f60b08b11)
2021-08-03 16:44:12 +03:00
naisila dd619e3f72 Add OpenConnectionToNodes and functions that generate shard queries
(ALL CODE BORROWED from commit 724d56f949)
2021-08-03 16:44:12 +03:00
Hanefi Onaldi 2a17fdbb88
Bump Citus version to 9.4.5 2021-07-08 09:51:28 +03:00
Hanefi Onaldi cdf8a123c6
Add changelog entry for 9.4.5
(cherry picked from commit 80a5539671)
2021-07-08 09:51:12 +03:00
Nils Dijk 46bc57a99a Bump use of new sql function 2021-07-05 16:15:51 +02:00
Marco Slot 1a21c524b7 Fix PG upgrade scripts for 9.4 2021-07-05 16:15:51 +02:00
Onur Tirtir be3da3901e Fix lower boundary calculation when pruning range dist table shards (#5082)
This happens only when we have a "<" or "<=" filter on distribution
column of a range distributed table and that filter falls in between
two shards.

When the filter falls in between two shards:

  If the filter is ">" or ">=", then UpperShardBoundary was
  returning "upperBoundIndex - 1", where upperBoundIndex is
  exclusive shard index used during binary seach.
  This is expected since upperBoundIndex is an exclusive
  index.

  If the filter is "<" or "<=", then LowerShardBoundary was
  returning "lowerBoundIndex + 1", where lowerBoundIndex is
  inclusive shard index used during binary seach.
  On the other hand, since lowerBoundIndex is an inclusive
  index, we should just return lowerBoundIndex instead of
  doing "+ 1". Before this commit, we were missing leftmost
  shard in such queries.

* Remove useless conditional branches

The branch that we delete from UpperShardBoundary was obviously useless.

The other one in LowerShardBoundary became useless after we remove "+ 1"
from there.

This indeed is another proof of what & how we are fixing with this pr.

* Improve comments and add more

* Add some tests for upper bound calculation too

(cherry picked from commit b118d4188e)

* Also fix a debug message diff for 9.4
2021-07-02 14:59:36 +03:00
Hanefi Onaldi 6348efca64 Do not use security flags by default (#4770)
(cherry picked from commit 697bbbd3c6)
2021-03-04 01:08:48 +03:00
Hanefi Onaldi 0e147f9c8c Add security flags in configure scripts (#4760)
(cherry picked from commit f87107eb6b)
2021-03-04 01:07:26 +03:00
Onder Kalaci 281460fbaa Do not connection re-use for intermediate results
/*
 * Colocated intermediate results are just files and not required to use
 * the same connections with their co-located shards. So, we are free to
 * use any connection we can get.
 *
 * Also, the current connection re-use logic does not know how to handle
 * intermediate results as the intermediate results always truncates the
 * existing files. That's why, we use one connection per intermediate
 * result.
 */

(cherry picked from commit 5d5a357487)
2021-02-11 17:13:55 +01:00
Onder Kalaci 3065966d13 When reaches to executor pool size, COPY sets the placement access
It looks like we forgot to set the placement accesses, and
this could lead to self-deadlocks on complex transaction blocks.

(cherry picked from commit 36bdeef1bb)
2021-02-02 10:17:28 +01:00
Gürkan İndibay d0000a15bd
Bump version to 9.4.4 (#4468)
Update configuration files version info
2021-01-04 13:56:34 +03:00
gurkanindibay a5adc49077 Add changelog entry for version 9.4.4
Conflicts:
	CHANGELOG.md

 Committing a cherry-pick with sha 19977792d8
2020-12-30 13:12:58 +00:00
Onur Tirtir 7233c27533 Not consider single shard hash dist. tables as replicated (#4413)
(cherry picked from commit 0eb5701658)
2020-12-22 16:59:32 +03:00
Onur Tirtir 51f422f3c6
Add some more tests with views to test recursive planning on views (#4404) 2020-12-18 17:42:35 +03:00
Marco Slot 8fae9aae96
Reliably detect local tables in router queries in 9.4 (#4418)
Co-authored-by: Marco Slot <marco.slot@gmail.com>
2020-12-17 13:38:16 +01:00
Onur Tirtir 59774b1dd4 Handle invalid connection hash entries (#4362)
If MemoryContextAlloc errors out -e.g. during an OOM-, ConnectionHashEntry->connections
stays as NULL.

With this commit, we add isValid flag to ConnectionHashEntry that should be set to true
right after we allocate & initialize ConnectionHashEntry->connections list properly, and we
check it before accesing to ConnectionHashEntry->connections.
(cherry picked from commit 7f3d1182ed)

 Conflicts:
	src/backend/distributed/connection/connection_management.c
2020-12-01 11:09:33 +03:00
Onur Tirtir 221aa1a381 Update CHANGELOG for 9.4.3
(cherry picked from commit 76a429f19b)

 Conflicts:
	CHANGELOG.md
2020-11-24 13:21:08 +03:00
Onur Tirtir 7e99324bd9 Bump version to 9.4.3 2020-11-24 12:19:15 +03:00
Önder Kalacı 447c7ecdd4 Enable parallel query on EXPLAIN ANALYZE (#4325)
It seems that we forgot to pass the revelant
flag to enable Postgres' parallel query
capabilities on the shards when user does
EXPLAIN ANALYZE on a distributed table.

(cherry picked from commit b0ddbbd33a)

 Conflicts:
	src/backend/distributed/planner/multi_explain.c
2020-11-24 12:19:15 +03:00
Onder Kalaci a943696c44 Do not execute subplans multiple times with cursors
Before this commit, we let AdaptiveExecutorPreExecutorRun()
to be effective multiple times on every FETCH on cursors.
That does not affect the correctness of the query results,
but adds significant overhead.

(cherry picked from commit c433c66f2b)
2020-11-23 13:43:24 +03:00
Onur Tirtir ca2bbd89b6 Update CHANGELOG for 9.4.2
(cherry picked from commit c7755103f1)
2020-10-21 15:29:24 +03:00
Onur Tirtir 3d2e1a7464 Bump version to 9.4.2 2020-10-21 15:28:12 +03:00
Marco Slot b7b7b66beb Support reference table view in reference table modification 2020-10-16 13:16:16 +02:00
Marco Slot f6e5006dfd Fix a bug that could lead to multiple maintenance daemons 2020-10-16 13:15:51 +02:00
Marco Slot 03e4bec352 Add maintenance daemon error tests 2020-10-16 13:15:39 +02:00
Onur Tirtir 6aac62e847 Update CHANGELOG for 9.4.1
(cherry picked from commit bc29238546)
2020-09-30 10:53:05 +03:00
Onur Tirtir 72c54b5cdd Bump version to 9.4.1 2020-09-30 10:52:31 +03:00
Marco Slot 637d93e8ff Fix EXPLAIN ANALYZE truncation
(cherry picked from commit c9d46c618b)

Conflicts:
	src/test/regress/expected/multi_explain.out
	src/test/regress/sql/multi_explain.sql
2020-09-28 15:49:58 +03:00
SaitTalhaNisanci 7a00c5b83c Not take ShareUpdateExlusiveLock on pg_dist_transaction (#4184)
* Not take ShareUpdateExlusiveLock on pg_dist_transaction

We were taking ShareUpdateExlusiveLock on pg_dist_transaction during
recovery to prevent multiple recoveries happening concurrenly. VACUUM(
not FULL) also takes ShareUpdateExclusiveLock, and they can conflict. It
seems that VACUUM will skip the table if there is a conflicting lock
already taken unless it is doing the vacuum to prevent id wraparound, in
which case there can be a deadlock. I guess the deadlock happens if:

- VACUUM takes a lock on pg_dist_transaction and is done for id
wraparound problem
- The transaction in the maintenance tries to take a lock but
cannot as that conflicts with the lock acquired by VACUUM
- The transaction in the maintenance daemon has a very old xid hence
VACUUM cannot proceed.

If we take a row exclusive lock in transaction recovery then it wouldn't
conflict with VACUUM hence it could proceed so the deadlock would be
resolved. To prevent concurrent transaction recoveries happening, an
advisory lock is taken with ShareUpdateExlusiveLock as before.

* Use CITUS_OPERATIONS tag

(cherry picked from commit e7cd1ed0ee)

 Conflicts:
	src/backend/distributed/transaction/transaction_recovery.c
2020-09-28 11:38:04 +03:00
Onur Tirtir 51b7b01a09 Update CHANGELOG for 9.4.0
(cherry picked from commit c7f97a9e01)

 Conflicts:
	CHANGELOG.md
2020-07-28 14:58:05 +03:00
Halil Ozan Akgul 993a402c73 Fixes create index concurrently bug
(cherry picked from commit 38b72ddd66)
2020-07-27 10:32:08 +03:00
SaitTalhaNisanci 39e63f5a08 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)
2020-07-27 10:32:08 +03:00
Halil Ozan Akgül 2271e9ded1 Fixes the non existing table bug (#4058)
(cherry picked from commit e9f89ed651)
2020-07-27 10:32:08 +03:00
Sait Talha Nisanci 4c90dbbd88 improve error message in secondaries
(cherry picked from commit 6f4686c741467b5c8bd6ca15c0788d8db856392a)
2020-07-21 13:55:12 +03:00
Sait Talha Nisanci 388893ce5e add multi follower repartition tests
(cherry picked from commit 6e5598fd58a1c0c6a597ca06539ac5e286cb6914)
2020-07-21 13:55:08 +03:00
Sait Talha Nisanci 4b98f6c5c2 address feedback
(cherry picked from commit 24043a3602abc7b525f2724a35168e4c45442165)
2020-07-21 13:55:04 +03:00
Sait Talha Nisanci 97dda868a0 use ActiveReadableNodeList in JobExecutorType and task tracker
The reason we should use ActiveReadableNodeList instead of ActiveReadableNonCoordinatorNodeList is that if coordinator is added to cluster as a worker, it should be counted as well. Otherwise if there is only coordinator in the cluster, the count will be 0, hence we get a warning.

In MultiTaskTrackerExecute, we should connect to coordinator if it is
added to the cluster because it will also be assigned tasks.

(cherry picked from commit ae6180ace2931223c58b87444a9e812f5e9f06e8)
2020-07-21 13:55:00 +03:00
Sait Talha Nisanci 27ef768f36 use ActivePrimaryNodeList to include coordinator
ActiveReadableWorkerNodeList doesn't include coordinator, however if
coordinator is added as a worker, we should also include that while
planning. The current methods are very easily misusable and this
requires a refactoring to make the distinction between methods that
include coordinator and that don't very explicit as they can introduce
subtle/major bugs pretty easily.

(cherry picked from commit 86b974e4ceddaf5e2c44799148a8cf485c7d90bf)
2020-07-21 13:54:56 +03:00