Commit Graph

821 Commits (364e8535dad3b2477eca0b1dc431db462008222d)

Author SHA1 Message Date
Jason Petersen 364e8535da Merge pull request #1182 from citusdata/fix_random_travis_failure
Fix Random Fails on Travis

cr: @jasonmp85
2017-01-31 16:42:19 -07:00
Eren Basak 8efb00768e Fix Random Fails on Travis
This change fixes the random failures on Travis, which is a bug introduced
with citus/#1124. Before this fix, travis was failing randomly on `check_multi_mx`
test schedule, specifically in the parallel group of `multi_mx_metadata`,
'multi_mx_modifications` and `multi_mx_modifying_xacts` tests. This change fixes this
by serializing these three test cases.
2017-01-31 15:23:06 -08:00
Eren Başak 1df8d27bce Merge pull request #1183 from citusdata/allow_drop_sequence_on_worker
Allow dropping sequences on mx workers
2017-01-31 14:59:29 -08:00
Eren Basak b458832416 Allow dropping sequences on mx workers
This change allows users to drop sequences on MX workers. Previously, Citus didn't allow dropping
sequences on MX workers because it could cause shards to be dropped if `DROP SEQUENCE ... CASCADE`
is used. We now allow that since allowing sequence creation but not dropping hurts user experience
and also may cause problems with custom Citus solutions.
2017-01-31 14:51:44 -08:00
Samay Sharma eca06f227e Merge pull request #1178 from citusdata/ozgune-patch-1
Update README.md to include use cases
2017-01-30 13:24:52 -08:00
Ozgun Erdogan 2828140d61 Update README.md to include use cases
Updated to the README.md to reflect newer product features.

* Include references to the multi-tenant use case
* Minor update to tutorial link to include 6.0
* Minor update to Contributing guidelines (we haven't used #helpwanted tags over the past year)
* Minor update to remove link to support & training
2017-01-27 16:36:33 -08:00
Brian Cloutier 0e135dfd72 Fix bug where router executor sends query to failed connections 2017-01-27 09:40:30 +02:00
Brian Cloutier 24654ac7e1 Refactor CheckShardPlacements
- Break CheckShardPlacements into multiple functions (The most important
  is MarkFailedShardPlacements), so that we can get rid of the global
  CoordinatedTransactionUses2PC.
- Call MarkFailedShardPlacements in the router executor, so we mark
  shards as invalid and stop using them while inside transaction blocks.
2017-01-26 13:20:45 +02:00
Marco Slot 6d460c4cd2 Merge pull request #1168 from citusdata/copy_inactive
Set placement to inactive on connection failure in COPY
2017-01-26 13:23:13 +04:00
Murat Tuncer 59ca49a826 Add copy failure tests inside transactions 2017-01-26 11:54:40 +03:00
Murat Tuncer 0500c31a30 Fix dependent tests 2017-01-25 19:19:39 +03:00
Murat Tuncer 5a8bc76912 Add failure case for regression tests 2017-01-25 19:19:39 +03:00
Marco Slot e55faf10f0 Mark failed placements as inactive immediately after COPY 2017-01-25 19:19:39 +03:00
Marco Slot b4c5a0781b Don't mark placements inactive in COPY after successful connection 2017-01-25 19:19:38 +03:00
Marco Slot 83cb58bf40 Set placement to inactive on connection failure in COPY 2017-01-25 19:19:38 +03:00
Marco Slot d1acc27b1b Merge pull request #1171 from citusdata/utility_schemanode_fix
Remove call to SchemaNode() in multi_ProcessUtility
2017-01-25 12:23:47 +01:00
Marco Slot 8971b3ed75 Short circuit in multi_ProcessUtility on ABORT/COMMIT 2017-01-25 11:57:00 +01:00
Marco Slot 5f61d8ea5a Always skip foreign key validation when enable_ddl_propagation is off 2017-01-25 11:56:59 +01:00
Marco Slot 2279061a90 Merge pull request #1163 from citusdata/mx_errors
Improve terminology in MX error messages
2017-01-25 11:14:21 +01:00
Marco Slot 8adb9c3ec1 Use coordinator instead of schema node in terminology 2017-01-25 11:07:23 +01:00
Marco Slot 46487dd583 Use bigserial instead of BIGINT in sequence error 2017-01-25 11:07:23 +01:00
Burak Yücesoy 75caddc694 Merge pull request #1172 from citusdata/add_order_by_to_tests
Add ORDER BY to some tests to have consistent output
2017-01-25 11:49:05 +03:00
Burak Yucesoy 240520d063 Add ORDER BY to some tests to have consistent output 2017-01-25 11:43:25 +02:00
Marco Slot 62e747e107 Merge pull request #1165 from citusdata/updating-readme
Updating citus cloud link to point to sign up
2017-01-24 09:52:58 +01:00
Craig Kerstiens 8b42bda105 updating citus cloud link to point to sign up 2017-01-24 09:09:06 +01:00
Eren Başak 2d7c117727 Merge pull request #1124 from citusdata/mx_worker_tests
MX regression tests for queries from workers
2017-01-24 09:53:50 +02:00
Eren Basak 2536c77ef0 Add Regression Tests For Querying MX Tables from Workers 2017-01-24 10:36:59 +03:00
Burak Yücesoy c6875b8d05 Merge pull request #1136 from citusdata/convert_drop_shards_to_use_new_api
Convert drop shards to use new API
2017-01-23 21:16:16 +03:00
Burak Yucesoy 46547e67cc Convert DropShards to use new connection API
With this change DropShards function started to use new connection API. DropShards
function is used by DROP TABLE, master_drop_all_shards and master_apply_delete_command,
therefore all of these functions now support transactional operations. In DropShards
function, if we cannot reach a node, we mark shard state of related placements as
FILE_TO_DELETE and continue to drop remaining shards; however if any error occurs after
establishing the connection, we ROLLBACK whole operation.
2017-01-23 21:08:41 +03:00
Burak Yucesoy 4efeeb50c3 In case of failed transactions update shard state only if it is FILE_FINALIZED
Before this change, when a transaction failed, we update related placements shard states
to FILE_INACTIVE during XACT_EVENT_PRE_COMMIT. However that means if another code block
changed shard state to something else (e.g. FILE_TO_DELETE) before XACT_EVENT_PRE_COMMIT
we overwrite that. To prevent that problem, in case of failure we started to change
shard state, only if its current shard state is FILE_FINALIZED.
2017-01-23 21:04:57 +03:00
Burak Yucesoy 02880a717b Add LoadShardPlacement UDF
This UDF returns a shard placement from cache given shard id and placement id. At the
moment it iterates over all shard placements of given shard by ShardPlacementList and
searches given placement id in that list, which is not a good solution performance-wise.
However, currently, this function will be used only when there is a failed transaction.
If a need arises we can optimize this function in the future.
2017-01-23 21:04:57 +03:00
Marco Slot 78e3d8c2bb Merge pull request #1158 from citusdata/convert_multi_shard
Use placement connection API for multi-shard transactions
2017-01-23 18:55:16 +01:00
Marco Slot cff95c310e Use placement connection API for multi-shard transactions 2017-01-23 18:34:50 +01:00
Andres Freund 1211d8569c Merge pull request #1134 from citusdata/prepare_hack_poc
Extended Prepared Statement Support
2017-01-23 09:31:33 -08:00
Andres Freund 970c81f589 Hack up PREPARE/EXECUTE for nearly all distributed queries.
All router, real-time, task-tracker plannable queries should now have
full prepared statement support (and even use router when possible),
unless they don't go through the custom plan interface (which
basically just affects LANGUAGE SQL (not plpgsql) functions).

This is achieved by forcing postgres' planner to always choose a
custom plan, by assigning very low costs to plans with bound
parameters (i.e. ones were the postgres planner replanned the query
upon EXECUTE with all parameter values provided), instead of the
generic one.

This requires some trickery, because for custom plans to work the
costs for a non-custom plan have to be known, which means we can't
error out when planning the generic plan.  Instead we have to return a
"faux" plan, that'd trigger an error message if executed.  But due to
the custom plan logic that plan will likely (unless called by an SQL
function, or because we can't support that query for some reason) not
be executed; instead the custom plan will be chosen.
2017-01-23 09:23:50 -08:00
Andres Freund 67da5611f7 Make router planner error handling more flexible.
So far router planner had encapsulated different functionality in
MultiRouterPlanCreate. Modifications always go through router, selects
sometimes. Modifications always error out if the query is unsupported,
selects return NULL.  Especially the error handling is a problem for
the upcoming extension of prepared statement support.

Split MultiRouterPlanCreate into CreateRouterPlan and
CreateModifyPlan, and change them to not throw errors.

Instead errors are now reported by setting the new
MultiPlan->plannigError.

Callers of router planner functionality now have to throw errors
themselves if desired, but also can skip doing so.

This is a pre-requisite for expanding prepared statement support.

While touching all those lines, improve a number of error messages by
getting them closer to the postgres error message guidelines.
2017-01-23 09:23:50 -08:00
Andres Freund e531d69e92 Centralize more of distributed planning into CreateDistributedPlan().
The name CreatePhysicalPlan() hasn't been accurate for a while, and
the split of work between multi_planner() and CreatePhysicalPlan()
doesn't seem perfect.  So rename to CreateDistributedPlan() and move a
bit more logic in there.
2017-01-23 09:23:50 -08:00
Andres Freund 83fe9bf489 Support for deferred error messages.
It can be useful, e.g. in the upcoming prepared statement support, to
be able to return an error from a function that is not raised
immediately, but can later be thrown.  That allows e.g. to attempt to
plan a statment using different methods and to create good error
messages in each planner, but to only error out after all planners
have been run.

To enable that create support for deferred error messages that can be
created (supporting errorcode, message, detail, hint) in one function,
and then thrown in different place.
2017-01-23 09:23:50 -08:00
Andres Freund 52249a3a19 Make usage of static a bit more consistent in multi_planner.c. 2017-01-23 09:23:50 -08:00
Jason Petersen 0986d740d4 Merge pull request #1137 from citusdata/make_rep_model_explicit
Add replication_model GUC

cr: @anarazel
2017-01-23 09:16:52 -07:00
Jason Petersen b5734eb11f Add replication_model GUC
This adds a replication_model GUC which is used as the replication
model for any new distributed table that is not a reference table.
With this change, tables with replication factor 1 are no longer
implicitly MX tables.

The GUC is similarly respected during empty shard creation for e.g.
existing append-partitioned tables. If the model is set to streaming
while replication factor is greater than one, table and shard creation
routines will error until this invalid combination is corrected.

Changing this parameter requires superuser permissions.
2017-01-23 09:05:14 -07:00
Brian Cloutier e4b65d03a2 Port master_append_table_to_shard to new connection API (#1149)
If any placements fail it doesn't update shard statistics on those placements.

A minor enabling refactor: Make CoordinatedTransactionUses2PC public (it used to be CoordinatedTransactionUse2PC but that symbol already existed, so renamed it as well)
2017-01-23 15:57:44 +02:00
Burak Yücesoy c618a46a35 Merge pull request #1118 from citusdata/reword_outer_repartition_error_message
Reword error message for outer joins requiring repartition
2017-01-23 11:02:21 +03:00
Burak Yucesoy 4bb9842660 Reword error message for outer joins requiring repartition
We changed error message which appears when user tries to execute outer join command and
that command requires repartitioning. Old error message mentioned about 1-to-1 shard
partitioning which may not be clear to user.
2017-01-23 10:42:36 +03:00
Marco Slot 1bf8efee67 Merge pull request #1156 from citusdata/enable_deadlock_prevention
Add an enable_deadlock_prevention flag to enable transactions across nodes
2017-01-22 22:06:54 +04:00
Marco Slot ac919337f1 Add an enable_deadlock_prevention flag to allow router transactions to expand to multiple nodes 2017-01-22 17:31:24 +01:00
Marco Slot aa7b3e7f01 Merge pull request #1157 from citusdata/unique_job_id
Ensure job IDs are unique across workers
2017-01-22 20:06:31 +04:00
Marco Slot 190fce2f70 Ensure job IDs are unique across workers 2017-01-22 16:55:14 +01:00
Andres Freund dbba78735c Merge pull request #1155 from citusdata/feature/connection_cleanup
Remove parts of old connection / transaction infrastructure
2017-01-21 09:11:31 -08:00
Andres Freund a596858463 Remove connection_cache.[ch]. 2017-01-21 09:01:15 -08:00