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

Connection reset with server in hot standby #48

Closed
vharitonsky opened this issue Dec 9, 2016 · 1 comment
Closed

Connection reset with server in hot standby #48

vharitonsky opened this issue Dec 9, 2016 · 1 comment
Assignees
Labels

Comments

@vharitonsky
Copy link

Currently connection reset does the following:
asyncpg v0.7.0
connection.py:370

async def reset(self):
        self._listeners = {}
        await self.execute('''
            SET SESSION AUTHORIZATION DEFAULT;
            RESET ALL;
            CLOSE ALL;
            UNLISTEN *;
            SELECT pg_advisory_unlock_all();
        ''')

Which is totally incomatible with postgresql in hot standby mode:

Transactions started during hot standby will never be assigned a transaction ID and cannot write to the system write-ahead log. Therefore, the following actions will produce error messages:
...
LISTEN, UNLISTEN, NOTIFY

Maybe there is a way to explicitly listen and then unlisten only in case listen command was issued?

@elprans
Copy link
Member

elprans commented Dec 9, 2016

Yes, this is definitely an issue. The best approach, IMO, would be to add a special Connection method to determine the state of the remote side.

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

No branches or pull requests

2 participants