reschke commented on code in PR #863:
URL: https://github.com/apache/jackrabbit-oak/pull/863#discussion_r1176424713
##########
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:
FWIW, MongoDB persists BSON, right? (So a binary representation of JSON).
Also note that that the utility method to estimate JVM memory use in the
document store will be incorrect in JDK >= 9.
##########
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:
This may be pedantic, but UTF-16 -> UTF-8 does not necessarily imply 50%
reduction. I assume the rough number is good enough, but maybe the comment
could state more clearly what's going on.
--
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]