Remove definition of builtin function
[platform/upstream/db4.git] / btree / btree.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  __bam
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_am.h"
16 INCLUDE #include "dbinc/btree.h"
17 INCLUDE #include "dbinc/log.h"
18 INCLUDE #include "dbinc/txn.h"
19 INCLUDE
20
21 /*
22  * BTREE-split: used to log a page split.
23  *
24  * left:        the page number for the low-order contents.
25  * llsn:        the left page's original LSN.
26  * right:       the page number for the high-order contents.
27  * rlsn:        the right page's original LSN.
28  * indx:        the number of entries that went to the left page.
29  * npgno:       the next page number
30  * nlsn:        the next page's original LSN (or 0 if no next page).
31  * pgno:        the parent page number
32  * plsn:        the parent page's original LSN.
33  * pg:          the split page's contents before the split.
34  * opflags:     SPL_NRECS: if splitting a tree that maintains a record count.
35  * pindx:       index of new record in parent page.
36  */
37 BEGIN split             48      62
38 DB      fileid          int32_t         ld
39 ARG     left            db_pgno_t       lu
40 POINTER llsn            DB_LSN *        lu
41 ARG     right           db_pgno_t       lu
42 POINTER rlsn            DB_LSN *        lu
43 ARG     indx            u_int32_t       lu
44 ARG     npgno           db_pgno_t       lu
45 POINTER nlsn            DB_LSN *        lu
46 ARG     ppgno           db_pgno_t       lu
47 POINTER plsn            DB_LSN *        lu
48 ARG     pindx           u_int32_t       lu
49 PGDBT   pg              DBT             s
50 DBT     pentry          DBT             s
51 DBT     rentry          DBT             s
52 ARG     opflags         u_int32_t       lu
53 END
54
55 BEGIN_COMPAT split      42      62
56 DB      fileid          int32_t         ld
57 ARG     left            db_pgno_t       lu
58 POINTER llsn            DB_LSN *        lu
59 ARG     right           db_pgno_t       lu
60 POINTER rlsn            DB_LSN *        lu
61 ARG     indx            u_int32_t       lu
62 ARG     npgno           db_pgno_t       lu
63 POINTER nlsn            DB_LSN *        lu
64 ARG     root_pgno       db_pgno_t       lu
65 PGDBT   pg              DBT             s
66 ARG     opflags         u_int32_t       lu
67 END
68
69 /*
70  * BTREE-rsplit: used to log a reverse-split
71  *
72  * pgno:        the page number of the page copied over the root.
73  * pgdbt:       the page being copied on the root page.
74  * root_pgno:   the root page number.
75  * nrec:        the tree's record count.
76  * rootent:     last entry on the root page.
77  * rootlsn:     the root page's original lsn.
78  */
79 BEGIN rsplit            42      63
80 DB      fileid          int32_t         ld
81 ARG     pgno            db_pgno_t       lu
82 PGDBT   pgdbt           DBT             s
83 ARG     root_pgno       db_pgno_t       lu
84 ARG     nrec            db_pgno_t       lu
85 DBT     rootent         DBT             s
86 POINTER rootlsn         DB_LSN *        lu
87 END
88
89 /*
90  * BTREE-adj: used to log the adjustment of an index.
91  *
92  * pgno:        the page modified.
93  * lsn:         the page's original lsn.
94  * indx:        the index adjusted.
95  * indx_copy:   the index to copy if inserting.
96  * is_insert:   0 if a delete, 1 if an insert.
97  */
98 BEGIN adj               42      55
99 DB      fileid          int32_t         ld
100 ARG     pgno            db_pgno_t       lu
101 POINTER lsn             DB_LSN *        lu
102 ARG     indx            u_int32_t       lu
103 ARG     indx_copy       u_int32_t       lu
104 ARG     is_insert       u_int32_t       lu
105 END
106
107 /*
108  * BTREE-cadjust: used to adjust the count change in an internal page.
109  *
110  * pgno:        the page modified.
111  * lsn:         the page's original lsn.
112  * indx:        the index to be adjusted.
113  * adjust:      the signed adjustment.
114  * opflags:     CAD_UPDATEROOT: if root page count was adjusted.
115  */
116 BEGIN cadjust           42      56
117 DB      fileid          int32_t         ld
118 ARG     pgno            db_pgno_t       lu
119 POINTER lsn             DB_LSN *        lu
120 ARG     indx            u_int32_t       lu
121 ARG     adjust          int32_t         ld
122 ARG     opflags         u_int32_t       lu
123 END
124
125 /*
126  * BTREE-cdel: used to log the intent-to-delete of a cursor record.
127  *
128  * pgno:        the page modified.
129  * lsn:         the page's original lsn.
130  * indx:        the index to be deleted.
131  */
132 BEGIN cdel              42      57
133 DB      fileid          int32_t         ld
134 ARG     pgno            db_pgno_t       lu
135 POINTER lsn             DB_LSN *        lu
136 ARG     indx            u_int32_t       lu
137 END
138
139 /*
140  * BTREE-repl: used to log the replacement of an item.
141  *
142  * pgno:        the page modified.
143  * lsn:         the page's original lsn.
144  * indx:        the index to be replaced.
145  * isdeleted:   set if the record was previously deleted.
146  * orig:        the original data.
147  * repl:        the replacement data.
148  * prefix:      the prefix of the replacement that matches the original.
149  * suffix:      the suffix of the replacement that matches the original.
150  */
151 BEGIN repl              42      58
152 DB      fileid          int32_t         ld
153 ARG     pgno            db_pgno_t       lu
154 POINTER lsn             DB_LSN *        lu
155 ARG     indx            u_int32_t       lu
156 ARG     isdeleted       u_int32_t       lu
157 DBT     orig            DBT             s
158 DBT     repl            DBT             s
159 ARG     prefix          u_int32_t       lu
160 ARG     suffix          u_int32_t       lu
161 END
162
163 /*
164  * BTREE-root: log the assignment of a root btree page.
165  */
166 BEGIN root              42      59
167 DB      fileid          int32_t         ld
168 ARG     meta_pgno       db_pgno_t       lu
169 ARG     root_pgno       db_pgno_t       lu
170 POINTER meta_lsn        DB_LSN *        lu
171 END
172
173 /*
174  * BTREE-curadj: undo cursor adjustments on txn abort.
175  *     Should only be processed during DB_TXN_ABORT.
176  * NOTE: the first_indx field gets used to hold
177  *      signed index adjustment in one case.
178  *      care should be taken if its size is changed.
179  */
180 BEGIN curadj            42      64
181 /* Fileid of db affected. */
182 DB      fileid          int32_t         ld
183 /* Which adjustment. */
184 ARG     mode            db_ca_mode      ld
185 /* Page entry is from. */
186 ARG     from_pgno       db_pgno_t       lu
187 /* Page entry  went to. */
188 ARG     to_pgno         db_pgno_t       lu
189 /* Left page of root split. */
190 ARG     left_pgno       db_pgno_t       lu
191 /* First index of dup set. Also used as adjustment. */
192 ARG     first_indx      u_int32_t       lu
193 /* Index entry is from. */
194 ARG     from_indx       u_int32_t       lu
195 /* Index where entry went. */
196 ARG     to_indx         u_int32_t       lu
197 END
198
199 /*
200  * BTREE-rcuradj: undo cursor adjustments on txn abort in
201  *     renumbering recno trees.
202  *     Should only be processed during DB_TXN_ABORT.
203  */
204 BEGIN rcuradj   42      65
205 /* Fileid of db affected. */
206 DB      fileid          int32_t         ld
207 /* Which adjustment. */
208 ARG     mode            ca_recno_arg    ld
209 /* Root page number. */
210 ARG     root            db_pgno_t       ld
211 /* Recno of the adjustment. */
212 ARG     recno           db_recno_t      ld
213 /* Order number of the adjustment. */
214 ARG     order           u_int32_t       lu
215 END
216
217 /*
218  * BTREE-relink -- Handles relinking around a deleted leaf page.
219  *
220  */
221 BEGIN_COMPAT relink             43      147
222 /* Fileid of db affected. */
223 DB      fileid          int32_t         ld
224 /* The page being removed. */
225 ARG     pgno            db_pgno_t       lu
226 /* The page's original lsn. */
227 POINTER lsn             DB_LSN *        lu
228 /* The previous page. */
229 ARG     prev            db_pgno_t       lu
230 /* The previous page's original lsn. */
231 POINTER lsn_prev        DB_LSN *        lu
232 /* The next page. */
233 ARG     next            db_pgno_t       lu
234 /* The previous page's original lsn. */
235 POINTER lsn_next        DB_LSN *        lu
236 END
237
238 BEGIN relink            44      147
239 /* Fileid of db affected. */
240 DB      fileid          int32_t         ld
241 /* The page being removed. */
242 ARG     pgno            db_pgno_t       lu
243 /* The new page number, if any. */
244 ARG     new_pgno        db_pgno_t       lu
245 /* The previous page. */
246 ARG     prev            db_pgno_t       lu
247 /* The previous page's original lsn. */
248 POINTER lsn_prev        DB_LSN *        lu
249 /* The next page. */
250 ARG     next            db_pgno_t       lu
251 /* The previous page's original lsn. */
252 POINTER lsn_next        DB_LSN *        lu
253 END
254
255 /*
256  * BTREE-merge -- Handles merging of pages during a compaction.
257  */
258 BEGIN_COMPAT merge              44      148
259 DB      fileid          int32_t         ld
260 ARG     pgno            db_pgno_t       lu
261 POINTER lsn             DB_LSN *        lu
262 ARG     npgno           db_pgno_t       lu
263 POINTER nlsn            DB_LSN *        lu
264 DBT     hdr             DBT             s
265 DBT     data            DBT             s
266 DBT     ind             DBT             s
267 END
268
269 BEGIN merge             47      148
270 DB      fileid          int32_t         ld
271 ARG     pgno            db_pgno_t       lu
272 POINTER lsn             DB_LSN *        lu
273 ARG     npgno           db_pgno_t       lu
274 POINTER nlsn            DB_LSN *        lu
275 PGDBT   hdr             DBT             s
276 PGDDBT  data            DBT             s
277 ARG     pg_copy         int32_t         lu
278 END
279
280 /*
281  * BTREE-pgno -- Handles replacing a page number in the record
282  * reference on pgno by indx.
283  */
284 BEGIN pgno              44      149
285 DB      fileid          int32_t         ld
286 ARG     pgno            db_pgno_t       lu
287 POINTER lsn             DB_LSN *        lu
288 ARG     indx            u_int32_t       lu
289 ARG     opgno           db_pgno_t       lu
290 ARG     npgno           db_pgno_t       lu
291 END