mirror of https://github.com/citusdata/citus.git
Refactor
parent
5d21f83613
commit
622016c08e
|
@ -736,51 +736,15 @@ WorkerFixPartitionShardIndexNamesCommandListForPartitionIndex(Oid partitionIndex
|
||||||
partitionSchemaName,
|
partitionSchemaName,
|
||||||
partitionName);
|
partitionName);
|
||||||
|
|
||||||
List *partitionShardIntervalList = LoadShardIntervalList(partitionId);
|
|
||||||
|
|
||||||
ShardInterval *partitionShardInterval = NULL;
|
/* create worker_fix_partition_shard_index_names command */
|
||||||
foreach_ptr(partitionShardInterval, partitionShardIntervalList)
|
StringInfo shardQueryString = makeStringInfo();
|
||||||
{
|
appendStringInfo(shardQueryString,
|
||||||
/*
|
"SELECT worker_fix_partition_shard_index_names(%s::regclass, %s, %s)",
|
||||||
* Prepare commands for each shard of current partition
|
quote_literal_cstr(qualifiedParentShardIndexName),
|
||||||
* to fix the index name that corresponds to the
|
quote_literal_cstr(partitionIndexName),
|
||||||
* current parent index name
|
quote_literal_cstr(qualifiedPartitionName));
|
||||||
*/
|
commandList = lappend(commandList, shardQueryString->data);
|
||||||
uint64 partitionShardId = partitionShardInterval->shardId;
|
|
||||||
|
|
||||||
List *activePlacementList = ActiveShardPlacementList(partitionShardId);
|
|
||||||
|
|
||||||
if ((list_length(activePlacementList) > 0) && (list_length(shardPlacements) > 0))
|
|
||||||
{
|
|
||||||
ShardPlacement *left = (ShardPlacement *) linitial(activePlacementList);
|
|
||||||
ShardPlacement *right = (ShardPlacement *) linitial(shardPlacements);
|
|
||||||
|
|
||||||
if (left->nodeId != right->nodeId)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get qualified partition shard name */
|
|
||||||
char *partitionShardName = pstrdup(partitionName);
|
|
||||||
AppendShardIdToName(&partitionShardName, partitionShardId);
|
|
||||||
char *qualifiedPartitionShardName = quote_qualified_identifier(
|
|
||||||
partitionSchemaName,
|
|
||||||
partitionShardName);
|
|
||||||
|
|
||||||
/* generate the new correct index name */
|
|
||||||
char *newPartitionShardIndexName = pstrdup(partitionIndexName);
|
|
||||||
AppendShardIdToName(&newPartitionShardIndexName, partitionShardId);
|
|
||||||
|
|
||||||
/* create worker_fix_partition_shard_index_names command */
|
|
||||||
StringInfo shardQueryString = makeStringInfo();
|
|
||||||
appendStringInfo(shardQueryString,
|
|
||||||
"SELECT worker_fix_partition_shard_index_names(%s::regclass, %s, %s)",
|
|
||||||
quote_literal_cstr(qualifiedParentShardIndexName),
|
|
||||||
quote_literal_cstr(partitionIndexName),
|
|
||||||
quote_literal_cstr(qualifiedPartitionName));
|
|
||||||
commandList = lappend(commandList, shardQueryString->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return commandList;
|
return commandList;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue