diff options
Diffstat (limited to 'db2/include/txn.h')
-rw-r--r-- | db2/include/txn.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/db2/include/txn.h b/db2/include/txn.h index a2512ed152..a6fa4db8de 100644 --- a/db2/include/txn.h +++ b/db2/include/txn.h @@ -4,11 +4,13 @@ * Copyright (c) 1996, 1997, 1998 * Sleepycat Software. All rights reserved. * - * @(#)txn.h 10.15 (Sleepycat) 4/21/98 + * @(#)txn.h 10.18 (Sleepycat) 1/3/99 */ #ifndef _TXN_H_ #define _TXN_H_ +#include "xa.h" + /* * The name of the transaction shared memory region is DEFAULT_TXN_FILE and * the region is always created group RW of the group owning the directory. @@ -25,6 +27,8 @@ /* * Internal data maintained in shared memory for each transaction. */ +typedef char DB_XID[XIDDATASIZE]; + typedef struct __txn_detail { u_int32_t txnid; /* current transaction id used to link free list also */ @@ -32,12 +36,31 @@ typedef struct __txn_detail { DB_LSN begin_lsn; /* lsn of begin record */ size_t last_lock; /* offset in lock region of last lock for this transaction. */ + size_t parent; /* Offset of transaction's parent. */ #define TXN_UNALLOC 0 #define TXN_RUNNING 1 #define TXN_ABORTED 2 #define TXN_PREPARED 3 +#define TXN_COMMITTED 4 u_int32_t status; /* status of the transaction */ SH_TAILQ_ENTRY links; /* free/active list */ + +#define TXN_XA_ABORTED 1 +#define TXN_XA_DEADLOCKED 2 +#define TXN_XA_ENDED 3 +#define TXN_XA_PREPARED 4 +#define TXN_XA_STARTED 5 +#define TXN_XA_SUSPENDED 6 + u_int32_t xa_status; /* XA status */ + + /* + * XID (xid_t) structure: because these fields are logged, the + * sizes have to be explicit. + */ + DB_XID xid; /* XA global transaction id */ + u_int32_t bqual; /* bqual_length from XID */ + u_int32_t gtrid; /* gtrid_length from XID */ + int32_t format; /* XA format */ } TXN_DETAIL; /* @@ -105,6 +128,12 @@ struct __db_txnregion { #define UNLOCK_TXNREGION(tmgrp) \ (void)__db_mutex_unlock(&(tmgrp)->region->hdr.lock, (tmgrp)->reginfo.fd) +/* Check for region catastrophic shutdown. */ +#define TXN_PANIC_CHECK(tmgrp) { \ + if ((tmgrp)->region->hdr.panic) \ + return (DB_RUNRECOVERY); \ +} + /* * Log record types. */ @@ -114,4 +143,6 @@ struct __db_txnregion { #include "txn_auto.h" #include "txn_ext.h" + +#include "xa_ext.h" #endif /* !_TXN_H_ */ |