couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject mem3 commit: updated refs/heads/master to 9dbea03
Date Wed, 18 Jun 2014 22:24:13 GMT
Repository: couchdb-mem3
Updated Branches:
  refs/heads/master 8d93ca625 -> 9dbea0340


Handle the #doc_info case in changes_enumerator

This is to handle the special case where the user migrates a CouchDB
database to BigCouch and they have not yet compacted the
database. Once the database has been compacted, this #doc_info clause
should never be encountered.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/9dbea034
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/9dbea034
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/9dbea034

Branch: refs/heads/master
Commit: 9dbea0340b54c234a15ee259ae69dea29fafc927
Parents: 8d93ca6
Author: Russell Branca <chewbranca@apache.org>
Authored: Wed Jun 18 15:04:35 2014 -0700
Committer: Russell Branca <chewbranca@apache.org>
Committed: Wed Jun 18 15:24:02 2014 -0700

----------------------------------------------------------------------
 src/mem3_rep.erl | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/9dbea034/src/mem3_rep.erl
----------------------------------------------------------------------
diff --git a/src/mem3_rep.erl b/src/mem3_rep.erl
index 373bc3f..a4aadb5 100644
--- a/src/mem3_rep.erl
+++ b/src/mem3_rep.erl
@@ -28,7 +28,8 @@
     localid,
     source,
     target,
-    filter
+    filter,
+    db
 }).
 
 go(Source, Target) ->
@@ -60,9 +61,10 @@ go(#shard{} = Source, #shard{} = Target, Opts) ->
     },
     go(Acc).
 
-go(#acc{source=Source, batch_count=BC}=Acc) ->
+go(#acc{source=Source, batch_count=BC}=Acc0) ->
     case couch_db:open(Source#shard.name, [{user_ctx,?CTX}]) of
     {ok, Db} ->
+        Acc = Acc0#acc{db=Db},
         Resp = try
             repl(Db, Acc)
         catch error:{not_found, no_db_file} ->
@@ -107,7 +109,11 @@ make_local_id(#shard{node=SourceNode}, #shard{node=TargetNode}, Filter)
->
     end,
     <<"_local/shard-sync-", S/binary, "-", T/binary, F/binary>>.
 
-changes_enumerator(FDI, _, #acc{revcount=C, infos=Infos}=Acc0) ->
+changes_enumerator(#doc_info{id=DocId}, Reds, #acc{db=Db}=Acc) ->
+    {ok, FDI} = couch_db:get_full_doc_info(Db, DocId),
+    changes_enumerator(FDI, Reds, Acc);
+changes_enumerator(#full_doc_info{}=FDI, _,
+  #acc{revcount=C, infos=Infos}=Acc0) ->
     #doc_info{
         high_seq=Seq,
         revs=Revs


Mime
View raw message