PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "fmgr.h"
#include "injection_stats.h"
#include "miscadmin.h"
#include "nodes/pg_list.h"
#include "nodes/value.h"
#include "storage/condition_variable.h"
#include "storage/dsm_registry.h"
#include "storage/ipc.h"
#include "storage/lwlock.h"
#include "storage/shmem.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/injection_point.h"
#include "utils/memutils.h"
#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
struct | InjectionPointCondition |
struct | InjectionPointSharedState |
Macros | |
#define | INJ_MAX_WAIT 8 |
#define | INJ_NAME_MAXLEN 64 |
Typedefs | |
typedef enum InjectionPointConditionType | InjectionPointConditionType |
typedef struct InjectionPointCondition | InjectionPointCondition |
typedef struct InjectionPointSharedState | InjectionPointSharedState |
Enumerations | |
enum | InjectionPointConditionType { INJ_CONDITION_ALWAYS = 0 , INJ_CONDITION_PID } |
Variables | |
PG_MODULE_MAGIC | |
static List * | inj_list_local = NIL |
static InjectionPointSharedState * | inj_state = NULL |
static bool | injection_point_local = false |
bool | inj_stats_enabled = false |
static shmem_request_hook_type | prev_shmem_request_hook = NULL |
static shmem_startup_hook_type | prev_shmem_startup_hook = NULL |
#define INJ_MAX_WAIT 8 |
Definition at line 39 of file injection_points.c.
#define INJ_NAME_MAXLEN 64 |
Definition at line 40 of file injection_points.c.
typedef struct InjectionPointCondition InjectionPointCondition |
typedef enum InjectionPointConditionType InjectionPointConditionType |
typedef struct InjectionPointSharedState InjectionPointSharedState |
void _PG_init | ( | void | ) |
Definition at line 521 of file injection_points.c.
References DefineCustomBoolVariable(), inj_stats_enabled, injection_shmem_request(), injection_shmem_startup(), MarkGUCPrefixReserved(), PGC_POSTMASTER, pgstat_register_inj(), pgstat_register_inj_fixed(), prev_shmem_request_hook, prev_shmem_startup_hook, process_shared_preload_libraries_in_progress, shmem_request_hook, and shmem_startup_hook.
void injection_error | ( | const char * | name, |
const void * | private_data | ||
) |
Definition at line 242 of file injection_points.c.
References elog, ERROR, injection_point_allowed(), name, and pgstat_report_inj().
|
static |
Definition at line 178 of file injection_points.c.
References GetNamedDSMSegment(), inj_state, and injection_point_init_state().
Referenced by injection_points_load(), injection_points_set_local(), injection_points_wakeup(), and injection_wait().
void injection_notice | ( | const char * | name, |
const void * | private_data | ||
) |
Definition at line 255 of file injection_points.c.
References elog, injection_point_allowed(), name, NOTICE, and pgstat_report_inj().
|
static |
Definition at line 198 of file injection_points.c.
References INJ_CONDITION_ALWAYS, INJ_CONDITION_PID, MyProcPid, InjectionPointCondition::pid, and InjectionPointCondition::type.
Referenced by injection_error(), injection_notice(), and injection_wait().
|
static |
Definition at line 124 of file injection_points.c.
References ConditionVariableInit(), and SpinLockInit.
Referenced by injection_init_shmem(), and injection_shmem_startup().
Datum injection_points_attach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 338 of file injection_points.c.
References generate_unaccent_rules::action, elog, ERROR, INJ_CONDITION_PID, inj_list_local, injection_point_local, InjectionPointAttach(), lappend(), makeString(), MemoryContextSwitchTo(), MyProcPid, name, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_create_inj(), pgstat_report_inj_fixed(), InjectionPointCondition::pid, pstrdup(), text_to_cstring(), TopMemoryContext, and InjectionPointCondition::type.
Datum injection_points_cached | ( | PG_FUNCTION_ARGS | ) |
Definition at line 418 of file injection_points.c.
References INJECTION_POINT_CACHED, name, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_report_inj_fixed(), and text_to_cstring().
|
static |
Definition at line 220 of file injection_points.c.
References inj_list_local, injection_point_local, InjectionPointDetach(), lfirst, name, pgstat_drop_inj(), and strVal.
Referenced by injection_points_set_local().
Datum injection_points_detach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 495 of file injection_points.c.
References elog, ERROR, inj_list_local, InjectionPointDetach(), list_delete(), makeString(), MemoryContextSwitchTo(), name, NIL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_drop_inj(), pgstat_report_inj_fixed(), text_to_cstring(), and TopMemoryContext.
Datum injection_points_load | ( | PG_FUNCTION_ARGS | ) |
Definition at line 385 of file injection_points.c.
References inj_state, injection_init_shmem(), INJECTION_POINT_LOAD, name, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_report_inj_fixed(), and text_to_cstring().
Datum injection_points_run | ( | PG_FUNCTION_ARGS | ) |
Definition at line 403 of file injection_points.c.
References INJECTION_POINT, name, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_report_inj_fixed(), and text_to_cstring().
Datum injection_points_set_local | ( | PG_FUNCTION_ARGS | ) |
Definition at line 473 of file injection_points.c.
References before_shmem_exit(), inj_state, injection_init_shmem(), injection_point_local, injection_points_cleanup(), and PG_RETURN_VOID.
Datum injection_points_wakeup | ( | PG_FUNCTION_ARGS | ) |
Definition at line 433 of file injection_points.c.
References ConditionVariableBroadcast(), elog, ERROR, i, INJ_MAX_WAIT, inj_state, injection_init_shmem(), InjectionPointSharedState::lock, name, InjectionPointSharedState::name, PG_GETARG_TEXT_PP, PG_RETURN_VOID, SpinLockAcquire, SpinLockRelease, text_to_cstring(), InjectionPointSharedState::wait_counts, and InjectionPointSharedState::wait_point.
|
static |
Definition at line 136 of file injection_points.c.
References MAXALIGN, prev_shmem_request_hook, RequestAddinShmemSpace(), and size.
Referenced by _PG_init().
|
static |
Definition at line 148 of file injection_points.c.
References inj_state, injection_point_init_state(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), prev_shmem_startup_hook, and ShmemInitStruct().
Referenced by _PG_init().
void injection_wait | ( | const char * | name, |
const void * | private_data | ||
) |
Definition at line 269 of file injection_points.c.
References ConditionVariableCancelSleep(), ConditionVariablePrepareToSleep(), ConditionVariableSleep(), elog, ERROR, i, INJ_MAX_WAIT, INJ_NAME_MAXLEN, inj_state, injection_init_shmem(), injection_point_allowed(), InjectionPointSharedState::lock, name, InjectionPointSharedState::name, pgstat_report_inj(), SpinLockAcquire, SpinLockRelease, strlcpy(), InjectionPointSharedState::wait_counts, InjectionPointSharedState::wait_point, and WaitEventInjectionPointNew().
PG_FUNCTION_INFO_V1 | ( | injection_points_attach | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_cached | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_detach | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_load | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_run | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_set_local | ) |
PG_FUNCTION_INFO_V1 | ( | injection_points_wakeup | ) |
Definition at line 70 of file injection_points.c.
Referenced by injection_points_attach(), injection_points_cleanup(), and injection_points_detach().
|
static |
Definition at line 94 of file injection_points.c.
Referenced by injection_init_shmem(), injection_points_load(), injection_points_set_local(), injection_points_wakeup(), injection_shmem_startup(), and injection_wait().
bool inj_stats_enabled = false |
Definition at line 113 of file injection_points.c.
Referenced by _PG_init(), injection_points_stats_fixed(), pgstat_create_inj(), pgstat_drop_inj(), pgstat_fetch_stat_injentry(), pgstat_report_inj(), and pgstat_report_inj_fixed().
|
static |
Definition at line 104 of file injection_points.c.
Referenced by injection_points_attach(), injection_points_cleanup(), and injection_points_set_local().
PG_MODULE_MAGIC |
Definition at line 36 of file injection_points.c.
|
static |
Definition at line 116 of file injection_points.c.
Referenced by _PG_init(), and injection_shmem_request().
|
static |
Definition at line 117 of file injection_points.c.
Referenced by _PG_init(), and injection_shmem_startup().