PG守护进程(Postmaster)——ApplyLauncherRegister_数据库

后台二等公民进程logical replication launcher注册(Register the apply launcher. Since it registers a background worker, it needs to be called before InitializeMaxBackends(), and it’s probably a good idea to call it before any modules had chance to take the background worker slots.)。
如果max_logical_replication_workers为零,就不需要注册logical replication launcher后台进程。
logical replication launcher也是使用后台二等公民进程框架。

void ApplyLauncherRegister(void){
BackgroundWorker bgw;
if (max_logical_replication_workers == 0) return;

memset(&bgw, 0, sizeof(bgw));
bgw.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
bgw.bgw_start_time = BgWorkerStart_RecoveryFinished;
snprintf(bgw.bgw_library_name, BGW_MAXLEN, "postgres");
snprintf(bgw.bgw_function_name, BGW_MAXLEN, "ApplyLauncherMain");
snprintf(bgw.bgw_name, BGW_MAXLEN, "logical replication launcher");
snprintf(bgw.bgw_type, BGW_MAXLEN, "logical replication launcher");
bgw.bgw_restart_time = 5;
bgw.bgw_notify_pid = 0;
bgw.bgw_main_arg = (Datum) 0;

RegisterBackgroundWorker(&bgw);
}

logical replication launcher运行的函数ApplyLauncherMain

PG守护进程(Postmaster)——ApplyLauncherRegister_postgresql_02