@@ -555,7 +555,7 @@ check_tuple_header_and_visibilty(HeapTupleHeader tuphdr, HeapCheckContext *ctx)
555
555
{
556
556
uint16 infomask = tuphdr -> t_infomask ;
557
557
bool header_garbled = false;
558
- unsigned expected_hoff ;;
558
+ unsigned expected_hoff ;
559
559
560
560
if (ctx -> tuphdr -> t_hoff > ctx -> lp_len )
561
561
{
@@ -1368,60 +1368,55 @@ check_mxid_valid_in_rel(MultiXactId mxid, HeapCheckContext *ctx)
1368
1368
* truly been valid at that time.
1369
1369
*
1370
1370
* If the status argument is not NULL, and if and only if the transaction ID
1371
- * appears to be valid in this relation, clog will be consulted and the commit
1372
- * status argument will be set with the status of the transaction ID.
1371
+ * appears to be valid in this relation, the status argument will be set with
1372
+ * the commit status of the transaction ID.
1373
1373
*/
1374
1374
static XidBoundsViolation
1375
1375
get_xid_status (TransactionId xid , HeapCheckContext * ctx ,
1376
1376
XidCommitStatus * status )
1377
1377
{
1378
- XidBoundsViolation result ;
1379
1378
FullTransactionId fxid ;
1380
1379
FullTransactionId clog_horizon ;
1381
1380
1382
1381
/* Quick check for special xids */
1383
1382
if (!TransactionIdIsValid (xid ))
1384
- result = XID_INVALID ;
1383
+ return XID_INVALID ;
1385
1384
else if (xid == BootstrapTransactionId || xid == FrozenTransactionId )
1386
- result = XID_BOUNDS_OK ;
1387
- else
1388
1385
{
1389
- /* Check if the xid is within bounds */
1390
- fxid = FullTransactionIdFromXidAndCtx (xid , ctx );
1391
- if (!fxid_in_cached_range (fxid , ctx ))
1392
- {
1393
- /*
1394
- * We may have been checking against stale values. Update the
1395
- * cached range to be sure, and since we relied on the cached
1396
- * range when we performed the full xid conversion, reconvert.
1397
- */
1398
- update_cached_xid_range (ctx );
1399
- fxid = FullTransactionIdFromXidAndCtx (xid , ctx );
1400
- }
1386
+ if (status != NULL )
1387
+ * status = XID_COMMITTED ;
1388
+ return XID_BOUNDS_OK ;
1389
+ }
1401
1390
1402
- if (FullTransactionIdPrecedesOrEquals (ctx -> next_fxid , fxid ))
1403
- result = XID_IN_FUTURE ;
1404
- else if (FullTransactionIdPrecedes (fxid , ctx -> oldest_fxid ))
1405
- result = XID_PRECEDES_CLUSTERMIN ;
1406
- else if (FullTransactionIdPrecedes (fxid , ctx -> relfrozenfxid ))
1407
- result = XID_PRECEDES_RELMIN ;
1408
- else
1409
- result = XID_BOUNDS_OK ;
1391
+ /* Check if the xid is within bounds */
1392
+ fxid = FullTransactionIdFromXidAndCtx (xid , ctx );
1393
+ if (!fxid_in_cached_range (fxid , ctx ))
1394
+ {
1395
+ /*
1396
+ * We may have been checking against stale values. Update the
1397
+ * cached range to be sure, and since we relied on the cached
1398
+ * range when we performed the full xid conversion, reconvert.
1399
+ */
1400
+ update_cached_xid_range (ctx );
1401
+ fxid = FullTransactionIdFromXidAndCtx (xid , ctx );
1410
1402
}
1411
1403
1412
- /*
1413
- * Early return if the caller does not request clog checking, or if the
1414
- * xid is already known to be out of bounds. We dare not check clog for
1415
- * out of bounds transaction IDs.
1416
- */
1417
- if (status == NULL || result != XID_BOUNDS_OK )
1418
- return result ;
1404
+ if (FullTransactionIdPrecedesOrEquals (ctx -> next_fxid , fxid ))
1405
+ return XID_IN_FUTURE ;
1406
+ if (FullTransactionIdPrecedes (fxid , ctx -> oldest_fxid ))
1407
+ return XID_PRECEDES_CLUSTERMIN ;
1408
+ if (FullTransactionIdPrecedes (fxid , ctx -> relfrozenfxid ))
1409
+ return XID_PRECEDES_RELMIN ;
1410
+
1411
+ /* Early return if the caller does not request clog checking */
1412
+ if (status == NULL )
1413
+ return XID_BOUNDS_OK ;
1419
1414
1420
1415
/* Early return if we just checked this xid in a prior call */
1421
1416
if (xid == ctx -> cached_xid )
1422
1417
{
1423
1418
* status = ctx -> cached_status ;
1424
- return result ;
1419
+ return XID_BOUNDS_OK ;
1425
1420
}
1426
1421
1427
1422
* status = XID_COMMITTED ;
@@ -1443,5 +1438,5 @@ get_xid_status(TransactionId xid, HeapCheckContext *ctx,
1443
1438
LWLockRelease (XactTruncationLock );
1444
1439
ctx -> cached_xid = xid ;
1445
1440
ctx -> cached_status = * status ;
1446
- return result ;
1441
+ return XID_BOUNDS_OK ;
1447
1442
}
0 commit comments