forked from bloomberg/comdb2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llog.src
266 lines (242 loc) · 5.95 KB
/
llog.src
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
PREFIX llog
INCLUDE #include <ctype.h>
INCLUDE #include <errno.h>
INCLUDE #include <stdlib.h>
INCLUDE #include <string.h>
INCLUDE #include <sys/types.h>
INCLUDE
INCLUDE #include <db.h>
INCLUDE
INCLUDE #include "llog_auto.h"
/*
Summary: these records contain enough information to UNDO
a subtransaction. They contain no redo information.
*/
BEGIN savegenid 10001
DBT table DBT s
DBT genid DBT s
END
BEGIN scdone 10002
DBT table DBT s
DBT fastinit DBT s
END
BEGIN undo_add_dta 10003
DBT table DBT s
ARG dtafile short hd
ARG dtastripe short hd
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
DBT lock DBT s
END
BEGIN undo_add_ix 10004
DBT table DBT s
ARG ix short hd
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG keylen int d
ARG dtalen int d
END
BEGIN ltran_commit 10005
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG gblcontext genid_t lx
ARG isabort short hd
END
/* Berkeley log_put decomposes this record, so be careful changing it */
BEGIN ltran_start 10006
ARG ltranid genid_t lx
/* needed for distributed locks */
ARG ownerdb int d
/* no previous lsn necessary */
END
/* written when a physical transaction is
undone. prevllsn is as before. complsn
is the lsn of a record this compensates
for. */
BEGIN ltran_comprec 10007
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
POINTER complsn DB_LSN * lu
END
/* Logical undo records for deletes. Undo action is re-inserting
the index/data record. */
BEGIN undo_del_dta 10008
DBT table DBT s
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG dtafile short hd
ARG dtastripe short hd
ARG dtalen int d
DBT lock DBT s
END
BEGIN undo_del_ix 10009
DBT table DBT s
ARG genid genid_t lx
ARG ix short hd
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
DBT keylock DBT s
ARG keylen int d
ARG dtalen int d
END
BEGIN undo_upd_dta 10010
DBT table DBT s
ARG oldgenid genid_t lx
ARG newgenid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG dtafile short hd
ARG dtastripe short hd
DBT lockold DBT s
DBT locknew DBT s
ARG old_dta_len int d
END
BEGIN undo_upd_ix 10011
DBT table DBT s
ARG oldgenid genid_t lx
ARG newgenid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG ix short hd
DBT key DBT s
ARG dtalen int d
END
BEGIN repblob 10012
ARG sessionid int d
ARG seqno int d
DBT data DBT s
END
/*
* Rowlocks logical-logging is decoupled from snapisol-logical logging which
* does not use rowlocks. The reason for this is that a non-rowlock'd snapisol
* transaction will allow multiple logical logs under a single transaction.
* Rowlocks recovery depends on only a single logical log per physical txn.
*
* I've documented the rowlocks required for each of these logs. Some of these
* locks are write-duration, & don't have an entry in the logs.
*/
/*
* Rowlock add_dta:
* Acquire a rowlock on the dta file for the new record
*/
BEGIN undo_add_dta_lk 10013
DBT table DBT s
ARG dtafile short hd
ARG dtastripe short hd
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
END
/*
* Rowlock add_ix:
* Acquire a rowlock on the ix file for the new record
*/
BEGIN undo_add_ix_lk 10014
DBT table DBT s
ARG ix short hd
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
DBT key DBT s
ARG dtalen int d
END
/*
* Rowlock del_dta:
* Acquire a wall-lock for the previous record
* Acquire a rowlock on the record
*/
BEGIN undo_del_dta_lk 10015
DBT table DBT s
ARG genid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG dtafile short hd
ARG dtastripe short hd
ARG dtalen int d
END
/*
* Rowlock del_ix:
* Acquire wall-locks for prev & next records
* Acquire a short-term rowlock on the record itself (to make sure its not part of a wall)
* Probes into an index are protected by next-key locking
*/
BEGIN undo_del_ix_lk 10016
DBT table DBT s
ARG genid genid_t lx
ARG ix short hd
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG keylen int d
ARG dtalen int d
END
/*
* Rowlock upd_dta:
* Acquire a wall-lock for the prev record
* Acquire a rowlock for the old genid.
* Acquire a rowlock for the new genid.
*/
BEGIN undo_upd_dta_lk 10017
DBT table DBT s
ARG oldgenid genid_t lx
ARG newgenid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG dtafile short hd
ARG dtastripe short hd
ARG old_dta_len int d
END
/*
* Rowlock upd_ix:
* Acquire wall-locks for prev & next records
* Acquire a short-term rowlock for the old genid (to make sure its not part of a wall)
* Acquire a rowlock for the new genid.
*/
BEGIN undo_upd_ix_lk 10018
DBT table DBT s
ARG oldgenid genid_t lx
ARG newgenid genid_t lx
ARG ltranid genid_t lx
POINTER prevllsn DB_LSN * lu
ARG ix short hd
DBT key DBT s
ARG dtalen int d
END
BEGIN blkseq 10019
ARG time int64_t ld
DBT key DBT s
DBT data DBT s
END
/*
* Benchmark record for rowlocks/txn-regop
* Used as a way to diagnose rowlocks slowness
* The operation and args will tell us what to do on the remote side. Cut 1 (default)
* is to simple call into an empty handler in bdb/rowlocks.c - do everything that the
* other rowlocks handlers do to set up and nothing else.
*/
BEGIN rowlocks_log_bench 10020
ARG op int d
ARG arg1 int d
ARG arg2 int d
ARG ltranid genid_t lx
DBT payload DBT s
DBT lock1 DBT s
DBT lock2 DBT s
POINTER prevllsn DB_LSN * lu
END
/*
* Same size as the rowlocks bench, but used as the 'commit' benchmark. This
* won't make it's way into bdb/rowlocks.c at all on the replicant.
*/
BEGIN commit_log_bench 10021
ARG op int d
ARG arg1 int d
ARG arg2 int d
ARG ltranid genid_t lx
DBT payload DBT s
DBT lock1 DBT s
DBT lock2 DBT s
POINTER prevllsn DB_LSN * lu
END