Benoit Chesneau created COUCHDB-2051:
----------------------------------------
Summary: couch_db:reopen_db/1 should return a not_found error when
the db has been deleted
Key: COUCHDB-2051
URL: https://issues.apache.org/jira/browse/COUCHDB-2051
Project: CouchDB
Issue Type: Improvement
Security Level: public (Regular issues)
Components: Database Core
Reporter: Benoit Chesneau
When you try to reopen a deleted db with {{couch_db:reopen/1}}, you get an exit
exception instead of a not_found error:
{{
([email protected])1> {ok, Db} = couch_db:open(<<"testdb">>, []).
{ok,{db,<0.215.0>,<0.216.0>,nil,<<"1391677910640185">>,
<0.217.0>,<0.213.0>,<0.219.0>,
{db_header,6,0,0,nil,nil,nil,0,nil,nil,1000},
0,
{btree,<0.213.0>,nil,#Fun<couch_db_updater.10.75275056>,
#Fun<couch_db_updater.11.75275056>,
#Fun<couch_btree.5.15886126>,
#Fun<couch_db_updater.12.75275056>,snappy},
{btree,<0.213.0>,nil,#Fun<couch_db_updater.13.75275056>,
#Fun<couch_db_updater.14.75275056>,
#Fun<couch_btree.5.15886126>,
#Fun<couch_db_updater.15.75275056>,snappy},
{btree,<0.213.0>,nil,#Fun<couch_btree.3.15886126>,
#Fun<couch_btree.4.15886126>,#Fun<couch_btree.5.15886126>,
nil,snappy},
0,<<"testdb">>,"./data/testdb.couch",[],[],nil,
{user_ctx,null,[],undefined},
nil,1000,
[before_header,after_header,on_file_open],
[create,{user_ctx,...}],
snappy,nil,nil}}
([email protected])2> [info] [<0.140.0>] 127.0.0.1 - - GET
/_utils/dialog/_delete_database.html 200
[info] [<0.140.0>] 127.0.0.1 - - DELETE /testdb/ 200
[info] [<0.140.0>] 127.0.0.1 - - GET /_utils/index.html 200
[info] [<0.140.0>] 127.0.0.1 - - GET /_utils/_sidebar.html 200
[info] [<0.140.0>] 127.0.0.1 - - GET /_all_dbs 200
[info] [<0.140.0>] 127.0.0.1 - - GET /_session 200
[info] [<0.138.0>] 127.0.0.1 - - GET / 200
[info] [<0.138.0>] 127.0.0.1 - - GET /_replicator/ 200
[info] [<0.140.0>] 127.0.0.1 - - GET /_users/ 200
([email protected])2> {ok, Db1} = couch_db:reopen(Db).
** exception exit: {noproc,{gen_server,call,[<0.215.0>,get_db,infinity]}}
in function gen_server:call/3 (gen_server.erl, line 188)
in call from couch_db:reopen/1 (src/couch_db.erl, line 94)
}}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)