You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/01/08 18:11:41 UTC

[GitHub] [couchdb] nickva opened a new pull request #2426: Use separate requests to write design when replicating

nickva opened a new pull request #2426: Use separate requests to write design when replicating
URL: https://github.com/apache/couchdb/pull/2426
 
 
   Design doc writes could fail on the target when replicating if with non-admin
   credentials. Typically the replicator will skip over them and bump the
   `doc_write_failures` counter. However, that relies on the POST request
   returning a `200 OK` response. If the authentication scheme is implemented such
   that the whole request fails if some docs don't have enough permission to be
   written, then the replication job ends up crashing with an ugly exception and
   gets stuck retrying forever. In order to accomodate that scanario write _design
   docs in their separate requests just like we write attachments.
   
   Fixes: #2415
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [couchdb] nickva commented on a change in pull request #2426: Use separate requests to write design when replicating

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #2426: Use separate requests to write design when replicating
URL: https://github.com/apache/couchdb/pull/2426#discussion_r364466467
 
 

 ##########
 File path: src/couch_replicator/src/couch_replicator_worker.erl
 ##########
 @@ -269,16 +269,28 @@ fetch_doc(Source, {Id, Revs, PAs}, DocHandler, Acc) ->
     end.
 
 
-remote_doc_handler({ok, #doc{atts = []} = Doc}, {Parent, _} = Acc) ->
-    ok = gen_server:call(Parent, {batch_doc, Doc}, infinity),
-    {ok, Acc};
-remote_doc_handler({ok, Doc}, {Parent, Target} = Acc) ->
+remote_doc_handler({ok, #doc{id = <<?DESIGN_DOC_PREFIX, _/binary>>} = Doc},
+        Acc) ->
+    % Flush design docs in their own PUT requests to correctly process
+    % authorization failures for design doc updates.
+    couch_log:debug("Worker flushing design doc", []),
 
 Review comment:
   I had copied the pattern from the attachment flusher were it had a similar log line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [couchdb] jaydoane commented on a change in pull request #2426: Use separate requests to write design when replicating

Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #2426: Use separate requests to write design when replicating
URL: https://github.com/apache/couchdb/pull/2426#discussion_r364462651
 
 

 ##########
 File path: src/couch_replicator/src/couch_replicator_worker.erl
 ##########
 @@ -269,16 +269,28 @@ fetch_doc(Source, {Id, Revs, PAs}, DocHandler, Acc) ->
     end.
 
 
-remote_doc_handler({ok, #doc{atts = []} = Doc}, {Parent, _} = Acc) ->
-    ok = gen_server:call(Parent, {batch_doc, Doc}, infinity),
-    {ok, Acc};
-remote_doc_handler({ok, Doc}, {Parent, Target} = Acc) ->
+remote_doc_handler({ok, #doc{id = <<?DESIGN_DOC_PREFIX, _/binary>>} = Doc},
+        Acc) ->
+    % Flush design docs in their own PUT requests to correctly process
+    % authorization failures for design doc updates.
+    couch_log:debug("Worker flushing design doc", []),
 
 Review comment:
   Do you want to leave this in?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

[GitHub] [couchdb] nickva merged pull request #2426: Use separate requests to write design when replicating

Posted by GitBox <gi...@apache.org>.
nickva merged pull request #2426: Use separate requests to write design when replicating
URL: https://github.com/apache/couchdb/pull/2426
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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