Commit Graph

2490 Commits (ad93d6feea1a4d9c992d1fc4d6b65b5e590f503c)

Author SHA1 Message Date
Onder Kalaci ad93d6feea Change the order of placement access added to the list
This is to make sure that the error messages related to foreign keys
to reference tables shows the exact placement access name instead of
SELECT.
2019-06-23 11:32:58 +02:00
Nils Dijk eb98f2d13a
Fix null pointer caused by partial initialization of ConnParamsHashEntry (#2789)
It has been reported a null pointer dereference could be triggered in FreeConnParamsHashEntryFields. Likely cause is an error in GetConnParams which will leave the cached ConnParamsHashEntry in a state that would cause the null pointer dereference in a subsequent connection establishment to the same server. This has been simulated by inserting ereport(ERROR, ...) at certain places in the code.

Not only would ConnParamsHashEntry be in a state that would cause a crash, it was also leaking memory in the ConnectionContext due to the loss of pointers as they are only stored on the ConnParamsHashEntry at the end of the function.

This patch rewrites both the GetConnParams to store pointers 'durably' at every point in the code so that an error would not lose the pointer as well as FreeConnParamsHashEntryFields in a way that it can clear half initialised ConnParamsHashEntry's in a safer manner.
2019-06-21 18:16:43 +02:00
Hanefi Onaldi 7a6eb2aba0
Fix one regression test that fails on enterprise (#2786)
GRANT queries are propagated on Enterprise. If a user attempts to
create a user and run a GRANT query before creating it on workers, we
fail. This issue does not happen in community as the user needs to run
the GRANTs on the workers manually.
2019-06-21 15:46:28 +03:00
Nils Dijk 5df1b49bed
Feature: optionally force master_update_node during failover (#2773)
When `master_update_node` is called to update a node's location it waits for appropriate locks to become available. This is useful during normal operation as new operations will be blocked till after the metadata update while running operations have time to finish.

When `master_update_node` is called after a node failure it is less useful to wait for running operations to finish as they can't. The lock being held indicates an operation that once attempted to commit will fail as the machine already failed. Now the downside is the failover is postponed till the termination point of the operation. This has been observed by users to take a significant amount of time causing the rest of the system to be observed unavailable.

With this patch it is possible in such situations to invoke `master_update_node` with 2 optional arguments:
 - `force` (bool defaults to `false`): When called with true the update of the metadata will be forced to proceed by terminating conflicting backends. A cancel is not enough as the backend might be in idle time (eg. an interactive session, or going back and forth between an appliaction), therefore a more intrusive solution of termination is used here.
 - `lock_cooldown` (int defaults to `10000`): This is the time in milliseconds before conflicting backends are terminated. This is to allow the backends to finish cleanly before terminating them. This allows the user to set an upperbound to the expected time to complete the metadata update, eg. performing the failover.

The functionality is implemented by spawning a background worker that has the task of helping a certain backend in acquiring its locks. The backend is either terminated on successful execution of the metadata update, or once the memory context of the expression gets reset, eg. on a cancel of the statement.
2019-06-21 12:03:15 +02:00
Jason Petersen 70055098af
Merge pull request #2689 from citusdata/prop_set_local
Add logic to propagate SET LOCAL at xact start

cr: @marcocitus
2019-06-20 16:28:35 -07:00
Jason Petersen d4e1172247 Implement propagation of SET LOCAL commands
Adds support for propagation of SET LOCAL commands to all workers
involved in a query. For now, SET SESSION (i.e. plain SET) is not
supported whatsoever, though this code is intended as somewhat of a
base for implementing such support in the future.

As SET LOCAL modifications are scoped to the body of a BEGIN/END xact
block, queries wishing to use SET LOCAL propagation must be within such
a block. In addition, subsequent modifications after e.g. any SAVEPOINT
or ROLLBACK statements will correspondingly push or pop variable mod-
ifications onto an internal stack such that the behavior of changed
values across the cluster will be identical to such behavior on e.g.
single-node PostgreSQL (or equivalently, what values are visible to
the end user by running SHOW on such variables on the coordinator).

If nodes enter the set of participants at some point after SET LOCAL
modifications (or SAVEPOINT, ROLLBACK, etc.) have occurred, the SET
variable state is eagerly propagated to them upon their entrance (this
is identical to, and indeed just augments, the existing logic for the
propagation of the SAVEPOINT "stack").

A new GUC (citus.propagate_set_commands) has been added to control this
behavior. Though the code suggests the valid settings are 'none', 'local',
'session', and 'all', only 'none' (the default) and 'local' are presently
implemented: attempting to use other values will result in an error.
2019-06-20 16:15:43 -07:00
Jason Petersen 1dec6c5163 Change BeginCoordinatedTransaction to internal linkage
It's only ever called from a single file, so having it be extern didn't
make a whole lot of sense.
2019-06-20 13:44:06 -07:00
Jason Petersen 2349e8e75c Remove extraneous comments around PG header change 2019-06-20 13:37:53 -07:00
Hadi Moshayedi 602f3cd551
Merge pull request #2780 from citusdata/master_super_copy
Make COPY adapt to connection use behaviour of previous commands in transaction
2019-06-20 20:00:30 +02:00
Hadi Moshayedi 4bbae02778 Make COPY compatible with unified executor. 2019-06-20 19:53:40 +02:00
Hadi Moshayedi 17d4d3e5ea
Merge pull request #2781 from citusdata/refactor_ExecuteModifyTasksSequentially
Refactor ExecuteModifyTasksSequentially.
2019-06-20 18:45:33 +02:00
Hadi Moshayedi 2e6d04df7b Refactor ExecuteModifyTasksSequentially. 2019-06-20 18:38:57 +02:00
Hadi Moshayedi 6741ffd716 Merge pull request #2775 from citusdata/remove_unneeded_expected_file
Use normalization for multi_subtransaction output
2019-06-19 18:00:24 +02:00
Hadi Moshayedi d4f3e2809d Use normalization for multi_subtransaction output 2019-06-19 17:54:33 +02:00
Hadi Moshayedi adb6afe8b9
Merge pull request #2774 from citusdata/fix_subxact_release
Fix subxact release crash.
2019-06-19 17:51:21 +02:00
Hadi Moshayedi 83f6c7dab4 Fix subxact release crash 2019-06-19 17:43:10 +02:00
Önder Kalacı dabe1e0add
Merge pull request #2769 from citusdata/refactor_create_dist_table
Refactor shard creation logic
2019-06-19 16:07:38 +02:00
Onder Kalaci 2b0c4accda Apply feedback 2019-06-19 10:03:58 +02:00
Onder Kalaci 3a04374a9e Refactor relation shard list creation during placement creation
This change is to make further refactoring even simpler such as
using the executor for shard creation.
2019-06-19 10:03:58 +02:00
Onder Kalaci 4fd1fcbbef Refactor shard creation logic
This is a preperation for the new executor, where creating shards
would go through the executor. So, explicitly generate the commands
for further processing.
2019-06-19 10:03:58 +02:00
Jason Petersen 96d9847aa4
Merge pull request #2757 from citusdata/werror
Enable Werror for all warnings

cr: @jasonmp85
2019-06-18 14:51:56 -07:00
Jason Petersen cdaca7297c Switch to werror-enabled CircleCI image 2019-06-18 14:43:54 -07:00
Philip Dubé 4bfcf5b665 Enable Werror for all warnings
Changes to ruleutils match changes made upstream to silence gcc fallthrough warnings
2019-06-18 14:43:54 -07:00
Hadi Moshayedi 04abc1137f
Merge pull request #2772 from citusdata/cancel
Use SendCancelationRequest() in ShutdownConnection()
2019-06-18 12:16:40 +02:00
Hadi Moshayedi b240854b8c Use SendCancelationRequest() in ShutdownConnection() 2019-06-18 12:10:05 +02:00
Hadi Moshayedi ee37e3da89
Merge pull request #2765 from citusdata/fix_diff
Fix test name detection in bin/diff
2019-06-17 12:39:34 +02:00
Hadi Moshayedi c42b22f8fd Fix test name detection in bin/diff 2019-06-17 11:31:42 +02:00
Philip Dubé ab15a214e0
Merge pull request #2733 from citusdata/fix_2642_joinalias
Fix join alias resolution
2019-06-12 17:34:39 -07:00
Philip Dubé 342d423725 Fix join alias resolution
FROM (query) alias ignored renaming
In nested subqueries the select list would rename, while the join alias would not respect that
2019-06-12 17:25:07 -07:00
Hanefi Onaldi b613403d87
update changelog for v8.2.2 2019-06-11 15:27:14 +03:00
Marco Slot c045c9c8eb
Merge pull request #2750 from citusdata/stats_collection_off
enable_statistics_collection defaults to off (opt-in)
2019-06-06 12:12:52 +02:00
Marco Slot c1ac794b77 enable_statistics_collection defaults to off 2019-06-05 18:43:26 +02:00
Hadi Moshayedi 674b7ce29a
Merge pull request #2748 from citusdata/ScanStateGetTupleDescriptor
Refactor some scan state info into their own functions.
2019-06-05 09:22:00 -07:00
Hadi Moshayedi 85325e0098 Refactor ScanStateGetExecutorState into its own function. 2019-06-05 09:16:43 -07:00
Hadi Moshayedi 0b01c59fa6 Refactor ScanStateGetTupleDescriptor() into a function. 2019-06-04 15:19:49 -07:00
Hadi Moshayedi 7abd28d3e8
Merge pull request #2654 from citusdata/fix_lateral_joins
Search all outer node levels for lateral join params.
2019-06-04 10:18:18 -07:00
Hadi Moshayedi 8e2d328530 Search all outer node levels for lateral join params. 2019-06-04 10:14:05 -07:00
Demur Rumed 5cc8049caa
Merge pull request #2742 from citusdata/fix_2739_outer_join_subquery_error
Also check rewrittenQuery jointree for outer join
2019-06-04 07:52:59 -07:00
Philip Dubé b5ced403d8 Also check rewrittenQuery jointree for outer join 2019-06-04 07:47:35 -07:00
Önder Kalacı b7f5819281
Merge pull request #2745 from citusdata/refactor_copy
Refactor ShardIdForTuple() to a separate function.
2019-06-03 10:24:17 +02:00
Hadi Moshayedi dee5bc31b4 Refactor ShardIdForTuple() to a separate function. 2019-06-02 09:48:15 -07:00
Önder Kalacı 27b0f0023c
Merge pull request #2716 from citusdata/max_cached_connections
Replace session lifespan flag with a configurable number of connections
2019-05-29 15:05:09 +02:00
Marco Slot c1566d464b Fix failure and isolation tests
On top of citus.max_cached_conns_per_worker GUC, with this commit
we're updating the regression tests to comply with the new behaviour.
2019-05-29 14:42:31 +02:00
Marco Slot bb3a96eacb Cache a configurable number of connections at xact end 2019-05-29 13:24:31 +02:00
Önder Kalacı caa8fffbd0
Merge pull request #2736 from citusdata/order_by_fix_9
Make sure that the regression tests are resistant to execution order changes
2019-05-28 12:27:45 +02:00
Onder Kalaci d46b92d79a Add order by to multi_mx_schema_support 2019-05-28 12:23:28 +02:00
Onder Kalaci fa2a6e4d8f Add order by to multi_mx_router_planner 2019-05-28 12:23:28 +02:00
Onder Kalaci 0a7a173eee Add order by to multi_mx_reference_table 2019-05-28 12:23:28 +02:00
Onder Kalaci 1553e12ee4 Add order by to multi_subquery_complex_reference_clause 2019-05-28 12:06:57 +02:00
Hadi Moshayedi d4dbe8f008
Merge pull request #2732 from citusdata/fix_a_typo
Fix a typo: WITH CARDINALITY -> WITH ORDINALITY
2019-05-24 15:58:31 -07:00