Merge pull request #1750 from citusdata/next_shard_id

Set shard and placement IDs in regression tests using a GUC
pull/1808/head
Marco Slot 2017-11-15 10:30:35 +01:00 committed by GitHub
commit f1a05fdc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
175 changed files with 261 additions and 182 deletions

View File

@ -68,6 +68,8 @@ int ShardCount = 32;
int ShardReplicationFactor = 1; /* desired replication factor for shards */
int ShardMaxSize = 1048576; /* maximum size in KB one shard can grow to */
int ShardPlacementPolicy = SHARD_PLACEMENT_ROUND_ROBIN;
int NextShardId = 0;
int NextPlacementId = 0;
static List * GetTableReplicaIdentityCommand(Oid relationId);
static Datum WorkerNodeGetDatum(WorkerNode *workerNode, TupleDesc tupleDescriptor);
@ -291,14 +293,33 @@ master_get_new_shardid(PG_FUNCTION_ARGS)
uint64
GetNextShardId()
{
text *sequenceName = cstring_to_text(SHARDID_SEQUENCE_NAME);
Oid sequenceId = ResolveRelationId(sequenceName);
Datum sequenceIdDatum = ObjectIdGetDatum(sequenceId);
text *sequenceName = NULL;
Oid sequenceId = InvalidOid;
Datum sequenceIdDatum = 0;
Oid savedUserId = InvalidOid;
int savedSecurityContext = 0;
Datum shardIdDatum = 0;
uint64 shardId = 0;
/*
* In regression tests, we would like to generate shard IDs consistently
* even if the tests run in parallel. Instead of the sequence, we can use
* the next_shard_id GUC to specify which shard ID the current session should
* generate next. The GUC is automatically increased by 1 every time a new
* shard ID is generated.
*/
if (NextShardId > 0)
{
shardId = NextShardId;
NextShardId += 1;
return shardId;
}
sequenceName = cstring_to_text(SHARDID_SEQUENCE_NAME);
sequenceId = ResolveRelationId(sequenceName);
sequenceIdDatum = ObjectIdGetDatum(sequenceId);
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);
@ -351,14 +372,33 @@ master_get_new_placementid(PG_FUNCTION_ARGS)
uint64
GetNextPlacementId(void)
{
text *sequenceName = cstring_to_text(PLACEMENTID_SEQUENCE_NAME);
Oid sequenceId = ResolveRelationId(sequenceName);
Datum sequenceIdDatum = ObjectIdGetDatum(sequenceId);
text *sequenceName = NULL;
Oid sequenceId = InvalidOid;
Datum sequenceIdDatum = 0;
Oid savedUserId = InvalidOid;
int savedSecurityContext = 0;
Datum placementIdDatum = 0;
uint64 placementId = 0;
/*
* In regression tests, we would like to generate placement IDs consistently
* even if the tests run in parallel. Instead of the sequence, we can use
* the next_placement_id GUC to specify which shard ID the current session
* should generate next. The GUC is automatically increased by 1 every time
* a new placement ID is generated.
*/
if (NextPlacementId > 0)
{
placementId = NextPlacementId;
NextPlacementId += 1;
return placementId;
}
sequenceName = cstring_to_text(PLACEMENTID_SEQUENCE_NAME);
sequenceId = ResolveRelationId(sequenceName);
sequenceIdDatum = ObjectIdGetDatum(sequenceId);
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);

View File

