@@ -1306,38 +1306,42 @@ _bt_insertonpg(Relation rel,
1306
1306
* Leaf insert with posting list split. Must include
1307
1307
* postingoff field before newitem/orignewitem.
1308
1308
*/
1309
+ Assert (isleaf );
1309
1310
xlinfo = XLOG_BTREE_INSERT_POST ;
1310
1311
}
1311
1312
else
1312
1313
{
1313
1314
/* Internal page insert, which finishes a split on cbuf */
1314
1315
xlinfo = XLOG_BTREE_INSERT_UPPER ;
1315
1316
XLogRegisterBuffer (1 , cbuf , REGBUF_STANDARD );
1316
- }
1317
1317
1318
- if (BufferIsValid (metabuf ))
1319
- {
1320
- Assert (metad -> btm_version >= BTREE_NOVAC_VERSION );
1321
- xlmeta .version = metad -> btm_version ;
1322
- xlmeta .root = metad -> btm_root ;
1323
- xlmeta .level = metad -> btm_level ;
1324
- xlmeta .fastroot = metad -> btm_fastroot ;
1325
- xlmeta .fastlevel = metad -> btm_fastlevel ;
1326
- xlmeta .oldest_btpo_xact = metad -> btm_oldest_btpo_xact ;
1327
- xlmeta .last_cleanup_num_heap_tuples =
1328
- metad -> btm_last_cleanup_num_heap_tuples ;
1329
- xlmeta .allequalimage = metad -> btm_allequalimage ;
1330
-
1331
- XLogRegisterBuffer (2 , metabuf , REGBUF_WILL_INIT | REGBUF_STANDARD );
1332
- XLogRegisterBufData (2 , (char * ) & xlmeta , sizeof (xl_btree_metadata ));
1333
-
1334
- xlinfo = XLOG_BTREE_INSERT_META ;
1318
+ if (BufferIsValid (metabuf ))
1319
+ {
1320
+ /* Actually, it's an internal page insert + meta update */
1321
+ xlinfo = XLOG_BTREE_INSERT_META ;
1322
+
1323
+ Assert (metad -> btm_version >= BTREE_NOVAC_VERSION );
1324
+ xlmeta .version = metad -> btm_version ;
1325
+ xlmeta .root = metad -> btm_root ;
1326
+ xlmeta .level = metad -> btm_level ;
1327
+ xlmeta .fastroot = metad -> btm_fastroot ;
1328
+ xlmeta .fastlevel = metad -> btm_fastlevel ;
1329
+ xlmeta .oldest_btpo_xact = metad -> btm_oldest_btpo_xact ;
1330
+ xlmeta .last_cleanup_num_heap_tuples =
1331
+ metad -> btm_last_cleanup_num_heap_tuples ;
1332
+ xlmeta .allequalimage = metad -> btm_allequalimage ;
1333
+
1334
+ XLogRegisterBuffer (2 , metabuf ,
1335
+ REGBUF_WILL_INIT | REGBUF_STANDARD );
1336
+ XLogRegisterBufData (2 , (char * ) & xlmeta ,
1337
+ sizeof (xl_btree_metadata ));
1338
+ }
1335
1339
}
1336
1340
1337
1341
XLogRegisterBuffer (0 , buf , REGBUF_STANDARD );
1338
1342
if (postingoff == 0 )
1339
1343
{
1340
- /* Simple, common case -- log itup from caller */
1344
+ /* Just log itup from caller */
1341
1345
XLogRegisterBufData (0 , (char * ) itup , IndexTupleSize (itup ));
1342
1346
}
1343
1347
else
0 commit comments