~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/dbinc/txn.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1996-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 *
7
 
 * $Id$
8
 
 */
9
 
 
10
 
#ifndef _TXN_H_
11
 
#define _TXN_H_
12
 
 
13
 
#include "dbinc/xa.h"
14
 
 
15
 
/* Operation parameters to the delayed commit processing code. */
16
 
typedef enum {
17
 
        TXN_REMOVE,             /* Remove a file. */
18
 
        TXN_TRADE,              /* Trade lockers. */
19
 
        TXN_TRADED              /* Already traded; downgrade lock. */
20
 
} TXN_EVENT_T;
21
 
 
22
 
struct __db_txnregion;  typedef struct __db_txnregion DB_TXNREGION;
23
 
 
24
 
/*
25
 
 * !!!
26
 
 * TXN_MINIMUM = (DB_LOCK_MAXID + 1) but this makes compilers complain.
27
 
 */
28
 
#define TXN_MINIMUM     0x80000000
29
 
#define TXN_MAXIMUM     0xffffffff      /* Maximum number of txn ids. */
30
 
#define TXN_INVALID     0               /* Invalid transaction ID. */
31
 
 
32
 
#define DEF_MAX_TXNS    20              /* Default max transactions. */
33
 
 
34
 
/*
35
 
 * Internal data maintained in shared memory for each transaction.
36
 
 */
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. */
43
 
 
44
 
#define TXN_RUNNING             1
45
 
#define TXN_ABORTED             2
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 */
52
 
 
53
 
        SH_TAILQ_ENTRY  links;          /* free/active list */
54
 
 
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 */
62
 
 
63
 
        /*
64
 
         * XID (xid_t) structure: because these fields are logged, the
65
 
         * sizes have to be explicit.
66
 
         */
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 */
71
 
} TXN_DETAIL;
72
 
 
73
 
/*
74
 
 * DB_TXNMGR --
75
 
 *      The transaction manager encapsulates the transaction system.
76
 
 */
77
 
struct __db_txnmgr {
78
 
/*
79
 
 * These fields need to be protected for multi-threaded support.
80
 
 *
81
 
 * !!!
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.
85
 
 */
86
 
        DB_MUTEX        *mutexp;        /* Lock list of active transactions
87
 
                                         * (including the content of each
88
 
                                         * TXN_DETAIL structure on the list).
89
 
                                         */
90
 
                                        /* List of active transactions. */
91
 
        TAILQ_HEAD(_chain, __db_txn)    txn_chain;
92
 
        u_int32_t        n_discards;    /* Number of txns discarded. */
93
 
 
94
 
/* These fields are never updated after creation, and so not protected. */
95
 
        DB_ENV          *dbenv;         /* Environment. */
96
 
        REGINFO          reginfo;       /* Region information. */
97
 
};
98
 
 
99
 
/*
100
 
 * DB_TXNREGION --
101
 
 *      The primary transaction data structure in the shared memory region.
102
 
 */
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. */
112
 
 
113
 
#define TXN_IN_RECOVERY  0x01           /* environment is being recovered */
114
 
        u_int32_t       flags;
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)
119
 
 
120
 
        roff_t          maint_off;      /* offset of region maintenance info */
121
 
#endif
122
 
};
123
 
 
124
 
/*
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
128
 
 * are used in the
129
 
 * txnlist functions.
130
 
 */
131
 
#define TXN_OK          0
132
 
#define TXN_COMMIT      1
133
 
#define TXN_PREPARE     2
134
 
#define TXN_ABORT       3
135
 
#define TXN_NOTFOUND    4
136
 
#define TXN_IGNORE      5
137
 
#define TXN_EXPECTED    6
138
 
#define TXN_UNEXPECTED  7
139
 
 
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_ */