From 6fc3b89f792037198144c41a611028a0948df9a8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 11 Sep 2019 19:12:57 +0300 Subject: [PATCH] mdbx: add reader_check_timestamp info LCK. Change-Id: I2f53b5996def8ff1d87a011fc662b94e2be3c467 --- src/elements/core.c | 1 + src/elements/internals.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/elements/core.c b/src/elements/core.c index 596b1e32..8d7f9b3b 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -13121,6 +13121,7 @@ int __cold mdbx_reader_check0(MDBX_env *env, int rdt_locked, int *dead) { return MDBX_SUCCESS; } + lck->mti_reader_check_timestamp = mdbx_osal_monotime(); const unsigned snap_nreaders = lck->mti_numreaders; mdbx_pid_t pidsbuf_onstask[142]; mdbx_pid_t *const pids = diff --git a/src/elements/internals.h b/src/elements/internals.h index a2ff6801..41ecd9c8 100644 --- a/src/elements/internals.h +++ b/src/elements/internals.h @@ -481,6 +481,9 @@ typedef struct MDBX_lockinfo { /* Threshold of un-synced-with-disk pages for auto-sync feature, * zero means no-threshold, i.e. auto-sync is disabled. */ volatile pgno_t mti_autosync_threshold; + + uint32_t reserved_pad; + /* Period for timed auto-sync feature, i.e. at the every steady checkpoint * the mti_unsynced_timeout sets to the current_time + mti_autosync_period. * The time value is represented in a suitable system-dependent form, for @@ -491,7 +494,7 @@ typedef struct MDBX_lockinfo { /* Marker to distinguish uniqueness of DB/CLK.*/ volatile uint64_t mti_bait_uniqueness; - /* /proc/sys/kernel/random/boot_id */ + /* the hash of /proc/sys/kernel/random/boot_id or analogue */ volatile uint64_t mti_boot_id; alignas(MDBX_CACHELINE_SIZE) /* cacheline ---------------------------------*/ @@ -515,6 +518,9 @@ typedef struct MDBX_lockinfo { /* Number of page which was discarded last time by madvise(MADV_FREE). */ volatile pgno_t mti_discarded_tail; + /* Timestamp of the last readers check. */ + volatile uint64_t mti_reader_check_timestamp; + alignas(MDBX_CACHELINE_SIZE) /* cacheline ---------------------------------*/ #ifdef MDBX_OSAL_LOCK