mirror of https://github.com/citusdata/citus.git
Directly register router xact callbacks in PG_init
Not entirely sure why we went with the shared memory hook approach, but it causes problems (multiple registration) during crashes. Changing to a simple direct registration call from PG_init.pull/818/head
parent
e2f720dbe7
commit
5f6264105d
|
@ -80,7 +80,6 @@ bool AllModificationsCommutative = false;
|
||||||
*/
|
*/
|
||||||
static HTAB *xactParticipantHash = NULL;
|
static HTAB *xactParticipantHash = NULL;
|
||||||
static List *xactShardConnSetList = NIL;
|
static List *xactShardConnSetList = NIL;
|
||||||
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
|
|
||||||
static bool subXactAbortAttempted = false;
|
static bool subXactAbortAttempted = false;
|
||||||
|
|
||||||
/* functions needed during start phase */
|
/* functions needed during start phase */
|
||||||
|
@ -113,7 +112,6 @@ static void RecordShardIdParticipant(uint64 affectedShardId,
|
||||||
NodeConnectionEntry *participantEntry);
|
NodeConnectionEntry *participantEntry);
|
||||||
|
|
||||||
/* functions needed by callbacks and hooks */
|
/* functions needed by callbacks and hooks */
|
||||||
static void RegisterRouterExecutorXactCallbacks(void);
|
|
||||||
static void RouterTransactionCallback(XactEvent event, void *arg);
|
static void RouterTransactionCallback(XactEvent event, void *arg);
|
||||||
static void RouterSubtransactionCallback(SubXactEvent event, SubTransactionId subId,
|
static void RouterSubtransactionCallback(SubXactEvent event, SubTransactionId subId,
|
||||||
SubTransactionId parentSubid, void *arg);
|
SubTransactionId parentSubid, void *arg);
|
||||||
|
@ -1202,32 +1200,13 @@ RouterExecutorEnd(QueryDesc *queryDesc)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* InstallRouterExecutorShmemHook simply installs a hook (intended to be called
|
* RegisterRouterExecutorXactCallbacks registers this executor's callbacks.
|
||||||
* once during backend startup), which will itself register all the transaction
|
|
||||||
* callbacks needed by this executor.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
InstallRouterExecutorShmemHook(void)
|
|
||||||
{
|
|
||||||
prev_shmem_startup_hook = shmem_startup_hook;
|
|
||||||
shmem_startup_hook = RegisterRouterExecutorXactCallbacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RegisterRouterExecutorXactCallbacks registers (sub-)transaction callbacks
|
|
||||||
* needed by this executor before calling any previous shmem startup hooks.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
RegisterRouterExecutorXactCallbacks(void)
|
RegisterRouterExecutorXactCallbacks(void)
|
||||||
{
|
{
|
||||||
RegisterXactCallback(RouterTransactionCallback, NULL);
|
RegisterXactCallback(RouterTransactionCallback, NULL);
|
||||||
RegisterSubXactCallback(RouterSubtransactionCallback, NULL);
|
RegisterSubXactCallback(RouterSubtransactionCallback, NULL);
|
||||||
|
|
||||||
if (prev_shmem_startup_hook != NULL)
|
|
||||||
{
|
|
||||||
prev_shmem_startup_hook();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ _PG_init(void)
|
||||||
WorkerNodeRegister();
|
WorkerNodeRegister();
|
||||||
|
|
||||||
/* initialize transaction callbacks */
|
/* initialize transaction callbacks */
|
||||||
InstallRouterExecutorShmemHook();
|
RegisterRouterExecutorXactCallbacks();
|
||||||
InstallMultiShardXactShmemHook();
|
InstallMultiShardXactShmemHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,6 @@ extern void RouterExecutorStart(QueryDesc *queryDesc, int eflags, Task *task);
|
||||||
extern void RouterExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count);
|
extern void RouterExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count);
|
||||||
extern void RouterExecutorFinish(QueryDesc *queryDesc);
|
extern void RouterExecutorFinish(QueryDesc *queryDesc);
|
||||||
extern void RouterExecutorEnd(QueryDesc *queryDesc);
|
extern void RouterExecutorEnd(QueryDesc *queryDesc);
|
||||||
extern void InstallRouterExecutorShmemHook(void);
|
extern void RegisterRouterExecutorXactCallbacks(void);
|
||||||
|
|
||||||
#endif /* MULTI_ROUTER_EXECUTOR_H_ */
|
#endif /* MULTI_ROUTER_EXECUTOR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue