Inferring and Asserting Distributed System Invariants
Stewart Grant§, Hendrik Cech¶, Ivan Beschastnikh§
University of British Columbia§, University of Bamberg¶
1
https://bitbucket.org/bestchai/dinv
Inferring and Asserting Distributed System Invariants - - PowerPoint PPT Presentation
Inferring and Asserting Distributed System Invariants https://bitbucket.org/bestchai/dinv Stewart Grant , Hendrik Cech , Ivan Beschastnikh University of British Columbia , University of Bamberg 1 Distributed Systems are pervasive
University of British Columbia§, University of Bamberg¶
1
https://bitbucket.org/bestchai/dinv
2
3
Verification - [ (verification) IronFleet SOSP’15, VerdiPLDI’15, Chapar POPL’16,
(modeling), Lamport et.al SIGOPS’02, Holtzman IEEE TSE’97]
Bug Detection - [MODIST NSDI’09, Demi NSDI’16,] Runtime Checkers - [ D3S NSDI’18, ]
5
Tracing - [PivotTracing SOSP’15, XTrace NSDI’07, Dapper TR’10, ] Log Analysis - [ShiViz CACM ‘16]
Verification - [ (verification) IronFleet SOSP’15, VerdiPLDI’15, Chapar POPL’16,
(modeling), Lamport et.al SIGOPS’02, Holtzman IEEE TSE’97]
Bug Detection - [MODIST NSDI’09, Demi NSDI’16,] Runtime Checkers - [ D3S NSDI’18, ]
6
Tracing - [PivotTracing SOSP’15, XTrace NSDI’07, Dapper TR’10, ] Log Analysis - [ShiViz CACM ‘16]
Some notable exceptions
○ Communicatin finite state machines
○ Requires enormous manual effort
○ Requires shared state
None of these can capture stateful properties like:
○ ∀nodes i,j keys_i != keys_j
○ ∀followers i length(log_leader) >= length(log_follower_i)
7
Wanted: distributed state invariants Make the fewest assumptions about the system as possible.
8
Key Partitioning: ∀nodes i, j keys_i != keys_j Mutual exclusion: ∀nodes i,j InCritical_i →¬InCritical_j
9
Key Partitioning: ∀nodes i, j keys_i != keys_j Mutual exclusion: ∀nodes i,j InCritical_i →¬InCritical_j
10
“Distributed State”
Running Example
11
Key Partitioning: ∀nodes i, j keys_i != keys_j Mutual exclusion: ∀nodes i,j InCritical_i →¬InCritical_j “Distributed State”
Static Analysis Dynamic Analysis
12
1. Interprocedural Program Slicing 2. Logging Code Injection
13
1. Interprocedural Program Slicing 2. Logging Code Injection
14
1. Interprocedural Program Slicing 2. Logging Code Injection
15
1. Interprocedural Program Slicing 2. Logging Code Injection
16
1. Interprocedural Program Slicing 2. Logging Code Injection
17
1. Interprocedural Program Slicing 2. Logging Code Injection 3. Vector Clock Injection
18
1. Interprocedural Program Slicing 2. Logging Code Injection 3. Vector Clock Injection
19
1. Interprocedural Program Slicing 2. Logging Code Injection 3. Vector Clock Injection
20
1. Interprocedural Program Slicing 2. Logging Code Injection 3. Vector Clock Injection
21
22
23
24
25
26
27
28
29
30
○ No messages are in flight ○ Message sent but not received
○ The ping sent by Node 0 happened before the pings receipt on node 1.
31
32
33
with no in flight messages
34
with no in flight messages
space
35
with no in flight messages
space
37
38
39
40
41
=
42
43
44
45
46
47
48
49
Node_3_InCritical == True Node_2_InCritical != Node_3_InCritical Node_2_InCritical == Node_1_InCritical
50
... “Likely” Invariants
invariants at runtime
51
invariants at runtime
using approximate synchrony
52
invariants at runtime
using approximate synchrony
53
invariants at runtime
using approximate synchrony
state by aggregating snapshots
54
invariants at runtime
using approximate synchrony
state by aggregating snapshots
55
56
57
System and Targeted property Dinv-inferred invariant Description
Raft Strong Leader principle ∀ follower i, len(leader log) ≥ len(i’s log) All appended log entries must be propagated by the leader Raft Log matching ∀ nodes i, j if i-log[c] = j-log[c] → ∀(x ≤ c), i-log[x] = j-log[x] If two logs contain an entry with the same index and term, then the logs are identical on all previous entries. Raft Leader agreement If ∃ node i, s.t i leader, than ∀ j ≠ i, j follower If a leader exists, then all other nodes are followers.
*Raft: In search of an understandable consensus algorithm, D.Ongaro et. al
58
System and Targeted property Dinv-inferred invariant Description
Raft Strong Leader principle ∀ follower i, len(leader log) ≥ len(i’s log) All appended log entries must be propagated by the leader Raft Log matching ∀ nodes i, j if i-log[c] = j-log[c] → ∀(x ≤ c), i-log[x] = j-log[x] If two logs contain an entry with the same index and term, then the logs are identical on all previous entries. Raft Leader agreement If ∃ node i, s.t i leader, than ∀ j ≠ i, j follower If a leader exists, then all other nodes are followers.
*Raft: In search of an understandable consensus algorithm, D.Ongaro et. al
59
System and Targeted property Dinv-inferred invariant Description
Raft Strong Leader principle ∀ follower i, len(leader log) ≥ len(i’s log) All appended log entries must be propagated by the leader Raft Log matching ∀ nodes i, j if i-log[c] = j-log[c] → ∀(x ≤ c), i-log[x] = j-log[x] If two logs contain an entry with the same index and term, then the logs are identical on all previous entries. Raft Leader agreement If ∃ node i, s.t i leader, than ∀ j ≠ i, j follower If a leader exists, then all other nodes are followers.
*Raft: In search of an understandable consensus algorithm, D.Ongaro et. al
Future work
60
Limitations
61
Repo: https://bitbucket.org/bestchai/dinv Demo: https://www.youtube.com/watch?v=n9fH9ABJ6S4
○
Static identification of distributed state
○
Automatic static instrumentation
○
Post-execution merging of distributed states
∀nodes InCritical <= 1