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

Commit9cd0d77

Browse files
committed
Fix corruption of local buffer state during extend of temp relation
A typo has been introduced by31966b1 when updating the state of alocal buffer when a temporary relation is extended, for the case of ablock included in the relation range extended, when it is already foundin the hash table holding the local buffers. In this case, BM_VALIDshould be cleared, but the buffer state was changed so as BM_VALIDremained while clearing the other flags.As reported on the thread, it was possible to corrupt the state of thelocal buffers on ENOSPC, but the states would be corrupted on any kindof ERROR during the relation extend (like partial writes or some othererrno).Reported-by: Alexander LakhinAuthor: Tender WangReviewed-by: Richard Guo, Alexander Lakhin, Michael PaquierDiscussion:https://postgr.es/m/18259-6e256429825dd435@postgresql.orgBackpatch-through: 16
1 parent9391f71 commit9cd0d77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/storage/buffer/localbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
380380
hash_search(LocalBufHash, (void*)&tag,HASH_ENTER,&found);
381381
if (found)
382382
{
383-
BufferDesc*existing_hdr=GetLocalBufferDescriptor(hresult->id);
383+
BufferDesc*existing_hdr;
384384
uint32buf_state;
385385

386386
UnpinLocalBuffer(BufferDescriptorGetBuffer(victim_buf_hdr));
@@ -392,7 +392,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
392392
buf_state=pg_atomic_read_u32(&existing_hdr->state);
393393
Assert(buf_state&BM_TAG_VALID);
394394
Assert(!(buf_state&BM_DIRTY));
395-
buf_state &=BM_VALID;
395+
buf_state &=~BM_VALID;
396396
pg_atomic_unlocked_write_u32(&existing_hdr->state,buf_state);
397397
}
398398
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp