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 List *xactShardConnSetList = NIL;
|
||||
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
|
||||
static bool subXactAbortAttempted = false;
|
||||
|
||||
/* functions needed during start phase */
|
||||
|
@ -113,7 +112,6 @@ static void RecordShardIdParticipant(uint64 affectedShardId,
|
|||
NodeConnectionEntry *participantEntry);
|
||||
|
||||
/* functions needed by callbacks and hooks */
|
||||
static void RegisterRouterExecutorXactCallbacks(void);
|
||||
static void RouterTransactionCallback(XactEvent event, void *arg);
|
||||
static void RouterSubtransactionCallback(SubXactEvent event, SubTransactionId subId,
|
||||
SubTransactionId parentSubid, void *arg);
|
||||
|
@ -1202,32 +1200,13 @@ RouterExecutorEnd(QueryDesc *queryDesc)
|
|||
|
||||
|
||||
/*
|
||||
* InstallRouterExecutorShmemHook simply installs a hook (intended to be called
|
||||
* once during backend startup), which will itself register all the transaction
|
||||
* callbacks needed by this executor.
|
||||
* RegisterRouterExecutorXactCallbacks registers this executor's callbacks.
|
||||
*/
|
||||
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)
|
||||
{
|
||||
RegisterXactCallback(RouterTransactionCallback, NULL);
|
||||
RegisterSubXactCallback(RouterSubtransactionCallback, NULL);
|
||||
|
||||
if (prev_shmem_startup_hook != NULL)
|
||||
{
|
||||
prev_shmem_startup_hook();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ _PG_init(void)
|
|||
WorkerNodeRegister();
|
||||
|
||||
/* initialize transaction callbacks */
|
||||
InstallRouterExecutorShmemHook();
|
||||
RegisterRouterExecutorXactCallbacks();
|
||||
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 RouterExecutorFinish(QueryDesc *queryDesc);
|
||||
extern void RouterExecutorEnd(QueryDesc *queryDesc);
|
||||
extern void InstallRouterExecutorShmemHook(void);
|
||||
extern void RegisterRouterExecutorXactCallbacks(void);
|
||||
|
||||
#endif /* MULTI_ROUTER_EXECUTOR_H_ */
|
||||
|
|
Loading…
Reference in New Issue