mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:44:13 +08:00
mdbx: проверка совместмости флагов GC/FreeDB (backport).
This commit is contained in:
parent
f5bbadf3a5
commit
cda8ebe0bd
20
src/core.c
20
src/core.c
@ -9164,9 +9164,10 @@ static int txn_renew(MDBX_txn *txn, const unsigned flags) {
|
|||||||
}
|
}
|
||||||
#endif /* Windows */
|
#endif /* Windows */
|
||||||
} else {
|
} else {
|
||||||
if (unlikely(txn->mt_dbs[FREE_DBI].md_flags != MDBX_INTEGERKEY)) {
|
if (unlikely((txn->mt_dbs[FREE_DBI].md_flags & DB_PERSISTENT_FLAGS) !=
|
||||||
ERROR("unexpected/invalid db-flags 0x%u for GC/FreeDB",
|
MDBX_INTEGERKEY)) {
|
||||||
txn->mt_dbs[FREE_DBI].md_flags);
|
ERROR("unexpected/invalid db-flags 0x%x for %s",
|
||||||
|
txn->mt_dbs[FREE_DBI].md_flags, "GC/FreeDB");
|
||||||
rc = MDBX_INCOMPATIBLE;
|
rc = MDBX_INCOMPATIBLE;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
@ -12424,12 +12425,12 @@ static int validate_meta(MDBX_env *env, MDBX_meta *const meta,
|
|||||||
meta->mm_dbs[FREE_DBI].md_entries ||
|
meta->mm_dbs[FREE_DBI].md_entries ||
|
||||||
meta->mm_dbs[FREE_DBI].md_leaf_pages ||
|
meta->mm_dbs[FREE_DBI].md_leaf_pages ||
|
||||||
meta->mm_dbs[FREE_DBI].md_overflow_pages)) {
|
meta->mm_dbs[FREE_DBI].md_overflow_pages)) {
|
||||||
WARNING("meta[%u] has false-empty %s, skip it", meta_number, "GC");
|
WARNING("meta[%u] has false-empty %s, skip it", meta_number, "GC/FreeDB");
|
||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
}
|
}
|
||||||
} else if (unlikely(meta->mm_dbs[FREE_DBI].md_root >= meta->mm_geo.next)) {
|
} else if (unlikely(meta->mm_dbs[FREE_DBI].md_root >= meta->mm_geo.next)) {
|
||||||
WARNING("meta[%u] has invalid %s-root %" PRIaPGNO ", skip it", meta_number,
|
WARNING("meta[%u] has invalid %s-root %" PRIaPGNO ", skip it", meta_number,
|
||||||
"GC", meta->mm_dbs[FREE_DBI].md_root);
|
"GC/FreeDB", meta->mm_dbs[FREE_DBI].md_root);
|
||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12451,7 +12452,7 @@ static int validate_meta(MDBX_env *env, MDBX_meta *const meta,
|
|||||||
|
|
||||||
if (unlikely(meta->mm_dbs[FREE_DBI].md_mod_txnid > txnid)) {
|
if (unlikely(meta->mm_dbs[FREE_DBI].md_mod_txnid > txnid)) {
|
||||||
WARNING("meta[%u] has wrong md_mod_txnid %" PRIaTXN " for %s, skip it",
|
WARNING("meta[%u] has wrong md_mod_txnid %" PRIaTXN " for %s, skip it",
|
||||||
meta_number, meta->mm_dbs[FREE_DBI].md_mod_txnid, "GC");
|
meta_number, meta->mm_dbs[FREE_DBI].md_mod_txnid, "GC/FreeDB");
|
||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12461,6 +12462,13 @@ static int validate_meta(MDBX_env *env, MDBX_meta *const meta,
|
|||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely((meta->mm_dbs[FREE_DBI].md_flags & DB_PERSISTENT_FLAGS) !=
|
||||||
|
MDBX_INTEGERKEY)) {
|
||||||
|
WARNING("meta[%u] has unexpected/invalid db-flags 0x%x for %s", meta_number,
|
||||||
|
meta->mm_dbs[FREE_DBI].md_flags, "GC/FreeDB");
|
||||||
|
return MDBX_INCOMPATIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
return MDBX_SUCCESS;
|
return MDBX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user