You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2018/04/26 18:59:00 UTC
[couchdb] 04/19: Fix race on couch_db:reopen/1
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch COUCHDB-3326-clustered-purge-davisp-refactor-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 9b1c4930102d35ff727351f377ca7a915e1810d6
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Apr 26 11:39:58 2018 -0500
Fix race on couch_db:reopen/1
This fixes a minor race by opening the database before closing it. This
was never found to be an issue in production and was just caught while
contemplating the PSE test suite.
---
src/couch/src/couch_db.erl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 93ea07e..3449274 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -161,8 +161,11 @@ reopen(#db{} = Db) ->
% We could have just swapped out the storage engine
% for this database during a compaction so we just
% reimplement this as a close/open pair now.
- close(Db),
- open(Db#db.name, [{user_ctx, Db#db.user_ctx} | Db#db.options]).
+ try
+ open(Db#db.name, [{user_ctx, Db#db.user_ctx} | Db#db.options])
+ after
+ close(Db)
+ end.
% You shouldn't call this. Its part of the ref counting between
--
To stop receiving notification emails like this one, please contact
davisp@apache.org.