Commit Graph

550 Commits (d19c4869d64c70f23f64ad8c63fbb0b62719ac7c)

Author SHA1 Message Date
Marco Slot d19c4869d6 Merge pull request #939 from citusdata/bugfix/colocated_multi_shards
Use co-located shard ID in multi-shard transactions
2016-11-02 11:18:46 +01:00
Marco Slot f6b3af7a49 Use co-located shard ID in multi_shard_transaction 2016-11-02 11:01:19 +01:00
Jason Petersen 74d8e4f640 Merge pull request #929 from citusdata/fix_create_index_if_not_exists
Avoid error during CREATE INDEX IF NOT EXISTS

cr: @jasonmp85
2016-11-01 17:11:39 -06:00
Samay Sharma 82e5faa190 Avoid error during CREATE INDEX IF NOT EXISTS
Previously, we threw an error when we ran CREATE INDEX IF NOT EXISTS
with an already existing index. This change enables expected behavior by
checking if the statement has IF NOT EXISTS before throwing the error.
We also ensure that we don't execute the command on the workers, if an
index already exists on the master.
2016-11-01 14:51:19 -07:00
Burak Yücesoy 99658c626e Merge pull request #937 from citusdata/fix_typo_in_error_message
Fix typo in error message
2016-11-01 17:04:53 +02:00
Burak Yucesoy b30b339f91 Fix typo in error message 2016-11-01 16:58:27 +02:00
Burak Yücesoy 2cb2e7a352 Merge pull request #936 from citusdata/fix_foreign_constraint_replication_factor_message
Change error message we displayed for foreign constraints if RF > 1
2016-11-01 15:57:46 +02:00
Burak Yucesoy 6246702a4c Change error message we displayed for foreign constraints if RF > 1
At the moment, we do not support foreign constraints if replication factor is greater
than 1. However foreign constraints can be used in cloud with high availability option.
Therefore we do not want to create an impression such that foreign constraints with
high availability is not supported at all. We call users to action with this error
message.
2016-11-01 15:47:19 +02:00
Marco Slot a4d5da4132 Merge pull request #928 from citusdata/fix_drop_shards
Always CASCADE while dropping a shard
2016-11-01 10:35:35 +01:00
Önder Kalacı 83e1719541 Always CASCADE while dropping a shard 2016-11-01 10:16:34 +01:00
Brian Cloutier 50805f1e5c Copy raw_parse_tree before using it
Address citusdata/citus#922.

Fixes a segfault in PG's installcheck caused by our reuse of
raw_parse_tree when handling EXPLAIN EXECUTE.
2016-10-27 18:25:49 +03:00
Önder Kalacı f3aedb9289 Merge pull request #921 from citusdata/fix_execution_of_insert_select_bug
Improve error semantics for INSERT..SELECT
2016-10-27 14:17:13 +03:00
Onder Kalaci a43e3bad56 Improve error semantics for INSERT..SELECT
With this commit, we error out if a worker query cannot be executed
on all placements of a target insert shard interval.
2016-10-27 14:09:05 +03:00
Andres Freund 7ae3b31328 Merge pull request #917 from citusdata/isolationtester
Basic Isolationtester infrastructure including some basic tests.
2016-10-27 04:03:37 -07:00
Andres Freund dfe7b357c5 Simple isolationtester dml vs. repair tests. 2016-10-27 00:31:41 -07:00
Andres Freund 121b868da5 Add very basic isolationtester infrastructure including a trivial test. 2016-10-27 00:31:41 -07:00
Andres Freund ce73ffdf2e Identify build and source directory of postgres we're compiling against.
That's useful when trying to rely on files only present in source and/or
build directories, not in the normal installation. E.g. the
isolationtester binary, or the valgrind suppression files.
2016-10-27 00:31:41 -07:00
Andres Freund c3e1d49e34 Don't try to shutdown servers that have not been started in regression tests.
This avoids spurious output from failing shutdowns and uninitialized
variable warnings if pg_regress_multi.pl fails before starting servers.
2016-10-27 00:31:41 -07:00
Metin Döşlü 03c06a3b68 Merge pull request #920 from citusdata/fix/error_on_different_shard_placement_count
Error on different shard placement counts
2016-10-26 18:54:08 +03:00
Metin Doslu c6f5cabbe3 Error on different shard placement count
In ErrorIfShardPlacementsNotColocated(), while checking if shards are colocated,
error out if matching shard intervals have different number of shard placements.
2016-10-26 18:46:05 +03:00
Önder Kalacı 7f74d82835 Merge pull request #919 from citusdata/add_stub_for_repair_shards
Add stub for Copy shard placement
2016-10-26 18:05:54 +03:00
Onder Kalaci 9cd549f21f Add stub for Copy shard placement
This commit does not change the current behaviour, but, helps to implement
enterprise feature without any version changes.
2016-10-26 17:57:55 +03:00
Metin Döşlü 9969594e10 Merge pull request #915 from citusdata/add_mark_tables_colocated
Add mark_tables_colocated() to update colocation groups
2016-10-26 17:37:29 +03:00
Metin Doslu 4e555880b7 Add mark_tables_colocated() to update colocation groups
Added a new UDF, mark_tables_colocated(), to colocate tables with the same
configuration (shard count, shard replication count and distribution column type).
2016-10-26 17:29:03 +03:00
Andres Freund 422bb51ff1 Merge pull request #916 from citusdata/bugfix/prepstate
Re-acquire metadata locks in RouterExecutorStart
2016-10-26 06:54:13 -07:00
Marco Slot 275378aa45 Re-acquire metadata locks in RouterExecutorStart 2016-10-26 14:34:59 +02:00
Brian Cloutier 1e6d1ef67e Fix segfault during EXPLAIN EXECUTE
Fix citusdata/citus#886

The way postgres' explain hook is designed means that our hook is never
called during EXPLAIN EXECUTE. So, we special-case EXPLAIN EXECUTE by
catching it in the utility hook.  We then replace the EXECUTE with the
original query and pass it back to Citus.
2016-10-26 15:18:42 +03:00
Burak Yücesoy 61f6baf9e3 Merge pull request #908 from citusdata/only_repair_given_shard
Only repair given shard
2016-10-26 14:44:48 +03:00
Burak Yucesoy fc2fea839b Only repair given shard
Previously, when a repair is requested on a shard, we also repair all co-located shards
of given shard, which may cause repairing already healthy shards. With this change, we
only repair given shard.
2016-10-26 14:36:37 +03:00
Brian Cloutier 80c8cfeabe Don't add a raw 32-bit int to tuples in create_distributed_table 2016-10-26 14:02:42 +03:00
Andres Freund 837ec67c80 Merge pull request #914 from citusdata/bugfix/minimal-127
Invalidate relcache after pg_dist_shard_placement changes.
2016-10-26 03:50:48 -07:00
Andres Freund fcd150c7c8 Invalidate relcache after pg_dist_shard_placement changes.
This forces prepared statements to be re-planned after changes of the
placement metadata. There's some locking issues remaining, but that's a
a separate task.

Also add regression tests verifying that invalidations take effect on
prepared statements.
2016-10-26 03:36:35 -07:00
Önder Kalacı fa8d39ec91 Merge pull request #859 from citusdata/feature/insert_select
Feature/insert select
2016-10-26 11:27:16 +03:00
Onder Kalaci 1673ea937c Feature: INSERT INTO ... SELECT
This commit adds INSERT INTO ... SELECT feature for distributed tables.

We implement INSERT INTO ... SELECT by pushing down the SELECT to
each shard. To compute that we use the router planner, by adding
an "uninstantiated" constraint that the partition column be equal to a
certain value. standard_planner() distributes that constraint to all
the tables where it knows how to push the restriction safely. An example
is that the tables that are connected via equi joins.

The router planner then iterates over the target table's shards,
for each we replace the "uninstantiated" restriction, with one that
PruneShardList() handles. Do so by replacing the partitioning qual
parameter added in multi_planner() with the current shard's
actual boundary values. Also, add the current shard's boundary values to the
top level subquery to ensure that even if the partitioning qual is
not distributed to all the tables, we never run the queries on the shards
that don't match with the current shard boundaries. Finally, perform the
normal shard pruning to decide on whether to push the query to the
current shard or not.

We do not support certain SQLs on the subquery, which are described/commented
on ErrorIfInsertSelectQueryNotSupported().

We also added some locking on the router executor. When an INSERT/SELECT command
runs on a distributed table with replication factor >1, we need to ensure that
it sees the same result on each placement of a shard. So we added the ability
such that router executor takes exclusive locks on shards from which the SELECT
in an INSERT/SELECT reads in order to prevent concurrent changes. This is not a
very optimal solution, but it's simple and correct. The
citus.all_modifications_commutative can be used to avoid aggressive locking.
An INSERT/SELECT whose filters are known to exclude any ongoing writes can be
marked as commutative. See RequiresConsistentSnapshot() for the details.

We also moved the decison of whether the multiPlan should be executed on
the router executor or not to the planning phase. This allowed us to
integrate multi task router executor tasks to the router executor smoothly.
2016-10-26 10:01:00 +03:00
Onder Kalaci e0d83d65af Add ability to reorder target list for INSERT/SELECT queries
The necessity for this functionality comes from the fact that ruleutils.c is not supposed to be
used on "rewritten" queries (i.e. ones that have been passed through QueryRewrite()).
Query rewriting is the process in which views and such are expanded,
and, INSERT/UPDATE targetlists are reordered to match the physical order,
defaults etc. For the details of reordeing, see transformInsertRow().
2016-10-26 10:00:03 +03:00
Jason Petersen f900a1a107 Merge pull request #901 from citusdata/fix_udf_schemas
Fix function schemas

cr: @mtuncer @anarazel
2016-10-25 12:54:04 -06:00
Jason Petersen 73f5b8b05f
Move all funcs to pg_catalog, add test to verify
We'd been relying on a single SET search_path command in an earlier
script, but a subsequent script RESET search_path, causing any further
bare functions to be created in the first schema on the search path.

However, starting with an older extension version and executing ALTER
scripts one at a time DOES avoid putting any functions in the public
namespace, so I wrote an upgrade script resilient to that, especially
because PostgreSQL 9.5 will error out if a function is already in the
schema it's being moved to.
2016-10-25 12:45:53 -06:00
Brian Cloutier 750855bcc0 Merge pull request #910 from citusdata/int8-nodeport
Treat nodePort as the 8byte number it is
2016-10-25 17:12:44 +03:00
Brian Cloutier c6b74b023f Treat nodePort as the 8byte number it is 2016-10-25 16:31:48 +03:00
Brian Cloutier 2e96f6ab27 Fix crash when upgrading to Citus 6
Between restart (running the new code) and ALTER EXTENSION citus
UPGRADE there was an inconsistency where we assumed that
pg_dist_partition had the repmodel column set. Now we give it a default
value if the column doesn't exist yet.
2016-10-24 15:18:29 +03:00
Marco Slot f5ae4330be Merge pull request #885 from citusdata/feature/parallel_ddl
Parallelise DDL commands
2016-10-24 13:29:51 +02:00
Marco Slot 271b20a23e Parallelise DDL commands 2016-10-24 12:39:08 +02:00
Burak Yücesoy 18f6c9c1a7 Merge pull request #888 from citusdata/foreign_key_support_for_create_table
Foreign key support for create table
2016-10-21 16:48:07 +03:00
Burak Yucesoy 5a03acf2bf Foreign Constraint Support for create_distributed_table and shard move
With this change, we now push down foreign key constraints created during CREATE TABLE
statements. We also start to send foreign constraints during shard move along with
other DDL statements
2016-10-21 15:38:55 +03:00
Marco Slot 84babaa58e Merge pull request #895 from citusdata/bugfix/evaluation
Re-disable master evaluation for SELECT
2016-10-21 11:38:11 +02:00
Marco Slot 02d2b86e68 Re-disable master evaluation for SELECT 2016-10-21 10:51:47 +02:00
Metin Döşlü 2dcca0939b Merge pull request #892 from citusdata/add_create_reference_table_udf
Add create_reference_table()
2016-10-20 15:41:38 +03:00
Metin Doslu 405335fcee Add create_reference_table()
create_reference_table() creates a hash distributed table with shard count
equals to 1 and replication factor equals to shard_replication_factor
configuration value.
2016-10-20 15:29:30 +03:00
Metin Döşlü b6a9b61d32 Merge pull request #867 from citusdata/add_create_distributed_table
Add create_distributed_table() udf
2016-10-20 11:43:25 +03:00
Metin Doslu d3e7d9dc8d Final refactoring 2016-10-20 11:29:11 +03:00