mirror of https://github.com/citusdata/citus.git
Reindent
parent
0653200151
commit
3b1dbed8d0
|
@ -162,7 +162,8 @@ PreprocessGrantStmt(Node *node, const char *queryString,
|
||||||
{
|
{
|
||||||
/* Propogate latest policies issue on deleted shards to avoid any potential issues */
|
/* Propogate latest policies issue on deleted shards to avoid any potential issues */
|
||||||
bool includeOrphanedShards = true;
|
bool includeOrphanedShards = true;
|
||||||
ddlJob->taskList = DDLTaskListExtended(relationId, ddlString.data, includeOrphanedShards);
|
ddlJob->taskList = DDLTaskListExtended(relationId, ddlString.data,
|
||||||
|
includeOrphanedShards);
|
||||||
}
|
}
|
||||||
ddlJobs = lappend(ddlJobs, ddlJob);
|
ddlJobs = lappend(ddlJobs, ddlJob);
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,8 @@ PreprocessRenameStmt(Node *node, const char *renameCommand,
|
||||||
* try to delete the orphaned shard with the wrong (new) name.
|
* try to delete the orphaned shard with the wrong (new) name.
|
||||||
*/
|
*/
|
||||||
bool includeOrphanedShards = true;
|
bool includeOrphanedShards = true;
|
||||||
ddlJob->taskList = DDLTaskListExtended(tableRelationId, renameCommand, includeOrphanedShards);
|
ddlJob->taskList = DDLTaskListExtended(tableRelationId, renameCommand,
|
||||||
|
includeOrphanedShards);
|
||||||
|
|
||||||
return list_make1(ddlJob);
|
return list_make1(ddlJob);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1592,7 +1592,8 @@ BuildCachedShardList(CitusTableCacheEntry *cacheEntry)
|
||||||
|
|
||||||
/* Only load Active shards in the cache */
|
/* Only load Active shards in the cache */
|
||||||
bool activeShardsOnly = true;
|
bool activeShardsOnly = true;
|
||||||
List *distShardTupleList = LookupDistShardTuples(cacheEntry->relationId, activeShardsOnly);
|
List *distShardTupleList = LookupDistShardTuples(cacheEntry->relationId,
|
||||||
|
activeShardsOnly);
|
||||||
int shardIntervalArrayLength = list_length(distShardTupleList);
|
int shardIntervalArrayLength = list_length(distShardTupleList);
|
||||||
if (shardIntervalArrayLength > 0)
|
if (shardIntervalArrayLength > 0)
|
||||||
{
|
{
|
||||||
|
@ -4562,7 +4563,8 @@ LookupDistShardTuples(Oid relationId, bool activeShardsOnly)
|
||||||
|
|
||||||
/* set scan arguments */
|
/* set scan arguments */
|
||||||
scanKey[0].sk_argument = ObjectIdGetDatum(relationId);
|
scanKey[0].sk_argument = ObjectIdGetDatum(relationId);
|
||||||
scanKey[1].sk_argument = (activeShardsOnly) ? SHARD_STATE_ACTIVE : SHARD_STATE_INVALID_LAST;
|
scanKey[1].sk_argument = (activeShardsOnly) ? SHARD_STATE_ACTIVE :
|
||||||
|
SHARD_STATE_INVALID_LAST;
|
||||||
|
|
||||||
SysScanDesc scanDescriptor = systable_beginscan(pgDistShard,
|
SysScanDesc scanDescriptor = systable_beginscan(pgDistShard,
|
||||||
DistShardLogicalRelidIndexId(), true,
|
DistShardLogicalRelidIndexId(), true,
|
||||||
|
|
|
@ -3271,7 +3271,7 @@ EnsureCoordinatorInitiatedOperation(void)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
EnsureShardMetadataIsSane(Oid relationId, int64 shardId,
|
EnsureShardMetadataIsSane(Oid relationId, int64 shardId,
|
||||||
char storageType, int shardState,
|
char storageType, int shardState,
|
||||||
text *shardMinValue, text *shardMaxValue)
|
text *shardMinValue, text *shardMaxValue)
|
||||||
{
|
{
|
||||||
if (shardId <= INVALID_SHARD_ID)
|
if (shardId <= INVALID_SHARD_ID)
|
||||||
|
|
|
@ -1081,10 +1081,12 @@ LoadShardIntervalList(Oid relationId)
|
||||||
List *
|
List *
|
||||||
LoadShardIntervalListIncludingOrphansViaCatalog(Oid relationId)
|
LoadShardIntervalListIncludingOrphansViaCatalog(Oid relationId)
|
||||||
{
|
{
|
||||||
List *shardIntervalList = LoadUnsortedShardIntervalListIncludingOrphansViaCatalog(relationId);
|
List *shardIntervalList = LoadUnsortedShardIntervalListIncludingOrphansViaCatalog(
|
||||||
|
relationId);
|
||||||
|
|
||||||
// Transform into a temporary array to sort.
|
/* Transform into a temporary array to sort. */
|
||||||
ShardInterval **shardIntervalArray = (ShardInterval **) PointerArrayFromList(shardIntervalList);
|
ShardInterval **shardIntervalArray = (ShardInterval **) PointerArrayFromList(
|
||||||
|
shardIntervalList);
|
||||||
int shardIntervalArrayLength = list_length(shardIntervalList);
|
int shardIntervalArrayLength = list_length(shardIntervalList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1103,10 +1105,12 @@ LoadShardIntervalListIncludingOrphansViaCatalog(Oid relationId)
|
||||||
shardIntervalArrayLength,
|
shardIntervalArrayLength,
|
||||||
cacheEntry->partitionColumn->
|
cacheEntry->partitionColumn->
|
||||||
varcollid,
|
varcollid,
|
||||||
cacheEntry->shardIntervalCompareFunction);
|
cacheEntry->
|
||||||
|
shardIntervalCompareFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
List *sortedShardIntervalList = ShardArrayToList(sortedShardIntervalArray, shardIntervalArrayLength);
|
List *sortedShardIntervalList = ShardArrayToList(sortedShardIntervalArray,
|
||||||
|
shardIntervalArrayLength);
|
||||||
return sortedShardIntervalList;
|
return sortedShardIntervalList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,8 @@ citus_drop_all_shards(PG_FUNCTION_ARGS)
|
||||||
*/
|
*/
|
||||||
LockRelationOid(relationId, AccessExclusiveLock);
|
LockRelationOid(relationId, AccessExclusiveLock);
|
||||||
|
|
||||||
List *shardIntervalList = LoadUnsortedShardIntervalListIncludingOrphansViaCatalog(relationId);
|
List *shardIntervalList = LoadUnsortedShardIntervalListIncludingOrphansViaCatalog(
|
||||||
|
relationId);
|
||||||
int droppedShardCount = DropShards(relationId, schemaName, relationName,
|
int droppedShardCount = DropShards(relationId, schemaName, relationName,
|
||||||
shardIntervalList, dropShardsMetadataOnly);
|
shardIntervalList, dropShardsMetadataOnly);
|
||||||
|
|
||||||
|
|
|
@ -576,6 +576,7 @@ BlockingShardSplit(SplitOperation splitOperation,
|
||||||
*/
|
*/
|
||||||
DropShardList(sourceColocatedShardIntervalList);
|
DropShardList(sourceColocatedShardIntervalList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert new shard and placement metdata */
|
/* Insert new shard and placement metdata */
|
||||||
InsertSplitChildrenShardMetadata(shardGroupSplitIntervalListList,
|
InsertSplitChildrenShardMetadata(shardGroupSplitIntervalListList,
|
||||||
workersForPlacementList);
|
workersForPlacementList);
|
||||||
|
@ -1188,6 +1189,7 @@ MarkShardListWithPlacementsForDrop(List *shardIntervalList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DropShardList drops shards and their metadata from both the coordinator and
|
* DropShardList drops shards and their metadata from both the coordinator and
|
||||||
* mx nodes.
|
* mx nodes.
|
||||||
|
@ -1492,10 +1494,10 @@ NonBlockingShardSplit(SplitOperation splitOperation,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 18) Drop old shards and delete related metadata. Have to do that before
|
* 18) Drop old shards and delete related metadata. Have to do that before
|
||||||
* creating the new shard metadata, because there's cross-checks
|
* creating the new shard metadata, because there's cross-checks
|
||||||
* preventing inconsistent metadata (like overlapping shards).
|
* preventing inconsistent metadata (like overlapping shards).
|
||||||
*/
|
*/
|
||||||
DropShardList(sourceColocatedShardIntervalList);
|
DropShardList(sourceColocatedShardIntervalList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -486,6 +486,7 @@ SingleReplicatedTable(Oid relationId)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ShardArrayToList builds a list of out the array of ShardInterval*.
|
* ShardArrayToList builds a list of out the array of ShardInterval*.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -95,7 +95,8 @@ extern void ProcessUtilityParseTree(Node *node, const char *queryString,
|
||||||
extern void MarkInvalidateForeignKeyGraph(void);
|
extern void MarkInvalidateForeignKeyGraph(void);
|
||||||
extern void InvalidateForeignKeyGraphForDDL(void);
|
extern void InvalidateForeignKeyGraphForDDL(void);
|
||||||
extern List * DDLTaskList(Oid relationId, const char *commandString);
|
extern List * DDLTaskList(Oid relationId, const char *commandString);
|
||||||
extern List * DDLTaskListExtended(Oid relationId, const char *commandString, bool includeOrphanedShards);
|
extern List * DDLTaskListExtended(Oid relationId, const char *commandString, bool
|
||||||
|
includeOrphanedShards);
|
||||||
extern List * NodeDDLTaskList(TargetWorkerSet targets, List *commands);
|
extern List * NodeDDLTaskList(TargetWorkerSet targets, List *commands);
|
||||||
extern bool AlterTableInProgress(void);
|
extern bool AlterTableInProgress(void);
|
||||||
extern bool DropSchemaOrDBInProgress(void);
|
extern bool DropSchemaOrDBInProgress(void);
|
||||||
|
|
Loading…
Reference in New Issue