Re: Pipeline mode and PQpipelineSync()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Pipeline mode and PQpipelineSync()
Дата
Msg-id 202107081729.osyyji4ewzjk@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Pipeline mode and PQpipelineSync()  (Boris Kolpackov <boris@codesynthesis.com>)
Ответы Re: Pipeline mode and PQpipelineSync()
Re: Pipeline mode and PQpipelineSync()
Список pgsql-hackers
On 2021-Jul-08, Boris Kolpackov wrote:

> Alvaro Herrera <alvaro.herrera@2ndquadrant.com> writes:

> > That seems a fair complaint, but I think PQisBusy is doing the right
> > thing per its charter.  It is documented as "would PQgetResult block?"
> > and it is returning correctly that PQgetResult would not block in that
> > situation, because no queries are pending.
> 
> Well, that's one way to view it. But in this case one can say that
> the entire pipeline is still "busy" since we haven't seen the
> PQpipelineSync() call. So maybe we could change the charter only
> for this special situation (that is, inside the pipeline)?

To be honest, I am hesitant to changing the charter in that way; I fear
it may have consequences I don't foresee.  I think the workaround is not
*that* bad.  On the other hand, since we explicitly made PQpipelineSync
not mandatory, it would be confusing to say that PQisBusy requires
PQpipelineSync to work properly.

> But I agree, it may not be worth the trouble and a note in the
> documentation may be an acceptable "solution".

I'm having a bit of trouble documenting this.  I modified the paragraph in the
pipeline mode docs to read:

    <para>
     <function>PQisBusy</function>, <function>PQconsumeInput</function>, etc
     operate as normal when processing pipeline results.  Note that if no
     queries are pending receipt of the corresponding results,
     <function>PQisBusy</function> returns 0.
    </para>

This seems a bit silly/obvious to me, but it may be enlightening to
people writing apps to use pipeline mode.  Do you find this sufficient?
(I tried to add something to the PQisBusy description, but it sounded
sillier.)

> I am happy to go either way, just let me know what it will be. And
> also if the latest patch to libpq that you have shared[1] is still
> necessary.
> 
> [1] https://www.postgresql.org/message-id/202107061747.tlss7f2somqf%40alvherre.pgsql

Yes, this patch (or some version thereof) is still needed.  I didn't
test the modified version of your program without it, but my repro
definitely misbehaved without it.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: enable_resultcache confusion
Следующее
От: Robert Haas
Дата:
Сообщение: Re: "debug_invalidate_system_caches_always" is too long