PostgreSQL Source Code: src/test/modules/injection_points/injection_points.c File Reference (original) (raw)
Go to the source code of this file.
Typedefs | |
---|---|
typedef enum InjectionPointConditionType | InjectionPointConditionType |
typedef struct InjectionPointCondition | InjectionPointCondition |
typedef struct InjectionPointSharedState | InjectionPointSharedState |
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 |
◆ INJ_MAX_WAIT
◆ INJ_NAME_MAXLEN
#define INJ_NAME_MAXLEN 64
◆ InjectionPointCondition
◆ InjectionPointConditionType
◆ InjectionPointSharedState
◆ InjectionPointConditionType
Enumerator |
---|
INJ_CONDITION_ALWAYS |
INJ_CONDITION_PID |
Definition at line 51 of file injection_points.c.
52{
InjectionPointConditionType
◆ _PG_init()
Definition at line 550 of file injection_points.c.
551{
553 return;
554
556 "Enables statistics for injection points.",
557 NULL,
559 false,
561 0,
562 NULL,
563 NULL,
564 NULL);
565
567
568
573
576}
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)
static void injection_shmem_request(void)
static shmem_startup_hook_type prev_shmem_startup_hook
static shmem_request_hook_type prev_shmem_request_hook
static void injection_shmem_startup(void)
void pgstat_register_inj(void)
void pgstat_register_inj_fixed(void)
shmem_startup_hook_type shmem_startup_hook
shmem_request_hook_type shmem_request_hook
bool process_shared_preload_libraries_in_progress
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.
◆ injection_error()
void injection_error | ( | const char * | name, |
---|---|---|---|
const void * | private_data, | ||
void * | arg | ||
) |
Definition at line 245 of file injection_points.c.
246{
248 char *argstr = (char *) arg;
249
251 return;
252
254
255 if (argstr)
256 elog(ERROR, "error triggered for injection point %s (%s)",
257 name, argstr);
258 else
259 elog(ERROR, "error triggered for injection point %s", name);
260}
static bool injection_point_allowed(InjectionPointCondition *condition)
void pgstat_report_inj(const char *name)
References arg, elog, ERROR, injection_point_allowed(), name, and pgstat_report_inj().
◆ injection_init_shmem()
static void injection_init_shmem ( void ) | static |
---|
◆ injection_notice()
void injection_notice | ( | const char * | name, |
---|---|---|---|
const void * | private_data, | ||
void * | arg | ||
) |
Definition at line 263 of file injection_points.c.
264{
266 char *argstr = (char *) arg;
267
269 return;
270
272
273 if (argstr)
274 elog(NOTICE, "notice triggered for injection point %s (%s)",
275 name, argstr);
276 else
277 elog(NOTICE, "notice triggered for injection point %s", name);
278}
References arg, elog, injection_point_allowed(), name, NOTICE, and pgstat_report_inj().
◆ injection_point_allowed()
◆ injection_point_init_state()
static void injection_point_init_state ( void * ptr) | static |
---|
◆ injection_points_attach()
Definition at line 351 of file injection_points.c.
352{
357
358 if (strcmp(action, "error") == 0)
359 function = "injection_error";
360 else if (strcmp(action, "notice") == 0)
361 function = "injection_notice";
362 else if (strcmp(action, "wait") == 0)
364 else
365 elog(ERROR, "incorrect action \"%s\" for injection point creation", action);
366
368 {
371 }
372
376
378 {
380
381
385 }
386
387
389
391}
#define PG_GETARG_TEXT_PP(n)
void InjectionPointAttach(const char *name, const char *library, const char *function, const void *private_data, int private_data_size)
static bool injection_point_local
static List * inj_list_local
void pgstat_create_inj(const char *name)
void pgstat_report_inj_fixed(uint32 numattach, uint32 numdetach, uint32 numrun, uint32 numcached, uint32 numloaded)
List * lappend(List *list, void *datum)
char * pstrdup(const char *in)
MemoryContext TopMemoryContext
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
on_exit_nicely_callback function
String * makeString(char *str)
char * text_to_cstring(const text *t)
References generate_unaccent_rules::action, elog, ERROR, function, 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.
◆ injection_points_cached()
◆ injection_points_cleanup()
static void injection_points_cleanup ( int code, Datum arg ) | static |
---|
◆ injection_points_detach()
Definition at line 524 of file injection_points.c.
525{
527
530 elog(ERROR, "could not detach injection point \"%s\"", name);
531
532
534 {
536
540 }
541
542
544
546}
List * list_delete(List *list, void *datum)
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.
◆ injection_points_load()
◆ injection_points_run()
◆ injection_points_set_local()
◆ injection_points_wakeup()
Definition at line 462 of file injection_points.c.
463{
466
469
470
473 {
475 {
477 break;
478 }
479 }
481 {
483 elog(ERROR, "could not find injection point %s to wake up", name);
484 }
487
488
491}
void ConditionVariableBroadcast(ConditionVariable *cv)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
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.
◆ injection_shmem_request()
static void injection_shmem_request ( void ) | static |
---|
◆ injection_shmem_startup()
static void injection_shmem_startup ( void ) | static |
---|
◆ injection_wait()
void injection_wait | ( | const char * | name, |
---|---|---|---|
const void * | private_data, | ||
void * | arg | ||
) |
Definition at line 282 of file injection_points.c.
283{
284 uint32 old_wait_counts = 0;
286 uint32 injection_wait_event = 0;
288
291
293 return;
294
296
297
298
299
300
301
303
304
305
306
309 {
311 {
315 break;
316 }
317 }
319
321 elog(ERROR, "could not find free slot for wait of injection point %s ",
323
324
326 for (;;)
327 {
328 uint32 new_wait_counts;
329
333
334 if (old_wait_counts != new_wait_counts)
335 break;
337 }
339
340
344}
bool ConditionVariableCancelSleep(void)
void ConditionVariablePrepareToSleep(ConditionVariable *cv)
void ConditionVariableSleep(ConditionVariable *cv, uint32 wait_event_info)
size_t strlcpy(char *dst, const char *src, size_t siz)
uint32 WaitEventInjectionPointNew(const char *wait_event_name)
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() [1/7]
◆ PG_FUNCTION_INFO_V1() [2/7]
◆ PG_FUNCTION_INFO_V1() [3/7]
◆ PG_FUNCTION_INFO_V1() [4/7]
◆ PG_FUNCTION_INFO_V1() [5/7]
◆ PG_FUNCTION_INFO_V1() [6/7]
◆ PG_FUNCTION_INFO_V1() [7/7]
◆ inj_list_local
◆ inj_state
◆ inj_stats_enabled
bool inj_stats_enabled = false
◆ injection_point_local
bool injection_point_local = false | static |
---|