mirror of https://github.com/citusdata/citus.git
Handle LWLockRegisterTranche changes
The initialization of a custom lock tranche is somewhat simplified in PostgreSQL 10: now a name and identifier are sufficient.pull/1439/head
parent
0b4b9aa5a9
commit
3c507e7399
|
@ -578,6 +578,13 @@ TaskTrackerShmemInit(void)
|
||||||
|
|
||||||
if (!alreadyInitialized)
|
if (!alreadyInitialized)
|
||||||
{
|
{
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
WorkerTasksSharedState->taskHashTrancheId = LWLockNewTrancheId();
|
||||||
|
WorkerTasksSharedState->taskHashTrancheName = "Worker Task Hash Tranche";
|
||||||
|
LWLockRegisterTranche(WorkerTasksSharedState->taskHashTrancheId,
|
||||||
|
WorkerTasksSharedState->taskHashTrancheName);
|
||||||
|
#else
|
||||||
|
|
||||||
/* initialize lwlock protecting the task tracker hash table */
|
/* initialize lwlock protecting the task tracker hash table */
|
||||||
LWLockTranche *tranche = &WorkerTasksSharedState->taskHashLockTranche;
|
LWLockTranche *tranche = &WorkerTasksSharedState->taskHashLockTranche;
|
||||||
|
|
||||||
|
@ -586,6 +593,8 @@ TaskTrackerShmemInit(void)
|
||||||
tranche->array_stride = sizeof(LWLock);
|
tranche->array_stride = sizeof(LWLock);
|
||||||
tranche->name = "Worker Task Hash Tranche";
|
tranche->name = "Worker Task Hash Tranche";
|
||||||
LWLockRegisterTranche(WorkerTasksSharedState->taskHashTrancheId, tranche);
|
LWLockRegisterTranche(WorkerTasksSharedState->taskHashTrancheId, tranche);
|
||||||
|
#endif
|
||||||
|
|
||||||
LWLockInitialize(&WorkerTasksSharedState->taskHashLock,
|
LWLockInitialize(&WorkerTasksSharedState->taskHashLock,
|
||||||
WorkerTasksSharedState->taskHashTrancheId);
|
WorkerTasksSharedState->taskHashTrancheId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,11 @@ typedef struct WorkerTasksSharedStateData
|
||||||
|
|
||||||
/* Lock protecting workerNodesHash */
|
/* Lock protecting workerNodesHash */
|
||||||
int taskHashTrancheId;
|
int taskHashTrancheId;
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
char *taskHashTrancheName;
|
||||||
|
#else
|
||||||
LWLockTranche taskHashLockTranche;
|
LWLockTranche taskHashLockTranche;
|
||||||
|
#endif
|
||||||
LWLock taskHashLock;
|
LWLock taskHashLock;
|
||||||
} WorkerTasksSharedStateData;
|
} WorkerTasksSharedStateData;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue