Skip to content

Commit

Permalink
Merge pull request #526 from cole-miller/auto-recovery
Browse files Browse the repository at this point in the history
Expose raft_uv_auto_recovery setting for dqlite nodes
  • Loading branch information
cole-miller authored Jul 19, 2023
2 parents 3d7b1ae + 332d0ae commit 837eeee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/dqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,20 @@ DQLITE_API int dqlite_node_set_target_voters(dqlite_node *n, int voters);
*/
DQLITE_API int dqlite_node_set_target_standbys(dqlite_node *n, int standbys);

/**
* Enable or disable auto-recovery for corrupted disk files.
*
* When auto-recovery is enabled, files in the data directory that are
* determined to be corrupt may be removed by dqlite at startup. This allows
* the node to start up successfully in more situations, but comes at the cost
* of possible data loss, and may mask bugs.
*
* This must be called before dqlite_node_start.
*
* Auto-recovery is enabled by default.
*/
DQLITE_API int dqlite_node_set_auto_recovery(dqlite_node *n, bool enabled);

/**
* Enable automatic role management on the server side for this node.
*
Expand Down
6 changes: 6 additions & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,12 @@ int dqlite_node_enable_role_management(dqlite_node *n)
return 0;
}

int dqlite_node_set_auto_recovery(dqlite_node *n, bool enabled)
{
raft_uv_set_auto_recovery(&n->raft_io, enabled);
return 0;
}

const char *dqlite_node_errmsg(dqlite_node *n)
{
if (n != NULL) {
Expand Down

0 comments on commit 837eeee

Please sign in to comment.