mdbx: LCK-format version 3.

The LCK file is re-created at every opportunity when the process that
opens the database is the only one that works with it. Thus the change
of the format of the file LCK creates only minimal compatibility
problems.

Applications using different versions of _libmdbx_ will be able to work
with one database alternately, but not at the same time. This appears to
be an acceptable inconvenience in exchange for new features.

Change-Id: I9414b3fffd53d5519c8172c57345b1eaf6e51c77
This commit is contained in:
Leonid Yuriev
2019-08-23 03:36:56 +03:00
parent de88707946
commit 6f8238e1e9
6 changed files with 172 additions and 152 deletions

View File

@@ -41,7 +41,6 @@
/*----------------------------------------------------------------------------*/
/* C99 includes */
#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
@@ -59,6 +58,22 @@
#include <malloc.h>
#endif /* xBSD */
/* C11 stdalign.h */
#if __has_include(<stdalign.h>)
#include <stdalign.h>
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define alignas(N) _Alignas(N)
#elif defined(_MSC_VER)
#define alignas(N) __declspec(align(N))
#elif __has_attribute(aligned) || defined(__GNUC__)
#define alignas(N) __attribute__((aligned(N)))
#else
#error "FIXME: Required _alignas() or equivalent."
#endif
/*----------------------------------------------------------------------------*/
/* Systems includes */
#ifndef _POSIX_C_SOURCE
#ifdef _POSIX_SOURCE
#define _POSIX_C_SOURCE 1
@@ -71,9 +86,6 @@
#define _XOPEN_SOURCE 0
#endif
/*----------------------------------------------------------------------------*/
/* Systems includes */
#if defined(_WIN32) || defined(_WIN64)
#define WIN32_LEAN_AND_MEAN
#include <tlhelp32.h>
@@ -599,12 +611,6 @@ void mdbx_osal_jitter(bool tiny);
#define MDBX_OSAL_LOCK_SIGN UINT32_C(0x8017)
#endif /* MDBX_OSAL_LOCK */
#ifdef MDBX_OSAL_LOCK
#define MDBX_OSAL_LOCK_SIZE sizeof(MDBX_OSAL_LOCK)
#else
#define MDBX_OSAL_LOCK_SIZE 0
#endif /* MDBX_OSAL_LOCK_SIZE */
/// \brief Инициализация объектов синхронизации внутри текущего процесса
/// связанных с экземпляром MDBX_env.
/// \return Код ошибки или 0 в случае успеха.