v2-0001-Fix-local-buffer-buf_state-wrong-set.patch

application/octet-stream

Filename: v2-0001-Fix-local-buffer-buf_state-wrong-set.patch
Type: application/octet-stream
Part: 0
Message: Re: BUG #18259: Assertion in ExtendBufferedRelLocal() fails after no-space-left condition

Patch

Format: format-patch
Series: patch v2-0001
Subject: Fix local buffer buf_state wrong set.
File+
src/backend/storage/buffer/localbuf.c 1 1
From 47b0b5a4599e5a15c73652535990d86db933f593 Mon Sep 17 00:00:00 2001
From: "tender.wang" <tender.wang@openpie.com>
Date: Wed, 27 Dec 2023 16:54:09 +0800
Subject: [PATCH v2] Fix local buffer buf_state wrong set.

---
 src/backend/storage/buffer/localbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index d1cdd3eeb4..33fe0a2218 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -392,7 +392,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
 			buf_state = pg_atomic_read_u32(&existing_hdr->state);
 			Assert(buf_state & BM_TAG_VALID);
 			Assert(!(buf_state & BM_DIRTY));
-			buf_state &= BM_VALID;
+			buf_state &= ~BM_VALID;
 			pg_atomic_unlocked_write_u32(&existing_hdr->state, buf_state);
 		}
 		else
-- 
2.25.1