Use library and symbol name for bgw entry

PostgreSQL 10 takes away the ability to directly assign a function
pointer; the other approach (library and symbol name) is supported by
all versions.
pull/1377/head
Jason Petersen 2017-04-20 19:26:27 -06:00
parent f86920f9d6
commit c9fa11b445
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 5 additions and 3 deletions

View File

@ -62,7 +62,6 @@ static volatile sig_atomic_t got_SIGHUP = false;
static volatile sig_atomic_t got_SIGTERM = false; static volatile sig_atomic_t got_SIGTERM = false;
/* initialization forward declarations */ /* initialization forward declarations */
static void TaskTrackerMain(Datum main_arg);
static Size TaskTrackerShmemSize(void); static Size TaskTrackerShmemSize(void);
static void TaskTrackerShmemInit(void); static void TaskTrackerShmemInit(void);
@ -108,7 +107,8 @@ TaskTrackerRegister(void)
worker.bgw_flags = BGWORKER_SHMEM_ACCESS; worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
worker.bgw_start_time = BgWorkerStart_ConsistentState; worker.bgw_start_time = BgWorkerStart_ConsistentState;
worker.bgw_restart_time = 1; worker.bgw_restart_time = 1;
worker.bgw_main = TaskTrackerMain; snprintf(worker.bgw_library_name, BGW_MAXLEN, "citus");
snprintf(worker.bgw_function_name, BGW_MAXLEN, "TaskTrackerMain");
worker.bgw_notify_pid = 0; worker.bgw_notify_pid = 0;
snprintf(worker.bgw_name, BGW_MAXLEN, "task tracker"); snprintf(worker.bgw_name, BGW_MAXLEN, "task tracker");
@ -117,7 +117,7 @@ TaskTrackerRegister(void)
/* Main entry point for task tracker process. */ /* Main entry point for task tracker process. */
static void void
TaskTrackerMain(Datum main_arg) TaskTrackerMain(Datum main_arg)
{ {
MemoryContext TaskTrackerContext = NULL; MemoryContext TaskTrackerContext = NULL;

View File

@ -112,6 +112,8 @@ extern int MaxRunningTasksPerNode;
/* State shared by the task tracker and task tracker protocol functions */ /* State shared by the task tracker and task tracker protocol functions */
extern WorkerTasksSharedStateData *WorkerTasksSharedState; extern WorkerTasksSharedStateData *WorkerTasksSharedState;
/* Entry point */
extern void TaskTrackerMain(Datum main_arg);
/* Function declarations local to the worker module */ /* Function declarations local to the worker module */
extern WorkerTask * WorkerTasksHashEnter(uint64 jobId, uint32 taskId); extern WorkerTask * WorkerTasksHashEnter(uint64 jobId, uint32 taskId);