Commit Graph

413 Commits (b7d4f99d804dc20b57ff280c5aace14f6d9e5b42)

Author SHA1 Message Date
Eren Başak 7e511d278e Lowercase \copy to match PostgreSQL's style for local/psql-level functions 2016-08-22 11:31:26 -06:00
Eren Basak d030eb63d1 Replace \stage With \copy on Regression Tests
Fixes #547

This change removes all references to \stage in the regression tests
and puts \COPY instead. Doing so changed shard counts, min/max
values on some test tables (lineitem, orders, etc.).
2016-08-22 11:31:26 -06:00
Robin Thomas 475a6245bf Remove all usage of pg_dist_shard.shardalias in extension code. (#739)
Remove regression test of non-null shardalias.
2016-08-19 17:06:22 +03:00
Jason Petersen 6b8d140d6c Merge pull request #701 from citusdata/fix_inttypes_warnings
Remove HAVE_INTTYPES_H ifdefs

cr: @anarazel
2016-08-18 15:35:11 -06:00
Jason Petersen eb039bd58e 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-08-18 15:19:53 -06:00
Jason Petersen 23fd254586 Add 5.2.0 CHANGELOG entry
Our longest yet!
2016-08-15 12:55:12 -06:00
Jason Petersen 8e7a567827 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 ed3a442cda 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 955644bc6c 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 d6f447884f 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 2d7355ffe0 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 6558853cc8 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 45d2aab32c 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 a6ca17d0a6 Lock tools version 2016-08-02 21:23:02 -07:00
Metin Doslu 16e02775ca Bump version numbers for 5.2 release 2016-08-01 13:48:24 -07:00
Marco Slot cdea8ef730 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 f538ab7f62 Rewrite WorkerShardStats to avoid invalid value bugs 2016-07-29 20:11:18 +02:00
Marco Slot 061662a51f Add MultiClientExecute and MultiClientValueIsNull for simple remote query execution 2016-07-29 20:07:18 +02:00
Andres Freund 71a5497d2c 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 0670ba6376 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 a59099945c 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 bb4f4e25b5 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 80156fd00b 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 d43578c557 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 18cd97b6fc 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 f19779b0ce 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ü 5b63deebc5 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 0a2c940ae5 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 98025110f0 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 94830778e4 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 6f91d30e1c 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 90a1d8f67a 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 01348b1c42 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 992997b8ad 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 bc9d2000af 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 719e44d1f4 Remove PostgreSQL 9.4 support 2016-07-26 20:16:09 +03:00
Önder Kalacı 45ec84adee 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 0d3e85ce11 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 1c1f30c58e 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 770ecffc8f 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 0531150785 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 9df8300efa 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 cff2743f46 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 461fefbdb2 Fix outer join crash when subquery is flatten 2016-07-22 17:01:19 +03:00
Jason Petersen 5ebba88c06 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 444d4eb558 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 e9eb1ae529 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 44e444ac6a 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 94160fc446 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 25e2bf9714 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