PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "miscadmin.h"
#include "postmaster/bgworker.h"
#include "postmaster/interrupt.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/lwlock.h"
#include "storage/proc.h"
#include "storage/shmem.h"
#include "access/xact.h"
#include "commands/dbcommands.h"
#include "executor/spi.h"
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "pgstat.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Data Structures | |
struct | worktable |
Typedefs | |
typedef struct worktable | worktable |
Functions | |
PG_FUNCTION_INFO_V1 (worker_spi_launch) | |
PGDLLEXPORT void | worker_spi_main (Datum main_arg) pg_attribute_noreturn() |
static void | initialize_worker_spi (worktable *table) |
void | _PG_init (void) |
Datum | worker_spi_launch (PG_FUNCTION_ARGS) |
Variables | |
PG_MODULE_MAGIC | |
static int | worker_spi_naptime = 10 |
static int | worker_spi_total_workers = 2 |
static char * | worker_spi_database = NULL |
static char * | worker_spi_role = NULL |
static uint32 | worker_spi_wait_event_main = 0 |
void _PG_init | ( | void | ) |
Definition at line 316 of file worker_spi.c.
References BackgroundWorker::bgw_flags, BackgroundWorker::bgw_function_name, BackgroundWorker::bgw_library_name, BackgroundWorker::bgw_main_arg, BGW_MAXLEN, BackgroundWorker::bgw_name, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BackgroundWorker::bgw_start_time, BackgroundWorker::bgw_type, BGWORKER_BACKEND_DATABASE_CONNECTION, BGWORKER_SHMEM_ACCESS, BgWorkerStart_RecoveryFinished, DefineCustomIntVariable(), DefineCustomStringVariable(), i, Int32GetDatum(), MarkGUCPrefixReserved(), PGC_POSTMASTER, PGC_SIGHUP, process_shared_preload_libraries_in_progress, RegisterBackgroundWorker(), snprintf, sprintf, worker_spi_database, worker_spi_naptime, worker_spi_role, and worker_spi_total_workers.
|
static |
Definition at line 73 of file worker_spi.c.
References appendStringInfo(), buf, CommitTransactionCommand(), DatumGetInt64(), debug_query_string, elog, FATAL, GetTransactionSnapshot(), initStringInfo(), worktable::name, pgstat_report_activity(), PopActiveSnapshot(), PushActiveSnapshot(), resetStringInfo(), worktable::schema, SetCurrentStatementStartTimestamp(), SPI_connect(), SPI_execute(), SPI_finish(), SPI_getbinval(), SPI_OK_SELECT, SPI_OK_UTILITY, SPI_processed, SPI_tuptable, StartTransactionCommand(), STATE_IDLE, STATE_RUNNING, SPITupleTable::tupdesc, and SPITupleTable::vals.
Referenced by worker_spi_main().
PG_FUNCTION_INFO_V1 | ( | worker_spi_launch | ) |
Datum worker_spi_launch | ( | PG_FUNCTION_ARGS | ) |
Definition at line 406 of file worker_spi.c.
References ARR_ELEMTYPE, ARR_NDIM, array_contains_nulls(), Assert, BackgroundWorker::bgw_extra, BackgroundWorker::bgw_flags, BackgroundWorker::bgw_function_name, BackgroundWorker::bgw_library_name, BackgroundWorker::bgw_main_arg, BGW_MAXLEN, BackgroundWorker::bgw_name, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BackgroundWorker::bgw_start_time, BackgroundWorker::bgw_type, BGWH_POSTMASTER_DIED, BGWH_STARTED, BGWH_STOPPED, BGWORKER_BACKEND_DATABASE_CONNECTION, BGWORKER_BYPASS_ALLOWCONN, BGWORKER_BYPASS_ROLELOGINCHECK, BGWORKER_SHMEM_ACCESS, BgWorkerStart_RecoveryFinished, deconstruct_array_builtin(), ereport, errcode(), errhint(), errmsg(), ERROR, get_database_oid(), get_role_oid(), i, Int32GetDatum(), MyProcPid, OidIsValid, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_INT32, PG_RETURN_NULL, RegisterDynamicBackgroundWorker(), snprintf, sprintf, TextDatumGetCString, WaitForBackgroundWorkerStartup(), worker_spi_database, and worker_spi_role.
void worker_spi_main | ( | Datum | main_arg | ) |
Definition at line 138 of file worker_spi.c.
References appendStringInfo(), BackgroundWorkerInitializeConnection(), BackgroundWorkerInitializeConnectionByOid(), BackgroundWorkerUnblockSignals(), BackgroundWorker::bgw_extra, BackgroundWorker::bgw_name, BGWORKER_BYPASS_ALLOWCONN, BGWORKER_BYPASS_ROLELOGINCHECK, buf, CHECK_FOR_INTERRUPTS, CommitTransactionCommand(), ConfigReloadPending, DatumGetInt32(), debug_query_string, die, elog, FATAL, GetTransactionSnapshot(), initialize_worker_spi(), initStringInfo(), LOG, MyBgworkerEntry, MyLatch, name, worktable::name, OidIsValid, palloc(), PGC_S_OVERRIDE, PGC_SIGHUP, PGC_USERSET, pgstat_report_activity(), pgstat_report_stat(), PopActiveSnapshot(), pqsignal(), ProcessConfigFile(), pstrdup(), PushActiveSnapshot(), quote_identifier(), ResetLatch(), worktable::schema, SetConfigOption(), SetCurrentStatementStartTimestamp(), SIGHUP, SignalHandlerForConfigReload(), SPI_connect(), SPI_execute(), SPI_finish(), SPI_getbinval(), SPI_OK_UPDATE_RETURNING, SPI_processed, SPI_tuptable, sprintf, StartTransactionCommand(), STATE_IDLE, STATE_RUNNING, SPITupleTable::tupdesc, val, SPITupleTable::vals, WaitEventExtensionNew(), WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_TIMEOUT, worker_spi_database, worker_spi_naptime, worker_spi_role, and worker_spi_wait_event_main.
PG_MODULE_MAGIC |
Definition at line 47 of file worker_spi.c.
|
static |
Definition at line 56 of file worker_spi.c.
Referenced by _PG_init(), worker_spi_launch(), and worker_spi_main().
|
static |
Definition at line 54 of file worker_spi.c.
Referenced by _PG_init(), and worker_spi_main().
|
static |
Definition at line 57 of file worker_spi.c.
Referenced by _PG_init(), worker_spi_launch(), and worker_spi_main().
|
static |
Definition at line 55 of file worker_spi.c.
Referenced by _PG_init().
|
static |
Definition at line 60 of file worker_spi.c.
Referenced by worker_spi_main().