Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Implement DOMAIN propagation for citus
Browse files Browse the repository at this point in the history
  • Loading branch information
thanodnl committed Apr 8, 2022
1 parent 6d8c593 commit 8897361
Show file tree
Hide file tree
Showing 26 changed files with 3,295 additions and 180 deletions.
9 changes: 9 additions & 0 deletions src/backend/distributed/commands/dependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
return CreateCollationDDLsIdempotent(dependency->objectId);
}

case OCLASS_CONSTRAINT:
{
/*
* Constraints can only be reached by domains, they resolve functions.
* Constraints themself are recreated by the domain recreation.
*/
return NIL;
}

case OCLASS_DATABASE:
{
List *databaseDDLCommands = NIL;
Expand Down
92 changes: 92 additions & 0 deletions src/backend/distributed/commands/distribute_object_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ static DistributeObjectOps Any_CompositeType = {
.address = CompositeTypeStmtObjectAddress,
.markDistributed = true,
};
static DistributeObjectOps Any_CreateDomain = {
.deparse = DeparseCreateDomainStmt,
.qualify = QualifyCreateDomainStmt,
.preprocess = PreprocessCreateDomainStmt,
.postprocess = PostprocessCreateDomainStmt,
.address = CreateDomainStmtObjectAddress,
.markDistributed = true,
};
static DistributeObjectOps Any_CreateEnum = {
.deparse = DeparseCreateEnumStmt,
.qualify = QualifyCreateEnumStmt,
Expand Down Expand Up @@ -305,6 +313,55 @@ static DistributeObjectOps Database_AlterOwner = {
.address = AlterDatabaseOwnerObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps Domain_Alter = {
.deparse = DeparseAlterDomainStmt,
.qualify = QualifyAlterDomainStmt,
.preprocess = PreprocessAlterDomainStmt,
.postprocess = PostprocessAlterDomainStmt,
.address = AlterDomainStmtObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps Domain_AlterObjectSchema = {
.deparse = DeparseAlterDomainSchemaStmt,
.qualify = QualifyAlterDomainSchemaStmt,
.preprocess = PreprocessAlterDomainSchemaStmt,
.postprocess = PostprocessAlterDomainSchemaStmt,
.address = AlterTypeSchemaStmtObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps Domain_AlterOwner = {
.deparse = DeparseAlterDomainOwnerStmt,
.qualify = QualifyAlterDomainOwnerStmt,
.preprocess = PreprocessAlterDomainOwnerStmt,
.postprocess = PostprocessAlterDomainOwnerStmt,
.address = AlterDomainOwnerStmtObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps Domain_Drop = {
.deparse = DeparseDropDomainStmt,
.qualify = QualifyDropDomainStmt,
.preprocess = PreprocessDropDomainStmt,
.postprocess = NULL,
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps Domain_Rename = {
.deparse = DeparseRenameDomainStmt,
.qualify = QualifyRenameDomainStmt,
.preprocess = PreprocessRenameDomainStmt,
.postprocess = NULL,
.address = RenameDomainStmtObjectAddress,
.markDistributed = false,
};

static DistributeObjectOps Domain_RenameConstraint = {
.deparse = DeparseDomainRenameConstraintStmt,
.qualify = QualifyDomainRenameConstraintStmt,
.preprocess = PreprocessDomainRenameConstraintStmt,
.postprocess = NULL,
.address = DomainRenameConstraintStmtObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps Extension_AlterObjectSchema = {
.deparse = DeparseAlterExtensionSchemaStmt,
.qualify = NULL,
Expand Down Expand Up @@ -815,6 +872,11 @@ GetDistributeObjectOps(Node *node)
{
switch (nodeTag(node))
{
case T_AlterDomainStmt:
{
return &Domain_Alter;
}

case T_AlterEnumStmt:
{
return &Any_AlterEnum;
Expand Down Expand Up @@ -887,6 +949,11 @@ GetDistributeObjectOps(Node *node)
return &Collation_AlterObjectSchema;
}

case OBJECT_DOMAIN:
{
return &Domain_AlterObjectSchema;
}

case OBJECT_EXTENSION:
{
return &Extension_AlterObjectSchema;
Expand Down Expand Up @@ -965,6 +1032,11 @@ GetDistributeObjectOps(Node *node)
return &Database_AlterOwner;
}

case OBJECT_DOMAIN:
{
return &Domain_AlterOwner;
}

case OBJECT_FOREIGN_SERVER:
{
return &ForeignServer_AlterOwner;
Expand Down Expand Up @@ -1123,6 +1195,11 @@ GetDistributeObjectOps(Node *node)
return &Any_CompositeType;
}

case T_CreateDomainStmt:
{
return &Any_CreateDomain;
}

case T_CreateEnumStmt:
{
return &Any_CreateEnum;
Expand Down Expand Up @@ -1210,6 +1287,11 @@ GetDistributeObjectOps(Node *node)
return &Collation_Drop;
}

case OBJECT_DOMAIN:
{
return &Domain_Drop;
}

case OBJECT_EXTENSION:
{
return &Extension_Drop;
Expand Down Expand Up @@ -1339,6 +1421,16 @@ GetDistributeObjectOps(Node *node)
return &Collation_Rename;
}

case OBJECT_DOMAIN:
{
return &Domain_Rename;
}

case OBJECT_DOMCONSTRAINT:
{
return &Domain_RenameConstraint;
}

case OBJECT_FOREIGN_SERVER:
{
return &ForeignServer_Rename;
Expand Down
Loading

0 comments on commit 8897361

Please sign in to comment.