1 /* Do not edit: automatically built by gen_rec.awk. */
5 #include "dbinc/crypto.h"
6 #include "dbinc/db_page.h"
7 #include "dbinc/db_am.h"
8 #include "dbinc/btree.h"
10 #include "dbinc/txn.h"
13 * PUBLIC: int __bam_split_read __P((ENV *, DB **, void *, void *,
14 * PUBLIC: __bam_split_args **));
17 __bam_split_read(env, dbpp, td, recbuf, argpp)
22 __bam_split_args **argpp;
24 __bam_split_args *argp;
29 if ((ret = __os_malloc(env,
30 sizeof(__bam_split_args) + sizeof(DB_TXN), &argp)) != 0)
33 argp->txnp = (DB_TXN *)&argp[1];
34 memset(argp->txnp, 0, sizeof(DB_TXN));
37 LOGCOPY_32(env, &argp->type, bp);
38 bp += sizeof(argp->type);
40 LOGCOPY_32(env, &argp->txnp->txnid, bp);
41 bp += sizeof(argp->txnp->txnid);
43 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
46 LOGCOPY_32(env, &uinttmp, bp);
47 argp->fileid = (int32_t)uinttmp;
48 bp += sizeof(uinttmp);
51 ret = __dbreg_id_to_db(
52 env, argp->txnp, dbpp, argp->fileid, 1);
55 LOGCOPY_32(env, &uinttmp, bp);
56 argp->left = (db_pgno_t)uinttmp;
57 bp += sizeof(uinttmp);
59 LOGCOPY_TOLSN(env, &argp->llsn, bp);
62 LOGCOPY_32(env, &uinttmp, bp);
63 argp->right = (db_pgno_t)uinttmp;
64 bp += sizeof(uinttmp);
66 LOGCOPY_TOLSN(env, &argp->rlsn, bp);
69 LOGCOPY_32(env, &argp->indx, bp);
70 bp += sizeof(argp->indx);
72 LOGCOPY_32(env, &uinttmp, bp);
73 argp->npgno = (db_pgno_t)uinttmp;
74 bp += sizeof(uinttmp);
76 LOGCOPY_TOLSN(env, &argp->nlsn, bp);
79 LOGCOPY_32(env, &uinttmp, bp);
80 argp->ppgno = (db_pgno_t)uinttmp;
81 bp += sizeof(uinttmp);
83 LOGCOPY_TOLSN(env, &argp->plsn, bp);
86 LOGCOPY_32(env, &argp->pindx, bp);
87 bp += sizeof(argp->pindx);
89 memset(&argp->pg, 0, sizeof(argp->pg));
90 LOGCOPY_32(env,&argp->pg.size, bp);
91 bp += sizeof(u_int32_t);
94 if (LOG_SWAPPED(env) && dbpp != NULL && *dbpp != NULL) {
96 if ((t_ret = __db_pageswap(*dbpp, (PAGE *)argp->pg.data,
97 (size_t)argp->pg.size, NULL, 1)) != 0)
101 memset(&argp->pentry, 0, sizeof(argp->pentry));
102 LOGCOPY_32(env,&argp->pentry.size, bp);
103 bp += sizeof(u_int32_t);
104 argp->pentry.data = bp;
105 bp += argp->pentry.size;
107 memset(&argp->rentry, 0, sizeof(argp->rentry));
108 LOGCOPY_32(env,&argp->rentry.size, bp);
109 bp += sizeof(u_int32_t);
110 argp->rentry.data = bp;
111 bp += argp->rentry.size;
113 LOGCOPY_32(env, &argp->opflags, bp);
114 bp += sizeof(argp->opflags);
121 * PUBLIC: int __bam_split_log __P((DB *, DB_TXN *, DB_LSN *,
122 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, u_int32_t,
123 * PUBLIC: db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, u_int32_t, const DBT *,
124 * PUBLIC: const DBT *, const DBT *, u_int32_t));
127 __bam_split_log(dbp, txnp, ret_lsnp, flags, left, llsn, right, rlsn, indx,
128 npgno, nlsn, ppgno, plsn, pindx, pg,
129 pentry, rentry, opflags)
150 DB_LSN *lsnp, null_lsn, *rlsnp;
153 u_int32_t zero, uinttmp, rectype, txn_num;
162 rectype = DB___bam_split;
166 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
167 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
177 null_lsn.file = null_lsn.offset = 0;
179 if (TAILQ_FIRST(&txnp->kids) != NULL &&
180 (ret = __txn_activekids(env, rectype, txnp)) != 0)
183 * We need to assign begin_lsn while holding region mutex.
184 * That assignment is done inside the DbEnv->log_put call,
185 * so pass in the appropriate memory location to be filled
186 * in by the log_put code.
188 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
189 txn_num = txnp->txnid;
192 DB_ASSERT(env, dbp->log_filename != NULL);
193 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
194 (ret = __dbreg_lazy_id(dbp)) != 0)
197 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
209 + sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size)
210 + sizeof(u_int32_t) + (pentry == NULL ? 0 : pentry->size)
211 + sizeof(u_int32_t) + (rentry == NULL ? 0 : rentry->size)
213 if (CRYPTO_ON(env)) {
214 npad = env->crypto_handle->adj_size(logrec.size);
218 if (is_durable || txnp == NULL) {
220 __os_malloc(env, logrec.size, &logrec.data)) != 0)
223 if ((ret = __os_malloc(env,
224 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
228 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
233 logrec.data = lr->data;
237 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
241 LOGCOPY_32(env, bp, &rectype);
242 bp += sizeof(rectype);
244 LOGCOPY_32(env, bp, &txn_num);
245 bp += sizeof(txn_num);
247 LOGCOPY_FROMLSN(env, bp, lsnp);
248 bp += sizeof(DB_LSN);
250 uinttmp = (u_int32_t)dbp->log_filename->id;
251 LOGCOPY_32(env, bp, &uinttmp);
252 bp += sizeof(uinttmp);
254 uinttmp = (u_int32_t)left;
255 LOGCOPY_32(env,bp, &uinttmp);
256 bp += sizeof(uinttmp);
260 LOG *lp = env->lg_handle->reginfo.primary;
261 if (LOG_COMPARE(llsn, &lp->lsn) >= 0 && (ret =
262 __log_check_page_lsn(env, dbp, llsn)) != 0)
265 LOGCOPY_FROMLSN(env, bp, llsn);
267 memset(bp, 0, sizeof(*llsn));
270 uinttmp = (u_int32_t)right;
271 LOGCOPY_32(env,bp, &uinttmp);
272 bp += sizeof(uinttmp);
276 LOG *lp = env->lg_handle->reginfo.primary;
277 if (LOG_COMPARE(rlsn, &lp->lsn) >= 0 && (ret =
278 __log_check_page_lsn(env, dbp, rlsn)) != 0)
281 LOGCOPY_FROMLSN(env, bp, rlsn);
283 memset(bp, 0, sizeof(*rlsn));
286 LOGCOPY_32(env, bp, &indx);
289 uinttmp = (u_int32_t)npgno;
290 LOGCOPY_32(env,bp, &uinttmp);
291 bp += sizeof(uinttmp);
295 LOG *lp = env->lg_handle->reginfo.primary;
296 if (LOG_COMPARE(nlsn, &lp->lsn) >= 0 && (ret =
297 __log_check_page_lsn(env, dbp, nlsn)) != 0)
300 LOGCOPY_FROMLSN(env, bp, nlsn);
302 memset(bp, 0, sizeof(*nlsn));
305 uinttmp = (u_int32_t)ppgno;
306 LOGCOPY_32(env,bp, &uinttmp);
307 bp += sizeof(uinttmp);
311 LOG *lp = env->lg_handle->reginfo.primary;
312 if (LOG_COMPARE(plsn, &lp->lsn) >= 0 && (ret =
313 __log_check_page_lsn(env, dbp, plsn)) != 0)
316 LOGCOPY_FROMLSN(env, bp, plsn);
318 memset(bp, 0, sizeof(*plsn));
321 LOGCOPY_32(env, bp, &pindx);
326 LOGCOPY_32(env, bp, &zero);
327 bp += sizeof(u_int32_t);
329 LOGCOPY_32(env, bp, &pg->size);
330 bp += sizeof(pg->size);
331 memcpy(bp, pg->data, pg->size);
332 if (LOG_SWAPPED(env))
333 if ((ret = __db_pageswap(dbp,
334 (PAGE *)bp, (size_t)pg->size, (DBT *)NULL, 0)) != 0)
339 if (pentry == NULL) {
341 LOGCOPY_32(env, bp, &zero);
342 bp += sizeof(u_int32_t);
344 LOGCOPY_32(env, bp, &pentry->size);
345 bp += sizeof(pentry->size);
346 memcpy(bp, pentry->data, pentry->size);
350 if (rentry == NULL) {
352 LOGCOPY_32(env, bp, &zero);
353 bp += sizeof(u_int32_t);
355 LOGCOPY_32(env, bp, &rentry->size);
356 bp += sizeof(rentry->size);
357 memcpy(bp, rentry->data, rentry->size);
361 LOGCOPY_32(env, bp, &opflags);
362 bp += sizeof(opflags);
365 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
367 if (is_durable || txnp == NULL) {
368 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
369 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
371 if (rlsnp != ret_lsnp)
378 * Set the debug bit if we are going to log non-durable
379 * transactions so they will be ignored by recovery.
381 memcpy(lr->data, logrec.data, logrec.size);
382 rectype |= DB_debug_FLAG;
383 LOGCOPY_32(env, logrec.data, &rectype);
385 if (!IS_REP_CLIENT(env))
387 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
389 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
390 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
391 LSN_NOT_LOGGED(*ret_lsnp);
394 #ifdef LOG_DIAGNOSTIC
396 (void)__bam_split_print(env,
397 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
401 __os_free(env, logrec.data);
403 if (is_durable || txnp == NULL)
404 __os_free(env, logrec.data);
410 * PUBLIC: int __bam_split_42_read __P((ENV *, DB **, void *,
411 * PUBLIC: void *, __bam_split_42_args **));
414 __bam_split_42_read(env, dbpp, td, recbuf, argpp)
419 __bam_split_42_args **argpp;
421 __bam_split_42_args *argp;
426 if ((ret = __os_malloc(env,
427 sizeof(__bam_split_42_args) + sizeof(DB_TXN), &argp)) != 0)
430 argp->txnp = (DB_TXN *)&argp[1];
431 memset(argp->txnp, 0, sizeof(DB_TXN));
434 LOGCOPY_32(env, &argp->type, bp);
435 bp += sizeof(argp->type);
437 LOGCOPY_32(env, &argp->txnp->txnid, bp);
438 bp += sizeof(argp->txnp->txnid);
440 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
441 bp += sizeof(DB_LSN);
443 LOGCOPY_32(env, &uinttmp, bp);
444 argp->fileid = (int32_t)uinttmp;
445 bp += sizeof(uinttmp);
448 ret = __dbreg_id_to_db(
449 env, argp->txnp, dbpp, argp->fileid, 1);
452 LOGCOPY_32(env, &uinttmp, bp);
453 argp->left = (db_pgno_t)uinttmp;
454 bp += sizeof(uinttmp);
456 LOGCOPY_TOLSN(env, &argp->llsn, bp);
457 bp += sizeof(DB_LSN);
459 LOGCOPY_32(env, &uinttmp, bp);
460 argp->right = (db_pgno_t)uinttmp;
461 bp += sizeof(uinttmp);
463 LOGCOPY_TOLSN(env, &argp->rlsn, bp);
464 bp += sizeof(DB_LSN);
466 LOGCOPY_32(env, &argp->indx, bp);
467 bp += sizeof(argp->indx);
469 LOGCOPY_32(env, &uinttmp, bp);
470 argp->npgno = (db_pgno_t)uinttmp;
471 bp += sizeof(uinttmp);
473 LOGCOPY_TOLSN(env, &argp->nlsn, bp);
474 bp += sizeof(DB_LSN);
476 LOGCOPY_32(env, &uinttmp, bp);
477 argp->root_pgno = (db_pgno_t)uinttmp;
478 bp += sizeof(uinttmp);
480 memset(&argp->pg, 0, sizeof(argp->pg));
481 LOGCOPY_32(env,&argp->pg.size, bp);
482 bp += sizeof(u_int32_t);
486 LOGCOPY_32(env, &argp->opflags, bp);
487 bp += sizeof(argp->opflags);
494 * PUBLIC: int __bam_rsplit_read __P((ENV *, DB **, void *, void *,
495 * PUBLIC: __bam_rsplit_args **));
498 __bam_rsplit_read(env, dbpp, td, recbuf, argpp)
503 __bam_rsplit_args **argpp;
505 __bam_rsplit_args *argp;
510 if ((ret = __os_malloc(env,
511 sizeof(__bam_rsplit_args) + sizeof(DB_TXN), &argp)) != 0)
514 argp->txnp = (DB_TXN *)&argp[1];
515 memset(argp->txnp, 0, sizeof(DB_TXN));
518 LOGCOPY_32(env, &argp->type, bp);
519 bp += sizeof(argp->type);
521 LOGCOPY_32(env, &argp->txnp->txnid, bp);
522 bp += sizeof(argp->txnp->txnid);
524 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
525 bp += sizeof(DB_LSN);
527 LOGCOPY_32(env, &uinttmp, bp);
528 argp->fileid = (int32_t)uinttmp;
529 bp += sizeof(uinttmp);
532 ret = __dbreg_id_to_db(
533 env, argp->txnp, dbpp, argp->fileid, 1);
536 LOGCOPY_32(env, &uinttmp, bp);
537 argp->pgno = (db_pgno_t)uinttmp;
538 bp += sizeof(uinttmp);
540 memset(&argp->pgdbt, 0, sizeof(argp->pgdbt));
541 LOGCOPY_32(env,&argp->pgdbt.size, bp);
542 bp += sizeof(u_int32_t);
543 argp->pgdbt.data = bp;
544 bp += argp->pgdbt.size;
545 if (LOG_SWAPPED(env) && dbpp != NULL && *dbpp != NULL) {
547 if ((t_ret = __db_pageswap(*dbpp, (PAGE *)argp->pgdbt.data,
548 (size_t)argp->pgdbt.size, NULL, 1)) != 0)
552 LOGCOPY_32(env, &uinttmp, bp);
553 argp->root_pgno = (db_pgno_t)uinttmp;
554 bp += sizeof(uinttmp);
556 LOGCOPY_32(env, &uinttmp, bp);
557 argp->nrec = (db_pgno_t)uinttmp;
558 bp += sizeof(uinttmp);
560 memset(&argp->rootent, 0, sizeof(argp->rootent));
561 LOGCOPY_32(env,&argp->rootent.size, bp);
562 bp += sizeof(u_int32_t);
563 argp->rootent.data = bp;
564 bp += argp->rootent.size;
566 LOGCOPY_TOLSN(env, &argp->rootlsn, bp);
567 bp += sizeof(DB_LSN);
574 * PUBLIC: int __bam_rsplit_log __P((DB *, DB_TXN *, DB_LSN *,
575 * PUBLIC: u_int32_t, db_pgno_t, const DBT *, db_pgno_t, db_pgno_t,
576 * PUBLIC: const DBT *, DB_LSN *));
579 __bam_rsplit_log(dbp, txnp, ret_lsnp, flags, pgno, pgdbt, root_pgno, nrec, rootent,
593 DB_LSN *lsnp, null_lsn, *rlsnp;
596 u_int32_t zero, uinttmp, rectype, txn_num;
605 rectype = DB___bam_rsplit;
609 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
610 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
620 null_lsn.file = null_lsn.offset = 0;
622 if (TAILQ_FIRST(&txnp->kids) != NULL &&
623 (ret = __txn_activekids(env, rectype, txnp)) != 0)
626 * We need to assign begin_lsn while holding region mutex.
627 * That assignment is done inside the DbEnv->log_put call,
628 * so pass in the appropriate memory location to be filled
629 * in by the log_put code.
631 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
632 txn_num = txnp->txnid;
635 DB_ASSERT(env, dbp->log_filename != NULL);
636 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
637 (ret = __dbreg_lazy_id(dbp)) != 0)
640 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
643 + sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size)
646 + sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size)
648 if (CRYPTO_ON(env)) {
649 npad = env->crypto_handle->adj_size(logrec.size);
653 if (is_durable || txnp == NULL) {
655 __os_malloc(env, logrec.size, &logrec.data)) != 0)
658 if ((ret = __os_malloc(env,
659 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
663 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
668 logrec.data = lr->data;
672 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
676 LOGCOPY_32(env, bp, &rectype);
677 bp += sizeof(rectype);
679 LOGCOPY_32(env, bp, &txn_num);
680 bp += sizeof(txn_num);
682 LOGCOPY_FROMLSN(env, bp, lsnp);
683 bp += sizeof(DB_LSN);
685 uinttmp = (u_int32_t)dbp->log_filename->id;
686 LOGCOPY_32(env, bp, &uinttmp);
687 bp += sizeof(uinttmp);
689 uinttmp = (u_int32_t)pgno;
690 LOGCOPY_32(env,bp, &uinttmp);
691 bp += sizeof(uinttmp);
695 LOGCOPY_32(env, bp, &zero);
696 bp += sizeof(u_int32_t);
698 LOGCOPY_32(env, bp, &pgdbt->size);
699 bp += sizeof(pgdbt->size);
700 memcpy(bp, pgdbt->data, pgdbt->size);
701 if (LOG_SWAPPED(env))
702 if ((ret = __db_pageswap(dbp,
703 (PAGE *)bp, (size_t)pgdbt->size, (DBT *)NULL, 0)) != 0)
708 uinttmp = (u_int32_t)root_pgno;
709 LOGCOPY_32(env,bp, &uinttmp);
710 bp += sizeof(uinttmp);
712 uinttmp = (u_int32_t)nrec;
713 LOGCOPY_32(env,bp, &uinttmp);
714 bp += sizeof(uinttmp);
716 if (rootent == NULL) {
718 LOGCOPY_32(env, bp, &zero);
719 bp += sizeof(u_int32_t);
721 LOGCOPY_32(env, bp, &rootent->size);
722 bp += sizeof(rootent->size);
723 memcpy(bp, rootent->data, rootent->size);
727 if (rootlsn != NULL) {
729 LOG *lp = env->lg_handle->reginfo.primary;
730 if (LOG_COMPARE(rootlsn, &lp->lsn) >= 0 && (ret =
731 __log_check_page_lsn(env, dbp, rootlsn)) != 0)
734 LOGCOPY_FROMLSN(env, bp, rootlsn);
736 memset(bp, 0, sizeof(*rootlsn));
737 bp += sizeof(*rootlsn);
740 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
742 if (is_durable || txnp == NULL) {
743 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
744 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
746 if (rlsnp != ret_lsnp)
753 * Set the debug bit if we are going to log non-durable
754 * transactions so they will be ignored by recovery.
756 memcpy(lr->data, logrec.data, logrec.size);
757 rectype |= DB_debug_FLAG;
758 LOGCOPY_32(env, logrec.data, &rectype);
760 if (!IS_REP_CLIENT(env))
762 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
764 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
765 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
766 LSN_NOT_LOGGED(*ret_lsnp);
769 #ifdef LOG_DIAGNOSTIC
771 (void)__bam_rsplit_print(env,
772 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
776 __os_free(env, logrec.data);
778 if (is_durable || txnp == NULL)
779 __os_free(env, logrec.data);
785 * PUBLIC: int __bam_adj_read __P((ENV *, DB **, void *, void *,
786 * PUBLIC: __bam_adj_args **));
789 __bam_adj_read(env, dbpp, td, recbuf, argpp)
794 __bam_adj_args **argpp;
796 __bam_adj_args *argp;
801 if ((ret = __os_malloc(env,
802 sizeof(__bam_adj_args) + sizeof(DB_TXN), &argp)) != 0)
805 argp->txnp = (DB_TXN *)&argp[1];
806 memset(argp->txnp, 0, sizeof(DB_TXN));
809 LOGCOPY_32(env, &argp->type, bp);
810 bp += sizeof(argp->type);
812 LOGCOPY_32(env, &argp->txnp->txnid, bp);
813 bp += sizeof(argp->txnp->txnid);
815 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
816 bp += sizeof(DB_LSN);
818 LOGCOPY_32(env, &uinttmp, bp);
819 argp->fileid = (int32_t)uinttmp;
820 bp += sizeof(uinttmp);
823 ret = __dbreg_id_to_db(
824 env, argp->txnp, dbpp, argp->fileid, 1);
827 LOGCOPY_32(env, &uinttmp, bp);
828 argp->pgno = (db_pgno_t)uinttmp;
829 bp += sizeof(uinttmp);
831 LOGCOPY_TOLSN(env, &argp->lsn, bp);
832 bp += sizeof(DB_LSN);
834 LOGCOPY_32(env, &argp->indx, bp);
835 bp += sizeof(argp->indx);
837 LOGCOPY_32(env, &argp->indx_copy, bp);
838 bp += sizeof(argp->indx_copy);
840 LOGCOPY_32(env, &argp->is_insert, bp);
841 bp += sizeof(argp->is_insert);
848 * PUBLIC: int __bam_adj_log __P((DB *, DB_TXN *, DB_LSN *,
849 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t,
850 * PUBLIC: u_int32_t));
853 __bam_adj_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, indx, indx_copy, is_insert)
865 DB_LSN *lsnp, null_lsn, *rlsnp;
868 u_int32_t uinttmp, rectype, txn_num;
877 rectype = DB___bam_adj;
881 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
882 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
892 null_lsn.file = null_lsn.offset = 0;
894 if (TAILQ_FIRST(&txnp->kids) != NULL &&
895 (ret = __txn_activekids(env, rectype, txnp)) != 0)
898 * We need to assign begin_lsn while holding region mutex.
899 * That assignment is done inside the DbEnv->log_put call,
900 * so pass in the appropriate memory location to be filled
901 * in by the log_put code.
903 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
904 txn_num = txnp->txnid;
907 DB_ASSERT(env, dbp->log_filename != NULL);
908 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
909 (ret = __dbreg_lazy_id(dbp)) != 0)
912 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
919 if (CRYPTO_ON(env)) {
920 npad = env->crypto_handle->adj_size(logrec.size);
924 if (is_durable || txnp == NULL) {
926 __os_malloc(env, logrec.size, &logrec.data)) != 0)
929 if ((ret = __os_malloc(env,
930 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
934 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
939 logrec.data = lr->data;
943 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
947 LOGCOPY_32(env, bp, &rectype);
948 bp += sizeof(rectype);
950 LOGCOPY_32(env, bp, &txn_num);
951 bp += sizeof(txn_num);
953 LOGCOPY_FROMLSN(env, bp, lsnp);
954 bp += sizeof(DB_LSN);
956 uinttmp = (u_int32_t)dbp->log_filename->id;
957 LOGCOPY_32(env, bp, &uinttmp);
958 bp += sizeof(uinttmp);
960 uinttmp = (u_int32_t)pgno;
961 LOGCOPY_32(env,bp, &uinttmp);
962 bp += sizeof(uinttmp);
966 LOG *lp = env->lg_handle->reginfo.primary;
967 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
968 __log_check_page_lsn(env, dbp, lsn)) != 0)
971 LOGCOPY_FROMLSN(env, bp, lsn);
973 memset(bp, 0, sizeof(*lsn));
976 LOGCOPY_32(env, bp, &indx);
979 LOGCOPY_32(env, bp, &indx_copy);
980 bp += sizeof(indx_copy);
982 LOGCOPY_32(env, bp, &is_insert);
983 bp += sizeof(is_insert);
986 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
988 if (is_durable || txnp == NULL) {
989 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
990 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
992 if (rlsnp != ret_lsnp)
999 * Set the debug bit if we are going to log non-durable
1000 * transactions so they will be ignored by recovery.
1002 memcpy(lr->data, logrec.data, logrec.size);
1003 rectype |= DB_debug_FLAG;
1004 LOGCOPY_32(env, logrec.data, &rectype);
1006 if (!IS_REP_CLIENT(env))
1007 ret = __log_put(env,
1008 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
1010 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
1011 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
1012 LSN_NOT_LOGGED(*ret_lsnp);
1015 #ifdef LOG_DIAGNOSTIC
1017 (void)__bam_adj_print(env,
1018 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1022 __os_free(env, logrec.data);
1024 if (is_durable || txnp == NULL)
1025 __os_free(env, logrec.data);
1031 * PUBLIC: int __bam_cadjust_read __P((ENV *, DB **, void *, void *,
1032 * PUBLIC: __bam_cadjust_args **));
1035 __bam_cadjust_read(env, dbpp, td, recbuf, argpp)
1040 __bam_cadjust_args **argpp;
1042 __bam_cadjust_args *argp;
1047 if ((ret = __os_malloc(env,
1048 sizeof(__bam_cadjust_args) + sizeof(DB_TXN), &argp)) != 0)
1051 argp->txnp = (DB_TXN *)&argp[1];
1052 memset(argp->txnp, 0, sizeof(DB_TXN));
1054 argp->txnp->td = td;
1055 LOGCOPY_32(env, &argp->type, bp);
1056 bp += sizeof(argp->type);
1058 LOGCOPY_32(env, &argp->txnp->txnid, bp);
1059 bp += sizeof(argp->txnp->txnid);
1061 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
1062 bp += sizeof(DB_LSN);
1064 LOGCOPY_32(env, &uinttmp, bp);
1065 argp->fileid = (int32_t)uinttmp;
1066 bp += sizeof(uinttmp);
1069 ret = __dbreg_id_to_db(
1070 env, argp->txnp, dbpp, argp->fileid, 1);
1073 LOGCOPY_32(env, &uinttmp, bp);
1074 argp->pgno = (db_pgno_t)uinttmp;
1075 bp += sizeof(uinttmp);
1077 LOGCOPY_TOLSN(env, &argp->lsn, bp);
1078 bp += sizeof(DB_LSN);
1080 LOGCOPY_32(env, &argp->indx, bp);
1081 bp += sizeof(argp->indx);
1083 LOGCOPY_32(env, &uinttmp, bp);
1084 argp->adjust = (int32_t)uinttmp;
1085 bp += sizeof(uinttmp);
1087 LOGCOPY_32(env, &argp->opflags, bp);
1088 bp += sizeof(argp->opflags);
1095 * PUBLIC: int __bam_cadjust_log __P((DB *, DB_TXN *, DB_LSN *,
1096 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, int32_t, u_int32_t));
1099 __bam_cadjust_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, indx, adjust, opflags)
1111 DB_LSN *lsnp, null_lsn, *rlsnp;
1114 u_int32_t uinttmp, rectype, txn_num;
1117 int is_durable, ret;
1119 COMPQUIET(lr, NULL);
1123 rectype = DB___bam_cadjust;
1127 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
1128 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
1138 null_lsn.file = null_lsn.offset = 0;
1140 if (TAILQ_FIRST(&txnp->kids) != NULL &&
1141 (ret = __txn_activekids(env, rectype, txnp)) != 0)
1144 * We need to assign begin_lsn while holding region mutex.
1145 * That assignment is done inside the DbEnv->log_put call,
1146 * so pass in the appropriate memory location to be filled
1147 * in by the log_put code.
1149 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
1150 txn_num = txnp->txnid;
1153 DB_ASSERT(env, dbp->log_filename != NULL);
1154 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1155 (ret = __dbreg_lazy_id(dbp)) != 0)
1158 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1164 + sizeof(u_int32_t);
1165 if (CRYPTO_ON(env)) {
1166 npad = env->crypto_handle->adj_size(logrec.size);
1167 logrec.size += npad;
1170 if (is_durable || txnp == NULL) {
1172 __os_malloc(env, logrec.size, &logrec.data)) != 0)
1175 if ((ret = __os_malloc(env,
1176 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
1180 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
1185 logrec.data = lr->data;
1189 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1193 LOGCOPY_32(env, bp, &rectype);
1194 bp += sizeof(rectype);
1196 LOGCOPY_32(env, bp, &txn_num);
1197 bp += sizeof(txn_num);
1199 LOGCOPY_FROMLSN(env, bp, lsnp);
1200 bp += sizeof(DB_LSN);
1202 uinttmp = (u_int32_t)dbp->log_filename->id;
1203 LOGCOPY_32(env, bp, &uinttmp);
1204 bp += sizeof(uinttmp);
1206 uinttmp = (u_int32_t)pgno;
1207 LOGCOPY_32(env,bp, &uinttmp);
1208 bp += sizeof(uinttmp);
1212 LOG *lp = env->lg_handle->reginfo.primary;
1213 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
1214 __log_check_page_lsn(env, dbp, lsn)) != 0)
1217 LOGCOPY_FROMLSN(env, bp, lsn);
1219 memset(bp, 0, sizeof(*lsn));
1222 LOGCOPY_32(env, bp, &indx);
1225 uinttmp = (u_int32_t)adjust;
1226 LOGCOPY_32(env,bp, &uinttmp);
1227 bp += sizeof(uinttmp);
1229 LOGCOPY_32(env, bp, &opflags);
1230 bp += sizeof(opflags);
1233 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1235 if (is_durable || txnp == NULL) {
1236 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
1237 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
1239 if (rlsnp != ret_lsnp)
1246 * Set the debug bit if we are going to log non-durable
1247 * transactions so they will be ignored by recovery.
1249 memcpy(lr->data, logrec.data, logrec.size);
1250 rectype |= DB_debug_FLAG;
1251 LOGCOPY_32(env, logrec.data, &rectype);
1253 if (!IS_REP_CLIENT(env))
1254 ret = __log_put(env,
1255 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
1257 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
1258 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
1259 LSN_NOT_LOGGED(*ret_lsnp);
1262 #ifdef LOG_DIAGNOSTIC
1264 (void)__bam_cadjust_print(env,
1265 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1269 __os_free(env, logrec.data);
1271 if (is_durable || txnp == NULL)
1272 __os_free(env, logrec.data);
1278 * PUBLIC: int __bam_cdel_read __P((ENV *, DB **, void *, void *,
1279 * PUBLIC: __bam_cdel_args **));
1282 __bam_cdel_read(env, dbpp, td, recbuf, argpp)
1287 __bam_cdel_args **argpp;
1289 __bam_cdel_args *argp;
1294 if ((ret = __os_malloc(env,
1295 sizeof(__bam_cdel_args) + sizeof(DB_TXN), &argp)) != 0)
1298 argp->txnp = (DB_TXN *)&argp[1];
1299 memset(argp->txnp, 0, sizeof(DB_TXN));
1301 argp->txnp->td = td;
1302 LOGCOPY_32(env, &argp->type, bp);
1303 bp += sizeof(argp->type);
1305 LOGCOPY_32(env, &argp->txnp->txnid, bp);
1306 bp += sizeof(argp->txnp->txnid);
1308 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
1309 bp += sizeof(DB_LSN);
1311 LOGCOPY_32(env, &uinttmp, bp);
1312 argp->fileid = (int32_t)uinttmp;
1313 bp += sizeof(uinttmp);
1316 ret = __dbreg_id_to_db(
1317 env, argp->txnp, dbpp, argp->fileid, 1);
1320 LOGCOPY_32(env, &uinttmp, bp);
1321 argp->pgno = (db_pgno_t)uinttmp;
1322 bp += sizeof(uinttmp);
1324 LOGCOPY_TOLSN(env, &argp->lsn, bp);
1325 bp += sizeof(DB_LSN);
1327 LOGCOPY_32(env, &argp->indx, bp);
1328 bp += sizeof(argp->indx);
1335 * PUBLIC: int __bam_cdel_log __P((DB *, DB_TXN *, DB_LSN *,
1336 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t));
1339 __bam_cdel_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, indx)
1349 DB_LSN *lsnp, null_lsn, *rlsnp;
1352 u_int32_t uinttmp, rectype, txn_num;
1355 int is_durable, ret;
1357 COMPQUIET(lr, NULL);
1361 rectype = DB___bam_cdel;
1365 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
1366 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
1376 null_lsn.file = null_lsn.offset = 0;
1378 if (TAILQ_FIRST(&txnp->kids) != NULL &&
1379 (ret = __txn_activekids(env, rectype, txnp)) != 0)
1382 * We need to assign begin_lsn while holding region mutex.
1383 * That assignment is done inside the DbEnv->log_put call,
1384 * so pass in the appropriate memory location to be filled
1385 * in by the log_put code.
1387 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
1388 txn_num = txnp->txnid;
1391 DB_ASSERT(env, dbp->log_filename != NULL);
1392 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1393 (ret = __dbreg_lazy_id(dbp)) != 0)
1396 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1400 + sizeof(u_int32_t);
1401 if (CRYPTO_ON(env)) {
1402 npad = env->crypto_handle->adj_size(logrec.size);
1403 logrec.size += npad;
1406 if (is_durable || txnp == NULL) {
1408 __os_malloc(env, logrec.size, &logrec.data)) != 0)
1411 if ((ret = __os_malloc(env,
1412 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
1416 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
1421 logrec.data = lr->data;
1425 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1429 LOGCOPY_32(env, bp, &rectype);
1430 bp += sizeof(rectype);
1432 LOGCOPY_32(env, bp, &txn_num);
1433 bp += sizeof(txn_num);
1435 LOGCOPY_FROMLSN(env, bp, lsnp);
1436 bp += sizeof(DB_LSN);
1438 uinttmp = (u_int32_t)dbp->log_filename->id;
1439 LOGCOPY_32(env, bp, &uinttmp);
1440 bp += sizeof(uinttmp);
1442 uinttmp = (u_int32_t)pgno;
1443 LOGCOPY_32(env,bp, &uinttmp);
1444 bp += sizeof(uinttmp);
1448 LOG *lp = env->lg_handle->reginfo.primary;
1449 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
1450 __log_check_page_lsn(env, dbp, lsn)) != 0)
1453 LOGCOPY_FROMLSN(env, bp, lsn);
1455 memset(bp, 0, sizeof(*lsn));
1458 LOGCOPY_32(env, bp, &indx);
1462 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1464 if (is_durable || txnp == NULL) {
1465 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
1466 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
1468 if (rlsnp != ret_lsnp)
1475 * Set the debug bit if we are going to log non-durable
1476 * transactions so they will be ignored by recovery.
1478 memcpy(lr->data, logrec.data, logrec.size);
1479 rectype |= DB_debug_FLAG;
1480 LOGCOPY_32(env, logrec.data, &rectype);
1482 if (!IS_REP_CLIENT(env))
1483 ret = __log_put(env,
1484 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
1486 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
1487 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
1488 LSN_NOT_LOGGED(*ret_lsnp);
1491 #ifdef LOG_DIAGNOSTIC
1493 (void)__bam_cdel_print(env,
1494 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1498 __os_free(env, logrec.data);
1500 if (is_durable || txnp == NULL)
1501 __os_free(env, logrec.data);
1507 * PUBLIC: int __bam_repl_read __P((ENV *, DB **, void *, void *,
1508 * PUBLIC: __bam_repl_args **));
1511 __bam_repl_read(env, dbpp, td, recbuf, argpp)
1516 __bam_repl_args **argpp;
1518 __bam_repl_args *argp;
1523 if ((ret = __os_malloc(env,
1524 sizeof(__bam_repl_args) + sizeof(DB_TXN), &argp)) != 0)
1527 argp->txnp = (DB_TXN *)&argp[1];
1528 memset(argp->txnp, 0, sizeof(DB_TXN));
1530 argp->txnp->td = td;
1531 LOGCOPY_32(env, &argp->type, bp);
1532 bp += sizeof(argp->type);
1534 LOGCOPY_32(env, &argp->txnp->txnid, bp);
1535 bp += sizeof(argp->txnp->txnid);
1537 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
1538 bp += sizeof(DB_LSN);
1540 LOGCOPY_32(env, &uinttmp, bp);
1541 argp->fileid = (int32_t)uinttmp;
1542 bp += sizeof(uinttmp);
1545 ret = __dbreg_id_to_db(
1546 env, argp->txnp, dbpp, argp->fileid, 1);
1549 LOGCOPY_32(env, &uinttmp, bp);
1550 argp->pgno = (db_pgno_t)uinttmp;
1551 bp += sizeof(uinttmp);
1553 LOGCOPY_TOLSN(env, &argp->lsn, bp);
1554 bp += sizeof(DB_LSN);
1556 LOGCOPY_32(env, &argp->indx, bp);
1557 bp += sizeof(argp->indx);
1559 LOGCOPY_32(env, &argp->isdeleted, bp);
1560 bp += sizeof(argp->isdeleted);
1562 memset(&argp->orig, 0, sizeof(argp->orig));
1563 LOGCOPY_32(env,&argp->orig.size, bp);
1564 bp += sizeof(u_int32_t);
1565 argp->orig.data = bp;
1566 bp += argp->orig.size;
1568 memset(&argp->repl, 0, sizeof(argp->repl));
1569 LOGCOPY_32(env,&argp->repl.size, bp);
1570 bp += sizeof(u_int32_t);
1571 argp->repl.data = bp;
1572 bp += argp->repl.size;
1574 LOGCOPY_32(env, &argp->prefix, bp);
1575 bp += sizeof(argp->prefix);
1577 LOGCOPY_32(env, &argp->suffix, bp);
1578 bp += sizeof(argp->suffix);
1585 * PUBLIC: int __bam_repl_log __P((DB *, DB_TXN *, DB_LSN *,
1586 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t,
1587 * PUBLIC: const DBT *, const DBT *, u_int32_t, u_int32_t));
1590 __bam_repl_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, indx, isdeleted, orig,
1591 repl, prefix, suffix)
1599 u_int32_t isdeleted;
1606 DB_LSN *lsnp, null_lsn, *rlsnp;
1609 u_int32_t zero, uinttmp, rectype, txn_num;
1612 int is_durable, ret;
1614 COMPQUIET(lr, NULL);
1618 rectype = DB___bam_repl;
1622 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
1623 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
1633 null_lsn.file = null_lsn.offset = 0;
1635 if (TAILQ_FIRST(&txnp->kids) != NULL &&
1636 (ret = __txn_activekids(env, rectype, txnp)) != 0)
1639 * We need to assign begin_lsn while holding region mutex.
1640 * That assignment is done inside the DbEnv->log_put call,
1641 * so pass in the appropriate memory location to be filled
1642 * in by the log_put code.
1644 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
1645 txn_num = txnp->txnid;
1648 DB_ASSERT(env, dbp->log_filename != NULL);
1649 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1650 (ret = __dbreg_lazy_id(dbp)) != 0)
1653 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1659 + sizeof(u_int32_t) + (orig == NULL ? 0 : orig->size)
1660 + sizeof(u_int32_t) + (repl == NULL ? 0 : repl->size)
1662 + sizeof(u_int32_t);
1663 if (CRYPTO_ON(env)) {
1664 npad = env->crypto_handle->adj_size(logrec.size);
1665 logrec.size += npad;
1668 if (is_durable || txnp == NULL) {
1670 __os_malloc(env, logrec.size, &logrec.data)) != 0)
1673 if ((ret = __os_malloc(env,
1674 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
1678 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
1683 logrec.data = lr->data;
1687 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1691 LOGCOPY_32(env, bp, &rectype);
1692 bp += sizeof(rectype);
1694 LOGCOPY_32(env, bp, &txn_num);
1695 bp += sizeof(txn_num);
1697 LOGCOPY_FROMLSN(env, bp, lsnp);
1698 bp += sizeof(DB_LSN);
1700 uinttmp = (u_int32_t)dbp->log_filename->id;
1701 LOGCOPY_32(env, bp, &uinttmp);
1702 bp += sizeof(uinttmp);
1704 uinttmp = (u_int32_t)pgno;
1705 LOGCOPY_32(env,bp, &uinttmp);
1706 bp += sizeof(uinttmp);
1710 LOG *lp = env->lg_handle->reginfo.primary;
1711 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
1712 __log_check_page_lsn(env, dbp, lsn)) != 0)
1715 LOGCOPY_FROMLSN(env, bp, lsn);
1717 memset(bp, 0, sizeof(*lsn));
1720 LOGCOPY_32(env, bp, &indx);
1723 LOGCOPY_32(env, bp, &isdeleted);
1724 bp += sizeof(isdeleted);
1728 LOGCOPY_32(env, bp, &zero);
1729 bp += sizeof(u_int32_t);
1731 LOGCOPY_32(env, bp, &orig->size);
1732 bp += sizeof(orig->size);
1733 memcpy(bp, orig->data, orig->size);
1739 LOGCOPY_32(env, bp, &zero);
1740 bp += sizeof(u_int32_t);
1742 LOGCOPY_32(env, bp, &repl->size);
1743 bp += sizeof(repl->size);
1744 memcpy(bp, repl->data, repl->size);
1748 LOGCOPY_32(env, bp, &prefix);
1749 bp += sizeof(prefix);
1751 LOGCOPY_32(env, bp, &suffix);
1752 bp += sizeof(suffix);
1755 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1757 if (is_durable || txnp == NULL) {
1758 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
1759 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
1761 if (rlsnp != ret_lsnp)
1768 * Set the debug bit if we are going to log non-durable
1769 * transactions so they will be ignored by recovery.
1771 memcpy(lr->data, logrec.data, logrec.size);
1772 rectype |= DB_debug_FLAG;
1773 LOGCOPY_32(env, logrec.data, &rectype);
1775 if (!IS_REP_CLIENT(env))
1776 ret = __log_put(env,
1777 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
1779 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
1780 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
1781 LSN_NOT_LOGGED(*ret_lsnp);
1784 #ifdef LOG_DIAGNOSTIC
1786 (void)__bam_repl_print(env,
1787 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1791 __os_free(env, logrec.data);
1793 if (is_durable || txnp == NULL)
1794 __os_free(env, logrec.data);
1800 * PUBLIC: int __bam_root_read __P((ENV *, DB **, void *, void *,
1801 * PUBLIC: __bam_root_args **));
1804 __bam_root_read(env, dbpp, td, recbuf, argpp)
1809 __bam_root_args **argpp;
1811 __bam_root_args *argp;
1816 if ((ret = __os_malloc(env,
1817 sizeof(__bam_root_args) + sizeof(DB_TXN), &argp)) != 0)
1820 argp->txnp = (DB_TXN *)&argp[1];
1821 memset(argp->txnp, 0, sizeof(DB_TXN));
1823 argp->txnp->td = td;
1824 LOGCOPY_32(env, &argp->type, bp);
1825 bp += sizeof(argp->type);
1827 LOGCOPY_32(env, &argp->txnp->txnid, bp);
1828 bp += sizeof(argp->txnp->txnid);
1830 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
1831 bp += sizeof(DB_LSN);
1833 LOGCOPY_32(env, &uinttmp, bp);
1834 argp->fileid = (int32_t)uinttmp;
1835 bp += sizeof(uinttmp);
1838 ret = __dbreg_id_to_db(
1839 env, argp->txnp, dbpp, argp->fileid, 1);
1842 LOGCOPY_32(env, &uinttmp, bp);
1843 argp->meta_pgno = (db_pgno_t)uinttmp;
1844 bp += sizeof(uinttmp);
1846 LOGCOPY_32(env, &uinttmp, bp);
1847 argp->root_pgno = (db_pgno_t)uinttmp;
1848 bp += sizeof(uinttmp);
1850 LOGCOPY_TOLSN(env, &argp->meta_lsn, bp);
1851 bp += sizeof(DB_LSN);
1858 * PUBLIC: int __bam_root_log __P((DB *, DB_TXN *, DB_LSN *,
1859 * PUBLIC: u_int32_t, db_pgno_t, db_pgno_t, DB_LSN *));
1862 __bam_root_log(dbp, txnp, ret_lsnp, flags, meta_pgno, root_pgno, meta_lsn)
1867 db_pgno_t meta_pgno;
1868 db_pgno_t root_pgno;
1872 DB_LSN *lsnp, null_lsn, *rlsnp;
1875 u_int32_t uinttmp, rectype, txn_num;
1878 int is_durable, ret;
1880 COMPQUIET(lr, NULL);
1884 rectype = DB___bam_root;
1888 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
1889 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
1899 null_lsn.file = null_lsn.offset = 0;
1901 if (TAILQ_FIRST(&txnp->kids) != NULL &&
1902 (ret = __txn_activekids(env, rectype, txnp)) != 0)
1905 * We need to assign begin_lsn while holding region mutex.
1906 * That assignment is done inside the DbEnv->log_put call,
1907 * so pass in the appropriate memory location to be filled
1908 * in by the log_put code.
1910 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
1911 txn_num = txnp->txnid;
1914 DB_ASSERT(env, dbp->log_filename != NULL);
1915 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1916 (ret = __dbreg_lazy_id(dbp)) != 0)
1919 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1923 + sizeof(*meta_lsn);
1924 if (CRYPTO_ON(env)) {
1925 npad = env->crypto_handle->adj_size(logrec.size);
1926 logrec.size += npad;
1929 if (is_durable || txnp == NULL) {
1931 __os_malloc(env, logrec.size, &logrec.data)) != 0)
1934 if ((ret = __os_malloc(env,
1935 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
1939 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
1944 logrec.data = lr->data;
1948 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1952 LOGCOPY_32(env, bp, &rectype);
1953 bp += sizeof(rectype);
1955 LOGCOPY_32(env, bp, &txn_num);
1956 bp += sizeof(txn_num);
1958 LOGCOPY_FROMLSN(env, bp, lsnp);
1959 bp += sizeof(DB_LSN);
1961 uinttmp = (u_int32_t)dbp->log_filename->id;
1962 LOGCOPY_32(env, bp, &uinttmp);
1963 bp += sizeof(uinttmp);
1965 uinttmp = (u_int32_t)meta_pgno;
1966 LOGCOPY_32(env,bp, &uinttmp);
1967 bp += sizeof(uinttmp);
1969 uinttmp = (u_int32_t)root_pgno;
1970 LOGCOPY_32(env,bp, &uinttmp);
1971 bp += sizeof(uinttmp);
1973 if (meta_lsn != NULL) {
1975 LOG *lp = env->lg_handle->reginfo.primary;
1976 if (LOG_COMPARE(meta_lsn, &lp->lsn) >= 0 && (ret =
1977 __log_check_page_lsn(env, dbp, meta_lsn)) != 0)
1980 LOGCOPY_FROMLSN(env, bp, meta_lsn);
1982 memset(bp, 0, sizeof(*meta_lsn));
1983 bp += sizeof(*meta_lsn);
1986 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1988 if (is_durable || txnp == NULL) {
1989 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
1990 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
1992 if (rlsnp != ret_lsnp)
1999 * Set the debug bit if we are going to log non-durable
2000 * transactions so they will be ignored by recovery.
2002 memcpy(lr->data, logrec.data, logrec.size);
2003 rectype |= DB_debug_FLAG;
2004 LOGCOPY_32(env, logrec.data, &rectype);
2006 if (!IS_REP_CLIENT(env))
2007 ret = __log_put(env,
2008 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
2010 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
2011 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
2012 LSN_NOT_LOGGED(*ret_lsnp);
2015 #ifdef LOG_DIAGNOSTIC
2017 (void)__bam_root_print(env,
2018 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
2022 __os_free(env, logrec.data);
2024 if (is_durable || txnp == NULL)
2025 __os_free(env, logrec.data);
2031 * PUBLIC: int __bam_curadj_read __P((ENV *, DB **, void *, void *,
2032 * PUBLIC: __bam_curadj_args **));
2035 __bam_curadj_read(env, dbpp, td, recbuf, argpp)
2040 __bam_curadj_args **argpp;
2042 __bam_curadj_args *argp;
2047 if ((ret = __os_malloc(env,
2048 sizeof(__bam_curadj_args) + sizeof(DB_TXN), &argp)) != 0)
2051 argp->txnp = (DB_TXN *)&argp[1];
2052 memset(argp->txnp, 0, sizeof(DB_TXN));
2054 argp->txnp->td = td;
2055 LOGCOPY_32(env, &argp->type, bp);
2056 bp += sizeof(argp->type);
2058 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2059 bp += sizeof(argp->txnp->txnid);
2061 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2062 bp += sizeof(DB_LSN);
2064 LOGCOPY_32(env, &uinttmp, bp);
2065 argp->fileid = (int32_t)uinttmp;
2066 bp += sizeof(uinttmp);
2069 ret = __dbreg_id_to_db(
2070 env, argp->txnp, dbpp, argp->fileid, 1);
2073 LOGCOPY_32(env, &uinttmp, bp);
2074 argp->mode = (db_ca_mode)uinttmp;
2075 bp += sizeof(uinttmp);
2077 LOGCOPY_32(env, &uinttmp, bp);
2078 argp->from_pgno = (db_pgno_t)uinttmp;
2079 bp += sizeof(uinttmp);
2081 LOGCOPY_32(env, &uinttmp, bp);
2082 argp->to_pgno = (db_pgno_t)uinttmp;
2083 bp += sizeof(uinttmp);
2085 LOGCOPY_32(env, &uinttmp, bp);
2086 argp->left_pgno = (db_pgno_t)uinttmp;
2087 bp += sizeof(uinttmp);
2089 LOGCOPY_32(env, &argp->first_indx, bp);
2090 bp += sizeof(argp->first_indx);
2092 LOGCOPY_32(env, &argp->from_indx, bp);
2093 bp += sizeof(argp->from_indx);
2095 LOGCOPY_32(env, &argp->to_indx, bp);
2096 bp += sizeof(argp->to_indx);
2103 * PUBLIC: int __bam_curadj_log __P((DB *, DB_TXN *, DB_LSN *,
2104 * PUBLIC: u_int32_t, db_ca_mode, db_pgno_t, db_pgno_t, db_pgno_t,
2105 * PUBLIC: u_int32_t, u_int32_t, u_int32_t));
2108 __bam_curadj_log(dbp, txnp, ret_lsnp, flags, mode, from_pgno, to_pgno, left_pgno, first_indx,
2115 db_pgno_t from_pgno;
2117 db_pgno_t left_pgno;
2118 u_int32_t first_indx;
2119 u_int32_t from_indx;
2123 DB_LSN *lsnp, null_lsn, *rlsnp;
2126 u_int32_t uinttmp, rectype, txn_num;
2129 int is_durable, ret;
2131 COMPQUIET(lr, NULL);
2135 rectype = DB___bam_curadj;
2139 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
2140 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
2150 null_lsn.file = null_lsn.offset = 0;
2152 if (TAILQ_FIRST(&txnp->kids) != NULL &&
2153 (ret = __txn_activekids(env, rectype, txnp)) != 0)
2156 * We need to assign begin_lsn while holding region mutex.
2157 * That assignment is done inside the DbEnv->log_put call,
2158 * so pass in the appropriate memory location to be filled
2159 * in by the log_put code.
2161 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
2162 txn_num = txnp->txnid;
2165 DB_ASSERT(env, dbp->log_filename != NULL);
2166 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
2167 (ret = __dbreg_lazy_id(dbp)) != 0)
2170 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2178 + sizeof(u_int32_t);
2179 if (CRYPTO_ON(env)) {
2180 npad = env->crypto_handle->adj_size(logrec.size);
2181 logrec.size += npad;
2184 if (is_durable || txnp == NULL) {
2186 __os_malloc(env, logrec.size, &logrec.data)) != 0)
2189 if ((ret = __os_malloc(env,
2190 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
2194 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
2199 logrec.data = lr->data;
2203 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
2207 LOGCOPY_32(env, bp, &rectype);
2208 bp += sizeof(rectype);
2210 LOGCOPY_32(env, bp, &txn_num);
2211 bp += sizeof(txn_num);
2213 LOGCOPY_FROMLSN(env, bp, lsnp);
2214 bp += sizeof(DB_LSN);
2216 uinttmp = (u_int32_t)dbp->log_filename->id;
2217 LOGCOPY_32(env, bp, &uinttmp);
2218 bp += sizeof(uinttmp);
2220 uinttmp = (u_int32_t)mode;
2221 LOGCOPY_32(env,bp, &uinttmp);
2222 bp += sizeof(uinttmp);
2224 uinttmp = (u_int32_t)from_pgno;
2225 LOGCOPY_32(env,bp, &uinttmp);
2226 bp += sizeof(uinttmp);
2228 uinttmp = (u_int32_t)to_pgno;
2229 LOGCOPY_32(env,bp, &uinttmp);
2230 bp += sizeof(uinttmp);
2232 uinttmp = (u_int32_t)left_pgno;
2233 LOGCOPY_32(env,bp, &uinttmp);
2234 bp += sizeof(uinttmp);
2236 LOGCOPY_32(env, bp, &first_indx);
2237 bp += sizeof(first_indx);
2239 LOGCOPY_32(env, bp, &from_indx);
2240 bp += sizeof(from_indx);
2242 LOGCOPY_32(env, bp, &to_indx);
2243 bp += sizeof(to_indx);
2246 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
2248 if (is_durable || txnp == NULL) {
2249 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
2250 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
2252 if (rlsnp != ret_lsnp)
2259 * Set the debug bit if we are going to log non-durable
2260 * transactions so they will be ignored by recovery.
2262 memcpy(lr->data, logrec.data, logrec.size);
2263 rectype |= DB_debug_FLAG;
2264 LOGCOPY_32(env, logrec.data, &rectype);
2266 if (!IS_REP_CLIENT(env))
2267 ret = __log_put(env,
2268 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
2270 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
2271 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
2272 LSN_NOT_LOGGED(*ret_lsnp);
2275 #ifdef LOG_DIAGNOSTIC
2277 (void)__bam_curadj_print(env,
2278 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
2282 __os_free(env, logrec.data);
2284 if (is_durable || txnp == NULL)
2285 __os_free(env, logrec.data);
2291 * PUBLIC: int __bam_rcuradj_read __P((ENV *, DB **, void *, void *,
2292 * PUBLIC: __bam_rcuradj_args **));
2295 __bam_rcuradj_read(env, dbpp, td, recbuf, argpp)
2300 __bam_rcuradj_args **argpp;
2302 __bam_rcuradj_args *argp;
2307 if ((ret = __os_malloc(env,
2308 sizeof(__bam_rcuradj_args) + sizeof(DB_TXN), &argp)) != 0)
2311 argp->txnp = (DB_TXN *)&argp[1];
2312 memset(argp->txnp, 0, sizeof(DB_TXN));
2314 argp->txnp->td = td;
2315 LOGCOPY_32(env, &argp->type, bp);
2316 bp += sizeof(argp->type);
2318 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2319 bp += sizeof(argp->txnp->txnid);
2321 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2322 bp += sizeof(DB_LSN);
2324 LOGCOPY_32(env, &uinttmp, bp);
2325 argp->fileid = (int32_t)uinttmp;
2326 bp += sizeof(uinttmp);
2329 ret = __dbreg_id_to_db(
2330 env, argp->txnp, dbpp, argp->fileid, 1);
2333 LOGCOPY_32(env, &uinttmp, bp);
2334 argp->mode = (ca_recno_arg)uinttmp;
2335 bp += sizeof(uinttmp);
2337 LOGCOPY_32(env, &uinttmp, bp);
2338 argp->root = (db_pgno_t)uinttmp;
2339 bp += sizeof(uinttmp);
2341 LOGCOPY_32(env, &uinttmp, bp);
2342 argp->recno = (db_recno_t)uinttmp;
2343 bp += sizeof(uinttmp);
2345 LOGCOPY_32(env, &argp->order, bp);
2346 bp += sizeof(argp->order);
2353 * PUBLIC: int __bam_rcuradj_log __P((DB *, DB_TXN *, DB_LSN *,
2354 * PUBLIC: u_int32_t, ca_recno_arg, db_pgno_t, db_recno_t, u_int32_t));
2357 __bam_rcuradj_log(dbp, txnp, ret_lsnp, flags, mode, root, recno, order)
2368 DB_LSN *lsnp, null_lsn, *rlsnp;
2371 u_int32_t uinttmp, rectype, txn_num;
2374 int is_durable, ret;
2376 COMPQUIET(lr, NULL);
2380 rectype = DB___bam_rcuradj;
2384 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
2385 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
2395 null_lsn.file = null_lsn.offset = 0;
2397 if (TAILQ_FIRST(&txnp->kids) != NULL &&
2398 (ret = __txn_activekids(env, rectype, txnp)) != 0)
2401 * We need to assign begin_lsn while holding region mutex.
2402 * That assignment is done inside the DbEnv->log_put call,
2403 * so pass in the appropriate memory location to be filled
2404 * in by the log_put code.
2406 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
2407 txn_num = txnp->txnid;
2410 DB_ASSERT(env, dbp->log_filename != NULL);
2411 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
2412 (ret = __dbreg_lazy_id(dbp)) != 0)
2415 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2420 + sizeof(u_int32_t);
2421 if (CRYPTO_ON(env)) {
2422 npad = env->crypto_handle->adj_size(logrec.size);
2423 logrec.size += npad;
2426 if (is_durable || txnp == NULL) {
2428 __os_malloc(env, logrec.size, &logrec.data)) != 0)
2431 if ((ret = __os_malloc(env,
2432 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
2436 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
2441 logrec.data = lr->data;
2445 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
2449 LOGCOPY_32(env, bp, &rectype);
2450 bp += sizeof(rectype);
2452 LOGCOPY_32(env, bp, &txn_num);
2453 bp += sizeof(txn_num);
2455 LOGCOPY_FROMLSN(env, bp, lsnp);
2456 bp += sizeof(DB_LSN);
2458 uinttmp = (u_int32_t)dbp->log_filename->id;
2459 LOGCOPY_32(env, bp, &uinttmp);
2460 bp += sizeof(uinttmp);
2462 uinttmp = (u_int32_t)mode;
2463 LOGCOPY_32(env,bp, &uinttmp);
2464 bp += sizeof(uinttmp);
2466 uinttmp = (u_int32_t)root;
2467 LOGCOPY_32(env,bp, &uinttmp);
2468 bp += sizeof(uinttmp);
2470 uinttmp = (u_int32_t)recno;
2471 LOGCOPY_32(env,bp, &uinttmp);
2472 bp += sizeof(uinttmp);
2474 LOGCOPY_32(env, bp, &order);
2475 bp += sizeof(order);
2478 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
2480 if (is_durable || txnp == NULL) {
2481 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
2482 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
2484 if (rlsnp != ret_lsnp)
2491 * Set the debug bit if we are going to log non-durable
2492 * transactions so they will be ignored by recovery.
2494 memcpy(lr->data, logrec.data, logrec.size);
2495 rectype |= DB_debug_FLAG;
2496 LOGCOPY_32(env, logrec.data, &rectype);
2498 if (!IS_REP_CLIENT(env))
2499 ret = __log_put(env,
2500 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
2502 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
2503 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
2504 LSN_NOT_LOGGED(*ret_lsnp);
2507 #ifdef LOG_DIAGNOSTIC
2509 (void)__bam_rcuradj_print(env,
2510 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
2514 __os_free(env, logrec.data);
2516 if (is_durable || txnp == NULL)
2517 __os_free(env, logrec.data);
2523 * PUBLIC: int __bam_relink_43_read __P((ENV *, DB **, void *,
2524 * PUBLIC: void *, __bam_relink_43_args **));
2527 __bam_relink_43_read(env, dbpp, td, recbuf, argpp)
2532 __bam_relink_43_args **argpp;
2534 __bam_relink_43_args *argp;
2539 if ((ret = __os_malloc(env,
2540 sizeof(__bam_relink_43_args) + sizeof(DB_TXN), &argp)) != 0)
2543 argp->txnp = (DB_TXN *)&argp[1];
2544 memset(argp->txnp, 0, sizeof(DB_TXN));
2546 argp->txnp->td = td;
2547 LOGCOPY_32(env, &argp->type, bp);
2548 bp += sizeof(argp->type);
2550 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2551 bp += sizeof(argp->txnp->txnid);
2553 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2554 bp += sizeof(DB_LSN);
2556 LOGCOPY_32(env, &uinttmp, bp);
2557 argp->fileid = (int32_t)uinttmp;
2558 bp += sizeof(uinttmp);
2561 ret = __dbreg_id_to_db(
2562 env, argp->txnp, dbpp, argp->fileid, 1);
2565 LOGCOPY_32(env, &uinttmp, bp);
2566 argp->pgno = (db_pgno_t)uinttmp;
2567 bp += sizeof(uinttmp);
2569 LOGCOPY_TOLSN(env, &argp->lsn, bp);
2570 bp += sizeof(DB_LSN);
2572 LOGCOPY_32(env, &uinttmp, bp);
2573 argp->prev = (db_pgno_t)uinttmp;
2574 bp += sizeof(uinttmp);
2576 LOGCOPY_TOLSN(env, &argp->lsn_prev, bp);
2577 bp += sizeof(DB_LSN);
2579 LOGCOPY_32(env, &uinttmp, bp);
2580 argp->next = (db_pgno_t)uinttmp;
2581 bp += sizeof(uinttmp);
2583 LOGCOPY_TOLSN(env, &argp->lsn_next, bp);
2584 bp += sizeof(DB_LSN);
2591 * PUBLIC: int __bam_relink_read __P((ENV *, DB **, void *, void *,
2592 * PUBLIC: __bam_relink_args **));
2595 __bam_relink_read(env, dbpp, td, recbuf, argpp)
2600 __bam_relink_args **argpp;
2602 __bam_relink_args *argp;
2607 if ((ret = __os_malloc(env,
2608 sizeof(__bam_relink_args) + sizeof(DB_TXN), &argp)) != 0)
2611 argp->txnp = (DB_TXN *)&argp[1];
2612 memset(argp->txnp, 0, sizeof(DB_TXN));
2614 argp->txnp->td = td;
2615 LOGCOPY_32(env, &argp->type, bp);
2616 bp += sizeof(argp->type);
2618 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2619 bp += sizeof(argp->txnp->txnid);
2621 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2622 bp += sizeof(DB_LSN);
2624 LOGCOPY_32(env, &uinttmp, bp);
2625 argp->fileid = (int32_t)uinttmp;
2626 bp += sizeof(uinttmp);
2629 ret = __dbreg_id_to_db(
2630 env, argp->txnp, dbpp, argp->fileid, 1);
2633 LOGCOPY_32(env, &uinttmp, bp);
2634 argp->pgno = (db_pgno_t)uinttmp;
2635 bp += sizeof(uinttmp);
2637 LOGCOPY_32(env, &uinttmp, bp);
2638 argp->new_pgno = (db_pgno_t)uinttmp;
2639 bp += sizeof(uinttmp);
2641 LOGCOPY_32(env, &uinttmp, bp);
2642 argp->prev = (db_pgno_t)uinttmp;
2643 bp += sizeof(uinttmp);
2645 LOGCOPY_TOLSN(env, &argp->lsn_prev, bp);
2646 bp += sizeof(DB_LSN);
2648 LOGCOPY_32(env, &uinttmp, bp);
2649 argp->next = (db_pgno_t)uinttmp;
2650 bp += sizeof(uinttmp);
2652 LOGCOPY_TOLSN(env, &argp->lsn_next, bp);
2653 bp += sizeof(DB_LSN);
2660 * PUBLIC: int __bam_relink_log __P((DB *, DB_TXN *, DB_LSN *,
2661 * PUBLIC: u_int32_t, db_pgno_t, db_pgno_t, db_pgno_t, DB_LSN *, db_pgno_t,
2662 * PUBLIC: DB_LSN *));
2665 __bam_relink_log(dbp, txnp, ret_lsnp, flags, pgno, new_pgno, prev, lsn_prev, next,
2679 DB_LSN *lsnp, null_lsn, *rlsnp;
2682 u_int32_t uinttmp, rectype, txn_num;
2685 int is_durable, ret;
2687 COMPQUIET(lr, NULL);
2691 rectype = DB___bam_relink;
2695 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
2696 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
2706 null_lsn.file = null_lsn.offset = 0;
2708 if (TAILQ_FIRST(&txnp->kids) != NULL &&
2709 (ret = __txn_activekids(env, rectype, txnp)) != 0)
2712 * We need to assign begin_lsn while holding region mutex.
2713 * That assignment is done inside the DbEnv->log_put call,
2714 * so pass in the appropriate memory location to be filled
2715 * in by the log_put code.
2717 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
2718 txn_num = txnp->txnid;
2721 DB_ASSERT(env, dbp->log_filename != NULL);
2722 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
2723 (ret = __dbreg_lazy_id(dbp)) != 0)
2726 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2733 + sizeof(*lsn_next);
2734 if (CRYPTO_ON(env)) {
2735 npad = env->crypto_handle->adj_size(logrec.size);
2736 logrec.size += npad;
2739 if (is_durable || txnp == NULL) {
2741 __os_malloc(env, logrec.size, &logrec.data)) != 0)
2744 if ((ret = __os_malloc(env,
2745 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
2749 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
2754 logrec.data = lr->data;
2758 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
2762 LOGCOPY_32(env, bp, &rectype);
2763 bp += sizeof(rectype);
2765 LOGCOPY_32(env, bp, &txn_num);
2766 bp += sizeof(txn_num);
2768 LOGCOPY_FROMLSN(env, bp, lsnp);
2769 bp += sizeof(DB_LSN);
2771 uinttmp = (u_int32_t)dbp->log_filename->id;
2772 LOGCOPY_32(env, bp, &uinttmp);
2773 bp += sizeof(uinttmp);
2775 uinttmp = (u_int32_t)pgno;
2776 LOGCOPY_32(env,bp, &uinttmp);
2777 bp += sizeof(uinttmp);
2779 uinttmp = (u_int32_t)new_pgno;
2780 LOGCOPY_32(env,bp, &uinttmp);
2781 bp += sizeof(uinttmp);
2783 uinttmp = (u_int32_t)prev;
2784 LOGCOPY_32(env,bp, &uinttmp);
2785 bp += sizeof(uinttmp);
2787 if (lsn_prev != NULL) {
2789 LOG *lp = env->lg_handle->reginfo.primary;
2790 if (LOG_COMPARE(lsn_prev, &lp->lsn) >= 0 && (ret =
2791 __log_check_page_lsn(env, dbp, lsn_prev)) != 0)
2794 LOGCOPY_FROMLSN(env, bp, lsn_prev);
2796 memset(bp, 0, sizeof(*lsn_prev));
2797 bp += sizeof(*lsn_prev);
2799 uinttmp = (u_int32_t)next;
2800 LOGCOPY_32(env,bp, &uinttmp);
2801 bp += sizeof(uinttmp);
2803 if (lsn_next != NULL) {
2805 LOG *lp = env->lg_handle->reginfo.primary;
2806 if (LOG_COMPARE(lsn_next, &lp->lsn) >= 0 && (ret =
2807 __log_check_page_lsn(env, dbp, lsn_next)) != 0)
2810 LOGCOPY_FROMLSN(env, bp, lsn_next);
2812 memset(bp, 0, sizeof(*lsn_next));
2813 bp += sizeof(*lsn_next);
2816 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
2818 if (is_durable || txnp == NULL) {
2819 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
2820 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
2822 if (rlsnp != ret_lsnp)
2829 * Set the debug bit if we are going to log non-durable
2830 * transactions so they will be ignored by recovery.
2832 memcpy(lr->data, logrec.data, logrec.size);
2833 rectype |= DB_debug_FLAG;
2834 LOGCOPY_32(env, logrec.data, &rectype);
2836 if (!IS_REP_CLIENT(env))
2837 ret = __log_put(env,
2838 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
2840 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
2841 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
2842 LSN_NOT_LOGGED(*ret_lsnp);
2845 #ifdef LOG_DIAGNOSTIC
2847 (void)__bam_relink_print(env,
2848 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
2852 __os_free(env, logrec.data);
2854 if (is_durable || txnp == NULL)
2855 __os_free(env, logrec.data);
2861 * PUBLIC: int __bam_merge_44_read __P((ENV *, DB **, void *,
2862 * PUBLIC: void *, __bam_merge_44_args **));
2865 __bam_merge_44_read(env, dbpp, td, recbuf, argpp)
2870 __bam_merge_44_args **argpp;
2872 __bam_merge_44_args *argp;
2877 if ((ret = __os_malloc(env,
2878 sizeof(__bam_merge_44_args) + sizeof(DB_TXN), &argp)) != 0)
2881 argp->txnp = (DB_TXN *)&argp[1];
2882 memset(argp->txnp, 0, sizeof(DB_TXN));
2884 argp->txnp->td = td;
2885 LOGCOPY_32(env, &argp->type, bp);
2886 bp += sizeof(argp->type);
2888 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2889 bp += sizeof(argp->txnp->txnid);
2891 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2892 bp += sizeof(DB_LSN);
2894 LOGCOPY_32(env, &uinttmp, bp);
2895 argp->fileid = (int32_t)uinttmp;
2896 bp += sizeof(uinttmp);
2899 ret = __dbreg_id_to_db(
2900 env, argp->txnp, dbpp, argp->fileid, 1);
2903 LOGCOPY_32(env, &uinttmp, bp);
2904 argp->pgno = (db_pgno_t)uinttmp;
2905 bp += sizeof(uinttmp);
2907 LOGCOPY_TOLSN(env, &argp->lsn, bp);
2908 bp += sizeof(DB_LSN);
2910 LOGCOPY_32(env, &uinttmp, bp);
2911 argp->npgno = (db_pgno_t)uinttmp;
2912 bp += sizeof(uinttmp);
2914 LOGCOPY_TOLSN(env, &argp->nlsn, bp);
2915 bp += sizeof(DB_LSN);
2917 memset(&argp->hdr, 0, sizeof(argp->hdr));
2918 LOGCOPY_32(env,&argp->hdr.size, bp);
2919 bp += sizeof(u_int32_t);
2920 argp->hdr.data = bp;
2921 bp += argp->hdr.size;
2923 memset(&argp->data, 0, sizeof(argp->data));
2924 LOGCOPY_32(env,&argp->data.size, bp);
2925 bp += sizeof(u_int32_t);
2926 argp->data.data = bp;
2927 bp += argp->data.size;
2929 memset(&argp->ind, 0, sizeof(argp->ind));
2930 LOGCOPY_32(env,&argp->ind.size, bp);
2931 bp += sizeof(u_int32_t);
2932 argp->ind.data = bp;
2933 bp += argp->ind.size;
2940 * PUBLIC: int __bam_merge_read __P((ENV *, DB **, void *, void *,
2941 * PUBLIC: __bam_merge_args **));
2944 __bam_merge_read(env, dbpp, td, recbuf, argpp)
2949 __bam_merge_args **argpp;
2951 __bam_merge_args *argp;
2956 if ((ret = __os_malloc(env,
2957 sizeof(__bam_merge_args) + sizeof(DB_TXN), &argp)) != 0)
2960 argp->txnp = (DB_TXN *)&argp[1];
2961 memset(argp->txnp, 0, sizeof(DB_TXN));
2963 argp->txnp->td = td;
2964 LOGCOPY_32(env, &argp->type, bp);
2965 bp += sizeof(argp->type);
2967 LOGCOPY_32(env, &argp->txnp->txnid, bp);
2968 bp += sizeof(argp->txnp->txnid);
2970 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
2971 bp += sizeof(DB_LSN);
2973 LOGCOPY_32(env, &uinttmp, bp);
2974 argp->fileid = (int32_t)uinttmp;
2975 bp += sizeof(uinttmp);
2978 ret = __dbreg_id_to_db(
2979 env, argp->txnp, dbpp, argp->fileid, 1);
2982 LOGCOPY_32(env, &uinttmp, bp);
2983 argp->pgno = (db_pgno_t)uinttmp;
2984 bp += sizeof(uinttmp);
2986 LOGCOPY_TOLSN(env, &argp->lsn, bp);
2987 bp += sizeof(DB_LSN);
2989 LOGCOPY_32(env, &uinttmp, bp);
2990 argp->npgno = (db_pgno_t)uinttmp;
2991 bp += sizeof(uinttmp);
2993 LOGCOPY_TOLSN(env, &argp->nlsn, bp);
2994 bp += sizeof(DB_LSN);
2996 memset(&argp->hdr, 0, sizeof(argp->hdr));
2997 LOGCOPY_32(env,&argp->hdr.size, bp);
2998 bp += sizeof(u_int32_t);
2999 argp->hdr.data = bp;
3000 bp += argp->hdr.size;
3002 memset(&argp->data, 0, sizeof(argp->data));
3003 LOGCOPY_32(env,&argp->data.size, bp);
3004 bp += sizeof(u_int32_t);
3005 argp->data.data = bp;
3006 bp += argp->data.size;
3007 if (LOG_SWAPPED(env) && dbpp != NULL && *dbpp != NULL) {
3009 if ((t_ret = __db_pageswap(*dbpp,
3010 (PAGE *)argp->hdr.data, (size_t)argp->hdr.size,
3011 &argp->data, 1)) != 0)
3015 LOGCOPY_32(env, &uinttmp, bp);
3016 argp->pg_copy = (int32_t)uinttmp;
3017 bp += sizeof(uinttmp);
3024 * PUBLIC: int __bam_merge_log __P((DB *, DB_TXN *, DB_LSN *,
3025 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, const DBT *,
3026 * PUBLIC: const DBT *, int32_t));
3029 __bam_merge_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, npgno, nlsn, hdr,
3044 DB_LSN *lsnp, null_lsn, *rlsnp;
3047 u_int32_t zero, uinttmp, rectype, txn_num;
3050 int is_durable, ret;
3052 COMPQUIET(lr, NULL);
3056 rectype = DB___bam_merge;
3060 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
3061 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
3071 null_lsn.file = null_lsn.offset = 0;
3073 if (TAILQ_FIRST(&txnp->kids) != NULL &&
3074 (ret = __txn_activekids(env, rectype, txnp)) != 0)
3077 * We need to assign begin_lsn while holding region mutex.
3078 * That assignment is done inside the DbEnv->log_put call,
3079 * so pass in the appropriate memory location to be filled
3080 * in by the log_put code.
3082 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
3083 txn_num = txnp->txnid;
3086 DB_ASSERT(env, dbp->log_filename != NULL);
3087 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
3088 (ret = __dbreg_lazy_id(dbp)) != 0)
3091 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
3097 + sizeof(u_int32_t) + (hdr == NULL ? 0 : hdr->size)
3098 + sizeof(u_int32_t) + (data == NULL ? 0 : data->size)
3099 + sizeof(u_int32_t);
3100 if (CRYPTO_ON(env)) {
3101 npad = env->crypto_handle->adj_size(logrec.size);
3102 logrec.size += npad;
3105 if (is_durable || txnp == NULL) {
3107 __os_malloc(env, logrec.size, &logrec.data)) != 0)
3110 if ((ret = __os_malloc(env,
3111 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
3115 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
3120 logrec.data = lr->data;
3124 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
3128 LOGCOPY_32(env, bp, &rectype);
3129 bp += sizeof(rectype);
3131 LOGCOPY_32(env, bp, &txn_num);
3132 bp += sizeof(txn_num);
3134 LOGCOPY_FROMLSN(env, bp, lsnp);
3135 bp += sizeof(DB_LSN);
3137 uinttmp = (u_int32_t)dbp->log_filename->id;
3138 LOGCOPY_32(env, bp, &uinttmp);
3139 bp += sizeof(uinttmp);
3141 uinttmp = (u_int32_t)pgno;
3142 LOGCOPY_32(env,bp, &uinttmp);
3143 bp += sizeof(uinttmp);
3147 LOG *lp = env->lg_handle->reginfo.primary;
3148 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
3149 __log_check_page_lsn(env, dbp, lsn)) != 0)
3152 LOGCOPY_FROMLSN(env, bp, lsn);
3154 memset(bp, 0, sizeof(*lsn));
3157 uinttmp = (u_int32_t)npgno;
3158 LOGCOPY_32(env,bp, &uinttmp);
3159 bp += sizeof(uinttmp);
3163 LOG *lp = env->lg_handle->reginfo.primary;
3164 if (LOG_COMPARE(nlsn, &lp->lsn) >= 0 && (ret =
3165 __log_check_page_lsn(env, dbp, nlsn)) != 0)
3168 LOGCOPY_FROMLSN(env, bp, nlsn);
3170 memset(bp, 0, sizeof(*nlsn));
3171 bp += sizeof(*nlsn);
3175 LOGCOPY_32(env, bp, &zero);
3176 bp += sizeof(u_int32_t);
3178 LOGCOPY_32(env, bp, &hdr->size);
3179 bp += sizeof(hdr->size);
3180 memcpy(bp, hdr->data, hdr->size);
3181 if (LOG_SWAPPED(env))
3182 if ((ret = __db_pageswap(dbp,
3183 (PAGE *)bp, (size_t)hdr->size, (DBT *)data, 0)) != 0)
3190 LOGCOPY_32(env, bp, &zero);
3191 bp += sizeof(u_int32_t);
3193 LOGCOPY_32(env, bp, &data->size);
3194 bp += sizeof(data->size);
3195 memcpy(bp, data->data, data->size);
3196 if (LOG_SWAPPED(env) && F_ISSET(data, DB_DBT_APPMALLOC))
3197 __os_free(env, data->data);
3201 uinttmp = (u_int32_t)pg_copy;
3202 LOGCOPY_32(env,bp, &uinttmp);
3203 bp += sizeof(uinttmp);
3206 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
3208 if (is_durable || txnp == NULL) {
3209 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
3210 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
3212 if (rlsnp != ret_lsnp)
3219 * Set the debug bit if we are going to log non-durable
3220 * transactions so they will be ignored by recovery.
3222 memcpy(lr->data, logrec.data, logrec.size);
3223 rectype |= DB_debug_FLAG;
3224 LOGCOPY_32(env, logrec.data, &rectype);
3226 if (!IS_REP_CLIENT(env))
3227 ret = __log_put(env,
3228 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
3230 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
3231 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
3232 LSN_NOT_LOGGED(*ret_lsnp);
3235 #ifdef LOG_DIAGNOSTIC
3237 (void)__bam_merge_print(env,
3238 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
3242 __os_free(env, logrec.data);
3244 if (is_durable || txnp == NULL)
3245 __os_free(env, logrec.data);
3251 * PUBLIC: int __bam_pgno_read __P((ENV *, DB **, void *, void *,
3252 * PUBLIC: __bam_pgno_args **));
3255 __bam_pgno_read(env, dbpp, td, recbuf, argpp)
3260 __bam_pgno_args **argpp;
3262 __bam_pgno_args *argp;
3267 if ((ret = __os_malloc(env,
3268 sizeof(__bam_pgno_args) + sizeof(DB_TXN), &argp)) != 0)
3271 argp->txnp = (DB_TXN *)&argp[1];
3272 memset(argp->txnp, 0, sizeof(DB_TXN));
3274 argp->txnp->td = td;
3275 LOGCOPY_32(env, &argp->type, bp);
3276 bp += sizeof(argp->type);
3278 LOGCOPY_32(env, &argp->txnp->txnid, bp);
3279 bp += sizeof(argp->txnp->txnid);
3281 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
3282 bp += sizeof(DB_LSN);
3284 LOGCOPY_32(env, &uinttmp, bp);
3285 argp->fileid = (int32_t)uinttmp;
3286 bp += sizeof(uinttmp);
3289 ret = __dbreg_id_to_db(
3290 env, argp->txnp, dbpp, argp->fileid, 1);
3293 LOGCOPY_32(env, &uinttmp, bp);
3294 argp->pgno = (db_pgno_t)uinttmp;
3295 bp += sizeof(uinttmp);
3297 LOGCOPY_TOLSN(env, &argp->lsn, bp);
3298 bp += sizeof(DB_LSN);
3300 LOGCOPY_32(env, &argp->indx, bp);
3301 bp += sizeof(argp->indx);
3303 LOGCOPY_32(env, &uinttmp, bp);
3304 argp->opgno = (db_pgno_t)uinttmp;
3305 bp += sizeof(uinttmp);
3307 LOGCOPY_32(env, &uinttmp, bp);
3308 argp->npgno = (db_pgno_t)uinttmp;
3309 bp += sizeof(uinttmp);
3316 * PUBLIC: int __bam_pgno_log __P((DB *, DB_TXN *, DB_LSN *,
3317 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, db_pgno_t,
3318 * PUBLIC: db_pgno_t));
3321 __bam_pgno_log(dbp, txnp, ret_lsnp, flags, pgno, lsn, indx, opgno, npgno)
3333 DB_LSN *lsnp, null_lsn, *rlsnp;
3336 u_int32_t uinttmp, rectype, txn_num;
3339 int is_durable, ret;
3341 COMPQUIET(lr, NULL);
3345 rectype = DB___bam_pgno;
3349 if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
3350 F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
3360 null_lsn.file = null_lsn.offset = 0;
3362 if (TAILQ_FIRST(&txnp->kids) != NULL &&
3363 (ret = __txn_activekids(env, rectype, txnp)) != 0)
3366 * We need to assign begin_lsn while holding region mutex.
3367 * That assignment is done inside the DbEnv->log_put call,
3368 * so pass in the appropriate memory location to be filled
3369 * in by the log_put code.
3371 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
3372 txn_num = txnp->txnid;
3375 DB_ASSERT(env, dbp->log_filename != NULL);
3376 if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
3377 (ret = __dbreg_lazy_id(dbp)) != 0)
3380 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
3386 + sizeof(u_int32_t);
3387 if (CRYPTO_ON(env)) {
3388 npad = env->crypto_handle->adj_size(logrec.size);
3389 logrec.size += npad;
3392 if (is_durable || txnp == NULL) {
3394 __os_malloc(env, logrec.size, &logrec.data)) != 0)
3397 if ((ret = __os_malloc(env,
3398 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
3402 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
3407 logrec.data = lr->data;
3411 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
3415 LOGCOPY_32(env, bp, &rectype);
3416 bp += sizeof(rectype);
3418 LOGCOPY_32(env, bp, &txn_num);
3419 bp += sizeof(txn_num);
3421 LOGCOPY_FROMLSN(env, bp, lsnp);
3422 bp += sizeof(DB_LSN);
3424 uinttmp = (u_int32_t)dbp->log_filename->id;
3425 LOGCOPY_32(env, bp, &uinttmp);
3426 bp += sizeof(uinttmp);
3428 uinttmp = (u_int32_t)pgno;
3429 LOGCOPY_32(env,bp, &uinttmp);
3430 bp += sizeof(uinttmp);
3434 LOG *lp = env->lg_handle->reginfo.primary;
3435 if (LOG_COMPARE(lsn, &lp->lsn) >= 0 && (ret =
3436 __log_check_page_lsn(env, dbp, lsn)) != 0)
3439 LOGCOPY_FROMLSN(env, bp, lsn);
3441 memset(bp, 0, sizeof(*lsn));
3444 LOGCOPY_32(env, bp, &indx);
3447 uinttmp = (u_int32_t)opgno;
3448 LOGCOPY_32(env,bp, &uinttmp);
3449 bp += sizeof(uinttmp);
3451 uinttmp = (u_int32_t)npgno;
3452 LOGCOPY_32(env,bp, &uinttmp);
3453 bp += sizeof(uinttmp);
3456 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
3458 if (is_durable || txnp == NULL) {
3459 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
3460 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
3462 if (rlsnp != ret_lsnp)
3469 * Set the debug bit if we are going to log non-durable
3470 * transactions so they will be ignored by recovery.
3472 memcpy(lr->data, logrec.data, logrec.size);
3473 rectype |= DB_debug_FLAG;
3474 LOGCOPY_32(env, logrec.data, &rectype);
3476 if (!IS_REP_CLIENT(env))
3477 ret = __log_put(env,
3478 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
3480 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
3481 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
3482 LSN_NOT_LOGGED(*ret_lsnp);
3485 #ifdef LOG_DIAGNOSTIC
3487 (void)__bam_pgno_print(env,
3488 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
3492 __os_free(env, logrec.data);
3494 if (is_durable || txnp == NULL)
3495 __os_free(env, logrec.data);
3501 * PUBLIC: int __bam_init_recover __P((ENV *, DB_DISTAB *));
3504 __bam_init_recover(env, dtabp)
3510 if ((ret = __db_add_recovery_int(env, dtabp,
3511 __bam_split_recover, DB___bam_split)) != 0)
3513 if ((ret = __db_add_recovery_int(env, dtabp,
3514 __bam_rsplit_recover, DB___bam_rsplit)) != 0)
3516 if ((ret = __db_add_recovery_int(env, dtabp,
3517 __bam_adj_recover, DB___bam_adj)) != 0)
3519 if ((ret = __db_add_recovery_int(env, dtabp,
3520 __bam_cadjust_recover, DB___bam_cadjust)) != 0)
3522 if ((ret = __db_add_recovery_int(env, dtabp,
3523 __bam_cdel_recover, DB___bam_cdel)) != 0)
3525 if ((ret = __db_add_recovery_int(env, dtabp,
3526 __bam_repl_recover, DB___bam_repl)) != 0)
3528 if ((ret = __db_add_recovery_int(env, dtabp,
3529 __bam_root_recover, DB___bam_root)) != 0)
3531 if ((ret = __db_add_recovery_int(env, dtabp,
3532 __bam_curadj_recover, DB___bam_curadj)) != 0)
3534 if ((ret = __db_add_recovery_int(env, dtabp,
3535 __bam_rcuradj_recover, DB___bam_rcuradj)) != 0)
3537 if ((ret = __db_add_recovery_int(env, dtabp,
3538 __bam_relink_recover, DB___bam_relink)) != 0)
3540 if ((ret = __db_add_recovery_int(env, dtabp,
3541 __bam_merge_recover, DB___bam_merge)) != 0)
3543 if ((ret = __db_add_recovery_int(env, dtabp,
3544 __bam_pgno_recover, DB___bam_pgno)) != 0)