libmdbx 0.14.2.0 (2026-05-14T21:14:59+03:00)
One of the fastest compact embeddable key-value ACID storage engine without WAL.
Loading...
Searching...
No Matches
Checking and Recovery

Classes

struct  MDBX_chk_line_t
 A virtual row of the report generated during a database integrity check. More...
struct  MDBX_chk_issue_t
 An issue problem was discovered during a database integrity check. More...
struct  MDBX_chk_scope_t
 A hierarchical context during a database integrity check. More...
struct  MDBX_chk_histogram
 A histogram with some statistical information collected during a database integrity check. More...
struct  MDBX_chk_table_t
 Information about a certain key-value table during a database integrity check. More...
struct  MDBX_chk_context_t
 The context for checking the integrity of a database. More...
struct  MDBX_chk_callbacks_t
 A set of callback functions used for checking the integrity of a database. More...
union  MDBX_chk_scope_t.usr_z
union  MDBX_chk_scope_t.usr_v
union  MDBX_chk_scope_t.usr_o
struct  MDBX_chk_histogram.ranges
struct  MDBX_chk_table_t.pages
struct  MDBX_chk_table_t.histogram
struct  MDBX_chk_context_t.result

Macros

#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable)
#define mdbx_preopen_snapinfoT(pathname, info, bytes)

Functions

LIBMDBX_API int mdbx_env_turn_for_recovery (MDBX_env *env, unsigned target_meta)
 Turn database to the specified meta-page.

Detailed Description

Basically this is internal API for mdbx_chk tool, etc. You should avoid to use it, except some extremal special cases.


Class Documentation

◆ MDBX_chk_line_t

struct MDBX_chk_line_t

A virtual row of the report generated during a database integrity check.

See also
mdbx_env_chk()
Class Members
char * begin
struct MDBX_chk_context * ctx
uint8_t empty
char * end
char * out
uint8_t scope_depth
uint8_t severity

◆ MDBX_chk_issue_t

struct MDBX_chk_issue_t

An issue problem was discovered during a database integrity check.

See also
mdbx_env_chk()
Class Members
const char * caption
size_t count
struct MDBX_chk_issue * next

◆ MDBX_chk_scope_t

struct MDBX_chk_scope_t

A hierarchical context during a database integrity check.

See also
mdbx_env_chk()

Public Attributes

MDBX_chk_issue_tissues
struct MDBX_chk_internal * internal
const void * object
MDBX_chk_stage_t stage
MDBX_chk_severity_t verbosity
size_t subtotal_issues
union { 
void * ptr
size_t number
usr_z
union { 
void * ptr
size_t number
usr_v
union { 
void * ptr
size_t number
usr_o

Member Data Documentation

◆ internal

struct MDBX_chk_internal* MDBX_chk_scope_t::internal

◆ issues

MDBX_chk_issue_t* MDBX_chk_scope_t::issues

◆ object

const void* MDBX_chk_scope_t::object

◆ stage

MDBX_chk_stage_t MDBX_chk_scope_t::stage

◆ subtotal_issues

size_t MDBX_chk_scope_t::subtotal_issues

◆ [union]

union { ... } MDBX_chk_scope_t::usr_o

◆ [union]

union { ... } MDBX_chk_scope_t::usr_v

◆ [union]

union { ... } MDBX_chk_scope_t::usr_z

◆ verbosity

MDBX_chk_severity_t MDBX_chk_scope_t::verbosity

◆ MDBX_chk_histogram

struct MDBX_chk_histogram

A histogram with some statistical information collected during a database integrity check.

See also
mdbx_env_chk()

Public Attributes

size_t amount
size_t count
size_t le1_amount
size_t le1_count
struct { 
size_t begin
size_t end
size_t amount
size_t count
ranges [9]

Member Data Documentation

◆ amount

size_t MDBX_chk_histogram::amount

◆ count

size_t MDBX_chk_histogram::count

◆ le1_amount

size_t MDBX_chk_histogram::le1_amount

◆ le1_count

size_t MDBX_chk_histogram::le1_count

◆ [struct]

struct { ... } MDBX_chk_histogram::ranges[9]

◆ MDBX_chk_table_t

struct MDBX_chk_table_t

Information about a certain key-value table during a database integrity check.

See also
mdbx_env_chk()

Public Attributes

MDBX_chk_user_table_cookie_tcookie
MDBX_val name
MDBX_db_flags_t flags
int id
size_t payload_bytes
size_t lost_bytes
struct { 
size_t all
size_t empty
size_t broken
size_t branch
size_t leaf
size_t nested_branch
size_t nested_leaf
size_t nested_subleaf
pages
struct { 
struct MDBX_chk_histogram height
struct MDBX_chk_histogram large_pages
struct MDBX_chk_histogram nested_height_or_gc_span_length
struct MDBX_chk_histogram key_len
struct MDBX_chk_histogram val_len
struct MDBX_chk_histogram multival
struct MDBX_chk_histogram tree_density
struct MDBX_chk_histogram large_or_nested_density
struct MDBX_chk_histogram page_age
struct MDBX_chk_histogram pgno
histogram

Member Data Documentation

◆ cookie

MDBX_chk_user_table_cookie_t* MDBX_chk_table_t::cookie

◆ flags

MDBX_db_flags_t MDBX_chk_table_t::flags

◆ [struct]

struct { ... } MDBX_chk_table_t::histogram

◆ id

int MDBX_chk_table_t::id

◆ lost_bytes

size_t MDBX_chk_table_t::lost_bytes

◆ name

MDBX_val MDBX_chk_table_t::name

◆ [struct]

struct { ... } MDBX_chk_table_t::pages

◆ payload_bytes

size_t MDBX_chk_table_t::payload_bytes

◆ MDBX_chk_context_t

struct MDBX_chk_context_t

The context for checking the integrity of a database.

See also
mdbx_env_chk()

Public Attributes

struct MDBX_chk_internal * internal
MDBX_envenv
MDBX_txntxn
MDBX_chk_scope_tscope
uint8_t scope_nesting
struct { 
size_t total_payload_bytes
size_t table_total
size_t table_processed
size_t total_unused_bytes
size_t unused_pages
size_t processed_pages
size_t reclaimable_pages
size_t gc_pages
size_t alloc_pages
size_t backed_pages
size_t problems_meta
size_t tree_problems
size_t gc_tree_problems
size_t kv_tree_problems
size_t problems_gc
size_t problems_kv
size_t total_problems
uint64_t steady_txnid
uint64_t recent_txnid
struct MDBX_chk_histogram histogram_page_age
struct MDBX_chk_histogram histogram_pgno_payload
struct MDBX_chk_histogram histogram_pgno_retained
const MDBX_chk_table_t *const * tables
result

Member Data Documentation

◆ env

MDBX_env* MDBX_chk_context_t::env

◆ internal

struct MDBX_chk_internal* MDBX_chk_context_t::internal

◆ [struct]

struct { ... } MDBX_chk_context_t::result

◆ scope

MDBX_chk_scope_t* MDBX_chk_context_t::scope

◆ scope_nesting

uint8_t MDBX_chk_context_t::scope_nesting

◆ txn

MDBX_txn* MDBX_chk_context_t::txn

◆ MDBX_chk_callbacks_t

struct MDBX_chk_callbacks_t

A set of callback functions used for checking the integrity of a database.

The callback functions are designed to organize interaction with the application code. This includes the integration of application logic that verifies the integrity of a data structure above the key-value level, the preparation and structured output of information about both the progress and the results of verification.

All callback functions are optional, unused ones must be set to nullptr.

Note
This API has not been frozen yet, and there may be improvements and changes in subsequent versions.
See also
mdbx_env_chk()

Public Attributes

bool(* check_break )(MDBX_chk_context_t *ctx)
int(* scope_push )(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, const char *fmt, va_list args)
int(* scope_conclude )(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, int err)
void(* scope_pop )(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner)
void(* issue )(MDBX_chk_context_t *ctx, const char *object, uint64_t entry_number, const char *issue, const char *extra_fmt, va_list extra_args)
MDBX_chk_user_table_cookie_t *(* table_filter )(MDBX_chk_context_t *ctx, const MDBX_val *name, MDBX_db_flags_t flags)
int(* table_conclude )(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, MDBX_cursor *cursor, int err)
void(* table_dispose )(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table)
int(* table_handle_kv )(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, size_t entry_number, const MDBX_val *key, const MDBX_val *value)
int(* stage_begin )(MDBX_chk_context_t *ctx, MDBX_chk_stage_t)
int(* stage_end )(MDBX_chk_context_t *ctx, MDBX_chk_stage_t, int err)
MDBX_chk_line_t *(* print_begin )(MDBX_chk_context_t *ctx, MDBX_chk_severity_t severity)
void(* print_flush )(MDBX_chk_line_t *)
void(* print_done )(MDBX_chk_line_t *)
void(* print_chars )(MDBX_chk_line_t *, const char *str, size_t len)
void(* print_format )(MDBX_chk_line_t *, const char *fmt, va_list args)
void(* print_size )(MDBX_chk_line_t *, const char *prefix, const uint64_t value, const char *suffix)

Member Data Documentation

◆ check_break

bool(* MDBX_chk_callbacks_t::check_break) (MDBX_chk_context_t *ctx)

◆ issue

void(* MDBX_chk_callbacks_t::issue) (MDBX_chk_context_t *ctx, const char *object, uint64_t entry_number, const char *issue, const char *extra_fmt, va_list extra_args)

◆ print_begin

MDBX_chk_line_t *(* MDBX_chk_callbacks_t::print_begin) (MDBX_chk_context_t *ctx, MDBX_chk_severity_t severity)

◆ print_chars

void(* MDBX_chk_callbacks_t::print_chars) (MDBX_chk_line_t *, const char *str, size_t len)

◆ print_done

void(* MDBX_chk_callbacks_t::print_done) (MDBX_chk_line_t *)

◆ print_flush

void(* MDBX_chk_callbacks_t::print_flush) (MDBX_chk_line_t *)

◆ print_format

void(* MDBX_chk_callbacks_t::print_format) (MDBX_chk_line_t *, const char *fmt, va_list args)

◆ print_size

void(* MDBX_chk_callbacks_t::print_size) (MDBX_chk_line_t *, const char *prefix, const uint64_t value, const char *suffix)

◆ scope_conclude

int(* MDBX_chk_callbacks_t::scope_conclude) (MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, int err)

◆ scope_pop

void(* MDBX_chk_callbacks_t::scope_pop) (MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner)

◆ scope_push

int(* MDBX_chk_callbacks_t::scope_push) (MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, const char *fmt, va_list args)

◆ stage_begin

int(* MDBX_chk_callbacks_t::stage_begin) (MDBX_chk_context_t *ctx, MDBX_chk_stage_t)

◆ stage_end

int(* MDBX_chk_callbacks_t::stage_end) (MDBX_chk_context_t *ctx, MDBX_chk_stage_t, int err)

◆ table_conclude

int(* MDBX_chk_callbacks_t::table_conclude) (MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, MDBX_cursor *cursor, int err)

◆ table_dispose

void(* MDBX_chk_callbacks_t::table_dispose) (MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table)

◆ table_filter

MDBX_chk_user_table_cookie_t *(* MDBX_chk_callbacks_t::table_filter) (MDBX_chk_context_t *ctx, const MDBX_val *name, MDBX_db_flags_t flags)

◆ table_handle_kv

int(* MDBX_chk_callbacks_t::table_handle_kv) (MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, size_t entry_number, const MDBX_val *key, const MDBX_val *value)

◆ MDBX_chk_scope_t.usr_z

union MDBX_chk_scope_t.usr_z
Class Members
size_t number
void * ptr

◆ MDBX_chk_scope_t.usr_v

union MDBX_chk_scope_t.usr_v
Class Members
size_t number
void * ptr

◆ MDBX_chk_scope_t.usr_o

union MDBX_chk_scope_t.usr_o
Class Members
size_t number
void * ptr

◆ MDBX_chk_histogram.ranges

struct MDBX_chk_histogram.ranges
Class Members
size_t amount
size_t begin
size_t count
size_t end

◆ MDBX_chk_table_t.pages

struct MDBX_chk_table_t.pages
Class Members
size_t all
size_t branch
size_t broken
size_t empty
size_t leaf
size_t nested_branch
size_t nested_leaf
size_t nested_subleaf

◆ MDBX_chk_table_t.histogram

struct MDBX_chk_table_t.histogram
Class Members
struct MDBX_chk_histogram height

Tree deep histogram

struct MDBX_chk_histogram key_len

Keys length histogram

struct MDBX_chk_histogram large_or_nested_density

Histogram of nested tree(s) branch and leaf pages filling in percents

struct MDBX_chk_histogram large_pages

Histogram of large/overflow pages length

struct MDBX_chk_histogram multival

Number of multi-values (aka duplicates) histogram

struct MDBX_chk_histogram nested_height_or_gc_span_length

Histogram of nested trees height, span length for GC

struct MDBX_chk_histogram page_age

Histogram of pages age

struct MDBX_chk_histogram pgno

Histogram of used pgno

struct MDBX_chk_histogram tree_density

Histogram of branch and leaf pages filling in percents

struct MDBX_chk_histogram val_len

Values length histogram

◆ MDBX_chk_context_t.result

struct MDBX_chk_context_t.result
Class Members
size_t alloc_pages
size_t backed_pages
size_t gc_pages
size_t gc_tree_problems
struct MDBX_chk_histogram histogram_page_age

Histogram of pages age

struct MDBX_chk_histogram histogram_pgno_payload

Histogram of pgno retained by readers

struct MDBX_chk_histogram histogram_pgno_retained

Histogram of pgno used by all payload

size_t kv_tree_problems
size_t problems_gc
size_t problems_kv
size_t problems_meta
size_t processed_pages
uint64_t recent_txnid
size_t reclaimable_pages
uint64_t steady_txnid
size_t table_processed
size_t table_total
const MDBX_chk_table_t *const * tables

A pointer to the array of table_total pointers to instances of MDBX_chk_table_t structures with information about all key-value tables, including MainDB and GC.

size_t total_payload_bytes
size_t total_problems
size_t total_unused_bytes
size_t tree_problems
size_t unused_pages

Macro Definition Documentation

◆ mdbx_env_open_for_recoveryT

#define mdbx_env_open_for_recoveryT ( env,
pathname,
target_mets,
writeable )
Value:
mdbx_env_open_for_recoveryW(env, pathname, target_mets, writeable)
LIBMDBX_API int mdbx_env_open_for_recoveryW(MDBX_env *env, const wchar_t *pathname, unsigned target_meta, bool writeable)
Open an environment instance using specific meta-page for checking and recovery.

◆ mdbx_preopen_snapinfoT

#define mdbx_preopen_snapinfoT ( pathname,
info,
bytes )
Value:
mdbx_preopen_snapinfoW(pathname, info, bytes)
LIBMDBX_API int mdbx_preopen_snapinfoW(const wchar_t *pathname, MDBX_envinfo *info, size_t bytes)
Gets basic information about the database without opening it.

Function Documentation

◆ mdbx_env_turn_for_recovery()

LIBMDBX_API int mdbx_env_turn_for_recovery ( MDBX_env * env,
unsigned target_meta )

Turn database to the specified meta-page.

This function mostly of internal API for mdbx_chk utility and subject to change at any time. Do not use this function to avoid shooting your own leg(s).