Commit Graph

3576 Commits (2e927bd6b77b0c9a107a0ade719785f354b6738f)

Author SHA1 Message Date
Onur Tirtir 2e927bd6b7
Bump Citus to 9.4devel (#3788) 2020-04-22 12:50:00 +03:00
Hanefi Onaldi 2e0cb6160c
Merge pull request #3786 from citusdata/coord-skip-dep-setup
Skip dependency setup on coordinator node
2020-04-21 15:29:26 +03:00
Hanefi Önaldı e85b835065
Skip dependency setup on coordinator node 2020-04-21 12:06:31 +03:00
Philip Dubé 2e5b1bfa41
Merge pull request #3756 from citusdata/fix-maintenanced-error-restart
maintenanced: use before_shmem_exit to clear workerPid
2020-04-20 14:57:30 +00:00
Philip Dubé 9093d51a22 maintenanced: handle before_shmem_exit, assert workerPid == 0 on start 2020-04-20 14:41:40 +00:00
Jelte Fennema 1423433531
Fix running check-isolation-base (#3782) 2020-04-20 15:36:09 +02:00
Önder Kalacı 793c65b539
Merge pull request #3606 from citusdata/improve_error_messages
Improve connection error message from the worker nodes
2020-04-20 13:47:43 +02:00
Onder Kalaci e182215d96 Improve connection error message from the worker nodes
We currently put the actual error message to the detail part. However,
many drivers don't show detail part.

As connection errors are somehow common, and hard to trace back, can't
we added the detail to the message itself.

In addition to that, we changed "connection error" message, as it
was confusing to the users who think that the error was happening
while connecting to the coordinator. In fact, this error is showing
up when the coordinator fails to connect remote nodes.
2020-04-20 13:32:55 +02:00
Hadi Moshayedi 797180e0e3
Merge pull request #3778 from citusdata/more_replicate
Replicate reference tables before master_create_empty_shard
2020-04-17 16:54:59 -07:00
Hadi Moshayedi 1250d691d3 Replicate reference tables before master_create_empty_shard 2020-04-17 16:47:03 -07:00
Philip Dubé c03d3714b3
Merge pull request #3779 from citusdata/insert-select-copy-cache-entry
Try copying shard intervals out of cache for long lived borrow
2020-04-17 22:49:58 +00:00
Philip Dubé 8e79672839 Try copying shard intervals out of cache for long lived borrow 2020-04-17 22:00:41 +00:00
Philip Dubé a461ef20d9
Merge pull request #3769 from citusdata/avoid-invalidating-live-cache-entries
Avoid invalidating live cache entries
2020-04-17 15:22:10 +00:00
Philip Dubé c00d57a955 CreateDistributedInsertSelectPlan: avoid calling GetCitusTableCacheEntry in a way that would invalidate live ShardInterval pointers 2020-04-17 14:44:23 +00:00
SaitTalhaNisanci 1d0f4bdcd2
invalidate plan cache in master_update_node (#3758)
* invalidate plan cache in master_update_node

If a plan is cached by postgres but a user uses master_update_node, then
when the plan cache is used for the updated node, they will get the old
nodename/nodepost in the plan. This is because the plan cache doesn't
know about the master_update_node. This could be a problem in prepared
statements or anything that goes into plancache. As a solution the plan
cache is invalidated inside master_update_node.

* add invalidate_inactive_shared_connections test function

We introduce invalidate_inactive_shared_connections udf to be used in
testing. It is possible that a connection count for an inactive node
will be greater than 0 and in that case it will not be removed at the
time of invalidation. However, later we don't have a mechanism to remove
it, which means that it will stay in the hash. For this not to cause a
problem, we use this udf in testing.

* move invalidate_inactive_shared_connections to udfs from test as it will be used in mx

* remove the test udf

* remove the IsInactive check
2020-04-17 17:43:48 +03:00
Philip Dubé ae391c4f4b
Merge pull request #3768 from citusdata/avoid-long-lived-metadata
Copy data from CitusTableCacheEntry more often
2020-04-17 14:25:51 +00:00
Philip Dubé c0a95a3adb Copy data from CitusTableCacheEntry more often
This copies over fixes from reference counting branch,
all CitusTableCacheEntry data may be freed when a GetCitusTableCacheEntry call occurs for its relationId

This fix is not complete, but reference counting is being deferred until 9.4

CopyShardInterval: remove dest parameter, always return newly allocated object
2020-04-17 14:17:18 +00:00
Önder Kalacı a919f09c96
Remove the entries from the shared connection counter hash when no connections remain (#3775)
We initially considered removing entries just before any change to
pg_dist_node. However, that ended-up being very complex and making
MX even more complex.

Instead, we're switching to a simpler solution, where we remove entries
when the counter gets to 0.

With certain workloads, this may have some performance penalty. But, two
notes on that:
 - When counter == 0, it implies that the cluster is not busy
 - With cached connections, that's not possible
2020-04-17 17:14:58 +03:00
Philip Dubé 79f6f3c02c
Merge pull request #3757 from citusdata/fix-window-function-assertion-failure
Avoid setting hasWindowFuncs true after window functions have been optimized out of query
2020-04-17 12:39:32 +00:00
Philip Dubé e4a4707f4a Avoid setting hasWindowFuncs true after window functions have been optimized out of query 2020-04-17 12:22:48 +00:00
SaitTalhaNisanci a9a3be15cc
introduce TASK_QUERY_NULL task type (#3774)
When we call SetTaskQueryString we would set the task type to
TASK_QUERY_TEXT, and some parts of the codebase rely on the fact that if
TASK_QUERY_TEXT is set, the data can be read safely. However if
SetTaskQueryString is called with a NULL taskQueryString this can cause
crashes. In that case taskQueryType will simply be set to
TASK_QUERY_NULL.
2020-04-17 14:59:22 +03:00
Hanefi Onaldi 2d50f63841
Merge pull request #3752 from citusdata/local-truncate
UDF to truncate local data after distributing table
2020-04-17 13:50:58 +03:00
Hanefi Önaldı 0c5d0cfee9
Notice message to help truncate local data after distribution 2020-04-17 13:21:34 +03:00
Hanefi Önaldı d535121f8d
Introduce truncate_local_data_after_distributing_table() 2020-04-17 13:21:34 +03:00
Marco Slot c3324f8962
Merge pull request #3772 from citusdata/fixes_from_enterprise
Use block_writes for replicate_reference_tables
2020-04-17 12:07:57 +02:00
Hadi Moshayedi 61198251fd Use block_writes for replicate_reference_tables 2020-04-16 19:25:41 -07:00
Nils Dijk 1d6ba1d09e
Refactor alter role to work on distributed roles (#3739)
DESCRIPTION: Alter role only works for citus managed roles

Alter role was implemented before we implemented good role management that hooks into the object propagation framework. This is a refactor of all alter role commands that have been implemented to
 - be on by default
 - only work for supported roles
 - make the citus extension owner a supported role

Instead of distributing the alter role commands for roles at the beginning of the node activation role it now _only_ executes the alter role commands for all users in all databases and in the current database.

In preparation of full role support small refactors have been done in the deparser.

Earlier tests targeting other roles than the citus extension owner have been either slightly changed or removed to be put back where we have full role support.

Fixes #2549
2020-04-16 12:23:27 +02:00
Hadi Moshayedi e0eba87b6c
Merge pull request #3764 from citusdata/fix_stuck
Detect deadlocks in replicate_reference_tables()
2020-04-15 13:18:38 -07:00
Hadi Moshayedi 59b9a4e5a1 Detect deadlocks in replicate_reference_tables() 2020-04-15 11:06:18 -07:00
SaitTalhaNisanci df9048ebaa
update outdated comments related to local_execution (#3759) 2020-04-15 16:15:43 +03:00
Marco Slot 5bd4970fac
Merge pull request #3017 from citusdata/fix/notices
Propagate notices from queries as notices
2020-04-15 11:50:56 +02:00
Marco Slot 8b83306a27 Issue worker messages with the same log level 2020-04-14 21:08:25 +02:00
SaitTalhaNisanci 132efdbc56
add execution params struct (#3747)
We had 9+ parameters in some of the functions related to execution.
Execution params is created to simplify this a bit so that we can set
only the fields that we are interested in and it is easier to read.
2020-04-14 14:32:40 +03:00
SaitTalhaNisanci d58b5e67c1
not run multi_router_planner_fast_path in parallel (#3744) 2020-04-14 13:14:23 +03:00
Önder Kalacı 9229db2081
Merge pull request #3692 from citusdata/shared_connection_counter
Throttle connections to the worker  nodes
2020-04-14 10:37:57 +02:00
Onder Kalaci aa6b641828 Throttle connections to the worker nodes
With this commit, we're introducing a new infrastructure to throttle
connections to the worker nodes. This infrastructure is useful for
multi-shard queries, router queries are have not been affected by this.

The goal is to prevent establishing more than citus.max_shared_pool_size
number of connections per worker node in total, across sessions.

To do that, we've introduced a new connection flag OPTIONAL_CONNECTION.
The idea is that some connections are optional such as the second
(and further connections) for the adaptive executor. A single connection
is enough to finish the distributed execution, the others are useful to
execute the query faster. Thus, they can be consider as optional connections.
When an optional connection is not allowed to the adaptive executor, it
simply skips it and continues the execution with the already established
connections. However, it'll keep retrying to establish optional
connections, in case some slots are open again.
2020-04-14 10:27:48 +02:00
Onder Kalaci 38b8a9ad62 Add citus_remote_connection_stats() function
This function is intended to be used for monitoring
the remote connections.
2020-04-14 10:03:27 +02:00
Onder Kalaci 0dbfbe0c37 Add the necessary shared memory infrastructure
- The hashmap in the shared memory
- The lock to access the hashmap
- The GUC to control the size
2020-04-14 10:03:26 +02:00
Hadi Moshayedi 4e3d402473
Merge pull request #3742 from citusdata/fix_sync
Ensure metadata is synced on master_copy_shard_placement(..., do_repair := false)
2020-04-13 12:57:11 -07:00
Hadi Moshayedi 2639a9a19d Test master_copy_shard_placement errors on foreign constraints 2020-04-13 12:45:27 -07:00
Hadi Moshayedi f9de734329 Ensure metadata is synced on ReplicateColocatedShardPlacement 2020-04-13 11:45:21 -07:00
Hadi Moshayedi 2218b7e38d Refactor ReplicateColocatedShardPlacement 2020-04-13 11:07:26 -07:00
SaitTalhaNisanci 2b2a146af4
update gitignores with new files in test folder (#3749) 2020-04-13 17:09:18 +03:00
SaitTalhaNisanci 2438e80a58
use CURSOR_OPT_PARALLEL_OK flag in local execution (#3745)
We currently don't use any cursor flags in local execution, but we can
use CURSOR_OPT_PARALLEL_OK flag to potentially benefit from parallelism
when possible.
2020-04-12 19:49:22 +03:00
Philip Dubé c8d0e45dd4
Merge pull request #3489 from citusdata/fix-having-some-not-recursively-planned
Fix subquery arguments in aggregates
2020-04-10 13:37:53 +00:00
Philip Dubé 30f10984e1 Defer get_agg_clause_costs, it happens later & avoids errors 2020-04-10 13:26:05 +00:00
Philip Dubé b054911466
Merge pull request #3740 from citusdata/avoid-freeconn-segfault
GetConnParams: Set runtimeParamStart before setting keywords/values to avoid out of bounds access
2020-04-10 13:25:32 +00:00
Philip Dubé ab0b59ad3b GetConnParams: Set runtimeParamStart before setting keywords/values to avoid out of bounds access 2020-04-10 13:14:06 +00:00
Halil Ozan Akgül 475c98a62a
Merge pull request #3546 from citusdata/connection-string-tests-9.2
Regression Tests on an Existing Cluster
2020-04-10 16:12:14 +03:00
Halil Ozan Akgul 34c2b7e056 Fixes the psql connection bug 2020-04-10 15:54:47 +03:00