stefan-egli commented on code in PR #863:
URL: https://github.com/apache/jackrabbit-oak/pull/863#discussion_r1176156321
##########
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 the problem here is that we'd really like to estimate the memory
usage within Mongo (which is UTF-8 IIUC), but the method used here is
estimating the memory usage within the JVM (which does a multiply by 2, so
would estimate for UTF-16). Is that correct?
The problem with the above is that it can potentially be off significantly -
as the method used is optimized to estimate JVM side memory use, not Mongo
side. And dividing by 2 could skew things..
I wonder if we should indeed lower the threshold for issuing a log.error
here (and then phrase the message that the exact size might differ)..
--
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]