public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniil Davydov <[email protected]>
To: [email protected]
Subject: [BUG] temp_table_max_size parameter may entail an error within ReadBuffer function
Date: Fri, 6 Dec 2024 16:54:30 +0700
Message-ID: <CAJDiXgiFqaoqvFGLeyuda28EfFOV+yD3aTk2ST7kvzR0bASjZw@mail.gmail.com> (raw)
Hi,
I noticed that this sequence of actions (for temporary table) leads to
an error, if
temp_table_max_size parameter is set :
***
LockRelationForExtension(relation, ExclusiveLock);
buf = ReadBuffer(relation, P_NEW);
***
Error occurs during total temporary table size calculation
(find_total_temp_relation_size function,
that can be called only if temp_table_max_size parameter > 0) : we are
trying to open all table's
indexes and append their size to the total size of the temporary
table. But inside relation_open function
(called for index) we meet this assert (and, of course, fail on it):
***
/*
* We don't acquire any other heavyweight lock while holding the relation
* extension lock. We do allow to acquire the same relation extension
* lock more than once but that case won't reach here.
*/
Assert(!IsRelationExtensionLockHeld);
***
I suppose that the simplest way out of the situation would be to skip
locking temporary tables for
extension
--
Best regards,
Daniil Davydov
Attachments:
[text/x-patch] 0001-Fix-bug-with-locking-temp-relation-for-extension.patch (787B, ../CAJDiXgiFqaoqvFGLeyuda28EfFOV+yD3aTk2ST7kvzR0bASjZw@mail.gmail.com/2-0001-Fix-bug-with-locking-temp-relation-for-extension.patch)
download | inline diff:
From da84d916e568be0d2414303f4a1e1d01b0bc6abd Mon Sep 17 00:00:00 2001
From: Daniil Davidov <[email protected]>
Date: Fri, 6 Dec 2024 16:41:53 +0700
Subject: [PATCH] Fix bug with locking temp relation for extension
---
src/backend/storage/lmgr/lmgr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index 094522acb4..0a91109d03 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -421,6 +421,9 @@ LockRelationForExtension(Relation relation, LOCKMODE lockmode)
{
LOCKTAG tag;
+ if (relation->rd_islocaltemp)
+ return;
+
SET_LOCKTAG_RELATION_EXTEND(tag,
relation->rd_lockInfo.lockRelId.dbId,
relation->rd_lockInfo.lockRelId.relId);
--
2.43.0
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [BUG] temp_table_max_size parameter may entail an error within ReadBuffer function
In-Reply-To: <CAJDiXgiFqaoqvFGLeyuda28EfFOV+yD3aTk2ST7kvzR0bASjZw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox