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

Commit3f695b3

Browse files
committed
sequences: Lock buffer before initializing page
fill_seq_fork_with_data(), used to initialize a new sequence relation, onlylocked the buffer after calling PageInit(), even though PageInit() modifiespage contents.This is unlikely to cause real-world issues, as the relation is exclusivelylocked at that point, and the buffer not yet marked dirty, so other processesshould not access the buffer.This issue looks to have been present since the introduction of sequences ine8647c4.Given the low risk, it does not seem worth backpatching the fix.Discussion:https://postgr.es/m/20230404185501.wdkmo3k7bedlx6qk@awork3.anarazel.de
1 parente126d81 commit3f695b3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

‎src/backend/commands/sequence.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ fill_seq_fork_with_data(Relation rel, HeapTuple tuple, ForkNumber forkNum)
377377

378378
/* Initialize first page of relation with special magic number */
379379

380-
buf=ReadBufferExtended(rel,forkNum,P_NEW,RBM_NORMAL,NULL);
380+
buf=ReadBufferExtended(rel,forkNum,P_NEW,RBM_ZERO_AND_LOCK,NULL);
381381
Assert(BufferGetBlockNumber(buf)==0);
382382

383383
page=BufferGetPage(buf);
@@ -388,8 +388,6 @@ fill_seq_fork_with_data(Relation rel, HeapTuple tuple, ForkNumber forkNum)
388388

389389
/* Now insert sequence tuple */
390390

391-
LockBuffer(buf,BUFFER_LOCK_EXCLUSIVE);
392-
393391
/*
394392
* Since VACUUM does not process sequences, we have to force the tuple to
395393
* have xmin = FrozenTransactionId now. Otherwise it would become

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp