mirror of https://github.com/citusdata/citus.git
expose transfermode for ensure reference table existance
parent
366461ccdb
commit
6e4862c57f
|
@ -420,7 +420,7 @@ ReplicateColocatedShardPlacement(int64 shardId, char *sourceNodeName,
|
||||||
* Since this a long-running operation we do this after the error checks, but
|
* Since this a long-running operation we do this after the error checks, but
|
||||||
* before taking metadata locks.
|
* before taking metadata locks.
|
||||||
*/
|
*/
|
||||||
EnsureReferenceTablesExistOnAllNodes();
|
EnsureReferenceTablesExistOnAllNodesExtended(shardReplicationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyShardTables(colocatedShardList, sourceNodeName, sourceNodePort,
|
CopyShardTables(colocatedShardList, sourceNodeName, sourceNodePort,
|
||||||
|
|
|
@ -77,6 +77,22 @@ replicate_reference_tables(PG_FUNCTION_ARGS)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EnsureReferenceTablesExistOnAllNodes(void)
|
EnsureReferenceTablesExistOnAllNodes(void)
|
||||||
|
{
|
||||||
|
EnsureReferenceTablesExistOnAllNodesExtended(TRANSFER_MODE_BLOCK_WRITES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EnsureReferenceTablesExistOnAllNodesExtended ensures that a shard placement for every
|
||||||
|
* reference table exists on all nodes. If a node does not have a set of shard placements,
|
||||||
|
* then master_copy_shard_placement is called in a subtransaction to pull the data to the
|
||||||
|
* new node.
|
||||||
|
*
|
||||||
|
* The transferMode is passed on to the implementation of the copy to control the locks
|
||||||
|
* and transferMode.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EnsureReferenceTablesExistOnAllNodesExtended(char transferMode)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Prevent this function from running concurrently with itself.
|
* Prevent this function from running concurrently with itself.
|
||||||
|
@ -192,7 +208,7 @@ EnsureReferenceTablesExistOnAllNodes(void)
|
||||||
StringInfo placementCopyCommand =
|
StringInfo placementCopyCommand =
|
||||||
CopyShardPlacementToWorkerNodeQuery(sourceShardPlacement,
|
CopyShardPlacementToWorkerNodeQuery(sourceShardPlacement,
|
||||||
newWorkerNode,
|
newWorkerNode,
|
||||||
TRANSFER_MODE_BLOCK_WRITES);
|
transferMode);
|
||||||
ExecuteCriticalRemoteCommand(connection, placementCopyCommand->data);
|
ExecuteCriticalRemoteCommand(connection, placementCopyCommand->data);
|
||||||
RemoteTransactionCommit(connection);
|
RemoteTransactionCommit(connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "distributed/metadata_cache.h"
|
#include "distributed/metadata_cache.h"
|
||||||
|
|
||||||
extern void EnsureReferenceTablesExistOnAllNodes(void);
|
extern void EnsureReferenceTablesExistOnAllNodes(void);
|
||||||
|
extern void EnsureReferenceTablesExistOnAllNodesExtended(char transferMode);
|
||||||
extern uint32 CreateReferenceTableColocationId(void);
|
extern uint32 CreateReferenceTableColocationId(void);
|
||||||
extern void DeleteAllReferenceTablePlacementsFromNodeGroup(int32 groupId);
|
extern void DeleteAllReferenceTablePlacementsFromNodeGroup(int32 groupId);
|
||||||
extern int CompareOids(const void *leftElement, const void *rightElement);
|
extern int CompareOids(const void *leftElement, const void *rightElement);
|
||||||
|
|
Loading…
Reference in New Issue