mdbx: allow devel-signatures (for Miranga-NG).

Binary format of v0.1.x and v0.2.x is frozed.

This commit allows to open DBs created early by devel-versions of libmdbx.
It seems to be required for Miranda-NG users, but no one else.

Change-Id: Icf1d0477dcc3d212e03c87ab8c5255c3382425e5
This commit is contained in:
Leonid Yuriev 2018-10-15 12:18:39 +03:00
parent d2bfb2e489
commit 3c4e9443ae
2 changed files with 6 additions and 2 deletions

View File

@ -476,8 +476,10 @@ typedef struct MDBX_lockinfo {
(uint16_t)(MDBX_LOCKINFO_WHOLE_SIZE + MDBX_CACHELINE_SIZE - 1))
#define MDBX_DATA_MAGIC ((MDBX_MAGIC << 8) + MDBX_DATA_VERSION)
#define MDBX_DATA_MAGIC_DEVEL ((MDBX_MAGIC << 8) + 255)
#define MDBX_LOCK_MAGIC ((MDBX_MAGIC << 8) + MDBX_LOCK_VERSION)
#define MDBX_LOCK_MAGIC_DEVEL ((MDBX_MAGIC << 8) + 255)
#ifndef MDBX_ASSUME_MALLOC_OVERHEAD
#define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u)

View File

@ -4928,7 +4928,8 @@ static int __cold mdbx_read_header(MDBX_env *env, MDBX_meta *meta,
mdbx_info("meta[%u] was updated, re-read it", meta_number);
}
if (page.mp_meta.mm_magic_and_version != MDBX_DATA_MAGIC) {
if (page.mp_meta.mm_magic_and_version != MDBX_DATA_MAGIC &&
page.mp_meta.mm_magic_and_version != MDBX_DATA_MAGIC_DEVEL) {
mdbx_error("meta[%u] has invalid magic/version %" PRIx64, meta_number,
page.mp_meta.mm_magic_and_version);
return ((page.mp_meta.mm_magic_and_version >> 8) != MDBX_MAGIC)
@ -6298,7 +6299,8 @@ static int __cold mdbx_setup_lck(MDBX_env *env, char *lck_pathname,
env->me_lck->mti_magic_and_version = MDBX_LOCK_MAGIC;
env->me_lck->mti_os_and_format = MDBX_LOCK_FORMAT;
} else {
if (env->me_lck->mti_magic_and_version != MDBX_LOCK_MAGIC) {
if (env->me_lck->mti_magic_and_version != MDBX_LOCK_MAGIC &&
env->me_lck->mti_magic_and_version != MDBX_LOCK_MAGIC_DEVEL) {
mdbx_error("lock region has invalid magic/version");
return ((env->me_lck->mti_magic_and_version >> 8) != MDBX_MAGIC)
? MDBX_INVALID