Skip to content

Instantly share code, notes, and snippets.

@jki127
Last active May 10, 2019 06:09
Show Gist options
  • Save jki127/f795d01622ede6706e9d3b657a159254 to your computer and use it in GitHub Desktop.
Save jki127/f795d01622ede6706e9d3b657a159254 to your computer and use it in GitHub Desktop.

Hashtables, Viewstamped Repl, Raft (cont) - DistSys Lecture - Nov 27th, 2018

Healing a Partition

  • The leader with the higher election term takes over according to the rules of Raft

Alternative: Run another election

Hints for using Raft on Project 4

  • Build a library that sends and receives messages asynchronously
    • Have a goroutine send a message
  • Make sure that two goroutines aren’t trying to send messages over the same TCP connection

One way to do timeouts

select {
	case <- tcpread():
		// try to read from connection for 3 seconds
	case <- time.After(3 * time.Second):
		// After 3 seconds, timeout
}

Viewstamped Replication (VR)

Hashtables

Keyspace partitioning

  • Create an excessively large space (hashtable) and map nodes across the space randomly (literally assign each node a random number)

Adding new nodes

  1. You give the new node a random number
  2. Find the items the first node with a higher number than the new node and rehash values that will now be incorrectly hashed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment