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) |
Typedefs | |
| typedef struct MDBX_chk_user_table_cookie | MDBX_chk_user_table_cookie_t |
| A custom type for binding additional data associated with a certain key-value table during a database integrity check. | |
Functions | |
| LIBMDBX_API int | mdbx_txn_lock (MDBX_env *env, bool dont_wait) |
| Acquires write-transaction lock. Provided for custom and/or complex locking scenarios. | |
| LIBMDBX_API int | mdbx_txn_unlock (MDBX_env *env) |
| Releases write-transaction lock. Provided for custom and/or complex locking scenarios. | |
| LIBMDBX_API int | mdbx_env_open_for_recovery (MDBX_env *env, const char *pathname, unsigned target_meta, bool writeable) |
| Open an environment instance using specific meta-page for checking and recovery. | |
| LIBMDBX_API int | mdbx_env_turn_for_recovery (MDBX_env *env, unsigned target_meta) |
| Turn database to the specified meta-page. | |
| LIBMDBX_API int | mdbx_env_chk (MDBX_env *env, const MDBX_chk_callbacks_t *cb, MDBX_chk_context_t *ctx, const MDBX_chk_flags_t flags, MDBX_chk_severity_t verbosity, unsigned timeout_seconds_16dot16) |
| Checks the integrity of a database. | |
| LIBMDBX_API int | mdbx_env_chk_encount_problem (MDBX_chk_context_t *ctx) |
| An auxiliary function to account issues detected by an application, including those coming to an application through logging. | |
| LIBMDBX_API const char * | mdbx_ratio2digits (uint64_t numerator, uint64_t denominator, int precision, char *buffer, size_t buffer_size) |
| An auxiliary function for converting fractions to string of decimal digits without using floating-point operations. | |
| LIBMDBX_API const char * | mdbx_ratio2percents (uint64_t value, uint64_t whole, char *buffer, size_t buffer_size) |
| An auxiliary function for converting fractions to percentage string without using floating-point operations. | |
Basically this is internal API for mdbx_chk tool, etc. You should avoid to use it, except some extremal special cases.
| struct MDBX_chk_line_t |
A virtual row of the report generated during a database integrity check.
| Class Members | ||
|---|---|---|
| char * | begin | |
| struct MDBX_chk_context * | ctx | |
| uint8_t | empty | |
| char * | end | |
| char * | out | |
| uint8_t | scope_depth | |
| uint8_t | severity | |
| struct MDBX_chk_issue_t |
An issue problem was discovered during a database integrity check.
| Class Members | ||
|---|---|---|
| const char * | caption | |
| size_t | count | |
| struct MDBX_chk_issue * | next | |
| struct MDBX_chk_scope_t |
A hierarchical context during a database integrity check.
| Class Members | ||
|---|---|---|
| struct MDBX_chk_internal * | internal | |
| MDBX_chk_issue_t * | issues | |
| const void * | object | |
| MDBX_chk_stage_t | stage | |
| size_t | subtotal_issues | |
| union MDBX_chk_scope_t.usr_o | usr_o | |
| union MDBX_chk_scope_t.usr_v | usr_v | |
| union MDBX_chk_scope_t.usr_z | usr_z | |
| MDBX_chk_severity_t | verbosity | |
| struct MDBX_chk_histogram |
A histogram with some statistical information collected during a database integrity check.
| Class Members | ||
|---|---|---|
| size_t | amount | |
| size_t | count | |
| size_t | le1_amount | |
| size_t | le1_count | |
| struct MDBX_chk_histogram.ranges | ranges[9] | |
| struct MDBX_chk_table_t |
Information about a certain key-value table during a database integrity check.
| Class Members | ||
|---|---|---|
| MDBX_chk_user_table_cookie_t * | cookie | |
| MDBX_db_flags_t | flags | |
| struct MDBX_chk_table_t.histogram | histogram | |
| int | id | |
| size_t | lost_bytes | |
| MDBX_val | name | |
| struct MDBX_chk_table_t.pages | pages | |
| size_t | payload_bytes | |
| struct MDBX_chk_context_t |
The context for checking the integrity of a database.
| Class Members | ||
|---|---|---|
| MDBX_env * | env | |
| struct MDBX_chk_internal * | internal | |
| struct MDBX_chk_context_t.result | result | |
| MDBX_chk_scope_t * | scope | |
| uint8_t | scope_nesting | |
| MDBX_txn * | txn | |
| 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’.
| Class Members | ||
|---|---|---|
| bool(*)(MDBX_chk_context_t *ctx) | check_break | |
| void(*)(MDBX_chk_context_t *ctx, const char *object, uint64_t entry_number, const char *issue, const char *extra_fmt, va_list extra_args) | issue | |
| MDBX_chk_line_t *(*)(MDBX_chk_context_t *ctx, MDBX_chk_severity_t severity) | print_begin | |
| void(*)(MDBX_chk_line_t *, const char *str, size_t len) | print_chars | |
| void(*)(MDBX_chk_line_t *) | print_done | |
| void(*)(MDBX_chk_line_t *) | print_flush | |
| void(*)(MDBX_chk_line_t *, const char *fmt, va_list args) | print_format | |
| void(*)(MDBX_chk_line_t *, const char *prefix, const uint64_t value, const char *suffix) | print_size | |
| int(*)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, int err) | scope_conclude | |
| void(*)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner) | scope_pop | |
| int(*)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, const char *fmt, va_list args) | scope_push | |
| int(*)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t) | stage_begin | |
| int(*)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t, int err) | stage_end | |
| int(*)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, MDBX_cursor *cursor, int err) | table_conclude | |
| void(*)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table) | table_dispose | |
| MDBX_chk_user_table_cookie_t *(*)(MDBX_chk_context_t *ctx, const MDBX_val *name, MDBX_db_flags_t flags) | table_filter | |
| int(*)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, size_t entry_number, const MDBX_val *key, const MDBX_val *value) | table_handle_kv | |
| struct MDBX_chk_table_t.pages |
| 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 |
| 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 | |
| #define mdbx_env_open_for_recoveryT | ( | env, | |
| pathname, | |||
| target_mets, | |||
| writeable ) |
| #define mdbx_preopen_snapinfoT | ( | pathname, | |
| info, | |||
| bytes ) |
| typedef struct MDBX_chk_user_table_cookie MDBX_chk_user_table_cookie_t |
A custom type for binding additional data associated with a certain key-value table during a database integrity check.
| enum MDBX_chk_flags_t |
Flags/options for checking the integrity of a database.
| enum MDBX_chk_severity_t |
Levels of logging/detailing of information supplied via callbacks during a database integrity check.
| enum MDBX_chk_stage_t |
The verification stages reported via callbacks during a database integrity check.
| Enumerator | |
|---|---|
| MDBX_chk_none | |
| MDBX_chk_init | |
| MDBX_chk_lock | |
| MDBX_chk_meta | |
| MDBX_chk_tree | |
| MDBX_chk_gc | |
| MDBX_chk_space | |
| MDBX_chk_maindb | |
| MDBX_chk_tables | |
| MDBX_chk_conclude | |
| MDBX_chk_unlock | |
| MDBX_chk_finalize | |
| LIBMDBX_API int mdbx_env_chk | ( | MDBX_env * | env, |
| const MDBX_chk_callbacks_t * | cb, | ||
| MDBX_chk_context_t * | ctx, | ||
| const MDBX_chk_flags_t | flags, | ||
| MDBX_chk_severity_t | verbosity, | ||
| unsigned | timeout_seconds_16dot16 ) |
Checks the integrity of a database.
Interaction with the application code is implemented through callback functions provided by the application using the 'cb parameter. During such interaction, the application can monitor the verification process, including skipping/filtering the processing of individual elements, as well as implement additional verification of the structure and/or information, taking into account the purpose and semantic significance for an application. For example, an application can check its own indexes and the correctness of database entries. It is for this purpose that the integrity check functionality has been improved for intensive use of callbacks and moved from the mdbx_chk` utility to the main library.
Verification is performed in several stages, starting with initialization and ending with finalization. For more details, see MDBX_chk_stage_t. The application code is notified about the beginning and end of each stage through the corresponding callback functions. For more details, see MDBX_chk_callbacks_t.
| [in] | env | A pointer to an instance of environment. |
| [in] | cb | A set of callback functions. |
| [in,out] | ctx | The context of a database integrity check, where the results of the check will be generated. |
| [in] | flags | Flags/options for checking database integrity. |
| [in] | verbosity | The required level of detail of information about the progress and results of the checking. |
| [in] | timeout_seconds_16dot16 | The duration limit for performing the check in 1/65536 fractions of a second, either 0 means no limit. |
| LIBMDBX_API int mdbx_env_chk_encount_problem | ( | MDBX_chk_context_t * | ctx | ) |
An auxiliary function to account issues detected by an application, including those coming to an application through logging.
An application should call this function to account for detected issues, or vice versa, do not make these calls to ignore discovered issues.
| LIBMDBX_API int mdbx_env_open_for_recovery | ( | MDBX_env * | env, |
| const char * | pathname, | ||
| unsigned | target_meta, | ||
| bool | writeable ) |
Open an environment instance using specific meta-page for checking and recovery.
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).
| 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).
| LIBMDBX_API const char * mdbx_ratio2digits | ( | uint64_t | numerator, |
| uint64_t | denominator, | ||
| int | precision, | ||
| char * | buffer, | ||
| size_t | buffer_size ) |
An auxiliary function for converting fractions to string of decimal digits without using floating-point operations.
| LIBMDBX_API const char * mdbx_ratio2percents | ( | uint64_t | value, |
| uint64_t | whole, | ||
| char * | buffer, | ||
| size_t | buffer_size ) |
An auxiliary function for converting fractions to percentage string without using floating-point operations.
| LIBMDBX_API int mdbx_txn_lock | ( | MDBX_env * | env, |
| bool | dont_wait ) |
Acquires write-transaction lock. Provided for custom and/or complex locking scenarios.
| LIBMDBX_API int mdbx_txn_unlock | ( | MDBX_env * | env | ) |
Releases write-transaction lock. Provided for custom and/or complex locking scenarios.