Merge remote-tracking branch 'origin/main' into circleci-gha-migration

pull/7154/head
Gokhan Gulbiz 2023-08-21 12:36:55 +03:00
commit eb6cb489dc
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
16 changed files with 228 additions and 50 deletions

View File

@ -6,16 +6,19 @@ orbs:
parameters:
image_suffix:
type: string
default: '-v1b94240'
default: '-v0c8d80c'
pg14_version:
type: string
default: '14.9'
pg15_version:
type: string
default: '15.4'
pg16_version:
type: string
default: '16beta3'
upgrade_pg_versions:
type: string
default: '14.9-15.4'
default: '14.9-15.4-16beta3'
style_checker_tools_version:
type: string
default: '0.8.18'
@ -721,6 +724,10 @@ workflows:
name: build-15
pg_major: 15
image_tag: '<< pipeline.parameters.pg15_version >>'
- build:
name: build-16
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
- check-style
- check-sql-snapshots
@ -871,6 +878,79 @@ workflows:
image: citus/failtester
make: check-failure
- test-citus: &test-citus-16
name: 'test-16_check-split'
make: check-split
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
requires: [build-16]
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise'
make: check-enterprise
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise-isolation'
make: check-enterprise-isolation
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise-isolation-logicalrep-1'
make: check-enterprise-isolation-logicalrep-1
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise-isolation-logicalrep-2'
make: check-enterprise-isolation-logicalrep-2
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise-isolation-logicalrep-3'
make: check-enterprise-isolation-logicalrep-3
- test-citus:
<<: *test-citus-16
name: 'test-16_check-enterprise-failure'
image: citus/failtester
make: check-enterprise-failure
- test-citus:
<<: *test-citus-16
name: 'test-16_check-multi'
make: check-multi
- test-citus:
<<: *test-citus-16
name: 'test-16_check-multi-1'
make: check-multi-1
- test-citus:
<<: *test-citus-16
name: 'test-16_check-mx'
make: check-multi-mx
- test-citus:
<<: *test-citus-16
name: 'test-16_check-vanilla'
make: check-vanilla
- test-citus:
<<: *test-citus-16
name: 'test-16_check-isolation'
make: check-isolation
- test-citus:
<<: *test-citus-16
name: 'test-16_check-operations'
make: check-operations
- test-citus:
<<: *test-citus-16
name: 'test-16_check-follower-cluster'
make: check-follower-cluster
- test-citus:
<<: *test-citus-16
name: 'test-16_check-columnar'
make: check-columnar
- test-citus:
<<: *test-citus-16
name: 'test-16_check-columnar-isolation'
make: check-columnar-isolation
- test-citus:
<<: *test-citus-16
name: 'test-16_check-failure'
image: citus/failtester
make: check-failure
- test-pytest:
name: 'test-14_pytest'
pg_major: 14
@ -883,6 +963,12 @@ workflows:
image_tag: '<< pipeline.parameters.pg15_version >>'
requires: [build-15]
- test-pytest:
name: 'test-16_pytest'
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
requires: [build-16]
- tap-test-citus:
name: 'test-15_tap-cdc'
suite: cdc
@ -890,6 +976,13 @@ workflows:
image_tag: '<< pipeline.parameters.pg15_version >>'
requires: [build-15]
- tap-test-citus:
name: 'test-16_tap-cdc'
suite: cdc
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
requires: [build-16]
- test-arbitrary-configs:
name: 'test-14_check-arbitrary-configs'
pg_major: 14
@ -902,6 +995,12 @@ workflows:
image_tag: '<< pipeline.parameters.pg15_version >>'
requires: [build-15]
- test-arbitrary-configs:
name: 'test-16_check-arbitrary-configs'
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
requires: [build-16]
- test-query-generator:
name: 'test-14_check-query-generator'
pg_major: 14
@ -914,6 +1013,12 @@ workflows:
image_tag: '<< pipeline.parameters.pg15_version >>'
requires: [build-15]
- test-query-generator:
name: 'test-16_check-query-generator'
pg_major: 16
image_tag: '<< pipeline.parameters.pg16_version >>'
requires: [build-16]
- test-pg-upgrade:
name: 'test-14-15_check-pg-upgrade'
old_pg_major: 14
@ -921,6 +1026,20 @@ workflows:
image_tag: '<< pipeline.parameters.upgrade_pg_versions >>'
requires: [build-14, build-15]
- test-pg-upgrade:
name: 'test-15-16_check-pg-upgrade'
old_pg_major: 15
new_pg_major: 16
image_tag: '<< pipeline.parameters.upgrade_pg_versions >>'
requires: [build-15, build-16]
- test-pg-upgrade:
name: 'test-14-16_check-pg-upgrade'
old_pg_major: 14
new_pg_major: 16
image_tag: '<< pipeline.parameters.upgrade_pg_versions >>'
requires: [build-14, build-16]
- test-citus-upgrade:
name: test-14_check-citus-upgrade
pg_major: 14
@ -967,7 +1086,28 @@ workflows:
- test-15_check-split
- test-15_check-arbitrary-configs
- test-15_check-query-generator
- test-16_check-multi
- test-16_check-multi-1
- test-16_check-mx
- test-16_check-vanilla
- test-16_check-isolation
- test-16_check-operations
- test-16_check-follower-cluster
- test-16_check-columnar
- test-16_check-columnar-isolation
- test-16_check-failure
- test-16_check-enterprise
- test-16_check-enterprise-isolation
- test-16_check-enterprise-isolation-logicalrep-1
- test-16_check-enterprise-isolation-logicalrep-2
- test-16_check-enterprise-isolation-logicalrep-3
- test-16_check-enterprise-failure
- test-16_check-split
- test-16_check-arbitrary-configs
- test-16_check-query-generator
- test-14-15_check-pg-upgrade
- test-15-16_check-pg-upgrade
- test-14-16_check-pg-upgrade
- test-14_check-citus-upgrade
- ch_benchmark:

