davisp commented on a change in pull request #2636: Clean up view size limit enforcement URL: https://github.com/apache/couchdb/pull/2636#discussion_r388438691
########## File path: src/couch_views/src/couch_views_indexer.erl ########## @@ -297,8 +299,13 @@ write_docs(TxDb, Mrst, Docs, State) -> last_seq := LastSeq } = State, - lists:foreach(fun(Doc) -> - couch_views_fdb:write_doc(TxDb, Sig, Views, Doc) + ViewIds = [View#mrview.id_num || View <- Views], + KeyLimit = key_size_limit(), + ValLimit = value_size_limit(), + + lists:foreach(fun(Doc0) -> + Doc1 = calculate_kv_sizes(Mrst, Doc0, KeyLimit, ValLimit), + couch_views_fdb:write_doc(TxDb, Sig, ViewIds, Doc1) Review comment: Started to try moving this but I didn't like how it moved extra logic into the fdb module. Given that the loop is the number of views on a design document the performance cost is insignificant so leaving the logic for pulling out the view id here seems better. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services