mirror of https://github.com/citusdata/citus.git
Add a function to delete shard metadata from MX nodes
parent
93e626c896
commit
2bd8f8f12e
|
@ -513,7 +513,7 @@ TableOwnerResetCommand(Oid relationId)
|
|||
|
||||
|
||||
/*
|
||||
* ShardListInsertCommand generates a singe command that can be
|
||||
* ShardListInsertCommand generates a single command that can be
|
||||
* executed to replicate shard and shard placement metadata for the
|
||||
* given shard intervals. The function assumes that each shard has a
|
||||
* single placement, and asserts this information.
|
||||
|
@ -634,6 +634,37 @@ ShardListInsertCommand(List *shardIntervalList)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ShardListDeleteCommand generates a command list that can be executed to delete
|
||||
* shard and shard placement metadata for the given shard.
|
||||
*/
|
||||
List *
|
||||
ShardDeleteCommandList(ShardInterval *shardInterval)
|
||||
{
|
||||
uint64 shardId = shardInterval->shardId;
|
||||
List *commandList = NIL;
|
||||
StringInfo deletePlacementCommand = NULL;
|
||||
StringInfo deleteShardCommand = NULL;
|
||||
|
||||
/* create command to delete shard placements */
|
||||
deletePlacementCommand = makeStringInfo();
|
||||
appendStringInfo(deletePlacementCommand,
|
||||
"DELETE FROM pg_dist_shard_placement WHERE shardid = %lu",
|
||||
shardId);
|
||||
|
||||
commandList = lappend(commandList, deletePlacementCommand->data);
|
||||
|
||||
/* create command to delete shard */
|
||||
deleteShardCommand = makeStringInfo();
|
||||
appendStringInfo(deleteShardCommand,
|
||||
"DELETE FROM pg_dist_shard WHERE shardid = %lu", shardId);
|
||||
|
||||
commandList = lappend(commandList, deleteShardCommand->data);
|
||||
|
||||
return commandList;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NodeDeleteCommand generate a command that can be
|
||||
* executed to delete the metadata for a worker node.
|
||||
|
|
|
@ -28,6 +28,7 @@ extern char * DistributionDeleteCommand(char *schemaName,
|
|||
extern char * TableOwnerResetCommand(Oid distributedRelationId);
|
||||
extern char * NodeListInsertCommand(List *workerNodeList);
|
||||
extern List * ShardListInsertCommand(List *shardIntervalList);
|
||||
extern List * ShardDeleteCommandList(ShardInterval *shardInterval);
|
||||
extern char * NodeDeleteCommand(uint32 nodeId);
|
||||
extern char * ColocationIdUpdateCommand(Oid relationId, uint32 colocationId);
|
||||
extern char * CreateSchemaDDLCommand(Oid schemaId);
|
||||
|
|
Loading…
Reference in New Issue