diff options
Diffstat (limited to 'db/dbinc/txn.h')
-rw-r--r-- | db/dbinc/txn.h | 93 |
1 files changed, 77 insertions, 16 deletions
diff --git a/db/dbinc/txn.h b/db/dbinc/txn.h index d7067407c..514b740e8 100644 --- a/db/dbinc/txn.h +++ b/db/dbinc/txn.h @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1996-2003 + * Copyright (c) 1996-2004 * Sleepycat Software. All rights reserved. * - * $Id: txn.h,v 11.48 2003/07/08 20:14:20 ubell Exp $ + * $Id: txn.h,v 11.54 2004/09/24 00:43:18 bostic Exp $ */ #ifndef _TXN_H_ @@ -77,14 +77,14 @@ typedef struct __txn_detail { * The transaction manager encapsulates the transaction system. */ struct __db_txnmgr { -/* - * These fields need to be protected for multi-threaded support. - * - * !!! - * As this structure is allocated in per-process memory, the mutex may need - * to be stored elsewhere on architectures unable to support mutexes in heap - * memory, e.g., HP/UX 9. - */ + /* + * These fields need to be protected for multi-threaded support. + * + * !!! + * As this structure is allocated in per-process memory, the mutex may + * need to be stored elsewhere on architectures unable to support + * mutexes in heap memory, e.g., HP/UX 9. + */ DB_MUTEX *mutexp; /* Lock list of active transactions * (including the content of each * TXN_DETAIL structure on the list). @@ -136,17 +136,78 @@ struct __txn_logrec { /* * Log record types. Note that these are *not* alphabetical. This is * intentional so that we don't change the meaning of values between - * software upgrades. EXPECTED, UNEXPECTED, IGNORE, NOTFOUND and OK - * are used in the txnlist functions. + * software upgrades. + * + * EXPECTED, UNEXPECTED, IGNORE, and OK are used in the txnlist functions. + * Here is an explanation of how the statuses are used. + * + * TXN_OK + * BEGIN records for transactions found on the txnlist during + * OPENFILES (BEGIN records are those with a prev_lsn of 0,0) + * + * TXN_COMMIT + * Transaction committed and should be rolled forward. + * + * TXN_ABORT + * This transaction's changes must be undone. Either there was + * never a prepare or commit record for this transaction OR there + * was a commit, but we are recovering to a timestamp or particular + * LSN and that point is before this transaction's commit. + * + * TXN_PREPARE + * Prepare record, but no commit record is in the log. + * + * TXN_IGNORE + * Generic meaning is that this transaction should not be + * processed during later recovery passes. We use it in a + * number of different manners: + * + * 1. We never saw its BEGIN record. Therefore, the logs have + * been reclaimed and we *know* that this transaction doesn't + * need to be aborted, because in order for it to be + * reclaimed, there must have been a subsequent checkpoint + * (and any dirty pages for this transaction made it to + * disk). + * + * 2. This is a child transaction that created a database. + * For some reason, we don't want to recreate that database + * (i.e., it already exists or some other database created + * after it exists). + * + * 3. During recovery open of subdatabases, if the master check fails, + * we use a TXN_IGNORE on the create of the subdb in the nested + * transaction. + * + * 4. During a remove, the file with the name being removed isn't + * the file for which we are recovering a remove. + * + * TXN_EXPECTED + * After a successful open during recovery, we update the + * transaction's status to TXN_EXPECTED. The open was done + * in the parent, but in the open log record, we record the + * child transaction's ID if we also did a create. When there + * is a valid ID in that field, we use it and mark the child's + * status as TXN_EXPECTED (indicating that we don't need to redo + * a create for this file). + * + * When recovering a remove, if we don't find or can't open + * the file, the child (which does the remove) gets marked + * EXPECTED (indicating that we don't need to redo the remove). + * + * TXN_UNEXPECTED + * During recovery, we attempted an open that should have succeeded + * and we got ENOENT, so like with the EXPECTED case, we indicate + * in the child that we got the UNEXPECTED return so that we do redo + * the creating/deleting operation. + * */ #define TXN_OK 0 #define TXN_COMMIT 1 #define TXN_PREPARE 2 #define TXN_ABORT 3 -#define TXN_NOTFOUND 4 -#define TXN_IGNORE 5 -#define TXN_EXPECTED 6 -#define TXN_UNEXPECTED 7 +#define TXN_IGNORE 4 +#define TXN_EXPECTED 5 +#define TXN_UNEXPECTED 6 #include "dbinc_auto/txn_auto.h" #include "dbinc_auto/txn_ext.h" |