39 #define INJ_MAX_WAIT 8
40 #define INJ_NAME_MAXLEN 64
97 const void *private_data);
99 const void *private_data);
101 const void *private_data);
129 memset(
state->wait_counts, 0,
sizeof(
state->wait_counts));
202 switch (condition->
type)
271 uint32 old_wait_counts = 0;
273 uint32 injection_wait_event = 0;
308 elog(
ERROR,
"could not find free slot for wait of injection point %s ",
321 if (old_wait_counts != new_wait_counts)
345 if (strcmp(
action,
"error") == 0)
346 function =
"injection_error";
347 else if (strcmp(
action,
"notice") == 0)
348 function =
"injection_notice";
349 else if (strcmp(
action,
"wait") == 0)
350 function =
"injection_wait";
352 elog(
ERROR,
"incorrect action \"%s\" for injection point creation",
action);
454 elog(
ERROR,
"could not find injection point %s to wake up",
name);
501 elog(
ERROR,
"could not detach injection point \"%s\"",
name);
527 "Enables statistics for injection points.",
bool ConditionVariableCancelSleep(void)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariablePrepareToSleep(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
void ConditionVariableSleep(ConditionVariable *cv, uint32 wait_event_info)
void * GetNamedDSMSegment(const char *name, size_t size, void(*init_callback)(void *ptr), bool *found)
#define PG_GETARG_TEXT_PP(n)
void DefineCustomBoolVariable(const char *name, const char *short_desc, const char *long_desc, bool *valueAddr, bool bootValue, GucContext context, int flags, GucBoolCheckHook check_hook, GucBoolAssignHook assign_hook, GucShowHook show_hook)
void MarkGUCPrefixReserved(const char *className)
bool InjectionPointDetach(const char *name)
void InjectionPointAttach(const char *name, const char *library, const char *function, const void *private_data, int private_data_size)
#define INJECTION_POINT(name)
#define INJECTION_POINT_CACHED(name)
#define INJECTION_POINT_LOAD(name)
Datum injection_points_detach(PG_FUNCTION_ARGS)
static bool injection_point_local
static void injection_shmem_request(void)
PG_FUNCTION_INFO_V1(injection_points_attach)
PGDLLEXPORT void injection_wait(const char *name, const void *private_data)
InjectionPointConditionType
static void injection_init_shmem(void)
Datum injection_points_cached(PG_FUNCTION_ARGS)
Datum injection_points_attach(PG_FUNCTION_ARGS)
struct InjectionPointCondition InjectionPointCondition
Datum injection_points_run(PG_FUNCTION_ARGS)
static List * inj_list_local
Datum injection_points_set_local(PG_FUNCTION_ARGS)
static shmem_startup_hook_type prev_shmem_startup_hook
static bool injection_point_allowed(InjectionPointCondition *condition)
static shmem_request_hook_type prev_shmem_request_hook
static void injection_points_cleanup(int code, Datum arg)
PGDLLEXPORT void injection_notice(const char *name, const void *private_data)
static void injection_shmem_startup(void)
struct InjectionPointSharedState InjectionPointSharedState
Datum injection_points_wakeup(PG_FUNCTION_ARGS)
PGDLLEXPORT void injection_error(const char *name, const void *private_data)
static void injection_point_init_state(void *ptr)
static InjectionPointSharedState * inj_state
Datum injection_points_load(PG_FUNCTION_ARGS)
void pgstat_report_inj(const char *name)
void pgstat_register_inj(void)
void pgstat_create_inj(const char *name)
void pgstat_drop_inj(const char *name)
void pgstat_register_inj_fixed(void)
void pgstat_report_inj_fixed(uint32 numattach, uint32 numdetach, uint32 numrun, uint32 numcached, uint32 numloaded)
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
void(* shmem_startup_hook_type)(void)
shmem_startup_hook_type shmem_startup_hook
void RequestAddinShmemSpace(Size size)
List * lappend(List *list, void *datum)
List * list_delete(List *list, void *datum)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
char * pstrdup(const char *in)
MemoryContext TopMemoryContext
void(* shmem_request_hook_type)(void)
shmem_request_hook_type shmem_request_hook
bool process_shared_preload_libraries_in_progress
size_t strlcpy(char *dst, const char *src, size_t siz)
MemoryContextSwitchTo(old_ctx)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
static pg_noinline void Size size
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
InjectionPointConditionType type
uint32 wait_counts[INJ_MAX_WAIT]
char name[INJ_MAX_WAIT][INJ_NAME_MAXLEN]
ConditionVariable wait_point
String * makeString(char *str)
char * text_to_cstring(const text *t)
uint32 WaitEventInjectionPointNew(const char *wait_event_name)