Bug 849074 - Got "database does not exist" error when restoring a scalable application with postgresql embedded
Got "database does not exist" error when restoring a scalable application wit...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Rob Millner
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-17 04:55 EDT by Jianwei Hou
Modified: 2015-05-14 18:58 EDT (History)
1 user (show)

See Also:
Fixed In Version: libra_ami #2039
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-17 17:29:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
snapshot output (1.93 KB, text/x-log)
2012-08-17 04:55 EDT, Jianwei Hou
no flags Details

  None (edit)
Description Jianwei Hou 2012-08-17 04:55:01 EDT
Created attachment 605128 [details]
snapshot output

Description of problem:
Try to snapshot a scalable app having postgresql embedded, there were messages showing " Could not dump PostgreSQL databases" 

Version-Release number of selected component (if applicable):
on devenv_2009, int
cli: rhc-0.97.11

How reproducible:
Always

Steps to Reproduce:
1.Create a scalable application and embed postgresql
  rhc app create -a ps1 -t php-5.3 -s
  rhc app cartridge add -a ps1 -c postgresql-8.4
2.ssh into app and create some data in postgresql database
3.take snapshot for the app
  rhc app snapshot save ./ps1.tar.gz -a ps1
  
Actual results:
in the output, there are messages like :
pg_dumpall: could not connect to database "template1": could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

  0.0%

WARNING!  Could not dump PostgreSQL databases!  Continuing anyway


Expected results:
Snapshot should be successful.

Additional info:
Delete some data from postgresql db, and restore from previous snapshot, data is   not back.
for full infomation, please see attachment.
Comment 1 Rob Millner 2012-08-17 19:44:46 EDT
Pull request: https://github.com/openshift/crankcase/pull/402

Fixed both backup and restore to properly get the UUID from the db gear.
Comment 2 Rob Millner 2012-08-18 13:17:19 EDT
Pull request merged.
Comment 3 Jianwei Hou 2012-08-20 02:28:34 EDT
Verified on devenv_2029

The snapshot problem is gone, but when trying to restore, there were still errors:

Steps to reproduce:
1.Create scabable app with postgresql embedded.
2.ssh into app, connect to postgresql and make some change.
3.Take snapshot for this app
4.ssh into app again and delete some data
5.Restore app from snapshot
6.ssh into app and check deleted data is back

Result:
in step 5, when trying to restore:
WARNING: This ssh terminal was started without a tty.
          It is highly recommended to login with: ssh -t
PostgreSQL server instance already running
ERROR:  role "fcc0d8a304df4e42a516bf2ce5dfdc34" does not exist
\connect: FATAL:  database "perl1s" does not exist

in step 6, try to connect to database:
[perl1s-jhou.dev.rhcloud.com ~]\> set -x
[perl1s-jhou.dev.rhcloud.com ~]\> psql
+ psql
+ PGDATABASE=perl1s
+ PGHOST=a70c81cc9b-jhou.dev.rhcloud.com
+ PGPORT=35696
+ PGUSER=admin
+ PGPASSWORD=Ceux16jwWtLa
+ /usr/bin/psql --set 'HISTFILE=~/app-root/data/.psql_history'
psql: FATAL:  database "perl1s" does not exist
Comment 4 Rob Millner 2012-08-20 15:57:25 EDT
Pull request:
https://github.com/openshift/crankcase/pull/410
Comment 5 Rob Millner 2012-08-20 21:29:40 EDT
Pull request merged.
Comment 6 Jianwei Hou 2012-08-21 05:54:12 EDT
Verified on devenv_2402

Steps:
1.Create scabable app with postgresql embedded.
2.ssh into app, connect to postgresql and make some change.
3.Take snapshot for this app
4.ssh into app again and delete some data
5.Restore app from snapshot
6.ssh into app and check deleted data is back

Result:
Restore was successful, ssh into app and connect to postgresql, the deleted data is back
Comment 7 Jianwei Hou 2012-08-21 05:55:23 EDT
(In reply to comment #6)
> Verified on devenv_2402
> 
> Steps:
> 1.Create scabable app with postgresql embedded.
> 2.ssh into app, connect to postgresql and make some change.
> 3.Take snapshot for this app
> 4.ssh into app again and delete some data
> 5.Restore app from snapshot
> 6.ssh into app and check deleted data is back
> 
> Result:
> Restore was successful, ssh into app and connect to postgresql, the deleted
> data is back

A typo, verified on devenv_2042

Note You need to log in before you can comment on or make changes to this bug.