PMEMPOOL_CHECK_END(3)
π PMEMPOOL_CHECK(3) π
okay bestie, welcome to the pmempool health check corner of the PMDK Programmer's Manual β this is where pmempool_check_init(), pmempool_check() and pmempool_check_end() live, and they're literally the trio that checks pmempool health. yes. that's the whole vibe. π©Ίβ¨
β¨ SYNOPSIS β¨
#include <libpmempool.h>
PMEMpoolcheck *pmempool_check_init(struct pmempool_check_args *args,
size_t args_size);
struct pmempool_check_status *pmempool_check(PMEMpoolcheck *ppc);
enum pmempool_check_result pmempool_check_end(PMEMpoolcheck *ppc);
πΈ DESCRIPTION πΈ
So to run the checks that libpmempool gives you, you first gotta set up a check context with pmempool_check_init() β that's the function we're yapping about in this whole section. Once it's initialized, that check context is this opaque handle of type PMEMpoolcheck*, and you pass it to literally every other function in libpmempool. it's giving main character energy, honestly. π
To actually execute the checks, you call pmempool_check() over and over, iteratively. Every single call pops out a new check status, which is a struct pmempool_check_status structure. we'll get to what those messages mean in a sec. π¦
When the checks are all done, pmempool_check() returns NULL. then you must finalize the check with pmempool_check_end(), which hands you back an enum pmempool_check_result describing the results of the entire check. no skipping the finale, bestie. π
π the init situation
pmempool_check_init() initializes the check context. args describes the parameters of the check context. args_size should be equal to the size of the struct pmempool_check_args. and that struct is defined like this:
struct pmempool_check_args
{
/* path to the pool to check */
const char *path;
/* optional backup path */
const char *backup_path;
/* type of the pool */
enum pmempool_pool_type pool_type;
/* parameters */
int flags;
};
The flags argument accepts any combination of these values (ORed together, so go wild):
PMEMPOOL_CHECK_REPAIRβ perform repairs π§PMEMPOOL_CHECK_DRY_RUNβ emulate repairs, not supported on Device DAXPMEMPOOL_CHECK_ADVANCEDβ perform hazardous repairs β οΈ (yes, hazardous, we said what we said)PMEMPOOL_CHECK_ALWAYS_YESβ do not ask before repairsPMEMPOOL_CHECK_VERBOSEβ generate info statusesPMEMPOOL_CHECK_FORMAT_STRβ generate string format statuses
pool_type has to match the type of the pool you're processing, no cap. you can turn on pool type detection by setting pool_type to PMEMPOOL_POOL_TYPE_DETECT. and if pool type detection fails? that ends the check. periodt. π
π§ the backup_path lore
backup_path may be:
NULL. No backup will be performed.- a non-existent file:
backup_pathwill be created and backup will be performed.pathmust be a single file pool. - an existing pool set file: Backup will be performed as defined by the
backup_pathpool set.pathmust be a pool set, andbackup_pathmust have the same structure (the same number of parts with exactly the same size) as thepathpool set.
Backup is supported only if the source pool set has no defined replicas. that's the rule, bestie, i don't make them. π«Ά
π the check loop
The pmempool_check() function starts or resumes the check indicated by ppc. When the next status is generated, the check is paused and pmempool_check() returns a pointer to the struct pmempool_check_status structure:
struct pmempool_check_status
{
enum pmempool_check_msg_type type; /* type of the status */
struct
{
const char *msg; /* status message string */
const char *answer; /* answer to message if applicable */
} str;
};
This structure can describe three types of statuses:
PMEMPOOL_CHECK_MSG_TYPE_INFOβ detailed information about the check. Generated only if aPMEMPOOL_CHECK_VERBOSEflag was set.PMEMPOOL_CHECK_MSG_TYPE_ERRORβ An error was encountered. πPMEMPOOL_CHECK_MSG_TYPE_QUESTIONβ question. Generated only if anPMEMPOOL_CHECK_ALWAYS_YESflag was not set. It requiresanswerto be set to "yes" or "no" before continuing.
After callingpmempool_check()again, the previously providedstruct pmempool_check_statuspointer must be considered invalid. like, gone. do not hold onto it. it's not yours anymore. π
The pmempool_check_end() function finalizes the check and releases all related resources. ppc is invalid after calling pmempool_check_end(). rip ppc, you served well. π
π RETURN VALUE π
pmempool_check_init() returns an opaque handle of type PMEMpoolcheck*. If the provided parameters are invalid or the initialization process fails, pmempool_check_init() returns NULL and sets errno appropriately.
Each call to pmempool_check() returns a pointer to a struct pmempool_check_status structure when a status is generated. When the check completes, pmempool_check() returns NULL.
The pmempool_check_end() function returns an enum pmempool_check_result summarizing the results of the finalized check. pmempool_check_end() can return one of the following values:
PMEMPOOL_CHECK_RESULT_CONSISTENTβ the pool is consistent βPMEMPOOL_CHECK_RESULT_NOT_CONSISTENTβ the pool is not consistentPMEMPOOL_CHECK_RESULT_REPAIREDβ the pool has issues but all repair steps completed successfullyPMEMPOOL_CHECK_RESULT_CANNOT_REPAIRβ the pool has issues which can not be repairedPMEMPOOL_CHECK_RESULT_ERRORβ the pool has errors or the check encountered an issuePMEMPOOL_CHECK_RESULT_SYNC_REQβ the pool has single healthy replica. To fix remaining issues usepmempool_sync(3).
β EXAMPLE β
This is an example of a check context initialization:
struct pmempool_check_args args =
{
.path = "/path/to/obj.pool",
.backup_path = NULL,
.pool_type = PMEMPOOL_POOL_TYPE_OBJ,
.flags = PMEMPOOL_CHECK_VERBOSE | PMEMPOOL_CHECK_FORMAT_STR
};
PMEMpoolcheck *ppc = pmempool_check_init(&args, sizeof(args));
so what's happening here: the check will process a pool of type PMEMPOOL_POOL_TYPE_OBJ located in the path /path/to/obj.pool. Before the check it will not create a backup of the pool (backup_path == NULL). It will also generate detailed information about the check (PMEMPOOL_CHECK_VERBOSE). The PMEMPOOL_CHECK_FORMAT_STR flag indicates string format statuses (struct pmempool_check_status). Currently this is the only supported status format so this flag is required. don't forget it, i'm begging. π
π₯ NOTES π₯
Currently, checking the consistency of a pmemobj pool is not supported. yeah. i know. it is what it is. π
π¦ SEE ALSO π¦
libpmemobj(7) and https://pmem.io
and that's the whole page, bestie!! this was the PMDK Programmer's Manual, dated 2025-07-24, brought to you by the PMDK crew β go check on your pools, hydrate, and don't leak your status pointers. mwah. πβ¨π
π¦ where this page comes from
- fedora 43: libpmempool-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2017-2022, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms