Added formatting changes by citus_indent utility.

pull/6453/head
Rajesh Kumar Thandapani 2022-11-16 07:39:34 +05:30
parent 827393ab41
commit 4635c1533f
2 changed files with 27 additions and 15 deletions

View File

@ -103,11 +103,14 @@ CanUseLocalCopy(uint32_t destinationNodeId)
return GetLocalNodeId() == (int32) destinationNodeId; return GetLocalNodeId() == (int32) destinationNodeId;
} }
/* /*
* SetupReplicationOriginSessionIfNotSetupAlready sets up the replication origin session * SetupReplicationOriginSessionIfNotSetupAlready sets up the replication origin session
* if it is not already setup. * if it is not already setup.
*/ */
static void SetupReplicationOriginSessionIfNotSetupAlready(MultiConnection *connection) { static void
SetupReplicationOriginSessionIfNotSetupAlready(MultiConnection *connection)
{
/* Setup replication Origin if not setup already */ /* Setup replication Origin if not setup already */
if (!SendRemoteCommand(connection, CDC_REPLICATION_ORIGIN_SESION_SETUP_CMD)) if (!SendRemoteCommand(connection, CDC_REPLICATION_ORIGIN_SESION_SETUP_CMD))
{ {
@ -116,11 +119,14 @@ CanUseLocalCopy(uint32_t destinationNodeId)
ForgetResults(connection); ForgetResults(connection);
} }
/* /*
* ResetReplicationOriginSessionIfSetupAlready resets the replication origin session * ResetReplicationOriginSessionIfSetupAlready resets the replication origin session
* if it has been setup currently. * if it has been setup currently.
*/ */
static void ResetReplicationOriginSessionIfSetupAlready(MultiConnection *connection) { static void
ResetReplicationOriginSessionIfSetupAlready(MultiConnection *connection)
{
if (!SendRemoteCommand(connection, CDC_REPLICATION_ORIGIN_SESION_RESET_CMD)) if (!SendRemoteCommand(connection, CDC_REPLICATION_ORIGIN_SESION_RESET_CMD))
{ {
ReportConnectionError(connection, ERROR); ReportConnectionError(connection, ERROR);
@ -128,6 +134,7 @@ static void ResetReplicationOriginSessionIfSetupAlready(MultiConnection *connect
ForgetResults(connection); ForgetResults(connection);
} }
/* Connect to node with source shard and trigger copy start. */ /* Connect to node with source shard and trigger copy start. */
static void static void
ConnectToRemoteAndStartCopy(ShardCopyDestReceiver *copyDest) ConnectToRemoteAndStartCopy(ShardCopyDestReceiver *copyDest)
@ -144,7 +151,7 @@ ConnectToRemoteAndStartCopy(ShardCopyDestReceiver *copyDest)
ClaimConnectionExclusively(copyDest->connection); ClaimConnectionExclusively(copyDest->connection);
/* Setup Replication Origin Session if not setup already for /* Setup Replication Origin Session if not setup already for
avoiding publication of events more than once. */ * avoiding publication of events more than once. */
SetupReplicationOriginSessionIfNotSetupAlready(copyDest->connection); SetupReplicationOriginSessionIfNotSetupAlready(copyDest->connection);
StringInfo copyStatement = ConstructShardCopyStatement( StringInfo copyStatement = ConstructShardCopyStatement(

View File

@ -40,7 +40,8 @@ static Oid FindTargetRelationOid(Relation sourceShardRelation,
static HeapTuple GetTupleForTargetSchema(HeapTuple sourceRelationTuple, static HeapTuple GetTupleForTargetSchema(HeapTuple sourceRelationTuple,
TupleDesc sourceTupleDesc, TupleDesc sourceTupleDesc,
TupleDesc targetTupleDesc); TupleDesc targetTupleDesc);
static bool replication_origin_filter_cb(LogicalDecodingContext *ctx, RepOriginId origin_id); static bool replication_origin_filter_cb(LogicalDecodingContext *ctx, RepOriginId
origin_id);
static bool PublishChangesIfCdcSlot(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, static bool PublishChangesIfCdcSlot(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
Relation relation, ReorderBufferChange *change); Relation relation, ReorderBufferChange *change);
@ -94,6 +95,7 @@ replication_origin_filter_cb(LogicalDecodingContext *ctx, RepOriginId origin_id)
return false; return false;
} }
/* /*
* PublishChangesIfCdcSlot checks if the current slot is a CDC slot. If so, it publishes * PublishChangesIfCdcSlot checks if the current slot is a CDC slot. If so, it publishes
* the changes as the change for the distributed table instead of shard. * the changes as the change for the distributed table instead of shard.
@ -104,8 +106,10 @@ PublishChangesIfCdcSlot(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
Relation relation, ReorderBufferChange *change) Relation relation, ReorderBufferChange *change)
{ {
char *replicationSlotName = ctx->slot->data.name.data; char *replicationSlotName = ctx->slot->data.name.data;
/* Check if the replication slot is CITUS_CDC_SLOT*/ /* Check if the replication slot is CITUS_CDC_SLOT*/
if (replicationSlotName != NULL && strcmp(replicationSlotName, CITUS_CDC_SLOT_NAME) == 0) if (replicationSlotName != NULL && strcmp(replicationSlotName, CITUS_CDC_SLOT_NAME) ==
0)
{ {
/* Skip publishing changes for Citus metadata tables*/ /* Skip publishing changes for Citus metadata tables*/
ObjectAddress objectAdress = { RelationRelationId, relation->rd_id, 0 }; ObjectAddress objectAdress = { RelationRelationId, relation->rd_id, 0 };
@ -113,6 +117,7 @@ PublishChangesIfCdcSlot(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
{ {
return true; return true;
} }
/* Check if this change is for a shard in distributed table. */ /* Check if this change is for a shard in distributed table. */
if (RelationIsAKnownShard(relation->rd_id)) if (RelationIsAKnownShard(relation->rd_id))
{ {