|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.68 2000/11/16 05:50:58 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.69 2000/11/30 08:46:21 vadim Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -61,9 +61,7 @@ static void _bt_pgaddtup(Relation rel, Page page, |
61 | 61 | static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, |
62 | 62 | int keysz, ScanKey scankey); |
63 | 63 |
|
64 | | -#ifdef XLOG |
65 | 64 | static Relation _xlheapRel; /* temporary hack */ |
66 | | -#endif |
67 | 65 |
|
68 | 66 | /* |
69 | 67 | * _bt_doinsert() -- Handle insertion of a single btitem in the tree. |
@@ -123,9 +121,7 @@ _bt_doinsert(Relation rel, BTItem btitem, |
123 | 121 | } |
124 | 122 | } |
125 | 123 |
|
126 | | -#ifdef XLOG |
127 | 124 | _xlheapRel = heapRel; /* temporary hack */ |
128 | | -#endif |
129 | 125 |
|
130 | 126 | /* do the insertion */ |
131 | 127 | res = _bt_insertonpg(rel, buf, stack, natts, itup_scankey, btitem, 0); |
@@ -522,7 +518,6 @@ _bt_insertonpg(Relation rel, |
522 | 518 | } |
523 | 519 | else |
524 | 520 | { |
525 | | -#ifdef XLOG |
526 | 521 | /* XLOG stuff */ |
527 | 522 | { |
528 | 523 | char xlbuf[sizeof(xl_btree_insert) + |
@@ -562,7 +557,7 @@ _bt_insertonpg(Relation rel, |
562 | 557 | PageSetLSN(page, recptr); |
563 | 558 | PageSetSUI(page, ThisStartUpID); |
564 | 559 | } |
565 | | -#endif |
| 560 | + |
566 | 561 | _bt_pgaddtup(rel, page, itemsz, btitem, newitemoff, "page"); |
567 | 562 | itup_off = newitemoff; |
568 | 563 | itup_blkno = BufferGetBlockNumber(buf); |
@@ -612,10 +607,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, |
612 | 607 | rightoff; |
613 | 608 | OffsetNumber maxoff; |
614 | 609 | OffsetNumber i; |
615 | | - |
616 | | -#ifdef XLOG |
617 | 610 | BTItem lhikey; |
618 | | -#endif |
619 | 611 |
|
620 | 612 | rbuf = _bt_getbuf(rel, P_NEW, BT_WRITE); |
621 | 613 | origpage = BufferGetPage(buf); |
@@ -685,9 +677,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, |
685 | 677 | itemsz = ItemIdGetLength(itemid); |
686 | 678 | item = (BTItem) PageGetItem(origpage, itemid); |
687 | 679 | } |
688 | | -#ifdef XLOG |
689 | 680 | lhikey = item; |
690 | | -#endif |
691 | 681 | if (PageAddItem(leftpage, (Item) item, itemsz, leftoff, |
692 | 682 | LP_USED) == InvalidOffsetNumber) |
693 | 683 | elog(STOP, "btree: failed to add hikey to the left sibling"); |
@@ -775,7 +765,6 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, |
775 | 765 | spage = BufferGetPage(sbuf); |
776 | 766 | } |
777 | 767 |
|
778 | | -#ifdef XLOG |
779 | 768 | /* |
780 | 769 | * Right sibling is locked, new siblings are prepared, but original |
781 | 770 | * page is not updated yet. Log changes before continuing. |
@@ -860,7 +849,6 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, |
860 | 849 | PageSetSUI(spage, ThisStartUpID); |
861 | 850 | } |
862 | 851 | } |
863 | | -#endif |
864 | 852 |
|
865 | 853 | /* |
866 | 854 | * By here, the original data page has been split into two new halves, |
@@ -1165,19 +1153,13 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) |
1165 | 1153 | BTItem item; |
1166 | 1154 | Size itemsz; |
1167 | 1155 | BTItem new_item; |
1168 | | - |
1169 | | -#ifdef XLOG |
1170 | 1156 | Buffer metabuf; |
1171 | | -#endif |
1172 | 1157 |
|
1173 | 1158 | /* get a new root page */ |
1174 | 1159 | rootbuf = _bt_getbuf(rel, P_NEW, BT_WRITE); |
1175 | 1160 | rootpage = BufferGetPage(rootbuf); |
1176 | 1161 | rootblknum = BufferGetBlockNumber(rootbuf); |
1177 | | - |
1178 | | -#ifdef XLOG |
1179 | 1162 | metabuf = _bt_getbuf(rel, BTREE_METAPAGE,BT_WRITE); |
1180 | | -#endif |
1181 | 1163 |
|
1182 | 1164 | /* NO ELOG(ERROR) from here till newroot op is logged */ |
1183 | 1165 |
|
@@ -1237,7 +1219,6 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) |
1237 | 1219 | elog(STOP, "btree: failed to add rightkey to new root page"); |
1238 | 1220 | pfree(new_item); |
1239 | 1221 |
|
1240 | | -#ifdef XLOG |
1241 | 1222 | /* XLOG stuff */ |
1242 | 1223 | { |
1243 | 1224 | xl_btree_newroot xlrec; |
@@ -1267,16 +1248,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) |
1267 | 1248 |
|
1268 | 1249 | _bt_wrtbuf(rel, metabuf); |
1269 | 1250 | } |
1270 | | -#endif |
1271 | 1251 |
|
1272 | 1252 | /* write and let go of the new root buffer */ |
1273 | 1253 | _bt_wrtbuf(rel, rootbuf); |
1274 | 1254 |
|
1275 | | -#ifndef XLOG |
1276 | | - /* update metadata page with new root block number */ |
1277 | | - _bt_metaproot(rel, rootblknum, 0); |
1278 | | -#endif |
1279 | | - |
1280 | 1255 | /* update and release new sibling, and finally the old root */ |
1281 | 1256 | _bt_wrtbuf(rel, rbuf); |
1282 | 1257 | _bt_wrtbuf(rel, lbuf); |
|
0 commit comments