36#define SH_PREFIX pgsa_stash_count_table
37#define SH_ELEMENT_TYPE pgsa_stash_count
38#define SH_KEY_TYPE uint64
39#define SH_KEY pgsa_stash_id
40#define SH_HASH_KEY(tb, key) hash_bytes((const unsigned char *) &(key), sizeof(uint64))
41#define SH_EQUAL(tb, a, b) (a == b)
42#define SH_SCOPE static inline
154 char *stash_name =
NULL;
180 errmsg(
"advice stash \"%s\" does not exist", stash_name));
198 stash->pgsa_stash_id,
295 errmsg(
"cannot set advice string for query ID 0"));
341 errmsg(
"pg_stash_advice worker is already running under PID %d",
static bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define Assert(condition)
void * dsa_get_address(dsa_area *area, dsa_pointer dp)
#define InvalidDsaPointer
void dshash_seq_init(dshash_seq_status *status, dshash_table *hash_table, bool exclusive)
void dshash_seq_term(dshash_seq_status *status)
void * dshash_seq_next(dshash_seq_status *status)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
#define PG_GETARG_TEXT_PP(n)
#define PG_GETARG_INT64(n)
#define PG_FUNCTION_INFO_V1(funcname)
void InitMaterializedSRF(FunctionCallInfo fcinfo, uint32 flags)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
char * pstrdup(const char *in)
MemoryContext CurrentMemoryContext
dshash_table * pgsa_entry_dshash
dshash_table * pgsa_stash_dshash
void pgsa_create_stash(char *stash_name)
void pgsa_drop_stash(char *stash_name)
void pgsa_set_advice_string(char *stash_name, int64 queryId, char *advice_string)
void pgsa_start_worker(void)
uint64 pgsa_lookup_stash_id(char *stash_name)
void pgsa_check_stash_name(char *stash_name)
pgsa_shared_state * pgsa_state
void pgsa_clear_advice_string(char *stash_name, int64 queryId)
void pgsa_check_lockout(void)
static Datum Int64GetDatum(int64 X)
char * psprintf(const char *fmt,...)
Datum pg_get_advice_stash_contents(PG_FUNCTION_ARGS)
Datum pg_start_stash_advice_worker(PG_FUNCTION_ARGS)
Datum pg_get_advice_stashes(PG_FUNCTION_ARGS)
Datum pg_drop_advice_stash(PG_FUNCTION_ARGS)
Datum pg_create_advice_stash(PG_FUNCTION_ARGS)
Datum pg_set_stashed_advice(PG_FUNCTION_ARGS)
dsa_pointer advice_string
pg_atomic_flag stashes_ready
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
char * text_to_cstring(const text *t)