Commit 8bb0c977 authored by Robert Haas's avatar Robert Haas

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
parent 94929f1c
...@@ -555,7 +555,7 @@ check_tuple_header_and_visibilty(HeapTupleHeader tuphdr, HeapCheckContext *ctx) ...@@ -555,7 +555,7 @@ check_tuple_header_and_visibilty(HeapTupleHeader tuphdr, HeapCheckContext *ctx)
{ {
uint16 infomask = tuphdr->t_infomask; uint16 infomask = tuphdr->t_infomask;
bool header_garbled = false; bool header_garbled = false;
unsigned expected_hoff;; unsigned expected_hoff;
if (ctx->tuphdr->t_hoff > ctx->lp_len) if (ctx->tuphdr->t_hoff > ctx->lp_len)
{ {
...@@ -1368,60 +1368,55 @@ check_mxid_valid_in_rel(MultiXactId mxid, HeapCheckContext *ctx) ...@@ -1368,60 +1368,55 @@ check_mxid_valid_in_rel(MultiXactId mxid, HeapCheckContext *ctx)
* truly been valid at that time. * truly been valid at that time.
* *
* If the status argument is not NULL, and if and only if the transaction ID * If the status argument is not NULL, and if and only if the transaction ID
* appears to be valid in this relation, clog will be consulted and the commit * appears to be valid in this relation, the status argument will be set with
* status argument will be set with the status of the transaction ID. * the commit status of the transaction ID.
*/ */
static XidBoundsViolation static XidBoundsViolation
get_xid_status(TransactionId xid, HeapCheckContext *ctx, get_xid_status(TransactionId xid, HeapCheckContext *ctx,
XidCommitStatus *status) XidCommitStatus *status)
{ {
XidBoundsViolation result;
FullTransactionId fxid; FullTransactionId fxid;
FullTransactionId clog_horizon; FullTransactionId clog_horizon;
/* Quick check for special xids */ /* Quick check for special xids */
if (!TransactionIdIsValid(xid)) if (!TransactionIdIsValid(xid))
result = XID_INVALID; return XID_INVALID;
else if (xid == BootstrapTransactionId || xid == FrozenTransactionId) else if (xid == BootstrapTransactionId || xid == FrozenTransactionId)
result = XID_BOUNDS_OK;
else
{ {
/* Check if the xid is within bounds */ if (status != NULL)
fxid = FullTransactionIdFromXidAndCtx(xid, ctx); *status = XID_COMMITTED;
if (!fxid_in_cached_range(fxid, ctx)) return XID_BOUNDS_OK;
{ }
/*
* We may have been checking against stale values. Update the
* cached range to be sure, and since we relied on the cached
* range when we performed the full xid conversion, reconvert.
*/
update_cached_xid_range(ctx);
fxid = FullTransactionIdFromXidAndCtx(xid, ctx);
}
if (FullTransactionIdPrecedesOrEquals(ctx->next_fxid, fxid)) /* Check if the xid is within bounds */
result = XID_IN_FUTURE; fxid = FullTransactionIdFromXidAndCtx(xid, ctx);
else if (FullTransactionIdPrecedes(fxid, ctx->oldest_fxid)) if (!fxid_in_cached_range(fxid, ctx))
result = XID_PRECEDES_CLUSTERMIN; {
else if (FullTransactionIdPrecedes(fxid, ctx->relfrozenfxid)) /*
result = XID_PRECEDES_RELMIN; * We may have been checking against stale values. Update the
else * cached range to be sure, and since we relied on the cached
result = XID_BOUNDS_OK; * range when we performed the full xid conversion, reconvert.
*/
update_cached_xid_range(ctx);
fxid = FullTransactionIdFromXidAndCtx(xid, ctx);
} }
/* if (FullTransactionIdPrecedesOrEquals(ctx->next_fxid, fxid))
* Early return if the caller does not request clog checking, or if the return XID_IN_FUTURE;
* xid is already known to be out of bounds. We dare not check clog for if (FullTransactionIdPrecedes(fxid, ctx->oldest_fxid))
* out of bounds transaction IDs. return XID_PRECEDES_CLUSTERMIN;
*/ if (FullTransactionIdPrecedes(fxid, ctx->relfrozenfxid))
if (status == NULL || result != XID_BOUNDS_OK) return XID_PRECEDES_RELMIN;
return result;
/* Early return if the caller does not request clog checking */
if (status == NULL)
return XID_BOUNDS_OK;
/* Early return if we just checked this xid in a prior call */ /* Early return if we just checked this xid in a prior call */
if (xid == ctx->cached_xid) if (xid == ctx->cached_xid)
{ {
*status = ctx->cached_status; *status = ctx->cached_status;
return result; return XID_BOUNDS_OK;
} }
*status = XID_COMMITTED; *status = XID_COMMITTED;
...@@ -1443,5 +1438,5 @@ get_xid_status(TransactionId xid, HeapCheckContext *ctx, ...@@ -1443,5 +1438,5 @@ get_xid_status(TransactionId xid, HeapCheckContext *ctx,
LWLockRelease(XactTruncationLock); LWLockRelease(XactTruncationLock);
ctx->cached_xid = xid; ctx->cached_xid = xid;
ctx->cached_status = *status; ctx->cached_status = *status;
return result; return XID_BOUNDS_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment