| From: | Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
| Subject: | Probably misleading comments or lack of tests in autoHeld portals management |
| Date: | 2019-02-26 13:17:11 |
| Message-ID: | 2cd5d2e3-272d-2951-8f74-716ae1a0b607@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
I am trying to figure out current cursors/portals management and life
cycle in Postgres. There are two if conditions for autoHeld portals:
- 'if (portal->autoHeld)' inside AtAbort_Portals at portalmem.c:802;
- '|| portal->autoHeld' inside AtCleanup_Portals at portalmem.c:871.
Their removal does not seem to affect anything, make check-world is
passed. I have tried configure --with-perl/--with-python, which should
be a case for autoHeld portals, but nothing changed.
For me it seems to be expectable, since autoHeld flag is always set
along with createSubid=InvalidSubTransactionId inside HoldPinnedPortals,
so the only one check 'createSubid == InvalidSubTransactionId' should be
enough. However, comment sections are rather misleading:
(1) portal.h:126 confirms my guess 'If the portal is held over from a
previous transaction, both subxids are InvalidSubTransactionId';
(2) while portalmem.c:797 states 'This is similar to the case of a
cursor from a previous transaction, but it could also be that the cursor
was auto-held in this transaction, so it wants to live on'.
I have tried, but could not build an example of valid query for the case
described in (2), and it is definitely absent in regression tests.
Am I missing something?
Added Peter to cc, since he is a commiter of 056a5a3, where autoHeld has
been introduced. Maybe it will be easier for him to recall the context.
Anyway, sorry for disturb if this question is actually trivial.
Regards
--
Alexey Kondratov
Postgres Professional https://www.postgrespro.com
Russian Postgres Company
| Attachment | Content-Type | Size |
|---|---|---|
| portalmem.c-if-autoHeld-checks.diff | text/x-patch | 874 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dagfinn Ilmari Mannsåker | 2019-02-26 14:02:39 | Re: pgbench MAX_ARGS |
| Previous Message | Simon Riggs | 2019-02-26 13:15:55 | Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits |