~ubuntu-branches/ubuntu/oneiric/firebird2.1/oneiric

« back to all changes in this revision

Viewing changes to src/jrd/tra.h

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2011-04-22 18:59:44 UTC
  • mfrom: (2.1.24 sid)
  • Revision ID: james.westby@ubuntu.com-20110422185944-egwy9r5xynjddku5
Tags: 2.1.4.18393-0.ds2-2
* apply patch from upstream SVN fixing ICU collations
* remove lintian overrides about manpages shipped in dependency package
* claim compliancy with Policy 3.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "../jrd/sbm.h" // For bid structure
43
43
 
44
44
#include "../jrd/DatabaseSnapshot.h"
 
45
#include "../jrd/TempSpace.h"
45
46
 
46
47
namespace Jrd {
47
48
 
54
55
class VerbAction;
55
56
class ArrayField;
56
57
class Attachment;
 
58
class DeferredJob;
57
59
 
58
60
const SLONG MAX_TRA_NUMBER = MAX_SLONG;
59
61
 
83
85
/* Transaction block */
84
86
 
85
87
const int DEFAULT_LOCK_TIMEOUT = -1; // infinite
 
88
const char* const TRA_BLOB_SPACE = "fb_blob_";
86
89
 
87
90
class jrd_tra : public pool_alloc_rpt<SCHAR, type_tra>
88
91
{
89
 
    public:
 
92
public:
90
93
        enum wait_t {
91
94
                tra_no_wait,
92
95
                tra_probe,
93
96
                tra_wait
94
97
        };
95
98
 
96
 
        jrd_tra(MemoryPool& p) :
97
 
                tra_blobs(&p),
98
 
                tra_resources(p),
99
 
                tra_context_vars(p),
100
 
                tra_lock_timeout(DEFAULT_LOCK_TIMEOUT)
 
99
        jrd_tra(JrdMemoryPool* p) :
 
100
                tra_pool(p),
 
101
                tra_blobs(p),
 
102
                tra_deferred_job(NULL),
 
103
                tra_resources(*p),
 
104
                tra_context_vars(*p),
 
105
                tra_lock_timeout(DEFAULT_LOCK_TIMEOUT),
 
106
                tra_blob_space(NULL)
101
107
        {}
102
108
 
 
109
        ~jrd_tra()
 
110
        {
 
111
                delete tra_blob_space;
 
112
        }
 
113
 
 
114
        static void destroy(Database* const dbb, jrd_tra* const transaction)
 
115
        {
 
116
                if (transaction)
 
117
                {
 
118
                        JrdMemoryPool* const pool = transaction->tra_pool;
 
119
                        delete transaction;
 
120
 
 
121
                        if (pool) 
 
122
                                JrdMemoryPool::deletePool(pool);
 
123
                }
 
124
        }
 
125
 
103
126
        Attachment* tra_attachment;     /* database attachment */
104
127
        SLONG tra_number;                       /* transaction number */
105
128
        SLONG tra_top;                          /* highest transaction in snapshot */
108
131
                                                                   gargage-collected by this tx */
109
132
        jrd_tra*        tra_next;               /* next transaction in database */
110
133
        jrd_tra*        tra_sibling;    /* next transaction in group */
111
 
        JrdMemoryPool* tra_pool;                /* pool for transaction */
 
134
        JrdMemoryPool* tra_pool;        /* pool for transaction */
112
135
        BlobIndexTree tra_blobs;                /* list of active blobs */
113
136
        ArrayField*     tra_arrays;             /* Linked list of active arrays */
114
137
        Lock*           tra_lock;               /* lock for transaction */
119
142
        Savepoint*      tra_save_free;  /* free savepoints */
120
143
        SLONG tra_save_point_number;    /* next save point number to use */
121
144
        ULONG tra_flags;
122
 
        class DeferredWork*     tra_deferred_work;      /* work deferred to commit time */
 
145
        DeferredJob*    tra_deferred_job;       /* work deferred to commit time */
123
146
        ResourceList tra_resources;             /* resource existence list */
124
147
        Firebird::StringMap tra_context_vars; // Context variables for the transaction
125
148
        traRpbList* tra_rpblist;        /* active record_param's of given transaction */
131
154
        jrd_req* tra_requests;          // Doubly linked list of requests active in this transaction
132
155
        DatabaseSnapshot* tra_db_snapshot; // Database state snapshot (for monitoring purposes)
133
156
        RuntimeStatistics tra_stats;
134
 
        UCHAR tra_transactions[1];
135
 
 
 
157
 
 
158
private:
 
159
        TempSpace* tra_blob_space;      // temp space storage
 
160
 
 
161
public:
136
162
        SSHORT getLockWait() const
137
163
        {
138
164
                return -tra_lock_timeout;
139
165
        }
 
166
 
 
167
        TempSpace* getTempSpace()
 
168
        {
 
169
                if (!tra_blob_space)
 
170
                        tra_blob_space = FB_NEW(*tra_pool) TempSpace(*tra_pool, TRA_BLOB_SPACE);
 
171
 
 
172
                return tra_blob_space;
 
173
        }
 
174
 
 
175
public:
 
176
        UCHAR tra_transactions[1];
140
177
};
141
178
 
142
179
// System transaction is always transaction 0.
281
318
        dfw_arg_trg_type                // trigger type
282
319
};
283
320
 
284
 
class DeferredWork : public pool_alloc<type_dfw>
285
 
{
286
 
public:
287
 
        enum dfw_t              dfw_type;               /* type of work deferred */
288
 
        DeferredWork*   dfw_next;               /* next block in transaction */
289
 
        Lock*                   dfw_lock;               /* relation creation lock */
290
 
        DeferredWork*   dfw_args;               /* arguments */
291
 
        SLONG                   dfw_sav_number; /* save point number */
292
 
        USHORT                  dfw_id;                 /* object id, if appropriate */
293
 
        USHORT                  dfw_count;              /* count of block posts */
294
 
        Firebird::string        dfw_name;       /* name of object */
295
 
public:
296
 
        explicit DeferredWork(MemoryPool& p) : dfw_name(p) { }
297
 
};
298
 
 
299
321
/* Verb actions */
300
322
 
301
323
class UndoItem {