-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
wait_self
148 lines (117 loc) · 3.41 KB
/
wait_self
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Waiting states when waiting for reservation or lock holder from same txn.
new-lock-table maxlocks=10000
----
# ---------------------------------------------------------------------------------
# req4 is waiting on locked "a", and req2 from the same txn acquires the
# reservation. req4 transitions to waitForSelf state
# ---------------------------------------------------------------------------------
new-txn txn=txn1 ts=10 epoch=0
----
new-txn txn=txn2 ts=10 epoch=0
----
new-txn txn=txn3 ts=10 epoch=0
----
new-request r=req1 txn=txn1 ts=10 spans=intent@a
----
new-request r=req2 txn=txn2 ts=10 spans=intent@a
----
new-request r=req3 txn=txn3 ts=10 spans=intent@a
----
new-request r=req4 txn=txn2 ts=10 spans=intent@a
----
scan r=req1
----
start-waiting: false
acquire r=req1 k=a durability=u
----
num=1
lock: "a"
holder: txn: 00000000-0000-0000-0000-000000000001, ts: 10.000000000,0, info: unrepl epoch: 0, seqs: [0]
dequeue r=req1
----
num=1
lock: "a"
holder: txn: 00000000-0000-0000-0000-000000000001, ts: 10.000000000,0, info: unrepl epoch: 0, seqs: [0]
scan r=req2
----
start-waiting: true
scan r=req3
----
start-waiting: true
scan r=req4
----
start-waiting: true
guard-state r=req2
----
new: state=waitForDistinguished txn=txn1 key="a" held=true guard-strength=Intent
guard-state r=req3
----
new: state=waitFor txn=txn1 key="a" held=true guard-strength=Intent
guard-state r=req4
----
new: state=waitFor txn=txn1 key="a" held=true guard-strength=Intent
print
----
num=1
lock: "a"
holder: txn: 00000000-0000-0000-0000-000000000001, ts: 10.000000000,0, info: unrepl epoch: 0, seqs: [0]
queued writers:
active: true req: 2, txn: 00000000-0000-0000-0000-000000000002
active: true req: 3, txn: 00000000-0000-0000-0000-000000000003
active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
distinguished req: 2
release txn=txn1 span=a
----
num=1
lock: "a"
queued writers:
active: false req: 2, txn: 00000000-0000-0000-0000-000000000002
active: true req: 3, txn: 00000000-0000-0000-0000-000000000003
active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
distinguished req: 3
guard-state r=req2
----
new: state=doneWaiting
guard-state r=req3
----
new: state=waitForDistinguished txn=txn2 key="a" held=false guard-strength=Intent
guard-state r=req4
----
new: state=waitSelf
print
----
num=1
lock: "a"
queued writers:
active: false req: 2, txn: 00000000-0000-0000-0000-000000000002
active: true req: 3, txn: 00000000-0000-0000-0000-000000000003
active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
distinguished req: 3
# Stays in waitSelf state if scans again.
scan r=req4
----
start-waiting: true
guard-state r=req4
----
old: state=waitSelf
# ---------------------------------------------------------------------------------
# req4 is waiting on reserved "a", and req2 from the same txn acquires the
# lock. req4 stops waiting
# ---------------------------------------------------------------------------------
acquire r=req2 k=a durability=u
----
num=1
lock: "a"
holder: txn: 00000000-0000-0000-0000-000000000002, ts: 10.000000000,0, info: unrepl epoch: 0, seqs: [0]
queued writers:
active: true req: 3, txn: 00000000-0000-0000-0000-000000000003
distinguished req: 3
guard-state r=req3
----
new: state=waitForDistinguished txn=txn2 key="a" held=true guard-strength=Intent
guard-state r=req4
----
new: state=doneWaiting
scan r=req4
----
start-waiting: false