Commit Graph

1394 Commits (a1387f4aa814afcc8d26cfec36d2006a486d18fa)

Author SHA1 Message Date
Marco Slot d164b4cd10 Merge pull request #1453 from citusdata/shard-placement-uses-groups
Shard placements don't hardcode nodename and nodeport
2017-07-12 14:37:16 +02:00
Brian Cloutier 72d8d2429b Add a test for upgrading shard placements 2017-07-12 14:18:27 +02:00
Brian Cloutier ee4edc498f Don't release locks early in metadata functions 2017-07-12 14:18:27 +02:00
Brian Cloutier f40f03270a Fix locking in ReadWorkerNodes() 2017-07-12 14:18:27 +02:00
Brian Cloutier 7ad95b53d2 Rename pg_dist_shard_placement -> pg_dist_placement
Comes with a few changes:

- Change the signature of some functions to accept groupid
  - InsertShardPlacementRow
  - DeleteShardPlacementRow
  - UpdateShardPlacementState

- NodeHasActiveShardPlacements returns true if the group the node is a
  part of has any active shard placements

- TupleToShardPlacement now returns ShardPlacements which have NULL
  nodeName and nodePort.

- Populate (nodeName, nodePort) when creating ShardPlacements
- Disallow removing a node if it contains any shard placements

- DeleteAllReferenceTablePlacementsFromNode matches based on group. This
  doesn't change behavior for now (while there is only one node per
  group), but means in the future callers should be careful about
  calling it on a secondary node, it'll delete placements on the primary.

- Create concept of a GroupShardPlacement, which represents an actual
  tuple in pg_dist_placement and is distinct from a ShardPlacement,
  which has been resolved to a specific node. In the future
  ShardPlacement should be renamed to NodeShardPlacement.

- Create some triggers which allow existing code to continue to insert
  into and update pg_dist_shard_placement as if it still existed.
2017-07-12 14:17:31 +02:00
Brian Cloutier fe53fd4a8e Remove functions created just for unit testing
These functions are holdovers from pg_shard and were created for unit
testing c-level functions (like InsertShardPlacementRow) which our
regression tests already test quite effectively. Removing because it
makes refactoring the signatures of those c-level functions
unnecessarily difficult.

- create_healthy_local_shard_placement_row
- update_shard_placement_row_state
- delete_shard_placement_row
2017-07-12 14:16:24 +02:00
Brian Cloutier 0b64bb1092 Fix typo in comment in CachedRelationLookup 2017-07-12 14:16:24 +02:00
Brian Cloutier 385d9cbbb7 Ignore generated multi_behavioral_analytics_create_table test files 2017-07-12 14:16:24 +02:00
Brian Cloutier 7c8a6c9cee Add vim swap files to .gitignore 2017-07-12 14:16:23 +02:00
Marco Slot bf8377082c Use consistent placement IDs in mulity_modyfing_xactstest 2017-07-12 14:16:23 +02:00
Marco Slot 0437fcd1b2 Merge pull request #1462 from citusdata/clean-regress-multi
Remove unused line, @arguments was set but never used
2017-07-12 14:14:21 +02:00
Brian Cloutier fd8c142530 Remove unused line, @arguments was set but never used 2017-07-12 13:46:27 +02:00
Marco Slot 04e2d64764 Merge pull request #1455 from citusdata/join_xact_modification_levels
Rework connection API to remove transaction restrictions
2017-07-12 12:49:54 +02:00
Marco Slot 9f7e4769e2 Clarify placement connection error messages 2017-07-12 11:59:19 +02:00
Marco Slot d3785b97c0 Remove XactModificationLevel distinction between DML and multi-shard 2017-07-12 11:59:19 +02:00
Marco Slot 710fe8666b Use GetPlacementListConnection for router DML 2017-07-12 11:26:23 +02:00
Marco Slot 29f21fea59 Use GetPlacementListConnection for multi-shard commands 2017-07-12 11:26:22 +02:00
Marco Slot 01c9b1f921 Use GetPlacementListConnection for router SELECTs 2017-07-12 11:26:22 +02:00
Marco Slot 63676f5d65 Allow choosing a connection for multiple placements with GetPlacementListConnection 2017-07-12 11:26:22 +02:00
Jason Petersen 0d569b722e
Bump to the latest Citus Tools
Gets the new uncrustify configuration.
2017-07-11 16:30:03 -06:00
Jason Petersen 9018e698ec
Indentation cleanup
Uncrustify 0.65 appears to have changed some defaults, resulting in
breakages for those of us who have already upgraded; Travis still uses
Uncrustify 0.64, but these changes work with both versions (assuming
appropriately updated config), so this should permit use of either
version for the time being.
2017-07-11 15:59:28 -06:00
Jason Petersen d896fe7995
Add some test outputs to gitignore
These were bothering me.
2017-07-11 15:37:32 -06:00
Burak Yücesoy d6d88efc2d Merge pull request #1488 from citusdata/fix_conflicting_vacuum_insert
Fix conflicting locks in VACUUM and INSERT
2017-07-10 16:00:59 +03:00
Burak Yucesoy a15b3c6df2 Add tests for concurrent INSERT and VACUUM behaviour 2017-07-10 15:46:48 +03:00
Burak Yucesoy c8b9e4011b Remove LockRelationDistributionMetadata function 2017-07-10 15:46:37 +03:00
Burak Yucesoy cb6070c720 Use ShareUpdateExclusiveLock instead ShareLock in VACUUM
Before this change, we used ShareLock to acquire lock on distributed tables while
running VACUUM. This makes VACUUM and INSERT block each other. With this change we
changed lock mode from ShareLock to ShareUpdateExclusiveLock, which does not conflict
with the locks INSERT acquire.
2017-07-10 15:46:19 +03:00
Murat Tuncer 2a4eada150 Replace duplicate code and call check_functions_in_node (#1478)
MasterIrreducibleExpressionWalker has a copied code from
function check_functions_in_node() which was available with
PG 9.6+. Now PG 9.5 support is dropped we can remove
duplicate code and directly call check_functions_in_node().
2017-07-07 10:19:33 +03:00
Marco Slot ea1fd9dd67 Merge pull request #1487 from citusdata/prepared_implicit_casts
Evaluate implicit casts in prepared statements
2017-07-06 21:49:03 +02:00
Marco Slot 31debc96e3 Handle implicit casts in prepared INSERTs 2017-07-06 16:17:35 +02:00
Andres Freund 74a6bac8cc Merge pull request #1473 from citusdata/fix/cancellation
Fix issues around statement cancellation and connection closure.
2017-07-04 14:58:23 -07:00
Andres Freund d76b093185 Add tests for statement cancellation. 2017-07-04 14:46:03 -07:00
Andres Freund 3461244539 Don't wait for statement completion when aborting coordinated transaction.
Previously we used ForgetResults() in StartRemoteTransactionAbort() -
that's problematic because there might still be an ongoing statement,
and this causes us to wait for its completion.  That e.g. happens when
a statement running on the coordinator is cancelled.
2017-07-04 14:46:03 -07:00
Andres Freund 0d791f6740 Cancel statements when closing connection at transaction end.
That's important because the currently running statement on a worker
might continue to hold locks and consume resources, even after the
connection is closed.  Unfortunately postgres will only notice closed
connections when reading from / writing to the network. That might
only happen much later.
2017-07-04 14:46:03 -07:00
Andres Freund be8677f926 Add NonblockingForgetResults().
This is very similar to ForgetResults() except that no network IO is
performed. Primarily useful in error handling cases.
2017-07-04 14:46:03 -07:00
Andres Freund 24153fae5d Add ShutdownConnection() which cancels statement before closing connection.
That's primarily useful in error cases, where we want to make sure
locks etc held by commands running on workers are released promptly.
2017-07-04 14:46:03 -07:00
Andres Freund 75a7ddea0d Always use connections in non-blocking mode.
Now that there's no blocking libpq callers left, default to using
non-blocking mode in connection_management.c.  This has two
advantages:
1) Blockiness doesn't have to frequently be reset, simplifying code
2) Prevents accidental use of blocking libpq functions, since they'll
   frequently return 'need IO'
2017-07-04 14:46:03 -07:00
Andres Freund 90a2d13a64 Move multi_copy.c to interrupt aware libpq wrappers. 2017-07-04 14:46:03 -07:00
Andres Freund 21c25abbb1 Move multi_client_executor to interrupt aware libpq wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund ddb0651967 Move citus tools to interrupt aware libpq wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund c674bc8640 Add interrupt aware PQputCopy{End,Data} wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund b7f9679ccc Move interrupt handling code from GetRemoteCommandResult to FinishConnectionIO.
Nearby commits will add additional interrupt handling functions, this
way we don't have to duplicate the code.
2017-07-04 12:38:52 -07:00
Andres Freund ec0ed677e3 Fix copy & pasto in WARNING message. 2017-07-04 12:38:52 -07:00
Andres Freund 3dedeadb5e Fix memory leak in RemoteFinalizedShardPlacementList(). 2017-07-04 12:38:52 -07:00
Andres Freund c161c2fbe3 Fix some trailing whitespace. 2017-07-04 12:38:52 -07:00
Burak Velioglu cd8c547165 Merge pull request #1266 from citusdata/fix_shard_name
Change shard_name UDF to include schema
2017-07-04 11:01:52 +03:00
Marco Slot 04fe3f03f6 Change implementation of shard_name UDF to get schema-qualified shard name 2017-07-04 10:49:40 +03:00
Marco Slot 58947e0dcf Merge pull request #1469 from citusdata/move_insert_select
Move INSERT ... SELECT planning logic into one place
2017-06-29 16:50:01 +02:00
Marco Slot da47a03b18 Move INSERT ... SELECT planning logic into one place 2017-06-29 15:03:14 +02:00
Önder Kalacı 907274a58a Merge pull request #1463 from citusdata/partition_distributed_table_utils
Add some utility functions for partitioned tables
2017-06-28 09:50:30 +03:00
Onder Kalaci 5f3f1d75a3 Add some utility functions for partitioned tables
This commit is intended to be a base for supporting declarative partitioning
on distributed tables. Here we add the following utility functions and their
unit tests:

  * Very basic functions including differnentiating partitioned tables and
    partitions, listing the partitions
  * Generating the PARTITION BY (expr) and adding this to the DDL events
    of partitioned tables
  * Ability to generate text representations of the ranges for partitions
  * Ability to generate the `ALTER TABLE parent_table ATTACH PARTITION
    partition_table FOR VALUES value_range`
  * Ability to apply add shard ids to the above command using
    `worker_apply_inter_shard_ddl_command()`
  * Ability to generate `ALTER TABLE parent_table DETACH PARTITION`
2017-06-28 09:39:55 +03:00