Re: Add PQsendSyncMessage() to libpq
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Anton Kirilov <antonvkirilov@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-05-04T10:36:42Z
Lists: pgsql-hackers
On 2023-May-04, Anton Kirilov wrote: > Thank you all for the feedback! Do you have any thoughts on the other > issue with PQpipelineSync() I have mentioned in my previous message? Eh, I hadn't seen that one. > Am I just misunderstanding what the code comment means and how the API > is supposed to be used by any chance? I think you have it right: it is possible that the buffer has not been fully flushed by the time PQpipelineSync returns. If you want to make sure it's fully flushed, your only option is to have the call block. That would make it no longer non-blocking, so it has to be explicitly requested behavior. I think this means to add yet another behavior flag for the new function: have it block, waiting for the buffer to be flushed. So your application can put several sync points in the queue, with no flushing (and of course no blocking), and have it flush+block only on the "last" one. Of course, for other users, you want the current behavior: have it flush opportunistically but not block. So you can't make it a single flag. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Commits
-
Remove some comments related to pqPipelineSync() and PQsendPipelineSync()
- 061cc7eacac1 17.0 landed
-
libpq: Add PQsendPipelineSync()
- 4794c2d31714 17.0 landed
-
Fix stop condition for dumping GRANT commands
- 7b7fa8513033 16.0 cited