@@ -1390,136 +1390,18 @@ check_tuple_attribute(HeapCheckContext *ctx)
13901390static void
13911391check_tuple (HeapCheckContext * ctx )
13921392{
1393- TransactionId xmin ;
1394- TransactionId xmax ;
1395- bool fatal = false;
1396- uint16 infomask = ctx -> tuphdr -> t_infomask ;
1397-
1398- /* If xmin is normal, it should be within valid range */
1399- xmin = HeapTupleHeaderGetXmin (ctx -> tuphdr );
1400- switch (get_xid_status (xmin , ctx , NULL ))
1401- {
1402- case XID_INVALID :
1403- case XID_BOUNDS_OK :
1404- break ;
1405- case XID_IN_FUTURE :
1406- report_corruption (ctx ,
1407- psprintf ("xmin %u equals or exceeds next valid transaction ID %u:%u" ,
1408- xmin ,
1409- EpochFromFullTransactionId (ctx -> next_fxid ),
1410- XidFromFullTransactionId (ctx -> next_fxid )));
1411- fatal = true;
1412- break ;
1413- case XID_PRECEDES_CLUSTERMIN :
1414- report_corruption (ctx ,
1415- psprintf ("xmin %u precedes oldest valid transaction ID %u:%u" ,
1416- xmin ,
1417- EpochFromFullTransactionId (ctx -> oldest_fxid ),
1418- XidFromFullTransactionId (ctx -> oldest_fxid )));
1419- fatal = true;
1420- break ;
1421- case XID_PRECEDES_RELMIN :
1422- report_corruption (ctx ,
1423- psprintf ("xmin %u precedes relation freeze threshold %u:%u" ,
1424- xmin ,
1425- EpochFromFullTransactionId (ctx -> relfrozenfxid ),
1426- XidFromFullTransactionId (ctx -> relfrozenfxid )));
1427- fatal = true;
1428- break ;
1429- }
1430-
1431- xmax = HeapTupleHeaderGetRawXmax (ctx -> tuphdr );
1432-
1433- if (infomask & HEAP_XMAX_IS_MULTI )
1434- {
1435- /* xmax is a multixact, so it should be within valid MXID range */
1436- switch (check_mxid_valid_in_rel (xmax , ctx ))
1437- {
1438- case XID_INVALID :
1439- report_corruption (ctx ,
1440- pstrdup ("multitransaction ID is invalid" ));
1441- fatal = true;
1442- break ;
1443- case XID_PRECEDES_RELMIN :
1444- report_corruption (ctx ,
1445- psprintf ("multitransaction ID %u precedes relation minimum multitransaction ID threshold %u" ,
1446- xmax , ctx -> relminmxid ));
1447- fatal = true;
1448- break ;
1449- case XID_PRECEDES_CLUSTERMIN :
1450- report_corruption (ctx ,
1451- psprintf ("multitransaction ID %u precedes oldest valid multitransaction ID threshold %u" ,
1452- xmax , ctx -> oldest_mxact ));
1453- fatal = true;
1454- break ;
1455- case XID_IN_FUTURE :
1456- report_corruption (ctx ,
1457- psprintf ("multitransaction ID %u equals or exceeds next valid multitransaction ID %u" ,
1458- xmax ,
1459- ctx -> next_mxact ));
1460- fatal = true;
1461- break ;
1462- case XID_BOUNDS_OK :
1463- break ;
1464- }
1465- }
1466- else
1467- {
1468- /*
1469- * xmax is not a multixact and is normal, so it should be within the
1470- * valid XID range.
1471- */
1472- switch (get_xid_status (xmax , ctx , NULL ))
1473- {
1474- case XID_INVALID :
1475- case XID_BOUNDS_OK :
1476- break ;
1477- case XID_IN_FUTURE :
1478- report_corruption (ctx ,
1479- psprintf ("xmax %u equals or exceeds next valid transaction ID %u:%u" ,
1480- xmax ,
1481- EpochFromFullTransactionId (ctx -> next_fxid ),
1482- XidFromFullTransactionId (ctx -> next_fxid )));
1483- fatal = true;
1484- break ;
1485- case XID_PRECEDES_CLUSTERMIN :
1486- report_corruption (ctx ,
1487- psprintf ("xmax %u precedes oldest valid transaction ID %u:%u" ,
1488- xmax ,
1489- EpochFromFullTransactionId (ctx -> oldest_fxid ),
1490- XidFromFullTransactionId (ctx -> oldest_fxid )));
1491- fatal = true;
1492- break ;
1493- case XID_PRECEDES_RELMIN :
1494- report_corruption (ctx ,
1495- psprintf ("xmax %u precedes relation freeze threshold %u:%u" ,
1496- xmax ,
1497- EpochFromFullTransactionId (ctx -> relfrozenfxid ),
1498- XidFromFullTransactionId (ctx -> relfrozenfxid )));
1499- fatal = true;
1500- }
1501- }
1502-
15031393 /*
1504- * Cannot process tuple data if tuple header was corrupt, as the offsets
1505- * within the page cannot be trusted, leaving too much risk of reading
1506- * garbage if we continue.
1507- *
1508- * We also cannot process the tuple if the xmin or xmax were invalid
1509- * relative to relfrozenxid or relminmxid, as clog entries for the xids
1510- * may already be gone.
1394+ * Check various forms of tuple header corruption, and if the header is too
1395+ * corrupt, do not continue with other checks.
15111396 */
1512- if (fatal )
1397+ if (! check_tuple_header ( ctx ) )
15131398 return ;
15141399
15151400 /*
1516- * Check various forms of tuple header corruption . If the header is too
1517- * corrupt to continue checking, or if the tuple is not visible to anyone,
1518- * we cannot continue with other checks .
1401+ * Check tuple visibility . If the inserting transaction aborted, we
1402+ * cannot assume our relation description matches the tuple structure, and
1403+ * therefore cannot check it .
15191404 */
1520- if (!check_tuple_header (ctx ))
1521- return ;
1522-
15231405 if (!check_tuple_visibility (ctx ))
15241406 return ;
15251407
0 commit comments