mirror of https://github.com/citusdata/citus.git
parent
1599e943e7
commit
6f4886cd11
|
@ -32,6 +32,29 @@
|
|||
#include "utils/memutils.h"
|
||||
|
||||
|
||||
/*
|
||||
* SendCommandToWorker sends a command to a particular worker as part of the
|
||||
* 2PC.
|
||||
*/
|
||||
void
|
||||
SendCommandToWorker(char *nodeName, int32 nodePort, char *command)
|
||||
{
|
||||
MultiConnection *transactionConnection = NULL;
|
||||
char *nodeUser = CitusExtensionOwnerName();
|
||||
int connectionFlags = 0;
|
||||
|
||||
BeginOrContinueCoordinatedTransaction();
|
||||
CoordinatedTransactionUse2PC();
|
||||
|
||||
transactionConnection = GetNodeUserDatabaseConnection(connectionFlags, nodeName,
|
||||
nodePort, nodeUser, NULL);
|
||||
|
||||
MarkRemoteTransactionCritical(transactionConnection);
|
||||
RemoteTransactionBeginIfNecessary(transactionConnection);
|
||||
ExecuteCriticalRemoteCommand(transactionConnection, command);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SendCommandToWorkers sends a command to all workers in
|
||||
* parallel. Commands are committed on the workers when the local
|
||||
|
|
|
@ -28,6 +28,7 @@ typedef enum TargetWorkerSet
|
|||
|
||||
/* Functions declarations for worker transactions */
|
||||
extern List * GetWorkerTransactions(void);
|
||||
extern void SendCommandToWorker(char *nodeName, int32 nodePort, char *command);
|
||||
extern void SendCommandToWorkers(TargetWorkerSet targetWorkerSet, char *command);
|
||||
extern void SendCommandToWorkersParams(TargetWorkerSet targetWorkerSet, char *command,
|
||||
int parameterCount, const Oid *parameterTypes,
|
||||
|
|
Loading…
Reference in New Issue