1 /*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 1996, 2013 Oracle and/or its affiliates. All rights reserved.
5 *
6 * $Id$
7 */
8
9 /*
10 * This file contains verification functions for all types of log records,
11 * one for each type. We can't make this automated like the log_type_print/read
12 * functions because there are no consistent handling. Each type of log records
13 * have unique ways to verify, and unique information to extract.
14 *
15 * In each verification function, we first call the log_type_read function
16 * to get the log_type_args structure, then extract information according to
17 * the type of log. The log types can be made into different categories, each
18 * of which have similar types of information.
19 *
20 * For example, txn_regop and txn_ckp types both have timestamps, and we
21 * want to maintain (timestamp,lsn) mapping, so we will have a on_timestamp
22 * function, and call it in txn_regop_verify and txn_ckp_verify functions,
23 * and in the two functions we may call other on_*** functions to extract and
24 * verify other information.
25 */
26
27 #include "db_config.h"
28
29 #include "db_int.h"
30 #include "dbinc/db_page.h"
31 #include "dbinc/btree.h"
32 #include "dbinc/fop.h"
33 #include "dbinc/hash.h"
34 #include "dbinc/heap.h"
35 #include "dbinc/qam.h"
36 #include "dbinc/txn.h"
37
38 #include "dbinc/log_verify.h"
39
40 static int __log_vrfy_proc __P((DB_LOG_VRFY_INFO *, DB_LSN, DB_LSN,
41 u_int32_t, DB_TXN *, int32_t, int *));
42 static int __lv_ckp_vrfy_handler __P((DB_LOG_VRFY_INFO *,
43 VRFY_TXN_INFO *, void *));
44 static const char *__lv_dbreg_str __P((u_int32_t));
45 static int __lv_dbregid_to_dbtype __P((DB_LOG_VRFY_INFO *, int32_t, DBTYPE *));
46 static int __lv_dbt_str __P((const DBT *, char **));
47 static const char *__lv_dbtype_str __P((DBTYPE));
48 static u_int32_t __lv_first_offset __P((ENV *));
49 static int __lv_new_logfile_vrfy __P((DB_LOG_VRFY_INFO *, const DB_LSN *));
50 static int __lv_log_fwdscr_oncmt __P((DB_LOG_VRFY_INFO *, DB_LSN,
51 u_int32_t, u_int32_t, int32_t));
52 static int __lv_log_fwdscr_onrec __P((DB_LOG_VRFY_INFO *,
53 u_int32_t, u_int32_t, DB_LSN, DB_LSN));
54 static int __lv_log_mismatch __P((DB_LOG_VRFY_INFO *, DB_LSN, DBTYPE, DBTYPE));
55 static int __lv_on_bam_log __P((DB_LOG_VRFY_INFO *, DB_LSN, int32_t));
56 static int __lv_on_ham_log __P((DB_LOG_VRFY_INFO *, DB_LSN, int32_t));
57 static int __lv_on_heap_log __P((DB_LOG_VRFY_INFO *, DB_LSN, int32_t));
58 static int __lv_on_new_txn __P((DB_LOG_VRFY_INFO *, const DB_LSN *,
59 const DB_TXN *, u_int32_t, int32_t, const DBT *));
60 static int __lv_on_nontxn_update __P((DB_LOG_VRFY_INFO *, const DB_LSN *,
61 u_int32_t, u_int32_t, int32_t));
62 static int __lv_on_page_update __P((DB_LOG_VRFY_INFO *, DB_LSN, int32_t,
63 db_pgno_t, DB_TXN *, int *));
64 static int __lv_on_qam_log __P((DB_LOG_VRFY_INFO *, DB_LSN, int32_t));
65 static int __lv_on_timestamp __P((DB_LOG_VRFY_INFO *, const DB_LSN *,
66 int32_t, u_int32_t));
67 static int __lv_on_txn_aborted __P((DB_LOG_VRFY_INFO *));
68 static int __lv_on_txn_logrec __P((DB_LOG_VRFY_INFO *, const DB_LSN *,
69 const DB_LSN *, const DB_TXN *, u_int32_t, int32_t));
70 static int __lv_vrfy_for_dbfile __P((DB_LOG_VRFY_INFO *, int32_t, int *));
71
72 /* General error handlers, called when a check fails. */
73 #define ON_ERROR(lvh, errv) do { \
74 (lvh)->flags |= (errv); \
75 if (F_ISSET((lvh), DB_LOG_VERIFY_CAF)) \
76 ret = 0;/* Ignore the error and continue. */ \
77 goto err; \
78 } while (0)
79
80 /* Used by logs of unsupported types. */
81 #define ON_NOT_SUPPORTED(env, lvh, lsn, ltype) do { \
82 __db_errx((env), DB_STR_A("2536", \
83 "[%lu][%lu] Not supported type of log record %u.", \
84 "%lu %lu %u"), (u_long)((lsn).file), (u_long)((lsn).offset),\
85 (ltype)); \
86 (lvh)->unknown_logrec_cnt++; \
87 goto err; \
88 } while (0)
89
90 #define SKIP_FORWARD_CHK(type) ((type) != DB___txn_regop && \
91 (type) != DB___txn_ckp && (type) != DB___fop_rename && \
92 (type) != DB___txn_child)
93
94 #define NOTCOMMIT(type) ((type) != DB___txn_regop && \
95 (type) != DB___txn_child)
96
97 #define LOG_VRFY_PROC(lvh, lsn, argp, fileid) do { \
98 int __lv_log_vrfy_proc_step = 0; \
99 if ((ret = __log_vrfy_proc((lvh), (lsn), (argp)->prev_lsn, \
100 (argp)->type, (argp)->txnp, (fileid), \
101 &__lv_log_vrfy_proc_step)) != 0) \
102 goto err; \
103 if (__lv_log_vrfy_proc_step == 1) \
104 goto out; \
105 else if (__lv_log_vrfy_proc_step == -1) \
106 goto err; \
107 else \
108 DB_ASSERT(lvh->dbenv->env, \
109 __lv_log_vrfy_proc_step == 0); \
110 } while (0)
111
112 /* Log record handlers used by log types involving page updates. */
113 #define ON_PAGE_UPDATE(lvh, lsn, argp, pgno) do { \
114 int __lv_onpgupdate_res; \
115 if ((ret = __lv_on_page_update((lvh), (lsn), (argp)->fileid, \
116 (pgno), (argp)->txnp, &__lv_onpgupdate_res)) != 0) \
117 goto err; \
118 if (__lv_onpgupdate_res == 1) \
119 goto out; \
120 else if (__lv_onpgupdate_res == -1) \
121 goto err; \
122 else \
123 DB_ASSERT(lvh->dbenv->env, __lv_onpgupdate_res == 0); \
124 } while (0)
125
126 static int
__lv_on_page_update(lvh,lsn,fileid,pgno,txnp,step)127 __lv_on_page_update(lvh, lsn, fileid, pgno, txnp, step)
128 DB_LOG_VRFY_INFO *lvh;
129 DB_LSN lsn;
130 int32_t fileid;
131 db_pgno_t pgno;
132 DB_TXN *txnp;
133 int *step;
134 {
135 u_int32_t otxn, txnid;
136 int res, ret;
137
138 txnid = txnp->txnid;
139 res = ret = 0;
140
141 if ((ret = __add_page_to_txn(lvh, fileid, pgno,
142 txnid, &otxn, &res)) != 0)
143 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
144 if (res != -1) {/* No access violation, we are done. */
145 *step = 0;
146 goto out;
147 }
148 /*
149 * It's OK for a child txn to update its parent's page, but not OK
150 * for a parent txn to update its active child's pages. We can't
151 * detect the child's abort, so we may false alarm that a parent txn
152 * is updating its child's pages.
153 */
154 if ((ret = __is_ancestor_txn(lvh, otxn, txnid, lsn, &res)) != 0)
155 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
156 if (res) {/* The txnid is updating its parent otxn's pages. */
157 *step = 0;
158 goto out;
159 }
160 if ((ret = __is_ancestor_txn(lvh, txnid, otxn, lsn, &res)) != 0)
161 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
162 if (res) {/* The txnid is updating its active child otxn's pages. */
163 __db_errx(lvh->dbenv->env, DB_STR_A("2537",
164 "[%lu][%lu] [WARNING] Parent txn %lx is updating its "
165 "active child txn %lx's pages, or %lx aborted.",
166 "%lu %lu %lx %lx %lx"), (u_long)lsn.file,
167 (u_long)lsn.offset, (u_long)txnid,
168 (u_long)otxn, (u_long)otxn);
169 *step = 0;
170 goto out;
171 }
172 /*
173 * It's likely that the two txns are parent-child and the child
174 * aborted, but from the log we can't figure out this fact.
175 */
176 __db_errx(lvh->dbenv->env, DB_STR_A("2538",
177 "[%lu][%lu] [WARNING] Txn %lx is updating txn %lx's pages.",
178 "%lu %lu %lx %lx"), (u_long)lsn.file, (u_long)lsn.offset,
179 (u_long)txnid, (u_long)otxn);
180 *step = 0;
181 out:
182 err:
183 return (ret);
184 }
185
186 /*
187 * This macro is put in all types of verify functions where a db file is
188 * updated, but no page number/lock involved.
189 */
190 #define ON_PAGE_UPDATE4
191
192 /*
193 * General log record handler used by all log verify functions.
194 */
195 static int
__log_vrfy_proc(lvh,lsn,prev_lsn,type,txnp,fileid,step)196 __log_vrfy_proc(lvh, lsn, prev_lsn, type, txnp, fileid, step)
197 DB_LOG_VRFY_INFO *lvh;
198 DB_LSN lsn, prev_lsn;
199 u_int32_t type; /* Log record type. */
200 DB_TXN *txnp;
201 int32_t fileid;
202 int *step;
203 {
204 int dovrfy, ret;
205
206 dovrfy = 1;
207 ret = 0;
208 /*
209 * step is used to tell if go on with the rest of the caller, or
210 * goto err/out.
211 * 0: go on after this function; 1: goto out; -1: goto err.
212 */
213 *step = 0;
214
215 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
216 /* Commits are not abort/beginnings. */
217 if (NOTCOMMIT(type) && ((ret = __lv_log_fwdscr_onrec(
218 lvh, txnp->txnid, type, prev_lsn, lsn)) != 0))
219 goto err;
220 if (SKIP_FORWARD_CHK(type))
221 goto out;
222 } else {/* Verifying */
223 if (F_ISSET(lvh, DB_LOG_VERIFY_VERBOSE))
224 __db_errx(lvh->dbenv->env, DB_STR_A("2539",
225 "[%lu][%lu] Verifying log record of type %s",
226 "%lu %lu %s"), (u_long)lsn.file,
227 (u_long)lsn.offset, LOGTYPE_NAME(lvh, type));
228 /*
229 * If verifying a log range and we've passed the initial part
230 * which may have partial txns, remove the PARTIAL bit.
231 */
232 if (F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL) &&
233 LOG_COMPARE(&lsn, &(lvh->valid_lsn)) >= 0) {
234 lvh->valid_lsn.offset = lvh->valid_lsn.file = 0;
235 F_CLR(lvh, DB_LOG_VERIFY_PARTIAL);
236 }
237
238 if ((ret = __lv_new_logfile_vrfy(lvh, &lsn)) != 0)
239 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
240 /* If only verify a db file, ignore logs about other dbs. */
241 if (F_ISSET(lvh, DB_LOG_VERIFY_DBFILE) && fileid !=
242 INVAL_DBREGID && (ret = __lv_vrfy_for_dbfile(lvh,
243 fileid, &dovrfy)) != 0)
244 goto err;
245 if (!dovrfy)
246 goto out;
247 if (lvh->aborted_txnid != 0 &&
248 ((ret = __lv_on_txn_aborted(lvh)) != 0))
249 goto err;
250 if ((ret = __get_aborttxn(lvh, lsn)) != 0)
251 goto err;
252 if (txnp->txnid >= TXN_MINIMUM) {
253 if ((ret = __lv_on_txn_logrec(lvh, &lsn, &(prev_lsn),
254 txnp, type, fileid)) != 0)
255 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
256 } else {/* Non-txnal updates. */
257 if ((ret = __lv_on_nontxn_update(lvh, &lsn,
258 txnp->txnid, type, fileid)) != 0)
259 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
260 }
261 }
262 if (0) {
263 out:
264 *step = 1;
265 }
266 if (0) {
267 err:
268 *step = -1;
269 }
270 return (ret);
271 }
272
273 /* Log record handlers used by log types for each access method. */
274 static int
__lv_on_bam_log(lvh,lsn,fileid)275 __lv_on_bam_log(lvh, lsn, fileid)
276 DB_LOG_VRFY_INFO *lvh;
277 DB_LSN lsn;
278 int32_t fileid;
279 {
280 int ret;
281 DBTYPE dbtype;
282 if ((ret = __lv_dbregid_to_dbtype(lvh, fileid, &dbtype)) == 0 &&
283 dbtype != DB_BTREE && dbtype != DB_RECNO && dbtype != DB_HASH)
284 ret = __lv_log_mismatch(lvh, lsn, dbtype, DB_BTREE);
285 if (ret == DB_NOTFOUND && F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
286 ret = 0;
287 return (ret);
288 }
289
290 static int
__lv_on_ham_log(lvh,lsn,fileid)291 __lv_on_ham_log(lvh, lsn, fileid)
292 DB_LOG_VRFY_INFO *lvh;
293 DB_LSN lsn;
294 int32_t fileid;
295 {
296 int ret;
297 DBTYPE dbtype;
298 if ((ret = __lv_dbregid_to_dbtype(lvh, fileid, &dbtype)) == 0 &&
299 dbtype != DB_HASH)
300 ret = __lv_log_mismatch(lvh, lsn, dbtype, DB_HASH);
301 if (ret == DB_NOTFOUND && F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
302 ret = 0;
303 return (ret);
304 }
305
306 static int
__lv_on_heap_log(lvh,lsn,fileid)307 __lv_on_heap_log(lvh, lsn, fileid)
308 DB_LOG_VRFY_INFO *lvh;
309 DB_LSN lsn;
310 int32_t fileid;
311 {
312 int ret;
313 DBTYPE dbtype;
314 if ((ret = __lv_dbregid_to_dbtype(lvh, fileid, &dbtype)) == 0 &&
315 dbtype != DB_HEAP)
316 ret = __lv_log_mismatch(lvh, lsn, dbtype, DB_HEAP);
317 if (ret == DB_NOTFOUND && F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
318 ret = 0;
319 return (ret);
320 }
321
322 static int
__lv_on_qam_log(lvh,lsn,fileid)323 __lv_on_qam_log(lvh, lsn, fileid)
324 DB_LOG_VRFY_INFO *lvh;
325 DB_LSN lsn;
326 int32_t fileid;
327 {
328 int ret;
329 DBTYPE dbtype;
330 if ((ret = __lv_dbregid_to_dbtype(lvh, fileid, &dbtype)) == 0 &&
331 dbtype != DB_QUEUE)
332 ret = __lv_log_mismatch(lvh, lsn, dbtype, DB_QUEUE);
333 if (ret == DB_NOTFOUND && F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
334 ret = 0;
335 return (ret);
336 }
337
338 /* Catch commits and store into lvinfo->txnrngs database. */
339 static int
__lv_log_fwdscr_oncmt(lvinfo,lsn,txnid,ptxnid,timestamp)340 __lv_log_fwdscr_oncmt(lvinfo, lsn, txnid, ptxnid, timestamp)
341 DB_LOG_VRFY_INFO *lvinfo;
342 DB_LSN lsn;
343 u_int32_t txnid, ptxnid;
344 int32_t timestamp;
345 {
346 int ret;
347 struct __lv_txnrange tr;
348 DBT key, data;
349
350 memset(&tr, 0, sizeof(tr));
351 memset(&key, 0, sizeof(DBT));
352 memset(&data, 0, sizeof(DBT));
353 tr.txnid = txnid;
354 tr.end = lsn;
355 tr.when_commit = timestamp;
356 tr.ptxnid = ptxnid;
357 key.data = &(txnid);
358 key.size = sizeof(txnid);
359 data.data = &tr;
360 data.size = sizeof(tr);
361 if ((ret = __db_put(lvinfo->txnrngs, lvinfo->ip, NULL,
362 &key, &data, 0)) != 0)
363 goto err;
364 err:
365 return (ret);
366 }
367
368 /* Catch aborts and txn beginnings and store into lvinfo->txnrngs database. */
369 static int
__lv_log_fwdscr_onrec(lvinfo,txnid,lrtype,prevlsn,lsn)370 __lv_log_fwdscr_onrec(lvinfo, txnid, lrtype, prevlsn, lsn)
371 DB_LOG_VRFY_INFO *lvinfo;
372 u_int32_t txnid, lrtype;
373 DB_LSN prevlsn, lsn;
374 {
375 int doput, ret, ret2, tret;
376 u_int32_t putflag;
377 struct __lv_txnrange tr, *ptr;
378 DBC *csr;
379 DBT key, key2, data, data2;
380
381 /* Ignore non-txnal log records. */
382 if (txnid < TXN_MINIMUM)
383 return (0);
384
385 /* Not used for now, but may be used later. Pass lint checks. */
386 COMPQUIET(lrtype ,0);
387 putflag = 0;
388 doput = ret = ret2 = 0;
389 csr = NULL;
390 memset(&tr, 0, sizeof(tr));
391 memset(&key, 0, sizeof(DBT));
392 memset(&data, 0, sizeof(DBT));
393 memset(&key2, 0, sizeof(DBT));
394 memset(&data2, 0, sizeof(DBT));
395 key.data = &txnid;
396 key.size = sizeof(txnid);
397 tr.txnid = txnid;
398 tr.when_commit = 0;/* This is not a __txn_regop record. */
399
400 if ((ret = __db_cursor(lvinfo->txnrngs, lvinfo->ip,
401 NULL, &csr, 0)) != 0)
402 goto err;
403 /*
404 * If the txnid is first seen here or reused later, it's aborted
405 * after this log record; if this log record is the 1st one of a txn,
406 * we have the beginning of the txn; otherwise the log record is one
407 * of the actions taken within the txn, and we don't do anything.
408 */
409 if ((ret = __dbc_get(csr, &key, &data, DB_SET)) != 0 &&
410 ret != DB_NOTFOUND)
411 goto err;
412
413 ptr = (struct __lv_txnrange *)data.data;
414 if (ret == DB_NOTFOUND || !IS_ZERO_LSN(ptr->begin)) {
415 tr.end = lsn;
416 data.data = &tr;
417 data.size = sizeof(tr);
418 doput = 1;
419 key2.data = &lsn;
420 key2.size = sizeof(lsn);
421 data2.data = &(tr.txnid);
422 data2.size = sizeof(tr.txnid);
423 putflag = DB_KEYFIRST;
424 if ((ret2 = __db_put(lvinfo->txnaborts, lvinfo->ip, NULL,
425 &key2, &data2, 0)) != 0) {
426 ret = ret2;
427 goto err;
428 }
429 } else if (ret == 0 && IS_ZERO_LSN(prevlsn)) {/* The beginning of txn.*/
430 /* The begin field must be [0, 0]. */
431 DB_ASSERT(lvinfo->dbenv->env, IS_ZERO_LSN(ptr->begin));
432 ptr->begin = lsn;
433 putflag = DB_CURRENT;
434 doput = 1;
435 }
436
437 if (doput && (ret = __dbc_put(csr, &key, &data, putflag)) != 0)
438 goto err;
439 err:
440 if (csr != NULL && (tret = __dbc_close(csr)) != 0 && ret == 0)
441 ret = tret;
442
443 return (ret);
444 }
445
446 /*
447 * Return 0 from dovrfy if verifying logs for a specified db file, and fileid
448 * is not the one we want; Otherwise return 1 from dovrfy. If DB operations
449 * failed, the error is returned.
450 */
451 static int
__lv_vrfy_for_dbfile(lvh,fileid,dovrfy)452 __lv_vrfy_for_dbfile(lvh, fileid, dovrfy)
453 DB_LOG_VRFY_INFO *lvh;
454 int32_t fileid;
455 int *dovrfy;
456 {
457 u_int8_t tmpuid[DB_FILE_ID_LEN];
458 VRFY_FILEREG_INFO *fregp;
459 u_int32_t i;
460 int ret, tret;
461 DBT tgtkey;
462
463 ret = tret = 0;
464 *dovrfy = 0;
465 fregp = NULL;
466 memset(tmpuid, 0, sizeof(u_int8_t) * DB_FILE_ID_LEN);
467 memset(&tgtkey, 0, sizeof(tgtkey));
468 tgtkey.data = lvh->target_dbid;
469 tgtkey.size = DB_FILE_ID_LEN;
470 ret = __get_filereg_info(lvh, &tgtkey, &fregp);
471
472 /*
473 * If the target db file is not seen yet, we don't verify any file,
474 * and it does not mean anything wrong.
475 */
476 if (ret == DB_NOTFOUND) {
477 ret = 0;
478 goto out;
479 }
480 if (ret != 0)
481 goto err;
482
483 for (i = 0; i < fregp->regcnt; i++)
484 if (fregp->dbregids[i] == fileid) {
485 *dovrfy = 1;
486 goto out;
487 }
488 out:
489 err:
490 if (fregp != NULL &&
491 (tret = __free_filereg_info(fregp)) != 0 && ret == 0)
492 ret = tret;
493
494 return (ret);
495 }
496
497 static int
__lv_log_mismatch(lvh,lsn,dbtype,exp_dbtype)498 __lv_log_mismatch(lvh, lsn, dbtype, exp_dbtype)
499 DB_LOG_VRFY_INFO *lvh;
500 DB_LSN lsn;
501 DBTYPE dbtype, exp_dbtype;
502 {
503 int ret;
504
505 __db_errx(lvh->dbenv->env, DB_STR_A("2540",
506 "[%lu][%lu] Log record type does not match related database type, "
507 "current database type: %s, expected database type according to "
508 "the log record type: %s.", "%lu %lu %s %s"),
509 (u_long)lsn.file, (u_long)lsn.offset, __lv_dbtype_str(dbtype),
510 __lv_dbtype_str(exp_dbtype));
511 ret = DB_LOG_VERIFY_BAD;
512 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
513 err:
514 return (ret);
515 }
516
517 static int
__lv_dbregid_to_dbtype(lvh,id,ptype)518 __lv_dbregid_to_dbtype(lvh, id, ptype)
519 DB_LOG_VRFY_INFO *lvh;
520 int32_t id;
521 DBTYPE *ptype;
522 {
523 int ret;
524 VRFY_FILELIFE *pflife;
525
526 ret = 0;
527 pflife = NULL;
528
529 if ((ret = __get_filelife(lvh, id, &pflife)) != 0)
530 goto err;
531 *ptype = pflife->dbtype;
532 err:
533 if (pflife != NULL)
534 __os_free(lvh->dbenv->env, pflife);
535
536 return (ret);
537 }
538
539 /*
540 * __db_log_verify_global_report --
541 * Report statistics data in DB_LOG_VRFY_INFO handle.
542 *
543 * PUBLIC: void __db_log_verify_global_report __P((const DB_LOG_VRFY_INFO *));
544 */
__db_log_verify_global_report(lvinfo)545 void __db_log_verify_global_report (lvinfo)
546 const DB_LOG_VRFY_INFO *lvinfo;
547 {
548 u_int32_t i, nltype;
549
550 __db_msg(lvinfo->dbenv->env,
551 "Number of active transactions: %u;", lvinfo->ntxn_active);
552 __db_msg(lvinfo->dbenv->env,
553 "Number of committed transactions: %u;", lvinfo->ntxn_commit);
554 __db_msg(lvinfo->dbenv->env,
555 "Number of aborted transactions: %u;", lvinfo->ntxn_abort);
556 __db_msg(lvinfo->dbenv->env,
557 "Number of prepared transactions: %u;", lvinfo->ntxn_prep);
558 __db_msg(lvinfo->dbenv->env,
559 "Total number of checkpoint: %u;", lvinfo->nckp);
560 __db_msg(lvinfo->dbenv->env,
561 "Total number of non-transactional updates: %u;",
562 lvinfo->non_txnup_cnt);
563 __db_msg(lvinfo->dbenv->env,
564 "Total number of unknown log records: %u;",
565 lvinfo->unknown_logrec_cnt);
566 __db_msg(lvinfo->dbenv->env,
567 "Total number of app-specific log record: %u;",
568 lvinfo->external_logrec_cnt);
569 __db_msg(lvinfo->dbenv->env,
570 "The number of each type of log record:");
571
572 for (i = 0; i < 256; i++) {
573 nltype = lvinfo->lrtypes[i];
574 if (LOGTYPE_NAME(lvinfo, i) != NULL)
575 __db_msg(lvinfo->dbenv->env, "\n\t%s : %u;",
576 LOGTYPE_NAME(lvinfo, i), nltype);
577 }
578 }
579
580 /*
581 * PUBLIC: int __crdel_metasub_verify __P((ENV *, DBT *, DB_LSN *,
582 * PUBLIC: db_recops, void *));
583 */
584 int
__crdel_metasub_verify(env,dbtp,lsnp,notused2,lvhp)585 __crdel_metasub_verify(env, dbtp, lsnp, notused2, lvhp)
586 ENV *env;
587 DBT *dbtp;
588 DB_LSN *lsnp;
589 db_recops notused2;
590 void *lvhp;
591 {
592 __crdel_metasub_args *argp;
593 DB_LOG_VRFY_INFO *lvh;
594 int ret;
595
596 notused2 = DB_TXN_LOG_VERIFY;
597 lvh = (DB_LOG_VRFY_INFO *)lvhp;
598
599 if ((ret =
600 __crdel_metasub_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
601 return (ret);
602
603 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
604 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
605
606 out:
607
608 err:
609
610 __os_free(env, argp);
611
612 return (ret);
613 }
614
615 /*
616 * PUBLIC: int __crdel_inmem_create_verify __P((ENV *, DBT *,
617 * PUBLIC: DB_LSN *, db_recops, void *));
618 */
619 int
__crdel_inmem_create_verify(env,dbtp,lsnp,notused2,lvhp)620 __crdel_inmem_create_verify(env, dbtp, lsnp, notused2, lvhp)
621 ENV *env;
622 DBT *dbtp;
623 DB_LSN *lsnp;
624 db_recops notused2;
625 void *lvhp;
626 {
627 __crdel_inmem_create_args *argp;
628 DB_LOG_VRFY_INFO *lvh;
629 int ret;
630
631 notused2 = DB_TXN_LOG_VERIFY;
632 lvh = (DB_LOG_VRFY_INFO *)lvhp;
633
634 if ((ret = __crdel_inmem_create_read(env, dbtp->data, &argp)) != 0)
635 return (ret);
636
637 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
638
639 out:
640
641 err:
642
643 __os_free(env, argp);
644
645 return (ret);
646 }
647
648 /*
649 * PUBLIC: int __crdel_inmem_rename_verify __P((ENV *, DBT *,
650 * PUBLIC: DB_LSN *, db_recops, void *));
651 */
652 int
__crdel_inmem_rename_verify(env,dbtp,lsnp,notused2,lvhp)653 __crdel_inmem_rename_verify(env, dbtp, lsnp, notused2, lvhp)
654 ENV *env;
655 DBT *dbtp;
656 DB_LSN *lsnp;
657 db_recops notused2;
658 void *lvhp;
659 {
660 __crdel_inmem_rename_args *argp;
661 DB_LOG_VRFY_INFO *lvh;
662 int ret;
663
664 notused2 = DB_TXN_LOG_VERIFY;
665 lvh = (DB_LOG_VRFY_INFO *)lvhp;
666
667 if ((ret = __crdel_inmem_rename_read(env, dbtp->data, &argp)) != 0)
668 return (ret);
669
670 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
671
672 out:
673
674 err:
675
676 __os_free(env, argp);
677
678 return (ret);
679 }
680
681 /*
682 * PUBLIC: int __crdel_inmem_remove_verify __P((ENV *, DBT *,
683 * PUBLIC: DB_LSN *, db_recops, void *));
684 */
685 int
__crdel_inmem_remove_verify(env,dbtp,lsnp,notused2,lvhp)686 __crdel_inmem_remove_verify(env, dbtp, lsnp, notused2, lvhp)
687 ENV *env;
688 DBT *dbtp;
689 DB_LSN *lsnp;
690 db_recops notused2;
691 void *lvhp;
692 {
693 __crdel_inmem_remove_args *argp;
694 DB_LOG_VRFY_INFO *lvh;
695 int ret;
696
697 notused2 = DB_TXN_LOG_VERIFY;
698 lvh = (DB_LOG_VRFY_INFO *)lvhp;
699
700 if ((ret = __crdel_inmem_remove_read(env, dbtp->data, &argp)) != 0)
701 return (ret);
702
703 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
704
705 out:
706
707 err:
708
709 __os_free(env, argp);
710
711 return (ret);
712 }
713
714 /*
715 * PUBLIC: int __db_addrem_verify __P((ENV *, DBT *, DB_LSN *,
716 * PUBLIC: db_recops, void *));
717 */
718 int
__db_addrem_verify(env,dbtp,lsnp,notused2,lvhp)719 __db_addrem_verify(env, dbtp, lsnp, notused2, lvhp)
720 ENV *env;
721 DBT *dbtp;
722 DB_LSN *lsnp;
723 db_recops notused2;
724 void *lvhp;
725 {
726 __db_addrem_args *argp;
727 DB_LOG_VRFY_INFO *lvh;
728 int ret;
729
730 notused2 = DB_TXN_LOG_VERIFY;
731 lvh = (DB_LOG_VRFY_INFO *)lvhp;
732
733 if ((ret =
734 __db_addrem_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
735 return (ret);
736
737 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
738 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
739
740 out:
741
742 err:
743
744 __os_free(env, argp);
745
746 return (ret);
747 }
748
749 /*
750 * PUBLIC: int __db_big_verify __P((ENV *, DBT *, DB_LSN *,
751 * PUBLIC: db_recops, void *));
752 */
753 int
__db_big_verify(env,dbtp,lsnp,notused2,lvhp)754 __db_big_verify(env, dbtp, lsnp, notused2, lvhp)
755 ENV *env;
756 DBT *dbtp;
757 DB_LSN *lsnp;
758 db_recops notused2;
759 void *lvhp;
760 {
761 __db_big_args *argp;
762 DB_LOG_VRFY_INFO *lvh;
763 int ret;
764
765 notused2 = DB_TXN_LOG_VERIFY;
766 lvh = (DB_LOG_VRFY_INFO *)lvhp;
767
768 if ((ret =
769 __db_big_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
770 return (ret);
771
772 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
773 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
774
775 out:
776
777 err:
778
779 __os_free(env, argp);
780
781 return (ret);
782 }
783
784 /*
785 * PUBLIC: int __db_ovref_verify __P((ENV *, DBT *, DB_LSN *,
786 * PUBLIC: db_recops, void *));
787 */
788 int
__db_ovref_verify(env,dbtp,lsnp,notused2,lvhp)789 __db_ovref_verify(env, dbtp, lsnp, notused2, lvhp)
790 ENV *env;
791 DBT *dbtp;
792 DB_LSN *lsnp;
793 db_recops notused2;
794 void *lvhp;
795 {
796 __db_ovref_args *argp;
797 DB_LOG_VRFY_INFO *lvh;
798 int ret;
799
800 notused2 = DB_TXN_LOG_VERIFY;
801 lvh = (DB_LOG_VRFY_INFO *)lvhp;
802
803 if ((ret =
804 __db_ovref_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
805 return (ret);
806
807 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
808 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
809
810 out:
811
812 err:
813
814 __os_free(env, argp);
815
816 return (ret);
817 }
818
819 /*
820 * PUBLIC: int __db_relink_42_verify __P((ENV *, DBT *, DB_LSN *,
821 * PUBLIC: db_recops, void *));
822 */
823 int
__db_relink_42_verify(env,dbtp,lsnp,notused2,lvhp)824 __db_relink_42_verify(env, dbtp, lsnp, notused2, lvhp)
825 ENV *env;
826 DBT *dbtp;
827 DB_LSN *lsnp;
828 db_recops notused2;
829 void *lvhp;
830 {
831 __db_relink_42_args *argp;
832 DB_LOG_VRFY_INFO *lvh;
833 int ret;
834
835 notused2 = DB_TXN_LOG_VERIFY;
836 lvh = (DB_LOG_VRFY_INFO *)lvhp;
837
838 if ((ret =
839 __db_relink_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
840 return (ret);
841
842 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
843 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
844 err:
845
846 __os_free(env, argp);
847
848 return (ret);
849 }
850
851 /*
852 * PUBLIC: int __db_debug_verify __P((ENV *, DBT *, DB_LSN *,
853 * PUBLIC: db_recops, void *));
854 */
855 int
__db_debug_verify(env,dbtp,lsnp,notused2,lvhp)856 __db_debug_verify(env, dbtp, lsnp, notused2, lvhp)
857 ENV *env;
858 DBT *dbtp;
859 DB_LSN *lsnp;
860 db_recops notused2;
861 void *lvhp;
862 {
863 __db_debug_args *argp;
864 DB_LOG_VRFY_INFO *lvh;
865 int ret;
866
867 notused2 = DB_TXN_LOG_VERIFY;
868 lvh = (DB_LOG_VRFY_INFO *)lvhp;
869
870 if ((ret = __db_debug_read(env, dbtp->data, &argp)) != 0)
871 return (ret);
872
873 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
874
875 out:
876
877 err:
878
879 __os_free(env, argp);
880
881 return (ret);
882 }
883
884 /*
885 * PUBLIC: int __db_noop_verify __P((ENV *, DBT *, DB_LSN *,
886 * PUBLIC: db_recops, void *));
887 */
888 int
__db_noop_verify(env,dbtp,lsnp,notused2,lvhp)889 __db_noop_verify(env, dbtp, lsnp, notused2, lvhp)
890 ENV *env;
891 DBT *dbtp;
892 DB_LSN *lsnp;
893 db_recops notused2;
894 void *lvhp;
895 {
896 __db_noop_args *argp;
897 DB_LOG_VRFY_INFO *lvh;
898 int ret;
899
900 notused2 = DB_TXN_LOG_VERIFY;
901 lvh = (DB_LOG_VRFY_INFO *)lvhp;
902
903 if ((ret =
904 __db_noop_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
905 return (ret);
906
907 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
908
909 out:
910
911 err:
912
913 __os_free(env, argp);
914
915 return (ret);
916 }
917
918 /*
919 * PUBLIC: int __db_pg_alloc_42_verify __P((ENV *, DBT *, DB_LSN *,
920 * PUBLIC: db_recops, void *));
921 */
922 int
__db_pg_alloc_42_verify(env,dbtp,lsnp,notused2,lvhp)923 __db_pg_alloc_42_verify(env, dbtp, lsnp, notused2, lvhp)
924 ENV *env;
925 DBT *dbtp;
926 DB_LSN *lsnp;
927 db_recops notused2;
928 void *lvhp;
929 {
930 __db_pg_alloc_42_args *argp;
931 DB_LOG_VRFY_INFO *lvh;
932 int ret;
933
934 notused2 = DB_TXN_LOG_VERIFY;
935 lvh = (DB_LOG_VRFY_INFO *)lvhp;
936
937 if ((ret =
938 __db_pg_alloc_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
939 return (ret);
940
941 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
942 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
943 err:
944
945 __os_free(env, argp);
946
947 return (ret);
948 }
949
950 /*
951 * PUBLIC: int __db_pg_alloc_verify __P((ENV *, DBT *, DB_LSN *,
952 * PUBLIC: db_recops, void *));
953 */
954 int
__db_pg_alloc_verify(env,dbtp,lsnp,notused2,lvhp)955 __db_pg_alloc_verify(env, dbtp, lsnp, notused2, lvhp)
956 ENV *env;
957 DBT *dbtp;
958 DB_LSN *lsnp;
959 db_recops notused2;
960 void *lvhp;
961 {
962 __db_pg_alloc_args *argp;
963 DB_LOG_VRFY_INFO *lvh;
964 int ret;
965
966 notused2 = DB_TXN_LOG_VERIFY;
967 lvh = (DB_LOG_VRFY_INFO *)lvhp;
968
969 if ((ret =
970 __db_pg_alloc_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
971 return (ret);
972
973 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
974 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
975
976 out:
977
978 err:
979
980 __os_free(env, argp);
981
982 return (ret);
983 }
984
985 /*
986 * PUBLIC: int __db_pg_free_42_verify __P((ENV *, DBT *, DB_LSN *,
987 * PUBLIC: db_recops, void *));
988 */
989 int
__db_pg_free_42_verify(env,dbtp,lsnp,notused2,lvhp)990 __db_pg_free_42_verify(env, dbtp, lsnp, notused2, lvhp)
991 ENV *env;
992 DBT *dbtp;
993 DB_LSN *lsnp;
994 db_recops notused2;
995 void *lvhp;
996 {
997 __db_pg_free_42_args *argp;
998 DB_LOG_VRFY_INFO *lvh;
999 int ret;
1000
1001 notused2 = DB_TXN_LOG_VERIFY;
1002 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1003
1004 if ((ret =
1005 __db_pg_free_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1006 return (ret);
1007
1008 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
1009 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
1010 err:
1011
1012 __os_free(env, argp);
1013
1014 return (ret);
1015 }
1016
1017 /*
1018 * PUBLIC: int __db_pg_free_verify __P((ENV *, DBT *, DB_LSN *,
1019 * PUBLIC: db_recops, void *));
1020 */
1021 int
__db_pg_free_verify(env,dbtp,lsnp,notused2,lvhp)1022 __db_pg_free_verify(env, dbtp, lsnp, notused2, lvhp)
1023 ENV *env;
1024 DBT *dbtp;
1025 DB_LSN *lsnp;
1026 db_recops notused2;
1027 void *lvhp;
1028 {
1029 __db_pg_free_args *argp;
1030 DB_LOG_VRFY_INFO *lvh;
1031 int ret;
1032
1033 notused2 = DB_TXN_LOG_VERIFY;
1034 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1035
1036 if ((ret =
1037 __db_pg_free_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1038 return (ret);
1039
1040 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1041 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1042
1043 out:
1044
1045 err:
1046
1047 __os_free(env, argp);
1048
1049 return (ret);
1050 }
1051
1052 /*
1053 * PUBLIC: int __db_cksum_verify __P((ENV *, DBT *, DB_LSN *,
1054 * PUBLIC: db_recops, void *));
1055 */
1056 int
__db_cksum_verify(env,dbtp,lsnp,notused2,lvhp)1057 __db_cksum_verify(env, dbtp, lsnp, notused2, lvhp)
1058 ENV *env;
1059 DBT *dbtp;
1060 DB_LSN *lsnp;
1061 db_recops notused2;
1062 void *lvhp;
1063 {
1064 __db_cksum_args *argp;
1065 DB_LOG_VRFY_INFO *lvh;
1066 int ret;
1067
1068 notused2 = DB_TXN_LOG_VERIFY;
1069 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1070
1071 if ((ret = __db_cksum_read(env, dbtp->data, &argp)) != 0)
1072 return (ret);
1073
1074 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
1075
1076 out:
1077
1078 err:
1079
1080 __os_free(env, argp);
1081
1082 return (ret);
1083 }
1084
1085 /*
1086 * PUBLIC: int __db_pg_freedata_42_verify __P((ENV *, DBT *,
1087 * PUBLIC: DB_LSN *, db_recops, void *));
1088 */
1089 int
__db_pg_freedata_42_verify(env,dbtp,lsnp,notused2,lvhp)1090 __db_pg_freedata_42_verify(env, dbtp, lsnp, notused2, lvhp)
1091 ENV *env;
1092 DBT *dbtp;
1093 DB_LSN *lsnp;
1094 db_recops notused2;
1095 void *lvhp;
1096 {
1097 __db_pg_freedata_42_args *argp;
1098 DB_LOG_VRFY_INFO *lvh;
1099 int ret;
1100
1101 notused2 = DB_TXN_LOG_VERIFY;
1102 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1103
1104 if ((ret =
1105 __db_pg_freedata_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1106 return (ret);
1107
1108 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
1109 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
1110 err:
1111
1112 __os_free(env, argp);
1113
1114 return (ret);
1115 }
1116
1117 /*
1118 * PUBLIC: int __db_pg_freedata_verify __P((ENV *, DBT *, DB_LSN *,
1119 * PUBLIC: db_recops, void *));
1120 */
1121 int
__db_pg_freedata_verify(env,dbtp,lsnp,notused2,lvhp)1122 __db_pg_freedata_verify(env, dbtp, lsnp, notused2, lvhp)
1123 ENV *env;
1124 DBT *dbtp;
1125 DB_LSN *lsnp;
1126 db_recops notused2;
1127 void *lvhp;
1128 {
1129 __db_pg_freedata_args *argp;
1130 DB_LOG_VRFY_INFO *lvh;
1131 int ret;
1132
1133 notused2 = DB_TXN_LOG_VERIFY;
1134 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1135
1136 if ((ret =
1137 __db_pg_freedata_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1138 return (ret);
1139
1140 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1141 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1142
1143 out:
1144
1145 err:
1146
1147 __os_free(env, argp);
1148
1149 return (ret);
1150 }
1151
1152 /*
1153 * PUBLIC: int __db_pg_init_verify __P((ENV *, DBT *, DB_LSN *,
1154 * PUBLIC: db_recops, void *));
1155 */
1156 int
__db_pg_init_verify(env,dbtp,lsnp,notused2,lvhp)1157 __db_pg_init_verify(env, dbtp, lsnp, notused2, lvhp)
1158 ENV *env;
1159 DBT *dbtp;
1160 DB_LSN *lsnp;
1161 db_recops notused2;
1162 void *lvhp;
1163 {
1164 __db_pg_init_args *argp;
1165 DB_LOG_VRFY_INFO *lvh;
1166 int ret;
1167
1168 notused2 = DB_TXN_LOG_VERIFY;
1169 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1170
1171 if ((ret =
1172 __db_pg_init_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1173 return (ret);
1174
1175 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1176 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1177
1178 out:
1179
1180 err:
1181
1182 __os_free(env, argp);
1183
1184 return (ret);
1185 }
1186
1187 /*
1188 * PUBLIC: int __db_pg_sort_44_verify __P((ENV *, DBT *, DB_LSN *,
1189 * PUBLIC: db_recops, void *));
1190 */
1191 int
__db_pg_sort_44_verify(env,dbtp,lsnp,notused2,lvhp)1192 __db_pg_sort_44_verify(env, dbtp, lsnp, notused2, lvhp)
1193 ENV *env;
1194 DBT *dbtp;
1195 DB_LSN *lsnp;
1196 db_recops notused2;
1197 void *lvhp;
1198 {
1199 __db_pg_sort_44_args *argp;
1200 DB_LOG_VRFY_INFO *lvh;
1201 int ret;
1202
1203 notused2 = DB_TXN_LOG_VERIFY;
1204 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1205
1206 if ((ret =
1207 __db_pg_sort_44_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1208 return (ret);
1209
1210 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
1211 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
1212 err:
1213
1214 __os_free(env, argp);
1215
1216 return (ret);
1217 }
1218
1219 /*
1220 * PUBLIC: int __db_pg_trunc_verify __P((ENV *, DBT *, DB_LSN *,
1221 * PUBLIC: db_recops, void *));
1222 */
1223 int
__db_pg_trunc_verify(env,dbtp,lsnp,notused2,lvhp)1224 __db_pg_trunc_verify(env, dbtp, lsnp, notused2, lvhp)
1225 ENV *env;
1226 DBT *dbtp;
1227 DB_LSN *lsnp;
1228 db_recops notused2;
1229 void *lvhp;
1230 {
1231 __db_pg_trunc_args *argp;
1232 DB_LOG_VRFY_INFO *lvh;
1233 int ret;
1234
1235 notused2 = DB_TXN_LOG_VERIFY;
1236 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1237
1238 if ((ret =
1239 __db_pg_trunc_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1240 return (ret);
1241
1242 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1243 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
1244 out:
1245 err:
1246 __os_free(env, argp);
1247
1248 return (ret);
1249 }
1250
1251 /*
1252 * PUBLIC: int __db_realloc_verify __P((ENV *, DBT *, DB_LSN *,
1253 * PUBLIC: db_recops, void *));
1254 */
1255 int
__db_realloc_verify(env,dbtp,lsnp,notused2,lvhp)1256 __db_realloc_verify(env, dbtp, lsnp, notused2, lvhp)
1257 ENV *env;
1258 DBT *dbtp;
1259 DB_LSN *lsnp;
1260 db_recops notused2;
1261 void *lvhp;
1262 {
1263 __db_realloc_args *argp;
1264 DB_LOG_VRFY_INFO *lvh;
1265 int ret;
1266
1267 notused2 = DB_TXN_LOG_VERIFY;
1268 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1269
1270 if ((ret =
1271 __db_realloc_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1272 return (ret);
1273
1274 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1275 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
1276
1277 out:
1278
1279 err:
1280
1281 __os_free(env, argp);
1282
1283 return (ret);
1284 }
1285
1286 /*
1287 * PUBLIC: int __db_relink_verify __P((ENV *, DBT *, DB_LSN *,
1288 * PUBLIC: db_recops, void *));
1289 */
1290 int
__db_relink_verify(env,dbtp,lsnp,notused2,lvhp)1291 __db_relink_verify(env, dbtp, lsnp, notused2, lvhp)
1292 ENV *env;
1293 DBT *dbtp;
1294 DB_LSN *lsnp;
1295 db_recops notused2;
1296 void *lvhp;
1297 {
1298 __db_relink_args *argp;
1299 DB_LOG_VRFY_INFO *lvh;
1300 int ret;
1301
1302 notused2 = DB_TXN_LOG_VERIFY;
1303 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1304
1305 if ((ret =
1306 __db_relink_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1307 return (ret);
1308
1309 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1310 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1311
1312 out:
1313
1314 err:
1315
1316 __os_free(env, argp);
1317
1318 return (ret);
1319 }
1320
1321 /*
1322 * PUBLIC: int __db_merge_verify __P((ENV *, DBT *, DB_LSN *,
1323 * PUBLIC: db_recops, void *));
1324 */
1325 int
__db_merge_verify(env,dbtp,lsnp,notused2,lvhp)1326 __db_merge_verify(env, dbtp, lsnp, notused2, lvhp)
1327 ENV *env;
1328 DBT *dbtp;
1329 DB_LSN *lsnp;
1330 db_recops notused2;
1331 void *lvhp;
1332 {
1333 __db_merge_args *argp;
1334 DB_LOG_VRFY_INFO *lvh;
1335 int ret;
1336
1337 notused2 = DB_TXN_LOG_VERIFY;
1338 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1339
1340 if ((ret =
1341 __db_merge_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1342 return (ret);
1343
1344 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1345 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1346
1347 out:
1348
1349 err:
1350
1351 __os_free(env, argp);
1352
1353 return (ret);
1354 }
1355
1356 /*
1357 * PUBLIC: int __db_pgno_verify __P((ENV *, DBT *, DB_LSN *,
1358 * PUBLIC: db_recops, void *));
1359 */
1360 int
__db_pgno_verify(env,dbtp,lsnp,notused2,lvhp)1361 __db_pgno_verify(env, dbtp, lsnp, notused2, lvhp)
1362 ENV *env;
1363 DBT *dbtp;
1364 DB_LSN *lsnp;
1365 db_recops notused2;
1366 void *lvhp;
1367 {
1368 __db_pgno_args *argp;
1369 DB_LOG_VRFY_INFO *lvh;
1370 int ret;
1371
1372 notused2 = DB_TXN_LOG_VERIFY;
1373 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1374
1375 if ((ret =
1376 __db_pgno_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1377 return (ret);
1378
1379 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1380 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1381
1382 out:
1383
1384 err:
1385
1386 __os_free(env, argp);
1387 return (ret);
1388 }
1389
1390 static const char *
__lv_dbreg_str(op)1391 __lv_dbreg_str(op)
1392 u_int32_t op;
1393 {
1394 const char *p;
1395
1396 switch (op) {
1397 case DBREG_CHKPNT:
1398 p = "DBREG_CHKPNT";
1399 break;
1400 case DBREG_RCLOSE:
1401 p = "DBREG_RCLOSE";
1402 break;
1403 case DBREG_CLOSE:
1404 p = "DBREG_CLOSE";
1405 break;
1406 case DBREG_OPEN:
1407 p = "DBREG_OPEN";
1408 break;
1409 case DBREG_PREOPEN:
1410 p = "DBREG_PREOPEN";
1411 break;
1412 case DBREG_REOPEN:
1413 p = "DBREG_REOPEN";
1414 break;
1415 case DBREG_XCHKPNT:
1416 p = "DBREG_XCHKPNT";
1417 break;
1418 case DBREG_XOPEN:
1419 p = "DBREG_XOPEN";
1420 break;
1421 case DBREG_XREOPEN:
1422 p = "DBREG_XREOPEN";
1423 break;
1424 default:
1425 p = DB_STR_P("Unknown dbreg op code");
1426 break;
1427 }
1428
1429 return (p);
1430 }
1431
1432 static int
__lv_dbt_str(dbt,str)1433 __lv_dbt_str(dbt, str)
1434 const DBT *dbt;
1435 char **str;
1436 {
1437 char *p, *q;
1438 u_int32_t buflen, bufsz, i;
1439 int ret;
1440
1441 ret = 0;
1442 p = q = NULL;
1443 buflen = bufsz = i = 0;
1444 bufsz = sizeof(char) * dbt->size * 2;
1445
1446 if ((ret = __os_malloc(NULL, bufsz, &p)) != 0)
1447 goto err;
1448 q = (char *)dbt->data;
1449
1450 memset(p, 0, bufsz);
1451 /*
1452 * Each unprintable character takes up several bytes, so be ware of
1453 * memory access violation.
1454 */
1455 for (i = 0; i < dbt->size && buflen < bufsz; i++) {
1456 buflen = (u_int32_t)strlen(p);
1457 snprintf(p + buflen, bufsz - (buflen + 1),
1458 isprint(q[i]) || q[i] == 0x0a ? "%c" : "%x", q[i]);
1459 }
1460 *str = p;
1461 err:
1462 return (ret);
1463 }
1464
1465 static const char *
__lv_dbtype_str(dbtype)1466 __lv_dbtype_str(dbtype)
1467 DBTYPE dbtype;
1468 {
1469 char *p;
1470
1471 switch (dbtype) {
1472 case DB_BTREE:
1473 p = "DB_BTREE";
1474 break;
1475 case DB_HASH:
1476 p = "DB_HASH";
1477 break;
1478 case DB_RECNO:
1479 p = "DB_RECNO";
1480 break;
1481 case DB_QUEUE:
1482 p = "DB_QUEUE";
1483 break;
1484 default:
1485 p = DB_STR_P("Unknown db type");
1486 break;
1487 }
1488
1489 return (p);
1490 }
1491
1492 /*
1493 * PUBLIC: int __dbreg_register_verify __P((ENV *, DBT *, DB_LSN *,
1494 * PUBLIC: db_recops, void *));
1495 */
1496 int
__dbreg_register_verify(env,dbtp,lsnp,notused2,lvhp)1497 __dbreg_register_verify(env, dbtp, lsnp, notused2, lvhp)
1498 ENV *env;
1499 DBT *dbtp;
1500 DB_LSN *lsnp;
1501 db_recops notused2;
1502 void *lvhp;
1503 {
1504 __dbreg_register_args *argp;
1505 DB_LOG_VRFY_INFO *lvh;
1506 VRFY_FILEREG_INFO *fregp, freg;
1507 VRFY_FILELIFE *pflife, flife;
1508 int checklife, rmv_dblife, ret, ret2;
1509 u_int32_t opcode;
1510 char *puid;
1511 const char *dbfname;
1512
1513 dbfname = NULL;
1514 checklife = 1;
1515 opcode = 0;
1516 ret = ret2 = rmv_dblife = 0;
1517 puid = NULL;
1518 notused2 = DB_TXN_LOG_VERIFY;
1519 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1520 fregp = NULL;
1521 pflife = NULL;
1522 memset(&flife, 0, sizeof(flife));
1523 memset(&freg, 0, sizeof(freg));
1524
1525 if ((ret = __dbreg_register_read(env, dbtp->data, &argp)) != 0)
1526 return (ret);
1527
1528 opcode = FLD_ISSET(argp->opcode, DBREG_OP_MASK);
1529 dbfname = argp->name.size == 0 ? "(null)" : (char *)(argp->name.data);
1530 /*
1531 * We don't call LOG_VRFY_PROC macro here, so we have to copy the code
1532 * snippet in __log_vrfy_proc here.
1533 */
1534 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
1535 if ((ret = __lv_log_fwdscr_onrec(lvh, argp->txnp->txnid,
1536 argp->type, argp->prev_lsn, *lsnp)) != 0)
1537 goto err;
1538 goto out;
1539 }
1540 if (lvh->aborted_txnid != 0 && (ret = __lv_on_txn_aborted(lvh)) != 0)
1541 goto err;
1542
1543 if ((ret = __get_filereg_info(lvh, &(argp->uid), &fregp)) != 0 &&
1544 ret != DB_NOTFOUND)
1545 goto err;
1546
1547 /*
1548 * When DBREG_CLOSE, we should remove the fileuid-filename mapping
1549 * from filereg because the file can be opened again with a different
1550 * fileuid after closed.
1551 */
1552 if (ret == 0 && IS_DBREG_CLOSE(opcode)) {
1553 if ((ret = __db_del(lvh->fileregs, lvh->ip, NULL,
1554 &(argp->uid), 0)) != 0)
1555 goto err;
1556 }
1557
1558 /*
1559 * If this db file is seen for the 1st time, store filereg and
1560 * filelife info. Since we will do a end-to-begin scan before the
1561 * verification, we will be able to get the record but it's regcnt
1562 * is 0 since we didn't know any dbregid yet.
1563 */
1564 if (ret == DB_NOTFOUND || fregp->regcnt == 0) {
1565 /* Store filereg info unless it's a CLOSE. */
1566 freg.fileid = argp->uid;
1567 if (!IS_DBREG_CLOSE(opcode)) {
1568 freg.regcnt = 1;
1569 freg.dbregids = &(argp->fileid);
1570 } else {
1571 freg.regcnt = 0;
1572 freg.dbregids = NULL;
1573 }
1574 if (ret == DB_NOTFOUND) {
1575 /*
1576 * If the db file is an in-memory db file, we can arrive
1577 * here because there is no __fop_rename log for it;
1578 * if the __fop_rename log record is out of the log range we
1579 * verify, we will also arrive here.
1580 */
1581 if ((ret = __os_malloc(env, argp->name.size + 1,
1582 &(freg.fname))) != 0)
1583 goto err;
1584 memset(freg.fname, 0,
1585 sizeof(char) * (argp->name.size + 1));
1586 (void)strncpy(freg.fname,
1587 (const char *)(argp->name.data), argp->name.size);
1588 } else /* We already have the name. */
1589 if ((ret = __os_strdup(env,
1590 fregp->fname, &(freg.fname))) != 0)
1591 goto err;
1592
1593 if (!IS_DBREG_OPEN(opcode) &&
1594 !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
1595 /* It's likely that the DBREG_OPEN is not seen.*/
1596 __db_msg(env, DB_STR_A("2541",
1597 "[%lu][%lu] Suspicious dbreg operation: %s, the "
1598 "database file %s's register in log region does "
1599 "not begin with an open operation.",
1600 "%lu %lu %s %s"), (u_long)lsnp->file,
1601 (u_long)lsnp->offset,
1602 __lv_dbreg_str(opcode), dbfname);
1603 }
1604
1605 /*
1606 * PREOPEN is only generated when opening an in-memory db.
1607 * Because we need to log the fileid we're allocating, but we
1608 * don't have all the details yet, we are preopening the
1609 * database and will actually complete the open later. So
1610 * PREOPEN is not a real open, and the log should be ignored
1611 * in log_verify.
1612 * If fileuid is in a CLOSE operation there is no need to
1613 * record it.
1614 */
1615 if ((opcode != DBREG_PREOPEN) && !IS_DBREG_CLOSE(opcode) &&
1616 (ret = __put_filereg_info(lvh, &freg)) != 0)
1617 goto err;
1618
1619 /* Store filelife info unless it's a CLOSE dbreg operation. */
1620 if (!IS_DBREG_CLOSE(opcode)) {
1621 flife.lifetime = opcode;
1622 flife.dbregid = argp->fileid;
1623 flife.lsn = *lsnp;
1624 flife.dbtype = argp->ftype;
1625 flife.meta_pgno = argp->meta_pgno;
1626 memcpy(flife.fileid, argp->uid.data, argp->uid.size);
1627 if ((ret = __put_filelife(lvh, &flife)) != 0)
1628 goto err;
1629 }
1630 /* on_txn_logrec relies on the freg info in db first. */
1631 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1632 goto out;
1633 }
1634
1635 /*
1636 * Add dbregid if it's new, and store the file register info; or
1637 * remove dbregid from fregp if we are closing the file.
1638 */
1639 if ((ret = __add_dbregid(lvh, fregp, argp->fileid,
1640 opcode, *lsnp, argp->ftype, argp->meta_pgno, &ret2)) != 0)
1641 goto err;
1642 ret = ret2;
1643 if (ret != 0 && ret != 1 && ret != 2 && ret != -1)
1644 goto err;/* DB operation error. */
1645 if (ret != 0) {
1646 /* Newly seen dbregid does not need to check life. */
1647 if (ret == 1)
1648 checklife = 0;
1649 else if (ret == -1)
1650 rmv_dblife = 1;/* The dbreg file id is closed. */
1651 else if (ret == 2) {
1652 __db_errx(env, DB_STR_A("2542",
1653 "[%lu][%lu] Wrong dbreg operation "
1654 "sequence, opening %s for id %d which is already "
1655 "open.", "%lu %lu %s %d"),
1656 (u_long)lsnp->file, (u_long)lsnp->offset,
1657 dbfname, argp->fileid);
1658 ret = DB_LOG_VERIFY_BAD;
1659 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
1660 }
1661 if (!rmv_dblife && (ret = __put_filereg_info(lvh, fregp)) != 0)
1662 goto err;
1663 }
1664
1665 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1666
1667 if (!checklife)
1668 goto out;
1669
1670 /*
1671 * Verify the database type does not change, and the lifetime of a
1672 * db file follow an open/chkpnt->[chkpnt]->close order.
1673 * A VRFY_FILELIFE record is removed from db on DBREG_CLOSE,
1674 * and inserted into db on DBREG_OPEN.
1675 */
1676 if (!IS_DBREG_OPEN(opcode) &&
1677 (ret = __get_filelife(lvh, argp->fileid, &pflife)) != 0) {
1678 if (ret == DB_NOTFOUND) {
1679 if (!F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
1680 __db_errx(env, DB_STR_A("2543",
1681 "[%lu][%lu] Wrong dbreg operation sequence,"
1682 "file %s with id %d is first seen of "
1683 "status: %s", "%lu %lu %s %d"),
1684 (u_long)lsnp->file, (u_long)lsnp->offset,
1685 dbfname, argp->fileid,
1686 __lv_dbreg_str(opcode));
1687 ret = DB_LOG_VERIFY_BAD;
1688 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
1689 } else
1690 ret = 0;
1691 }
1692 goto err;
1693 }
1694
1695 /* Can't go on verifying without pflife. */
1696 if (pflife == NULL)
1697 goto out;
1698 if (argp->ftype != pflife->dbtype) {
1699 if ((ret = __lv_dbt_str(&(argp->uid), &puid)) != 0)
1700 goto err;
1701 __db_errx(env, DB_STR_A("2544",
1702 "[%lu][%lu] The dbtype of database file %s with uid %s "
1703 " and id %d has changed from %s to %s.",
1704 "%lu %lu %s %s %d %s %s"), (u_long)lsnp->file,
1705 (u_long)lsnp->offset, dbfname, puid,
1706 pflife->dbregid, __lv_dbtype_str(pflife->dbtype),
1707 __lv_dbtype_str(argp->ftype));
1708
1709 __os_free(env, puid);
1710 ret = DB_LOG_VERIFY_BAD;
1711 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
1712 }
1713
1714 if ((IS_DBREG_CLOSE(opcode) &&
1715 (pflife->lifetime != DBREG_CHKPNT ||
1716 pflife->lifetime != DBREG_XCHKPNT) &&
1717 !IS_DBREG_OPEN(pflife->lifetime))) {
1718 __db_errx(env, DB_STR_A("2545",
1719 "[%lu][%lu] Wrong dbreg operation sequence for file %s "
1720 "with id %d, current status: %s, new status: %s",
1721 "%lu %lu %s %d %s %s"), (u_long)lsnp->file,
1722 (u_long)lsnp->offset, dbfname, pflife->dbregid,
1723 __lv_dbreg_str(pflife->lifetime),
1724 __lv_dbreg_str(opcode));
1725 ret = DB_LOG_VERIFY_BAD;
1726 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
1727 }
1728
1729 pflife->lifetime = opcode;
1730 pflife->lsn = *lsnp;
1731 if ((!rmv_dblife && (ret = __put_filelife(lvh, pflife)) != 0) ||
1732 ((rmv_dblife || IS_DBREG_CLOSE(opcode)) &&
1733 ((ret = __del_filelife(lvh, argp->fileid)) != 0)))
1734 goto err;
1735
1736 out:
1737 /* There may be something to do here in future. */
1738 err:
1739 __os_free(env, argp);
1740 if (fregp != NULL &&
1741 (ret2 = __free_filereg_info(fregp)) != 0 && ret == 0)
1742 ret = ret2;
1743 if (freg.fname != NULL)
1744 __os_free(env, freg.fname);
1745 if (pflife != NULL)
1746 __os_free(env, pflife);
1747
1748 return (ret);
1749 }
1750
1751 /*
1752 * PUBLIC: int __bam_split_verify __P((ENV *, DBT *, DB_LSN *,
1753 * PUBLIC: db_recops, void *));
1754 */
1755 int
__bam_split_verify(env,dbtp,lsnp,notused2,lvhp)1756 __bam_split_verify(env, dbtp, lsnp, notused2, lvhp)
1757 ENV *env;
1758 DBT *dbtp;
1759 DB_LSN *lsnp;
1760 db_recops notused2;
1761 void *lvhp;
1762 {
1763 __bam_split_args *argp;
1764 DB_LOG_VRFY_INFO *lvh;
1765 int ret;
1766
1767 notused2 = DB_TXN_LOG_VERIFY;
1768 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1769
1770 if ((ret =
1771 __bam_split_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1772 return (ret);
1773
1774 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1775
1776 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->left);
1777 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->right);
1778 /* Parent page lock is always released before __bam_page returns. */
1779
1780 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1781 goto err;
1782
1783 out:
1784
1785 err:
1786
1787 __os_free(env, argp);
1788 return (ret);
1789 }
1790
1791 /*
1792 * PUBLIC: int __bam_split_42_verify __P((ENV *, DBT *, DB_LSN *,
1793 * PUBLIC: db_recops, void *));
1794 */
1795 int
__bam_split_42_verify(env,dbtp,lsnp,notused2,lvhp)1796 __bam_split_42_verify(env, dbtp, lsnp, notused2, lvhp)
1797 ENV *env;
1798 DBT *dbtp;
1799 DB_LSN *lsnp;
1800 db_recops notused2;
1801 void *lvhp;
1802 {
1803 __bam_split_42_args *argp;
1804 DB_LOG_VRFY_INFO *lvh;
1805 int ret;
1806
1807 notused2 = DB_TXN_LOG_VERIFY;
1808 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1809
1810 if ((ret =
1811 __bam_split_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1812 return (ret);
1813
1814 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
1815 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
1816
1817 err:
1818
1819 __os_free(env, argp);
1820 return (ret);
1821 }
1822
1823 /*
1824 * PUBLIC: int __bam_rsplit_verify __P((ENV *, DBT *, DB_LSN *,
1825 * PUBLIC: db_recops, void *));
1826 */
1827 int
__bam_rsplit_verify(env,dbtp,lsnp,notused2,lvhp)1828 __bam_rsplit_verify(env, dbtp, lsnp, notused2, lvhp)
1829 ENV *env;
1830 DBT *dbtp;
1831 DB_LSN *lsnp;
1832 db_recops notused2;
1833 void *lvhp;
1834 {
1835 __bam_rsplit_args *argp;
1836 DB_LOG_VRFY_INFO *lvh;
1837 int ret;
1838
1839 notused2 = DB_TXN_LOG_VERIFY;
1840 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1841
1842 if ((ret =
1843 __bam_rsplit_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1844 return (ret);
1845
1846 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1847
1848 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1849 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1850 goto err;
1851
1852 out:
1853
1854 err:
1855
1856 __os_free(env, argp);
1857 return (ret);
1858 }
1859
1860 /*
1861 * PUBLIC: int __bam_adj_verify __P((ENV *, DBT *, DB_LSN *,
1862 * PUBLIC: db_recops, void *));
1863 */
1864 int
__bam_adj_verify(env,dbtp,lsnp,notused2,lvhp)1865 __bam_adj_verify(env, dbtp, lsnp, notused2, lvhp)
1866 ENV *env;
1867 DBT *dbtp;
1868 DB_LSN *lsnp;
1869 db_recops notused2;
1870 void *lvhp;
1871 {
1872 __bam_adj_args *argp;
1873 DB_LOG_VRFY_INFO *lvh;
1874 int ret;
1875
1876 notused2 = DB_TXN_LOG_VERIFY;
1877 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1878
1879 if ((ret =
1880 __bam_adj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1881 return (ret);
1882
1883 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1884
1885 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1886 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1887 goto err;
1888
1889 out:
1890
1891 err:
1892
1893 __os_free(env, argp);
1894 return (ret);
1895 }
1896
1897 /*
1898 * PUBLIC: int __bam_irep_verify __P((ENV *, DBT *, DB_LSN *,
1899 * PUBLIC: db_recops, void *));
1900 */
1901 int
__bam_irep_verify(env,dbtp,lsnp,notused2,lvhp)1902 __bam_irep_verify(env, dbtp, lsnp, notused2, lvhp)
1903 ENV *env;
1904 DBT *dbtp;
1905 DB_LSN *lsnp;
1906 db_recops notused2;
1907 void *lvhp;
1908 {
1909 __bam_irep_args *argp;
1910 DB_LOG_VRFY_INFO *lvh;
1911 int ret;
1912
1913 notused2 = DB_TXN_LOG_VERIFY;
1914 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1915
1916 if ((ret =
1917 __bam_irep_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1918 return (ret);
1919
1920 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1921
1922 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1923 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1924 goto err;
1925
1926 out:
1927
1928 err:
1929
1930 __os_free(env, argp);
1931 return (ret);
1932 }
1933
1934 /*
1935 * PUBLIC: int __bam_cadjust_verify __P((ENV *, DBT *, DB_LSN *,
1936 * PUBLIC: db_recops, void *));
1937 */
1938 int
__bam_cadjust_verify(env,dbtp,lsnp,notused2,lvhp)1939 __bam_cadjust_verify(env, dbtp, lsnp, notused2, lvhp)
1940 ENV *env;
1941 DBT *dbtp;
1942 DB_LSN *lsnp;
1943 db_recops notused2;
1944 void *lvhp;
1945 {
1946 __bam_cadjust_args *argp;
1947 DB_LOG_VRFY_INFO *lvh;
1948 int ret;
1949
1950 notused2 = DB_TXN_LOG_VERIFY;
1951 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1952
1953 if ((ret =
1954 __bam_cadjust_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1955 return (ret);
1956
1957 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1958
1959 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1960 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1961 goto err;
1962
1963 out:
1964
1965 err:
1966
1967 __os_free(env, argp);
1968 return (ret);
1969 }
1970
1971 /*
1972 * PUBLIC: int __bam_cdel_verify __P((ENV *, DBT *, DB_LSN *,
1973 * PUBLIC: db_recops, void *));
1974 */
1975 int
__bam_cdel_verify(env,dbtp,lsnp,notused2,lvhp)1976 __bam_cdel_verify(env, dbtp, lsnp, notused2, lvhp)
1977 ENV *env;
1978 DBT *dbtp;
1979 DB_LSN *lsnp;
1980 db_recops notused2;
1981 void *lvhp;
1982 {
1983 __bam_cdel_args *argp;
1984 DB_LOG_VRFY_INFO *lvh;
1985 int ret;
1986
1987 notused2 = DB_TXN_LOG_VERIFY;
1988 lvh = (DB_LOG_VRFY_INFO *)lvhp;
1989
1990 if ((ret =
1991 __bam_cdel_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
1992 return (ret);
1993
1994 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
1995
1996 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
1997 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
1998 goto err;
1999
2000 out:
2001
2002 err:
2003
2004 __os_free(env, argp);
2005 return (ret);
2006 }
2007
2008 /*
2009 * PUBLIC: int __bam_repl_verify __P((ENV *, DBT *, DB_LSN *,
2010 * PUBLIC: db_recops, void *));
2011 */
2012 int
__bam_repl_verify(env,dbtp,lsnp,notused2,lvhp)2013 __bam_repl_verify(env, dbtp, lsnp, notused2, lvhp)
2014 ENV *env;
2015 DBT *dbtp;
2016 DB_LSN *lsnp;
2017 db_recops notused2;
2018 void *lvhp;
2019 {
2020 __bam_repl_args *argp;
2021 DB_LOG_VRFY_INFO *lvh;
2022 int ret;
2023
2024 notused2 = DB_TXN_LOG_VERIFY;
2025 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2026
2027 if ((ret =
2028 __bam_repl_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2029 return (ret);
2030
2031 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2032
2033 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2034 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
2035 goto err;
2036
2037 out:
2038
2039 err:
2040
2041 __os_free(env, argp);
2042 return (ret);
2043 }
2044
2045 /*
2046 * PUBLIC: int __bam_root_verify __P((ENV *, DBT *, DB_LSN *,
2047 * PUBLIC: db_recops, void *));
2048 */
2049 int
__bam_root_verify(env,dbtp,lsnp,notused2,lvhp)2050 __bam_root_verify(env, dbtp, lsnp, notused2, lvhp)
2051 ENV *env;
2052 DBT *dbtp;
2053 DB_LSN *lsnp;
2054 db_recops notused2;
2055 void *lvhp;
2056 {
2057 __bam_root_args *argp;
2058 DB_LOG_VRFY_INFO *lvh;
2059 int ret;
2060
2061 notused2 = DB_TXN_LOG_VERIFY;
2062 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2063
2064 if ((ret =
2065 __bam_root_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2066 return (ret);
2067
2068 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2069 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
2070 goto err;
2071
2072 out:
2073
2074 err:
2075
2076 __os_free(env, argp);
2077 return (ret);
2078 }
2079
2080 /*
2081 * PUBLIC: int __bam_curadj_verify __P((ENV *, DBT *, DB_LSN *,
2082 * PUBLIC: db_recops, void *));
2083 */
2084 int
__bam_curadj_verify(env,dbtp,lsnp,notused2,lvhp)2085 __bam_curadj_verify(env, dbtp, lsnp, notused2, lvhp)
2086 ENV *env;
2087 DBT *dbtp;
2088 DB_LSN *lsnp;
2089 db_recops notused2;
2090 void *lvhp;
2091 {
2092 __bam_curadj_args *argp;
2093 DB_LOG_VRFY_INFO *lvh;
2094 int ret;
2095
2096 notused2 = DB_TXN_LOG_VERIFY;
2097 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2098
2099 if ((ret =
2100 __bam_curadj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2101 return (ret);
2102
2103 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2104 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
2105 goto err;
2106
2107 out:
2108
2109 err:
2110
2111 __os_free(env, argp);
2112
2113 return (ret);
2114 }
2115
2116 /*
2117 * PUBLIC: int __bam_rcuradj_verify __P((ENV *, DBT *, DB_LSN *,
2118 * PUBLIC: db_recops, void *));
2119 */
2120 int
__bam_rcuradj_verify(env,dbtp,lsnp,notused2,lvhp)2121 __bam_rcuradj_verify(env, dbtp, lsnp, notused2, lvhp)
2122 ENV *env;
2123 DBT *dbtp;
2124 DB_LSN *lsnp;
2125 db_recops notused2;
2126 void *lvhp;
2127 {
2128 __bam_rcuradj_args *argp;
2129 DB_LOG_VRFY_INFO *lvh;
2130 int ret;
2131
2132 notused2 = DB_TXN_LOG_VERIFY;
2133 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2134
2135 if ((ret =
2136 __bam_rcuradj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2137 return (ret);
2138
2139 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2140 if ((ret = __lv_on_bam_log(lvh, *lsnp, argp->fileid)) != 0)
2141 goto err;
2142
2143 out:
2144
2145 err:
2146
2147 __os_free(env, argp);
2148
2149 return (ret);
2150 }
2151
2152 /*
2153 * PUBLIC: int __bam_relink_43_verify __P((ENV *, DBT *, DB_LSN *,
2154 * PUBLIC: db_recops, void *));
2155 */
2156 int
__bam_relink_43_verify(env,dbtp,lsnp,notused2,lvhp)2157 __bam_relink_43_verify(env, dbtp, lsnp, notused2, lvhp)
2158 ENV *env;
2159 DBT *dbtp;
2160 DB_LSN *lsnp;
2161 db_recops notused2;
2162 void *lvhp;
2163 {
2164 __bam_relink_43_args *argp;
2165 DB_LOG_VRFY_INFO *lvh;
2166 int ret;
2167
2168 notused2 = DB_TXN_LOG_VERIFY;
2169 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2170
2171 if ((ret =
2172 __bam_relink_43_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2173 return (ret);
2174
2175 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2176 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
2177 err:
2178
2179 __os_free(env, argp);
2180
2181 return (ret);
2182 }
2183
2184 /*
2185 * PUBLIC: int __bam_merge_44_verify __P((ENV *, DBT *, DB_LSN *,
2186 * PUBLIC: db_recops, void *));
2187 */
2188 int
__bam_merge_44_verify(env,dbtp,lsnp,notused2,lvhp)2189 __bam_merge_44_verify(env, dbtp, lsnp, notused2, lvhp)
2190 ENV *env;
2191 DBT *dbtp;
2192 DB_LSN *lsnp;
2193 db_recops notused2;
2194 void *lvhp;
2195 {
2196 __bam_merge_44_args *argp;
2197 DB_LOG_VRFY_INFO *lvh;
2198 int ret;
2199
2200 notused2 = DB_TXN_LOG_VERIFY;
2201 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2202
2203 if ((ret =
2204 __bam_merge_44_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2205 return (ret);
2206
2207 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2208 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
2209 err:
2210
2211 __os_free(env, argp);
2212
2213 return (ret);
2214 }
2215
2216 /*
2217 * PUBLIC: int __fop_create_42_verify __P((ENV *, DBT *, DB_LSN *,
2218 * PUBLIC: db_recops, void *));
2219 */
2220 int
__fop_create_42_verify(env,dbtp,lsnp,notused2,lvhp)2221 __fop_create_42_verify(env, dbtp, lsnp, notused2, lvhp)
2222 ENV *env;
2223 DBT *dbtp;
2224 DB_LSN *lsnp;
2225 db_recops notused2;
2226 void *lvhp;
2227 {
2228 __fop_create_42_args *argp;
2229 DB_LOG_VRFY_INFO *lvh;
2230 int ret;
2231
2232 notused2 = DB_TXN_LOG_VERIFY;
2233 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2234
2235 if ((ret = __fop_create_42_read(env, dbtp->data, &argp)) != 0)
2236 return (ret);
2237
2238 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2239 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
2240 err:
2241
2242 __os_free(env, argp);
2243
2244 return (ret);
2245 }
2246
2247 /*
2248 * PUBLIC: int __fop_create_verify __P((ENV *, DBT *, DB_LSN *,
2249 * PUBLIC: db_recops, void *));
2250 */
2251 int
__fop_create_verify(env,dbtp,lsnp,notused2,lvhp)2252 __fop_create_verify(env, dbtp, lsnp, notused2, lvhp)
2253 ENV *env;
2254 DBT *dbtp;
2255 DB_LSN *lsnp;
2256 db_recops notused2;
2257 void *lvhp;
2258 {
2259 __fop_create_args *argp;
2260 DB_LOG_VRFY_INFO *lvh;
2261 int ret;
2262
2263 notused2 = DB_TXN_LOG_VERIFY;
2264 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2265
2266 if ((ret = __fop_create_read(env, dbtp->data, &argp)) != 0)
2267 return (ret);
2268
2269 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
2270
2271 out:
2272
2273 err:
2274
2275 __os_free(env, argp);
2276
2277 return (ret);
2278 }
2279
2280 /*
2281 * PUBLIC: int __fop_remove_verify __P((ENV *, DBT *, DB_LSN *,
2282 * PUBLIC: db_recops, void *));
2283 */
2284 int
__fop_remove_verify(env,dbtp,lsnp,notused2,lvhp)2285 __fop_remove_verify(env, dbtp, lsnp, notused2, lvhp)
2286 ENV *env;
2287 DBT *dbtp;
2288 DB_LSN *lsnp;
2289 db_recops notused2;
2290 void *lvhp;
2291 {
2292 __fop_remove_args *argp;
2293 DB_LOG_VRFY_INFO *lvh;
2294 int ret;
2295
2296 notused2 = DB_TXN_LOG_VERIFY;
2297 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2298
2299 if ((ret = __fop_remove_read(env, dbtp->data, &argp)) != 0)
2300 return (ret);
2301
2302 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
2303
2304 out:
2305
2306 err:
2307
2308 __os_free(env, argp);
2309
2310 return (ret);
2311 }
2312
2313 /*
2314 * PUBLIC: int __fop_write_42_verify __P((ENV *, DBT *, DB_LSN *,
2315 * PUBLIC: db_recops, void *));
2316 */
2317 int
__fop_write_42_verify(env,dbtp,lsnp,notused2,lvhp)2318 __fop_write_42_verify(env, dbtp, lsnp, notused2, lvhp)
2319 ENV *env;
2320 DBT *dbtp;
2321 DB_LSN *lsnp;
2322 db_recops notused2;
2323 void *lvhp;
2324 {
2325 __fop_write_42_args *argp;
2326 DB_LOG_VRFY_INFO *lvh;
2327 int ret;
2328
2329 notused2 = DB_TXN_LOG_VERIFY;
2330 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2331
2332 if ((ret = __fop_write_42_read(env, dbtp->data, &argp)) != 0)
2333 return (ret);
2334
2335 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2336 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
2337 err:
2338
2339 __os_free(env, argp);
2340 return (ret);
2341 }
2342
2343 /*
2344 * PUBLIC: int __fop_write_verify __P((ENV *, DBT *, DB_LSN *,
2345 * PUBLIC: db_recops, void *));
2346 */
2347 int
__fop_write_verify(env,dbtp,lsnp,notused2,lvhp)2348 __fop_write_verify(env, dbtp, lsnp, notused2, lvhp)
2349 ENV *env;
2350 DBT *dbtp;
2351 DB_LSN *lsnp;
2352 db_recops notused2;
2353 void *lvhp;
2354 {
2355 __fop_write_args *argp;
2356 DB_LOG_VRFY_INFO *lvh;
2357 int ret;
2358
2359 notused2 = DB_TXN_LOG_VERIFY;
2360 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2361
2362 if ((ret = __fop_write_read(env, dbtp->data, &argp)) != 0)
2363 return (ret);
2364
2365 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
2366 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
2367 out:
2368
2369 err:
2370
2371 __os_free(env, argp);
2372 return (ret);
2373 }
2374
2375 /*
2376 * PUBLIC: int __fop_rename_42_verify __P((ENV *, DBT *, DB_LSN *,
2377 * PUBLIC: db_recops, void *));
2378 */
2379 int
__fop_rename_42_verify(env,dbtp,lsnp,notused2,lvhp)2380 __fop_rename_42_verify(env, dbtp, lsnp, notused2, lvhp)
2381 ENV *env;
2382 DBT *dbtp;
2383 DB_LSN *lsnp;
2384 db_recops notused2;
2385 void *lvhp;
2386 {
2387 __fop_rename_42_args *argp;
2388 DB_LOG_VRFY_INFO *lvh;
2389 int ret;
2390
2391 notused2 = DB_TXN_LOG_VERIFY;
2392 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2393
2394 if ((ret = __fop_rename_42_read(env, dbtp->data, &argp)) != 0)
2395 return (ret);
2396
2397 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2398 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
2399 err:
2400
2401 __os_free(env, argp);
2402
2403 return (ret);
2404 }
2405
2406 /*
2407 * PUBLIC: int __fop_rename_verify __P((ENV *, DBT *, DB_LSN *,
2408 * PUBLIC: db_recops, void *));
2409 */
2410 int
__fop_rename_verify(env,dbtp,lsnp,notused2,lvhp)2411 __fop_rename_verify(env, dbtp, lsnp, notused2, lvhp)
2412 ENV *env;
2413 DBT *dbtp;
2414 DB_LSN *lsnp;
2415 db_recops notused2;
2416 void *lvhp;
2417 {
2418 __fop_rename_args *argp;
2419 DB_LOG_VRFY_INFO *lvh;
2420 char *buf;
2421 int ret;
2422 size_t buflen;
2423 VRFY_FILEREG_INFO freg, *fregp;
2424
2425 memset(&freg, 0, sizeof(freg));
2426 notused2 = DB_TXN_LOG_VERIFY;
2427 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2428 buf = NULL;
2429
2430 if ((ret = __fop_rename_read(env, dbtp->data, &argp)) != 0)
2431 return (ret);
2432
2433 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
2434 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
2435 /*
2436 * Since we get the fname-fuid map when iterating from end to
2437 * beginning, we only store the latest file name, that's the
2438 * name supposed to be used currently. So if the fileid is
2439 * already stored, and we see it again here, it means the db
2440 * file was renamed and we already have its latest name.
2441 *
2442 * Store the dbfile path (dir/fname) in case there are db
2443 * files with same name in different data directories.
2444 */
2445 if (__get_filereg_info(lvh, &(argp->fileid), &fregp) == 0) {
2446 if (fregp != NULL &&
2447 (ret = __free_filereg_info(fregp)) != 0)
2448 goto err;
2449 goto out;
2450 }
2451 freg.fileid = argp->fileid;
2452 if ((ret = __os_malloc(env, buflen = argp->dirname.size +
2453 argp->newname.size + 2, &buf)) != 0)
2454 goto err;
2455 snprintf(buf, buflen, "%s/%s", (char *)argp->dirname.data,
2456 (char *)argp->newname.data);
2457 freg.fname = buf;
2458 /* Store the dbfilename<-->dbfileid map. */
2459 if ((ret = __put_filereg_info(lvh, &freg)) != 0)
2460 goto err;
2461 }
2462 out:
2463
2464 err:
2465 if (buf != NULL)
2466 __os_free(lvh->dbenv->env, buf);
2467 __os_free(env, argp);
2468
2469 return (ret);
2470 }
2471
2472 /*
2473 * PUBLIC: int __fop_file_remove_verify __P((ENV *, DBT *, DB_LSN *,
2474 * PUBLIC: db_recops, void *));
2475 */
2476 int
__fop_file_remove_verify(env,dbtp,lsnp,notused2,lvhp)2477 __fop_file_remove_verify(env, dbtp, lsnp, notused2, lvhp)
2478 ENV *env;
2479 DBT *dbtp;
2480 DB_LSN *lsnp;
2481 db_recops notused2;
2482 void *lvhp;
2483 {
2484 __fop_file_remove_args *argp;
2485 DB_LOG_VRFY_INFO *lvh;
2486 int ret;
2487
2488 notused2 = DB_TXN_LOG_VERIFY;
2489 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2490
2491 if ((ret = __fop_file_remove_read(env, dbtp->data, &argp)) != 0)
2492 return (ret);
2493
2494 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
2495
2496 out:
2497
2498 err:
2499
2500 __os_free(env, argp);
2501
2502 return (ret);
2503 }
2504
2505 #ifdef HAVE_HASH
2506 /*
2507 * PUBLIC: int __ham_insdel_verify __P((ENV *, DBT *, DB_LSN *,
2508 * PUBLIC: db_recops, void *));
2509 */
2510 int
__ham_insdel_verify(env,dbtp,lsnp,notused2,lvhp)2511 __ham_insdel_verify(env, dbtp, lsnp, notused2, lvhp)
2512 ENV *env;
2513 DBT *dbtp;
2514 DB_LSN *lsnp;
2515 db_recops notused2;
2516 void *lvhp;
2517 {
2518 __ham_insdel_args *argp;
2519 DB_LOG_VRFY_INFO *lvh;
2520 int ret;
2521
2522 notused2 = DB_TXN_LOG_VERIFY;
2523 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2524
2525 if ((ret =
2526 __ham_insdel_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2527 return (ret);
2528
2529 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2530 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2531 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2532 goto err;
2533
2534 out:
2535
2536 err:
2537
2538 __os_free(env, argp);
2539 return (ret);
2540 }
2541
2542 /*
2543 * PUBLIC: int __ham_newpage_verify __P((ENV *, DBT *, DB_LSN *,
2544 * PUBLIC: db_recops, void *));
2545 */
2546 int
__ham_newpage_verify(env,dbtp,lsnp,notused2,lvhp)2547 __ham_newpage_verify(env, dbtp, lsnp, notused2, lvhp)
2548 ENV *env;
2549 DBT *dbtp;
2550 DB_LSN *lsnp;
2551 db_recops notused2;
2552 void *lvhp;
2553 {
2554 __ham_newpage_args *argp;
2555 DB_LOG_VRFY_INFO *lvh;
2556 int ret;
2557
2558 notused2 = DB_TXN_LOG_VERIFY;
2559 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2560
2561 if ((ret =
2562 __ham_newpage_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2563 return (ret);
2564
2565 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2566
2567 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
2568 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2569 goto err;
2570
2571 out:
2572
2573 err:
2574
2575 __os_free(env, argp);
2576 return (ret);
2577 }
2578
2579 /*
2580 * PUBLIC: int __ham_splitdata_verify __P((ENV *, DBT *, DB_LSN *,
2581 * PUBLIC: db_recops, void *));
2582 */
2583 int
__ham_splitdata_verify(env,dbtp,lsnp,notused2,lvhp)2584 __ham_splitdata_verify(env, dbtp, lsnp, notused2, lvhp)
2585 ENV *env;
2586 DBT *dbtp;
2587 DB_LSN *lsnp;
2588 db_recops notused2;
2589 void *lvhp;
2590 {
2591 __ham_splitdata_args *argp;
2592 DB_LOG_VRFY_INFO *lvh;
2593 int ret;
2594
2595 notused2 = DB_TXN_LOG_VERIFY;
2596 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2597
2598 if ((ret =
2599 __ham_splitdata_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2600 return (ret);
2601
2602 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2603 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2604 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2605 goto err;
2606
2607 out:
2608
2609 err:
2610
2611 __os_free(env, argp);
2612
2613 return (ret);
2614 }
2615
2616 /*
2617 * PUBLIC: int __ham_replace_verify __P((ENV *, DBT *, DB_LSN *,
2618 * PUBLIC: db_recops, void *));
2619 */
2620 int
__ham_replace_verify(env,dbtp,lsnp,notused2,lvhp)2621 __ham_replace_verify(env, dbtp, lsnp, notused2, lvhp)
2622 ENV *env;
2623 DBT *dbtp;
2624 DB_LSN *lsnp;
2625 db_recops notused2;
2626 void *lvhp;
2627 {
2628 __ham_replace_args *argp;
2629 DB_LOG_VRFY_INFO *lvh;
2630 int ret;
2631
2632 notused2 = DB_TXN_LOG_VERIFY;
2633 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2634
2635 if ((ret =
2636 __ham_replace_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2637 return (ret);
2638
2639 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2640
2641 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2642 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2643 goto err;
2644
2645 out:
2646
2647 err:
2648
2649 __os_free(env, argp);
2650
2651 return (ret);
2652 }
2653
2654 /*
2655 * PUBLIC: int __ham_copypage_verify __P((ENV *, DBT *, DB_LSN *,
2656 * PUBLIC: db_recops, void *));
2657 */
2658 int
__ham_copypage_verify(env,dbtp,lsnp,notused2,lvhp)2659 __ham_copypage_verify(env, dbtp, lsnp, notused2, lvhp)
2660 ENV *env;
2661 DBT *dbtp;
2662 DB_LSN *lsnp;
2663 db_recops notused2;
2664 void *lvhp;
2665 {
2666 __ham_copypage_args *argp;
2667 DB_LOG_VRFY_INFO *lvh;
2668 int ret;
2669
2670 notused2 = DB_TXN_LOG_VERIFY;
2671 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2672
2673 if ((ret =
2674 __ham_copypage_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2675 return (ret);
2676
2677 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2678 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2679 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2680 goto err;
2681
2682 out:
2683
2684 err:
2685
2686 __os_free(env, argp);
2687 return (ret);
2688 }
2689
2690 /*
2691 * PUBLIC: int __ham_metagroup_42_verify __P((ENV *, DBT *, DB_LSN *,
2692 * PUBLIC: db_recops, void *));
2693 */
2694 int
__ham_metagroup_42_verify(env,dbtp,lsnp,notused2,lvhp)2695 __ham_metagroup_42_verify(env, dbtp, lsnp, notused2, lvhp)
2696 ENV *env;
2697 DBT *dbtp;
2698 DB_LSN *lsnp;
2699 db_recops notused2;
2700 void *lvhp;
2701 {
2702 __ham_metagroup_42_args *argp;
2703 DB_LOG_VRFY_INFO *lvh;
2704 int ret;
2705
2706 notused2 = DB_TXN_LOG_VERIFY;
2707 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2708
2709 if ((ret =
2710 __ham_metagroup_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2711 return (ret);
2712
2713 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2714 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
2715 err:
2716
2717 __os_free(env, argp);
2718
2719 return (ret);
2720 }
2721
2722 /*
2723 * PUBLIC: int __ham_metagroup_verify __P((ENV *, DBT *, DB_LSN *,
2724 * PUBLIC: db_recops, void *));
2725 */
2726 int
__ham_metagroup_verify(env,dbtp,lsnp,notused2,lvhp)2727 __ham_metagroup_verify(env, dbtp, lsnp, notused2, lvhp)
2728 ENV *env;
2729 DBT *dbtp;
2730 DB_LSN *lsnp;
2731 db_recops notused2;
2732 void *lvhp;
2733 {
2734 __ham_metagroup_args *argp;
2735 DB_LOG_VRFY_INFO *lvh;
2736 int ret;
2737
2738 notused2 = DB_TXN_LOG_VERIFY;
2739 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2740
2741 if ((ret =
2742 __ham_metagroup_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2743 return (ret);
2744
2745 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2746 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2747 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2748 goto err;
2749
2750 out:
2751
2752 err:
2753
2754 __os_free(env, argp);
2755 return (ret);
2756 }
2757
2758 /*
2759 * PUBLIC: int __ham_groupalloc_42_verify __P((ENV *, DBT *,
2760 * PUBLIC: DB_LSN *, db_recops, void *));
2761 */
2762 int
__ham_groupalloc_42_verify(env,dbtp,lsnp,notused2,lvhp)2763 __ham_groupalloc_42_verify(env, dbtp, lsnp, notused2, lvhp)
2764 ENV *env;
2765 DBT *dbtp;
2766 DB_LSN *lsnp;
2767 db_recops notused2;
2768 void *lvhp;
2769 {
2770 __ham_groupalloc_42_args *argp;
2771 DB_LOG_VRFY_INFO *lvh;
2772 int ret;
2773
2774 notused2 = DB_TXN_LOG_VERIFY;
2775 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2776
2777 if ((ret =
2778 __ham_groupalloc_42_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2779 return (ret);
2780
2781 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
2782 /* LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid); */
2783 err:
2784
2785 __os_free(env, argp);
2786
2787 return (ret);
2788 }
2789
2790 /*
2791 * PUBLIC: int __ham_groupalloc_verify __P((ENV *, DBT *, DB_LSN *,
2792 * PUBLIC: db_recops, void *));
2793 */
2794 int
__ham_groupalloc_verify(env,dbtp,lsnp,notused2,lvhp)2795 __ham_groupalloc_verify(env, dbtp, lsnp, notused2, lvhp)
2796 ENV *env;
2797 DBT *dbtp;
2798 DB_LSN *lsnp;
2799 db_recops notused2;
2800 void *lvhp;
2801 {
2802 __ham_groupalloc_args *argp;
2803 DB_LOG_VRFY_INFO *lvh;
2804 VRFY_FILELIFE *pflife;
2805 int ret;
2806
2807 ret = 0;
2808 pflife = NULL;
2809
2810 notused2 = DB_TXN_LOG_VERIFY;
2811 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2812
2813 if ((ret =
2814 __ham_groupalloc_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2815 return (ret);
2816
2817 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2818 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
2819
2820 /*
2821 * The __ham_groupalloc record is only generated when creating the
2822 * hash sub database so it will always be on the master database's
2823 * fileid.
2824 */
2825
2826 if ((ret = __get_filelife(lvh, argp->fileid, &pflife)) != 0)
2827 goto err;
2828
2829 if (pflife->meta_pgno != PGNO_BASE_MD) {
2830 __db_errx(lvh->dbenv->env, DB_STR_A("2546",
2831 "[%lu][%lu] __ham_groupalloc should apply only to the "
2832 "master database with meta page number 0, current meta "
2833 "page number is %d.", "%lu %lu %d"),
2834 (u_long)lsnp->file, (u_long)lsnp->offset,
2835 pflife->meta_pgno);
2836 ret = DB_LOG_VERIFY_BAD;
2837 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
2838 }
2839
2840 out:
2841
2842 err:
2843 if (pflife != NULL)
2844 __os_free(lvh->dbenv->env, pflife);
2845
2846 __os_free(env, argp);
2847 return (ret);
2848 }
2849
2850 /*
2851 * PUBLIC: int __ham_changeslot_verify __P((ENV *, DBT *, DB_LSN *,
2852 * PUBLIC: db_recops, void *));
2853 */
2854 int
__ham_changeslot_verify(env,dbtp,lsnp,notused2,lvhp)2855 __ham_changeslot_verify(env, dbtp, lsnp, notused2, lvhp)
2856 ENV *env;
2857 DBT *dbtp;
2858 DB_LSN *lsnp;
2859 db_recops notused2;
2860 void *lvhp;
2861 {
2862 __ham_changeslot_args *argp;
2863 DB_LOG_VRFY_INFO *lvh;
2864 int ret;
2865
2866 notused2 = DB_TXN_LOG_VERIFY;
2867 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2868
2869 if ((ret =
2870 __ham_changeslot_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2871 return (ret);
2872
2873 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2874 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
2875 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2876 goto err;
2877
2878 out:
2879
2880 err:
2881
2882 __os_free(env, argp);
2883
2884 return (ret);
2885 }
2886
2887 /*
2888 * PUBLIC: int __ham_contract_verify __P((ENV *, DBT *, DB_LSN *,
2889 * PUBLIC: db_recops, void *));
2890 */
2891 int
__ham_contract_verify(env,dbtp,lsnp,notused2,lvhp)2892 __ham_contract_verify(env, dbtp, lsnp, notused2, lvhp)
2893 ENV *env;
2894 DBT *dbtp;
2895 DB_LSN *lsnp;
2896 db_recops notused2;
2897 void *lvhp;
2898 {
2899 __ham_contract_args *argp;
2900 DB_LOG_VRFY_INFO *lvh;
2901 int ret;
2902
2903 notused2 = DB_TXN_LOG_VERIFY;
2904 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2905
2906 if ((ret =
2907 __ham_contract_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2908 return (ret);
2909
2910 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2911 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2912 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2913 goto err;
2914
2915 out:
2916
2917 err:
2918
2919 __os_free(env, argp);
2920 return (ret);
2921 }
2922
2923 /*
2924 * PUBLIC: int __ham_curadj_verify __P((ENV *, DBT *, DB_LSN *,
2925 * PUBLIC: db_recops, void *));
2926 */
2927 int
__ham_curadj_verify(env,dbtp,lsnp,notused2,lvhp)2928 __ham_curadj_verify(env, dbtp, lsnp, notused2, lvhp)
2929 ENV *env;
2930 DBT *dbtp;
2931 DB_LSN *lsnp;
2932 db_recops notused2;
2933 void *lvhp;
2934 {
2935 __ham_curadj_args *argp;
2936 DB_LOG_VRFY_INFO *lvh;
2937 int ret;
2938
2939 notused2 = DB_TXN_LOG_VERIFY;
2940 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2941
2942 if ((ret =
2943 __ham_curadj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2944 return (ret);
2945
2946 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2947 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
2948 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2949 goto err;
2950
2951 out:
2952
2953 err:
2954
2955 __os_free(env, argp);
2956
2957 return (ret);
2958 }
2959
2960 /*
2961 * PUBLIC: int __ham_chgpg_verify __P((ENV *, DBT *, DB_LSN *,
2962 * PUBLIC: db_recops, void *));
2963 */
2964 int
__ham_chgpg_verify(env,dbtp,lsnp,notused2,lvhp)2965 __ham_chgpg_verify(env, dbtp, lsnp, notused2, lvhp)
2966 ENV *env;
2967 DBT *dbtp;
2968 DB_LSN *lsnp;
2969 db_recops notused2;
2970 void *lvhp;
2971 {
2972 __ham_chgpg_args *argp;
2973 DB_LOG_VRFY_INFO *lvh;
2974 int ret;
2975
2976 notused2 = DB_TXN_LOG_VERIFY;
2977 lvh = (DB_LOG_VRFY_INFO *)lvhp;
2978
2979 if ((ret =
2980 __ham_chgpg_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
2981 return (ret);
2982
2983 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
2984 ON_PAGE_UPDATE4 /* No pages are locked by txns. */
2985 if ((ret = __lv_on_ham_log(lvh, *lsnp, argp->fileid)) != 0)
2986 goto err;
2987
2988 out:
2989
2990 err:
2991
2992 __os_free(env, argp);
2993 return (ret);
2994 }
2995 #endif
2996
2997 #ifdef HAVE_HEAP
2998 /*
2999 * PUBLIC: int __heap_addrem_verify
3000 * PUBLIC: __P((ENV *, DBT *, DB_LSN *, db_recops, void *));
3001 */
3002 int
__heap_addrem_verify(env,dbtp,lsnp,notused2,lvhp)3003 __heap_addrem_verify(env, dbtp, lsnp, notused2, lvhp)
3004 ENV *env;
3005 DBT *dbtp;
3006 DB_LSN *lsnp;
3007 db_recops notused2;
3008 void *lvhp;
3009 {
3010 __heap_addrem_args *argp;
3011 DB_LOG_VRFY_INFO *lvh;
3012 int ret;
3013
3014 notused2 = DB_TXN_LOG_VERIFY;
3015 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3016
3017 if ((ret =
3018 __heap_addrem_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3019 return (ret);
3020
3021 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3022 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
3023 if ((ret = __lv_on_heap_log(lvh, *lsnp, argp->fileid)) != 0)
3024 goto err;
3025 out:
3026
3027 err:
3028 __os_free(env, argp);
3029 return (ret);
3030 }
3031
3032 /*
3033 * PUBLIC: int __heap_pg_alloc_verify
3034 * PUBLIC: __P((ENV *, DBT *, DB_LSN *, db_recops, void *));
3035 */
3036 int
__heap_pg_alloc_verify(env,dbtp,lsnp,notused2,lvhp)3037 __heap_pg_alloc_verify(env, dbtp, lsnp, notused2, lvhp)
3038 ENV *env;
3039 DBT *dbtp;
3040 DB_LSN *lsnp;
3041 db_recops notused2;
3042 void *lvhp;
3043 {
3044 __heap_pg_alloc_args *argp;
3045 DB_LOG_VRFY_INFO *lvh;
3046 int ret;
3047
3048 notused2 = DB_TXN_LOG_VERIFY;
3049 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3050
3051 if ((ret =
3052 __heap_pg_alloc_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3053 return (ret);
3054
3055 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3056 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
3057 if ((ret = __lv_on_heap_log(lvh, *lsnp, argp->fileid)) != 0)
3058 goto err;
3059 out:
3060
3061 err:
3062 __os_free(env, argp);
3063 return (ret);
3064 }
3065
3066 /*
3067 * PUBLIC: int __heap_trunc_meta_verify
3068 * PUBLIC: __P((ENV *, DBT *, DB_LSN *, db_recops, void *));
3069 */
3070 int
__heap_trunc_meta_verify(env,dbtp,lsnp,notused2,lvhp)3071 __heap_trunc_meta_verify(env, dbtp, lsnp, notused2, lvhp)
3072 ENV *env;
3073 DBT *dbtp;
3074 DB_LSN *lsnp;
3075 db_recops notused2;
3076 void *lvhp;
3077 {
3078 __heap_trunc_meta_args *argp;
3079 DB_LOG_VRFY_INFO *lvh;
3080 int ret;
3081
3082 notused2 = DB_TXN_LOG_VERIFY;
3083 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3084
3085 if ((ret =
3086 __heap_trunc_meta_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3087 return (ret);
3088
3089 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3090 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
3091 if ((ret = __lv_on_heap_log(lvh, *lsnp, argp->fileid)) != 0)
3092 goto err;
3093 out:
3094
3095 err:
3096
3097 __os_free(env, argp);
3098 return (ret);
3099 }
3100
3101 /*
3102 * PUBLIC: int __heap_trunc_page_verify
3103 * PUBLIC: __P((ENV *, DBT *, DB_LSN *, db_recops, void *));
3104 */
3105 int
__heap_trunc_page_verify(env,dbtp,lsnp,notused2,lvhp)3106 __heap_trunc_page_verify(env, dbtp, lsnp, notused2, lvhp)
3107 ENV *env;
3108 DBT *dbtp;
3109 DB_LSN *lsnp;
3110 db_recops notused2;
3111 void *lvhp;
3112 {
3113 __heap_trunc_page_args *argp;
3114 DB_LOG_VRFY_INFO *lvh;
3115 int ret;
3116
3117 notused2 = DB_TXN_LOG_VERIFY;
3118 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3119
3120 if ((ret =
3121 __heap_trunc_page_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3122 return (ret);
3123
3124 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3125 ON_PAGE_UPDATE(lvh, *lsnp, argp, argp->pgno);
3126 if ((ret = __lv_on_heap_log(lvh, *lsnp, argp->fileid)) != 0)
3127 goto err;
3128 out:
3129
3130 err:
3131 __os_free(env, argp);
3132 return (ret);
3133 }
3134 #endif
3135
3136 #ifdef HAVE_QUEUE
3137 /*
3138 * PUBLIC: int __qam_incfirst_verify __P((ENV *, DBT *, DB_LSN *,
3139 * PUBLIC: db_recops, void *));
3140 */
3141 int
__qam_incfirst_verify(env,dbtp,lsnp,notused2,lvhp)3142 __qam_incfirst_verify(env, dbtp, lsnp, notused2, lvhp)
3143 ENV *env;
3144 DBT *dbtp;
3145 DB_LSN *lsnp;
3146 db_recops notused2;
3147 void *lvhp;
3148 {
3149 __qam_incfirst_args *argp;
3150 DB_LOG_VRFY_INFO *lvh;
3151 int ret;
3152
3153 notused2 = DB_TXN_LOG_VERIFY;
3154 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3155
3156 if ((ret =
3157 __qam_incfirst_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3158 return (ret);
3159
3160 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3161 if ((ret = __lv_on_qam_log(lvh, *lsnp, argp->fileid)) != 0)
3162 goto err;
3163
3164 out:
3165
3166 err:
3167
3168 __os_free(env, argp);
3169
3170 return (ret);
3171 }
3172
3173 /*
3174 * PUBLIC: int __qam_mvptr_verify __P((ENV *, DBT *, DB_LSN *,
3175 * PUBLIC: db_recops, void *));
3176 */
3177 int
__qam_mvptr_verify(env,dbtp,lsnp,notused2,lvhp)3178 __qam_mvptr_verify(env, dbtp, lsnp, notused2, lvhp)
3179 ENV *env;
3180 DBT *dbtp;
3181 DB_LSN *lsnp;
3182 db_recops notused2;
3183 void *lvhp;
3184 {
3185 __qam_mvptr_args *argp;
3186 DB_LOG_VRFY_INFO *lvh;
3187 int ret;
3188
3189 notused2 = DB_TXN_LOG_VERIFY;
3190 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3191
3192 if ((ret =
3193 __qam_mvptr_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3194 return (ret);
3195
3196 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3197 if ((ret = __lv_on_qam_log(lvh, *lsnp, argp->fileid)) != 0)
3198 goto err;
3199
3200 out:
3201
3202 err:
3203
3204 __os_free(env, argp);
3205
3206 return (ret);
3207 }
3208
3209 /*
3210 * PUBLIC: int __qam_del_verify __P((ENV *, DBT *, DB_LSN *,
3211 * PUBLIC: db_recops, void *));
3212 */
3213 int
__qam_del_verify(env,dbtp,lsnp,notused2,lvhp)3214 __qam_del_verify(env, dbtp, lsnp, notused2, lvhp)
3215 ENV *env;
3216 DBT *dbtp;
3217 DB_LSN *lsnp;
3218 db_recops notused2;
3219 void *lvhp;
3220 {
3221 __qam_del_args *argp;
3222 DB_LOG_VRFY_INFO *lvh;
3223 int ret;
3224
3225 notused2 = DB_TXN_LOG_VERIFY;
3226 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3227
3228 if ((ret =
3229 __qam_del_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3230 return (ret);
3231
3232 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3233 if ((ret = __lv_on_qam_log(lvh, *lsnp, argp->fileid)) != 0)
3234 goto err;
3235
3236 out:
3237
3238 err:
3239
3240 __os_free(env, argp);
3241
3242 return (ret);
3243 }
3244
3245 /*
3246 * PUBLIC: int __qam_add_verify __P((ENV *, DBT *, DB_LSN *,
3247 * PUBLIC: db_recops, void *));
3248 */
3249 int
__qam_add_verify(env,dbtp,lsnp,notused2,lvhp)3250 __qam_add_verify(env, dbtp, lsnp, notused2, lvhp)
3251 ENV *env;
3252 DBT *dbtp;
3253 DB_LSN *lsnp;
3254 db_recops notused2;
3255 void *lvhp;
3256 {
3257 __qam_add_args *argp;
3258 DB_LOG_VRFY_INFO *lvh;
3259 int ret;
3260
3261 notused2 = DB_TXN_LOG_VERIFY;
3262 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3263
3264 if ((ret =
3265 __qam_add_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3266 return (ret);
3267
3268 LOG_VRFY_PROC(lvh, *lsnp, argp, argp->fileid);
3269 if ((ret = __lv_on_qam_log(lvh, *lsnp, argp->fileid)) != 0)
3270 goto err;
3271
3272 out:
3273
3274 err:
3275
3276 __os_free(env, argp);
3277
3278 return (ret);
3279 }
3280
3281 /*
3282 * PUBLIC: int __qam_delext_verify __P((ENV *, DBT *, DB_LSN *,
3283 * PUBLIC: db_recops, void *));
3284 */
3285 int
__qam_delext_verify(env,dbtp,lsnp,notused2,lvhp)3286 __qam_delext_verify(env, dbtp, lsnp, notused2, lvhp)
3287 ENV *env;
3288 DBT *dbtp;
3289 DB_LSN *lsnp;
3290 db_recops notused2;
3291 void *lvhp;
3292 {
3293 __qam_delext_args *argp;
3294 DB_LOG_VRFY_INFO *lvh;
3295 int ret;
3296
3297 notused2 = DB_TXN_LOG_VERIFY;
3298 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3299
3300 if ((ret =
3301 __qam_delext_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
3302 return (ret);
3303
3304 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3305 if ((ret = __lv_on_qam_log(lvh, *lsnp, argp->fileid)) != 0)
3306 goto err;
3307
3308 out:
3309
3310 err:
3311
3312 __os_free(env, argp);
3313
3314 return (ret);
3315 }
3316 #endif
3317
3318 /*
3319 * PUBLIC: int __txn_regop_42_verify __P((ENV *, DBT *, DB_LSN *,
3320 * PUBLIC: db_recops, void *));
3321 */
3322 int
__txn_regop_42_verify(env,dbtp,lsnp,notused2,lvhp)3323 __txn_regop_42_verify(env, dbtp, lsnp, notused2, lvhp)
3324 ENV *env;
3325 DBT *dbtp;
3326 DB_LSN *lsnp;
3327 db_recops notused2;
3328 void *lvhp;
3329 {
3330 __txn_regop_42_args *argp;
3331 DB_LOG_VRFY_INFO *lvh;
3332 int ret;
3333
3334 notused2 = DB_TXN_LOG_VERIFY;
3335 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3336
3337 if ((ret = __txn_regop_42_read(env, dbtp->data, &argp)) != 0)
3338 return (ret);
3339
3340 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
3341 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
3342 err:
3343
3344 __os_free(env, argp);
3345
3346 return (ret);
3347 }
3348
3349 /*
3350 * PUBLIC: int __txn_regop_verify __P((ENV *, DBT *, DB_LSN *,
3351 * PUBLIC: db_recops, void *));
3352 */
3353 int
__txn_regop_verify(env,dbtp,lsnp,notused2,lvhp)3354 __txn_regop_verify(env, dbtp, lsnp, notused2, lvhp)
3355 ENV *env;
3356 DBT *dbtp;
3357 DB_LSN *lsnp;
3358 db_recops notused2;
3359 void *lvhp;
3360 {
3361 __txn_regop_args *argp;
3362 DB_LOG_VRFY_INFO *lvh;
3363 int ret, ret2, started;
3364 VRFY_TXN_INFO *ptvi, *pptvi;
3365 VRFY_TIMESTAMP_INFO tsinfo;
3366
3367 ptvi = pptvi = NULL;
3368 notused2 = DB_TXN_LOG_VERIFY;
3369 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3370 ret = ret2 = started = 0;
3371
3372 if ((ret = __txn_regop_read(env, dbtp->data, &argp)) != 0)
3373 return (ret);
3374
3375 /*
3376 * The __lv_log_fwdscr_oncmt call must precede LOG_VRFY_PROC otherwise
3377 * this txn will be taken as an aborted txn.
3378 */
3379 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
3380 if ((ret = __lv_log_fwdscr_oncmt(lvh, *lsnp,
3381 argp->txnp->txnid, 0, argp->timestamp)) != 0)
3382 goto err;
3383
3384 tsinfo.lsn = *lsnp;
3385 tsinfo.timestamp = argp->timestamp;
3386 tsinfo.logtype = argp->type;
3387 if ((ret = __put_timestamp_info(lvh, &tsinfo)) != 0)
3388 goto err;
3389 goto out; /* We are done. */
3390 }
3391
3392 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3393 if ((ret = __del_txn_pages(lvh, argp->txnp->txnid)) != 0 &&
3394 ret != DB_NOTFOUND)
3395 goto err;/* Some txns may have updated no pages. */
3396 if ((ret = __lv_on_timestamp(lvh, lsnp, argp->timestamp,
3397 DB___txn_regop)) != 0)
3398 goto err;
3399 if ((ret = __get_txn_vrfy_info(lvh, argp->txnp->txnid, &ptvi)) != 0 &&
3400 ret != DB_NOTFOUND)
3401 goto err;
3402 if (ret == DB_NOTFOUND && !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
3403 if (!IS_ZERO_LSN(lvh->lv_config->start_lsn) &&
3404 (ret2 = __txn_started(lvh, lvh->lv_config->start_lsn,
3405 argp->txnp->txnid, &started)) == 0 && started != 0) {
3406 ret = 0;
3407 goto err;
3408 }
3409 if (ret2 != 0)
3410 ret = ret2;
3411 __db_errx(lvh->dbenv->env, DB_STR_A("2547",
3412 "[%lu][%lu] Can not find an active transaction's "
3413 "information, txnid: %lx.", "%lu %lu %lx"),
3414 (u_long)lsnp->file, (u_long)lsnp->offset,
3415 (u_long)argp->txnp->txnid);
3416 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
3417
3418 }
3419
3420 if (ptvi == NULL) {
3421 if (ret == DB_NOTFOUND &&
3422 F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
3423 ret = 0;
3424 goto out;
3425
3426 }
3427 DB_ASSERT(env, ptvi->ptxnid == 0);
3428
3429 /*
3430 * This log record is only logged when committing a outermost txn,
3431 * child txn commits are logged in __txn_child_log.
3432 */
3433 if (ptvi->ptxnid == 0) {
3434 if (ptvi->status == TXN_STAT_PREPARE)
3435 lvh->ntxn_prep--;
3436 else if (ptvi->status == TXN_STAT_ACTIVE)
3437 lvh->ntxn_active--;
3438 lvh->ntxn_commit++;
3439 }
3440 ptvi->status = TXN_STAT_COMMIT;
3441 DB_ASSERT(env, IS_ZERO_LSN(ptvi->last_lsn));
3442 ptvi->last_lsn = *lsnp;
3443 if ((ret = __put_txn_vrfy_info(lvh, ptvi)) != 0)
3444 goto err;
3445
3446 /* Report txn stats. */
3447 if (F_ISSET(lvh, DB_LOG_VERIFY_VERBOSE))
3448 __db_msg(env, DB_STR_A("2548",
3449 "[%lu][%lu] The number of active, committed and aborted "
3450 "child txns of txn %lx: %u, %u, %u.",
3451 "%lu %lu %lx %u %u %u"), (u_long)lsnp->file,
3452 (u_long)lsnp->offset, (u_long)ptvi->txnid,
3453 ptvi->nchild_active, ptvi->nchild_commit,
3454 ptvi->nchild_abort);
3455 out:
3456 err:
3457
3458 if (pptvi != NULL && (ret2 = __free_txninfo(pptvi)) != 0 && ret == 0)
3459 ret = ret2;
3460 if (ptvi != NULL && (ret2 = __free_txninfo(ptvi)) != 0 && ret == 0)
3461 ret = ret2;
3462 __os_free(env, argp);
3463
3464 return (ret);
3465 }
3466
3467 /*
3468 * PUBLIC: int __txn_ckp_42_verify __P((ENV *, DBT *, DB_LSN *,
3469 * PUBLIC: db_recops, void *));
3470 */
3471 int
__txn_ckp_42_verify(env,dbtp,lsnp,notused2,lvhp)3472 __txn_ckp_42_verify(env, dbtp, lsnp, notused2, lvhp)
3473 ENV *env;
3474 DBT *dbtp;
3475 DB_LSN *lsnp;
3476 db_recops notused2;
3477 void *lvhp;
3478 {
3479 __txn_ckp_42_args *argp;
3480 DB_LOG_VRFY_INFO *lvh;
3481 int ret;
3482
3483 notused2 = DB_TXN_LOG_VERIFY;
3484 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3485
3486 if ((ret = __txn_ckp_42_read(env, dbtp->data, &argp)) != 0)
3487 return (ret);
3488
3489 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
3490 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
3491 err:
3492
3493 __os_free(env, argp);
3494
3495 return (ret);
3496 }
3497
3498 /*
3499 * PUBLIC: int __txn_ckp_verify __P((ENV *, DBT *, DB_LSN *,
3500 * PUBLIC: db_recops, void *));
3501 */
3502 int
__txn_ckp_verify(env,dbtp,lsnp,notused2,lvhp)3503 __txn_ckp_verify(env, dbtp, lsnp, notused2, lvhp)
3504 ENV *env;
3505 DBT *dbtp;
3506 DB_LSN *lsnp;
3507 db_recops notused2;
3508 void *lvhp;
3509 {
3510 __txn_ckp_args *argp;
3511 DB_LOG_VRFY_INFO *lvh;
3512 VRFY_CKP_INFO *lastckp, ckpinfo;
3513 int ret;
3514 struct __ckp_verify_params cvp;
3515 VRFY_TIMESTAMP_INFO tsinfo;
3516 char timebuf[CTIME_BUFLEN];
3517 time_t ckp_time, lastckp_time;
3518
3519 lastckp = NULL;
3520 notused2 = DB_TXN_LOG_VERIFY;
3521 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3522 memset(&ckpinfo, 0, sizeof(ckpinfo));
3523 memset(&cvp, 0, sizeof(cvp));
3524
3525 if ((ret = __txn_ckp_read(env, dbtp->data, &argp)) != 0)
3526 return (ret);
3527
3528 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3529
3530 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
3531 tsinfo.lsn = *lsnp;
3532 tsinfo.timestamp = argp->timestamp;
3533 tsinfo.logtype = argp->type;
3534 /*
3535 * Store the first ckp_lsn, or the least one greater than the
3536 * starting point. There will be no partial txns after
3537 * valid_lsn.
3538 */
3539 if (!(!IS_ZERO_LSN(lvh->lv_config->start_lsn) &&
3540 LOG_COMPARE(&(lvh->lv_config->start_lsn),
3541 &(argp->ckp_lsn)) > 0))
3542 lvh->valid_lsn = argp->ckp_lsn;
3543 if ((ret = __put_timestamp_info(lvh, &tsinfo)) != 0)
3544 goto err;
3545 goto out;/* We are done, exit. */
3546 }
3547 lvh->nckp++;
3548 ckp_time = (time_t)argp->timestamp;
3549 __db_msg(env, DB_STR_A("2549",
3550 "[%lu][%lu] Checkpoint record, ckp_lsn: [%lu][%lu], "
3551 "timestamp: %s. Total checkpoint: %u",
3552 "%lu %lu %lu %lu %s %u"), (u_long)lsnp->file,
3553 (u_long)lsnp->offset, (u_long)argp->ckp_lsn.file,
3554 (u_long)argp->ckp_lsn.offset,
3555 __os_ctime(&ckp_time, timebuf), lvh->nckp);
3556
3557 if ((ret = __lv_on_timestamp(lvh, lsnp,
3558 argp->timestamp, DB___txn_ckp)) != 0)
3559 goto err;
3560 if (((ret = __get_last_ckp_info(lvh, &lastckp)) != 0) &&
3561 ret != DB_NOTFOUND)
3562 return (ret);
3563 if (ret == DB_NOTFOUND)
3564 goto cont;
3565
3566 if (LOG_COMPARE(&(argp->last_ckp), &(lastckp->lsn)) != 0) {
3567 __db_errx(env, DB_STR_A("2550",
3568 "[%lu][%lu] Last known checkpoint [%lu][%lu] not equal "
3569 "to last_ckp :[%lu][%lu]. Some checkpoint log records "
3570 "may be missing.", "%lu %lu %lu %lu %lu %lu"),
3571 (u_long)lsnp->file, (u_long)lsnp->offset,
3572 (u_long)lastckp->lsn.file, (u_long)lastckp->lsn.offset,
3573 (u_long)argp->last_ckp.file, (u_long)argp->last_ckp.offset);
3574 ret = DB_LOG_VERIFY_BAD;
3575 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
3576 }
3577
3578 /*
3579 * Checkpoint are generally not performed quite often, so we see this
3580 * as an error, but in txn commits we see it as a warning.
3581 */
3582 lastckp_time = (time_t)lastckp->timestamp;
3583 if (argp->timestamp < lastckp->timestamp) {
3584 __db_errx(env, DB_STR_A("2551",
3585 "[%lu][%lu] Last known checkpoint [%lu, %lu] has a "
3586 "timestamp %s smaller than this checkpoint timestamp %s.",
3587 "%lu %lu %lu %lu %s %s"), (u_long)lsnp->file,
3588 (u_long)lsnp->offset, (u_long)lastckp->lsn.file,
3589 (u_long)lastckp->lsn.offset,
3590 __os_ctime(&lastckp_time, timebuf),
3591 __os_ctime(&ckp_time, timebuf));
3592 ret = DB_LOG_VERIFY_BAD;
3593 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
3594 }
3595
3596 cont:
3597 cvp.env = env;
3598 cvp.lsn = *lsnp;
3599 cvp.ckp_lsn = argp->ckp_lsn;
3600
3601 /*
3602 * Verify that all active txn's first lsn is greater than
3603 * argp->ckp_lsn.
3604 */
3605 if ((ret = __iterate_txninfo(lvh, 0, 0,
3606 __lv_ckp_vrfy_handler, &cvp)) != 0)
3607 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
3608 ckpinfo.timestamp = argp->timestamp;
3609 ckpinfo.lsn = *lsnp;
3610 ckpinfo.ckplsn = argp->ckp_lsn;
3611
3612 if ((ret = __put_ckp_info(lvh, &ckpinfo)) != 0)
3613 goto err;
3614 out:
3615 err:
3616 if (argp)
3617 __os_free(env, argp);
3618 if (lastckp)
3619 __os_free(env, lastckp);
3620 return (ret);
3621 }
3622
3623 static int
__lv_ckp_vrfy_handler(lvinfo,txninfop,param)3624 __lv_ckp_vrfy_handler(lvinfo, txninfop, param)
3625 DB_LOG_VRFY_INFO *lvinfo;
3626 VRFY_TXN_INFO *txninfop;
3627 void *param;
3628 {
3629 struct __ckp_verify_params *cvp;
3630 int ret;
3631
3632 ret = 0;
3633 cvp = (struct __ckp_verify_params *)param;
3634 /* ckp_lsn should be less than any active txn's first lsn. */
3635 if (txninfop->status == TXN_STAT_ACTIVE && LOG_COMPARE(&(cvp->ckp_lsn),
3636 &(txninfop->first_lsn)) >= 0) {
3637 __db_errx(cvp->env, DB_STR_A("2552",
3638 "[%lu][%lu] ckp log's ckp_lsn [%lu][%lu] greater than "
3639 "active txn %lx 's first lsn [%lu][%lu]",
3640 "%lu %lu %lu %lu %lx %lu %lu"),
3641 (u_long)cvp->lsn.file, (u_long)cvp->lsn.offset,
3642 (u_long)cvp->ckp_lsn.file, (u_long)cvp->ckp_lsn.offset,
3643 (u_long)txninfop->txnid,
3644 (u_long)txninfop->first_lsn.file,
3645 (u_long)txninfop->first_lsn.offset);
3646 lvinfo->flags |= DB_LOG_VERIFY_ERR;
3647 if (!F_ISSET(lvinfo, DB_LOG_VERIFY_CAF))
3648 /* Stop the iteration. */
3649 ret = DB_LOG_VERIFY_BAD;
3650 }
3651
3652 return (ret);
3653 }
3654
3655 /*
3656 * PUBLIC: int __txn_child_verify __P((ENV *, DBT *, DB_LSN *,
3657 * PUBLIC: db_recops, void *));
3658 */
3659 int
__txn_child_verify(env,dbtp,lsnp,notused2,lvhp)3660 __txn_child_verify(env, dbtp, lsnp, notused2, lvhp)
3661 ENV *env;
3662 DBT *dbtp;
3663 DB_LSN *lsnp;
3664 db_recops notused2;
3665 void *lvhp;
3666 {
3667 __txn_child_args *argp;
3668 DB_LOG_VRFY_INFO *lvh;
3669 VRFY_TXN_INFO *ptvi, *ptvi2;
3670 int ret, ret2, started;
3671
3672 /*
3673 * This function is called when a txn T0's child txn T1 commits. Before
3674 * this log record we don't know T0 and T1's relationship. This means
3675 * we never know the T0 has an active child txn T1, all child txns
3676 * we know are committed.
3677 */
3678 notused2 = DB_TXN_LOG_VERIFY;
3679 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3680 ptvi = ptvi2 = NULL;
3681 ret = ret2 = started = 0;
3682
3683 if ((ret = __txn_child_read(env, dbtp->data, &argp)) != 0)
3684 return (ret);
3685
3686 /*
3687 * The __lv_log_fwdscr_oncmt call must precede LOG_VRFY_PROC otherwise
3688 * this txn will be taken as an aborted txn.
3689 */
3690 if (F_ISSET(lvh, DB_LOG_VERIFY_FORWARD)) {
3691 if ((ret = __lv_log_fwdscr_oncmt(lvh, argp->c_lsn, argp->child,
3692 argp->txnp->txnid, 0)) != 0)
3693 goto err;
3694 if ((ret = __lv_log_fwdscr_onrec(lvh, argp->txnp->txnid,
3695 argp->type, argp->prev_lsn, *lsnp)) != 0)
3696 goto err;
3697 goto out;/* We are done. */
3698 }
3699 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3700 if ((ret = __return_txn_pages(lvh, argp->child,
3701 argp->txnp->txnid)) != 0 && ret != DB_NOTFOUND)
3702 goto err;/* Some txns may have updated no pages. */
3703
3704 /* Update parent txn info. */
3705 if ((ret = __get_txn_vrfy_info(lvh, argp->txnp->txnid, &ptvi)) != 0 &&
3706 ret != DB_NOTFOUND)
3707 goto err;
3708 if (ret == DB_NOTFOUND && !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
3709 if (!IS_ZERO_LSN(lvh->lv_config->start_lsn) &&
3710 ((ret2 = __txn_started(lvh, lvh->lv_config->start_lsn,
3711 argp->txnp->txnid, &started)) == 0) && started != 0) {
3712 ret = 0;
3713 goto err;
3714 }
3715 if (ret2 != 0)
3716 ret = ret2;
3717 __db_errx(lvh->dbenv->env, DB_STR_A("2553",
3718 "[%lu][%lu] Can not find an active transaction's "
3719 "information, txnid: %lx.", "%lu %lu %lx"),
3720 (u_long)lsnp->file, (u_long)lsnp->offset,
3721 (u_long)argp->txnp->txnid);
3722 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
3723
3724 }
3725 if (ptvi == NULL) {
3726 if (ret == DB_NOTFOUND &&
3727 F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
3728 ret = 0;
3729 goto out;
3730
3731 }
3732 ptvi->nchild_commit++;
3733 /*
3734 * The start of this child txn caused lvh->ntxn_active to be
3735 * incremented unnecessarily, so decrement it.
3736 */
3737 lvh->ntxn_active--;
3738 if (ptvi->status != TXN_STAT_ACTIVE) {
3739 __db_errx(lvh->dbenv->env, DB_STR_A("2554",
3740 "[%lu][%lu] Parent txn %lx ended "
3741 "before child txn %lx ends.", "%lu %lu %lx %lx"),
3742 (u_long)lsnp->file, (u_long)lsnp->offset,
3743 (u_long)argp->txnp->txnid, (u_long)argp->child);
3744 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
3745 }
3746 if ((ret = __put_txn_vrfy_info(lvh, ptvi)) != 0)
3747 goto err;
3748
3749 /* Update child txn info. */
3750 if ((ret = __get_txn_vrfy_info(lvh, argp->child, &ptvi2)) != 0 &&
3751 ret != DB_NOTFOUND)
3752 goto err;
3753 if (ret == DB_NOTFOUND && !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
3754 if (!IS_ZERO_LSN(lvh->lv_config->start_lsn) &&
3755 ((ret2 = __txn_started(lvh, lvh->lv_config->start_lsn,
3756 argp->child, &started)) == 0) && started != 0) {
3757 ret = 0;
3758 goto err;
3759 }
3760 if (ret2 != 0)
3761 ret = ret2;
3762 __db_errx(lvh->dbenv->env, DB_STR_A("2555",
3763 "[%lu][%lu] Can not find an active "
3764 "transaction's information, txnid: %lx.",
3765 "%lu %lu %lx"), (u_long)lsnp->file,
3766 (u_long)lsnp->offset, (u_long)argp->child);
3767 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
3768
3769 }
3770 if (ptvi2 == NULL) {
3771 if (ret == DB_NOTFOUND &&
3772 F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
3773 ret = 0;
3774 goto out;
3775
3776 }
3777 if (ptvi2->status != TXN_STAT_ACTIVE) {
3778 __db_errx(lvh->dbenv->env, DB_STR_A("2556",
3779 "[%lu][%lu] Txn %lx ended before it commits.",
3780 "%lu %lu %lx"), (u_long)lsnp->file,
3781 (u_long)lsnp->offset, (u_long)argp->child);
3782 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
3783 }
3784 ptvi2->status = TXN_STAT_COMMIT;
3785 if ((ret = __put_txn_vrfy_info(lvh, ptvi2)) != 0)
3786 goto err;
3787 out:
3788 err:
3789 __os_free(env, argp);
3790 if (ptvi != NULL && (ret2 = __free_txninfo(ptvi)) != 0 && ret == 0)
3791 ret = ret2;
3792 if (ptvi2 != NULL && (ret2 = __free_txninfo(ptvi2)) != 0 && ret == 0)
3793 ret = ret2;
3794
3795 return (ret);
3796 }
3797
3798 /*
3799 * PUBLIC: int __txn_xa_regop_42_verify __P((ENV *, DBT *, DB_LSN *,
3800 * PUBLIC: db_recops, void *));
3801 */
3802 int
__txn_xa_regop_42_verify(env,dbtp,lsnp,notused2,lvhp)3803 __txn_xa_regop_42_verify(env, dbtp, lsnp, notused2, lvhp)
3804 ENV *env;
3805 DBT *dbtp;
3806 DB_LSN *lsnp;
3807 db_recops notused2;
3808 void *lvhp;
3809 {
3810 __txn_xa_regop_42_args *argp;
3811 DB_LOG_VRFY_INFO *lvh;
3812 int ret;
3813
3814 notused2 = DB_TXN_LOG_VERIFY;
3815 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3816
3817 if ((ret = __txn_xa_regop_42_read(env, dbtp->data, &argp)) != 0)
3818 return (ret);
3819
3820 ON_NOT_SUPPORTED(env, lvh, *lsnp, argp->type);
3821 /* LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID); */
3822 err:
3823 __os_free(env, argp);
3824
3825 return (ret);
3826 }
3827
3828 /*
3829 * PUBLIC: int __txn_prepare_verify __P((ENV *, DBT *, DB_LSN *,
3830 * PUBLIC: db_recops, void *));
3831 */
3832 int
__txn_prepare_verify(env,dbtp,lsnp,notused2,lvhp)3833 __txn_prepare_verify(env, dbtp, lsnp, notused2, lvhp)
3834 ENV *env;
3835 DBT *dbtp;
3836 DB_LSN *lsnp;
3837 db_recops notused2;
3838 void *lvhp;
3839 {
3840 __txn_prepare_args *argp;
3841 DB_LOG_VRFY_INFO *lvh;
3842 VRFY_TXN_INFO *ptvi;
3843 int ret, ret2, started;
3844
3845 ret = ret2 = started = 0;
3846 ptvi = NULL;
3847 notused2 = DB_TXN_LOG_VERIFY;
3848 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3849
3850 if ((ret = __txn_prepare_read(env, dbtp->data, &argp)) != 0)
3851 return (ret);
3852
3853 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3854
3855 if ((ret = __get_txn_vrfy_info(lvh, argp->txnp->txnid, &ptvi)) != 0 &&
3856 ret != DB_NOTFOUND)
3857 goto err;
3858
3859 if (ret == DB_NOTFOUND && !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
3860 if (!IS_ZERO_LSN(lvh->lv_config->start_lsn) &&
3861 ((ret2 = __txn_started(lvh, lvh->lv_config->start_lsn,
3862 argp->txnp->txnid, &started)) == 0) && started != 0) {
3863 ret = 0;
3864 goto err;
3865 }
3866 if (ret2 != 0)
3867 ret = ret2;
3868 __db_errx(lvh->dbenv->env, DB_STR_A("2557",
3869 "[%lu][%lu] Can not find an active transaction's "
3870 "information, txnid: %lx.", "%lu %lu %lx"),
3871 (u_long)lsnp->file, (u_long)lsnp->offset,
3872 (u_long)argp->txnp->txnid);
3873 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
3874
3875 }
3876 if (ptvi == NULL) {
3877 if (ret == DB_NOTFOUND &&
3878 F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
3879 ret = 0;
3880 goto out;
3881
3882 }
3883 DB_ASSERT(env,
3884 (IS_ZERO_LSN(ptvi->prep_lsn) && ptvi->status != TXN_STAT_PREPARE) ||
3885 (!IS_ZERO_LSN(ptvi->prep_lsn) && ptvi->status == TXN_STAT_PREPARE));
3886
3887 lvh->ntxn_prep++;
3888 lvh->ntxn_active--;
3889
3890 if (!IS_ZERO_LSN(ptvi->prep_lsn)) {/* Prepared more than once. */
3891
3892 __db_errx(lvh->dbenv->env, DB_STR_A("2558",
3893 "[%lu][%lu] Multiple txn_prepare log record for "
3894 "transaction %lx, previous prepare lsn: [%lu, %lu].",
3895 "%lu %lu %lx %lu %lu"), (u_long)lsnp->file,
3896 (u_long)lsnp->offset, (u_long)argp->txnp->txnid,
3897 (u_long)ptvi->prep_lsn.file, (u_long)ptvi->prep_lsn.offset);
3898 } else {
3899 ptvi->prep_lsn = *lsnp;
3900 ptvi->status = TXN_STAT_PREPARE;
3901 }
3902 ret = __put_txn_vrfy_info(lvh, ptvi);
3903 out:
3904 err:
3905 __os_free(env, argp);
3906 if (ptvi != NULL && (ret2 = __free_txninfo(ptvi)) != 0 && ret == 0)
3907 ret = ret2;
3908 return (ret);
3909 }
3910
3911 /*
3912 * PUBLIC: int __txn_recycle_verify __P((ENV *, DBT *, DB_LSN *,
3913 * PUBLIC: db_recops, void *));
3914 */
3915 int
__txn_recycle_verify(env,dbtp,lsnp,notused2,lvhp)3916 __txn_recycle_verify(env, dbtp, lsnp, notused2, lvhp)
3917 ENV *env;
3918 DBT *dbtp;
3919 DB_LSN *lsnp;
3920 db_recops notused2;
3921 void *lvhp;
3922 {
3923 __txn_recycle_args *argp;
3924 DB_LOG_VRFY_INFO *lvh;
3925 int ret;
3926
3927 notused2 = DB_TXN_LOG_VERIFY;
3928 lvh = (DB_LOG_VRFY_INFO *)lvhp;
3929 ret = 0;
3930
3931 if ((ret = __txn_recycle_read(env, dbtp->data, &argp)) != 0)
3932 return (ret);
3933
3934 LOG_VRFY_PROC(lvh, *lsnp, argp, INVAL_DBREGID);
3935
3936 /* Add recycle info for all txns whose ID is in the [min, max] range. */
3937 ret = __add_recycle_lsn_range(lvh, lsnp, argp->min, argp->max);
3938
3939 out:
3940
3941 err:
3942
3943 __os_free(env, argp);
3944 return (ret);
3945 }
3946
3947 /* Handle log types having timestamps, so far only __txn_ckp and __txn_regop. */
3948 static int
__lv_on_timestamp(lvh,lsn,timestamp,logtype)3949 __lv_on_timestamp(lvh, lsn, timestamp, logtype)
3950 DB_LOG_VRFY_INFO *lvh;
3951 const DB_LSN *lsn;
3952 int32_t timestamp;
3953 u_int32_t logtype;
3954 {
3955 VRFY_TIMESTAMP_INFO *ltsinfo;
3956 int ret;
3957
3958 ltsinfo = NULL;
3959 ret = 0;
3960 if ((ret = __get_latest_timestamp_info(lvh, *lsn, <sinfo)) == 0) {
3961 DB_ASSERT(lvh->dbenv->env, ltsinfo != NULL);
3962 if (ltsinfo->timestamp >= timestamp &&
3963 F_ISSET(lvh, DB_LOG_VERIFY_VERBOSE)) {
3964 __db_errx(lvh->dbenv->env, DB_STR_A("2559",
3965 "[%lu][%lu] [WARNING] This log record of type %s "
3966 "does not have a greater time stamp than "
3967 "[%lu, %lu] of type %s", "%lu %lu %s %lu %lu %s"),
3968 (u_long)lsn->file, (u_long)lsn->offset,
3969 LOGTYPE_NAME(lvh, logtype),
3970 (u_long)ltsinfo->lsn.file,
3971 (u_long)ltsinfo->lsn.offset,
3972 LOGTYPE_NAME(lvh, ltsinfo->logtype));
3973 lvh->flags |= DB_LOG_VERIFY_WARNING;
3974 }
3975 }
3976 if (ltsinfo != NULL)
3977 __os_free(lvh->dbenv->env, ltsinfo);
3978 if (ret == DB_NOTFOUND)
3979 ret = 0;
3980
3981 return (ret);
3982 }
3983
3984 /*
3985 * Called whenever the log record belongs to a transaction.
3986 */
3987 static int
__lv_on_txn_logrec(lvh,lsnp,prev_lsnp,txnp,type,dbregid)3988 __lv_on_txn_logrec(lvh, lsnp, prev_lsnp, txnp, type, dbregid)
3989 DB_LOG_VRFY_INFO *lvh;
3990 const DB_LSN *lsnp;
3991 const DB_LSN *prev_lsnp;
3992 const DB_TXN *txnp;
3993 u_int32_t type;
3994 int32_t dbregid;
3995 {
3996 DBT fid;
3997 VRFY_TXN_INFO *pvti;
3998 u_int32_t txnid;
3999 VRFY_FILEREG_INFO *fregp;
4000 int ret, ret2, started;
4001
4002 ret = ret2 = started = 0;
4003 pvti = NULL;
4004 fregp = NULL;
4005 lvh->lrtypes[type]++;/* Increment per-type log record count. */
4006 txnid = txnp->txnid;
4007 memset(&fid, 0, sizeof(fid));
4008
4009 if (dbregid == INVAL_DBREGID)
4010 goto cont;
4011 if ((ret = __get_filereg_by_dbregid(lvh, dbregid, &fregp)) != 0) {
4012 if (ret == DB_NOTFOUND) {
4013 /*
4014 * It's likely that we are verifying a subset of logs
4015 * and the DBREG_OPEN is outside the range.
4016 */
4017 if (!F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
4018 __db_msg(lvh->dbenv->env, DB_STR_A("2560",
4019 "[%lu][%lu] Transaction %lx is updating a "
4020 "db file %d not registered.",
4021 "%lu %lu %lx %d"),
4022 (u_long)lsnp->file, (u_long)lsnp->offset,
4023 (u_long)txnp->txnid, dbregid);
4024 goto cont;
4025 } else
4026 goto err;
4027 }
4028
4029 fid = fregp->fileid;
4030 cont:
4031 if (IS_ZERO_LSN(*prev_lsnp) &&
4032 (ret = __lv_on_new_txn(lvh, lsnp, txnp, type, dbregid, &fid)) != 0)
4033 goto err;
4034
4035 if ((ret = __get_txn_vrfy_info(lvh, txnid, &pvti)) != 0 &&
4036 ret != DB_NOTFOUND)
4037 goto err;
4038
4039 /* If can't find the txn, there is an internal error. */
4040 if (ret == DB_NOTFOUND && !F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL)) {
4041 /*
4042 * If verifying from middle, it's expected that txns begun
4043 * before start are not found.
4044 */
4045 if (!IS_ZERO_LSN(lvh->lv_config->start_lsn) && ((ret2 =
4046 __txn_started(lvh, lvh->lv_config->start_lsn, txnid,
4047 &started)) == 0) && started != 0) {
4048 ret = 0;
4049 goto out;/* We are done. */
4050 }
4051 if (ret2 != 0)
4052 ret = ret2;
4053
4054 __db_errx(lvh->dbenv->env, DB_STR_A("2561",
4055 "[%lu][%lu] Can not find an active transaction's "
4056 "information, txnid: %lx.", "%lu %lu %lx"),
4057 (u_long)lsnp->file, (u_long)lsnp->offset, (u_long)txnid);
4058 ON_ERROR(lvh, DB_LOG_VERIFY_INTERR);
4059 }
4060
4061 /* Can't proceed without the txn info. */
4062 if (pvti == NULL) {
4063 if (ret == DB_NOTFOUND && F_ISSET(lvh, DB_LOG_VERIFY_PARTIAL))
4064 ret = 0;
4065 goto out;
4066 }
4067
4068 /* Check if prev lsn is wrong, and some log records may be missing. */
4069 if (!IS_ZERO_LSN(*prev_lsnp) &&
4070 LOG_COMPARE(prev_lsnp, &(pvti->cur_lsn)) != 0) {
4071 __db_errx(lvh->dbenv->env, DB_STR_A("2562",
4072 "[%lu][%lu] Previous record for transaction %lx is "
4073 "[%lu][%lu] and prev_lsn is [%lu][%lu].",
4074 "%lu %lu %lx %lu %lu %lu %lu"), (u_long)lsnp->file,
4075 (u_long)lsnp->offset, (u_long)pvti->txnid,
4076 (u_long)pvti->cur_lsn.file, (u_long)pvti->cur_lsn.offset,
4077 (u_long)prev_lsnp->file, (u_long)prev_lsnp->offset);
4078 ret = DB_LOG_VERIFY_BAD;
4079 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
4080 }
4081
4082 /*
4083 * After the txn is prepared, the only valid log record for this txn
4084 * is the commit record.
4085 */
4086 if (pvti->status == TXN_STAT_PREPARE && type != DB___txn_regop) {
4087 __db_errx(lvh->dbenv->env, DB_STR_A("2563",
4088 "[%lu][%lu] Update action is performed in a "
4089 "prepared transaction %lx.", "%lu %lu %lx"),
4090 (u_long)lsnp->file, (u_long)lsnp->offset, (u_long)txnid);
4091 ret = DB_LOG_VERIFY_BAD;
4092 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
4093 }
4094 pvti->cur_lsn = *lsnp;
4095 pvti->flags = txnp->flags;
4096 if (dbregid != INVAL_DBREGID && fid.size > 0 &&
4097 (ret = __add_file_updated(pvti, &fid, dbregid)) != 0)
4098 goto err;
4099 if ((ret = __put_txn_vrfy_info(lvh, pvti)) != 0)
4100 goto err;
4101 out:
4102 err:
4103 if (pvti != NULL && (ret2 = __free_txninfo(pvti)) != 0 && ret == 0)
4104 ret = ret2;
4105 if (fregp != NULL &&
4106 (ret2 = __free_filereg_info(fregp)) != 0 && ret == 0)
4107 ret = ret2;
4108 return (ret);
4109 }
4110
4111 /*
4112 * Called whenever a new transaction is started, including child transactions.
4113 */
4114 static int
__lv_on_new_txn(lvh,lsnp,txnp,type,dbregid,fid)4115 __lv_on_new_txn (lvh, lsnp, txnp, type, dbregid, fid)
4116 DB_LOG_VRFY_INFO *lvh;
4117 const DB_LSN *lsnp;
4118 const DB_TXN *txnp;
4119 u_int32_t type;
4120 int32_t dbregid;
4121 const DBT *fid;
4122 {
4123 VRFY_TXN_INFO vti, *pvti, *vtip;
4124 int ret, tret;
4125 u_int32_t txnid;
4126 ENV *env;
4127
4128 ret = tret = 0;
4129 txnid = txnp->txnid;
4130 pvti = NULL;
4131 memset(&vti, 0, sizeof(vti));
4132 vti.txnid = txnid;
4133 env = lvh->dbenv->env;
4134 /* Log record type, may be used later. Pass lint checks. */
4135 COMPQUIET(type, 0);
4136
4137 /*
4138 * It's possible that the new txn is a child txn, we will decrement
4139 * this value in __txn_child_verify when we realize this, because
4140 * this value only records the number of outermost active txns.
4141 */
4142 lvh->ntxn_active++;
4143
4144 if ((ret = __get_txn_vrfy_info(lvh, txnid, &pvti)) != 0 &&
4145 ret != DB_NOTFOUND)
4146 goto err;
4147 if (ret == DB_NOTFOUND)
4148 vtip = &vti;
4149 else {/* The txnid is reused, may be illegal. */
4150 vtip = pvti;
4151 /*
4152 * If this txn id was recycled, this use is legal. A legal
4153 * recyclable txnid is immediately not recyclable after
4154 * it's recycled here. And it's impossible for vtip->status
4155 * to be TXN_STAT_ACTIVE, since we have made it TXN_STAT_ABORT
4156 * when we detected this txn id recycle just now.
4157 */
4158 if (vtip->num_recycle > 0 && LOG_COMPARE(&(vtip->recycle_lsns
4159 [vtip->num_recycle - 1]), lsnp) < 0) {
4160 DB_ASSERT(env, vtip->status != TXN_STAT_ACTIVE);
4161 if ((ret = __rem_last_recycle_lsn(vtip)) != 0)
4162 goto err;
4163 if ((ret = __clear_fileups(vtip)) != 0)
4164 goto err;
4165
4166 vtip->status = 0;
4167 ZERO_LSN(vtip->prep_lsn);
4168 ZERO_LSN(vtip->last_lsn);
4169
4170 vtip->nchild_active = 0;
4171 vtip->nchild_commit = 0;
4172 vtip->nchild_abort = 0;
4173 /*
4174 * We may goto the else branch if this txn has child txns
4175 * before any updates done on its behalf. So we should
4176 * exclude this possibility to conclude a failed verification.
4177 */
4178 } else if (vtip->nchild_active + vtip->nchild_commit +
4179 vtip->nchild_abort == 0) {
4180 __db_errx(lvh->dbenv->env, DB_STR_A("2564",
4181 "[%lu][%lu] Transaction id %lx reused without "
4182 "being recycled with a __txn_recycle.",
4183 "%lu %lu %lx"),
4184 (u_long)lsnp->file, (u_long)lsnp->offset,
4185 (u_long)txnid);
4186 ret = DB_LOG_VERIFY_BAD;
4187 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
4188 }
4189 }
4190
4191 vtip->first_lsn = *lsnp;
4192 vtip->cur_lsn = *lsnp;
4193 vtip->flags = txnp->flags;
4194
4195 /*
4196 * It's possible that the first log rec does not update any file,
4197 * like the __txn_child type of record.
4198 */
4199 if (fid->size > 0 && (ret =
4200 __add_file_updated(vtip, fid, dbregid)) != 0)
4201 goto err;
4202 if ((ret = __put_txn_vrfy_info(lvh, vtip)) != 0)
4203 goto err;
4204
4205 err:
4206 if (pvti != NULL && (tret = __free_txninfo(pvti)) != 0 && ret == 0)
4207 ret = tret;
4208 if ((tret = __free_txninfo_stack(&vti)) != 0 && ret == 0)
4209 ret = tret;
4210
4211 return (ret);
4212 }
4213
4214 /* Called when we detect that a new log file is used. */
4215 static int
__lv_new_logfile_vrfy(lvh,lsnp)4216 __lv_new_logfile_vrfy(lvh, lsnp)
4217 DB_LOG_VRFY_INFO *lvh;
4218 const DB_LSN *lsnp;
4219 {
4220 int ret;
4221
4222 ret = 0;
4223 if (IS_ZERO_LSN(lvh->last_lsn) || lvh->last_lsn.file == lsnp->file) {
4224 lvh->last_lsn = *lsnp;
4225 return (0);
4226 }
4227
4228 /*
4229 * If file number changed, it must have been incremented,
4230 * and the offset is 0.
4231 * */
4232 if (lsnp->file - lvh->last_lsn.file != 1 || lsnp->offset !=
4233 __lv_first_offset(lvh->dbenv->env)) {
4234 __db_errx(lvh->dbenv->env,
4235 "[%lu][%lu] Last log record verified ([%lu][%lu]) is not "
4236 "immidiately before the current log record.",
4237 (u_long)lsnp->file, (u_long)lsnp->offset,
4238 (u_long)lvh->last_lsn.file, (u_long)lvh->last_lsn.offset);
4239 ret = DB_LOG_VERIFY_BAD;
4240 ON_ERROR(lvh, DB_LOG_VERIFY_ERR);
4241 }
4242
4243 lvh->last_lsn = *lsnp;
4244 err:
4245 return (ret);
4246 }
4247
4248 static u_int32_t
__lv_first_offset(env)4249 __lv_first_offset(env)
4250 ENV *env;
4251 {
4252 u_int32_t sz;
4253
4254 if (CRYPTO_ON(env))
4255 sz = HDR_CRYPTO_SZ;
4256 else
4257 sz = HDR_NORMAL_SZ;
4258
4259 sz += sizeof(LOGP);
4260
4261 return sz;
4262 }
4263
4264 /* Called when we see a non-transactional update log record. */
4265 static int
__lv_on_nontxn_update(lvh,lsnp,txnid,logtype,fileid)4266 __lv_on_nontxn_update(lvh, lsnp, txnid, logtype, fileid)
4267 DB_LOG_VRFY_INFO *lvh;
4268 const DB_LSN *lsnp;
4269 u_int32_t txnid, logtype;
4270 int32_t fileid;
4271 {
4272 lvh->lrtypes[logtype]++;
4273 COMPQUIET(txnid, 0);
4274 if (fileid != INVAL_DBREGID) {
4275 lvh->non_txnup_cnt++;
4276 __db_msg(lvh->dbenv->env, DB_STR_A("2565",
4277 "[%lu][%lu] Non-transactional update, "
4278 "log type: %u, fileid: %d.", "%lu %lu %u %d"),
4279 (u_long)lsnp->file, (u_long)lsnp->offset, logtype, fileid);
4280 }
4281
4282 return (0);
4283 }
4284
4285 static int
__lv_on_txn_aborted(lvinfo)4286 __lv_on_txn_aborted(lvinfo)
4287 DB_LOG_VRFY_INFO *lvinfo;
4288 {
4289 int ret, ret2, sres;
4290 VRFY_TXN_INFO *ptvi;
4291 u_int32_t abtid;
4292 DB_LSN lsn, slsn;
4293
4294 ret = ret2 = sres = 0;
4295 abtid = lvinfo->aborted_txnid;
4296 lsn = lvinfo->aborted_txnlsn;
4297 slsn = lvinfo->lv_config->start_lsn;
4298 ptvi = NULL;
4299
4300 if ((ret = __del_txn_pages(lvinfo, lvinfo->aborted_txnid)) != 0 &&
4301 ret != DB_NOTFOUND)
4302 goto err;/* Some txns may have updated no pages. */
4303 ret = __get_txn_vrfy_info(lvinfo, lvinfo->aborted_txnid, &ptvi);
4304 if (ret == DB_NOTFOUND && !F_ISSET(lvinfo, DB_LOG_VERIFY_PARTIAL)) {
4305 /*
4306 * If verifying from slsn and the txn abtid started before
4307 * slsn, it's expected that we can't find the txn.
4308 */
4309 if (!IS_ZERO_LSN(slsn) && (ret2 = __txn_started(lvinfo, slsn,
4310 abtid, &sres)) == 0 && sres != 0) {
4311 ret = 0;
4312 goto err;
4313 }
4314 if (ret2 != 0)
4315 ret = ret2;/* Use the same error msg below. */
4316 __db_errx(lvinfo->dbenv->env, DB_STR_A("2566",
4317 "[%lu][%lu] Can not find an active transaction's "
4318 "information, txnid: %lx.", "%lu %lu %lx"),
4319 (u_long)lsn.file, (u_long)lsn.offset,
4320 (u_long)lvinfo->aborted_txnid);
4321 ON_ERROR(lvinfo, DB_LOG_VERIFY_INTERR);
4322 }
4323 if (ptvi == NULL) {
4324 if (ret == DB_NOTFOUND &&
4325 F_ISSET(lvinfo, DB_LOG_VERIFY_PARTIAL))
4326 ret = 0;
4327 goto out;
4328 }
4329 ptvi->status = TXN_STAT_ABORT;
4330 lvinfo->ntxn_abort++;
4331 lvinfo->ntxn_active--;
4332 /* Report txn stats. */
4333 if (F_ISSET(lvinfo, DB_LOG_VERIFY_VERBOSE)) {
4334 __db_msg(lvinfo->dbenv->env, DB_STR_A("2567",
4335 "[%lu][%lu] Txn %lx aborted after this log record.",
4336 "%lu %lu %lx"), (u_long)lvinfo->aborted_txnlsn.file,
4337 (u_long)lvinfo->aborted_txnlsn.offset, (u_long)ptvi->txnid);
4338 __db_msg(lvinfo->dbenv->env, DB_STR_A("2568",
4339 "\tThe number of active, committed and aborted child txns "
4340 "of txn %lx: %u, %u, %u.", "%lx %u %u %u"),
4341 (u_long)ptvi->txnid, ptvi->nchild_active,
4342 ptvi->nchild_commit, ptvi->nchild_abort);
4343 }
4344 lvinfo->aborted_txnid = 0;
4345 lvinfo->aborted_txnlsn.file = lvinfo->aborted_txnlsn.offset = 0;
4346 if ((ret = __put_txn_vrfy_info(lvinfo, ptvi)) != 0)
4347 goto err;
4348 if ((ret = __free_txninfo(ptvi)) != 0)
4349 goto err;
4350 out:
4351 err:
4352 return (ret);
4353 }
4354