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