Commit Graph

667 Commits (d7c2e6ab9989ea8869b2af33cf8a9779df393493)

Author SHA1 Message Date
Jason Petersen 89b0c69e6b 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 a7317564ea Add some test outputs to gitignore
These were bothering me.
2017-07-11 15:37:32 -06:00
Burak Yucesoy 33c2c97c6a Add tests for concurrent INSERT and VACUUM behaviour 2017-07-10 15:46:48 +03:00
Burak Yucesoy d4996ad438 Remove LockRelationDistributionMetadata function 2017-07-10 15:46:37 +03:00
Burak Yucesoy c213647ab2 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 1432846da7 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 e2091ae96a Handle implicit casts in prepared INSERTs 2017-07-06 16:17:35 +02:00
Andres Freund 13b86623fd Add tests for statement cancellation. 2017-07-04 14:46:03 -07:00
Andres Freund e171d5363e 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 aa1008238c 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 b62d94379d 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 dba9fa5df0 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 e6d1927567 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 c2c16ce438 Move multi_copy.c to interrupt aware libpq wrappers. 2017-07-04 14:46:03 -07:00
Andres Freund a8602cbd07 Move multi_client_executor to interrupt aware libpq wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund 52cb6fb304 Move citus tools to interrupt aware libpq wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund 567a6cbd16 Add interrupt aware PQputCopy{End,Data} wrappers. 2017-07-04 12:38:52 -07:00
Andres Freund e296f470c2 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 b4fa32dd6d Fix copy & pasto in WARNING message. 2017-07-04 12:38:52 -07:00
Andres Freund 3d8e295041 Fix memory leak in RemoteFinalizedShardPlacementList(). 2017-07-04 12:38:52 -07:00
Andres Freund e190cdf77e Fix some trailing whitespace. 2017-07-04 12:38:52 -07:00
Marco Slot 1ed7976cb9 Change implementation of shard_name UDF to get schema-qualified shard name 2017-07-04 10:49:40 +03:00
Marco Slot 290f9a6301 Move INSERT ... SELECT planning logic into one place 2017-06-29 15:03:14 +02:00
Onder Kalaci dc9b63504e 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
Andres Freund 3ab288bf66 Remove version check from pg_regress_multi.pl
The check is not necessary anymore after f59cf2b818.
2017-06-26 18:07:43 -07:00
Andres Freund 80483bcab2 Remove 9.5 references from comments in schedule files.
Replace with version-less reference, no point in repeating this for
every release.
2017-06-26 18:04:32 -07:00
Andres Freund 1a728f747b Remove 9.5 regression test output files. 2017-06-26 12:17:46 -07:00
Andres Freund c9c26ad81f Remove 9.5 related node wrappers.
Now that all branches support the extensible node infrastructure, we
don't need our wrappers anymore.
2017-06-26 08:46:32 -07:00
Andres Freund 7733154be0 Fix code only enabled for 9.5.
There's still supporting wrappers used, a subsequent commit will
remove those.

This also removes the already unused tuplecount_t define.
2017-06-26 08:46:32 -07:00
Andres Freund 0f3d41702e Remove 9.5 specific C files. 2017-06-26 08:46:32 -07:00
Jason Petersen 05aef7ce29 Support PostgreSQL 10 (#1379)
Adds support for PostgreSQL 10 by copying in the requisite ruleutils
and updating all API usages to conform with changes in PostgreSQL 10.
Most changes are fairly minor but they are numerous. One particular
obstacle was the change in \d behavior in PostgreSQL 10's psql; I had
to add SQL implementations (views, mostly) to mimic the pre-10 output.
2017-06-26 02:35:46 -06:00
Andres Freund 2e7e40dc66 Add some tests checking that maintenance daemon gets started.
The 2nd database one is a bit slow, but also shows something
important, so we might want to keep it?
2017-06-23 11:53:39 -07:00
Andres Freund 62e7b67dc1 Introduce per-database maintenance process.
This will be used for deadlock detection, prepared transaction
recovery amongst others, but currently is just idling around.
2017-06-23 11:53:39 -07:00
Andres Freund 81f92d44d2 Minimal infrastructure for per-backend citus initialization. 2017-06-23 11:20:10 -07:00
Andres Freund 0df00a0955 Force cache invalidation machinery to be initialized earlier.
Previously it was not guaranteed that invalidations were registered
after creating the extension, only if the extension was used
afterwards.
2017-06-23 11:20:10 -07:00
Andres Freund 31b610a359 Centralized metadata_cache cache variables into one struct, to avoid missing resets.
E.g. extensionOwner was already missed.
2017-06-23 11:20:10 -07:00
Marco Slot d4295587aa Fix spuriously failing regression test 2017-06-23 10:06:15 +02:00
Marco Slot 5f84d8e0c4 Add weird column name to create_distributed_table test 2017-06-22 16:27:39 +02:00
Marco Slot 9d14e70716 Clarify error message when copying NULL value into table 2017-06-22 15:48:24 +02:00
Marco Slot f1c6c966f0 Execute INSERT..SELECT via coordinator if it cannot be pushed down
Add a second implementation of INSERT INTO distributed_table SELECT ... that is used if
the query cannot be pushed down. The basic idea is to execute the SELECT query separately
and pass the results into the distributed table using a CopyDestReceiver, which is also
used for COPY and create_distributed_table. When planning the SELECT, we go through
planner hooks again, which means the SELECT can also be a distributed query.

EXPLAIN is supported, but EXPLAIN ANALYZE is not because preventing double execution was
a lot more complicated in this case.
2017-06-22 15:46:30 +02:00
Marco Slot 688f5a11c7 Support quoted column-names in COPY logic 2017-06-22 15:45:57 +02:00
Marco Slot 7675d21151 Simplify router planner call path 2017-06-22 15:45:57 +02:00
Murat Tuncer 49e9f13963 Remove fall back to select if poll is not available (#1466)
poll is supported on all relevant systems, there is no
need to have a fall back mechanism to use select()
2017-06-22 12:11:18 +03:00
Jason Petersen ffaae84fa5 Don't call PostProcessUtility for local commands
It is intended only to aid in processing of distributed DDL commands,
but as written could execute during local CREATE INDEX CONCURRENTLY
commands.
2017-06-19 15:56:03 -06:00
velioglu 0cf67a3164 Delete ExecuteRemoteCommand function 2017-06-15 17:11:19 +03:00
velioglu 8706181b8a Convert DropShardsFromWorker to the new connection API 2017-06-15 15:24:06 +03:00
velioglu c8cebb91bb Convert TableDDLCommandList function to the new connection API 2017-06-14 17:29:58 +03:00
velioglu 1b07d9d396 Convert RemoteTableOwner function to the new connection API 2017-06-14 17:29:58 +03:00
velioglu 34eb8e78f7 Convert worker_fetch_foreign_file to new connection API 2017-06-14 17:29:58 +03:00
velioglu 0049f7334a Convert DistributedTableSizeOnWorker function to new connection API 2017-06-14 17:29:58 +03:00