mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 01:42:55 +00:00
Cleanup perf_counters on backend exit
This commit is contained in:
@@ -2551,12 +2551,17 @@ communicator_read_slru_segment(SlruKind kind, int64 segno, neon_request_lsns *re
|
||||
void
|
||||
communicator_reconfigure_timeout_if_needed(void)
|
||||
{
|
||||
bool needs_set = (MyPState->ring_receive != MyPState->ring_unused ||
|
||||
(MIN_BACKEND_PREFETCH_LSN != InvalidXLogRecPtr &&
|
||||
MIN_BACKEND_PREFETCH_LSN != GetXLogReplayRecPtr(NULL))) &&
|
||||
bool needs_set = MyPState->ring_receive != MyPState->ring_unused &&
|
||||
!AmPrewarmWorker && /* do not pump prefetch state in prewarm worker */
|
||||
readahead_getpage_pull_timeout_ms > 0;
|
||||
|
||||
if (!needs_set && MIN_BACKEND_PREFETCH_LSN != InvalidXLogRecPtr)
|
||||
{
|
||||
if (last_replay_lsn == InvalidXLogRecPtr)
|
||||
MIN_BACKEND_PREFETCH_LSN = InvalidXLogRecPtr;
|
||||
else
|
||||
needs_set = true; /* Can not reset MIN_BACKEND_PREFETCH_LSN now, have to do it later */
|
||||
}
|
||||
if (needs_set != timeout_set)
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/ipc.h"
|
||||
#include "storage/proc.h"
|
||||
#include "storage/shmem.h"
|
||||
#include "utils/builtins.h"
|
||||
@@ -42,6 +43,11 @@ NeonPerfCountersShmemRequest(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
NeonPerfCountersReset(int code, Datum arg)
|
||||
{
|
||||
memset(MyNeonCounters, 0, sizeof(*MyNeonCounters));
|
||||
}
|
||||
|
||||
void
|
||||
NeonPerfCountersShmemInit(void)
|
||||
@@ -58,6 +64,7 @@ NeonPerfCountersShmemInit(void)
|
||||
{
|
||||
/* shared memory is initialized to zeros, so nothing to do here */
|
||||
}
|
||||
on_shmem_exit(NeonPerfCountersReset, 0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
Reference in New Issue
Block a user