mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2444 from bdarnell/multinode-report
Add ReportUnreachable and ReportSnapshot to MultiNode.
This commit is contained in:
commit
0ab24d4606
@ -35,7 +35,8 @@ previously-persisted entries with Index >= i must be discarded.
|
|||||||
2. Send all Messages to the nodes named in the To field. It is important that
|
2. Send all Messages to the nodes named in the To field. It is important that
|
||||||
no messages be sent until after the latest HardState has been persisted to disk,
|
no messages be sent until after the latest HardState has been persisted to disk,
|
||||||
and all Entries written by any previous Ready batch (Messages may be sent while
|
and all Entries written by any previous Ready batch (Messages may be sent while
|
||||||
entries from the same batch are being persisted).
|
entries from the same batch are being persisted). If any Message has type MsgSnap,
|
||||||
|
call Node.ReportSnapshot() after it has been sent (these messages may be large).
|
||||||
|
|
||||||
3. Apply Snapshot (if any) and CommittedEntries to the state machine.
|
3. Apply Snapshot (if any) and CommittedEntries to the state machine.
|
||||||
If any committed Entry has Type EntryConfChange, call Node.ApplyConfChange()
|
If any committed Entry has Type EntryConfChange, call Node.ApplyConfChange()
|
||||||
|
@ -38,6 +38,10 @@ type MultiNode interface {
|
|||||||
Advance(map[uint64]Ready)
|
Advance(map[uint64]Ready)
|
||||||
// Status returns the current status of the given group.
|
// Status returns the current status of the given group.
|
||||||
Status(group uint64) Status
|
Status(group uint64) Status
|
||||||
|
// Report reports the given node is not reachable for the last send.
|
||||||
|
ReportUnreachable(id, groupID uint64)
|
||||||
|
// ReportSnapshot reports the stutus of the sent snapshot.
|
||||||
|
ReportSnapshot(id, groupID uint64, status SnapshotStatus)
|
||||||
// Stop performs any necessary termination of the MultiNode.
|
// Stop performs any necessary termination of the MultiNode.
|
||||||
Stop()
|
Stop()
|
||||||
}
|
}
|
||||||
@ -447,3 +451,25 @@ func (mn *multiNode) Status(group uint64) Status {
|
|||||||
mn.status <- ms
|
mn.status <- ms
|
||||||
return <-ms.ch
|
return <-ms.ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mn *multiNode) ReportUnreachable(id, groupID uint64) {
|
||||||
|
select {
|
||||||
|
case mn.recvc <- multiMessage{
|
||||||
|
group: groupID,
|
||||||
|
msg: pb.Message{Type: pb.MsgUnreachable, From: id},
|
||||||
|
}:
|
||||||
|
case <-mn.done:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mn *multiNode) ReportSnapshot(id, groupID uint64, status SnapshotStatus) {
|
||||||
|
rej := status == SnapshotFailure
|
||||||
|
|
||||||
|
select {
|
||||||
|
case mn.recvc <- multiMessage{
|
||||||
|
group: groupID,
|
||||||
|
msg: pb.Message{Type: pb.MsgSnapStatus, From: id, Reject: rej},
|
||||||
|
}:
|
||||||
|
case <-mn.done:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user