mirror of https://github.com/citusdata/citus.git
parent
350b1e6431
commit
d256f3fca9
|
@ -23,14 +23,12 @@
|
||||||
#include "access/relscan.h"
|
#include "access/relscan.h"
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
#include "catalog/indexing.h"
|
#include "catalog/indexing.h"
|
||||||
#include "distributed/commit_protocol.h"
|
|
||||||
#include "distributed/connection_cache.h"
|
#include "distributed/connection_cache.h"
|
||||||
#include "distributed/listutils.h"
|
#include "distributed/listutils.h"
|
||||||
#include "distributed/metadata_cache.h"
|
#include "distributed/metadata_cache.h"
|
||||||
#include "distributed/pg_dist_transaction.h"
|
#include "distributed/pg_dist_transaction.h"
|
||||||
#include "distributed/transaction_recovery.h"
|
#include "distributed/transaction_recovery.h"
|
||||||
#include "distributed/worker_manager.h"
|
#include "distributed/worker_manager.h"
|
||||||
#include "distributed/worker_transaction.h"
|
|
||||||
#include "lib/stringinfo.h"
|
#include "lib/stringinfo.h"
|
||||||
#include "storage/lmgr.h"
|
#include "storage/lmgr.h"
|
||||||
#include "storage/lock.h"
|
#include "storage/lock.h"
|
||||||
|
@ -71,35 +69,6 @@ recover_prepared_transactions(PG_FUNCTION_ARGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LogPreparedTransactions logs a commit record for all prepared transactions
|
|
||||||
* on connections in connectionList. The remote transaction is safe to commit
|
|
||||||
* once the record has been durably stored (i.e. the local transaction is
|
|
||||||
* committed).
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
LogPreparedTransactions(List *connectionList)
|
|
||||||
{
|
|
||||||
ListCell *connectionCell = NULL;
|
|
||||||
|
|
||||||
foreach(connectionCell, connectionList)
|
|
||||||
{
|
|
||||||
TransactionConnection *transactionConnection =
|
|
||||||
(TransactionConnection *) lfirst(connectionCell);
|
|
||||||
|
|
||||||
char transactionState PG_USED_FOR_ASSERTS_ONLY =
|
|
||||||
transactionConnection->transactionState;
|
|
||||||
int groupId = transactionConnection->groupId;
|
|
||||||
int64 connectionId = transactionConnection->connectionId;
|
|
||||||
StringInfo transactionName = BuildTransactionName(connectionId);
|
|
||||||
|
|
||||||
Assert(transactionState == TRANSACTION_STATE_PREPARED);
|
|
||||||
|
|
||||||
LogTransactionRecord(groupId, transactionName->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LogTransactionRecord registers the fact that a transaction has been
|
* LogTransactionRecord registers the fact that a transaction has been
|
||||||
* prepared on a worker. The presence of this record indicates that the
|
* prepared on a worker. The presence of this record indicates that the
|
||||||
|
|
|
@ -12,11 +12,7 @@
|
||||||
#define TRANSACTION_RECOVERY_H
|
#define TRANSACTION_RECOVERY_H
|
||||||
|
|
||||||
|
|
||||||
#include "nodes/pg_list.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions declarations for worker transactions */
|
/* Functions declarations for worker transactions */
|
||||||
extern void LogPreparedTransactions(List *connectionList);
|
|
||||||
extern void LogTransactionRecord(int groupId, char *transactionName);
|
extern void LogTransactionRecord(int groupId, char *transactionName);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue