Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8bb0c97

Browse files
committed
Try to avoid a compiler warning about using fxid uninitialized.
Mark Dilger, with a couple of stray semicolons removed by me. Discussion: http://postgr.es/m/2A7DA1A8-C4AA-43DF-A985-3CA52F4DC775@enterprisedb.com
1 parent 94929f1 commit 8bb0c97

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

contrib/amcheck/verify_heapam.c

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ check_tuple_header_and_visibilty(HeapTupleHeader tuphdr, HeapCheckContext *ctx)
555555
{
556556
uint16 infomask = tuphdr->t_infomask;
557557
bool header_garbled = false;
558-
unsigned expected_hoff;;
558+
unsigned expected_hoff;
559559

560560
if (ctx->tuphdr->t_hoff > ctx->lp_len)
561561
{
@@ -1368,60 +1368,55 @@ check_mxid_valid_in_rel(MultiXactId mxid, HeapCheckContext *ctx)
13681368
* truly been valid at that time.
13691369
*
13701370
* 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.
13731373
*/
13741374
static XidBoundsViolation
13751375
get_xid_status(TransactionId xid, HeapCheckContext *ctx,
13761376
XidCommitStatus *status)
13771377
{
1378-
XidBoundsViolation result;
13791378
FullTransactionId fxid;
13801379
FullTransactionId clog_horizon;
13811380

13821381
/* Quick check for special xids */
13831382
if (!TransactionIdIsValid(xid))
1384-
result = XID_INVALID;
1383+
return XID_INVALID;
13851384
else if (xid == BootstrapTransactionId || xid == FrozenTransactionId)
1386-
result = XID_BOUNDS_OK;
1387-
else
13881385
{
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+
}
14011390

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);
14101402
}
14111403

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;
14191414

14201415
/* Early return if we just checked this xid in a prior call */
14211416
if (xid == ctx->cached_xid)
14221417
{
14231418
*status = ctx->cached_status;
1424-
return result;
1419+
return XID_BOUNDS_OK;
14251420
}
14261421

14271422
*status = XID_COMMITTED;
@@ -1443,5 +1438,5 @@ get_xid_status(TransactionId xid, HeapCheckContext *ctx,
14431438
LWLockRelease(XactTruncationLock);
14441439
ctx->cached_xid = xid;
14451440
ctx->cached_status = *status;
1446-
return result;
1441+
return XID_BOUNDS_OK;
14471442
}

0 commit comments

Comments
 (0)