chewbranca commented on code in PR #4862:
URL: https://github.com/apache/couchdb/pull/4862#discussion_r1399558049
##########
src/couch/src/couch_db.erl:
##########
@@ -297,7 +303,13 @@ open_doc(Db, IdOrDocInfo) ->
open_doc(Db, IdOrDocInfo, []).
open_doc(Db, Id, Options) ->
- increment_stat(Db, [couchdb, database_reads]),
+ open_doc(Db, Id, Options, true).
+
+open_doc(Db, Id, Options, ChangeStat) ->
+ case ChangeStat of
+ true -> ?MODULE:increment_stat(Db, [couchdb, database_reads]);
+ false -> ok
+ end,
Review Comment:
Yeah we should be triggering database reads anytime a read is performed. The
bug here is that we read the doc twice, one for include_docs=true and once for
the filter, when we should only be doing that once.
It's a bit more complicated in that the js filter will potentially load all
the available revs, whereas include_docs does not, so some care will need to be
taken there, but we definitely do not want to hide data from stats collection.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]