davisp commented on a change in pull request #1842: Implement partition size 
limits
URL: https://github.com/apache/couchdb/pull/1842#discussion_r248026654
 
 

 ##########
 File path: src/couch/src/couch_db_updater.erl
 ##########
 @@ -576,6 +606,16 @@ merge_rev_tree(OldInfo, NewDoc, _Client, true) ->
     {NewTree, _} = couch_key_tree:merge(OldTree, NewTree0),
     OldInfo#full_doc_info{rev_tree = NewTree}.
 
+is_overflowed(_New, _Old, []) ->
+    false;
+is_overflowed(Old, Old, _FullPartitions) ->
+    false;
+is_overflowed(New, Old, FullPartitions) ->
+    Partition = couch_partition:from_docid(New#full_doc_info.id),
+    NewSize = estimate_size(New),
+    OldSize = estimate_size(Old),
+    lists:member(Partition, FullPartitions) andalso NewSize > OldSize.
 
 Review comment:
   The key bit is that we're just looking at external sizes for the threshold 
which only includes leaves the revision tree which means that deleting docs and 
fields on docs does decrease the used space. An example of a test showing this 
behavior is here:
   
   
https://github.com/apache/couchdb/blob/feature/database-partitions/test/elixir/test/partition_size_test.exs#L102

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