Commit Graph

3058 Commits (38ac28b4b861b79eea93479948bc36610f6547cc)

Author SHA1 Message Date
Önder Kalacı 2d57899130
Merge pull request #2806 from citusdata/isolation_consistent_finish_step
Isolation tests: consistently name COMMIT '-commit'
2019-06-27 11:57:23 +02:00
Philip Dubé 4e54c1525d Isolation tests: consistently name COMMIT '-commit' 2019-06-27 07:32:39 +02:00
Önder Kalacı 66b4225d0a
Merge pull request #2777 from citusdata/create-all-schemas-as-superuser
Create all distributed schemas as superuser on a separate connection
2019-06-26 17:19:02 +02:00
Hanefi Onaldi 4e08477fed Add test case for issue 2575 2019-06-26 17:12:28 +02:00
Hanefi Onaldi 7e8fd49b94 Create Schemas as superuser on all shard/table creation UDFs
- All the schema creations on the workers will now be  via superuser connections
- If a shard is being repaired or a shard is replicated, we will create the
  schema only in the relevant worker; and in all the other cases where a schema
  creation is needed, we will block operations until we ensure the schema exists
  in all the workers
2019-06-26 17:12:28 +02:00
Philip Dubé 6ae9158216
Merge pull request #2778 from citusdata/2400_modifying_ctes
Support CTEs in router planner for modification queries
2019-06-26 16:47:00 +02:00
Philip Dubé aa0c47848e subquery_and_cte: test rejecting volatile ctes
Also update isolation_citus_dist_activity from after merge
2019-06-26 16:27:07 +02:00
Philip Dubé db7fdb1854 Router planner: bail on volatile functions in CTEs 2019-06-26 10:32:01 +02:00
Philip Dubé 5c62f9935a Router planner: reject SELECT FOR UPDATE ctes 2019-06-26 10:32:01 +02:00
Philip Dubé 18575ccfd3 Add tests to subquery_and_cte, update check-multi-mx expected results 2019-06-26 10:32:01 +02:00
Philip Dubé 77efec04a0 Router Planner: accept SELECT_CMD ctes in modification queries 2019-06-26 10:32:01 +02:00
Philip Dubé 84fe626378 multi_router_planner: refactor error propagation 2019-06-26 10:32:01 +02:00
Philip Dubé 9ed6dd5570 Ignore compile_commands.json, fix typo 2019-06-26 10:32:01 +02:00
Önder Kalacı c37198f0fa
Merge pull request #2797 from citusdata/normalize_name_lengths
Normalize multi_name_lengths.
2019-06-25 16:13:30 +02:00
Hadi Moshayedi 25a984bab4 Normalize multi_name_lengths. 2019-06-25 14:18:33 +02:00
Hadi Moshayedi c7745486b9
Merge pull request #2793 from citusdata/coordinator_plan
Show just coordinator plan in some test outputs.
2019-06-24 14:11:49 +02:00
Hadi Moshayedi 3d0a521295 Show just coordinator plan in some test outputs. 2019-06-24 12:24:30 +02:00
Önder Kalacı 9a137e9486
Merge pull request #2790 from citusdata/fix_fkey_error
Change the order of placement access added to the placement access list
2019-06-24 09:49:58 +02:00
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