stefan-egli commented on code in PR #863:
URL: https://github.com/apache/jackrabbit-oak/pull/863#discussion_r1177841729


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java:
##########
@@ -1470,8 +1487,18 @@ public <T extends Document> boolean create(Collection<T> 
collection, List<Update
                 }
                 insertSuccess = true;
                 return true;
-            } catch (MongoException e) {
-                return false;
+            } catch (BsonMaximumSizeExceededException e) {
+                T doct = null;
+                for (T doc : docs) {
+                    doct = doc;
+                    // doc.getMemory()/2 - converting from UTF-16 to UTF-8
+                    if (doc.getMemory()/2 > SIZE_LIMIT) {

Review Comment:
   I think it's anyway difficult to convert our JVM estimate to a MongoDB 
estimate, for that we'd have to know how much space integers, boolean etc are 
taking up. With the current "divide by 2" we assume they also take half the 
space, which might or might not be true.
   
   So I would add some margin to this condition, either by already warning at 
say 14MB - or, more drastically, by dividing by 3 (which would correspond to 
warning at 10.7MB already). That would be a bit more "loudly", as it would list 
IDs of more documents than necessary, but it would more likely not miss any. 
Without any margin there is chance to miss 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to