Probably misleading comments or lack of tests in autoHeld portalsmanagement

Поиск
Список
Период
Сортировка
От Alexey Kondratov
Тема Probably misleading comments or lack of tests in autoHeld portalsmanagement
Дата
Msg-id 2cd5d2e3-272d-2951-8f74-716ae1a0b607@postgrespro.ru
обсуждение исходный текст
Список 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


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Следующее
От: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Дата:
Сообщение: Re: pgbench MAX_ARGS