-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add flush request in pipeline #2200
Conversation
I think adding the ability to send a Would it be reasonable to track the expected responses from non-ReadyForQuery triggering messages and fold this behavior into |
Yes, I agree that GetResultsNotCheckSync is not a good feature for the api. Yes, it is needed to receive messages after Flush without sending Sync, since in this mode only Sync triggers ReadyForQuery. From the point of view of the protocol, there are such cases of tracking other messages:
Also, this adds another level: we only need to track messages before Flush or Sync. In this case, it is possible that the public Flush as a function should be combined with the Flush as a message, so as not to overcomplicate the internal logic. As a possible solution, two counters can be added waiting for messages in the buffer and waiting for sent messages. This variant, at least when considered, looks like a working. |
This does get tricky. What we're trying to do is is stay synced with the server without using a Sync point. But the difficulty of doing that is part of why Sync points exist. But perhaps there is an approach that isn't too complicated. The pipeline system doesn't operate at the protocol message level. It operates at a slightly higher level. For example, there is no way to only send a Perhaps just as Yuck... this is really hard. I think we would actually need to have a record of everything sent so we could match it with what we expect to receive. That's more complicated than I'd like. But the alternative seems to be something like what you did originally: a way of getting results that doesn't know if there are any results pending or not. 🤷 |
I thought about this question, as a result, I can suggest the following construction. We can add a queue, the elements of which will contain three fields: the type of message (in the sense of the user, i.e. Prepare, QueryParams, QueryPrepared, etc), a flag indicating whether message was sent to the server, a flag indicating whether there was a Flush or Sync as a message after (that is, we can expect a response from the server). Then, it seems, it will be readable and transparent in terms of processing logic. |
Yeah, I think that would work. |
Well, then I will try to realize this variant after a while. |
It turned out to be a bit more complicated than I expected, but the result seems acceptable. Some notes:
|
PIPELINE_DEALLOCATE | ||
PIPELINE_SYNC_REQUEST | ||
PIPELINE_FLUSH_REQUEST | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think they should be private. Fixed.
Thanks! |
Hello, there is a suggestion to add the ability to send a Flush message in Pipeline mode. This feature is available in Pipeline mode in the libpq library, in the PostgreSQL documentation this method is proposed for executing dependent commands, as an alternative to transaction mode for some cases. As for my need, I want to create a test scenario for such case using the library. Also, this feature may close issue #2025.