mirror of https://github.com/citusdata/citus.git
Reindent
parent
919e44eab6
commit
3d46860fbb
|
@ -69,7 +69,8 @@ PG_FUNCTION_INFO_V1(citus_cleanup_orphaned_shards);
|
||||||
PG_FUNCTION_INFO_V1(isolation_cleanup_orphaned_shards);
|
PG_FUNCTION_INFO_V1(isolation_cleanup_orphaned_shards);
|
||||||
|
|
||||||
static int DropOrphanedShardsForMove(bool waitForLocks);
|
static int DropOrphanedShardsForMove(bool waitForLocks);
|
||||||
static bool TryDropShardOutsideTransaction(char *qualifiedTableName, char *nodeName, int nodePort);
|
static bool TryDropShardOutsideTransaction(char *qualifiedTableName, char *nodeName, int
|
||||||
|
nodePort);
|
||||||
static bool TryLockRelationAndPlacementCleanup(Oid relationId, LOCKMODE lockmode);
|
static bool TryLockRelationAndPlacementCleanup(Oid relationId, LOCKMODE lockmode);
|
||||||
|
|
||||||
/* Functions for cleanup infrastructure */
|
/* Functions for cleanup infrastructure */
|
||||||
|
@ -246,7 +247,8 @@ DropOrphanedShardsForCleanup()
|
||||||
if (failedShardCountForCleanup > 0)
|
if (failedShardCountForCleanup > 0)
|
||||||
{
|
{
|
||||||
ereport(WARNING, (errmsg("Failed to drop %d cleanup shards out of %d",
|
ereport(WARNING, (errmsg("Failed to drop %d cleanup shards out of %d",
|
||||||
failedShardCountForCleanup, list_length(cleanupRecordList))));
|
failedShardCountForCleanup, list_length(
|
||||||
|
cleanupRecordList))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return removedShardCountForCleanup;
|
return removedShardCountForCleanup;
|
||||||
|
@ -417,12 +419,14 @@ CompleteNewOperationNeedingCleanup(bool isSuccess)
|
||||||
if (list_length(currentOperationRecordList) > 0)
|
if (list_length(currentOperationRecordList) > 0)
|
||||||
{
|
{
|
||||||
ereport(LOG, (errmsg("Removed %d orphaned shards out of %d",
|
ereport(LOG, (errmsg("Removed %d orphaned shards out of %d",
|
||||||
removedShardCountOnComplete, list_length(currentOperationRecordList))));
|
removedShardCountOnComplete, list_length(
|
||||||
|
currentOperationRecordList))));
|
||||||
|
|
||||||
if (failedShardCountOnComplete > 0)
|
if (failedShardCountOnComplete > 0)
|
||||||
{
|
{
|
||||||
ereport(WARNING, (errmsg("Failed to drop %d cleanup shards out of %d",
|
ereport(WARNING, (errmsg("Failed to drop %d cleanup shards out of %d",
|
||||||
failedShardCountOnComplete, list_length(currentOperationRecordList))));
|
failedShardCountOnComplete, list_length(
|
||||||
|
currentOperationRecordList))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +463,7 @@ InsertCleanupRecordInCurrentTransaction(CleanupObject objectType,
|
||||||
values[Anum_pg_dist_cleanup_object_type - 1] = Int32GetDatum(objectType);
|
values[Anum_pg_dist_cleanup_object_type - 1] = Int32GetDatum(objectType);
|
||||||
values[Anum_pg_dist_cleanup_object_name - 1] = CStringGetTextDatum(objectName);
|
values[Anum_pg_dist_cleanup_object_name - 1] = CStringGetTextDatum(objectName);
|
||||||
values[Anum_pg_dist_cleanup_node_group_id - 1] = Int32GetDatum(nodeGroupId);
|
values[Anum_pg_dist_cleanup_node_group_id - 1] = Int32GetDatum(nodeGroupId);
|
||||||
values[Anum_pg_dist_cleanup_policy_type -1] = Int32GetDatum(policy);
|
values[Anum_pg_dist_cleanup_policy_type - 1] = Int32GetDatum(policy);
|
||||||
|
|
||||||
/* open cleanup relation and insert new tuple */
|
/* open cleanup relation and insert new tuple */
|
||||||
Oid relationId = DistCleanupRelationId();
|
Oid relationId = DistCleanupRelationId();
|
||||||
|
@ -680,7 +684,8 @@ ListCleanupRecordsForCurrentOperation(void)
|
||||||
int scanKeyCount = 1;
|
int scanKeyCount = 1;
|
||||||
Oid scanIndexId = InvalidOid;
|
Oid scanIndexId = InvalidOid;
|
||||||
bool useIndex = false;
|
bool useIndex = false;
|
||||||
SysScanDesc scanDescriptor = systable_beginscan(pgDistCleanup, scanIndexId, useIndex, NULL,
|
SysScanDesc scanDescriptor = systable_beginscan(pgDistCleanup, scanIndexId, useIndex,
|
||||||
|
NULL,
|
||||||
scanKeyCount, scanKey);
|
scanKeyCount, scanKey);
|
||||||
|
|
||||||
HeapTuple heapTuple = NULL;
|
HeapTuple heapTuple = NULL;
|
||||||
|
@ -697,6 +702,7 @@ ListCleanupRecordsForCurrentOperation(void)
|
||||||
return recordList;
|
return recordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TupleToCleanupRecord converts a pg_dist_cleanup record tuple into a CleanupRecord struct.
|
* TupleToCleanupRecord converts a pg_dist_cleanup record tuple into a CleanupRecord struct.
|
||||||
*/
|
*/
|
||||||
|
@ -808,6 +814,7 @@ static uint64
|
||||||
GetNextCleanupRecordId(void)
|
GetNextCleanupRecordId(void)
|
||||||
{
|
{
|
||||||
uint64 recordId = INVALID_CLEANUP_RECORD_ID;
|
uint64 recordId = INVALID_CLEANUP_RECORD_ID;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In regression tests, we would like to generate record IDs consistently
|
* In regression tests, we would like to generate record IDs consistently
|
||||||
* even if the tests run in parallel. Instead of the sequence, we can use
|
* even if the tests run in parallel. Instead of the sequence, we can use
|
||||||
|
@ -844,6 +851,7 @@ LockOperationId(OperationId operationId)
|
||||||
(void) LockAcquire(&tag, ExclusiveLock, sessionLock, dontWait);
|
(void) LockAcquire(&tag, ExclusiveLock, sessionLock, dontWait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
TryLockOperationId(OperationId operationId)
|
TryLockOperationId(OperationId operationId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,8 +75,7 @@ static void ErrorIfCannotSplitShardExtended(SplitOperation splitOperation,
|
||||||
ShardInterval *shardIntervalToSplit,
|
ShardInterval *shardIntervalToSplit,
|
||||||
List *shardSplitPointsList,
|
List *shardSplitPointsList,
|
||||||
List *nodeIdsForPlacementList);
|
List *nodeIdsForPlacementList);
|
||||||
static void CreateAndCopySplitShardsForShardGroup(
|
static void CreateAndCopySplitShardsForShardGroup(WorkerNode *sourceShardNode,
|
||||||
WorkerNode *sourceShardNode,
|
|
||||||
List *sourceColocatedShardIntervalList,
|
List *sourceColocatedShardIntervalList,
|
||||||
List *shardGroupSplitIntervalListList,
|
List *shardGroupSplitIntervalListList,
|
||||||
List *workersForPlacementList);
|
List *workersForPlacementList);
|
||||||
|
@ -133,7 +132,8 @@ static List * ExecuteSplitShardReplicationSetupUDF(WorkerNode *sourceWorkerNode,
|
||||||
List *sourceColocatedShardIntervalList,
|
List *sourceColocatedShardIntervalList,
|
||||||
List *shardGroupSplitIntervalListList,
|
List *shardGroupSplitIntervalListList,
|
||||||
List *destinationWorkerNodesList);
|
List *destinationWorkerNodesList);
|
||||||
static void AddDummyShardEntryInMap(HTAB *mapOfPlacementToDummyShardList, uint32 targetNodeId,
|
static void AddDummyShardEntryInMap(HTAB *mapOfPlacementToDummyShardList, uint32
|
||||||
|
targetNodeId,
|
||||||
ShardInterval *shardInterval);
|
ShardInterval *shardInterval);
|
||||||
static uint64 GetNextShardIdForSplitChild(void);
|
static uint64 GetNextShardIdForSplitChild(void);
|
||||||
|
|
||||||
|
@ -581,7 +581,8 @@ CreateSplitShardsForShardGroup(List *shardGroupSplitIntervalListList,
|
||||||
/* Log resource for cleanup in case of failure only. */
|
/* Log resource for cleanup in case of failure only. */
|
||||||
CleanupPolicy policy = CLEANUP_ON_FAILURE;
|
CleanupPolicy policy = CLEANUP_ON_FAILURE;
|
||||||
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
||||||
ConstructQualifiedShardName(shardInterval),
|
ConstructQualifiedShardName(
|
||||||
|
shardInterval),
|
||||||
workerPlacementNode->groupId,
|
workerPlacementNode->groupId,
|
||||||
policy);
|
policy);
|
||||||
|
|
||||||
|
@ -1132,7 +1133,6 @@ DropShardList(List *shardIntervalList)
|
||||||
|
|
||||||
if (DeferShardDeleteOnSplit)
|
if (DeferShardDeleteOnSplit)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Log shard in pg_dist_cleanup.
|
/* Log shard in pg_dist_cleanup.
|
||||||
* Parent shards are to be dropped only on sucess after split workflow is complete,
|
* Parent shards are to be dropped only on sucess after split workflow is complete,
|
||||||
* so mark the policy as 'CLEANUP_DEFERRED_ON_SUCCESS'.
|
* so mark the policy as 'CLEANUP_DEFERRED_ON_SUCCESS'.
|
||||||
|
@ -1465,7 +1465,8 @@ CreateDummyShardsForShardGroup(HTAB *mapOfPlacementToDummyShardList,
|
||||||
*/
|
*/
|
||||||
CleanupPolicy policy = CLEANUP_ALWAYS;
|
CleanupPolicy policy = CLEANUP_ALWAYS;
|
||||||
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
||||||
ConstructQualifiedShardName(shardInterval),
|
ConstructQualifiedShardName(
|
||||||
|
shardInterval),
|
||||||
workerPlacementNode->groupId,
|
workerPlacementNode->groupId,
|
||||||
policy);
|
policy);
|
||||||
|
|
||||||
|
@ -1509,7 +1510,8 @@ CreateDummyShardsForShardGroup(HTAB *mapOfPlacementToDummyShardList,
|
||||||
*/
|
*/
|
||||||
CleanupPolicy policy = CLEANUP_ALWAYS;
|
CleanupPolicy policy = CLEANUP_ALWAYS;
|
||||||
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
InsertCleanupRecordInSubtransaction(CLEANUP_SHARD_PLACEMENT,
|
||||||
ConstructQualifiedShardName(shardInterval),
|
ConstructQualifiedShardName(
|
||||||
|
shardInterval),
|
||||||
workerPlacementNode->groupId,
|
workerPlacementNode->groupId,
|
||||||
policy);
|
policy);
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,3 @@
|
||||||
#define CLEANUPRECORDID_SEQUENCE_NAME "pg_dist_cleanup_recordid_seq"
|
#define CLEANUPRECORDID_SEQUENCE_NAME "pg_dist_cleanup_recordid_seq"
|
||||||
|
|
||||||
#endif /* PG_DIST_CLEANUP_H */
|
#endif /* PG_DIST_CLEANUP_H */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue