22// / \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2026
33/* clang-format off */
44
5- #define MDBX_BUILD_SOURCERY bceb4cffb452beb8b344b66517dbfcc12ae8e80220a05240377f9d076620e4d6_v0_14_1_342_g630b73ee
5+ #define MDBX_BUILD_SOURCERY 6d68c22a5b187cc09f4da421420755287684bcef9724c984bf49e8e83944228b_v0_14_1_345_gc83be929
66
77#define LIBMDBX_INTERNALS
88#define MDBX_DEPRECATED
@@ -2566,7 +2566,7 @@ MDBX_MAYBE_UNUSED MDBX_NOTHROW_PURE_FUNCTION static inline bool is_subpage(const
25662566}
25672567
25682568/* The version number for a database's lockfile format. */
2569- #define MDBX_LOCK_VERSION 6
2569+ #define MDBX_LOCK_VERSION 7
25702570
25712571#if MDBX_LOCKING == MDBX_LOCKING_WIN32FILES
25722572
@@ -2646,8 +2646,7 @@ typedef struct pgops {
26462646 gc_prof_stat_t work;
26472647 /* Затраты на поддержку и обновления самой GC */
26482648 gc_prof_stat_t self;
2649- /* Итераций обновления GC,
2650- * больше 1 если были повторы/перезапуски */
2649+ /* Итераций обновления GC, больше 1 если были повторы/перезапуски */
26512650 uint32_t wloops;
26522651 /* Итерации слияния записей GC */
26532652 uint32_t coalescences;
@@ -2657,6 +2656,10 @@ typedef struct pgops {
26572656 uint32_t flushes;
26582657 /* Попытки пнуть тормозящих читателей */
26592658 uint32_t kicks;
2659+ /* Максимальная замеченная разница между последним и самым старым читаемым MVCC-снимками */
2660+ uint32_t max_reader_lag;
2661+ /* Максимальное замеченное количество страниц удерживаемых от переработки из-за чтения старых MVCC-снимков */
2662+ uint32_t max_retained_pages;
26602663 } gc_prof;
26612664} pgop_stat_t ;
26622665
@@ -2792,7 +2795,8 @@ typedef struct shared_lck {
27922795 osal_ipclock_t wrt_lock;
27932796#endif /* MDBX_LOCKING > 0 */
27942797
2795- atomic_txnid_t cached_oldest;
2798+ atomic_txnid_t cached_oldest_txnid;
2799+ mdbx_atomic_uint64_t cached_oldest_retired;
27962800
27972801 /* Timestamp of entering an out-of-sync state. Value is represented in a
27982802 * suitable system-dependent form, for example clock_gettime(CLOCK_BOOTTIME)
@@ -2837,8 +2841,9 @@ typedef struct shared_lck {
28372841/* Lockfile format signature: version, features and field layout */
28382842#define MDBX_LOCK_FORMAT \
28392843 (MDBX_LCK_SIGN * 27733 + (unsigned )sizeof (reader_slot_t ) * 13 + \
2840- (unsigned )offsetof(reader_slot_t , snapshot_pages_used) * 251 + (unsigned )offsetof(lck_t , cached_oldest) * 83 + \
2841- (unsigned )offsetof(lck_t , rdt_length) * 37 + (unsigned )offsetof(lck_t , rdt) * 29 )
2844+ (unsigned )offsetof(reader_slot_t , snapshot_pages_used) * 251 + \
2845+ (unsigned )offsetof(lck_t , cached_oldest_txnid) * 83 + (unsigned )offsetof(lck_t , rdt_length) * 37 + \
2846+ (unsigned )offsetof(lck_t , rdt) * 29 )
28422847#endif /* FLEXIBLE_ARRAY_MEMBERS */
28432848} lck_t ;
28442849
@@ -3825,10 +3830,14 @@ MDBX_INTERNAL int audit_ex(MDBX_txn *txn, size_t retired_stored, bool dont_filte
38253830/* mvcc-readers.c */
38263831MDBX_INTERNAL bsr_t mvcc_bind_slot (MDBX_env *env);
38273832MDBX_MAYBE_UNUSED MDBX_INTERNAL pgno_t mvcc_largest_this (MDBX_env *env, pgno_t largest);
3828- MDBX_INTERNAL txnid_t mvcc_shapshot_oldest (MDBX_env *const env, const txnid_t steady);
38293833MDBX_INTERNAL pgno_t mvcc_snapshot_largest (const MDBX_env *env, pgno_t last_used_page);
38303834MDBX_INTERNAL int mvcc_cleanup_dead (MDBX_env *env, int rlocked, int *dead);
3831- MDBX_INTERNAL bool mvcc_kick_laggards (MDBX_env *env, const txnid_t laggard);
3835+ MDBX_INTERNAL bool mvcc_kick_laggards (MDBX_txn *txn, const txnid_t laggard);
3836+ typedef struct oldest_readed_shapshot_into {
3837+ txnid_t oldest_txnid, steady_txnid;
3838+ } orsi_t ;
3839+
3840+ MDBX_INTERNAL orsi_t mvcc_shapshot_oldest (const MDBX_txn *const txn);
38323841
38333842/* dxb.c */
38343843MDBX_INTERNAL int dxb_setup (MDBX_env *env, const int lck_rc, const mdbx_mode_t mode_bits);
@@ -4870,7 +4879,7 @@ MDBX_MAYBE_UNUSED static void static_checks(void) {
48704879 STATIC_ASSERT (offsetof (lck_t , wrt_lock) % MDBX_CACHELINE_SIZE == 0 );
48714880 STATIC_ASSERT (offsetof (lck_t , rdt_lock) % MDBX_CACHELINE_SIZE == 0 );
48724881#else
4873- STATIC_ASSERT (offsetof (lck_t , cached_oldest ) % MDBX_CACHELINE_SIZE == 0 );
4882+ STATIC_ASSERT (offsetof (lck_t , cached_oldest_txnid ) % MDBX_CACHELINE_SIZE == 0 );
48744883 STATIC_ASSERT (offsetof (lck_t , rdt_length) % MDBX_CACHELINE_SIZE == 0 );
48754884#endif /* MDBX_LOCKING */
48764885#if FLEXIBLE_ARRAY_MEMBERS
0 commit comments