2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1996-2002
5
* Sleepycat Software. All rights reserved.
15
/* Operation parameters to the delayed commit processing code. */
17
TXN_REMOVE, /* Remove a file. */
18
TXN_TRADE, /* Trade lockers. */
19
TXN_TRADED /* Already traded; downgrade lock. */
22
struct __db_txnregion; typedef struct __db_txnregion DB_TXNREGION;
26
* TXN_MINIMUM = (DB_LOCK_MAXID + 1) but this makes compilers complain.
28
#define TXN_MINIMUM 0x80000000
29
#define TXN_MAXIMUM 0xffffffff /* Maximum number of txn ids. */
30
#define TXN_INVALID 0 /* Invalid transaction ID. */
32
#define DEF_MAX_TXNS 20 /* Default max transactions. */
35
* Internal data maintained in shared memory for each transaction.
37
typedef struct __txn_detail {
38
u_int32_t txnid; /* current transaction id
39
used to link free list also */
40
DB_LSN last_lsn; /* last lsn written for this txn */
41
DB_LSN begin_lsn; /* lsn of begin record */
42
roff_t parent; /* Offset of transaction's parent. */
46
#define TXN_PREPARED 3
47
#define TXN_COMMITTED 4
48
u_int32_t status; /* status of the transaction */
49
#define TXN_COLLECTED 0x1
50
#define TXN_RESTORED 0x2
51
u_int32_t flags; /* collected during txn_recover */
53
SH_TAILQ_ENTRY links; /* free/active list */
55
#define TXN_XA_ABORTED 1
56
#define TXN_XA_DEADLOCKED 2
57
#define TXN_XA_ENDED 3
58
#define TXN_XA_PREPARED 4
59
#define TXN_XA_STARTED 5
60
#define TXN_XA_SUSPENDED 6
61
u_int32_t xa_status; /* XA status */
64
* XID (xid_t) structure: because these fields are logged, the
65
* sizes have to be explicit.
67
u_int8_t xid[XIDDATASIZE]; /* XA global transaction id */
68
u_int32_t bqual; /* bqual_length from XID */
69
u_int32_t gtrid; /* gtrid_length from XID */
70
int32_t format; /* XA format */
75
* The transaction manager encapsulates the transaction system.
79
* These fields need to be protected for multi-threaded support.
82
* As this structure is allocated in per-process memory, the mutex may need
83
* to be stored elsewhere on architectures unable to support mutexes in heap
84
* memory, e.g., HP/UX 9.
86
DB_MUTEX *mutexp; /* Lock list of active transactions
87
* (including the content of each
88
* TXN_DETAIL structure on the list).
90
/* List of active transactions. */
91
TAILQ_HEAD(_chain, __db_txn) txn_chain;
92
u_int32_t n_discards; /* Number of txns discarded. */
94
/* These fields are never updated after creation, and so not protected. */
95
DB_ENV *dbenv; /* Environment. */
96
REGINFO reginfo; /* Region information. */
101
* The primary transaction data structure in the shared memory region.
103
struct __db_txnregion {
104
u_int32_t maxtxns; /* maximum number of active TXNs */
105
u_int32_t last_txnid; /* last transaction id given out */
106
u_int32_t cur_maxid; /* current max unused id. */
107
DB_LSN last_ckp; /* lsn of the last checkpoint */
108
time_t time_ckp; /* time of last checkpoint */
109
u_int32_t logtype; /* type of logging */
110
u_int32_t locktype; /* lock type */
111
DB_TXN_STAT stat; /* Statistics for txns. */
113
#define TXN_IN_RECOVERY 0x01 /* environment is being recovered */
115
/* active TXN list */
116
SH_TAILQ_HEAD(__active) active_txn;
117
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
118
#define TXN_MAINT_SIZE (sizeof(roff_t) * DB_MAX_HANDLES)
120
roff_t maint_off; /* offset of region maintenance info */
125
* Log record types. Note that these are *not* alphabetical. This is
126
* intentional so that we don't change the meaning of values between
127
* software upgrades. EXPECTED, UNEXPECTED, IGNORE, NOTFOUND and OK
133
#define TXN_PREPARE 2
135
#define TXN_NOTFOUND 4
137
#define TXN_EXPECTED 6
138
#define TXN_UNEXPECTED 7
140
#include "dbinc_auto/txn_auto.h"
141
#include "dbinc_auto/txn_ext.h"
142
#include "dbinc_auto/xa_ext.h"
143
#endif /* !_TXN_H_ */