Distributed Systems

ECE419, Winter 2026
University of Toronto
Instructor: Ashvin Goel

    Distributed Systems

Lab 3 FAQ

Q: What is the easiest way to perform periodic processing in Go?

A: Create a goroutine (or reuse an existing one) that invokes time.Sleep() in a loop. See the ticker() goroutine. Don't use Go's time.Timer or time.Ticker, which are difficult to use correctly. You may find Go's rand useful for randomizing the periodic processing.


Q: The labgob package generates a warning about capitalization of struct fields. What is this warning?

A: Go RPC only sends struct fields whose names start with capital letters (otherwise those fields are not sent). Sub-structures must also have capitalized field names (e.g. fields of log records in an array). Don't ignore the labgob package warnings.


Q: What might be the reasons for "term changed even though there were no failures"?

A: You can try to change your timeout value and heartbeat interval to see if there is any effect, since once a RequestVote is sent, a term change is inevitable. However, there are many possibilities for an election to start incorrectly:

Please follow the debugging guide to identify the exact issue.


Q: This rule doesn't make sense to me:

"If commitIndex > lastApplied: increment lastApplied, apply log[lastApplied] to state machine"

Shouldn't we be applying from from the range [lastApplied + 1, commitIndex]?

A: Yes, that is what the rule is saying. You should read the rule as being applied repeatedly.