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

[GitHub] [couchdb] pgj commented on a diff in pull request #4569: feat(`mango`): add `keys_examined` for `execution_stats`

pgj commented on code in PR #4569:
URL: https://github.com/apache/couchdb/pull/4569#discussion_r1190214351


##########
src/mango/src/mango_cursor_view.erl:
##########
@@ -379,14 +395,22 @@ view_cb({row, Row}, #mrargs{extra = Options} = Acc) ->
             ok = rexi:stream2(ViewRow),
             set_mango_msg_timestamp();
         {Doc, _} ->
-            put(mango_docs_examined, get(mango_docs_examined) + 1),
+            mango_execution_stats:shard_incr_docs_examined(),
             couch_stats:increment_counter([mango, docs_examined]),
             Process(Doc)
     end,
     {ok, Acc};
-view_cb(complete, Acc) ->
+view_cb(complete, #mrargs{extra = Options} = Acc) ->
+    ShardStats = mango_execution_stats:shard_get_stats(),
+    case couch_util:get_value(execution_stats_map, Options, false) of
+        true ->
+            Stats = ShardStats;
+        false ->
+            DocsExamined = maps:get(docs_examined, ShardStats),
+            Stats = {docs_examined, DocsExamined}
+    end,

Review Comment:
   You are right, and it is completely logical.  I did not see any warnings from the compiler related to that, though.



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