Change BSD-2.0 to BSD-3-Clause
[platform/upstream/db4.git] / txn / txn.src
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1996-2009 Oracle.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 DBPRIVATE
10 PREFIX  __txn
11
12 INCLUDE #include "db_int.h"
13 INCLUDE #include "dbinc/crypto.h"
14 INCLUDE #include "dbinc/db_page.h"
15 INCLUDE #include "dbinc/db_dispatch.h"
16 INCLUDE #include "dbinc/db_am.h"
17 INCLUDE #include "dbinc/lock.h"
18 INCLUDE #include "dbinc/log.h"
19 INCLUDE #include "dbinc/txn.h"
20 INCLUDE
21
22 /*
23  * This is the standard log operation for commit.
24  * Note that we are using an int32_t for the timestamp.  This means that
25  * in 2039 we will need to deprecate this log record and create one that
26  * either changes the Epoch or has a 64-bit offset.
27  * NOTE: The opcode MUST be the first argument in these records, because
28  * the force_abort code overwrites it with an ABORT should the write to
29  * the log fail.
30  * envid:
31  *      Environment ID of this operation (4.4+).
32  */
33 BEGIN_COMPAT regop              42      10
34 ARG     opcode          u_int32_t       lu
35 TIME    timestamp       int32_t         ld
36 LOCKS   locks           DBT             s
37 END
38
39 BEGIN regop             44      10
40 ARG     opcode          u_int32_t       lu
41 TIME    timestamp       int32_t         ld
42 ARG     envid           u_int32_t       lu
43 LOCKS   locks           DBT             s
44 END
45
46 /*
47  * This is the checkpoint record.  It contains the lsn that the checkpoint
48  * guarantees and a pointer to the last checkpoint so we can walk backwards
49  * by checkpoint.
50  *
51  * ckp_lsn:
52  *      The lsn in the log of the most recent point at which all begun
53  *      transactions have been aborted.  This is the point for which
54  *      the checkpoint is relevant.
55  * last_ckp:
56  *      The previous checkpoint.
57  * timestamp:
58  *      See comment in commit about timestamps.
59  * envid:
60  *      Environment ID of this checkpoint (4.3+).
61  * rep_gen:
62  *      Persistent replication generation number (4.2-4.5 only).
63  *      Renamed to 'spare' in 4.6.
64  */
65 BEGIN_COMPAT ckp                42      11
66 POINTER ckp_lsn         DB_LSN *        lu
67 POINTER last_ckp        DB_LSN *        lu
68 TIME    timestamp       int32_t         ld
69 ARG     rep_gen         u_int32_t       lu
70 END
71
72 BEGIN ckp               43      11
73 POINTER ckp_lsn         DB_LSN *        lu
74 POINTER last_ckp        DB_LSN *        lu
75 TIME    timestamp       int32_t         ld
76 ARG     envid           u_int32_t       lu
77 ARG     spare           u_int32_t       lu
78 END
79
80 /*
81  * This is the (new) log operation for a child commit.  It is
82  * logged as a record in the PARENT.  The child field contains
83  * the transaction ID of the child committing and the c_lsn is
84  * the last LSN of the child's log trail.
85  */
86 BEGIN child             42      12
87 ARG     child   u_int32_t       lx
88 POINTER c_lsn   DB_LSN *        lu
89 END
90
91
92 /*
93  * This is the standard log operation for prepare.
94  * NOTE: The opcode MUST be the first argument in these records, because
95  * the force_abort code overwrites it with an ABORT should the write to
96  * the log fail.
97  */
98 BEGIN_COMPAT xa_regop           42      13
99 ARG     opcode          u_int32_t       lu
100 DBT     xid             DBT             s
101 ARG     formatID        int32_t         ld
102 ARG     gtrid           u_int32_t       lu
103 ARG     bqual           u_int32_t       lu
104 POINTER begin_lsn       DB_LSN *        lu
105 LOCKS   locks           DBT             s
106 END
107
108 BEGIN prepare           48              13
109 ARG     opcode          u_int32_t       lu
110 DBT     gid             DBT     s
111 POINTER begin_lsn       DB_LSN *        lu
112 LOCKS   locks           DBT             s
113 END
114
115 /*
116  * Log the fact that we are recycling txnids.
117  */
118 BEGIN recycle           42      14
119 ARG     min             u_int32_t       lu
120 ARG     max             u_int32_t       lu
121 END