diff options
Diffstat (limited to 'db/dbreg/dbreg_auto.c')
-rw-r--r-- | db/dbreg/dbreg_auto.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/db/dbreg/dbreg_auto.c b/db/dbreg/dbreg_auto.c index a9cc5f704..519786c14 100644 --- a/db/dbreg/dbreg_auto.c +++ b/db/dbreg/dbreg_auto.c @@ -2,13 +2,6 @@ #include "db_config.h" -#ifndef NO_SYSTEM_INCLUDES -#include <sys/types.h> - -#include <ctype.h> -#include <string.h> -#endif - #include "db_int.h" #include "dbinc/crypto.h" #include "dbinc/db_page.h" @@ -23,11 +16,11 @@ * PUBLIC: int32_t, DBTYPE, db_pgno_t, u_int32_t)); */ int -__dbreg_register_log(dbenv, txnid, ret_lsnp, flags, +__dbreg_register_log(dbenv, txnp, ret_lsnp, flags, opcode, name, uid, fileid, ftype, meta_pgno, id) DB_ENV *dbenv; - DB_TXN *txnid; + DB_TXN *txnp; DB_LSN *ret_lsnp; u_int32_t flags; u_int32_t opcode; @@ -55,29 +48,30 @@ __dbreg_register_log(dbenv, txnid, ret_lsnp, flags, ret = 0; if (LF_ISSET(DB_LOG_NOT_DURABLE)) { - if (txnid == NULL) + if (txnp == NULL) + return (0); + if (txnp == NULL) return (0); is_durable = 0; } else is_durable = 1; - if (txnid == NULL) { + if (txnp == NULL) { txn_num = 0; lsnp = &null_lsn; null_lsn.file = null_lsn.offset = 0; } else { - if (TAILQ_FIRST(&txnid->kids) != NULL && - (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + if (TAILQ_FIRST(&txnp->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnp)) != 0) return (ret); /* * We need to assign begin_lsn while holding region mutex. * That assignment is done inside the DbEnv->log_put call, * so pass in the appropriate memory location to be filled * in by the log_put code. - */ - DB_SET_BEGIN_LSNP(txnid, &rlsnp); - txn_num = txnid->txnid; - lsnp = &txnid->last_lsn; + */ + DB_SET_TXN_LSNP(txnp, &rlsnp, &lsnp); + txn_num = txnp->txnid; } logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) @@ -94,7 +88,7 @@ __dbreg_register_log(dbenv, txnid, ret_lsnp, flags, logrec.size += npad; } - if (is_durable || txnid == NULL) { + if (is_durable || txnp == NULL) { if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) return (ret); @@ -168,12 +162,13 @@ __dbreg_register_log(dbenv, txnid, ret_lsnp, flags, memcpy(bp, &uinttmp, sizeof(uinttmp)); bp += sizeof(uinttmp); - DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + DB_ASSERT(dbenv, + (u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); - if (is_durable || txnid == NULL) { + if (is_durable || txnp == NULL) { if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec, - flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) { - txnid->last_lsn = *rlsnp; + flags | DB_LOG_NOCOPY)) == 0 && txnp != NULL) { + *lsnp = *rlsnp; if (rlsnp != ret_lsnp) *ret_lsnp = *rlsnp; } @@ -192,20 +187,21 @@ __dbreg_register_log(dbenv, txnid, ret_lsnp, flags, #else ret = 0; #endif - STAILQ_INSERT_HEAD(&txnid->logs, lr, links); + STAILQ_INSERT_HEAD(&txnp->logs, lr, links); + F_SET((TXN_DETAIL *)txnp->td, TXN_DTL_INMEMORY); LSN_NOT_LOGGED(*ret_lsnp); } #ifdef LOG_DIAGNOSTIC if (ret != 0) (void)__dbreg_register_print(dbenv, - (DBT *)&logrec, ret_lsnp, NULL, NULL); + (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL); #endif #ifdef DIAGNOSTIC __os_free(dbenv, logrec.data); #else - if (is_durable || txnid == NULL) + if (is_durable || txnp == NULL) __os_free(dbenv, logrec.data); #endif return (ret); @@ -230,13 +226,14 @@ __dbreg_register_read(dbenv, recbuf, argpp) sizeof(__dbreg_register_args) + sizeof(DB_TXN), &argp)) != 0) return (ret); bp = recbuf; - argp->txnid = (DB_TXN *)&argp[1]; + argp->txnp = (DB_TXN *)&argp[1]; + memset(argp->txnp, 0, sizeof(DB_TXN)); memcpy(&argp->type, bp, sizeof(argp->type)); bp += sizeof(argp->type); - memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); - bp += sizeof(argp->txnid->txnid); + memcpy(&argp->txnp->txnid, bp, sizeof(argp->txnp->txnid)); + bp += sizeof(argp->txnp->txnid); memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); bp += sizeof(DB_LSN); |