[Trunk/6.1] restore database gives a error: OperationalError: FATAL: database does not exist

Bug #944073 reported by risto3
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Low
OpenERP's Framework R&D

Bug Description

saved and tried to restore a database .. ( PostgreSQL 9.1.2 )
save seems ok but restore is broke.

here is the server output:
2012-03-01 15:17:09,909 4345 INFO ? openerp: OpenERP version 6.1
2012-03-01 15:17:09,909 4345 INFO ? openerp: addons paths: /home/richard/src/openerp/addons/6.1,/home/richard/src/openerp/web/6.1/addons
2012-03-01 15:17:09,909 4345 INFO ? openerp: database hostname: localhost
2012-03-01 15:17:09,909 4345 INFO ? openerp: database port: 5432
2012-03-01 15:17:09,910 4345 INFO ? openerp: database user: richard
2012-03-01 15:17:09,910 4345 INFO ? openerp.service.netrpc_server: starting NET-RPC service on 0.0.0.0:8070
2012-03-01 15:17:09,911 4345 INFO ? openerp.netsvc: Starting 1 services
2012-03-01 15:17:09,943 4345 INFO ? openerp.wsgi.core: HTTP service (werkzeug) running on 0.0.0.0:8069
2012-03-01 15:17:10,258 4345 INFO ? openerp.addons.web: embedded mode
2012-03-01 15:17:10,982 4345 INFO ? openerp: OpenERP server is running, waiting for connections...
2012-03-01 15:17:25,398 4345 INFO ? werkzeug: 127.0.0.1 - - [01/Mar/2012 15:17:25] "GET /web/static/src/img/throbber2.gif HTTP/1.1" 304 -
2012-03-01 15:17:25,809 4345 WARNING nouveau openerp.sql_db: __nonzero__() is deprecated. (It is too expensive to test a connection.)
2012-03-01 15:17:25,816 4345 ERROR nouveau openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
  File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 421, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.6/site-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: FATAL: database "nouveau" does not exist

pg_restore: [archiver] WARNING: invalid creation date in header
pg_restore: [archiver] entry ID -1297435727 out of range -- perhaps a corrupt TOC
2012-03-01 15:17:26,489 4345 ERROR template1 openerp.netsvc: 32
Pipe cassé
2012-03-01 15:17:26,526 4345 INFO template1 werkzeug: 127.0.0.1 - - [01/Mar/2012 15:17:26] "POST /web/database/restore HTTP/1.1" 500 -
2012-03-01 15:17:26,532 4345 ERROR template1 werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 159, in run_wsgi
    execute(app)
  File "/usr/lib/python2.6/site-packages/Werkzeug-0.7-py2.6.egg/werkzeug/serving.py", line 146, in execute
    application_iter = app(environ, start_response)
  File "/home/richard/src/openerp/server/6.1/openerp/wsgi/core.py", line 397, in application
    result = handler(environ, start_response)
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 467, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/lib/python2.6/site-packages/Werkzeug-0.7-py2.6.egg/werkzeug/wsgi.py", line 409, in __call__
    return self.app(environ, start_response)
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 503, in dispatch
    response.set_cookie(self.session_cookie, session.sid)
  File "/usr/lib/python2.6/contextlib.py", line 34, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 353, in session_context
    yield request.session
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 494, in dispatch
    result = handler( request, self.config)
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 327, in http_handler
    return HttpRequest(request, config).dispatch(controller, f)
  File "/home/richard/src/openerp/web/6.1/addons/web/common/http.py", line 287, in dispatch
    _logger.debug("<-- size: %s", len(r))
TypeError: object of type 'NoneType' has no len()

Revision history for this message
risto3 (risto3) wrote :

above is with the web client, here is the output from the gtk client (deleting the partially created db first)

2012-03-01 15:24:00,576 4345 INFO ? openerp.sql_db: ConnectionPool(used=0/count=0/max=64): Close all connections to 'user=richard dbname=nouveau'
2012-03-01 15:24:00,701 4345 INFO template1 openerp.service.web_services: DROP DB: nouveau
2012-03-01 15:24:14,785 4345 WARNING nouveau openerp.sql_db: __nonzero__() is deprecated. (It is too expensive to test a connection.)
2012-03-01 15:24:14,793 4345 ERROR nouveau openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
  File "/home/richard/src/openerp/server/6.1/openerp/sql_db.py", line 421, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.6/site-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: FATAL: database "nouveau" does not exist

pg_restore: [archiver] WARNING: invalid creation date in header
pg_restore: [archiver] entry ID -1297435727 out of range -- perhaps a corrupt TOC
2012-03-01 15:24:15,345 4345 ERROR template1 openerp.netsvc: 32
Pipe cassé

Revision history for this message
risto3 (risto3) wrote :

btw, I try pg_dump and pg_restore manually and things seem to work just fine.
command used:

pg_dump -v -f oerpV61.dump.tar -F t oerpV61

(I create nouveau)

pg_restore -ve --dbname=nouveau oerpV61.dump.tar

Revision history for this message
Stefan Manteuffel (b5c-linux-177) wrote :

Here is the Problem that Firefox store it some times in bin and some times in dump format.

The dump file works well.

Stefan

Revision history for this message
risto3 (risto3) wrote :

?? I _know_ the dump file is okay, albeit not compressed.
The bug is: "save seems ok but restore is broke."
                                                ^^^^^^^^^^!

Amit Parik (amit-parik)
Changed in openobject-server:
status: New → Triaged
Revision history for this message
Houssine (houssine-bakkali) wrote :

any news about this issue as I got the same problem on openerp 6_1_1 under ubuntu 10_04 LTS

dump correctly made and tried to restore it in a windows environment.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Folks,

I have checked your issue with ubuntu 12.04 with PostgreSQL 9.1.3 (Firefox) and it's working good at my end.

So would you please check it again and If you still faced the problem then provide a more information on this.

Thanks and waiting for your reply!

Changed in openobject-server:
status: Triaged → Incomplete
Revision history for this message
risto3 (risto3) wrote :

Hi, just tried again using postgreSQL 9.1.2 with the final source kit openerp-6.1-1
tried both web and gtk

backup works fine, but restore gives:
2012-05-24 15:24:43,806 3812 INFO ? openerp.service.web_services: DUMP DB successful: sasBAOU
2012-05-24 15:24:44,080 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:24:44] "POST /web/database/backup HTTP/1.1" 200 -
2012-05-24 15:26:14,840 3812 WARNING test2 openerp.sql_db: __nonzero__() is deprecated. (It is too expensive to test a connection.)
2012-05-24 15:26:14,852 3812 ERROR test2 openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/openerp-6.1_1-py2.6.egg/openerp/sql_db.py", line 421, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.6/site-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: FATAL: database "test2" does not exist

2012-05-24 15:26:15,735 3812 INFO template1 openerp.service.web_services: RESTORE DB: test2
2012-05-24 15:26:15,740 3812 INFO template1 werkzeug: 192.168.0.8 - - [24/May/2012 15:26:15] "POST /web/database/restore HTTP/1.1" 200 -
2012-05-24 15:26:23,952 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:23] "GET /web/webclient/home HTTP/1.1" 200 -
2012-05-24 15:26:24,070 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "GET /web/webclient/css HTTP/1.1" 304 -
2012-05-24 15:26:24,075 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "GET /web/webclient/js HTTP/1.1" 304 -
2012-05-24 15:26:24,534 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/session/get_session_info HTTP/1.1" 200 -
2012-05-24 15:26:24,583 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/webclient/qweblist HTTP/1.1" 200 -
2012-05-24 15:26:24,748 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/proxy/load HTTP/1.1" 200 -
2012-05-24 15:26:24,907 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/session/get_lang_list HTTP/1.1" 200 -
2012-05-24 15:26:24,928 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "GET /web/static/src/img/pattern.png HTTP/1.1" 304 -
2012-05-24 15:26:24,929 3812 INFO ? werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "GET /web/static/src/img/logo2.png HTTP/1.1" 304 -
2012-05-24 15:26:24,936 3812 INFO template1 werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/database/get_list HTTP/1.1" 200 -
2012-05-24 15:26:24,946 3812 INFO template1 werkzeug: 192.168.0.8 - - [24/May/2012 15:26:24] "POST /web/database/get_list HTTP/1.1" 200 -
2012-05-24 15:26:30,754 3812 INFO test2 openerp.modules.loading: init db

and when opening the restored db, it's like a newly created one that needs everying to be installed/configured again.

If I do a createdb and restoredb from the command line things work dandy.

I think the problem is clear now, openerp restore is having problems with creation of the new db during the restore, the creation seems to happen afterwards (during a failed restore).

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

Thanks for your quick response on this.

Yes, you are right, I have also faced this error at restore time like.
OperationalError: FATAL: database "test2" does not exist

Also this error doesn't related to Postgres Sql version, It's produce at all version. That's why I am confirming this issue for your comment#7.

Note : This type of error was reported ago, But it's occurs from different way, please see lp:917030

Thank you!

summary: - v61 restore database broke
+ [Trunk/6.1] restore database gives a error: OperationalError: FATAL:
+ database does not exist
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.