stefan-egli commented on code in PR #863:
URL: https://github.com/apache/jackrabbit-oak/pull/863#discussion_r1182342929
##########
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:
The 14MB was just to be on the very safe side, I wasn't suggesting to
introduce an additional 14MB check.
Let's say you create a document with 16MB+1byte. Mongo will throw a
BsonMaximumSizeExceededException. But for some reason our estimate of that
document, divided by 2 is smaller than 16MB (our `getMemory` is only
approximate). That case we wouldn't catch atm. But we could catch it as well by
eg dividing by 3 or use a lower threshold (whatever is easier). (yes, we would
potentially warn about documents that were not the reason mongo issued the
exception, but I don't think that's a problem)
--
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]