Skip to content

Commit 278aa68

Browse files
committed
Have to lock buffer while changing page' LSN.
Thanks to Tom.
1 parent a51d560 commit 278aa68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/commands/sequence.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.53 2001/04/03 21:58:00 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.54 2001/04/04 15:43:25 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -181,13 +181,13 @@ DefineSequence(CreateSeqStmt *seq)
181181
/* Now - form & insert sequence tuple */
182182
tuple = heap_formtuple(tupDesc, value, null);
183183
heap_insert(rel, tuple);
184-
ReleaseBuffer(buf);
185184

186185
/*
187186
* After crash REDO of heap_insert above would re-init page and
188187
* our magic number would be lost. We have to log sequence creation.
189188
* This means two log records instead of one -:(
190189
*/
190+
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
191191
START_CRIT_SECTION();
192192
{
193193
xl_seq_rec xlrec;
@@ -217,6 +217,8 @@ DefineSequence(CreateSeqStmt *seq)
217217
}
218218
END_CRIT_SECTION();
219219

220+
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
221+
ReleaseBuffer(buf);
220222
heap_close(rel, AccessExclusiveLock);
221223
}
222224

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy