You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/07/31 15:47:06 UTC

[GitHub] nickva commented on a change in pull request #721: Save migrated replicator checkpoint documents immediately

nickva commented on a change in pull request #721: Save migrated replicator checkpoint documents immediately
URL: https://github.com/apache/couchdb/pull/721#discussion_r130390772
 
 

 ##########
 File path: src/couch_replicator/src/couch_replicator_scheduler_job.erl
 ##########
 @@ -632,11 +632,30 @@ fold_replication_logs([Db | Rest] = Dbs, Vsn, LogId, NewId, Rep, Acc) ->
             Rest, ?REP_ID_VERSION, NewId, NewId, Rep, [Doc | Acc]);
     {ok, Doc} ->
         MigratedLog = #doc{id = NewId, body = Doc#doc.body},
+        maybe_save_migrated_log(Rep, Db, MigratedLog, Doc#doc.id),
         fold_replication_logs(
             Rest, ?REP_ID_VERSION, NewId, NewId, Rep, [MigratedLog | Acc])
     end.
 
 
+maybe_save_migrated_log(Rep, Db, #doc{} = Doc, OldId) ->
+    case get_value(use_checkpoints, Rep#rep.options, true) of
+        true ->
+            DbName = httpdb_strip_creds(Db),
+            try
+                update_checkpoint(Db, Doc),
+                OkMsg = "Migrated replication checkpoint. Db:~p ~p -> ~p",
+                couch_log:notice(OkMsg,  [DbName, OldId, Doc#doc.id])
+            catch
 
 Review comment:
   Agreed. Good point. Will let it crash here.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services