Skip to content

Conversation

kbarber
Copy link
Contributor

@kbarber kbarber commented Oct 23, 2013

This patch is a fix for the race condition that keeps occuring during
postgresql setup. Its very rare on its own, but when you are using this
module in a CI environment it happens quite frequently.

Basically what happens is that sometimes the service will announce the
database has started, but really it is still working in the background.
Sometimes the unix socket may not be listening, and sometimes the
system is still loading and you get a weird client error.

The fix itself is a modification to postgresql::validate_db_connection
so that it is able to connect on the local unix socket, plus retry
until the database is available.

This new and improved validate_db_connection can then be put into the
build pipeline (in the service class in particular) to ensure the
database is started before continuing on with the remaining steps.

This in effect blocks the puppet module from continuing until the
postgresql database is fully started and able to receive connections
which is perfect.

Tests and documentation provided.

ALSO:

Remove concat::setup for include

Since the class is now throwing an error when you use the class directly, I'm just removing it.

We left this in from the last rewrite as someone reported an issue a long time ago, but alas we have been unable to prove its a problem.

fi
done

echo 'Unable to connect to puppetdb'
Copy link

Choose a reason for hiding this comment

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

beep bloop puppetdb

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/367/

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/368/

@kbarber
Copy link
Contributor Author

kbarber commented Oct 23, 2013

retest this please

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/369/

@kbarber
Copy link
Contributor Author

kbarber commented Oct 23, 2013

retest this please

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/371/

This patch is a fix for the race condition that keeps occuring during
postgresql setup. Its very rare on its own, but when you are using this
module in a CI environment it happens quite frequently.

Basically what happens is that sometimes the service will announce the
database has started, but really it is still working in the background.
Sometimes the unix socket may not be listening, and sometimes the
system is still loading and you get a weird client error.

The fix itself is a modification to postgresql::validate_db_connection
so that it is able to connect on the local unix socket, plus retry
until the database is available.

This new and improved validate_db_connection can then be put into the
build pipeline (in the service class in particular) to ensure the
database is started before continuing on with the remaining steps.

This in effect blocks the puppet module from continuing until the
postgresql database is fully started and able to receive connections
which is perfect.

Tests and documentation provided.

Signed-off-by: Ken Barber <ken@bob.sh>
Since the class is now throwing an error when you use the class directly,
I'm just removing it.

We left this in from the last rewrite as someone reported an issue a long
time ago, but alas we have been unable to prove its a problem.

Signed-off-by: Ken Barber <ken@bob.sh>
Signed-off-by: Ken Barber <ken@bob.sh>
Signed-off-by: Ken Barber <ken@bob.sh>
@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/372/

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/373/

@kbarber
Copy link
Contributor Author

kbarber commented Oct 23, 2013

retest this please

@kbarber-jenkins2
Copy link

Test FAILed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/375/

Signed-off-by: Ken Barber <ken@bob.sh>
@kbarber-jenkins2
Copy link

Test PASSed.
Refer to this link for build results: http://box.bob.sh:8080/job/puppetlabs-postgresql/377/

apenney pushed a commit that referenced this pull request Oct 25, 2013
…ion_on_startup

(GH-198) Fix race condition on startup
@apenney apenney merged commit 74ff957 into puppetlabs:master Oct 25, 2013
cegeka-jenkins pushed a commit to cegeka/puppet-postgresql that referenced this pull request Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants