You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "stefan-egli (via GitHub)" <gi...@apache.org> on 2023/04/12 16:53:10 UTC

[GitHub] [jackrabbit-oak] stefan-egli commented on a diff in pull request #863: OAK-10127 - Log warn message when MongoDB document is big

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


##########
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 haven't followed all discussion) is UTF-16 always the case, or is there something that this could be made dependent upon ?



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java:
##########
@@ -1115,6 +1123,15 @@ private <T extends Document> T findAndModify(Collection<T> collection,
                 }
             }
             return oldDoc;
+        } catch (MongoWriteException e) {
+            WriteError werr = e.getError();
+            LOG.error("Failed to update the document with Id={} with error message '{}'",

Review Comment:
   ```suggestion
               LOG.error("Failed to update the document with Id={} with a MongoWriteException message '{}'",
   ```
   
   a bit a detail, but perhaps could be useful to explicitly state that it was a MongoWriteException (and a MongoCommandException below)



-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org