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_dispatch.h"
8 #include "dbinc/db_am.h"
9 #include "dbinc/lock.h"
10 #include "dbinc/log.h"
11 #include "dbinc/txn.h"
14 * PUBLIC: int __txn_regop_42_read __P((ENV *, void *,
15 * PUBLIC: __txn_regop_42_args **));
18 __txn_regop_42_read(env, recbuf, argpp)
21 __txn_regop_42_args **argpp;
23 __txn_regop_42_args *argp;
28 if ((ret = __os_malloc(env,
29 sizeof(__txn_regop_42_args) + sizeof(DB_TXN), &argp)) != 0)
32 argp->txnp = (DB_TXN *)&argp[1];
33 memset(argp->txnp, 0, sizeof(DB_TXN));
35 LOGCOPY_32(env, &argp->type, bp);
36 bp += sizeof(argp->type);
38 LOGCOPY_32(env, &argp->txnp->txnid, bp);
39 bp += sizeof(argp->txnp->txnid);
41 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
44 LOGCOPY_32(env, &argp->opcode, bp);
45 bp += sizeof(argp->opcode);
47 LOGCOPY_32(env, &uinttmp, bp);
48 argp->timestamp = (int32_t)uinttmp;
49 bp += sizeof(uinttmp);
51 memset(&argp->locks, 0, sizeof(argp->locks));
52 LOGCOPY_32(env,&argp->locks.size, bp);
53 bp += sizeof(u_int32_t);
54 argp->locks.data = bp;
55 bp += argp->locks.size;
62 * PUBLIC: int __txn_regop_read __P((ENV *, void *, __txn_regop_args **));
65 __txn_regop_read(env, recbuf, argpp)
68 __txn_regop_args **argpp;
70 __txn_regop_args *argp;
75 if ((ret = __os_malloc(env,
76 sizeof(__txn_regop_args) + sizeof(DB_TXN), &argp)) != 0)
79 argp->txnp = (DB_TXN *)&argp[1];
80 memset(argp->txnp, 0, sizeof(DB_TXN));
82 LOGCOPY_32(env, &argp->type, bp);
83 bp += sizeof(argp->type);
85 LOGCOPY_32(env, &argp->txnp->txnid, bp);
86 bp += sizeof(argp->txnp->txnid);
88 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
91 LOGCOPY_32(env, &argp->opcode, bp);
92 bp += sizeof(argp->opcode);
94 LOGCOPY_32(env, &uinttmp, bp);
95 argp->timestamp = (int32_t)uinttmp;
96 bp += sizeof(uinttmp);
98 LOGCOPY_32(env, &argp->envid, bp);
99 bp += sizeof(argp->envid);
101 memset(&argp->locks, 0, sizeof(argp->locks));
102 LOGCOPY_32(env,&argp->locks.size, bp);
103 bp += sizeof(u_int32_t);
104 argp->locks.data = bp;
105 bp += argp->locks.size;
112 * PUBLIC: int __txn_regop_log __P((ENV *, DB_TXN *, DB_LSN *,
113 * PUBLIC: u_int32_t, u_int32_t, int32_t, u_int32_t, const DBT *));
116 __txn_regop_log(env, txnp, ret_lsnp, flags,
117 opcode, timestamp, envid, locks)
128 DB_LSN *lsnp, null_lsn, *rlsnp;
130 u_int32_t zero, uinttmp, rectype, txn_num;
138 rectype = DB___txn_regop;
142 if (LF_ISSET(DB_LOG_NOT_DURABLE)) {
152 null_lsn.file = null_lsn.offset = 0;
154 if (TAILQ_FIRST(&txnp->kids) != NULL &&
155 (ret = __txn_activekids(env, rectype, txnp)) != 0)
158 * We need to assign begin_lsn while holding region mutex.
159 * That assignment is done inside the DbEnv->log_put call,
160 * so pass in the appropriate memory location to be filled
161 * in by the log_put code.
163 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
164 txn_num = txnp->txnid;
167 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
171 + sizeof(u_int32_t) + (locks == NULL ? 0 : locks->size);
172 if (CRYPTO_ON(env)) {
173 npad = env->crypto_handle->adj_size(logrec.size);
177 if (is_durable || txnp == NULL) {
179 __os_malloc(env, logrec.size, &logrec.data)) != 0)
182 if ((ret = __os_malloc(env,
183 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
187 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
192 logrec.data = lr->data;
196 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
200 LOGCOPY_32(env, bp, &rectype);
201 bp += sizeof(rectype);
203 LOGCOPY_32(env, bp, &txn_num);
204 bp += sizeof(txn_num);
206 LOGCOPY_FROMLSN(env, bp, lsnp);
207 bp += sizeof(DB_LSN);
209 LOGCOPY_32(env, bp, &opcode);
210 bp += sizeof(opcode);
212 uinttmp = (u_int32_t)timestamp;
213 LOGCOPY_32(env,bp, &uinttmp);
214 bp += sizeof(uinttmp);
216 LOGCOPY_32(env, bp, &envid);
221 LOGCOPY_32(env, bp, &zero);
222 bp += sizeof(u_int32_t);
224 LOGCOPY_32(env, bp, &locks->size);
225 bp += sizeof(locks->size);
226 memcpy(bp, locks->data, locks->size);
231 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
233 if (is_durable || txnp == NULL) {
234 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
235 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
237 if (rlsnp != ret_lsnp)
244 * Set the debug bit if we are going to log non-durable
245 * transactions so they will be ignored by recovery.
247 memcpy(lr->data, logrec.data, logrec.size);
248 rectype |= DB_debug_FLAG;
249 LOGCOPY_32(env, logrec.data, &rectype);
251 if (!IS_REP_CLIENT(env))
253 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
255 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
256 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
257 LSN_NOT_LOGGED(*ret_lsnp);
260 #ifdef LOG_DIAGNOSTIC
262 (void)__txn_regop_print(env,
263 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
267 __os_free(env, logrec.data);
269 if (is_durable || txnp == NULL)
270 __os_free(env, logrec.data);
276 * PUBLIC: int __txn_ckp_42_read __P((ENV *, void *, __txn_ckp_42_args **));
279 __txn_ckp_42_read(env, recbuf, argpp)
282 __txn_ckp_42_args **argpp;
284 __txn_ckp_42_args *argp;
289 if ((ret = __os_malloc(env,
290 sizeof(__txn_ckp_42_args) + sizeof(DB_TXN), &argp)) != 0)
293 argp->txnp = (DB_TXN *)&argp[1];
294 memset(argp->txnp, 0, sizeof(DB_TXN));
296 LOGCOPY_32(env, &argp->type, bp);
297 bp += sizeof(argp->type);
299 LOGCOPY_32(env, &argp->txnp->txnid, bp);
300 bp += sizeof(argp->txnp->txnid);
302 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
303 bp += sizeof(DB_LSN);
305 LOGCOPY_TOLSN(env, &argp->ckp_lsn, bp);
306 bp += sizeof(DB_LSN);
308 LOGCOPY_TOLSN(env, &argp->last_ckp, bp);
309 bp += sizeof(DB_LSN);
311 LOGCOPY_32(env, &uinttmp, bp);
312 argp->timestamp = (int32_t)uinttmp;
313 bp += sizeof(uinttmp);
315 LOGCOPY_32(env, &argp->rep_gen, bp);
316 bp += sizeof(argp->rep_gen);
323 * PUBLIC: int __txn_ckp_read __P((ENV *, void *, __txn_ckp_args **));
326 __txn_ckp_read(env, recbuf, argpp)
329 __txn_ckp_args **argpp;
331 __txn_ckp_args *argp;
336 if ((ret = __os_malloc(env,
337 sizeof(__txn_ckp_args) + sizeof(DB_TXN), &argp)) != 0)
340 argp->txnp = (DB_TXN *)&argp[1];
341 memset(argp->txnp, 0, sizeof(DB_TXN));
343 LOGCOPY_32(env, &argp->type, bp);
344 bp += sizeof(argp->type);
346 LOGCOPY_32(env, &argp->txnp->txnid, bp);
347 bp += sizeof(argp->txnp->txnid);
349 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
350 bp += sizeof(DB_LSN);
352 LOGCOPY_TOLSN(env, &argp->ckp_lsn, bp);
353 bp += sizeof(DB_LSN);
355 LOGCOPY_TOLSN(env, &argp->last_ckp, bp);
356 bp += sizeof(DB_LSN);
358 LOGCOPY_32(env, &uinttmp, bp);
359 argp->timestamp = (int32_t)uinttmp;
360 bp += sizeof(uinttmp);
362 LOGCOPY_32(env, &argp->envid, bp);
363 bp += sizeof(argp->envid);
365 LOGCOPY_32(env, &argp->spare, bp);
366 bp += sizeof(argp->spare);
373 * PUBLIC: int __txn_ckp_log __P((ENV *, DB_TXN *, DB_LSN *,
374 * PUBLIC: u_int32_t, DB_LSN *, DB_LSN *, int32_t, u_int32_t, u_int32_t));
377 __txn_ckp_log(env, txnp, ret_lsnp, flags,
378 ckp_lsn, last_ckp, timestamp, envid, spare)
390 DB_LSN *lsnp, null_lsn, *rlsnp;
392 u_int32_t uinttmp, rectype, txn_num;
400 rectype = DB___txn_ckp;
404 if (LF_ISSET(DB_LOG_NOT_DURABLE)) {
414 null_lsn.file = null_lsn.offset = 0;
416 if (TAILQ_FIRST(&txnp->kids) != NULL &&
417 (ret = __txn_activekids(env, rectype, txnp)) != 0)
420 * We need to assign begin_lsn while holding region mutex.
421 * That assignment is done inside the DbEnv->log_put call,
422 * so pass in the appropriate memory location to be filled
423 * in by the log_put code.
425 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
426 txn_num = txnp->txnid;
429 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
435 if (CRYPTO_ON(env)) {
436 npad = env->crypto_handle->adj_size(logrec.size);
440 if (is_durable || txnp == NULL) {
442 __os_malloc(env, logrec.size, &logrec.data)) != 0)
445 if ((ret = __os_malloc(env,
446 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
450 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
455 logrec.data = lr->data;
459 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
463 LOGCOPY_32(env, bp, &rectype);
464 bp += sizeof(rectype);
466 LOGCOPY_32(env, bp, &txn_num);
467 bp += sizeof(txn_num);
469 LOGCOPY_FROMLSN(env, bp, lsnp);
470 bp += sizeof(DB_LSN);
473 LOGCOPY_FROMLSN(env, bp, ckp_lsn);
475 memset(bp, 0, sizeof(*ckp_lsn));
476 bp += sizeof(*ckp_lsn);
478 if (last_ckp != NULL)
479 LOGCOPY_FROMLSN(env, bp, last_ckp);
481 memset(bp, 0, sizeof(*last_ckp));
482 bp += sizeof(*last_ckp);
484 uinttmp = (u_int32_t)timestamp;
485 LOGCOPY_32(env,bp, &uinttmp);
486 bp += sizeof(uinttmp);
488 LOGCOPY_32(env, bp, &envid);
491 LOGCOPY_32(env, bp, &spare);
495 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
497 if (is_durable || txnp == NULL) {
498 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
499 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
501 if (rlsnp != ret_lsnp)
508 * Set the debug bit if we are going to log non-durable
509 * transactions so they will be ignored by recovery.
511 memcpy(lr->data, logrec.data, logrec.size);
512 rectype |= DB_debug_FLAG;
513 LOGCOPY_32(env, logrec.data, &rectype);
515 if (!IS_REP_CLIENT(env))
517 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
519 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
520 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
521 LSN_NOT_LOGGED(*ret_lsnp);
524 #ifdef LOG_DIAGNOSTIC
526 (void)__txn_ckp_print(env,
527 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
531 __os_free(env, logrec.data);
533 if (is_durable || txnp == NULL)
534 __os_free(env, logrec.data);
540 * PUBLIC: int __txn_child_read __P((ENV *, void *, __txn_child_args **));
543 __txn_child_read(env, recbuf, argpp)
546 __txn_child_args **argpp;
548 __txn_child_args *argp;
552 if ((ret = __os_malloc(env,
553 sizeof(__txn_child_args) + sizeof(DB_TXN), &argp)) != 0)
556 argp->txnp = (DB_TXN *)&argp[1];
557 memset(argp->txnp, 0, sizeof(DB_TXN));
559 LOGCOPY_32(env, &argp->type, bp);
560 bp += sizeof(argp->type);
562 LOGCOPY_32(env, &argp->txnp->txnid, bp);
563 bp += sizeof(argp->txnp->txnid);
565 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
566 bp += sizeof(DB_LSN);
568 LOGCOPY_32(env, &argp->child, bp);
569 bp += sizeof(argp->child);
571 LOGCOPY_TOLSN(env, &argp->c_lsn, bp);
572 bp += sizeof(DB_LSN);
579 * PUBLIC: int __txn_child_log __P((ENV *, DB_TXN *, DB_LSN *,
580 * PUBLIC: u_int32_t, u_int32_t, DB_LSN *));
583 __txn_child_log(env, txnp, ret_lsnp, flags,
593 DB_LSN *lsnp, null_lsn, *rlsnp;
595 u_int32_t rectype, txn_num;
603 rectype = DB___txn_child;
607 if (LF_ISSET(DB_LOG_NOT_DURABLE)) {
617 null_lsn.file = null_lsn.offset = 0;
619 if (TAILQ_FIRST(&txnp->kids) != NULL &&
620 (ret = __txn_activekids(env, rectype, txnp)) != 0)
623 * We need to assign begin_lsn while holding region mutex.
624 * That assignment is done inside the DbEnv->log_put call,
625 * so pass in the appropriate memory location to be filled
626 * in by the log_put code.
628 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
629 txn_num = txnp->txnid;
632 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
635 if (CRYPTO_ON(env)) {
636 npad = env->crypto_handle->adj_size(logrec.size);
640 if (is_durable || txnp == NULL) {
642 __os_malloc(env, logrec.size, &logrec.data)) != 0)
645 if ((ret = __os_malloc(env,
646 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
650 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
655 logrec.data = lr->data;
659 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
663 LOGCOPY_32(env, bp, &rectype);
664 bp += sizeof(rectype);
666 LOGCOPY_32(env, bp, &txn_num);
667 bp += sizeof(txn_num);
669 LOGCOPY_FROMLSN(env, bp, lsnp);
670 bp += sizeof(DB_LSN);
672 LOGCOPY_32(env, bp, &child);
676 LOGCOPY_FROMLSN(env, bp, c_lsn);
678 memset(bp, 0, sizeof(*c_lsn));
679 bp += sizeof(*c_lsn);
682 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
684 if (is_durable || txnp == NULL) {
685 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
686 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
688 if (rlsnp != ret_lsnp)
695 * Set the debug bit if we are going to log non-durable
696 * transactions so they will be ignored by recovery.
698 memcpy(lr->data, logrec.data, logrec.size);
699 rectype |= DB_debug_FLAG;
700 LOGCOPY_32(env, logrec.data, &rectype);
702 if (!IS_REP_CLIENT(env))
704 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
706 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
707 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
708 LSN_NOT_LOGGED(*ret_lsnp);
711 #ifdef LOG_DIAGNOSTIC
713 (void)__txn_child_print(env,
714 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
718 __os_free(env, logrec.data);
720 if (is_durable || txnp == NULL)
721 __os_free(env, logrec.data);
727 * PUBLIC: int __txn_xa_regop_42_read __P((ENV *, void *,
728 * PUBLIC: __txn_xa_regop_42_args **));
731 __txn_xa_regop_42_read(env, recbuf, argpp)
734 __txn_xa_regop_42_args **argpp;
736 __txn_xa_regop_42_args *argp;
741 if ((ret = __os_malloc(env,
742 sizeof(__txn_xa_regop_42_args) + sizeof(DB_TXN), &argp)) != 0)
745 argp->txnp = (DB_TXN *)&argp[1];
746 memset(argp->txnp, 0, sizeof(DB_TXN));
748 LOGCOPY_32(env, &argp->type, bp);
749 bp += sizeof(argp->type);
751 LOGCOPY_32(env, &argp->txnp->txnid, bp);
752 bp += sizeof(argp->txnp->txnid);
754 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
755 bp += sizeof(DB_LSN);
757 LOGCOPY_32(env, &argp->opcode, bp);
758 bp += sizeof(argp->opcode);
760 memset(&argp->xid, 0, sizeof(argp->xid));
761 LOGCOPY_32(env,&argp->xid.size, bp);
762 bp += sizeof(u_int32_t);
764 bp += argp->xid.size;
766 LOGCOPY_32(env, &uinttmp, bp);
767 argp->formatID = (int32_t)uinttmp;
768 bp += sizeof(uinttmp);
770 LOGCOPY_32(env, &argp->gtrid, bp);
771 bp += sizeof(argp->gtrid);
773 LOGCOPY_32(env, &argp->bqual, bp);
774 bp += sizeof(argp->bqual);
776 LOGCOPY_TOLSN(env, &argp->begin_lsn, bp);
777 bp += sizeof(DB_LSN);
779 memset(&argp->locks, 0, sizeof(argp->locks));
780 LOGCOPY_32(env,&argp->locks.size, bp);
781 bp += sizeof(u_int32_t);
782 argp->locks.data = bp;
783 bp += argp->locks.size;
790 * PUBLIC: int __txn_prepare_read __P((ENV *, void *, __txn_prepare_args **));
793 __txn_prepare_read(env, recbuf, argpp)
796 __txn_prepare_args **argpp;
798 __txn_prepare_args *argp;
802 if ((ret = __os_malloc(env,
803 sizeof(__txn_prepare_args) + sizeof(DB_TXN), &argp)) != 0)
806 argp->txnp = (DB_TXN *)&argp[1];
807 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, &argp->opcode, bp);
819 bp += sizeof(argp->opcode);
821 memset(&argp->gid, 0, sizeof(argp->gid));
822 LOGCOPY_32(env,&argp->gid.size, bp);
823 bp += sizeof(u_int32_t);
825 bp += argp->gid.size;
827 LOGCOPY_TOLSN(env, &argp->begin_lsn, bp);
828 bp += sizeof(DB_LSN);
830 memset(&argp->locks, 0, sizeof(argp->locks));
831 LOGCOPY_32(env,&argp->locks.size, bp);
832 bp += sizeof(u_int32_t);
833 argp->locks.data = bp;
834 bp += argp->locks.size;
841 * PUBLIC: int __txn_prepare_log __P((ENV *, DB_TXN *, DB_LSN *,
842 * PUBLIC: u_int32_t, u_int32_t, const DBT *, DB_LSN *, const DBT *));
845 __txn_prepare_log(env, txnp, ret_lsnp, flags,
846 opcode, gid, begin_lsn, locks)
857 DB_LSN *lsnp, null_lsn, *rlsnp;
859 u_int32_t zero, rectype, txn_num;
867 rectype = DB___txn_prepare;
871 if (LF_ISSET(DB_LOG_NOT_DURABLE)) {
881 null_lsn.file = null_lsn.offset = 0;
883 if (TAILQ_FIRST(&txnp->kids) != NULL &&
884 (ret = __txn_activekids(env, rectype, txnp)) != 0)
887 * We need to assign begin_lsn while holding region mutex.
888 * That assignment is done inside the DbEnv->log_put call,
889 * so pass in the appropriate memory location to be filled
890 * in by the log_put code.
892 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
893 txn_num = txnp->txnid;
896 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
898 + sizeof(u_int32_t) + (gid == NULL ? 0 : gid->size)
900 + sizeof(u_int32_t) + (locks == NULL ? 0 : locks->size);
901 if (CRYPTO_ON(env)) {
902 npad = env->crypto_handle->adj_size(logrec.size);
906 if (is_durable || txnp == NULL) {
908 __os_malloc(env, logrec.size, &logrec.data)) != 0)
911 if ((ret = __os_malloc(env,
912 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
916 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
921 logrec.data = lr->data;
925 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
929 LOGCOPY_32(env, bp, &rectype);
930 bp += sizeof(rectype);
932 LOGCOPY_32(env, bp, &txn_num);
933 bp += sizeof(txn_num);
935 LOGCOPY_FROMLSN(env, bp, lsnp);
936 bp += sizeof(DB_LSN);
938 LOGCOPY_32(env, bp, &opcode);
939 bp += sizeof(opcode);
943 LOGCOPY_32(env, bp, &zero);
944 bp += sizeof(u_int32_t);
946 LOGCOPY_32(env, bp, &gid->size);
947 bp += sizeof(gid->size);
948 memcpy(bp, gid->data, gid->size);
952 if (begin_lsn != NULL)
953 LOGCOPY_FROMLSN(env, bp, begin_lsn);
955 memset(bp, 0, sizeof(*begin_lsn));
956 bp += sizeof(*begin_lsn);
960 LOGCOPY_32(env, bp, &zero);
961 bp += sizeof(u_int32_t);
963 LOGCOPY_32(env, bp, &locks->size);
964 bp += sizeof(locks->size);
965 memcpy(bp, locks->data, locks->size);
970 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
972 if (is_durable || txnp == NULL) {
973 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
974 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
976 if (rlsnp != ret_lsnp)
983 * Set the debug bit if we are going to log non-durable
984 * transactions so they will be ignored by recovery.
986 memcpy(lr->data, logrec.data, logrec.size);
987 rectype |= DB_debug_FLAG;
988 LOGCOPY_32(env, logrec.data, &rectype);
990 if (!IS_REP_CLIENT(env))
992 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
994 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
995 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
996 LSN_NOT_LOGGED(*ret_lsnp);
999 #ifdef LOG_DIAGNOSTIC
1001 (void)__txn_prepare_print(env,
1002 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1006 __os_free(env, logrec.data);
1008 if (is_durable || txnp == NULL)
1009 __os_free(env, logrec.data);
1015 * PUBLIC: int __txn_recycle_read __P((ENV *, void *, __txn_recycle_args **));
1018 __txn_recycle_read(env, recbuf, argpp)
1021 __txn_recycle_args **argpp;
1023 __txn_recycle_args *argp;
1027 if ((ret = __os_malloc(env,
1028 sizeof(__txn_recycle_args) + sizeof(DB_TXN), &argp)) != 0)
1031 argp->txnp = (DB_TXN *)&argp[1];
1032 memset(argp->txnp, 0, sizeof(DB_TXN));
1034 LOGCOPY_32(env, &argp->type, bp);
1035 bp += sizeof(argp->type);
1037 LOGCOPY_32(env, &argp->txnp->txnid, bp);
1038 bp += sizeof(argp->txnp->txnid);
1040 LOGCOPY_TOLSN(env, &argp->prev_lsn, bp);
1041 bp += sizeof(DB_LSN);
1043 LOGCOPY_32(env, &argp->min, bp);
1044 bp += sizeof(argp->min);
1046 LOGCOPY_32(env, &argp->max, bp);
1047 bp += sizeof(argp->max);
1054 * PUBLIC: int __txn_recycle_log __P((ENV *, DB_TXN *, DB_LSN *,
1055 * PUBLIC: u_int32_t, u_int32_t, u_int32_t));
1058 __txn_recycle_log(env, txnp, ret_lsnp, flags,
1068 DB_LSN *lsnp, null_lsn, *rlsnp;
1070 u_int32_t rectype, txn_num;
1073 int is_durable, ret;
1075 COMPQUIET(lr, NULL);
1078 rectype = DB___txn_recycle;
1082 if (LF_ISSET(DB_LOG_NOT_DURABLE)) {
1092 null_lsn.file = null_lsn.offset = 0;
1094 if (TAILQ_FIRST(&txnp->kids) != NULL &&
1095 (ret = __txn_activekids(env, rectype, txnp)) != 0)
1098 * We need to assign begin_lsn while holding region mutex.
1099 * That assignment is done inside the DbEnv->log_put call,
1100 * so pass in the appropriate memory location to be filled
1101 * in by the log_put code.
1103 DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp);
1104 txn_num = txnp->txnid;
1107 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1109 + sizeof(u_int32_t);
1110 if (CRYPTO_ON(env)) {
1111 npad = env->crypto_handle->adj_size(logrec.size);
1112 logrec.size += npad;
1115 if (is_durable || txnp == NULL) {
1117 __os_malloc(env, logrec.size, &logrec.data)) != 0)
1120 if ((ret = __os_malloc(env,
1121 logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
1125 __os_malloc(env, logrec.size, &logrec.data)) != 0) {
1130 logrec.data = lr->data;
1134 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1138 LOGCOPY_32(env, bp, &rectype);
1139 bp += sizeof(rectype);
1141 LOGCOPY_32(env, bp, &txn_num);
1142 bp += sizeof(txn_num);
1144 LOGCOPY_FROMLSN(env, bp, lsnp);
1145 bp += sizeof(DB_LSN);
1147 LOGCOPY_32(env, bp, &min);
1150 LOGCOPY_32(env, bp, &max);
1154 (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1156 if (is_durable || txnp == NULL) {
1157 if ((ret = __log_put(env, rlsnp,(DBT *)&logrec,
1158 flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) {
1160 if (rlsnp != ret_lsnp)
1167 * Set the debug bit if we are going to log non-durable
1168 * transactions so they will be ignored by recovery.
1170 memcpy(lr->data, logrec.data, logrec.size);
1171 rectype |= DB_debug_FLAG;
1172 LOGCOPY_32(env, logrec.data, &rectype);
1174 if (!IS_REP_CLIENT(env))
1175 ret = __log_put(env,
1176 rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
1178 STAILQ_INSERT_HEAD(&txnp->logs, lr, links);
1179 F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY);
1180 LSN_NOT_LOGGED(*ret_lsnp);
1183 #ifdef LOG_DIAGNOSTIC
1185 (void)__txn_recycle_print(env,
1186 (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
1190 __os_free(env, logrec.data);
1192 if (is_durable || txnp == NULL)
1193 __os_free(env, logrec.data);
1199 * PUBLIC: int __txn_init_recover __P((ENV *, DB_DISTAB *));
1202 __txn_init_recover(env, dtabp)
1208 if ((ret = __db_add_recovery_int(env, dtabp,
1209 __txn_regop_recover, DB___txn_regop)) != 0)
1211 if ((ret = __db_add_recovery_int(env, dtabp,
1212 __txn_ckp_recover, DB___txn_ckp)) != 0)
1214 if ((ret = __db_add_recovery_int(env, dtabp,
1215 __txn_child_recover, DB___txn_child)) != 0)
1217 if ((ret = __db_add_recovery_int(env, dtabp,
1218 __txn_prepare_recover, DB___txn_prepare)) != 0)
1220 if ((ret = __db_add_recovery_int(env, dtabp,
1221 __txn_recycle_recover, DB___txn_recycle)) != 0)