Skip to content

Allow entries to apply during snapshot#86

Merged
willemt merged 1 commit intowillemt:masterfrom
RedisLabs:feat/snapshot-nonblocking-apply
Aug 15, 2018
Merged

Allow entries to apply during snapshot#86
willemt merged 1 commit intowillemt:masterfrom
RedisLabs:feat/snapshot-nonblocking-apply

Conversation

@yossigo
Copy link
Contributor

@yossigo yossigo commented Aug 7, 2018

Currently raft_apply_entry() and raft_apply_all() will avoid applying entries if a snapshot is in progress. Assuming the FSM is able to provide the proper isolation, I don't see any real reason to prevent this in the library but @willemt perhaps you do?

This requires care in maintaining the different indexes, but we anyway must assume the commit index can advance during snapshots (see #84 for example).

@willemt
Copy link
Owner

willemt commented Aug 7, 2018

That makes a lot of sense. For example, you could isolate a key value store FSM when it's being snapshotted by iterating over the keys and being aware of log entries setting values.

However, I like that the default behaviour is so strict. It makes it easier to not break things. Therefore I think a good way to allow this is by adding flags to raft_begin_snapshot. This is what I'm thinking about doing:

#define  RAFT_SNAPSHOT_NONBLOCKING_APPLY 1

int raft_begin_snapshot(raft_server_t *me_, int flags);

If specified when calling raft_begin_snapshot(), the library will not
postpone applying entries during snapshots.  This requires the FSM to
provide full isolation between the snapshot and active state.
@willemt willemt merged commit 2c89514 into willemt:master Aug 15, 2018
@willemt
Copy link
Owner

willemt commented Aug 15, 2018

Good optimisation for FSMs that can use this

@tezc tezc deleted the feat/snapshot-nonblocking-apply branch October 28, 2022 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants