Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6968e6

Browse files
committed
Do not allow *timestamp to be passed as NULL
The code had bugs that would cause crashes if NULL was passed as thatargument (originally intended to mean not to bother returning itsvalue), and after inspection it turns out that nothing seems interestedin the case that *ts is NULL anyway. Therefore, remove the partialchecks intended to support that case.Author: Michael Paquierthough I didn't include a proposed Assert.Backpatch to 9.5.
1 parent1944628 commitd6968e6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎src/backend/access/transam/commit_ts.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ TransactionIdSetCommitTs(TransactionId xid, TimestampTz ts,
252252
/*
253253
* Interrogate the commit timestamp of a transaction.
254254
*
255-
* Return value indicates whether commit timestamp record was found for
256-
* given xid.
255+
* The return value indicates whether a commit timestamp record was found for
256+
* the given xid. The timestamp value is returned in *ts (which may not be
257+
* null), and the origin node for the Xid is returned in *nodeid, if it's not
258+
* null.
257259
*/
258260
bool
259261
TransactionIdGetCommitTsData(TransactionIdxid,TimestampTz*ts,
@@ -294,8 +296,7 @@ TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts,
294296
TransactionIdPrecedes(xid,oldestCommitTs)||
295297
TransactionIdPrecedes(newestCommitTs,xid))
296298
{
297-
if (ts)
298-
*ts=0;
299+
*ts=0;
299300
if (nodeid)
300301
*nodeid=InvalidRepOriginId;
301302
return false;
@@ -312,8 +313,7 @@ TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts,
312313
LWLockAcquire(CommitTsLock,LW_SHARED);
313314
if (commitTsShared->xidLastCommit==xid)
314315
{
315-
if (ts)
316-
*ts=commitTsShared->dataLastCommit.time;
316+
*ts=commitTsShared->dataLastCommit.time;
317317
if (nodeid)
318318
*nodeid=commitTsShared->dataLastCommit.nodeid;
319319

@@ -330,8 +330,7 @@ TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts,
330330
SizeOfCommitTimestampEntry*entryno,
331331
SizeOfCommitTimestampEntry);
332332

333-
if (ts)
334-
*ts=entry.time;
333+
*ts=entry.time;
335334
if (nodeid)
336335
*nodeid=entry.nodeid;
337336

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp