Raft and Other Stories Consensus Trilogy: Part III Rough Timeline - - PowerPoint PPT Presentation

raft and other stories
SMART_READER_LITE
LIVE PREVIEW

Raft and Other Stories Consensus Trilogy: Part III Rough Timeline - - PowerPoint PPT Presentation

Raft and Other Stories Consensus Trilogy: Part III Rough Timeline for Today Talk about logistics and lab 0 Raft: You should all know this better than I do. Quiz and midterm course evaluation. Lab 0 and 2 Some Observations Nearly


slide-1
SLIDE 1

Raft and Other Stories

Consensus Trilogy: Part III

slide-2
SLIDE 2

Rough Timeline for Today

  • Talk about logistics and lab 0
  • Raft: You should all know this better than I do.
  • Quiz and midterm course evaluation.
slide-3
SLIDE 3

Lab 0 and 2

slide-4
SLIDE 4

Some Observations

  • Nearly everyone used locks or bounded channels of length 1.
slide-5
SLIDE 5

Some Observations

  • Nearly everyone used locks or bounded channels of length 1.
  • Not the Go way to concurrency.
slide-6
SLIDE 6

Some Observations

  • Nearly everyone used locks or bounded channels of length 1.
  • Not the Go way to concurrency.
  • Some office hour questions on Erlang, etc. -- where you apply those paradigms
slide-7
SLIDE 7

Some Observations

  • Nearly everyone used locks or bounded channels of length 1.
  • Not the Go way to concurrency.
  • Some office hour questions on Erlang, etc. -- where you apply those paradigms
  • IMO harder to think about than processing everything on one thread.
slide-8
SLIDE 8

Some Observations

  • Nearly everyone used locks or bounded channels of length 1.
  • Not the Go way to concurrency.
  • Some office hour questions on Erlang, etc. -- where you apply those paradigms
  • IMO harder to think about than processing everything on one thread.
  • See Lab 2 starter code for an alternative.
slide-9
SLIDE 9

Some Observations

  • Concurrent programming: adding methods affects existing methods.
slide-10
SLIDE 10

Some Observations

  • Concurrent programming: adding methods affects existing methods.
  • Might necessitate adding concurrency control where none was needed.
slide-11
SLIDE 11

Some Observations

  • Concurrent programming: adding methods affects existing methods.
  • Might necessitate adding concurrency control where none was needed.
  • Might simplify concurrency control where previously needed.
slide-12
SLIDE 12

Some Observations

  • Concurrent programming: adding methods affects existing methods.
  • Might necessitate adding concurrency control where none was needed.
  • Might simplify concurrency control where previously needed.
  • This is not an intro class: starter code exists to help you get started.
slide-13
SLIDE 13

Some Observations

  • Concurrent programming: adding methods affects existing methods.
  • Might necessitate adding concurrency control where none was needed.
  • Might simplify concurrency control where previously needed.
  • This is not an intro class: starter code exists to help you get started.
  • You are responsible for ensuring no bugs in code you hand in.
slide-14
SLIDE 14

Some Observations

  • Half of the class did not run gofmt on code they handed in.
slide-15
SLIDE 15

Some Observations

  • Half of the class did not run gofmt on code they handed in.
  • No points docked for formatting.
slide-16
SLIDE 16

Some Observations

  • Half of the class did not run gofmt on code they handed in.
  • No points docked for formatting.
  • But... why? Tools exist to be used, can't help you if you don't use them.
slide-17
SLIDE 17

Some Observations

  • Half of the class did not run gofmt on code they handed in.
  • No points docked for formatting.
  • But... why? Tools exist to be used, can't help you if you don't use them.
  • Similarly several people did not run `go vet` and golint.
slide-18
SLIDE 18

Some Observations

  • Half of the class did not run gofmt on code they handed in.
  • No points docked for formatting.
  • But... why? Tools exist to be used, can't help you if you don't use them.
  • Similarly several people did not run `go vet` and golint.
  • Would have picked up some build errors for those who had those.
slide-19
SLIDE 19

Some Observations

  • Lots of questions about how to test for concurrency.
slide-20
SLIDE 20

Some Observations

  • Lots of questions about how to test for concurrency.
  • Few actual tests 😟
slide-21
SLIDE 21

Some Observations

  • Lots of questions about how to test for concurrency.
  • Few actual tests 😟

const NThreads = 1000 var wg sync.WaitGroup for i := 0; i < NThreads; i++ { wg.Add(1) go func(iter int) { run(endpoint) wg.Done() }(i) } wg.Wait()

slide-22
SLIDE 22

Some Observations

  • Lots of questions about how to test for concurrency.
  • Few actual tests 😟

const NThreads = 1000 var wg sync.WaitGroup for i := 0; i < NThreads; i++ { wg.Add(1) go func(iter int) { run(endpoint) wg.Done() }(i) } wg.Wait() func run(endpoint string) { conn, err := grpc.Dial(endpoint, grpc.WithInsecure()) if err != nil { ... } ... }

slide-23
SLIDE 23

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
slide-24
SLIDE 24

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
  • Please try -- if possible -- to use the structure in the starter code.
slide-25
SLIDE 25

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
  • Please try -- if possible -- to use the structure in the starter code.
  • Please ask if something in the lab write up is unclear.
slide-26
SLIDE 26

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
  • Please try -- if possible -- to use the structure in the starter code.
  • Please ask if something in the lab write up is unclear.
  • Not sure anyone has read it.
slide-27
SLIDE 27

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
  • Please try -- if possible -- to use the structure in the starter code.
  • Please ask if something in the lab write up is unclear.
  • Not sure anyone has read it.
  • I could not understand it yesterday.
slide-28
SLIDE 28

Lab 2

  • Went out Monday: not sure how many people have had a chance to look.
  • Please try -- if possible -- to use the structure in the starter code.
  • Please ask if something in the lab write up is unclear.
  • Not sure anyone has read it.
  • I could not understand it yesterday.
  • Start early: there are subtleties here, need time to get it right.
slide-29
SLIDE 29
slide-30
SLIDE 30

Survey

slide-31
SLIDE 31

What is the Problem?

KV-Store

set("s0", ...) set("s1", ...) get("s0")->...

Client KV-Store Client

set("s2", ...) set("s1", ...) get("s1")->...

Client

set("s1", ...) get("s0")->...

slide-32
SLIDE 32

What is the Problem?

KV-Store

set("s0", ...) set("s1", ...) get("s0")->...

Client KV-Store Client

set("s2", ...) set("s1", ...) get("s1")->...

Client

set("s1", ...) get("s0")->...

In what order should these commands be run?

slide-33
SLIDE 33

A Possible Solution

KV-Store Client KV-Store Client Client

slide-34
SLIDE 34

A Possible Solution

KV-Store Client KV-Store Client Client

set("s1", 25)

slide-35
SLIDE 35

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client Client

set("s1", 25)

slide-36
SLIDE 36

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25)

slide-37
SLIDE 37

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25)

slide-38
SLIDE 38

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42)

slide-39
SLIDE 39

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729)

slide-40
SLIDE 40

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729)

slide-41
SLIDE 41

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-42
SLIDE 42

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-43
SLIDE 43

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-44
SLIDE 44

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-45
SLIDE 45

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-46
SLIDE 46

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-47
SLIDE 47

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 25) set("s1", 42) set("s1", 1729) set("s1", 1729) set("s1", 42)

slide-48
SLIDE 48

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 42) set("s1", 25) set("s1", 1729) set("s1", 42) set("s1", 25) set("s1", 1729)

slide-49
SLIDE 49

A Possible Solution

KV-Store

set("s1", 42)

Client KV-Store Client

set("s1", 1729)

Client

set("s1", 25) set("s1", 42) set("s1", 25) set("s1", 1729) set("s1", 42) set("s1", 25) set("s1", 1729)

slide-50
SLIDE 50

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
slide-51
SLIDE 51

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
slide-52
SLIDE 52

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
  • Reduces conflicts. Reduces number of messages in the common case.
slide-53
SLIDE 53

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
  • Reduces conflicts. Reduces number of messages in the common case.
  • But leader election is independent of actual protocol.
slide-54
SLIDE 54

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
  • Reduces conflicts. Reduces number of messages in the common case.
  • But leader election is independent of actual protocol.
  • Raft combines these two processes in one protocol.
slide-55
SLIDE 55

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
  • Reduces conflicts. Reduces number of messages in the common case.
  • But leader election is independent of actual protocol.
  • Raft combines these two processes in one protocol.
  • Leader election responsible for ensuring a good leader.
slide-56
SLIDE 56

Raft Observation

  • Paxos originally explained as a single decree leaderless protocol.
  • Leader added for efficiency, e.g., in MultiPaxos from last lecture.
  • Reduces conflicts. Reduces number of messages in the common case.
  • But leader election is independent of actual protocol.
  • Raft combines these two processes in one protocol.
  • Leader election responsible for ensuring a good leader.
  • Consensus is just leader deciding on ordering and replicating decision.
slide-57
SLIDE 57

Raft Log

  • Primitive: Maintain a consistent log across participants
slide-58
SLIDE 58

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

slide-59
SLIDE 59

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

Entries with the same term from the same leader.

slide-60
SLIDE 60

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

set(x, 5)

Entries with the same term from the same leader.

slide-61
SLIDE 61

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

set(x, 5) set(x, 6)

1

Entries with the same term from the same leader.

slide-62
SLIDE 62

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

Entries with the same term from the same leader.

slide-63
SLIDE 63

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

get(x)

3

Entries with the same term from the same leader.

slide-64
SLIDE 64

Raft Log

  • Primitive: Maintain a consistent log across participants

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

get(x)

3

Terms should not go back Entries with the same term from the same leader.

slide-65
SLIDE 65

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

set(z, 2)

2

slide-66
SLIDE 66

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

set(z, 2)

2

Two entries with the same index and term are identical.

slide-67
SLIDE 67

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2

slide-68
SLIDE 68

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2 1

set(y, 6)

3

slide-69
SLIDE 69

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2 1

set(y, 6)

3 1

set(y, 6)

3

slide-70
SLIDE 70

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2 1

set(y, 6)

3 1

set(y, 6)

3 1

set(y, 6)

3

slide-71
SLIDE 71

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2 1

set(y, 6)

3 1

set(y, 6)

3 1

set(y, 6)

3

If two logs agree on an entry, they agree on the prefix

slide-72
SLIDE 72

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1

set(z, 8)

2 1

set(y, 6)

3 1

set(y, 6)

3

If two logs agree on an entry, they agree on the prefix

slide-73
SLIDE 73

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

set(y, 6)

3 1

set(y, 6)

3

If two logs agree on an entry, they agree on the prefix

slide-74
SLIDE 74

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

set(y, 6)

3 1

set(y, 6)

3 1

get(x)

2

If two logs agree on an entry, they agree on the prefix

slide-75
SLIDE 75

Raft Log

Term Command Index

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

get(x)

2

set(x, 5) set(x, 6)

1 1

set(y, 6)

3 1

set(y, 6)

3 1

get(x)

2

If two logs agree on an entry, they agree on the prefix

1

set(y, 6)

3

slide-76
SLIDE 76

Raft Timeline

Term

slide-77
SLIDE 77

Raft Timeline

L e a d e r E l e c t i

  • n

Term

slide-78
SLIDE 78

Raft Timeline

L e a d e r E l e c t i

  • n

R e i g n Term

slide-79
SLIDE 79

Raft Timeline

L e a d e r E l e c t i

  • n

R e i g n L e a d e r E l e c t i

  • n

Term

slide-80
SLIDE 80

Raft Timeline

L e a d e r E l e c t i

  • n

R e i g n L e a d e r E l e c t i

  • n

Term

slide-81
SLIDE 81

Raft Timeline

L e a d e r E l e c t i

  • n

R e i g n L e a d e r E l e c t i

  • n

Term

slide-82
SLIDE 82

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

slide-83
SLIDE 83

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

AppendEntries(term=0, prevIdx =0, prevTerm=0, [(1,0, set(x,6)]) AppendEntries(term=0, prevIdx =0, prevTerm=0, [(1,0, set(x,6)])

slide-84
SLIDE 84

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

AppendEntries(term=0, prevIdx =0, prevTerm=0, [(1,0, set(x,6)]) AppendEntries(term=0, prevIdx =0, prevTerm=0, [(1,0, set(x,6)])

How should the followers respond?

slide-85
SLIDE 85

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

(0, Success) (0, Fail) set(x, 6)

1

slide-86
SLIDE 86

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

(0, Success) (0, Fail) set(x, 6)

1

What can the leader infer from this interaction?

slide-87
SLIDE 87

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

AppendEntries(term=-1, prevIdx=-1, prevTerm=-1, [(0,0, set(x, 5),(1,0, set(x,6)])

slide-88
SLIDE 88

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

slide-89
SLIDE 89

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ...

...

22

...

23

...

24

slide-90
SLIDE 90

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ...

...

22

...

23

...

24

slide-91
SLIDE 91

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ...

...

22

...

23

...

24 1

...

22

slide-92
SLIDE 92

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ...

...

22

...

23

...

24 1

...

22 1

...

22

slide-93
SLIDE 93

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ... 1

...

22 1

...

22

slide-94
SLIDE 94

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ... 1

...

22 1

...

22 1

...

22

slide-95
SLIDE 95

Raft within a Term

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

... ... ... 1

...

22 1

...

22 1

...

22

Log entries can be deleted. When is it safe to execute commands?

slide-96
SLIDE 96

Need to ensure some log entries are never deleted.

slide-97
SLIDE 97

Safety Through Leader Election

  • Want to make sure some set of entries always remain in the log.
slide-98
SLIDE 98

Safety Through Leader Election

  • Want to make sure some set of entries always remain in the log.
  • Can only execute actions for such committed entries.
slide-99
SLIDE 99

Safety Through Leader Election

  • Want to make sure some set of entries always remain in the log.
  • Can only execute actions for such committed entries.
  • Need to ensure this without communicating with former leader(s).
slide-100
SLIDE 100

Safety Through Leader Election

  • Want to make sure some set of entries always remain in the log.
  • Can only execute actions for such committed entries.
  • Need to ensure this without communicating with former leader(s).
  • Leaders might die or disappear.
slide-101
SLIDE 101

Safety Through Leader Election

  • Want to make sure some set of entries always remain in the log.
  • Can only execute actions for such committed entries.
  • Need to ensure this without communicating with former leader(s).
  • Leaders might die or disappear.
  • How to do this?
slide-102
SLIDE 102

Safety Through Leader Election

  • Make use of quorum intersection.
slide-103
SLIDE 103

Safety Through Leader Election

  • Make use of quorum intersection.
  • How?
slide-104
SLIDE 104

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

RequestVote(term=1, lastLogIndex = 1, lastLogTerm = 0)

slide-105
SLIDE 105

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

RequestVote(term=1, lastLogIndex = 1, lastLogTerm = 0)

How should the followers respond?

slide-106
SLIDE 106

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

RequestVote(term=2, lastLogIndex = 2, lastLogTerm = 0)

slide-107
SLIDE 107

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

RequestVote(term=2, lastLogIndex = 2, lastLogTerm = 0)

How should the followers respond?

slide-108
SLIDE 108

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2 1

...

2

RequestVote(term=2, lastLogIndex = 2, lastLogTerm = 1) ...

2

slide-109
SLIDE 109

Leader Election

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2 1

...

2

RequestVote(term=2, lastLogIndex = 2, lastLogTerm = 1)

How should the followers respond?

...

2

slide-110
SLIDE 110

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

slide-111
SLIDE 111

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

slide-112
SLIDE 112

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

slide-113
SLIDE 113

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

slide-114
SLIDE 114

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

slide-115
SLIDE 115

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

slide-116
SLIDE 116

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

slide-117
SLIDE 117

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

2

2

Is this stable?

slide-118
SLIDE 118

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

2

2

slide-119
SLIDE 119

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

2

2

slide-120
SLIDE 120

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

2

2

Is this legal?

slide-121
SLIDE 121

Figure 8

1

1

1

1

1

1

1

1

1

1

2

2

2

2

3

3

4

4

2

2

3

3

slide-122
SLIDE 122

Figure 8

1

1

1

1

1

1

1

1

1

1

3

3

3

3

slide-123
SLIDE 123

Figure 8

1

1

1

1

1

1

1

1

1

1

3

3

3

3

3

3

slide-124
SLIDE 124

Figure 8

1

1

1

1

1

1

1

1

1

1

3

3

3

3

3

3

3

3

slide-125
SLIDE 125

Figure 8

1

1

1

1

1

1

1

1

1

1

3

3

3

3

3

3

3

3

3

3

slide-126
SLIDE 126

Configuration Change

slide-127
SLIDE 127

Why?

  • Want to be able to change the set of servers.
slide-128
SLIDE 128

Why?

  • Want to be able to change the set of servers.
  • Take down servers for maintenance.
slide-129
SLIDE 129

Why?

  • Want to be able to change the set of servers.
  • Take down servers for maintenance.
  • Add new servers to replace failed ones.
slide-130
SLIDE 130

Why?

  • Want to be able to change the set of servers.
  • Take down servers for maintenance.
  • Add new servers to replace failed ones.
  • Other reasons.
slide-131
SLIDE 131

How?

  • Use a special log message which contains the set of servers.

Term Config Index

slide-132
SLIDE 132

How?

  • Use a special log message which contains the set of servers.
  • Use Raft to replicate this to everyone.

Term Config Index

slide-133
SLIDE 133

How Special?

  • All peers use configuration as soon as logged.
  • Why safe?
  • We know how to revert this change.

Term Config Index

slide-134
SLIDE 134

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

slide-135
SLIDE 135

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

slide-136
SLIDE 136

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

C

5

slide-137
SLIDE 137

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

C

5

...

3

...

4

C

5

...

2

...

3

...

4

C

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C

5

slide-138
SLIDE 138

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2

...

3

...

4

C

5

slide-139
SLIDE 139

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2

...

3

...

4

C

5

slide-140
SLIDE 140

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2

...

3

...

4

C

5 1

...

3

slide-141
SLIDE 141

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2

...

3

...

4

C

5 1

...

3

...

2 1

...

3

slide-142
SLIDE 142

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2 1

...

3

...

2 1

...

3

slide-143
SLIDE 143

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2 1

...

3

...

2 1

...

3

...

2 1

...

3

slide-144
SLIDE 144

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

2 1

...

3

...

2 1

...

3

...

2 1

...

3

What happens now?

slide-145
SLIDE 145

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

slide-146
SLIDE 146

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

slide-147
SLIDE 147

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

C-all

5

slide-148
SLIDE 148

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

C-all

5

...

3

...

4

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

slide-149
SLIDE 149

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

...

2

C-all

5

...

3

...

4

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

C-new

5

slide-150
SLIDE 150

Protocol

set(x, 5) set(x, 5) set(x, 6)

1

set(x, 6)

1

...

2

...

3

...

4

C-all

5

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

set(x, 5) set(x, 6)

1

...

2

...

3

...

4

C-all

5

C-new

5

C-new

5

C-new

5

C-new

5

slide-151
SLIDE 151

Quiz