2
configure vendored
View File

@ -2588,7 +2588,7 @@ fi
if test "$with_pg_version_check" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: building against PostgreSQL $version_num (skipped compatibility check)" >&5
$as_echo "$as_me: building against PostgreSQL $version_num (skipped compatibility check)" >&6;}
elif test "$version_num" != '14' -a "$version_num" != '15'; then
elif test "$version_num" != '14' -a "$version_num" != '15' -a "$version_num" != '16'; then
as_fn_error $? "Citus is not compatible with the detected PostgreSQL version ${version_num}." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: building against PostgreSQL $version_num" >&5

View File

@ -80,7 +80,7 @@ AC_SUBST(with_pg_version_check)
if test "$with_pg_version_check" = no; then
AC_MSG_NOTICE([building against PostgreSQL $version_num (skipped compatibility check)])
elif test "$version_num" != '14' -a "$version_num" != '15'; then
elif test "$version_num" != '14' -a "$version_num" != '15' -a "$version_num" != '16'; then
AC_MSG_ERROR([Citus is not compatible with the detected PostgreSQL version ${version_num}.])
else
AC_MSG_NOTICE([building against PostgreSQL $version_num])

View File

@ -72,7 +72,7 @@ DistShardRelationId(void)
/*
* DistShardRelationId returns the relation id of the pg_dist_shard
* DistShardShardidIndexId returns the relation id of the pg_dist_shard_shardid_index
*/
static Oid
DistShardShardidIndexId(void)
@ -87,7 +87,7 @@ DistShardShardidIndexId(void)
/*
* DistShardRelationId returns the relation id of the pg_dist_shard
* DistPartitionRelationId returns the relation id of the pg_dist_partition
*/
static Oid
DistPartitionRelationId(void)
@ -376,7 +376,8 @@ CdcIsReferenceTableViaCatalog(Oid relationId)
* A table is a reference table when its partition method is 'none'
* and replication model is 'two phase commit'
*/
return partitionMethodChar == 'n' && replicationModelChar == 't';
return partitionMethodChar == DISTRIBUTE_BY_NONE &&
replicationModelChar == REPLICATION_MODEL_2PC;
}

View File

@ -561,7 +561,7 @@ ReindexStmtFindRelationOid(ReindexStmt *reindexStmt, bool missingOk)
{
relationId = RangeVarGetRelidExtended(reindexStmt->relation, lockmode,
(missingOk) ? RVR_MISSING_OK : 0,
RANGE_VAR_TABLE_CALLBACK, NULL);
RangeVarCallbackOwnsTable, NULL);
}
return relationId;

View File

@ -4987,8 +4987,8 @@ CitusTableTypeIdList(CitusTableType citusTableType)
Datum replicationModelDatum = datumArray[Anum_pg_dist_partition_repmodel - 1];
Datum colocationIdDatum = datumArray[Anum_pg_dist_partition_colocationid - 1];
Oid partitionMethod = DatumGetChar(partMethodDatum);
Oid replicationModel = DatumGetChar(replicationModelDatum);
char partitionMethod = DatumGetChar(partMethodDatum);
char replicationModel = DatumGetChar(replicationModelDatum);
uint32 colocationId = DatumGetUInt32(colocationIdDatum);
if (IsCitusTableTypeInternal(partitionMethod, replicationModel, colocationId,

View File

@ -1414,6 +1414,12 @@ RelationInfoContainsOnlyRecurringTuples(PlannerInfo *plannerInfo, Relids relids)
while ((relationId = bms_next_member(relids, relationId)) >= 0)
{
/* outer join RTE check in PG16 */
if (IsRelOptOuterJoin(plannerInfo, relationId))
{
continue;
}
RangeTblEntry *rangeTableEntry = plannerInfo->simple_rte_array[relationId];
if (FindNodeMatchingCheckFunctionInRangeTableList(list_make1(rangeTableEntry),

View File

@ -171,8 +171,6 @@ static bool FindQueryContainingRTEIdentityInternal(Node *node,
static int ParentCountPriorToAppendRel(List *appendRelList, AppendRelInfo *appendRelInfo);
static bool IsVarRelOptOuterJoin(PlannerInfo *root, Var *varToBeAdded);
/*
* AllDistributionKeysInQueryAreEqual returns true if either
@ -1241,7 +1239,7 @@ AddToAttributeEquivalenceClass(AttributeEquivalenceClass *attributeEquivalenceCl
}
/* outer join checks in PG16 */
if (IsVarRelOptOuterJoin(root, varToBeAdded))
if (IsRelOptOuterJoin(root, varToBeAdded->varno))
{
return;
}
@ -1388,19 +1386,19 @@ GetTargetSubquery(PlannerInfo *root, RangeTblEntry *rangeTableEntry, Var *varToB
/*
* IsVarRelOptOuterJoin returns true if the Var to be added
* is an outer join, false otherwise.
* IsRelOptOuterJoin returns true if the RelOpt referenced
* by varNo is an outer join, false otherwise.
*/
static bool
IsVarRelOptOuterJoin(PlannerInfo *root, Var *varToBeAdded)
bool
IsRelOptOuterJoin(PlannerInfo *root, int varNo)
{
#if PG_VERSION_NUM >= PG_VERSION_16
if (root->simple_rel_array_size <= varToBeAdded->varno)
if (root->simple_rel_array_size <= varNo)
{
return true;
}
RelOptInfo *rel = root->simple_rel_array[varToBeAdded->varno];
RelOptInfo *rel = root->simple_rel_array[varNo];
if (rel == NULL)
{
/* must be an outer join */

View File

@ -156,7 +156,7 @@ struct TableDDLCommand
/*
* This union contains one (1) typed field for every implementation for
* TableDDLCommand. A union enforces no overloading of fields but instead requiers at
* TableDDLCommand. A union enforces no overloading of fields but instead requires at
* most one of the fields to be used at any time.
*/
union

View File

@ -20,6 +20,7 @@
extern bool AllDistributionKeysInQueryAreEqual(Query *originalQuery,
PlannerRestrictionContext *
plannerRestrictionContext);
extern bool IsRelOptOuterJoin(PlannerInfo *root, int varNo);
extern bool SafeToPushdownUnionSubquery(Query *originalQuery, PlannerRestrictionContext *
plannerRestrictionContext);
extern bool ContainsUnionSubquery(Query *queryTree);

View File

@ -27,8 +27,6 @@
#define float_abs(a) fabs(a)
#define RANGE_VAR_TABLE_CALLBACK RangeVarCallbackMaintainsTable
#define tuplesort_getdatum_compat(a, b, c, d, e, f) tuplesort_getdatum(a, b, c, d, e, f)
static inline struct config_generic **
@ -57,8 +55,6 @@ get_guc_variables_compat(int *gucCount)
#include "utils/guc.h"
#include "utils/guc_tables.h"
#define RANGE_VAR_TABLE_CALLBACK RangeVarCallbackOwnsTable
#define pg_clean_ascii_compat(a, b) pg_clean_ascii(a)
#define RelationPhysicalIdentifier_compat(a) ((a)->rd_node)

View File

@ -9,6 +9,13 @@ use cdctestlib;
use threads;
my $pg_major_version = int($ENV{'pg_major_version'});
print("working with PG major version : $pg_major_version\n");
if ($pg_major_version >= 16) {
plan skip_all => 'wal2json is not available for PG16 yet';
exit 0;
}
# Initialize co-ordinator node
my $select_stmt = qq(SELECT * FROM data_100008 ORDER BY id;);
my $result = 0;

View File

@ -92,6 +92,7 @@ PG_MAJOR_VERSION = get_pg_major_version()
OLDEST_SUPPORTED_CITUS_VERSION_MATRIX = {
14: "10.2.0",
15: "11.1.5",
16: "12.1devel",
}
OLDEST_SUPPORTED_CITUS_VERSION = OLDEST_SUPPORTED_CITUS_VERSION_MATRIX[PG_MAJOR_VERSION]

View File

@ -698,9 +698,17 @@ master_remove_node
(1 row)
starting permutation: s1-add-node-1 s1-begin s1-disable-node-1 s2-disable-node-1 s1-abort s1-show-nodes
starting permutation: s1-add-node-1 s1-add-node-2 s1-begin s1-disable-node-2 s2-disable-node-2 s1-abort s2-wait-metadata-sync s1-show-nodes
step s1-add-node-1:
SELECT 1 FROM master_add_node('localhost', 57637);
SELECT 1 FROM master_add_node('localhost', 57637);
?column?
---------------------------------------------------------------------
1
(1 row)
step s1-add-node-2:
SELECT 1 FROM master_add_node('localhost', 57638);
?column?
---------------------------------------------------------------------
@ -708,11 +716,11 @@ step s1-add-node-1:
(1 row)
step s1-begin:
BEGIN;
BEGIN;
step s1-disable-node-1:
SELECT 1 FROM master_disable_node('localhost', 57637);
SELECT public.wait_until_metadata_sync();
step s1-disable-node-2:
SELECT 1 FROM master_disable_node('localhost', 57638);
SELECT public.wait_until_metadata_sync();
?column?
---------------------------------------------------------------------
@ -724,34 +732,38 @@ wait_until_metadata_sync
(1 row)
step s2-disable-node-1:
SELECT 1 FROM master_disable_node('localhost', 57637);
SELECT public.wait_until_metadata_sync();
step s2-disable-node-2:
SELECT 1 FROM master_disable_node('localhost', 57638);
<waiting ...>
step s1-abort:
ABORT;
ABORT;
step s2-disable-node-1: <... completed>
step s2-disable-node-2: <... completed>
?column?
---------------------------------------------------------------------
1
(1 row)
step s2-wait-metadata-sync:
SELECT public.wait_until_metadata_sync();
wait_until_metadata_sync
---------------------------------------------------------------------
(1 row)
step s1-show-nodes:
SELECT nodename, nodeport, isactive FROM pg_dist_node ORDER BY nodename, nodeport;
SELECT nodename, nodeport, isactive FROM pg_dist_node ORDER BY nodename, nodeport;
nodename |nodeport|isactive
---------------------------------------------------------------------
localhost| 57637|f
(1 row)
localhost| 57637|t
localhost| 57638|f
(2 rows)
master_remove_node
---------------------------------------------------------------------
(1 row)
(2 rows)

View File

@ -3,8 +3,8 @@ Parsed test spec with 3 sessions
starting permutation: s1-begin s1-update-node-1 s2-update-node-2 s1-commit s1-show-nodes s3-update-node-1-back s3-update-node-2-back s3-manually-fix-metadata
nodeid|nodename |nodeport
---------------------------------------------------------------------
22|localhost| 57638
21|localhost| 57637
23|localhost| 57638
22|localhost| 57637
(2 rows)
step s1-begin:
@ -43,8 +43,8 @@ step s1-show-nodes:
nodeid|nodename |nodeport|isactive
---------------------------------------------------------------------
21|localhost| 58637|t
22|localhost| 58638|t
22|localhost| 58637|t
23|localhost| 58638|t
(2 rows)
step s3-update-node-1-back:
@ -93,8 +93,8 @@ nodeid|nodename|nodeport
starting permutation: s1-begin s1-update-node-1 s2-begin s2-update-node-1 s1-commit s2-abort s1-show-nodes s3-update-node-1-back s3-manually-fix-metadata
nodeid|nodename |nodeport
---------------------------------------------------------------------
24|localhost| 57638
23|localhost| 57637
25|localhost| 57638
24|localhost| 57637
(2 rows)
step s1-begin:
@ -139,8 +139,8 @@ step s1-show-nodes:
nodeid|nodename |nodeport|isactive
---------------------------------------------------------------------
24|localhost| 57638|t
23|localhost| 58637|t
25|localhost| 57638|t
24|localhost| 58637|t
(2 rows)
step s3-update-node-1-back:
@ -178,8 +178,8 @@ nodeid|nodename|nodeport
starting permutation: s2-create-table s1-begin s1-update-node-nonexistent s1-prepare-transaction s2-cache-prepared-statement s1-commit-prepared s2-execute-prepared s1-update-node-existent s3-manually-fix-metadata
nodeid|nodename |nodeport
---------------------------------------------------------------------
26|localhost| 57638
25|localhost| 57637
27|localhost| 57638
26|localhost| 57637
(2 rows)
step s2-create-table:

View File

@ -45,6 +45,12 @@ step "s1-disable-node-1"
SELECT public.wait_until_metadata_sync();
}
step "s1-disable-node-2"
{
SELECT 1 FROM master_disable_node('localhost', 57638);
SELECT public.wait_until_metadata_sync();
}
step "s1-remove-node-1"
{
SELECT * FROM master_remove_node('localhost', 57637);
@ -88,6 +94,16 @@ step "s2-disable-node-1"
SELECT public.wait_until_metadata_sync();
}
step "s2-disable-node-2"
{
SELECT 1 FROM master_disable_node('localhost', 57638);
}
step "s2-wait-metadata-sync"
{
SELECT public.wait_until_metadata_sync();
}
step "s2-remove-node-1"
{
SELECT * FROM master_remove_node('localhost', 57637);
@ -135,4 +151,4 @@ permutation "s1-add-inactive-1" "s1-begin" "s1-disable-node-1" "s2-activate-node
permutation "s1-add-inactive-1" "s1-begin" "s1-activate-node-1" "s2-disable-node-1" "s1-commit" "s1-show-nodes"
// disable an active node from 2 transactions, one aborts
permutation "s1-add-node-1" "s1-begin" "s1-disable-node-1" "s2-disable-node-1" "s1-abort" "s1-show-nodes"
permutation "s1-add-node-1" "s1-add-node-2" "s1-begin" "s1-disable-node-2" "s2-disable-node-2" "s1-abort" "s2-wait-metadata-sync" "s1-show-nodes"