Skip to content
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

Fixed hangup of execution of queries like "COPY TO STDIN" in asynchronous mode. #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

true-alex
Copy link

The problem is in the wrong sequence of calls when processing the result of calling the COPY command in asynchronous mode.
#98

The problem is that the pg_db_result method tries to get the result of the query before it completes. The result of the COPY command will be only after the end of reading / writing the data stream.

Perhaps the problem can be solved differently, I did not want to change the source code much.

@turnstep
Copy link
Contributor

Do you have a working test script that demonstrates this? While digging in, I found some other issues with regards to async COPY so I want to make sure I fix it all at once.

@true-alex
Copy link
Author

A lot of time has passed, the server is already down.
According to the results of experiments, I refused to use asynchronous COPY due to the fact that it did not speed up, but only saved memory (I had enough memory).
Only test cases remained, which are also tied to task #98.
https://github.com/bucardo/dbdpg/files/9491191/test.tgz

@turnstep
Copy link
Contributor

Thank you. I think we are simply going to disallow calling pg_result after an asynchronous COPY, as it's not the same as the non-COPY cases where we can simply wait for the server to finish.

@true-alex
Copy link
Author

In the current version of the module, if pg_result is not called after a successful pg_ready, an error will occur, since pg_result sets the status of waiting for data from COPY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants