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

Include states in run-postgresql #160

Closed
wants to merge 2 commits into from
Closed

Include states in run-postgresql #160

wants to merge 2 commits into from

Conversation

matthyx
Copy link

@matthyx matthyx commented Jan 13, 2017

We've noticed, with persistent storage, that if the script is interrupted between lines 16 and 20 users never get created even on following container restarts because "$PGDATA/postgresql.conf" gets created before create_users is run.
I have added states for each critical step in the startup in the folder "$PGDATA/status".
As a side question, is there a particular reason to call set_passwords every time? (this is why I have also added the if status for it)

We've noticed, with persistent storage, that if the script is interrupted between lines 16 and 20 users never get created even on following container restarts because "$PGDATA/postgresql.conf" gets created before create_users is run.
I have added states for each critical step in the startup in the folder "$PGDATA/status".
As a side question, is there a particular reason to call set_passwords every time? (this is why I have also added the if status for it)
@openshift-bot
Copy link
Collaborator

Can one of the admins verify this patch?

2 similar comments
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@rhscl-bot
Copy link

Can one of the admins verify this patch?

@praiskup
Copy link
Member

praiskup commented Jan 18, 2017 via email

This will delete all database files in case the script has been interrupted before touching 1.initialize_database_done
It should not harm as initialize_database expects $PGDATA to be empty
@matthyx
Copy link
Author

matthyx commented Jan 18, 2017

@praiskup thanks for your detailed answer. You have a very good point with the interruption in the middle of the database initialization.
I suggest we then clean $PGDATA completely unless we have passed the first state. Somewhat brutal, but works in that case.
What do you think?

@praiskup
Copy link
Member

praiskup commented Jan 18, 2017

:( Thanks for the update, but have a look at #82, that's something I'm totally against.
This would btw. clean perfectly valid database upon container update from older containers.
There are other typos ... but it imo doesn't matter.

@praiskup
Copy link
Member

Note the part:

And if the container was "gently" terminated before 3., we could end up running some trap shell exit hook, but even this is pretty dangerous.

I would fix that as "if and only if".

@matthyx
Copy link
Author

matthyx commented Jan 18, 2017

Ok, agreed. Normally it's up to OpenShift to clean and recycle the persistent volume.
I will try to find a higher level solution to this problem... and discard the $PGDATA deletion.

@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@matthyx
Copy link
Author

matthyx commented Feb 7, 2017

I am closing that PR... will come back once PetSets are available.

@matthyx matthyx closed this Feb 7, 2017
@matthyx matthyx deleted the patch-1 branch February 7, 2017 12:53
@bparees
Copy link
Collaborator

bparees commented Feb 7, 2017

@matthyx petsets (stateful sets) are available, the mongodb example uses them:

https://github.com/sclorg/mongodb-container/tree/master/examples/petset

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.

None yet

6 participants