@ -813,6 +813,36 @@ RegisterCitusConfigVariables(void)
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
DefineCustomIntVariable(
"citus.next_shard_id",
gettext_noop("Set the next shard ID to use in shard creation."),
gettext_noop("Shard IDs are normally generated using a sequence. If "
"next_shard_id is set to a non-zero value, shard IDs will "
"instead be generated by incrementing from the value of "
"this GUC and this will be reflected in the GUC. This is "
"mainly useful to ensure consistent shard IDs when running "
"tests in parallel."),
&NextShardId,
0, 0, INT_MAX,
PGC_USERSET,
GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
DefineCustomIntVariable(
"citus.next_placement_id",
gettext_noop("Set the next placement ID to use in placement creation."),
gettext_noop("Placement IDs are normally generated using a sequence. If "
"next_placement_id is set to a non-zero value, placement IDs will "
"instead be generated by incrementing from the value of "
"this GUC and this will be reflected in the GUC. This is "
"mainly useful to ensure consistent placement IDs when running "
"tests in parallel."),
&NextPlacementId,
0, 0, INT_MAX,
PGC_USERSET,
GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
DefineCustomIntVariable(
"citus.max_task_string_size",
gettext_noop("Sets the maximum size (in bytes) of a worker task call string."),

View File

@ -92,6 +92,8 @@ extern int ShardCount;
extern int ShardReplicationFactor;
extern int ShardMaxSize;
extern int ShardPlacementPolicy;
extern int NextShardId;
extern int NextPlacementId;
extern bool IsCoordinator(void);

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 103000;
SET citus.next_shard_id TO 103000;
-- tests that the upgrade from 7.0-2 to 7.0-3 properly migrates shard placements
DROP EXTENSION citus;
SET citus.enable_version_checks TO 'false';

View File

@ -1,7 +1,7 @@
--
-- MULTI_ARRAY_AGG
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 520000;
SET citus.next_shard_id TO 520000;
CREATE OR REPLACE FUNCTION array_sort (ANYARRAY)
RETURNS ANYARRAY LANGUAGE SQL
AS $$

View File

@ -1,7 +1,7 @@
--
-- MULTI_BINARY_MASTER_COPY
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 430000;
SET citus.next_shard_id TO 430000;
-- Try binary master copy for different executors
SET citus.binary_master_copy_format TO 'on';
SET citus.task_executor_type TO 'task-tracker';

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1601000;
SET citus.next_shard_id TO 1601000;
CREATE TABLE tab9 (test_id integer NOT NULL, data int);
CREATE TABLE tab10 (test_id integer NOT NULL, data int);
SELECT master_create_distributed_table('tab9', 'test_id', 'hash');

View File

@ -3,7 +3,7 @@
--
-- tests UDFs created for citus tools
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1240000;
SET citus.next_shard_id TO 1240000;
-- test with invalid port, prevent OS dependent warning from being displayed
SET client_min_messages to ERROR;
-- PG 9.5 does not show context for plpgsql raise

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1220000;
SET citus.next_shard_id TO 1220000;
-- Tests functions related to cluster membership
-- before starting the test, lets try to create reference table and see a
-- meaningful error

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1300000;
SET citus.next_shard_id TO 1300000;
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 4;
-- ===================================================================
-- create test utility function
@ -631,6 +631,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='schema_colloca
(1 row)
\c - - - :master_port
SET citus.next_shard_id TO 1300068;
CREATE TABLE table1_groupF ( id int );
SELECT create_reference_table('table1_groupF');
create_reference_table

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 390000;
SET citus.next_shard_id TO 390000;
-- ===================================================================
-- get ready for the foreign data wrapper tests
-- ===================================================================

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 380000;
SET citus.next_shard_id TO 380000;
-- ===================================================================
-- test INSERT proxy creation functionality
-- ===================================================================

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 370000;
SET citus.next_shard_id TO 370000;
-- ===================================================================
-- create test functions and types needed for tests
-- ===================================================================

View File

@ -1,7 +1,7 @@
--
-- MULTI_CREATE_TABLE_CONSTRAINTS
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 365000;
SET citus.next_shard_id TO 365000;
-- test that Citus forbids unique and EXCLUDE constraints on append-partitioned tables.
CREATE TABLE uniq_cns_append_tables
(

View File

@ -2,7 +2,7 @@
-- test composite type, varchar and enum types
-- create, distribute, INSERT, SELECT and UPDATE
-- ===================================================================
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 530000;
SET citus.next_shard_id TO 530000;
-- create a custom type...
CREATE TYPE test_composite_type AS (
i integer,

View File

@ -1,7 +1,7 @@
--
-- MULTI_DEPARSE_SHARD_QUERY
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 13100000;
SET citus.next_shard_id TO 13100000;
CREATE FUNCTION deparse_shard_query_test(text)
RETURNS VOID
AS 'citus'

View File

@ -2,7 +2,7 @@
-- MULTI_DROP_EXTENSION
--
-- Tests around dropping and recreating the extension
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 550000;
SET citus.next_shard_id TO 550000;
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);
SELECT master_create_distributed_table('testtableddl', 'distributecol', 'append');
master_create_distributed_table

View File

@ -1,6 +1,6 @@
-- Tests that check that our query functionality behaves as expected when the
-- table schema is modified via ALTER statements.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 620000;
SET citus.next_shard_id TO 620000;
SELECT count(*) FROM customer;
count
-------

View File

@ -1,7 +1,7 @@
---
--- MULTI_EXPIRE_TABLE_CACHE
---
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1220000;
SET citus.next_shard_id TO 1220000;
-- create test table
CREATE TABLE large_table(a int, b int);
SELECT master_create_distributed_table('large_table', 'a', 'hash');

View File

@ -1,7 +1,7 @@
--
-- MULTI_EXPLAIN
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 570000;
SET citus.next_shard_id TO 570000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -1,7 +1,7 @@
--
-- MULTI_EXPLAIN
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 570000;
SET citus.next_shard_id TO 570000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -5,7 +5,7 @@
--
-- It'd be nice to script generation of this file, but alas, that's
-- not done yet.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 580000;
SET citus.next_shard_id TO 580000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 580000;
CREATE SCHEMA test;
CREATE OR REPLACE FUNCTION test.maintenance_worker(p_dbname text DEFAULT current_database())

View File

@ -1,7 +1,7 @@
--
-- MULTI_FOREIGN_KEY
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1350000;
SET citus.next_shard_id TO 1350000;
-- set shard_count to 4 for faster tests, because we create/drop lots of shards in this test.
SET citus.shard_count TO 4;
-- create tables

View File

@ -1,7 +1,7 @@
--
-- MULTI_FUNCTION_EVALUATION
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1200000;
SET citus.next_shard_id TO 1200000;
-- nextval() works (no good way to test DEFAULT, or, by extension, SERIAL)
CREATE TABLE example (key INT, value INT);
SELECT master_create_distributed_table('example', 'key', 'hash');

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 610000;
SET citus.next_shard_id TO 610000;
-- ===================================================================
-- create test functions
-- ===================================================================

View File

@ -2,7 +2,7 @@
-- MULTI_HASH_PRUNING
--
-- Tests for shard and join pruning logic on hash partitioned tables.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 630000;
SET citus.next_shard_id TO 630000;
-- Create a table partitioned on integer column and update partition type to
-- hash. Then load data into this table and update shard min max values with
-- hashed ones. Hash value of 1, 2, 3 and 4 are consecutively -1905060026,

View File

@ -1,7 +1,7 @@
--
-- MULTI_HAVING_PUSHDOWN
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 590000;
SET citus.next_shard_id TO 590000;
CREATE TABLE lineitem_hash (LIKE lineitem);
SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash');
create_distributed_table

View File

@ -3,11 +3,11 @@
--
-- Check that we can run CREATE INDEX and DROP INDEX statements on distributed
-- tables.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 640000;
SET citus.next_shard_id TO 640000;
--
-- CREATE TEST TABLES
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 102080;
SET citus.next_shard_id TO 102080;
CREATE TABLE index_test_range(a int, b int, c int);
SELECT master_create_distributed_table('index_test_range', 'a', 'range');
master_create_distributed_table

View File

@ -1,8 +1,8 @@
--
-- MULTI_INSERT_SELECT
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 13300000;
ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 13300000;
SET citus.next_shard_id TO 13300000;
SET citus.next_placement_id TO 13300000;
-- create co-located tables
SET citus.shard_count = 4;
SET citus.shard_replication_factor = 2;

View File

@ -1,7 +1,7 @@
--
-- MULTI_JOIN_ORDER_ADDITIONAL
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 650000;
SET citus.next_shard_id TO 650000;
-- Set configuration to print table join order and pruned shards
SET citus.explain_distributed_queries TO off;
SET citus.log_multi_join_order TO TRUE;

View File

@ -1,7 +1,7 @@
--
-- MULTI_JOIN_ORDER_TPCH_LARGE
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 660000;
SET citus.next_shard_id TO 660000;
-- Enable configuration to print table join order
SET citus.explain_distributed_queries TO off;
SET citus.log_multi_join_order TO TRUE;

View File

@ -5,7 +5,7 @@
-- transaction block here so that we don't emit debug messages with changing
-- transaction ids in them. Also, we set the executor type to task tracker
-- executor here, as we cannot run repartition jobs with real time executor.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 690000;
SET citus.next_shard_id TO 690000;
SET citus.enable_unique_job_ids TO off;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset

View File

@ -5,7 +5,7 @@
-- transaction block here so that we don't emit debug messages with changing
-- transaction ids in them. Also, we set the executor type to task tracker
-- executor here, as we cannot run repartition jobs with real time executor.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 690000;
SET citus.next_shard_id TO 690000;
SET citus.enable_unique_job_ids TO off;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset

View File

@ -4,7 +4,7 @@
-- Tests covering partition and join-pruning for large table joins. Note that we
-- set executor type to task tracker executor here, as we cannot run repartition
-- jobs with real time executor.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 700000;
SET citus.next_shard_id TO 700000;
SET citus.large_table_shard_count TO 2;
SET client_min_messages TO DEBUG2;
SET citus.task_executor_type TO 'task-tracker';

View File

@ -5,7 +5,7 @@
-- and dual hash repartition joins. The tests also cover task assignment propagation
-- from a sql task to its depended tasks. Note that we set the executor type to task
-- tracker executor here, as we cannot run repartition jobs with real time executor.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 710000;
SET citus.next_shard_id TO 710000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -5,7 +5,7 @@
-- and dual hash repartition joins. The tests also cover task assignment propagation
-- from a sql task to its depended tasks. Note that we set the executor type to task
-- tracker executor here, as we cannot run repartition jobs with real time executor.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 710000;
SET citus.next_shard_id TO 710000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -2,7 +2,7 @@
-- MULTI_MASTER_PROTOCOL
--
-- Tests that check the metadata returned by the master node.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 740000;
SET citus.next_shard_id TO 740000;
SELECT part_storage_type, part_key, part_replica_count, part_max_size,
part_placement_policy FROM master_get_table_metadata('lineitem');
part_storage_type | part_key | part_replica_count | part_max_size | part_placement_policy

View File

@ -1,7 +1,7 @@
--
-- MULTI_METADATA_ACCESS
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1360000;
SET citus.next_shard_id TO 1360000;
CREATE USER no_access;
NOTICE: not propagating CREATE ROLE/USER commands to worker nodes
HINT: Connect to worker nodes directly to manually create all necessary users and roles.

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 750000;
SET citus.next_shard_id TO 750000;
-- ===================================================================
-- test end-to-end modification functionality
-- ===================================================================

View File

@ -3,7 +3,7 @@
--
-- Test user permissions.
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1420000;
SET citus.next_shard_id TO 1420000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1420000;
SET citus.shard_replication_factor TO 1;
SET citus.shard_count TO 2;

View File

@ -3,7 +3,7 @@
--
-- This test checks that we can handle null min/max values in shard statistics
-- and that we don't partition or join prune shards that have null values.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 760000;
SET citus.next_shard_id TO 760000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -3,7 +3,7 @@
--
-- This test checks that we can handle null min/max values in shard statistics
-- and that we don't partition or join prune shards that have null values.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 760000;
SET citus.next_shard_id TO 760000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -3,7 +3,7 @@
--
-- Tests to verify that we correctly prune unreferenced shards. For this, we
-- need to increase the logging verbosity of messages displayed on the client.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 770000;
SET citus.next_shard_id TO 770000;
-- Adding additional l_orderkey = 1 to make this query not router executable
SELECT l_orderkey, l_linenumber, l_shipdate FROM lineitem WHERE l_orderkey = 9030 or l_orderkey = 1;
l_orderkey | l_linenumber | l_shipdate

View File

@ -1,7 +1,7 @@
--
-- Distributed Partitioned Table Tests
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1660000;
SET citus.next_shard_id TO 1660000;
SET citus.shard_count TO 4;
SET citus.shard_replication_factor TO 1;
--

View File

@ -1,7 +1,7 @@
--
-- Distributed Partitioned Table Tests
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1660000;
SET citus.next_shard_id TO 1660000;
SET citus.shard_count TO 4;
SET citus.shard_replication_factor TO 1;
--

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 800000;
SET citus.next_shard_id TO 800000;
-- ===================================================================
-- create test functions
-- ===================================================================

View File

@ -5,7 +5,7 @@
-- on the master node for final processing. When the query completes or fails,
-- the resource owner should automatically clean up these intermediate query
-- result files.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 810000;
SET citus.next_shard_id TO 810000;
SET citus.enable_unique_job_ids TO off;
BEGIN;
-- pg_ls_dir() displays jobids. We explicitly set the jobId sequence

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1600000;
SET citus.next_shard_id TO 1600000;
\c "dbname=regression options='-c\ citus.use_secondary_nodes=always'"
CREATE TABLE dest_table (a int, b int);
CREATE TABLE source_table (a int, b int);

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1250000;
SET citus.next_shard_id TO 1250000;
CREATE TABLE reference_table_test (value_1 int, value_2 float, value_3 text, value_4 timestamp);
-- insert some data, and make sure that cannot be create_distributed_table
INSERT INTO reference_table_test VALUES (1, 1.0, '1', '2016-12-01');

View File

@ -2,7 +2,7 @@
-- MULTI_REMOVE_NODE_REFERENCE_TABLE
--
-- Tests that check the metadata after master_remove_node.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1380000;
SET citus.next_shard_id TO 1380000;
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1380000;
ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART 1380000;
ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART 1380000;
@ -711,6 +711,7 @@ WHERE
\c - - - :master_port
SET citus.next_shard_id TO 1380001;
-- verify table structure is changed
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.remove_node_reference_table'::regclass;
Column | Type | Modifiers

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 820000;
SET citus.next_shard_id TO 820000;
SELECT groupid AS worker_2_group FROM pg_dist_node WHERE nodeport=:worker_2_port \gset
SELECT groupid AS worker_1_group FROM pg_dist_node WHERE nodeport=:worker_1_port \gset
-- ===================================================================

View File

@ -1,7 +1,7 @@
--
-- MULTI_REPARTITION_UDT
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 535000;
SET citus.next_shard_id TO 535000;
-- START type creation
CREATE TYPE test_udt AS (i integer, i2 integer);
-- ... as well as a function to use as its comparator...

View File

@ -1,7 +1,7 @@
--
-- MULTI_REPARTITIONED_SUBQUERY_UDF
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 830000;
SET citus.next_shard_id TO 830000;
-- Create UDF in master and workers
\c - - - :master_port
DROP FUNCTION IF EXISTS median(double precision[]);

View File

@ -2,7 +2,7 @@
-- MULTI_REPLICATE_REFERENCE_TABLE
--
-- Tests that check the metadata returned by the master node.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1370000;
SET citus.next_shard_id TO 1370000;
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1370000;
ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART 1370000;
ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART 1370000;

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 840000;
SET citus.next_shard_id TO 840000;
-- ===================================================================
-- test router planner functionality for single shard select queries
-- ===================================================================

View File

@ -1,7 +1,7 @@
--
-- MULTI_SHARD_MODIFY
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 350000;
SET citus.next_shard_id TO 350000;
-- Create a new hash partitioned multi_shard_modify_test table and load data into it.
CREATE TABLE multi_shard_modify_test (
t_key integer not null,
@ -294,4 +294,4 @@ SELECT master_modify_multiple_shards('DELETE FROM multi_shard_modify_test WHERE
1
(1 row)
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 102046;
SET citus.next_shard_id TO 102046;

View File

@ -2,7 +2,7 @@
-- multi shard update delete
-- this file is intended to test multi shard update/delete queries
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1440000;
SET citus.next_shard_id TO 1440000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1440000;
SET citus.shard_replication_factor to 1;
SET citus.multi_shard_modify_mode to 'parallel';

View File

@ -2,7 +2,7 @@
-- multi shard update delete
-- this file is intended to test multi shard update/delete queries
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1440000;
SET citus.next_shard_id TO 1440000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1440000;
SET citus.shard_replication_factor to 1;
SET citus.multi_shard_modify_mode to 'parallel';

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 850000;
SET citus.next_shard_id TO 850000;
-- ===================================================================
-- test end-to-end query functionality
-- ===================================================================

View File

@ -2,7 +2,7 @@
-- MULTI_SINGLE_RELATION_SUBQUERY
--
-- This test checks that we are able to run selected set of distributed SQL subqueries.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 860000;
SET citus.next_shard_id TO 860000;
SET citus.task_executor_type TO 'task-tracker';
select
number_sum,

View File

@ -4,7 +4,7 @@
-- Test checks whether size of distributed tables can be obtained with citus_table_size.
-- To find the relation size and total relation size citus_relation_size and
-- citus_total_relation_size are also tested.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1390000;
SET citus.next_shard_id TO 1390000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1390000;
-- Tests with invalid relation IDs
SELECT citus_table_size(1);

View File

@ -1,7 +1,7 @@
--
-- MULTI_SQL_FUNCTION
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1230000;
SET citus.next_shard_id TO 1230000;
CREATE FUNCTION sql_test_no_1() RETURNS bigint AS '
SELECT
count(*)

View File

@ -2,6 +2,7 @@
-- MULTI_SUBQUERY
--
-- no need to set shardid sequence given that we're not creating any shards
SET citus.next_shard_id TO 570032;
SET citus.enable_router_execution TO FALSE;
-- Check that we error out if shard min/max values are not exactly same.
SELECT

View File

@ -4,7 +4,7 @@
-- the tables that are used depends to multi_insert_select_behavioral_analytics_create_table.sql
--
-- We don't need shard id sequence here, so commented out to prevent conflicts with concurrent tests
-- ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1400000;
-- SET citus.next_shard_id TO 1400000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1400000;
SET citus.enable_router_execution TO FALSE;

View File

@ -4,7 +4,7 @@
-- the tables that are used depends to multi_insert_select_behavioral_analytics_create_table.sql
--
-- We don't need shard id sequence here, so commented out to prevent conflicts with concurrent tests
-- ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1400000;
-- SET citus.next_shard_id TO 1400000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1400000;
SET citus.enable_router_execution TO FALSE;
CREATE TABLE user_buy_test_table(user_id int, item_id int, buy_count int);

View File

@ -3,7 +3,7 @@
-- regression tests to cover more cases
-- the tables that are used depends to multi_insert_select_behavioral_analytics_create_table.sql
-- We don't need shard id sequence here, so commented out to prevent conflicts with concurrent tests
-- ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1400000;
-- SET citus.next_shard_id TO 1400000;
SET citus.enable_router_execution TO false;
-- a very simple union query
SELECT user_id, counter

View File

@ -2,7 +2,7 @@
-- MULTI_TABLE_DDL
--
-- Tests around changing the schema and dropping of a distributed table
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 870000;
SET citus.next_shard_id TO 870000;
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);
SELECT master_create_distributed_table('testtableddl', 'distributecol', 'append');
master_create_distributed_table

View File

@ -1,7 +1,7 @@
--
-- MULTI_TASK_ASSIGNMENT
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 880000;
SET citus.next_shard_id TO 880000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -1,7 +1,7 @@
--
-- MULTI_TASK_ASSIGNMENT
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 880000;
SET citus.next_shard_id TO 880000;
-- print whether we're using version > 9 to make version-specific tests clear
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 9 AS version_above_nine;

View File

@ -1,7 +1,7 @@
--
-- MULTI_TASK_STRING_SIZE
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1602000;
SET citus.next_shard_id TO 1602000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1602000;
CREATE TABLE wide_table
(

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1220000;
SET citus.next_shard_id TO 1220000;
-- Tests for prepared transaction recovery
-- Ensure pg_dist_transaction is empty for test
SELECT recover_prepared_transactions();

View File

@ -1,7 +1,7 @@
--
-- MULTI_TRUNCATE
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1210000;
SET citus.next_shard_id TO 1210000;
--
-- truncate for append distribution
-- expect all shards to be dropped

View File

@ -2,7 +2,7 @@
-- MULTI_UNSUPPORTED_WORKER_OPERATIONS
--
-- Tests for ensuring unsupported functions on workers error out.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1270000;
SET citus.next_shard_id TO 1270000;
ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART 1370000;
ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART 1370000;
-- Set the colocation id to a safe value so that

View File

@ -1,5 +1,5 @@
-- this test file aims to test UPSERT feature on Citus
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 980000;
SET citus.next_shard_id TO 980000;
CREATE TABLE upsert_test
(
part_key int UNIQUE,

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 990000;
SET citus.next_shard_id TO 990000;
-- ===================================================================
-- test utility statement functionality
-- ===================================================================

View File

@ -4,7 +4,7 @@
-- Check that we can run utility statements with embedded SELECT statements on
-- distributed tables. Currently we only support CREATE TABLE AS (SELECT..),
-- DECLARE CURSOR, and COPY ... TO statements.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1000000;
SET citus.next_shard_id TO 1000000;
CREATE TEMP TABLE lineitem_pricing_summary AS
(
SELECT

View File

@ -3,7 +3,7 @@
--
-- Tests to check if we inform the user about potential caveats of creating new
-- databases, schemas, and roles.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1010000;
SET citus.next_shard_id TO 1010000;
CREATE DATABASE new_database;
NOTICE: Citus partially supports CREATE DATABASE for distributed databases
DETAIL: Citus does not propagate CREATE DATABASE command to workers

View File

@ -1,7 +1,7 @@
--
-- TASK_TRACKER_CLEANUP_JOB
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1060000;
SET citus.next_shard_id TO 1060000;
\set JobId 401010
\set CompletedTaskId 801107
\set RunningTaskId 801108

View File

@ -1,7 +1,7 @@
--
-- TASK_TRACKER_CREATE_TABLE
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1070000;
SET citus.next_shard_id TO 1070000;
-- New table definitions to test the task tracker process and protocol
CREATE TABLE lineitem_simple_task ( LIKE lineitem );
CREATE TABLE lineitem_compute_task ( LIKE lineitem );

View File

@ -1,7 +1,7 @@
--
-- WORKER_CHECK_INVALID_ARGUMENTS
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1100000;
SET citus.next_shard_id TO 1100000;
\set JobId 201010
\set TaskId 101108
\set Table_Name simple_binary_data_table

View File

@ -4,7 +4,7 @@
-- Create new table definitions for lineitem and supplier tables to test worker
-- node execution logic. For now,the tests include range and hash partitioning
-- of existing tables.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1110000;
SET citus.next_shard_id TO 1110000;
CREATE TABLE lineitem (
l_orderkey bigint not null,
l_partkey integer not null,

View File

@ -3,7 +3,7 @@
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 230000;
SET citus.next_shard_id TO 230000;
-- Initialize tables to join

View File

@ -2,7 +2,7 @@
-- multi behavioral analytics
-- this file is intended to create the table requires for the tests
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1400000;
SET citus.next_shard_id TO 1400000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1400000;
SET citus.shard_replication_factor = 1;
SET citus.shard_count = 4;

View File

@ -3,7 +3,7 @@
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 240000;
SET citus.next_shard_id TO 240000;
CREATE TABLE lineitem_hash (

View File

@ -1,5 +1,5 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 250000;
SET citus.next_shard_id TO 250000;
CREATE SCHEMA tpch

View File

@ -6,7 +6,7 @@
-- citus.shard_max_size. These values are set in pg_regress_multi.pl. Shard placement
-- policy is left to the default value (round-robin) to test the common install case.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 290000;
SET citus.next_shard_id TO 290000;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|'

View File

@ -6,7 +6,7 @@
-- are creating shards of correct size even when records are large.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 300000;
SET citus.next_shard_id TO 300000;
SET citus.shard_max_size TO "256kB";

View File

@ -3,7 +3,7 @@
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 280000;
SET citus.next_shard_id TO 280000;
-- We load more data to customer and part tables to test distributed joins. The

View File

@ -3,7 +3,7 @@
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 320000;
SET citus.next_shard_id TO 320000;
-- Create a new range partitioned customer_delete_protocol table and load data into it.

View File

@ -1,5 +1,5 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 310000;
SET citus.next_shard_id TO 310000;
SET citus.large_table_shard_count TO 2;

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1260000;
SET citus.next_shard_id TO 1260000;
SET citus.log_multi_join_order to true;
SET client_min_messages TO LOG;

View File

@ -3,7 +3,7 @@
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 260000;
SET citus.next_shard_id TO 260000;
COPY lineitem FROM '@abs_srcdir@/data/lineitem.1.data' WITH DELIMITER '|';

View File

@ -1,7 +1,7 @@
--
-- MULTI_APPEND_TABLE_TO_SHARD
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 230000;
SET citus.next_shard_id TO 230000;
-- Initialize tables to join
CREATE TABLE multi_append_table_to_shard_right
(

View File

@ -2,7 +2,7 @@
-- multi behavioral analytics
-- this file is intended to create the table requires for the tests
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1400000;
SET citus.next_shard_id TO 1400000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1400000;
SET citus.shard_replication_factor = 1;
SET citus.shard_count = 4;

View File

@ -1,7 +1,7 @@
--
-- COMPLEX_COUNT_DISTINCT
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 240000;
SET citus.next_shard_id TO 240000;
CREATE TABLE lineitem_hash (
l_orderkey bigint not null,
l_partkey integer not null,

View File

@ -1,4 +1,4 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 250000;
SET citus.next_shard_id TO 250000;
CREATE SCHEMA tpch
CREATE TABLE nation (
n_nationkey integer not null,

View File

@ -5,7 +5,7 @@
-- of shards uploaded depends on two config values: citus.shard_replication_factor and
-- citus.shard_max_size. These values are set in pg_regress_multi.pl. Shard placement
-- policy is left to the default value (round-robin) to test the common install case.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 290000;
SET citus.next_shard_id TO 290000;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|'
\copy orders FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|'

View File

@ -4,7 +4,7 @@
-- Tests for loading data with large records (i.e. greater than the read buffer
-- size, which is 32kB) in a distributed cluster. These tests make sure that we
-- are creating shards of correct size even when records are large.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 300000;
SET citus.next_shard_id TO 300000;
SET citus.shard_max_size TO "256kB";
CREATE TABLE large_records_table (data_id integer, data text);
SELECT master_create_distributed_table('large_records_table', 'data_id', 'append');

View File

@ -1,7 +1,7 @@
--
-- MULTI_STAGE_MORE_DATA
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 280000;
SET citus.next_shard_id TO 280000;
-- We load more data to customer and part tables to test distributed joins. The
-- loading causes the planner to consider customer and part tables as large, and
-- evaluate plans where some of the underlying tables need to be repartitioned.

View File

@ -1,7 +1,7 @@
--
-- MULTI_MASTER_DELETE_PROTOCOL
--
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 320000;
SET citus.next_shard_id TO 320000;
-- Create a new range partitioned customer_delete_protocol table and load data into it.
CREATE TABLE customer_delete_protocol (
c_custkey integer not null,

Some files were not shown because too many files have changed in this diff Show More