From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Gilles Darold <gilles(at)darold(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Issue with server side statement-level rollback |
Date: | 2020-11-19 20:43:26 |
Message-ID: | 20201119204326.aotqbrnb2kblczjo@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2020-11-12 11:40:22 +0100, Gilles Darold wrote:
> The problem we are encountering is when PostgreSQL is compiled in debug
> mode with --enable-cassert. At line 1327 of src/backend/tcop/pquery.c
> the following assert fail:
>
> /*
> * Clear subsidiary contexts to recover temporary memory.
> */
> Assert(portal->portalContext == CurrentMemoryContext);
>
> MemoryContextDeleteChildren(portal->portalContext);
>
> This extension, although it is a risky implementation, works extremely
> well when used in a fully controlled environment. It avoid the latency
> of the extra communication for the RELEASE+SAVEPOINT usually controlled at
> client side. The client is only responsible to issue the "ROLLBACK TO
> autosavepoint"
> when needed. The extension allow a high performances gain for this feature
> that helps customers using Oracle or DB2 to migrate to PostgreSQL.
>
>
> Actually with the extension the memory context is not CurrentMemoryContext
> as expected by the assert.
What is it instead? I don't think you really can safely be in a
different context at this point. There's risks of CurrentMemoryContext
pointing to a deleted context, and risks of memory leaks, depending on
the situation.
> As there is no hook or API that could allow a perfect server side
> integration of this feature we have done what is possible to do in the
> extension.
> So my question is should we allow such use through an extension and in
> this case what is the change to PostgreSQL code that could avoid the
> assert crash? Or perhaps we have missed something in this extension to
> be able to make the assert happy but I don't think so.
Without more detail of what you actually are precisely doing, and what
the hooks / integration you'd like would look like, it's hard to comment
usefully here.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2020-11-19 20:49:05 | Re: Move OpenSSL random under USE_OPENSSL_RANDOM |
Previous Message | Tom Lane | 2020-11-19 20:14:08 | Re: Should we document IS [NOT] OF? |