Commit Graph

358 Commits (b59ab75e2b14ce759862281c96baf2096af89a10)

Author SHA1 Message Date
Jason Petersen b59ab75e2b
Add 5.2.0 CHANGELOG entry
Our longest yet!
2016-08-15 12:55:12 -06:00
Jason Petersen 900f7590ab
Fix Travis local_first_candidate_nodes failures
A recent change to the image used in Travis causes some problems for
the code we use here to ensure the local replica is first. Since this
code is essentially dead in a post-stage world anyhow, we're OK with
ripping out the tests to placate Travis.
2016-08-14 23:12:10 -06:00
Murat Tuncer 3a49cf830e
Remove a router planner test for materialized view
PostgreSQL 9.5.4 stopped calling planner for materialized view create
command when NO DATA option is provided.

This causes our test to behave differently between pre-9.5.4 and 9.5.4.
2016-08-14 22:57:09 -06:00
Andres Freund 3ea352e5f9 Merge pull request #717 from citusdata/fix-700
Skip over unreferenced parameters when router executing prepared statement.
2016-08-05 14:22:24 -07:00
Andres Freund 7fdb5fbe29 Skip over unreferenced parameters when router executing prepared statement.
When an unreferenced prepared statement parameter does not explicitly
have a type assigned, we cannot deserialize it, to send to the remote
side.  That commonly happens inside plpgsql functions, where local
variables are passed in as unused prepared statement parameters.
2016-08-05 14:12:06 -07:00
Jason Petersen eba8396501
Avoid attempting to lock invalid shard identifier
A recent change generates a "dummy" shard placement with its identifier
set to INVALID_SHARD_ID for SELECT queries against distributed tables
with no shards. Normally, no lock is acquired for SELECT statements,
but if all_modifications_commutative is set to true, we will acquire a
shared lock, triggering an assertion failure within LockShardResource
in the above case.

The "dummy" shard placement is actually necessary to ensure such empty
queries have somewhere to execute, and INVALID_SHARD_ID seems the most
appropriate value for the dummy's shard identifier field, so the most
straightforward fix is to just avoid locking invalid shard identifiers.
2016-08-04 13:49:51 -07:00
Jason Petersen ccc32f9da8
Pass -Werror during configure/compile/test step
This will fail any Travis builds that introduce warnings.
2016-08-03 14:59:14 -07:00
Jason Petersen 3a8534eb21
Check style during Travis CI builds
This bumps the Citus tools to 0.4.0, which include support for adding
a recent (0.6.3) uncrustify to Travis in addition to support for fully
installing Travis scripts to system locations. For brevity, suffixes
have been removed from Travis shell scripts.

