Skip to content

Commit

Permalink
Do not retry proposal if already found in CommittedEntries (#2740)
Browse files Browse the repository at this point in the history
This is the first win from Open Census. Learnt that proposals immediately show up in `raft.Ready().CommittedEntries`, but then take a long time in the `applyCh` queue to be applied. If these proposals are just waiting in the queue to be applied, then we're sure that Raft didn't lose them in flight, and therefore, we don't need to re-propose them. This PR detects that and avoids retrying the proposal.
  • Loading branch information
manishrjain authored Nov 8, 2018
1 parent bf0cfee commit 7a59e8d
Show file tree
Hide file tree
Showing 5 changed files with 404 additions and 340 deletions.
5 changes: 3 additions & 2 deletions conn/raft_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ func (r *lockedSource) Seed(seed int64) {
}

type ProposalCtx struct {
Ch chan error
Ctx context.Context
Found uint32
Ch chan error
Ctx context.Context
}

type proposals struct {
Expand Down
15 changes: 8 additions & 7 deletions protos/pb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ message Snapshot {
}

message Proposal {
Mutations mutations = 2;
repeated KV kv = 4;
MembershipState state = 5;
string clean_predicate = 6; // Delete the predicate which was moved to other group.
string key = 7;
OracleDelta delta = 8;
Snapshot snapshot = 9; // Used to tell the group when to take snapshot.
Mutations mutations = 2;
repeated KV kv = 4;
MembershipState state = 5;
string clean_predicate = 6; // Delete the predicate which was moved to other group.
string key = 7;
OracleDelta delta = 8;
Snapshot snapshot = 9; // Used to tell the group when to take snapshot.
uint64 index = 10; // Used to store Raft index, in raft.Ready.
}

message KVS {
Expand Down
Loading

0 comments on commit 7a59e8d

Please sign in to comment.