jiangphcn commented on a change in pull request #1808: Update 
before_doc_update/2 to before_doc_update/3
URL: https://github.com/apache/couchdb/pull/1808#discussion_r244903306
 
 

 ##########
 File path: src/couch/src/couch_db_plugin.erl
 ##########
 @@ -34,11 +34,13 @@
 validate_dbname(DbName, Normalized, Default) ->
     maybe_handle(validate_dbname, [DbName, Normalized], Default).
 
-before_doc_update(Db, Doc0) ->
+before_doc_update(Db, Doc0, UpdateType) ->
     Fun = couch_db:get_before_doc_update_fun(Db),
-    case with_pipe(before_doc_update, [Doc0, Db]) of
-        [Doc1, _Db] when is_function(Fun) -> Fun(Doc1, Db);
-        [Doc1, _Db] -> Doc1
+    case with_pipe(before_doc_update, [Doc0, Db, UpdateType]) of
+        [Doc1, _Db, UpdateType] when is_function(Fun) ->
 
 Review comment:
   thanks @iilyak for double check. For this case, I tried to use `[Doc1, _Db] 
when is_function(Fun) ->` here and `[Doc, Db].` in 
https://github.com/cloudant/showroom/pull/212/commits/7706fba5776466ba23963213ace114d85068e777#diff-984e3fb55ca9cd5d963758ec7cdc91e0L43.
 But this causes that db instance can't start. 
   
   So I try to pass all variables here `[Doc, Db, _UpdateType].` and use `[Doc, 
Db, _UpdateType].` in 
https://github.com/cloudant/showroom/pull/212/commits/7706fba5776466ba23963213ace114d85068e777#diff-984e3fb55ca9cd5d963758ec7cdc91e0R40.
  My test works fine now 
https://github.com/cloudant/showroom/pull/212#issuecomment-449840808
   
   I noticed that _Db is still passed to Fun even if it is not changed. 
Thinking that we need the same case for _UpdateType.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to