-
Notifications
You must be signed in to change notification settings - Fork 557
/
commit
69 lines (60 loc) · 1.39 KB
/
commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Committing fails on an empty engine.
!commit 1
---
Panic: commit index 1 does not exist
# Add some entries.
splice 1@1= 2@1=foo 3@2=bar
---
splice → 3@2 bar
# Committing entry 0 fails.
!commit 0
---
Panic: commit index 0 does not exist
# Committing entry 1 works, and updates the commit index.
#
# Show the engine operations too, and notice that the commit index isn't flushed
# to durable storage (it can be recovered from the durable quorum logs).
commit 1 oplog=true
status
---
engine: set CommitIndex 0x02 = 0x0101
commit → 1@1 None
last=3@2 commit=1@1
# Dump the raw engine contents tdump
dump
---
Entry(1) 0x000000000000000001 = 0x010100
Entry(2) 0x000000000000000002 = 0x02010103666f6f
Entry(3) 0x000000000000000003 = 0x03020103626172
CommitIndex 0x02 = 0x0101
# Commits are idempotent, which doesn't incur an engine set.
commit 1 oplog=true
status
---
commit → 1@1 None
last=3@2 commit=1@1
# Commits can skip an entry.
commit 3
status
---
commit → 3@2 bar
last=3@2 commit=3@2
# Commit regressions error.
!commit 2
status
---
Panic: commit index regression 3 → 2
last=3@2 commit=3@2
# Committing non-existant indexes error.
!commit 4
status
---
Panic: commit index 4 does not exist
last=3@2 commit=3@2
# Dump the raw values.
dump
---
Entry(1) 0x000000000000000001 = 0x010100
Entry(2) 0x000000000000000002 = 0x02010103666f6f
Entry(3) 0x000000000000000003 = 0x03020103626172
CommitIndex 0x02 = 0x0302