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 2021/06/29 20:49:10 UTC

[GitHub] [couchdb] nickva commented on a change in pull request #3633: 3631 3.x fix pq shard creation

nickva commented on a change in pull request #3633:
URL: https://github.com/apache/couchdb/pull/3633#discussion_r660953298



##########
File path: src/mem3/src/mem3_util.erl
##########
@@ -101,6 +101,10 @@ write_db_doc(DbName, #doc{id=Id, body=Body} = Doc, ShouldMutate) ->
     {ok, #doc{body = Body}} ->
         % the doc is already in the desired state, we're done here
         ok;
+    {ok, #doc{body = Body1}} ->

Review comment:
       Since we run this on creation logic only, I don't know if we'd ever be in a position to update the doc with a new body. It would either already be created, and we'd get a conflict, or it wouldn't be there, and we'd try to create it.
   
   
   Even in general (if this wasn't just a fabric_db_create call), we might not know if `Body1` is necessarily an "updated" `Body`? It could be a stale value  too. Then, we would get a `conflict` thrown but we don't catch it here properly like we do in the `{not_found, _}` clause.
   
   It may be safer to avoid modifying the subtle bits there especially with how conflict throws are handled?
   
   




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org