mirror of https://github.com/citusdata/citus.git
Rename per worker
parent
56e014e64e
commit
c48bf5ebaa
|
@ -435,7 +435,7 @@ BigIntArrayDatumContains(Datum *array, int arrayLength, uint64 toFind)
|
||||||
* FullShardPlacementList returns a List containing all the shard placements of
|
* FullShardPlacementList returns a List containing all the shard placements of
|
||||||
* a specific table (excluding the excludedShardArray)
|
* a specific table (excluding the excludedShardArray)
|
||||||
*/
|
*/
|
||||||
static List *
|
List *
|
||||||
FullShardPlacementList(Oid relationId, ArrayType *excludedShardArray)
|
FullShardPlacementList(Oid relationId, ArrayType *excludedShardArray)
|
||||||
{
|
{
|
||||||
List *shardPlacementList = NIL;
|
List *shardPlacementList = NIL;
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "distributed/version_compat.h"
|
#include "distributed/version_compat.h"
|
||||||
#include "distributed/worker_protocol.h"
|
#include "distributed/worker_protocol.h"
|
||||||
|
|
||||||
|
extern List *FullShardPlacementList(Oid relationId, ArrayType *excludedShardArray);
|
||||||
static char * PartitionBound(Oid partitionId);
|
static char * PartitionBound(Oid partitionId);
|
||||||
static Relation try_relation_open_nolock(Oid relationId);
|
static Relation try_relation_open_nolock(Oid relationId);
|
||||||
static List * CreateFixPartitionConstraintsTaskList(Oid relationId);
|
static List * CreateFixPartitionConstraintsTaskList(Oid relationId);
|
||||||
|
@ -555,17 +556,31 @@ CreateFixPartitionShardIndexNames(Oid parentRelationId, Oid partitionRelationId,
|
||||||
/* lock metadata before getting placement lists */
|
/* lock metadata before getting placement lists */
|
||||||
LockShardListMetadata(parentShardIntervalList, ShareLock);
|
LockShardListMetadata(parentShardIntervalList, ShareLock);
|
||||||
|
|
||||||
MemoryContext localContext = AllocSetContextCreate(CurrentMemoryContext,
|
int taskId = 1;
|
||||||
"CreateFixPartitionShardIndexNames",
|
|
||||||
|
List *shardPlacementList = FullShardPlacementList(parentRelationId, construct_empty_array(INT4OID));
|
||||||
|
|
||||||
|
|
||||||
|
List *workerNodeList = ReadDistNode(true);
|
||||||
|
|
||||||
|
/* make sure we have deterministic output for our tests */
|
||||||
|
workerNodeList = SortList(workerNodeList, CompareWorkerNodes);
|
||||||
|
|
||||||
|
MemoryContext localContext = AllocSetContextCreate(CurrentMemoryContext, "CreateFixPartitionShardIndexNames",
|
||||||
ALLOCSET_DEFAULT_SIZES);
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
MemoryContext oldContext = MemoryContextSwitchTo(localContext);
|
MemoryContext oldContext = MemoryContextSwitchTo(localContext);
|
||||||
|
|
||||||
int taskId = 1;
|
WorkerNode *workerNode = NULL;
|
||||||
|
foreach_ptr(workerNode, workerNodeList)
|
||||||
ShardInterval *parentShardInterval = NULL;
|
|
||||||
foreach_ptr(parentShardInterval, parentShardIntervalList)
|
|
||||||
{
|
{
|
||||||
uint64 parentShardId = parentShardInterval->shardId;
|
List *shardsOnNode = FilterActiveShardPlacementListByNode(
|
||||||
|
shardPlacementList, workerNode);
|
||||||
|
|
||||||
|
ShardPlacement *shardPlacement = NULL;
|
||||||
|
|
||||||
|
foreach_ptr(shardPlacement, shardsOnNode)
|
||||||
|
{
|
||||||
|
uint64 parentShardId = shardPlacement->shardId;
|
||||||
|
|
||||||
List *queryStringList =
|
List *queryStringList =
|
||||||
WorkerFixPartitionShardIndexNamesCommandList(parentShardId,
|
WorkerFixPartitionShardIndexNamesCommandList(parentShardId,
|
||||||
|
@ -594,6 +609,9 @@ CreateFixPartitionShardIndexNames(Oid parentRelationId, Oid partitionRelationId,
|
||||||
ExecuteUtilityTaskList(list_make1(task), localExecutionSupported);
|
ExecuteUtilityTaskList(list_make1(task), localExecutionSupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* after every iteration, clean-up all the memory associated with it */
|
/* after every iteration, clean-up all the memory associated with it */
|
||||||
MemoryContextReset(localContext);
|
MemoryContextReset(localContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,4 +222,6 @@ extern void SetupRebalanceMonitor(List *placementUpdateList,
|
||||||
uint64 initialProgressState,
|
uint64 initialProgressState,
|
||||||
PlacementUpdateStatus initialStatus);
|
PlacementUpdateStatus initialStatus);
|
||||||
|
|
||||||
|
extern List *FullShardPlacementList(Oid relationId, ArrayType *excludedShardArray);
|
||||||
|
|
||||||
#endif /* SHARD_REBALANCER_H */
|
#endif /* SHARD_REBALANCER_H */
|
||||||
|
|
Loading…
Reference in New Issue