Skip to content

Commit

Permalink
Expose raft_uv_auto_recovery setting for dqlite nodes
Browse files Browse the repository at this point in the history
So that Jepsen can make use of it.

Signed-off-by: Cole Miller <cole.miller@canonical.com>
  • Loading branch information
cole-miller committed Jul 19, 2023
1 parent 3d7b1ae commit 332d0ae
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 332d0ae

Please sign in to comment.