37 #define INJ_MAX_WAIT 8
38 #define INJ_NAME_MAXLEN 64
90 const void *private_data);
92 const void *private_data);
94 const void *private_data);
108 memset(
state->wait_counts, 0,
sizeof(
state->wait_counts));
141 switch (condition->
type)
203 uint32 old_wait_counts = 0;
205 uint32 injection_wait_event = 0;
238 elog(
ERROR,
"could not find free slot for wait of injection point %s ",
251 if (old_wait_counts != new_wait_counts)
275 if (strcmp(
action,
"error") == 0)
276 function =
"injection_error";
277 else if (strcmp(
action,
"notice") == 0)
278 function =
"injection_notice";
279 else if (strcmp(
action,
"wait") == 0)
280 function =
"injection_wait";
282 elog(
ERROR,
"incorrect action \"%s\" for injection point creation",
action);
376 elog(
ERROR,
"could not find injection point %s to wake up",
name);
422 elog(
ERROR,
"could not detach injection point \"%s\"",
name);
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)
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
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 bool injection_point_allowed(InjectionPointCondition *condition)
static void injection_points_cleanup(int code, Datum arg)
PGDLLEXPORT void injection_notice(const char *name, const void *private_data)
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 before_shmem_exit(pg_on_exit_callback function, Datum arg)
List * lappend(List *list, void *datum)
List * list_delete(List *list, void *datum)
char * pstrdup(const char *in)
MemoryContext TopMemoryContext
size_t strlcpy(char *dst, const char *src, size_t siz)
MemoryContextSwitchTo(old_ctx)
#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)