Limit GIST_MAX_SPLIT_PAGES to XLR_MAX_BLOCK_ID
Gin code respects the XLR_MAX_BLOCK_ID when
calling XLogEnsureRecordSpace(). But it appears that the Gist code does not
try to limit its block-id consumption to XLR_MAX_BLOCK_ID.
The GIST_MAX_SPLIT_PAGES is hard-coded at 75, but XLogEnsureRecordSpace()
would reject a request of more than 32 (XLR_MAX_BLOCK_ID).
The attached patch redefines GIST_MAX_SPLIT_PAGES so that in case of a
split, gistplacetopage() now throws an error when the block-ids needed
exceed 32.
I have used Min(75, XLR_MAX_BLOCK_ID) as the macro expansion, but I believe
it can be set to plain XLR_MAX_BLOCK_ID.
--
Gurjeet Singh http://gurjeet.singh.im/
Attachments:
gist_limit_blockid_to_XLR_MAX_BLOCK_ID.patchapplication/octet-stream; name=gist_limit_blockid_to_XLR_MAX_BLOCK_ID.patchDownload
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 1a77982..3191a0d 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -37,7 +37,7 @@
* so if you raise this higher than that limit, you'll just get a different
* error.
*/
-#define GIST_MAX_SPLIT_PAGES 75
+#define GIST_MAX_SPLIT_PAGES Min(75, XLR_MAX_BLOCK_ID)
/* Buffer lock modes */
#define GIST_SHARE BUFFER_LOCK_SHARE
(adding Heikki, since that macro was touched by his commit 04e298b8)
Does my previous description of the problem make sense, or am I fretting
over something that's a non-issue.
Best regards,
On Sun, Sep 20, 2015 at 7:03 PM, Gurjeet Singh <gurjeet@singh.im> wrote:
Gin code respects the XLR_MAX_BLOCK_ID when
calling XLogEnsureRecordSpace(). But it appears that the Gist code does not
try to limit its block-id consumption to XLR_MAX_BLOCK_ID.The GIST_MAX_SPLIT_PAGES is hard-coded at 75, but XLogEnsureRecordSpace()
would reject a request of more than 32 (XLR_MAX_BLOCK_ID).The attached patch redefines GIST_MAX_SPLIT_PAGES so that in case of a
split, gistplacetopage() now throws an error when the block-ids needed
exceed 32.I have used Min(75, XLR_MAX_BLOCK_ID) as the macro expansion, but I
believe it can be set to plain XLR_MAX_BLOCK_ID.--
Gurjeet Singh http://gurjeet.singh.im/
--
Gurjeet Singh http://gurjeet.singh.im/