v1-0001-Fix-an-incorrect-assertion-in-mdwritev.patch
text/x-patch
Filename: v1-0001-Fix-an-incorrect-assertion-in-mdwritev.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Fix an incorrect assertion in mdwritev().
| File | + | − |
|---|---|---|
| src/backend/storage/smgr/md.c | 1 | 1 |
From c77d1810ac6f13e9b58da5cd3ded5e47d44d03af Mon Sep 17 00:00:00 2001
From: Xing Guo <higuoxing@gmail.com>
Date: Sat, 25 May 2024 23:36:29 +0800
Subject: [PATCH v1] Fix an incorrect assertion in mdwritev().
In commit 4908c58[^1], we added smgrwritev() which is a vectored variant
of smgrwrite(). Since mdwritev() is to be used only for updating
already-existing blocks of a relation, the assertion condition shall be
updated accordingly.
[^1]: https://github.com/postgres/postgres/commit/4908c5872059c409aa647bcde758dfeffe07996e
---
src/backend/storage/smgr/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index bf0f3ca76d..2abb5133a6 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -930,7 +930,7 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
{
/* This assert is too expensive to have on normally ... */
#ifdef CHECK_WRITE_VS_EXTEND
- Assert(blocknum < mdnblocks(reln, forknum));
+ Assert(blocknum + nblocks <= mdnblocks(reln, forknum));
#endif
while (nblocks > 0)
--
2.45.1