diff options
Diffstat (limited to 'src/txn/txn.c')
-rw-r--r-- | src/txn/txn.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/txn/txn.c b/src/txn/txn.c index 81225e5c..91652cb7 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved. */ /* * Copyright (c) 1995, 1996 @@ -227,8 +227,15 @@ __txn_begin(env, ip, parent, txnpp, flags) if (LF_ISSET(DB_TXN_FAMILY)) F_SET(txn, TXN_FAMILY | TXN_INFAMILY | TXN_READONLY); if (LF_ISSET(DB_TXN_SNAPSHOT) || F_ISSET(dbenv, DB_ENV_TXN_SNAPSHOT) || - (parent != NULL && F_ISSET(parent, TXN_SNAPSHOT))) - F_SET(txn, TXN_SNAPSHOT); + (parent != NULL && F_ISSET(parent, TXN_SNAPSHOT))) { + if (IS_REP_CLIENT(env)) { + __db_errx(env, DB_STR("4572", + "DB_TXN_SNAPSHOT may not be used on a replication client")); + ret = (EINVAL); + goto err; + } else + F_SET(txn, TXN_SNAPSHOT); + } if (LF_ISSET(DB_IGNORE_LEASE)) F_SET(txn, TXN_IGNORE_LEASE); @@ -581,8 +588,7 @@ __txn_continue(env, txn, td, ip, add_to_list) txn->set_timeout = __txn_set_timeout; txn->set_txn_lsnp = __txn_set_txn_lsnp; - /* XXX Do we need to explicitly set a SYNC flag here? */ - txn->flags = TXN_MALLOC | + txn->flags = TXN_MALLOC | TXN_SYNC | (F_ISSET(td, TXN_DTL_NOWAIT) ? TXN_NOWAIT : 0); txn->xa_thr_status = TXN_XA_THREAD_NOTA; @@ -795,8 +801,9 @@ __txn_commit(txn, flags) if (ret == 0) { DB_LSN s_lsn; - DB_ASSERT(env, __log_current_lsn_int( - env, &s_lsn, NULL, NULL) == 0); + if ((ret = __log_current_lsn_int( + env, &s_lsn, NULL, NULL)) != 0) + goto err; DB_ASSERT(env, LOG_COMPARE( &td->visible_lsn, &s_lsn) <= 0); COMPQUIET(s_lsn.file, 0); @@ -890,17 +897,16 @@ static int __txn_close_cursors(txn) DB_TXN *txn; { - int ret, tret; + int ret, t_ret; DBC *dbc; - ret = tret = 0; + ret = t_ret = 0; dbc = NULL; if (txn == NULL) return (0); while ((dbc = TAILQ_FIRST(&txn->my_cursors)) != NULL) { - DB_ASSERT(dbc->env, txn == dbc->txn); /* @@ -913,21 +919,21 @@ __txn_close_cursors(txn) /* Removed from the active queue here. */ if (F_ISSET(dbc, DBC_ACTIVE)) - ret = __dbc_close(dbc); + t_ret = __dbc_close(dbc); dbc->txn = NULL; /* We have to close all cursors anyway, so continue on error. */ - if (ret != 0) { - __db_err(dbc->env, ret, "__dbc_close"); - if (tret == 0) - tret = ret; + if (t_ret != 0) { + __db_err(dbc->env, t_ret, "__dbc_close"); + if (ret == 0) + ret = t_ret; } } txn->my_cursors.tqh_first = NULL; txn->my_cursors.tqh_last = NULL; - return (tret);/* Return the first error if any. */ + return (ret); /* Return the first error, if any. */ } /* @@ -1050,7 +1056,7 @@ __txn_abort(txn) * it, however make sure that it is aborted when the last process * tries to abort it. */ - if (txn->xa_thr_status != TXN_XA_THREAD_NOTA && td->xa_ref > 1) { + if (txn->xa_thr_status != TXN_XA_THREAD_NOTA && td->xa_ref > 1) { td->status = TXN_NEED_ABORT; return (0); } @@ -2165,5 +2171,5 @@ __txn_applied(env, ip, commit_info, timeout) if (renv->envid == commit_info->envid && LOG_COMPARE(&commit_info->lsn, &lsn) <= 0) return (0); - return (DB_NOTFOUND); + return (USR_ERR(env, DB_NOTFOUND)); } |