couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [3/3] couch commit: updated refs/heads/master to c2ef372
Date Thu, 25 Jun 2015 11:45:16 GMT
Fix `active_size` format conversion in `get_db_info` function

In `active_size` conversion in `couch_db:get_db_info/1` old db reduction's size format assumed
to be an integer representing active state, when it also could be a tuple of active and external
sizes.

This handeled correctly, for example, in [couch_db_updater.erl](https://github.com/apache/couchdb-couch/blob/master/src/couch_db_updater.erl#L426).

This patch addresses conversion of both possible formats to CouchDB `size_info` record.

This closes issue COUCHDB-2701


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/6dcbf935
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/6dcbf935
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/6dcbf935

Branch: refs/heads/master
Commit: 6dcbf935390485bc7f141e029451714b1652006d
Parents: 2c19dcd
Author: Eric Avdey <eiri@eiri.ca>
Authored: Tue May 26 09:59:24 2015 -0300
Committer: Eric Avdey <eiri@eiri.ca>
Committed: Wed Jun 24 13:02:49 2015 -0300

----------------------------------------------------------------------
 src/couch_db.erl | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/6dcbf935/src/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_db.erl b/src/couch_db.erl
index bbfbe0d..6b2dcc4 100644
--- a/src/couch_db.erl
+++ b/src/couch_db.erl
@@ -333,8 +333,13 @@ get_db_info(Db) ->
     {ok, FileSize} = couch_file:bytes(Fd),
     {ok, DbReduction} = couch_btree:full_reduce(IdBtree),
     SizeInfo0 = element(3, DbReduction),
-    SizeInfo = if is_record(SizeInfo0, size_info) -> SizeInfo0; true ->
-        #size_info{active=SizeInfo0}
+    SizeInfo = case SizeInfo0 of
+        SI when is_record(SI, size_info) ->
+            SI;
+        {AS, ES} ->
+            #size_info{active=AS, external=ES};
+        SI ->
+            #size_info{active=SI}
     end,
     ActiveSize = active_size(Db, SizeInfo),
     DiskVersion = couch_db_header:disk_version(Header),


Mime
View raw message