|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <sys/stat.h>#include "common/hashfn.h"#include "miscadmin.h"#include "pg_stash_advice.h"#include "postmaster/bgworker.h"#include "postmaster/interrupt.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/latch.h"#include "storage/proc.h"#include "storage/procsignal.h"#include "utils/backend_status.h"#include "utils/guc.h"#include "utils/memutils.h"#include "utils/timestamp.h"#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
| struct | pgsa_writer_context |
| struct | pgsa_saved_entry |
| struct | pgsa_saved_stash |
Macros | |
| #define | SH_PREFIX pgsa_saved_stash_table |
| #define | SH_ELEMENT_TYPE pgsa_saved_stash |
| #define | SH_KEY_TYPE char * |
| #define | SH_KEY name |
| #define | SH_HASH_KEY(tb, key) hash_bytes((const unsigned char *) (key), strlen(key)) |
| #define | SH_EQUAL(tb, a, b) (strcmp(a, b) == 0) |
| #define | SH_SCOPE static inline |
| #define | SH_DEFINE |
| #define | SH_DECLARE |
Typedefs | |
| typedef struct pgsa_writer_context | pgsa_writer_context |
| typedef struct pgsa_saved_entry | pgsa_saved_entry |
| typedef struct pgsa_saved_stash | pgsa_saved_stash |
| #define SH_DECLARE |
Definition at line 68 of file stashpersist.c.
| #define SH_DEFINE |
Definition at line 67 of file stashpersist.c.
| #define SH_ELEMENT_TYPE pgsa_saved_stash |
Definition at line 61 of file stashpersist.c.
Definition at line 64 of file stashpersist.c.
Definition at line 63 of file stashpersist.c.
Definition at line 62 of file stashpersist.c.
| #define SH_PREFIX pgsa_saved_stash_table |
Definition at line 60 of file stashpersist.c.
Definition at line 66 of file stashpersist.c.
|
extern |
Definition at line 94 of file stashpersist.c.
References BackgroundWorkerUnblockSignals(), before_shmem_exit(), pgsa_shared_state::bgworker_pid, pgsa_shared_state::change_count, ConfigReloadPending, DEBUG1, ereport, errmsg, fb(), GetCurrentTimestamp(), InitializeSessionUserIdStandalone(), InvalidPid, pgsa_shared_state::lock, LOG, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyLatch, MyProcPid, pg_atomic_read_u64(), pg_atomic_test_set_flag(), pg_atomic_unlocked_test_flag(), pg_stash_advice_persist_interval, PG_WAIT_EXTENSION, PGC_SIGHUP, pgsa_attach(), pgsa_detach_shmem(), pgsa_read_from_disk(), pgsa_state, pgsa_write_to_disk(), pgstat_beinit(), pgstat_bestart_final(), pgstat_bestart_initial(), pqsignal, ProcessConfigFile(), procsignal_sigusr1_handler(), ResetLatch(), ShutdownRequestPending, SIGHUP, SignalHandlerForConfigReload(), SignalHandlerForShutdownRequest(), SIGUSR1, pgsa_shared_state::stashes_ready, TimestampDifferenceMilliseconds(), TimestampTzPlusMilliseconds, WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_TIMEOUT.
|
static |
Definition at line 572 of file stashpersist.c.
References appendStringInfoChar(), appendStringInfoString(), buf, and str.
Referenced by pgsa_write_entries().
Definition at line 221 of file stashpersist.c.
References pgsa_shared_state::bgworker_pid, InvalidPid, pgsa_shared_state::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcPid, and pgsa_state.
Referenced by pg_stash_advice_worker_main().
Definition at line 604 of file stashpersist.c.
Referenced by pgsa_read_from_disk().
Definition at line 233 of file stashpersist.c.
References pgsa_saved_entry::advice_string, AllocateFile(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentMemoryContext, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg, ERROR, fb(), FreeFile(), fstat, pgsa_shared_state::lock, LOG, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MCXT_ALLOC_HUGE, MemoryContextDelete(), MemoryContextSwitchTo(), name, palloc(), palloc_extended(), PGSA_DUMP_FILE, pgsa_entry_dshash, pgsa_next_tsv_field(), pgsa_reset_all_stashes(), pgsa_restore_entries(), pgsa_restore_stashes(), pgsa_state, pgsa_unescape_tsv_field(), pgsa_saved_entry::queryId, repalloc(), and pgsa_saved_entry::stash_name.
Referenced by pg_stash_advice_worker_main().
|
static |
Definition at line 626 of file stashpersist.c.
References DEBUG2, ereport, errmsg, fb(), i, pgsa_shared_state::lock, LW_SHARED, LWLockAcquire(), LWLockRelease(), pgsa_set_advice_string(), and pgsa_state.
Referenced by pgsa_read_from_disk().
|
static |
Definition at line 645 of file stashpersist.c.
References DEBUG2, ereport, errmsg, fb(), pgsa_shared_state::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pgsa_saved_stash::name, pgsa_create_stash(), and pgsa_state.
Referenced by pgsa_read_from_disk().
Definition at line 669 of file stashpersist.c.
References ereport, errcode(), ERRCODE_DATA_CORRUPTED, errmsg, ERROR, fb(), filename, likely, and str.
Referenced by pgsa_read_from_disk().
|
static |
Definition at line 722 of file stashpersist.c.
References pgsa_entry::advice_string, appendStringInfo(), appendStringInfoChar(), dsa_get_address(), dshash_seq_init(), dshash_seq_next(), dshash_seq_term(), fb(), InvalidDsaPointer, pgsa_entry::key, pgsa_stash_name::name, pgsa_append_tsv_escaped_string(), pgsa_dsa_area, pgsa_entry_dshash, pgsa_entry_key::pgsa_stash_id, pgsa_write_error(), pgsa_entry_key::queryId, and resetStringInfo().
Referenced by pgsa_write_to_disk().
|
static |
Definition at line 760 of file stashpersist.c.
References ereport, errcode_for_file_access(), errmsg, ERROR, fb(), and FreeFile().
Referenced by pgsa_write_entries(), and pgsa_write_stashes().
|
static |
Definition at line 777 of file stashpersist.c.
References appendStringInfo(), Assert, dshash_seq_init(), dshash_seq_next(), dshash_seq_term(), fb(), pgsa_stash_name::name, pgsa_stash_dshash, pgsa_write_error(), pstrdup(), and resetStringInfo().
Referenced by pgsa_write_to_disk().
Definition at line 498 of file stashpersist.c.
References AllocateFile(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentMemoryContext, DEBUG1, durable_rename(), ereport, errcode_for_file_access(), errmsg, ERROR, fb(), FreeFile(), initStringInfo(), LOG, MAXPGPATH, MemoryContextDelete(), MemoryContextSwitchTo(), PGSA_DUMP_FILE, pgsa_entry_dshash, pgsa_write_entries(), pgsa_write_stashes(), and snprintf.
Referenced by pg_stash_advice_worker_main().