The main additional logic here is just ensuring Travis CI gets a newer
uncrustify install and that `citus_indent` is called with the `--check`
flag, which exits with a nonzero status if any files don't comply.
2016-08-02 23:16:30 -07:00
Jason Petersen 6be5217872
Lock tools version 2016-08-02 21:23:02 -07:00
Metin Doslu 3ff1877108
Bump version numbers for 5.2 release 2016-08-01 13:48:24 -07:00
Marco Slot ae7bcfff45 Merge pull request #670 from citusdata/bugfix/empty_stage
Improve WorkerShardStats to avoid invalid value bugs
2016-07-29 20:17:08 +02:00
Marco Slot 9705cbcdf8 Rewrite WorkerShardStats to avoid invalid value bugs 2016-07-29 20:11:18 +02:00
Marco Slot 5e432449ba Add MultiClientExecute and MultiClientValueIsNull for simple remote query execution 2016-07-29 20:07:18 +02:00
Andres Freund ea2c2f096a Merge pull request #677 from citusdata/fix-674
Don't access pg_dist_partition->partkey directly, use heap_getattr().
2016-07-29 10:14:38 -07:00
Andres Freund 63fb8311cb Don't access pg_dist_partition->partkey directly, use heap_getattr().
Text datums can't be directly accessed via the struct equivalence trick
used to access catalogs. That's because, as an optimization, they're
sometimes aligned to 1 byte ("text"'s alignment), and sometimes to 4
bytes. That depends on it being a short
varlena (cf. VARATT_NOT_PAD_BYTE) or not.

In the case at hand here, partkey became longer than 127 characters -
the boundary for short varlenas (cf. VARATT_CAN_MAKE_SHORT()). Thus it
became 4 byte/int aligned. Which lead to the direct struct access
accessing the wrong data.

The fix is simply to never access partkey that way - to enforce that,
hide partkey ehind the usual ifdef.

Fixes: #674
2016-07-29 10:02:36 -07:00
Eren Başak 2f8211a787 Merge pull request #685 from citusdata/make_1pc_default_for_ddl
Set 1PC as the Default Commit Protocol for DDL Commands
2016-07-29 16:54:56 +03:00
Eren Başak bb3893d0d8 Set 1PC as the Default Commit Protocol for DDL Commands
Fixes #679

This change sets the default commit protocol for distributed DDL
commands to '1pc'. If the user issues a distributed DDL command with
this default setting, then once in a session, a NOTICE message is
shown about using '2pc' being extra safe.
2016-07-29 16:42:55 +03:00
Jason Petersen cd3b49e70b Merge pull request #675 from citusdata/fix_purge_segfault
Quick fix for possible segfault in PurgeConnection

cr: @anarazel
2016-07-29 00:16:41 -06:00
Jason Petersen bedf53d566
Quick fix for possible segfault in PurgeConnection
Now that connections can be acquired without going through the cache,
we have to handle cases where functions assume the cache has been ini-
tialized.
2016-07-29 00:12:56 -06:00
Jason Petersen f1ed052c2b Merge pull request #673 from citusdata/feature/improve_sequence_support
Support SERIAL/BIGSERIAL non-partition columns

cr: @anarazel
2016-07-29 00:11:33 -06:00
Jason Petersen abe7304898
Support SERIAL/BIGSERIAL non-partition columns
This adds support for SERIAL/BIGSERIAL column types. Because we now can
evaluate functions on the master (during execution), adding this is a
matter of ensuring the table creation step works properly.

To accomplish this, I've added some logic to detect sequences owned by
a table (i.e. those related to its columns). Simply creating a sequence
and using it in a default value is insufficient; users who do so must
ensure the sequence is owned by the column using it.

Fortunately, this is exactly what SERIAL and BIGSERIAL do, which is the
use case we're targeting with this feature. While testing this, I found
that worker_apply_shard_ddl_command actually adds shard identifiers to
sequence names, though I found no places that use or test this path. I
removed that code so that sequence names are not mutated and will match
those used by a SERIAL default value expression.

Our use of the new-to-9.5 CREATE SEQUENCE IF NOT EXISTS syntax means we
are dropping support for 9.4 (which is being done regardless, but makes
this change simpler). I've removed 9.4 from the Travis build matrix.

Some edge cases are possible in ALTER SEQUENCE, COPY FROM (on workers),
and CREATE SEQUENCE OWNED BY. I've added errors for each so that users
understand when and why certain operations are prohibited.
2016-07-28 23:55:40 -06:00
Metin Döşlü 30d8b74245 Merge pull request #678 from citusdata/fix/fix_676_add_old_versions_of_api_functions_without_schema_parameter
Add old version(without schema name parameter) of api functions back
2016-07-28 21:59:44 +03:00
Burak Yucesoy 6f20af9e38 Remove schema name parameter from API functions
We remove schema name parameter from worker_fetch_foreign_file and
worker_fetch_regular_table functions. We now send schema name
concatanated with table name.
2016-07-28 20:41:05 +03:00
Burak Yucesoy a649b47bac Add old version(without schema name parameter) of api functions back
Fixes #676

We added old versions (i.e. without schema name) of worker_apply_shard_ddl_command,
worker_fetch_foreign_file and worker_fetch_regular_table back. During function call
of one of these functions, we set schema name as  public schema and call the newer
version of the functions.
2016-07-28 20:40:38 +03:00
Eren Başak afb829b102 Merge pull request #686 from citusdata/allow_cancellation_on_ddl_commands
Tidy Up multi_ProcessUtility
2016-07-28 17:34:14 +03:00
Eren Başak 8a590c9e5b Remove AllFinalizedlacementsAccessible Function
This change removes AllFinalizedPlacementsAccessible function since,
we open connections to all shard placements before any command is
sent so we immediately error out if a shard placement is not accessible.
2016-07-28 17:24:37 +03:00
Eren Başak 40f8149320 Allow Cancellation During Distributed DDL Commands
This change allows users to interrupt long running DDL commands.
Interrupt requests are handled after each DDL command being propagated
to a shard placement, which means that generally the cancel request will
be processed right after the execution of the DDL is finished in the
current placement.
2016-07-28 17:12:07 +03:00
Murat Tuncer 1ee3d091da Merge pull request #647 from citusdata/501_use_relation_restrictions
Expand router planner coverage for single worker queries
2016-07-27 23:49:24 +03:00
Murat Tuncer cc33a450c4 Expand router planner coverage
We can now support richer set of queries in router planner.
This allow us to support CTEs, joins, window function, subqueries
if they are known to be executed at a single worker with a single
task (all tables are filtered down to a single shard and a single
worker contains all table shards referenced in the query).

Fixes : #501
2016-07-27 23:35:38 +03:00
Murat Tuncer 512d1791c2 Merge pull request #672 from citusdata/drop_pg_94_support
Drop PostgreSQL 9.4 support
2016-07-26 20:24:15 +03:00
Murat Tuncer c20080992d Remove PostgreSQL 9.4 support 2016-07-26 20:16:09 +03:00
Önder Kalacı 34d3df5a7b Merge pull request #642 from citusdata/bugfix/realtime_poll_timeout
Fix bug related to poll timeout
2016-07-26 10:21:37 +03:00
Onder Kalaci 56c0b0825f Fix bug related to poll timeout
This commit fixes a bug on setting polling timeout. The code
updated to comform to the comment that is already placed.
2016-07-26 09:55:47 +03:00
Burak Yücesoy 0c540e741d Merge pull request #665 from citusdata/remove_warnings_on_schema_creation
Remove warnings on schema creation
2016-07-22 19:03:44 +03:00
Burak Yucesoy c1a3478c3b Remove warnings on schema creation
Since now we support schema related operations, there is no need to warn user about
schema usage.
2016-07-22 18:24:23 +03:00
Burak Yücesoy 291aafd11d Merge pull request #662 from citusdata/fix/fix_ALTER_TABLE_SET_SCHEMA
Fix ALTER TABLE SET SCHEMA
2016-07-22 18:07:39 +03:00
Burak Yucesoy bdff72ed75 Fix ALTER TABLE SET SCHEMA
Fixes #132

We hook into ALTER ... SET SCHEMA and warn out if user tries to change schema of a
distributed table.

We also hook into ALTER TABLE ALL IN TABLE SPACE statements and warn out if citus has
been loaded.
2016-07-22 17:52:40 +03:00
Murat Tuncer 0782b8f34e Merge pull request #660 from citusdata/outer_join_fix_for_flattened_queries
Prevent outer join crash when subquery is flatten
2016-07-22 17:16:33 +03:00
Murat Tuncer 5d996a6891 Fix outer join crash when subquery is flatten 2016-07-22 17:01:19 +03:00
Jason Petersen a53a2fe8b0 Merge pull request #653 from citusdata/fix/fix_worker_fetch_regular_table_with_schema
Fix worker_fetch_regular_table with schema

cr: @jasonmp85
2016-07-22 00:56:07 -06:00
Burak Yucesoy b58872b441
Fix worker_fetch_regular_table with schema
Fixes #504
Fixes #646

We changed signature of worker_fetch_regular_table to accept schema name as parameter to
make it work with schemas.
2016-07-22 00:44:02 -06:00
Jason Petersen 69fbdc90c5 Merge pull request #627 from citusdata/feature/mod_in_xact
Permit "single-shard" transactions

cr: @anarazel
2016-07-21 16:37:38 -06:00
Jason Petersen 5d525fba24
Permit "single-shard" transactions
Allows the use of modification commands (INSERT/UPDATE/DELETE) within
transaction blocks (delimited by BEGIN and ROLLBACK/COMMIT), so long as
all modifications hit a subset of nodes involved in the first such com-
mand in the transaction. This does not circumvent the requirement that
each individual modification command must still target a single shard.

For instance, after sending BEGIN, a user might INSERT some rows to a
shard replicated on two nodes. Subsequent modifications can hit other
shards, so long as they are on one or both of these nodes.

SAVEPOINTs are supported, though if the user actually attempts to send
a ROLLBACK command that specifies a SAVEPOINT they will receive an
ERROR at the end of the topmost transaction.

Placements are only marked inactive if at least one replica succeeds
in a transaction where others fail. Non-atomic behavior is possible if
the shard targeted by the initial modification within a transaction has
a higher replication factor than another shard within the same block
and a node with the latter shard has a failure during the COMMIT phase.

Other methods of denoting transaction blocks (multi-statement commands
sent all at once and functions written in e.g. PL/pgSQL or other such
languages) are not presently supported; their treatment remains the
same as before.
2016-07-21 15:57:22 -06:00
Joe Nelson f7a1191b0a Update docs links (#663)
Thanks to @joerg84 for pointing out the broken links

Closes #658
2016-07-21 13:39:40 -07:00
Burak Yücesoy aa15043b09 Merge pull request #655 from citusdata/fix/fix_555_hll_with_schema
Fix COUNT DISTINCT approximation with schema
2016-07-21 18:01:33 +03:00
Burak Yucesoy 20debfc0ee Fix COUNT DISTINCT approximation with schema
Fixes #555

Before this change, we were resolving HLL function and type Oid without qualified name.
Now we find the schema name where HLL objects are stored and generate qualified names for
each objects.

Similar fix is also applied for cstore_table_size function call.
2016-07-21 17:29:18 +03:00
Burak Yücesoy fdd6c57bdf Merge pull request #644 from citusdata/fix/fix_73_master_apply_delete_command_with_schema
Fix master_apply_delete_command with schema
2016-07-21 15:13:39 +03:00
Burak Yucesoy bca672e0a4 Fix master_apply_delete_command with schema
Fixes #73
2016-07-21 15:09:20 +03:00
Burak Yücesoy 85bfad781b Merge pull request #643 from citusdata/add_schema_name_to_worker_apply_shard_ddl_command
Add schema name to worker apply shard ddl command
2016-07-21 14:23:29 +03:00
Burak Yucesoy 2f0158dde1 Change worker_apply_shard_ddl_command to accept schema name as parameter
Fixes #565
Fixes #626

To add schema support to citus, we need to schema-prefix all table names, object names etc.
in the queries sent to worker nodes. However; query deparsing is not available for most of
DDL commands, therefore it is not easy to generate worker query in the master node.

As a solution we are sending schema names along with shard id and query to run to worker
nodes with worker_apply_shard_ddl_command.

To not break \STAGE command we pass public schema as paramater while calling
worker_apply_shard_ddl_command from there. This will not cause problem if user uses \STAGE
in different schema because passes schema name is used only if there is no schema name is
given in the query.
2016-07-21 14:17:26 +03:00