Bug 797140 - Failed to restore PostgreSQL data to a new nodejs application using snapshot tarball
Summary: Failed to restore PostgreSQL data to a new nodejs application using snapshot ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: jizhao
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-24 11:25 UTC by jizhao
Modified: 2015-05-14 22:51 UTC (History)
4 users (show)

Fixed In Version: rhc-cartridge-postgresql-0.4.3-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-02 21:56:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description jizhao 2012-02-24 11:25:38 UTC
Description of problem:
Get error while using snapshot tarball of previous app to restore a new app.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Create a nodejs app and embed postgresql to it
2.Write some data to the postgresql database
<--------code snippets--------->
// Handler for GET /data1
app.get('/data1.js', function(req, res){
    var client = new pg.Client(conString);
    client.connect();
    client.query("DROP TABLE IF EXISTS info");
    client.query("CREATE TABLE info(id integer PRIMARY KEY, data text)");
    client.query("INSERT INTO info VALUES(1, '#str_random1#')");
    client.end();
<------------------------------>
3. Take snapshot of the app
4. Destroy the app
5. Create a new nodejs app and embed postgresql to it
6. Use the snapshot tarball to restore the new app.
7. Check the data of postgresql database
<-----------code snippets----------->
// Handler for GET /show
app.get('/show.js', function(req, res){
    var client = new pg.Client(conString);
    client.connect();
    var query = client.query("SELECT data FROM info");
    query.on('row', function(row) {
        result = row.data;
    });
    query.on('error', function(error) {
        client.end();
        res.send('Failed to get data from database', {'Content-Type': 'text/plain'});
    });
    query.on('end', function() {
        client.end();
        res.send(result, {'Content-Type': 'text/plain'});
    });
});
<----------------------------------->
  
Actual results:
6. Get error message during restoring
<---------output------------>
Stopping application...
Done
Removing old git repo: ~/git/app2.git/
Removing old data dir: ~/app2/data/*
Restoring ~/git/app2.git and ~/app2/data
Running extra restore: postgresql_restore.sh
ERROR:  role "0068cce8b240437aa9524304b343b9bc" does not exist
ERROR:  role "0068cce8b240437aa9524304b343b9bc" does not exist
ERROR:  role "0068cce8b240437aa9524304b343b9bc" does not exist
\connect: FATAL:  database "app2" does not exist

Error: Could not import PostgreSQL Database!  Continuing...

Running .openshift/action_hooks/pre_build
Running .openshift/action_hooks/build
PostgreSQL server instance already running
Running .openshift/action_hooks/deploy
Starting application...
PostgreSQL server instance already running
Done
Running .openshift/action_hooks/post_deploy
<--------------------------->
7. Get "Proxy Error" on the webpage.
Here's log of the app
<-----------log-------------->
Fri Feb 24 2012 06:22:34 GMT-0500 (EST): Node server started on 127.0.250.1:8080 ...

events.js:48
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: FATAL:  password authentication failed for user "admin"

    at Connection.<anonymous> (/usr/lib/node_modules/pg/lib/native/index.js:138:17)
    at Connection.emit (events.js:67:17)
<------------------------------->

Expected results:
PostgreSQL data should be restored without error.

Additional info:

Comment 1 jizhao 2012-02-24 12:21:40 UTC
Found this bug on devenv_1634.

Comment 2 Ram Ranganathan 2012-02-24 19:34:30 UTC
Fixed postgresql snapshot and restore to handle new user/app names
with git commit 78ea2686e500d1f141c990849507a59c4396a8c8

Comment 3 Meng Bo 2012-02-27 02:35:29 UTC
verify fixed on devenv_1642, with rhc-cartridge-postgresql-8.4-0.4.3-1.el6_2.noarch,
issue has been fixed.


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