You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "nickva (via GitHub)" <gi...@apache.org> on 2023/05/01 15:14:29 UTC

[GitHub] [couchdb] nickva commented on a diff in pull request #4554: feat(`mango`): add `keys_examined` for `execution_stats` (part 1)

nickva commented on code in PR #4554:
URL: https://github.com/apache/couchdb/pull/4554#discussion_r1181645292


##########
src/mango/src/mango_cursor_view.erl:
##########
@@ -457,12 +480,21 @@ handle_message({row, Props}, Cursor) ->
             couch_log:error("~s :: Error loading doc: ~p", [?MODULE, Error]),
             {ok, Cursor}
     end;
-handle_message({execution_stats, ShardStats}, #cursor{execution_stats = Stats} = Cursor) ->
-    {docs_examined, DocsExamined} = ShardStats,
-    Cursor1 = Cursor#cursor{
+% TODO: remove clause couchdb 4 -- mixed-version upgrade support
+handle_message(
+    {execution_stats, {docs_examined, DocsExamined}}, #cursor{execution_stats = Stats} = Cursor0

Review Comment:
   Tiny nit: It might look better pick out `Stats` in a separate line after the function head, since with the `{execution_stats, {docs_examined, DocsExamined}}` the head is getting rather long.
   
   Also, in the second clause it might be better to explicitly assert we're matching on a map.
   
   ```erlang
   handle_message({execution_stats, {docs_examined, DocsExamined}}, #cursor{} = Cursor0) ->
       #cursor{execution_stats = Stats} = Cursor0,
       ...
   handle_message({execution_stats, #{} = ShardStats}, #cursor{} = Cursor0) ->
       #cursor{execution_stats = Stats} = Cursor0,
       ...  
   
   ```



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