Commit Graph

380 Commits (release-5.2)

Author SHA1 Message Date
Jason Petersen fa60208026
Bump CHANGELOG release dates
Oops.
2016-11-07 09:52:18 -07:00
Jason Petersen 2ea46d9ff2
Add 5.2.2 CHANGELOG entry
Many fixes and improvements to existing behavior.
2016-11-07 09:49:38 -07:00
Samay Sharma c2767550b5
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-02 17:50:19 -06:00
Marco Slot 1228d7d2d3
Update docs links to v5.2 docs 2016-10-25 15:39:02 -06:00
Metin Doslu c93925f657
Reduce minimum value of task_tracker_delay to 1ms 2016-10-25 15:23:40 -06:00
Eren Basak a851aaf9f7
Fix command counter increment bug
Fixes citusdata/citus#714

On `InsertShardRow`, we previously called `CommandCounterIncrement()` before
`CitusInvalidateRelcacheByRelid(relationId);`. This might prevent to skip
invalidation of the distributed table in the next access within the same session.
2016-10-25 15:23:22 -06:00
Andres Freund 3df78ebd4a Don't create hash-table of zero size in TaskHashCreate().
hash_create(), called by TaskHashCreate(), doesn't work correctly for a
zero sized hash table. This triggers valgrind errors, and could
potentially cause crashes even without valgring.

This currently happens for Jobs with 0 tasks. These probably should be
optimized away before reaching TaskHashCreate(), but that's a bigger
change.
2016-10-03 14:10:44 -07:00
Andres Freund 94dc5768fe Initialize count_agg_clauses argument to 0.
count_agg_clause *adds* the cost of the aggregates to the state
variable, it doesn't reinitialize it. That is intentional, as it is used
to incrementally add costs in some places.
2016-10-03 14:10:37 -07:00
Andres Freund 6bb6c9d22b Lower "waiting for activity on tasks took longer than" log level.
It's perfectly normal to wait longer in several circumstances, and the
output can lead to spurious regression output changes.
2016-10-03 14:10:31 -07:00
Jason Petersen 3bb8a5f84b
Directly register router xact callbacks in PG_init
Not entirely sure why we went with the shared memory hook approach, but
it causes problems (multiple registration) during crashes. Changing to
a simple direct registration call from PG_init.
2016-09-29 17:10:30 -06:00
Marco Slot 8b36c27379 Make count return 0 if all shards are pruned away
Before this change, count on a distributed returned NULL if all shards
were pruned away, because on the master we replace with count(..) call
with a sum(..) call to sum the counts from the shards. However, sum
returns NULL when there are no rows, whereas count is expected to return
0.
2016-09-29 20:55:50 +02:00
Marco Slot b0cf34e361 Merge pull request #817 from citusdata/router_plannner_fix_for_5.2.2
Make where false queries router plannable
2016-09-28 18:17:04 +02:00
Murat Tuncer 8db6a0ddf2 Make where false queries router plannable 2016-09-28 19:03:14 +03:00
Jason Petersen 6a7e930b42
Fix unique-violation-in-xact segfault
An interaction between ReraiseRemoteError and DML transaction support
causes segfaults:

  * ReraiseRemoteError calls PurgeConnection, freeing a connection...
  * That connection is still in the xactParticipantHash

At transaction end, the memory in the freed connection might happen to
pass the "is this connection OK?" check, causing us to try to send an
ABORT over that connection. By removing it from the transaction hash
before calling ReraiseRemoteError, we avoid this possibility.
2016-09-27 17:27:22 -06:00
Metin Doslu b8bb22e5cc
Pass text oid inteads of invalid oid for null values
Passing invalid oids even for null values in PQsendQueryParams() causes worker
nodes to fail. Therefore, we pass text oid for null values.
2016-09-27 17:22:56 -06:00
Andres Freund f5430989ed
Support NoMovement direction in router executor
This is mainly interesting because it allows to use RETURN QUERY/RETURN
QUERY EXECUTE and FOR ... IN .. LOOPs in plpgsql.
2016-09-27 17:21:44 -06:00
Marco Slot 4c72a88bfe
Fix segmentation fault in case of joins with WHERE 1=0 2016-09-27 17:20:34 -06:00
Metin Doslu 5494f21541
Remove pg_toast_* references from regression tests
pg_toast_* oids are constantly changing, and this causes regression tests to
fail time to time. With this commit, we remove all of the pg_toast_* references
from regression test outputs.
2016-09-27 17:20:23 -06:00
Jason Petersen 1b7c24a938
Add 5.2.1 CHANGELOG entry
Outer join and memory leak fixes
2016-09-06 12:28:41 -05:00
Jason Petersen da8c26e1c3
Fix CreateShardConnectionHash memory leak
The call to hash_create specified HASH_CONTEXT without actually setting
one using the provided HASHCTL. The hashes returned by this function
are used locally, so simply using CurrentMemoryContext is sufficient.
2016-09-06 12:28:41 -05:00
Metin Doslu 232261827d
Add complex subquery pushdown regression tests 2016-09-06 12:28:37 -05:00
Metin Doslu fa4f3b4d9a
Add outer join clause list extraction for subquery pushdown logic
In subquery pushdown, we allow outer joins if the join condition is on the
partition columns. WhereClauseList() used to return all join conditions including
outer joins. However, this has been changed with a commit related to outer join
support on regular queries. With this commit, we refactored ExtractFromExpressionWalker()
to return two lists of qualifiers. The first list is for inner join and filter
clauses and the second list is for outer join clauses. Therefore, we can also
use outer join clauses to check subquery pushdown prerequisites.
2016-09-06 11:51:28 -05:00
Jason Petersen ce0a0ab813
Add sort call to shard placement test
The comparator is kind of broken, but I think this is better than the
current state of random failures.
2016-09-06 11:51:28 -05:00
Jason Petersen 9ea36bb375
Remove HAVE_INTTYPES_H ifdefs
I've been seeing warnings on OS X/clang for a while about these lines
and finally got tired of it. The main problem is that PRIu64 expects a
uint64_t but we were passing a uint64 (a PostgreSQL-defined type). In
PostgreSQL 9.5, we now have INT64_MODIFIER, so can build our own zero-
padded unsigned 64-bit int format modifier that expects a PostgreSQL-
provided uint64 type.

This simplifies the code slightly (no more ifdefs) and gets rid of the
warning that's been annoying me since April (my TODO creation time).
2016-09-06 11:51:28 -05:00
Jason Petersen a091353c0c
Add 5.2.0 CHANGELOG entry
Our longest yet!
2016-08-15 12:59:35 -06:00
Jason Petersen 0509d85e94
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:19:16 -06:00
Murat Tuncer 379ba0d717
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 23:19:16 -06:00
Andres Freund 75cd7a7d6f Merge pull request #718 from citusdata/fix-700-5.2
Skip over unreferenced parameters when router executing prepared stat…
2016-08-05 14:28:23 -07:00
Andres Freund 7f6084c14f 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:20:22 -07:00
Jason Petersen 27171c230c
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 14:45:54 -07:00
Jason Petersen 596bc7194d
Lock tools version 2016-08-02 21:28:17 -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