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

fix: re-new connection in PostgresChannelMessageTableSubscriber #9062

Merged

Conversation

joshiste
Copy link
Contributor

@joshiste joshiste commented Apr 1, 2024

PostgresChannelMessageTableSubscriber currently never renews the connection. This causes problems on DB failover. With this change the connection is renewed when notifications are not received for a certain time.

fixes #9061

@joshiste joshiste force-pushed the fix/postgres-listen-failover branch from 78bc2df to 3221eeb Compare April 1, 2024 14:06
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can simulate the reconnection somehow in the unit test.
See PostgresChannelMessageTableSubscriberTests.

Also note: the version 6.0.x is out of Open Source Support.
So, we accept the fix and back-port it down to 6.1.x only.

Thanks

@joshiste joshiste force-pushed the fix/postgres-listen-failover branch from 3221eeb to d0e7f7c Compare April 1, 2024 15:15
@joshiste
Copy link
Contributor Author

joshiste commented Apr 1, 2024

I wonder if we can simulate the reconnection somehow in the unit test.
See PostgresChannelMessageTableSubscriberTests.

I've added a test that verifies for reconnection after certain time without notifications

@joshiste joshiste force-pushed the fix/postgres-listen-failover branch 2 times, most recently from e6cc266 to 4b3e74c Compare April 1, 2024 16:29
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is off with a new test:

PostgresChannelMessageTableSubscriberTests > testRenewConnection() FAILED
    org.opentest4j.AssertionFailedError at PostgresChannelMessageTableSubscriberTests.java:282

@joshiste
Copy link
Contributor Author

joshiste commented Apr 1, 2024

I saw that. It does work on my machine. Is there any way to get more context (e.g. the assertion message) for this failure?
There was a previous run, which worked fine ... so I guess it's flaky...

PostgresChannelMessageTableSubscriber never renews the connection.
This causes problems on DB failover. With this change the connection is
renewed when notifications are not received for a certain time.

fixes spring-projects#9061
@joshiste joshiste force-pushed the fix/postgres-listen-failover branch from 4b3e74c to e30bebd Compare April 1, 2024 16:58
@artembilan artembilan merged commit 642278d into spring-projects:main Apr 1, 2024
3 checks passed
@artembilan
Copy link
Member

... and cherry-picked to 6.2.x & 6.1.x.

Thank you for contribution; looking forward for more!

@joshiste
Copy link
Contributor Author

joshiste commented Apr 2, 2024

What is the schedule for the next release? Is it 16th of April? https://calendar.spring.io

@artembilan
Copy link
Member

April, 16

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.

PostgresChannelMessageTableSubscriber not properly handling Database Failover
2 participants