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

Interop binaries: wait for database to be up #2006

Merged
merged 3 commits into from
Sep 27, 2023
Merged

Conversation

divergentdave
Copy link
Collaborator

This waits for the Postgres database to come up before starting janus_interop_aggregator etc. This is for #1977. I tried this out locally, and saw the following on stdout from the setup job. (the first two lines are from pg_isready)

/var/run/postgresql:5432 - no response
/var/run/postgresql:5432 - accepting connections
janus_interop_aggregator: started
aggregation_job_creator: started
aggregation_job_driver: started
collection_job_driver: started

@divergentdave divergentdave requested a review from a team as a code owner September 26, 2023 17:02
@tgeoghegan
Copy link
Contributor

Nice find, David. @c02-student, since none of us have been able to reproduce this, do you think you could check whether this patch fixes your issue?

@@ -1,4 +1,5 @@
#!/bin/bash
until pg_isready -U postgres; do sleep 1; done
Copy link
Contributor

Choose a reason for hiding this comment

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

This will wait for postgres forever, right? I think we should give up after some delay so that e.g. postgres crashing on startup due to misconfiguration doesn't cause a test to hang forever.

@@ -1,4 +1,5 @@
#!/bin/bash
timeout 5m bash -c 'until pg_isready -U postgres; do sleep 1; done'
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider running this script with set -e or perhaps better adding || "timeout waiting for postgres to be ready" && exit 1. Otherwise the script will fall through on failure.

This is a nit since we'll be able to see the results in the logs anyways, can take it or leave it.

Choose a reason for hiding this comment

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

I was able to resolve the issue with this change !
I have tested it in my local environment for both release/0.5 and 0.6.0-prerelease-1, and both passed successfully.

Thank you .

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.

4 participants