This commit is contained in:
kenctrl 2025-03-11 19:24:15 -04:00
parent a1610fb282
commit fe6ae451c1
2 changed files with 9 additions and 10 deletions

View File

@ -87,6 +87,6 @@ func (ts *Test) makeTitle() string {
} else {
title = title + "one client"
}
title = title + " (" + ts.part + ")" // 4A or 4B
title = title + " (" + ts.part + ")" // 4A, 4B, 4C
return title
}

View File

@ -174,16 +174,15 @@ func (rf *Raft) Start(command interface{}) (int, int, bool) {
return index, term, isLeader
}
// The tester calls Kill() when it is done with a Raft instance (e.g.,
// when it simulates a crash and restarts the peer or when the test is
// done). Kill allows your implementation (1) to close the applyCh so
// that the application on top of Raft can clean up, and (2) to return
// out of long-running goroutines.
// the tester doesn't halt goroutines created by Raft after each test,
// but it does call the Kill() method. your code can use killed() to
// check whether Kill() has been called. the use of atomic avoids the
// need for a lock.
//
// Long-running goroutines use memory and may chew up CPU time,
// perhaps causing later tests to fail and generating confusing debug
// output. any goroutine with a long-running loop should call killed()
// to check whether it should stop.
// the issue is that long-running goroutines use memory and may chew
// up CPU time, perhaps causing later tests to fail and generating
// confusing debug output. any goroutine with a long-running loop
// should call killed() to check whether it should stop.
func (rf *Raft) Kill() {
atomic.StoreInt32(&rf.dead, 1)
// Your code here, if desired.