1/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
3#pragma once
4/* Do not edit this file. This code generated by logformat.c. Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. */
5#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
6#include <ft/ft-internal.h>
7#include <util/bytestring.h>
8#include <util/memarena.h>
9enum lt_cmd {
10 LT_begin_checkpoint = 'x',
11 LT_end_checkpoint = 'X',
12 LT_fassociate = 'f',
13 LT_xstillopen = 's',
14 LT_xstillopenprepared = 'p',
15 LT_xbegin = 'b',
16 LT_xcommit = 'C',
17 LT_xprepare = 'P',
18 LT_xabort = 'q',
19 LT_fcreate = 'F',
20 LT_fopen = 'O',
21 LT_fclose = 'e',
22 LT_fdelete = 'U',
23 LT_frename = 'n',
24 LT_enq_insert = 'I',
25 LT_enq_insert_no_overwrite = 'i',
26 LT_enq_delete_any = 'E',
27 LT_enq_insert_multiple = 'm',
28 LT_enq_delete_multiple = 'M',
29 LT_comment = 'T',
30 LT_shutdown_up_to_19 = 'Q',
31 LT_shutdown = '0',
32 LT_load = 'l',
33 LT_hot_index = 'h',
34 LT_enq_update = 'u',
35 LT_enq_updatebroadcast = 'B',
36 LT_change_fdescriptor = 'D'
37};
38
39enum rt_cmd {
40 RT_fdelete = 'U',
41 RT_fcreate = 'F',
42 RT_frename = 'n',
43 RT_cmdinsert = 'i',
44 RT_cmddelete = 'd',
45 RT_rollinclude = 'r',
46 RT_load = 'l',
47 RT_hot_index = 'h',
48 RT_dictionary_redirect = 'R',
49 RT_cmdupdate = 'u',
50 RT_cmdupdatebroadcast = 'B',
51 RT_change_fdescriptor = 'D'
52};
53
54struct logtype_begin_checkpoint {
55 LSN lsn;
56 uint64_t timestamp;
57 TXNID last_xid;
58 uint32_t crc;
59 uint32_t len;
60};
61struct logtype_end_checkpoint {
62 LSN lsn;
63 LSN lsn_begin_checkpoint;
64 uint64_t timestamp;
65 uint32_t num_fassociate_entries;
66 uint32_t num_xstillopen_entries;
67 uint32_t crc;
68 uint32_t len;
69};
70struct logtype_fassociate {
71 LSN lsn;
72 FILENUM filenum;
73 uint32_t treeflags;
74 BYTESTRING iname;
75 uint8_t unlink_on_close;
76 uint32_t crc;
77 uint32_t len;
78};
79struct logtype_xstillopen {
80 LSN lsn;
81 TXNID_PAIR xid;
82 TXNID_PAIR parentxid;
83 uint64_t rollentry_raw_count;
84 FILENUMS open_filenums;
85 uint8_t force_fsync_on_commit;
86 uint64_t num_rollback_nodes;
87 uint64_t num_rollentries;
88 BLOCKNUM spilled_rollback_head;
89 BLOCKNUM spilled_rollback_tail;
90 BLOCKNUM current_rollback;
91 uint32_t crc;
92 uint32_t len;
93};
94struct logtype_xstillopenprepared {
95 LSN lsn;
96 TXNID_PAIR xid;
97 XIDP xa_xid;
98 uint64_t rollentry_raw_count;
99 FILENUMS open_filenums;
100 uint8_t force_fsync_on_commit;
101 uint64_t num_rollback_nodes;
102 uint64_t num_rollentries;
103 BLOCKNUM spilled_rollback_head;
104 BLOCKNUM spilled_rollback_tail;
105 BLOCKNUM current_rollback;
106 uint32_t crc;
107 uint32_t len;
108};
109struct logtype_xbegin {
110 LSN lsn;
111 TXNID_PAIR xid;
112 TXNID_PAIR parentxid;
113 uint32_t crc;
114 uint32_t len;
115};
116struct logtype_xcommit {
117 LSN lsn;
118 TXNID_PAIR xid;
119 uint32_t crc;
120 uint32_t len;
121};
122struct logtype_xprepare {
123 LSN lsn;
124 TXNID_PAIR xid;
125 XIDP xa_xid;
126 uint32_t crc;
127 uint32_t len;
128};
129struct logtype_xabort {
130 LSN lsn;
131 TXNID_PAIR xid;
132 uint32_t crc;
133 uint32_t len;
134};
135struct logtype_fcreate {
136 LSN lsn;
137 TXNID_PAIR xid;
138 FILENUM filenum;
139 BYTESTRING iname;
140 uint32_t mode;
141 uint32_t treeflags;
142 uint32_t nodesize;
143 uint32_t basementnodesize;
144 uint32_t compression_method;
145 uint32_t crc;
146 uint32_t len;
147};
148struct logtype_fopen {
149 LSN lsn;
150 BYTESTRING iname;
151 FILENUM filenum;
152 uint32_t treeflags;
153 uint32_t crc;
154 uint32_t len;
155};
156struct logtype_fclose {
157 LSN lsn;
158 BYTESTRING iname;
159 FILENUM filenum;
160 uint32_t crc;
161 uint32_t len;
162};
163struct logtype_fdelete {
164 LSN lsn;
165 TXNID_PAIR xid;
166 FILENUM filenum;
167 uint32_t crc;
168 uint32_t len;
169};
170struct logtype_frename {
171 LSN lsn;
172 TXNID_PAIR xid;
173 BYTESTRING old_iname;
174 FILENUM old_filenum;
175 BYTESTRING new_iname;
176 uint32_t crc;
177 uint32_t len;
178};
179struct logtype_enq_insert {
180 LSN lsn;
181 FILENUM filenum;
182 TXNID_PAIR xid;
183 BYTESTRING key;
184 BYTESTRING value;
185 uint32_t crc;
186 uint32_t len;
187};
188struct logtype_enq_insert_no_overwrite {
189 LSN lsn;
190 FILENUM filenum;
191 TXNID_PAIR xid;
192 BYTESTRING key;
193 BYTESTRING value;
194 uint32_t crc;
195 uint32_t len;
196};
197struct logtype_enq_delete_any {
198 LSN lsn;
199 FILENUM filenum;
200 TXNID_PAIR xid;
201 BYTESTRING key;
202 uint32_t crc;
203 uint32_t len;
204};
205struct logtype_enq_insert_multiple {
206 LSN lsn;
207 FILENUM src_filenum;
208 FILENUMS dest_filenums;
209 TXNID_PAIR xid;
210 BYTESTRING src_key;
211 BYTESTRING src_val;
212 uint32_t crc;
213 uint32_t len;
214};
215struct logtype_enq_delete_multiple {
216 LSN lsn;
217 FILENUM src_filenum;
218 FILENUMS dest_filenums;
219 TXNID_PAIR xid;
220 BYTESTRING src_key;
221 BYTESTRING src_val;
222 uint32_t crc;
223 uint32_t len;
224};
225struct logtype_comment {
226 LSN lsn;
227 uint64_t timestamp;
228 BYTESTRING comment;
229 uint32_t crc;
230 uint32_t len;
231};
232struct logtype_shutdown_up_to_19 {
233 LSN lsn;
234 uint64_t timestamp;
235 uint32_t crc;
236 uint32_t len;
237};
238struct logtype_shutdown {
239 LSN lsn;
240 uint64_t timestamp;
241 TXNID last_xid;
242 uint32_t crc;
243 uint32_t len;
244};
245struct logtype_load {
246 LSN lsn;
247 TXNID_PAIR xid;
248 FILENUM old_filenum;
249 BYTESTRING new_iname;
250 uint32_t crc;
251 uint32_t len;
252};
253struct logtype_hot_index {
254 LSN lsn;
255 TXNID_PAIR xid;
256 FILENUMS hot_index_filenums;
257 uint32_t crc;
258 uint32_t len;
259};
260struct logtype_enq_update {
261 LSN lsn;
262 FILENUM filenum;
263 TXNID_PAIR xid;
264 BYTESTRING key;
265 BYTESTRING extra;
266 uint32_t crc;
267 uint32_t len;
268};
269struct logtype_enq_updatebroadcast {
270 LSN lsn;
271 FILENUM filenum;
272 TXNID_PAIR xid;
273 BYTESTRING extra;
274 bool is_resetting_op;
275 uint32_t crc;
276 uint32_t len;
277};
278struct logtype_change_fdescriptor {
279 LSN lsn;
280 FILENUM filenum;
281 TXNID_PAIR xid;
282 BYTESTRING old_descriptor;
283 BYTESTRING new_descriptor;
284 bool update_cmp_descriptor;
285 uint32_t crc;
286 uint32_t len;
287};
288struct rolltype_fdelete {
289 FILENUM filenum;
290};
291int toku_rollback_fdelete (FILENUM filenum,TOKUTXN txn, LSN oplsn);
292int toku_commit_fdelete (FILENUM filenum,TOKUTXN txn, LSN oplsn);
293struct rolltype_fcreate {
294 FILENUM filenum;
295 BYTESTRING iname;
296};
297int toku_rollback_fcreate (FILENUM filenum,BYTESTRING iname,TOKUTXN txn, LSN oplsn);
298int toku_commit_fcreate (FILENUM filenum,BYTESTRING iname,TOKUTXN txn, LSN oplsn);
299struct rolltype_frename {
300 BYTESTRING old_iname;
301 BYTESTRING new_iname;
302};
303int toku_rollback_frename (BYTESTRING old_iname,BYTESTRING new_iname,TOKUTXN txn, LSN oplsn);
304int toku_commit_frename (BYTESTRING old_iname,BYTESTRING new_iname,TOKUTXN txn, LSN oplsn);
305struct rolltype_cmdinsert {
306 FILENUM filenum;
307 BYTESTRING key;
308};
309int toku_rollback_cmdinsert (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
310int toku_commit_cmdinsert (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
311struct rolltype_cmddelete {
312 FILENUM filenum;
313 BYTESTRING key;
314};
315int toku_rollback_cmddelete (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
316int toku_commit_cmddelete (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
317struct rolltype_rollinclude {
318 TXNID_PAIR xid;
319 uint64_t num_nodes;
320 BLOCKNUM spilled_head;
321 BLOCKNUM spilled_tail;
322};
323int toku_rollback_rollinclude (TXNID_PAIR xid,uint64_t num_nodes,BLOCKNUM spilled_head,BLOCKNUM spilled_tail,TOKUTXN txn, LSN oplsn);
324int toku_commit_rollinclude (TXNID_PAIR xid,uint64_t num_nodes,BLOCKNUM spilled_head,BLOCKNUM spilled_tail,TOKUTXN txn, LSN oplsn);
325struct rolltype_load {
326 FILENUM old_filenum;
327 BYTESTRING new_iname;
328};
329int toku_rollback_load (FILENUM old_filenum,BYTESTRING new_iname,TOKUTXN txn, LSN oplsn);
330int toku_commit_load (FILENUM old_filenum,BYTESTRING new_iname,TOKUTXN txn, LSN oplsn);
331struct rolltype_hot_index {
332 FILENUMS hot_index_filenums;
333};
334int toku_rollback_hot_index (FILENUMS hot_index_filenums,TOKUTXN txn, LSN oplsn);
335int toku_commit_hot_index (FILENUMS hot_index_filenums,TOKUTXN txn, LSN oplsn);
336struct rolltype_dictionary_redirect {
337 FILENUM old_filenum;
338 FILENUM new_filenum;
339};
340int toku_rollback_dictionary_redirect (FILENUM old_filenum,FILENUM new_filenum,TOKUTXN txn, LSN oplsn);
341int toku_commit_dictionary_redirect (FILENUM old_filenum,FILENUM new_filenum,TOKUTXN txn, LSN oplsn);
342struct rolltype_cmdupdate {
343 FILENUM filenum;
344 BYTESTRING key;
345};
346int toku_rollback_cmdupdate (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
347int toku_commit_cmdupdate (FILENUM filenum,BYTESTRING key,TOKUTXN txn, LSN oplsn);
348struct rolltype_cmdupdatebroadcast {
349 FILENUM filenum;
350 bool is_resetting_op;
351};
352int toku_rollback_cmdupdatebroadcast (FILENUM filenum,bool is_resetting_op,TOKUTXN txn, LSN oplsn);
353int toku_commit_cmdupdatebroadcast (FILENUM filenum,bool is_resetting_op,TOKUTXN txn, LSN oplsn);
354struct rolltype_change_fdescriptor {
355 FILENUM filenum;
356 BYTESTRING old_descriptor;
357};
358int toku_rollback_change_fdescriptor (FILENUM filenum,BYTESTRING old_descriptor,TOKUTXN txn, LSN oplsn);
359int toku_commit_change_fdescriptor (FILENUM filenum,BYTESTRING old_descriptor,TOKUTXN txn, LSN oplsn);
360struct log_entry {
361 enum lt_cmd cmd;
362 union {
363 struct logtype_begin_checkpoint begin_checkpoint;
364 struct logtype_end_checkpoint end_checkpoint;
365 struct logtype_fassociate fassociate;
366 struct logtype_xstillopen xstillopen;
367 struct logtype_xstillopenprepared xstillopenprepared;
368 struct logtype_xbegin xbegin;
369 struct logtype_xcommit xcommit;
370 struct logtype_xprepare xprepare;
371 struct logtype_xabort xabort;
372 struct logtype_fcreate fcreate;
373 struct logtype_fopen fopen;
374 struct logtype_fclose fclose;
375 struct logtype_fdelete fdelete;
376 struct logtype_frename frename;
377 struct logtype_enq_insert enq_insert;
378 struct logtype_enq_insert_no_overwrite enq_insert_no_overwrite;
379 struct logtype_enq_delete_any enq_delete_any;
380 struct logtype_enq_insert_multiple enq_insert_multiple;
381 struct logtype_enq_delete_multiple enq_delete_multiple;
382 struct logtype_comment comment;
383 struct logtype_shutdown_up_to_19 shutdown_up_to_19;
384 struct logtype_shutdown shutdown;
385 struct logtype_load load;
386 struct logtype_hot_index hot_index;
387 struct logtype_enq_update enq_update;
388 struct logtype_enq_updatebroadcast enq_updatebroadcast;
389 struct logtype_change_fdescriptor change_fdescriptor;
390 } u;
391};
392struct roll_entry {
393 enum rt_cmd cmd;
394 struct roll_entry *prev; /* for in-memory list of log entries. Threads from newest to oldest. */
395 union {
396 struct rolltype_fdelete fdelete;
397 struct rolltype_fcreate fcreate;
398 struct rolltype_frename frename;
399 struct rolltype_cmdinsert cmdinsert;
400 struct rolltype_cmddelete cmddelete;
401 struct rolltype_rollinclude rollinclude;
402 struct rolltype_load load;
403 struct rolltype_hot_index hot_index;
404 struct rolltype_dictionary_redirect dictionary_redirect;
405 struct rolltype_cmdupdate cmdupdate;
406 struct rolltype_cmdupdatebroadcast cmdupdatebroadcast;
407 struct rolltype_change_fdescriptor change_fdescriptor;
408 } u;
409};
410#define rolltype_dispatch(s, funprefix) ({ switch((s)->cmd) {\
411 case RT_fdelete: funprefix ## fdelete (&(s)->u.fdelete); break;\
412 case RT_fcreate: funprefix ## fcreate (&(s)->u.fcreate); break;\
413 case RT_frename: funprefix ## frename (&(s)->u.frename); break;\
414 case RT_cmdinsert: funprefix ## cmdinsert (&(s)->u.cmdinsert); break;\
415 case RT_cmddelete: funprefix ## cmddelete (&(s)->u.cmddelete); break;\
416 case RT_rollinclude: funprefix ## rollinclude (&(s)->u.rollinclude); break;\
417 case RT_load: funprefix ## load (&(s)->u.load); break;\
418 case RT_hot_index: funprefix ## hot_index (&(s)->u.hot_index); break;\
419 case RT_dictionary_redirect: funprefix ## dictionary_redirect (&(s)->u.dictionary_redirect); break;\
420 case RT_cmdupdate: funprefix ## cmdupdate (&(s)->u.cmdupdate); break;\
421 case RT_cmdupdatebroadcast: funprefix ## cmdupdatebroadcast (&(s)->u.cmdupdatebroadcast); break;\
422 case RT_change_fdescriptor: funprefix ## change_fdescriptor (&(s)->u.change_fdescriptor); break;\
423 }})
424#define logtype_dispatch_assign(s, funprefix, var, ...) do { switch((s)->cmd) {\
425 case LT_begin_checkpoint: var = funprefix ## begin_checkpoint (&(s)->u.begin_checkpoint, __VA_ARGS__); break;\
426 case LT_end_checkpoint: var = funprefix ## end_checkpoint (&(s)->u.end_checkpoint, __VA_ARGS__); break;\
427 case LT_fassociate: var = funprefix ## fassociate (&(s)->u.fassociate, __VA_ARGS__); break;\
428 case LT_xstillopen: var = funprefix ## xstillopen (&(s)->u.xstillopen, __VA_ARGS__); break;\
429 case LT_xstillopenprepared: var = funprefix ## xstillopenprepared (&(s)->u.xstillopenprepared, __VA_ARGS__); break;\
430 case LT_xbegin: var = funprefix ## xbegin (&(s)->u.xbegin, __VA_ARGS__); break;\
431 case LT_xcommit: var = funprefix ## xcommit (&(s)->u.xcommit, __VA_ARGS__); break;\
432 case LT_xprepare: var = funprefix ## xprepare (&(s)->u.xprepare, __VA_ARGS__); break;\
433 case LT_xabort: var = funprefix ## xabort (&(s)->u.xabort, __VA_ARGS__); break;\
434 case LT_fcreate: var = funprefix ## fcreate (&(s)->u.fcreate, __VA_ARGS__); break;\
435 case LT_fopen: var = funprefix ## fopen (&(s)->u.fopen, __VA_ARGS__); break;\
436 case LT_fclose: var = funprefix ## fclose (&(s)->u.fclose, __VA_ARGS__); break;\
437 case LT_fdelete: var = funprefix ## fdelete (&(s)->u.fdelete, __VA_ARGS__); break;\
438 case LT_frename: var = funprefix ## frename (&(s)->u.frename, __VA_ARGS__); break;\
439 case LT_enq_insert: var = funprefix ## enq_insert (&(s)->u.enq_insert, __VA_ARGS__); break;\
440 case LT_enq_insert_no_overwrite: var = funprefix ## enq_insert_no_overwrite (&(s)->u.enq_insert_no_overwrite, __VA_ARGS__); break;\
441 case LT_enq_delete_any: var = funprefix ## enq_delete_any (&(s)->u.enq_delete_any, __VA_ARGS__); break;\
442 case LT_enq_insert_multiple: var = funprefix ## enq_insert_multiple (&(s)->u.enq_insert_multiple, __VA_ARGS__); break;\
443 case LT_enq_delete_multiple: var = funprefix ## enq_delete_multiple (&(s)->u.enq_delete_multiple, __VA_ARGS__); break;\
444 case LT_comment: var = funprefix ## comment (&(s)->u.comment, __VA_ARGS__); break;\
445 case LT_shutdown_up_to_19: var = funprefix ## shutdown_up_to_19 (&(s)->u.shutdown_up_to_19, __VA_ARGS__); break;\
446 case LT_shutdown: var = funprefix ## shutdown (&(s)->u.shutdown, __VA_ARGS__); break;\
447 case LT_load: var = funprefix ## load (&(s)->u.load, __VA_ARGS__); break;\
448 case LT_hot_index: var = funprefix ## hot_index (&(s)->u.hot_index, __VA_ARGS__); break;\
449 case LT_enq_update: var = funprefix ## enq_update (&(s)->u.enq_update, __VA_ARGS__); break;\
450 case LT_enq_updatebroadcast: var = funprefix ## enq_updatebroadcast (&(s)->u.enq_updatebroadcast, __VA_ARGS__); break;\
451 case LT_change_fdescriptor: var = funprefix ## change_fdescriptor (&(s)->u.change_fdescriptor, __VA_ARGS__); break;\
452 }} while (0)
453#define rolltype_dispatch_assign(s, funprefix, var, ...) do { \
454 switch((s)->cmd) {\
455 case RT_fdelete: var = funprefix ## fdelete ((s)->u.fdelete.filenum, __VA_ARGS__); break;\
456 case RT_fcreate: var = funprefix ## fcreate ((s)->u.fcreate.filenum,(s)->u.fcreate.iname, __VA_ARGS__); break;\
457 case RT_frename: var = funprefix ## frename ((s)->u.frename.old_iname,(s)->u.frename.new_iname, __VA_ARGS__); break;\
458 case RT_cmdinsert: var = funprefix ## cmdinsert ((s)->u.cmdinsert.filenum,(s)->u.cmdinsert.key, __VA_ARGS__); break;\
459 case RT_cmddelete: var = funprefix ## cmddelete ((s)->u.cmddelete.filenum,(s)->u.cmddelete.key, __VA_ARGS__); break;\
460 case RT_rollinclude: var = funprefix ## rollinclude ((s)->u.rollinclude.xid,(s)->u.rollinclude.num_nodes,(s)->u.rollinclude.spilled_head,(s)->u.rollinclude.spilled_tail, __VA_ARGS__); break;\
461 case RT_load: var = funprefix ## load ((s)->u.load.old_filenum,(s)->u.load.new_iname, __VA_ARGS__); break;\
462 case RT_hot_index: var = funprefix ## hot_index ((s)->u.hot_index.hot_index_filenums, __VA_ARGS__); break;\
463 case RT_dictionary_redirect: var = funprefix ## dictionary_redirect ((s)->u.dictionary_redirect.old_filenum,(s)->u.dictionary_redirect.new_filenum, __VA_ARGS__); break;\
464 case RT_cmdupdate: var = funprefix ## cmdupdate ((s)->u.cmdupdate.filenum,(s)->u.cmdupdate.key, __VA_ARGS__); break;\
465 case RT_cmdupdatebroadcast: var = funprefix ## cmdupdatebroadcast ((s)->u.cmdupdatebroadcast.filenum,(s)->u.cmdupdatebroadcast.is_resetting_op, __VA_ARGS__); break;\
466 case RT_change_fdescriptor: var = funprefix ## change_fdescriptor ((s)->u.change_fdescriptor.filenum,(s)->u.change_fdescriptor.old_descriptor, __VA_ARGS__); break;\
467 default: assert(0);} } while (0)
468#define logtype_dispatch_args(s, funprefix, ...) do { switch((s)->cmd) {\
469 case LT_begin_checkpoint: funprefix ## begin_checkpoint ((s)->u.begin_checkpoint.lsn,(s)->u.begin_checkpoint.timestamp,(s)->u.begin_checkpoint.last_xid, __VA_ARGS__); break;\
470 case LT_end_checkpoint: funprefix ## end_checkpoint ((s)->u.end_checkpoint.lsn,(s)->u.end_checkpoint.lsn_begin_checkpoint,(s)->u.end_checkpoint.timestamp,(s)->u.end_checkpoint.num_fassociate_entries,(s)->u.end_checkpoint.num_xstillopen_entries, __VA_ARGS__); break;\
471 case LT_fassociate: funprefix ## fassociate ((s)->u.fassociate.lsn,(s)->u.fassociate.filenum,(s)->u.fassociate.treeflags,(s)->u.fassociate.iname,(s)->u.fassociate.unlink_on_close, __VA_ARGS__); break;\
472 case LT_xstillopen: funprefix ## xstillopen ((s)->u.xstillopen.lsn,(s)->u.xstillopen.xid,(s)->u.xstillopen.parentxid,(s)->u.xstillopen.rollentry_raw_count,(s)->u.xstillopen.open_filenums,(s)->u.xstillopen.force_fsync_on_commit,(s)->u.xstillopen.num_rollback_nodes,(s)->u.xstillopen.num_rollentries,(s)->u.xstillopen.spilled_rollback_head,(s)->u.xstillopen.spilled_rollback_tail,(s)->u.xstillopen.current_rollback, __VA_ARGS__); break;\
473 case LT_xstillopenprepared: funprefix ## xstillopenprepared ((s)->u.xstillopenprepared.lsn,(s)->u.xstillopenprepared.xid,(s)->u.xstillopenprepared.xa_xid,(s)->u.xstillopenprepared.rollentry_raw_count,(s)->u.xstillopenprepared.open_filenums,(s)->u.xstillopenprepared.force_fsync_on_commit,(s)->u.xstillopenprepared.num_rollback_nodes,(s)->u.xstillopenprepared.num_rollentries,(s)->u.xstillopenprepared.spilled_rollback_head,(s)->u.xstillopenprepared.spilled_rollback_tail,(s)->u.xstillopenprepared.current_rollback, __VA_ARGS__); break;\
474 case LT_xbegin: funprefix ## xbegin ((s)->u.xbegin.lsn,(s)->u.xbegin.xid,(s)->u.xbegin.parentxid, __VA_ARGS__); break;\
475 case LT_xcommit: funprefix ## xcommit ((s)->u.xcommit.lsn,(s)->u.xcommit.xid, __VA_ARGS__); break;\
476 case LT_xprepare: funprefix ## xprepare ((s)->u.xprepare.lsn,(s)->u.xprepare.xid,(s)->u.xprepare.xa_xid, __VA_ARGS__); break;\
477 case LT_xabort: funprefix ## xabort ((s)->u.xabort.lsn,(s)->u.xabort.xid, __VA_ARGS__); break;\
478 case LT_fcreate: funprefix ## fcreate ((s)->u.fcreate.lsn,(s)->u.fcreate.xid,(s)->u.fcreate.filenum,(s)->u.fcreate.iname,(s)->u.fcreate.mode,(s)->u.fcreate.treeflags,(s)->u.fcreate.nodesize,(s)->u.fcreate.basementnodesize,(s)->u.fcreate.compression_method, __VA_ARGS__); break;\
479 case LT_fopen: funprefix ## fopen ((s)->u.fopen.lsn,(s)->u.fopen.iname,(s)->u.fopen.filenum,(s)->u.fopen.treeflags, __VA_ARGS__); break;\
480 case LT_fclose: funprefix ## fclose ((s)->u.fclose.lsn,(s)->u.fclose.iname,(s)->u.fclose.filenum, __VA_ARGS__); break;\
481 case LT_fdelete: funprefix ## fdelete ((s)->u.fdelete.lsn,(s)->u.fdelete.xid,(s)->u.fdelete.filenum, __VA_ARGS__); break;\
482 case LT_frename: funprefix ## frename ((s)->u.frename.lsn,(s)->u.frename.xid,(s)->u.frename.old_iname,(s)->u.frename.old_filenum,(s)->u.frename.new_iname, __VA_ARGS__); break;\
483 case LT_enq_insert: funprefix ## enq_insert ((s)->u.enq_insert.lsn,(s)->u.enq_insert.filenum,(s)->u.enq_insert.xid,(s)->u.enq_insert.key,(s)->u.enq_insert.value, __VA_ARGS__); break;\
484 case LT_enq_insert_no_overwrite: funprefix ## enq_insert_no_overwrite ((s)->u.enq_insert_no_overwrite.lsn,(s)->u.enq_insert_no_overwrite.filenum,(s)->u.enq_insert_no_overwrite.xid,(s)->u.enq_insert_no_overwrite.key,(s)->u.enq_insert_no_overwrite.value, __VA_ARGS__); break;\
485 case LT_enq_delete_any: funprefix ## enq_delete_any ((s)->u.enq_delete_any.lsn,(s)->u.enq_delete_any.filenum,(s)->u.enq_delete_any.xid,(s)->u.enq_delete_any.key, __VA_ARGS__); break;\
486 case LT_enq_insert_multiple: funprefix ## enq_insert_multiple ((s)->u.enq_insert_multiple.lsn,(s)->u.enq_insert_multiple.src_filenum,(s)->u.enq_insert_multiple.dest_filenums,(s)->u.enq_insert_multiple.xid,(s)->u.enq_insert_multiple.src_key,(s)->u.enq_insert_multiple.src_val, __VA_ARGS__); break;\
487 case LT_enq_delete_multiple: funprefix ## enq_delete_multiple ((s)->u.enq_delete_multiple.lsn,(s)->u.enq_delete_multiple.src_filenum,(s)->u.enq_delete_multiple.dest_filenums,(s)->u.enq_delete_multiple.xid,(s)->u.enq_delete_multiple.src_key,(s)->u.enq_delete_multiple.src_val, __VA_ARGS__); break;\
488 case LT_comment: funprefix ## comment ((s)->u.comment.lsn,(s)->u.comment.timestamp,(s)->u.comment.comment, __VA_ARGS__); break;\
489 case LT_shutdown_up_to_19: funprefix ## shutdown_up_to_19 ((s)->u.shutdown_up_to_19.lsn,(s)->u.shutdown_up_to_19.timestamp, __VA_ARGS__); break;\
490 case LT_shutdown: funprefix ## shutdown ((s)->u.shutdown.lsn,(s)->u.shutdown.timestamp,(s)->u.shutdown.last_xid, __VA_ARGS__); break;\
491 case LT_load: funprefix ## load ((s)->u.load.lsn,(s)->u.load.xid,(s)->u.load.old_filenum,(s)->u.load.new_iname, __VA_ARGS__); break;\
492 case LT_hot_index: funprefix ## hot_index ((s)->u.hot_index.lsn,(s)->u.hot_index.xid,(s)->u.hot_index.hot_index_filenums, __VA_ARGS__); break;\
493 case LT_enq_update: funprefix ## enq_update ((s)->u.enq_update.lsn,(s)->u.enq_update.filenum,(s)->u.enq_update.xid,(s)->u.enq_update.key,(s)->u.enq_update.extra, __VA_ARGS__); break;\
494 case LT_enq_updatebroadcast: funprefix ## enq_updatebroadcast ((s)->u.enq_updatebroadcast.lsn,(s)->u.enq_updatebroadcast.filenum,(s)->u.enq_updatebroadcast.xid,(s)->u.enq_updatebroadcast.extra,(s)->u.enq_updatebroadcast.is_resetting_op, __VA_ARGS__); break;\
495 case LT_change_fdescriptor: funprefix ## change_fdescriptor ((s)->u.change_fdescriptor.lsn,(s)->u.change_fdescriptor.filenum,(s)->u.change_fdescriptor.xid,(s)->u.change_fdescriptor.old_descriptor,(s)->u.change_fdescriptor.new_descriptor,(s)->u.change_fdescriptor.update_cmp_descriptor, __VA_ARGS__); break;\
496 }} while (0)
497static const size_t toku_log_begin_checkpoint_overhead = (+4+1+8+sizeof(uint64_t)+sizeof(TXNID)+8);
498void toku_log_begin_checkpoint (TOKULOGGER logger, LSN *lsnp, int do_fsync, uint64_t timestamp, TXNID last_xid);
499static const size_t toku_log_end_checkpoint_overhead = (+4+1+8+sizeof(LSN)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+8);
500void toku_log_end_checkpoint (TOKULOGGER logger, LSN *lsnp, int do_fsync, LSN lsn_begin_checkpoint, uint64_t timestamp, uint32_t num_fassociate_entries, uint32_t num_xstillopen_entries);
501static const size_t toku_log_fassociate_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(uint32_t)+sizeof(BYTESTRING)+sizeof(uint8_t)+8);
502void toku_log_fassociate (TOKULOGGER logger, LSN *lsnp, int do_fsync, FILENUM filenum, uint32_t treeflags, BYTESTRING iname, uint8_t unlink_on_close);
503static const size_t toku_log_xstillopen_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(TXNID_PAIR)+sizeof(uint64_t)+sizeof(FILENUMS)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(BLOCKNUM)+sizeof(BLOCKNUM)+sizeof(BLOCKNUM)+8);
504void toku_log_xstillopen (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, TXNID_PAIR parentxid, uint64_t rollentry_raw_count, FILENUMS open_filenums, uint8_t force_fsync_on_commit, uint64_t num_rollback_nodes, uint64_t num_rollentries, BLOCKNUM spilled_rollback_head, BLOCKNUM spilled_rollback_tail, BLOCKNUM current_rollback);
505static const size_t toku_log_xstillopenprepared_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(XIDP)+sizeof(uint64_t)+sizeof(FILENUMS)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(BLOCKNUM)+sizeof(BLOCKNUM)+sizeof(BLOCKNUM)+8);
506void toku_log_xstillopenprepared (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, XIDP xa_xid, uint64_t rollentry_raw_count, FILENUMS open_filenums, uint8_t force_fsync_on_commit, uint64_t num_rollback_nodes, uint64_t num_rollentries, BLOCKNUM spilled_rollback_head, BLOCKNUM spilled_rollback_tail, BLOCKNUM current_rollback);
507static const size_t toku_log_xbegin_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(TXNID_PAIR)+8);
508void toku_log_xbegin (TOKULOGGER logger, LSN *lsnp, int do_fsync, TXNID_PAIR xid, TXNID_PAIR parentxid);
509static const size_t toku_log_xcommit_overhead = (+4+1+8+sizeof(TXNID_PAIR)+8);
510void toku_log_xcommit (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid);
511static const size_t toku_log_xprepare_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(XIDP)+8);
512void toku_log_xprepare (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, XIDP xa_xid);
513static const size_t toku_log_xabort_overhead = (+4+1+8+sizeof(TXNID_PAIR)+8);
514void toku_log_xabort (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid);
515static const size_t toku_log_fcreate_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(FILENUM)+sizeof(BYTESTRING)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint32_t)+8);
516void toku_log_fcreate (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, FILENUM filenum, BYTESTRING iname, uint32_t mode, uint32_t treeflags, uint32_t nodesize, uint32_t basementnodesize, uint32_t compression_method);
517static const size_t toku_log_fopen_overhead = (+4+1+8+sizeof(BYTESTRING)+sizeof(FILENUM)+sizeof(uint32_t)+8);
518void toku_log_fopen (TOKULOGGER logger, LSN *lsnp, int do_fsync, BYTESTRING iname, FILENUM filenum, uint32_t treeflags);
519static const size_t toku_log_fclose_overhead = (+4+1+8+sizeof(BYTESTRING)+sizeof(FILENUM)+8);
520void toku_log_fclose (TOKULOGGER logger, LSN *lsnp, int do_fsync, BYTESTRING iname, FILENUM filenum);
521static const size_t toku_log_fdelete_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(FILENUM)+8);
522void toku_log_fdelete (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, FILENUM filenum);
523static const size_t toku_log_frename_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(FILENUM)+sizeof(BYTESTRING)+8);
524void toku_log_frename (TOKULOGGER logger, LSN *lsnp, int do_fsync, TXNID_PAIR xid, BYTESTRING old_iname, FILENUM old_filenum, BYTESTRING new_iname);
525static const size_t toku_log_enq_insert_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+8);
526void toku_log_enq_insert (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING key, BYTESTRING value);
527static const size_t toku_log_enq_insert_no_overwrite_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+8);
528void toku_log_enq_insert_no_overwrite (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING key, BYTESTRING value);
529static const size_t toku_log_enq_delete_any_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+8);
530void toku_log_enq_delete_any (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING key);
531static const size_t toku_log_enq_insert_multiple_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(FILENUMS)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+8);
532void toku_log_enq_insert_multiple (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM src_filenum, FILENUMS dest_filenums, TXNID_PAIR xid, BYTESTRING src_key, BYTESTRING src_val);
533static const size_t toku_log_enq_delete_multiple_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(FILENUMS)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+8);
534void toku_log_enq_delete_multiple (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM src_filenum, FILENUMS dest_filenums, TXNID_PAIR xid, BYTESTRING src_key, BYTESTRING src_val);
535static const size_t toku_log_comment_overhead = (+4+1+8+sizeof(uint64_t)+sizeof(BYTESTRING)+8);
536void toku_log_comment (TOKULOGGER logger, LSN *lsnp, int do_fsync, uint64_t timestamp, BYTESTRING comment);
537static const size_t toku_log_shutdown_up_to_19_overhead = (+4+1+8+sizeof(uint64_t)+8);
538void toku_log_shutdown_up_to_19 (TOKULOGGER logger, LSN *lsnp, int do_fsync, uint64_t timestamp);
539static const size_t toku_log_shutdown_overhead = (+4+1+8+sizeof(uint64_t)+sizeof(TXNID)+8);
540void toku_log_shutdown (TOKULOGGER logger, LSN *lsnp, int do_fsync, uint64_t timestamp, TXNID last_xid);
541static const size_t toku_log_load_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(FILENUM)+sizeof(BYTESTRING)+8);
542void toku_log_load (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, FILENUM old_filenum, BYTESTRING new_iname);
543static const size_t toku_log_hot_index_overhead = (+4+1+8+sizeof(TXNID_PAIR)+sizeof(FILENUMS)+8);
544void toku_log_hot_index (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, TXNID_PAIR xid, FILENUMS hot_index_filenums);
545static const size_t toku_log_enq_update_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+8);
546void toku_log_enq_update (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING key, BYTESTRING extra);
547static const size_t toku_log_enq_updatebroadcast_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(bool)+8);
548void toku_log_enq_updatebroadcast (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING extra, bool is_resetting_op);
549static const size_t toku_log_change_fdescriptor_overhead = (+4+1+8+sizeof(FILENUM)+sizeof(TXNID_PAIR)+sizeof(BYTESTRING)+sizeof(BYTESTRING)+sizeof(bool)+8);
550void toku_log_change_fdescriptor (TOKULOGGER logger, LSN *lsnp, int do_fsync, TOKUTXN txn, FILENUM filenum, TXNID_PAIR xid, BYTESTRING old_descriptor, BYTESTRING new_descriptor, bool update_cmp_descriptor);
551int toku_log_fread (FILE *infile, struct log_entry *le);
552// Return 0 if there is something to read, -1 if nothing to read, >0 on error
553int toku_log_fread_backward (FILE *infile, struct log_entry *le);
554void toku_log_free_log_entry_resources (struct log_entry *le);
555void toku_logger_save_rollback_fdelete (TOKUTXN txn, FILENUM filenum);
556void toku_logger_save_rollback_fcreate (TOKUTXN txn, FILENUM filenum, BYTESTRING *iname_ptr);
557void toku_logger_save_rollback_frename (TOKUTXN txn, BYTESTRING *old_iname_ptr, BYTESTRING *new_iname_ptr);
558void toku_logger_save_rollback_cmdinsert (TOKUTXN txn, FILENUM filenum, BYTESTRING *key_ptr);
559void toku_logger_save_rollback_cmddelete (TOKUTXN txn, FILENUM filenum, BYTESTRING *key_ptr);
560void toku_logger_save_rollback_rollinclude (TOKUTXN txn, TXNID_PAIR xid, uint64_t num_nodes, BLOCKNUM spilled_head, BLOCKNUM spilled_tail);
561void toku_logger_save_rollback_load (TOKUTXN txn, FILENUM old_filenum, BYTESTRING *new_iname_ptr);
562void toku_logger_save_rollback_hot_index (TOKUTXN txn, FILENUMS *hot_index_filenums_ptr);
563void toku_logger_save_rollback_dictionary_redirect (TOKUTXN txn, FILENUM old_filenum, FILENUM new_filenum);
564void toku_logger_save_rollback_cmdupdate (TOKUTXN txn, FILENUM filenum, BYTESTRING *key_ptr);
565void toku_logger_save_rollback_cmdupdatebroadcast (TOKUTXN txn, FILENUM filenum, bool is_resetting_op);
566void toku_logger_save_rollback_change_fdescriptor (TOKUTXN txn, FILENUM filenum, BYTESTRING *old_descriptor_ptr);
567void toku_logger_rollback_wbuf_nocrc_write_fdelete (struct wbuf *wbuf, FILENUM filenum);
568void toku_logger_rollback_wbuf_nocrc_write_fcreate (struct wbuf *wbuf, FILENUM filenum, BYTESTRING iname);
569void toku_logger_rollback_wbuf_nocrc_write_frename (struct wbuf *wbuf, BYTESTRING old_iname, BYTESTRING new_iname);
570void toku_logger_rollback_wbuf_nocrc_write_cmdinsert (struct wbuf *wbuf, FILENUM filenum, BYTESTRING key);
571void toku_logger_rollback_wbuf_nocrc_write_cmddelete (struct wbuf *wbuf, FILENUM filenum, BYTESTRING key);
572void toku_logger_rollback_wbuf_nocrc_write_rollinclude (struct wbuf *wbuf, TXNID_PAIR xid, uint64_t num_nodes, BLOCKNUM spilled_head, BLOCKNUM spilled_tail);
573void toku_logger_rollback_wbuf_nocrc_write_load (struct wbuf *wbuf, FILENUM old_filenum, BYTESTRING new_iname);
574void toku_logger_rollback_wbuf_nocrc_write_hot_index (struct wbuf *wbuf, FILENUMS hot_index_filenums);
575void toku_logger_rollback_wbuf_nocrc_write_dictionary_redirect (struct wbuf *wbuf, FILENUM old_filenum, FILENUM new_filenum);
576void toku_logger_rollback_wbuf_nocrc_write_cmdupdate (struct wbuf *wbuf, FILENUM filenum, BYTESTRING key);
577void toku_logger_rollback_wbuf_nocrc_write_cmdupdatebroadcast (struct wbuf *wbuf, FILENUM filenum, bool is_resetting_op);
578void toku_logger_rollback_wbuf_nocrc_write_change_fdescriptor (struct wbuf *wbuf, FILENUM filenum, BYTESTRING old_descriptor);
579void toku_logger_rollback_wbuf_nocrc_write (struct wbuf *wbuf, struct roll_entry *r);
580uint32_t toku_logger_rollback_fsize_fdelete (FILENUM filenum);
581uint32_t toku_logger_rollback_fsize_fcreate (FILENUM filenum, BYTESTRING iname);
582uint32_t toku_logger_rollback_fsize_frename (BYTESTRING old_iname, BYTESTRING new_iname);
583uint32_t toku_logger_rollback_fsize_cmdinsert (FILENUM filenum, BYTESTRING key);
584uint32_t toku_logger_rollback_fsize_cmddelete (FILENUM filenum, BYTESTRING key);
585uint32_t toku_logger_rollback_fsize_rollinclude (TXNID_PAIR xid, uint64_t num_nodes, BLOCKNUM spilled_head, BLOCKNUM spilled_tail);
586uint32_t toku_logger_rollback_fsize_load (FILENUM old_filenum, BYTESTRING new_iname);
587uint32_t toku_logger_rollback_fsize_hot_index (FILENUMS hot_index_filenums);
588uint32_t toku_logger_rollback_fsize_dictionary_redirect (FILENUM old_filenum, FILENUM new_filenum);
589uint32_t toku_logger_rollback_fsize_cmdupdate (FILENUM filenum, BYTESTRING key);
590uint32_t toku_logger_rollback_fsize_cmdupdatebroadcast (FILENUM filenum, bool is_resetting_op);
591uint32_t toku_logger_rollback_fsize_change_fdescriptor (FILENUM filenum, BYTESTRING old_descriptor);
592uint32_t toku_logger_rollback_fsize(struct roll_entry *item);
593int toku_parse_rollback(unsigned char *buf, uint32_t n_bytes, struct roll_entry **itemp, memarena *ma);
594LSN toku_log_entry_get_lsn(struct log_entry *);
595int toku_logprint_one_record(FILE *outf, FILE *f);
596