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 2014/01/17 23:08:37 UTC

[23/32] git commit: Store #full_doc_info{} records in the seq tree

Store #full_doc_info{} records in the seq tree

This improves the performance of compaction and replication by not
requiring a btree lookup for every row in the by_seq tree at the cost of
storing extra bytes on disk.


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

Branch: refs/heads/import
Commit: 923be422b353b34e00f5ee2241525123340bcab7
Parents: d83c669
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Mar 7 16:03:31 2013 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Mar 20 06:02:43 2013 -0500

----------------------------------------------------------------------
 src/couch_index_updater.erl | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/923be422/src/couch_index_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_updater.erl b/src/couch_index_updater.erl
index 9f54a56..f86964f 100644
--- a/src/couch_index_updater.erl
+++ b/src/couch_index_updater.erl
@@ -137,12 +137,15 @@ update(Idx, Mod, IdxState) ->
 
         NumChanges = couch_db:count_changes_since(Db, CurrSeq),
 
-        LoadDoc = fun(DocInfo) ->
-            #doc_info{
-                id=DocId,
-                high_seq=Seq,
-                revs=[#rev_info{deleted=Deleted} | _]
-            } = DocInfo,
+        GetInfo = fun
+            (#full_doc_info{id=Id, update_seq=Seq, deleted=Del}=FDI) ->
+                {Id, Seq, Del, couch_doc:to_doc_info(FDI)};
+            (#doc_info{id=Id, high_seq=Seq, revs=[RI|_]}=DI) ->
+                {Id, Seq, RI#rev_info.deleted, DI}
+        end,
+
+        LoadDoc = fun(DI) ->
+            {DocId, Seq, Deleted, DocInfo} = GetInfo(DI),
 
             case {IncludeDesign, DocId} of
                 {false, <<"_design/", _/binary>>} ->