|
7 | 7 | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 |
| - * $Id: nbtree.h,v 1.41 2000/08/10 02:33:19 inoue Exp $ |
| 10 | + * $Id: nbtree.h,v 1.42 2000/09/12 06:07:52 vadim Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -183,6 +183,72 @@ typedef BTStackData *BTStack;
|
183 | 183 | #defineP_FIRSTKEY((OffsetNumber) 2)
|
184 | 184 | #defineP_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY)
|
185 | 185 |
|
| 186 | + |
| 187 | +#ifdefXLOG |
| 188 | + |
| 189 | +/* XLOG stuff */ |
| 190 | + |
| 191 | +/* |
| 192 | + * XLOG allows to store some information in high 4 bits of log |
| 193 | + * record xl_info field |
| 194 | + */ |
| 195 | +#defineXLOG_BTREE_DELETE0x00/* delete btitem */ |
| 196 | +#defineXLOG_BTREE_INSERT0x10/* add btitem without split */ |
| 197 | +#defineXLOG_BTREE_SPLIT0x20/* add btitem with split */ |
| 198 | +#defineXLOG_BTREE_ONLEFT0x40/* flag for split case: new btitem */ |
| 199 | +/* goes to the left sibling */ |
| 200 | + |
| 201 | +/* |
| 202 | + * All what we need to find changed index tuple (18 bytes) |
| 203 | + */ |
| 204 | +typedefstructxl_btreetid |
| 205 | +{ |
| 206 | +RelFileNodenode; |
| 207 | +CommandIdcid;/* this is for "better" tuple' */ |
| 208 | +/* identification - it allows to avoid */ |
| 209 | +/* "compensation" records for undo */ |
| 210 | +ItemPointerDatatid;/* changed tuple id */ |
| 211 | +}xl_btreetid; |
| 212 | + |
| 213 | +/* This is what we need to know about delete - ALIGN(18) = 24 bytes */ |
| 214 | +typedefstructxl_btree_delete |
| 215 | +{ |
| 216 | +xl_btreetidtarget;/* deleted tuple id */ |
| 217 | +}xl_btree_delete; |
| 218 | + |
| 219 | +#defineSizeOfBtreeDelete(offsetof(xl_btreetid, tid) + SizeOfIptrData)) |
| 220 | + |
| 221 | +/* This is what we need to know about pure (without split) insert - 26 + key data */ |
| 222 | +typedefstructxl_btree_insert |
| 223 | +{ |
| 224 | +xl_btreetidtarget;/* inserted tuple id */ |
| 225 | +BTItemDatabtitem; |
| 226 | +/* KEY DATA FOLLOWS AT END OF STRUCT */ |
| 227 | +}xl_btree_insert; |
| 228 | + |
| 229 | +#defineSizeOfBtreeInsert(offsetof(xl_btree_insert, btitem) + sizeof(BTItemData)) |
| 230 | + |
| 231 | + |
| 232 | +/* This is what we need to know about insert with split - 26 + right sibling btitems */ |
| 233 | +typedefstructxl_btree_split |
| 234 | +{ |
| 235 | +xl_btreetidtarget;/* inserted tuple id */ |
| 236 | +BlockNumberothblk;/* second block participated in split: */ |
| 237 | +/* first one is stored in target' tid */ |
| 238 | +BlockNumberparblk;/* parent block to be updated */ |
| 239 | +/* |
| 240 | + * We log all btitems from the right sibling. If new btitem goes on |
| 241 | + * the left sibling then we log it too and it will be first BTItemData |
| 242 | + * at the end of this struct. |
| 243 | + */ |
| 244 | +}xl_btree_split; |
| 245 | + |
| 246 | +#defineSizeOfBtreeSplit(offsetof(xl_btree_insert, parblk) + sizeof(BlockNumber)) |
| 247 | + |
| 248 | +/* end of XLOG stuff */ |
| 249 | + |
| 250 | +#endif/* XLOG */ |
| 251 | + |
186 | 252 | /*
|
187 | 253 | *Operator strategy numbers -- ordering of these is <, <=, =, >=, >
|
188 | 254 | */
|
|