diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-01-29 20:08:54 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-01-29 20:08:54 +0000 |
commit | 0fc0c2d630abe0f4b6cc37c7f92728d1fe156ff3 (patch) | |
tree | 4a7727a9db0c07676d8ba44fdab09291bf928da7 /src/couchdb/couch_rep_writer.erl | |
parent | adb2703aa1f7b13d30e033a8b47bc625f8c492cc (diff) |
Thanks Filipe Manana. Closes COUCHDB-631.
Replicator option to replicate a list of docids (bypasses by_seq index).
Usage: POST to /_replicate with a JSON body of:
{"source": "myfoo",
"target" : "http://remotedb.com/theirfoo",
"doc_ids": ["foo1", "foo3", "foo666"]}
This will copy the listed docs from the source to the target database.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@904615 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_rep_writer.erl')
-rw-r--r-- | src/couchdb/couch_rep_writer.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/couchdb/couch_rep_writer.erl b/src/couchdb/couch_rep_writer.erl index b86028ce..269b9799 100644 --- a/src/couchdb/couch_rep_writer.erl +++ b/src/couchdb/couch_rep_writer.erl @@ -21,6 +21,8 @@ start_link(Parent, Target, Reader, _PostProps) -> writer_loop(Parent, Reader, Target) -> case couch_rep_reader:next(Reader) of + {complete, nil} -> + ok; {complete, FinalSeq} -> Parent ! {writer_checkpoint, FinalSeq}, ok; @@ -38,7 +40,12 @@ writer_loop(Parent, Reader, Target) -> ?LOG_DEBUG("writer failed to write an attachment ~p", [Err]), exit({attachment_request_failed, Err, Docs}) end, - Parent ! {writer_checkpoint, HighSeq}, + case HighSeq of + nil -> + ok; + _SeqNumber -> + Parent ! {writer_checkpoint, HighSeq} + end, couch_rep_att:cleanup(), couch_util:should_flush(), writer_loop(Parent, Reader, Target) |