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

Commit 71901ab

Browse files
committed
Introduce InvalidCommandId.
This allows a 32-bit field to represent an *optional* command ID without a separate flag bit. Andres Freund
1 parent 9c68834 commit 71901ab

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/backend/access/transam/xact.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,12 @@ CommandCounterIncrement(void)
766766
if (currentCommandIdUsed)
767767
{
768768
currentCommandId += 1;
769-
if (currentCommandId == FirstCommandId) /* check for overflow */
769+
if (currentCommandId == InvalidCommandId)
770770
{
771771
currentCommandId -= 1;
772772
ereport(ERROR,
773773
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
774-
errmsg("cannot have more than 2^32-1 commands in a transaction")));
774+
errmsg("cannot have more than 2^32-2 commands in a transaction")));
775775
}
776776
currentCommandIdUsed = false;
777777

src/include/c.h

+1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ typedef uint32 MultiXactOffset;
368368
typedef uint32 CommandId;
369369

370370
#define FirstCommandId ((CommandId) 0)
371+
#define InvalidCommandId (~(CommandId)0)
371372

372373
/*
373374
* Array indexing support

0 commit comments

Comments
 (0)