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

Commit a1aeea6

Browse files
committed
Fix bug in monotonic sequences support
1 parent 700bab9 commit a1aeea6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

contrib/mmts/pglogical_apply.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,13 @@ void MtmExecutor(void* work, size_t size)
11611161
case 'N':
11621162
{
11631163
int64 next;
1164+
Oid relid;
11641165
Assert(rel != NULL);
1165-
next = pq_getmsgint64(&s);
1166-
AdjustSequence(RelationGetRelid(rel), next);
1166+
relid = RelationGetRelid(rel);
11671167
close_rel(rel);
11681168
rel = NULL;
1169+
next = pq_getmsgint64(&s);
1170+
AdjustSequence(relid, next);
11691171
break;
11701172
}
11711173
case '0':

src/backend/commands/sequence.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,6 @@ void AdjustSequence(Oid relid, int64 next)
861861
/* open and AccessShareLock sequence */
862862
init_sequence(relid, &elm, &seqrel);
863863

864-
/* lock page' buffer and read tuple */
865-
seq = read_seq_tuple(elm, seqrel, &buf, &seqtuple);
866-
867864
if (elm->last != elm->cached && elm->last + elm->increment > next) /* cached number is greater than received */
868865
{
869866
relation_close(seqrel, NoLock);

0 commit comments

Comments
 (0)