Bug 964116

Summary: Failed to snapshot the app with postgresql-8.4 after migration
Product: OpenShift Online Reporter: Wei Sun <wsun>
Component: ContainersAssignee: Fotios Lindiakos <fotios>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: jkeck
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-11 04:05:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wei Sun 2013-05-17 09:26:02 UTC
Description of problem:
After migration,try to snapshot the app with postgresql-8.4,it failed with some error:
ERROR:  database "r8psql" already exists
ERROR:  role "admin" cannot be dropped because some objects depend on it

Version-Release number of selected component (if applicable):
Upgraded from devenv-stage_353 to devenv_3235

How reproducible:
Always

Steps to Reproduce:
1. Launch devenv-stage_353
2. Create a ruby-1.8 app with postgresql-8.4
3. Add V1 marker to node
#touch /var/lib/openshift/.settings/v1_cartridge_format
4. scp -r ~/devenv-local and /etc/yum.repos.d/* from devenv_3235 instance to same location on devenv-stage_353 instance
5. yum update -y --enablerepo devenv-local
6. Run oo-admin-clear-pending-ops
7. Remove the v1 marker from the node
#rm -f /var/lib/openshift/.settings/v1_cartridge_format
8. Clear the broker cache
#rake tmp:clear
9. Restart the rhc-broker and mcollective
10. Run migrate-mongo-2.0.28 
11. Run rhc-admin-migrate --version 2.0.28
12. Add some data to postgresql
13. Snapshot save the app
14. Modify the data in postgresql
15. Snapshot restore the app
  
Actual results:
[sunwei@dhcp-8-229 dev]$ rhc snapshot restore r8psql
Restoring from snapshot r8psql.tar.gz...
pg_ctl: server does not shut down
Removing old git repo: ~/git/r8psql.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/340353959762857042116608.git and ~/app-root/data
ERROR:  database "r8psql" already exists
ERROR:  role "admin" cannot be dropped because some objects depend on it
DETAIL:  owner of database r8psql
owner of database template1
owner of database template0
owner of database postgres
1 object in database r8psql
/var/lib/openshift/340353959762857042116608/postgresql/bin/control: line 90: /var/lib/openshift/340353959762857042116608/app-root/data//postgresql_db_username: No such file or directory
/var/lib/openshift/340353959762857042116608/postgresql/bin/control: line 93: /var/lib/openshift/340353959762857042116608/app-root/data//postgresql_db_dbname: No such file or directory
Postgres restore attempted, but no dump found
/var/lib/openshift/340353959762857042116608/app-root/data//postgresql_dump_snapshot.gz does not exist

RESULT:
Success


Expected results:
Can restore successfully

Additional info:

Comment 1 Fotios Lindiakos 2013-05-21 00:32:17 UTC
Currently undergoing testing in a PR. Will merge when complete.
https://github.com/openshift/origin-server/pull/2562

Comment 2 Fotios Lindiakos 2013-05-21 04:30:54 UTC
This is currently merging. Moving to ON_QA so that it can be tested when the merge completes.

Comment 3 openshift-github-bot 2013-05-21 04:50:06 UTC
Commits pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/4c638a72568b06ed3bb7301742c61e58e053c76f
Test for Bug964116

https://github.com/openshift/li/commit/dafb1341e67ee6430f0383d984fe150ea30f1690
Merge pull request #1427 from fotioslindiakos/Bug964116

Merged by openshift-bot

Comment 4 openshift-github-bot 2013-05-21 04:50:09 UTC
Commits pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/3f839a864fc21f1fa5a484e6f55905e5b37c4b4a
Bug 964116: Postgres failed to restore snapshot

https://bugzilla.redhat.com/show_bug.cgi?id=964116

The `post_restore` function was attempting to delete the old user, even
if it was the same as the new user. This has been fixed.

https://github.com/openshift/origin-server/commit/d8a3b762eda7ad0ace02e938be7ccb62a133b8e5
Merge pull request #2562 from fotioslindiakos/Bug964116

Merged by openshift-bot

Comment 5 Wei Sun 2013-05-21 10:00:58 UTC
Upgraded from devenv-stage_353 to devenv_3253,the error "database "phppsql" already exists" still exists,but data can be restored successfully.Verified it.

Result:
[sunwei@dhcp-8-229 dev]$ snapshot restore phppsql
+ rhc snapshot restore phppsql -p redhat
Restoring from snapshot phppsql.tar.gz...
[Tue May 21 05:43:48 2013] [warn] module php5_module is already loaded, skipping
Removing old git repo: ~/git/phppsql.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/32106fb4c1f311e282aa22000a989ca0.git and ~/app-root/data
ERROR:  database "phppsql" already exists
[Tue May 21 05:44:27 2013] [warn] module php5_module is already loaded, skipping

RESULT:
Success