1#include <stdint.h>
2#include <sys/time.h>
3#include <ft/logger/log-internal.h>
4int toku_logprint_one_record(FILE *outf, FILE *f) {
5 int cmd, r;
6 uint32_t len1, crc_in_file;
7 uint32_t ignorelen=0;
8 struct x1764 checksum;
9 toku_x1764_init(&checksum);
10 r=toku_fread_uint32_t(f, &len1, &checksum, &ignorelen);
11 if (r==EOF) return EOF;
12 cmd=fgetc(f);
13 if (cmd==EOF) return DB_BADFORMAT;
14 uint32_t len_in_file, len=1+4; // cmd + len1
15 char charcmd = (char)cmd;
16 toku_x1764_add(&checksum, &charcmd, 1);
17 switch ((enum lt_cmd)cmd) {
18 case LT_begin_checkpoint:
19 fprintf(outf, "%-23s ", "begin_checkpoint");
20 fprintf(outf, " 'x':");
21 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
22 r = toku_logprint_uint64_t (outf, f, "timestamp", &checksum, &len,0); if (r!=0) return r;
23 r = toku_logprint_TXNID (outf, f, "last_xid", &checksum, &len,0); if (r!=0) return r;
24 {
25 uint32_t actual_murmur = toku_x1764_finish(&checksum);
26 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
27 fprintf(outf, " crc=%08x", crc_in_file);
28 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
29 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
30 fprintf(outf, " len=%u", len_in_file);
31 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
32 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
33 };
34 fprintf(outf, "\n");
35 return 0;
36
37 case LT_end_checkpoint:
38 fprintf(outf, "%-23s ", "end_checkpoint");
39 fprintf(outf, " 'X':");
40 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
41 r = toku_logprint_LSN (outf, f, "lsn_begin_checkpoint", &checksum, &len,0); if (r!=0) return r;
42 r = toku_logprint_uint64_t (outf, f, "timestamp", &checksum, &len,0); if (r!=0) return r;
43 r = toku_logprint_uint32_t (outf, f, "num_fassociate_entries", &checksum, &len,0); if (r!=0) return r;
44 r = toku_logprint_uint32_t (outf, f, "num_xstillopen_entries", &checksum, &len,0); if (r!=0) return r;
45 {
46 uint32_t actual_murmur = toku_x1764_finish(&checksum);
47 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
48 fprintf(outf, " crc=%08x", crc_in_file);
49 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
50 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
51 fprintf(outf, " len=%u", len_in_file);
52 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
53 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
54 };
55 fprintf(outf, "\n");
56 return 0;
57
58 case LT_fassociate:
59 fprintf(outf, "%-23s ", "fassociate");
60 fprintf(outf, " 'f':");
61 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
62 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
63 r = toku_logprint_uint32_t (outf, f, "treeflags", &checksum, &len,0); if (r!=0) return r;
64 r = toku_logprint_BYTESTRING (outf, f, "iname", &checksum, &len,0); if (r!=0) return r;
65 r = toku_logprint_uint8_t (outf, f, "unlink_on_close", &checksum, &len,0); if (r!=0) return r;
66 {
67 uint32_t actual_murmur = toku_x1764_finish(&checksum);
68 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
69 fprintf(outf, " crc=%08x", crc_in_file);
70 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
71 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
72 fprintf(outf, " len=%u", len_in_file);
73 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
74 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
75 };
76 fprintf(outf, "\n");
77 return 0;
78
79 case LT_xstillopen:
80 fprintf(outf, "%-23s ", "xstillopen");
81 fprintf(outf, " 's':");
82 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
83 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
84 r = toku_logprint_TXNID_PAIR (outf, f, "parentxid", &checksum, &len,0); if (r!=0) return r;
85 r = toku_logprint_uint64_t (outf, f, "rollentry_raw_count", &checksum, &len,0); if (r!=0) return r;
86 r = toku_logprint_FILENUMS (outf, f, "open_filenums", &checksum, &len,0); if (r!=0) return r;
87 r = toku_logprint_uint8_t (outf, f, "force_fsync_on_commit", &checksum, &len,0); if (r!=0) return r;
88 r = toku_logprint_uint64_t (outf, f, "num_rollback_nodes", &checksum, &len,0); if (r!=0) return r;
89 r = toku_logprint_uint64_t (outf, f, "num_rollentries", &checksum, &len,0); if (r!=0) return r;
90 r = toku_logprint_BLOCKNUM (outf, f, "spilled_rollback_head", &checksum, &len,0); if (r!=0) return r;
91 r = toku_logprint_BLOCKNUM (outf, f, "spilled_rollback_tail", &checksum, &len,0); if (r!=0) return r;
92 r = toku_logprint_BLOCKNUM (outf, f, "current_rollback", &checksum, &len,0); if (r!=0) return r;
93 {
94 uint32_t actual_murmur = toku_x1764_finish(&checksum);
95 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
96 fprintf(outf, " crc=%08x", crc_in_file);
97 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
98 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
99 fprintf(outf, " len=%u", len_in_file);
100 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
101 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
102 };
103 fprintf(outf, "\n");
104 return 0;
105
106 case LT_xstillopenprepared:
107 fprintf(outf, "%-23s ", "xstillopenprepared");
108 fprintf(outf, " 'p':");
109 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
110 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
111 r = toku_logprint_XIDP (outf, f, "xa_xid", &checksum, &len,0); if (r!=0) return r;
112 r = toku_logprint_uint64_t (outf, f, "rollentry_raw_count", &checksum, &len,0); if (r!=0) return r;
113 r = toku_logprint_FILENUMS (outf, f, "open_filenums", &checksum, &len,0); if (r!=0) return r;
114 r = toku_logprint_uint8_t (outf, f, "force_fsync_on_commit", &checksum, &len,0); if (r!=0) return r;
115 r = toku_logprint_uint64_t (outf, f, "num_rollback_nodes", &checksum, &len,0); if (r!=0) return r;
116 r = toku_logprint_uint64_t (outf, f, "num_rollentries", &checksum, &len,0); if (r!=0) return r;
117 r = toku_logprint_BLOCKNUM (outf, f, "spilled_rollback_head", &checksum, &len,0); if (r!=0) return r;
118 r = toku_logprint_BLOCKNUM (outf, f, "spilled_rollback_tail", &checksum, &len,0); if (r!=0) return r;
119 r = toku_logprint_BLOCKNUM (outf, f, "current_rollback", &checksum, &len,0); if (r!=0) return r;
120 {
121 uint32_t actual_murmur = toku_x1764_finish(&checksum);
122 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
123 fprintf(outf, " crc=%08x", crc_in_file);
124 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
125 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
126 fprintf(outf, " len=%u", len_in_file);
127 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
128 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
129 };
130 fprintf(outf, "\n");
131 return 0;
132
133 case LT_xbegin:
134 fprintf(outf, "%-23s ", "xbegin");
135 fprintf(outf, " 'b':");
136 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
137 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
138 r = toku_logprint_TXNID_PAIR (outf, f, "parentxid", &checksum, &len,0); if (r!=0) return r;
139 {
140 uint32_t actual_murmur = toku_x1764_finish(&checksum);
141 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
142 fprintf(outf, " crc=%08x", crc_in_file);
143 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
144 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
145 fprintf(outf, " len=%u", len_in_file);
146 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
147 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
148 };
149 fprintf(outf, "\n");
150 return 0;
151
152 case LT_xcommit:
153 fprintf(outf, "%-23s ", "xcommit");
154 fprintf(outf, " 'C':");
155 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
156 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
157 {
158 uint32_t actual_murmur = toku_x1764_finish(&checksum);
159 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
160 fprintf(outf, " crc=%08x", crc_in_file);
161 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
162 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
163 fprintf(outf, " len=%u", len_in_file);
164 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
165 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
166 };
167 fprintf(outf, "\n");
168 return 0;
169
170 case LT_xprepare:
171 fprintf(outf, "%-23s ", "xprepare");
172 fprintf(outf, " 'P':");
173 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
174 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
175 r = toku_logprint_XIDP (outf, f, "xa_xid", &checksum, &len,0); if (r!=0) return r;
176 {
177 uint32_t actual_murmur = toku_x1764_finish(&checksum);
178 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
179 fprintf(outf, " crc=%08x", crc_in_file);
180 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
181 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
182 fprintf(outf, " len=%u", len_in_file);
183 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
184 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
185 };
186 fprintf(outf, "\n");
187 return 0;
188
189 case LT_xabort:
190 fprintf(outf, "%-23s ", "xabort");
191 fprintf(outf, " 'q':");
192 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
193 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
194 {
195 uint32_t actual_murmur = toku_x1764_finish(&checksum);
196 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
197 fprintf(outf, " crc=%08x", crc_in_file);
198 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
199 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
200 fprintf(outf, " len=%u", len_in_file);
201 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
202 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
203 };
204 fprintf(outf, "\n");
205 return 0;
206
207 case LT_fcreate:
208 fprintf(outf, "%-23s ", "fcreate");
209 fprintf(outf, " 'F':");
210 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
211 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
212 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
213 r = toku_logprint_BYTESTRING (outf, f, "iname", &checksum, &len,0); if (r!=0) return r;
214 r = toku_logprint_uint32_t (outf, f, "mode", &checksum, &len,"0%o"); if (r!=0) return r;
215 r = toku_logprint_uint32_t (outf, f, "treeflags", &checksum, &len,0); if (r!=0) return r;
216 r = toku_logprint_uint32_t (outf, f, "nodesize", &checksum, &len,0); if (r!=0) return r;
217 r = toku_logprint_uint32_t (outf, f, "basementnodesize", &checksum, &len,0); if (r!=0) return r;
218 r = toku_logprint_uint32_t (outf, f, "compression_method", &checksum, &len,0); if (r!=0) return r;
219 {
220 uint32_t actual_murmur = toku_x1764_finish(&checksum);
221 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
222 fprintf(outf, " crc=%08x", crc_in_file);
223 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
224 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
225 fprintf(outf, " len=%u", len_in_file);
226 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
227 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
228 };
229 fprintf(outf, "\n");
230 return 0;
231
232 case LT_fopen:
233 fprintf(outf, "%-23s ", "fopen");
234 fprintf(outf, " 'O':");
235 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
236 r = toku_logprint_BYTESTRING (outf, f, "iname", &checksum, &len,0); if (r!=0) return r;
237 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
238 r = toku_logprint_uint32_t (outf, f, "treeflags", &checksum, &len,0); if (r!=0) return r;
239 {
240 uint32_t actual_murmur = toku_x1764_finish(&checksum);
241 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
242 fprintf(outf, " crc=%08x", crc_in_file);
243 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
244 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
245 fprintf(outf, " len=%u", len_in_file);
246 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
247 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
248 };
249 fprintf(outf, "\n");
250 return 0;
251
252 case LT_fclose:
253 fprintf(outf, "%-23s ", "fclose");
254 fprintf(outf, " 'e':");
255 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
256 r = toku_logprint_BYTESTRING (outf, f, "iname", &checksum, &len,0); if (r!=0) return r;
257 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
258 {
259 uint32_t actual_murmur = toku_x1764_finish(&checksum);
260 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
261 fprintf(outf, " crc=%08x", crc_in_file);
262 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
263 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
264 fprintf(outf, " len=%u", len_in_file);
265 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
266 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
267 };
268 fprintf(outf, "\n");
269 return 0;
270
271 case LT_fdelete:
272 fprintf(outf, "%-23s ", "fdelete");
273 fprintf(outf, " 'U':");
274 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
275 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
276 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
277 {
278 uint32_t actual_murmur = toku_x1764_finish(&checksum);
279 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
280 fprintf(outf, " crc=%08x", crc_in_file);
281 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
282 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
283 fprintf(outf, " len=%u", len_in_file);
284 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
285 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
286 };
287 fprintf(outf, "\n");
288 return 0;
289
290 case LT_frename:
291 fprintf(outf, "%-23s ", "frename");
292 fprintf(outf, " 'n':");
293 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
294 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
295 r = toku_logprint_BYTESTRING (outf, f, "old_iname", &checksum, &len,0); if (r!=0) return r;
296 r = toku_logprint_FILENUM (outf, f, "old_filenum", &checksum, &len,0); if (r!=0) return r;
297 r = toku_logprint_BYTESTRING (outf, f, "new_iname", &checksum, &len,0); if (r!=0) return r;
298 {
299 uint32_t actual_murmur = toku_x1764_finish(&checksum);
300 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
301 fprintf(outf, " crc=%08x", crc_in_file);
302 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
303 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
304 fprintf(outf, " len=%u", len_in_file);
305 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
306 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
307 };
308 fprintf(outf, "\n");
309 return 0;
310
311 case LT_enq_insert:
312 fprintf(outf, "%-23s ", "enq_insert");
313 fprintf(outf, " 'I':");
314 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
315 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
316 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
317 r = toku_logprint_BYTESTRING (outf, f, "key", &checksum, &len,0); if (r!=0) return r;
318 r = toku_logprint_BYTESTRING (outf, f, "value", &checksum, &len,0); if (r!=0) return r;
319 {
320 uint32_t actual_murmur = toku_x1764_finish(&checksum);
321 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
322 fprintf(outf, " crc=%08x", crc_in_file);
323 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
324 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
325 fprintf(outf, " len=%u", len_in_file);
326 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
327 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
328 };
329 fprintf(outf, "\n");
330 return 0;
331
332 case LT_enq_insert_no_overwrite:
333 fprintf(outf, "%-23s ", "enq_insert_no_overwrite");
334 fprintf(outf, " 'i':");
335 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
336 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
337 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
338 r = toku_logprint_BYTESTRING (outf, f, "key", &checksum, &len,0); if (r!=0) return r;
339 r = toku_logprint_BYTESTRING (outf, f, "value", &checksum, &len,0); if (r!=0) return r;
340 {
341 uint32_t actual_murmur = toku_x1764_finish(&checksum);
342 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
343 fprintf(outf, " crc=%08x", crc_in_file);
344 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
345 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
346 fprintf(outf, " len=%u", len_in_file);
347 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
348 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
349 };
350 fprintf(outf, "\n");
351 return 0;
352
353 case LT_enq_delete_any:
354 fprintf(outf, "%-23s ", "enq_delete_any");
355 fprintf(outf, " 'E':");
356 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
357 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
358 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
359 r = toku_logprint_BYTESTRING (outf, f, "key", &checksum, &len,0); if (r!=0) return r;
360 {
361 uint32_t actual_murmur = toku_x1764_finish(&checksum);
362 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
363 fprintf(outf, " crc=%08x", crc_in_file);
364 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
365 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
366 fprintf(outf, " len=%u", len_in_file);
367 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
368 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
369 };
370 fprintf(outf, "\n");
371 return 0;
372
373 case LT_enq_insert_multiple:
374 fprintf(outf, "%-23s ", "enq_insert_multiple");
375 fprintf(outf, " 'm':");
376 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
377 r = toku_logprint_FILENUM (outf, f, "src_filenum", &checksum, &len,0); if (r!=0) return r;
378 r = toku_logprint_FILENUMS (outf, f, "dest_filenums", &checksum, &len,0); if (r!=0) return r;
379 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
380 r = toku_logprint_BYTESTRING (outf, f, "src_key", &checksum, &len,0); if (r!=0) return r;
381 r = toku_logprint_BYTESTRING (outf, f, "src_val", &checksum, &len,0); if (r!=0) return r;
382 {
383 uint32_t actual_murmur = toku_x1764_finish(&checksum);
384 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
385 fprintf(outf, " crc=%08x", crc_in_file);
386 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
387 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
388 fprintf(outf, " len=%u", len_in_file);
389 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
390 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
391 };
392 fprintf(outf, "\n");
393 return 0;
394
395 case LT_enq_delete_multiple:
396 fprintf(outf, "%-23s ", "enq_delete_multiple");
397 fprintf(outf, " 'M':");
398 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
399 r = toku_logprint_FILENUM (outf, f, "src_filenum", &checksum, &len,0); if (r!=0) return r;
400 r = toku_logprint_FILENUMS (outf, f, "dest_filenums", &checksum, &len,0); if (r!=0) return r;
401 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
402 r = toku_logprint_BYTESTRING (outf, f, "src_key", &checksum, &len,0); if (r!=0) return r;
403 r = toku_logprint_BYTESTRING (outf, f, "src_val", &checksum, &len,0); if (r!=0) return r;
404 {
405 uint32_t actual_murmur = toku_x1764_finish(&checksum);
406 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
407 fprintf(outf, " crc=%08x", crc_in_file);
408 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
409 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
410 fprintf(outf, " len=%u", len_in_file);
411 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
412 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
413 };
414 fprintf(outf, "\n");
415 return 0;
416
417 case LT_comment:
418 fprintf(outf, "%-23s ", "comment");
419 fprintf(outf, " 'T':");
420 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
421 r = toku_logprint_uint64_t (outf, f, "timestamp", &checksum, &len,0); if (r!=0) return r;
422 r = toku_logprint_BYTESTRING (outf, f, "comment", &checksum, &len,0); if (r!=0) return r;
423 {
424 uint32_t actual_murmur = toku_x1764_finish(&checksum);
425 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
426 fprintf(outf, " crc=%08x", crc_in_file);
427 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
428 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
429 fprintf(outf, " len=%u", len_in_file);
430 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
431 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
432 };
433 fprintf(outf, "\n");
434 return 0;
435
436 case LT_shutdown_up_to_19:
437 fprintf(outf, "%-23s ", "shutdown_up_to_19");
438 fprintf(outf, " 'Q':");
439 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
440 r = toku_logprint_uint64_t (outf, f, "timestamp", &checksum, &len,0); if (r!=0) return r;
441 {
442 uint32_t actual_murmur = toku_x1764_finish(&checksum);
443 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
444 fprintf(outf, " crc=%08x", crc_in_file);
445 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
446 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
447 fprintf(outf, " len=%u", len_in_file);
448 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
449 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
450 };
451 fprintf(outf, "\n");
452 return 0;
453
454 case LT_shutdown:
455 fprintf(outf, "%-23s ", "shutdown");
456 fprintf(outf, " '0':");
457 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
458 r = toku_logprint_uint64_t (outf, f, "timestamp", &checksum, &len,0); if (r!=0) return r;
459 r = toku_logprint_TXNID (outf, f, "last_xid", &checksum, &len,0); if (r!=0) return r;
460 {
461 uint32_t actual_murmur = toku_x1764_finish(&checksum);
462 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
463 fprintf(outf, " crc=%08x", crc_in_file);
464 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
465 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
466 fprintf(outf, " len=%u", len_in_file);
467 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
468 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
469 };
470 fprintf(outf, "\n");
471 return 0;
472
473 case LT_load:
474 fprintf(outf, "%-23s ", "load");
475 fprintf(outf, " 'l':");
476 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
477 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
478 r = toku_logprint_FILENUM (outf, f, "old_filenum", &checksum, &len,0); if (r!=0) return r;
479 r = toku_logprint_BYTESTRING (outf, f, "new_iname", &checksum, &len,0); if (r!=0) return r;
480 {
481 uint32_t actual_murmur = toku_x1764_finish(&checksum);
482 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
483 fprintf(outf, " crc=%08x", crc_in_file);
484 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
485 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
486 fprintf(outf, " len=%u", len_in_file);
487 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
488 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
489 };
490 fprintf(outf, "\n");
491 return 0;
492
493 case LT_hot_index:
494 fprintf(outf, "%-23s ", "hot_index");
495 fprintf(outf, " 'h':");
496 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
497 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
498 r = toku_logprint_FILENUMS (outf, f, "hot_index_filenums", &checksum, &len,0); if (r!=0) return r;
499 {
500 uint32_t actual_murmur = toku_x1764_finish(&checksum);
501 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
502 fprintf(outf, " crc=%08x", crc_in_file);
503 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
504 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
505 fprintf(outf, " len=%u", len_in_file);
506 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
507 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
508 };
509 fprintf(outf, "\n");
510 return 0;
511
512 case LT_enq_update:
513 fprintf(outf, "%-23s ", "enq_update");
514 fprintf(outf, " 'u':");
515 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
516 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
517 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
518 r = toku_logprint_BYTESTRING (outf, f, "key", &checksum, &len,0); if (r!=0) return r;
519 r = toku_logprint_BYTESTRING (outf, f, "extra", &checksum, &len,0); if (r!=0) return r;
520 {
521 uint32_t actual_murmur = toku_x1764_finish(&checksum);
522 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
523 fprintf(outf, " crc=%08x", crc_in_file);
524 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
525 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
526 fprintf(outf, " len=%u", len_in_file);
527 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
528 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
529 };
530 fprintf(outf, "\n");
531 return 0;
532
533 case LT_enq_updatebroadcast:
534 fprintf(outf, "%-23s ", "enq_updatebroadcast");
535 fprintf(outf, " 'B':");
536 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
537 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
538 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
539 r = toku_logprint_BYTESTRING (outf, f, "extra", &checksum, &len,0); if (r!=0) return r;
540 r = toku_logprint_bool (outf, f, "is_resetting_op", &checksum, &len,0); if (r!=0) return r;
541 {
542 uint32_t actual_murmur = toku_x1764_finish(&checksum);
543 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
544 fprintf(outf, " crc=%08x", crc_in_file);
545 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
546 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
547 fprintf(outf, " len=%u", len_in_file);
548 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
549 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
550 };
551 fprintf(outf, "\n");
552 return 0;
553
554 case LT_change_fdescriptor:
555 fprintf(outf, "%-23s ", "change_fdescriptor");
556 fprintf(outf, " 'D':");
557 r = toku_logprint_LSN (outf, f, "lsn", &checksum, &len, 0); if (r!=0) return r;
558 r = toku_logprint_FILENUM (outf, f, "filenum", &checksum, &len,0); if (r!=0) return r;
559 r = toku_logprint_TXNID_PAIR (outf, f, "xid", &checksum, &len,0); if (r!=0) return r;
560 r = toku_logprint_BYTESTRING (outf, f, "old_descriptor", &checksum, &len,0); if (r!=0) return r;
561 r = toku_logprint_BYTESTRING (outf, f, "new_descriptor", &checksum, &len,0); if (r!=0) return r;
562 r = toku_logprint_bool (outf, f, "update_cmp_descriptor", &checksum, &len,0); if (r!=0) return r;
563 {
564 uint32_t actual_murmur = toku_x1764_finish(&checksum);
565 r = toku_fread_uint32_t_nocrclen (f, &crc_in_file); len+=4; if (r!=0) return r;
566 fprintf(outf, " crc=%08x", crc_in_file);
567 if (crc_in_file!=actual_murmur) fprintf(outf, " checksum=%08x", actual_murmur);
568 r = toku_fread_uint32_t_nocrclen (f, &len_in_file); len+=4; if (r!=0) return r;
569 fprintf(outf, " len=%u", len_in_file);
570 if (len_in_file!=len) fprintf(outf, " actual_len=%u", len);
571 if (len_in_file!=len || crc_in_file!=actual_murmur) return DB_BADFORMAT;
572 };
573 fprintf(outf, "\n");
574 return 0;
575
576 }
577 fprintf(outf, "Unknown command %d ('%c')", cmd, cmd);
578 return DB_BADFORMAT;
579}
580
581