[ 
https://issues.apache.org/jira/browse/OAK-12114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18062179#comment-18062179
 ] 

Julian Reschke commented on OAK-12114:
--------------------------------------

I just figured that out as well.

So what surprised me is that BSON does not compress; it only happens on disk.

So get more precise size estimates, our utils should that consider the length 
of the UTF-8 serialized string (of course, only optionally).

> MongoDBExceptionTest uses payloads that compress well
> -----------------------------------------------------
>
>                 Key: OAK-12114
>                 URL: https://issues.apache.org/jira/browse/OAK-12114
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: mongomk
>            Reporter: Julian Reschke
>            Priority: Major
>             Fix For: 2.0.0
>
>
> ...containing only zeros, thus defeating the purpose of testing large 
> payloads.
> (actually, not testing it at all)
> With this change:
> {code}
> diff --git 
> a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBExceptionTest.java
>  
> b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBExceptionTest.java
> index d6e7cb264e..934af36627 100644
> --- 
> a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBExceptionTest.java
> +++ 
> b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBExceptionTest.java
> @@ -36,7 +36,6 @@ import org.junit.Test;
>  import org.slf4j.event.Level;
>  import java.util.ArrayList;
> -import java.util.Arrays;
>  import java.util.List;
>  import static java.util.Collections.singletonList;
> @@ -333,9 +332,5 @@ public class MongoDBExceptionTest {
>      // RED ALERT: OAK-12114
>      private String create1MBContent() {
> -        char[] chars = new char[1024 * 1024];
> -        Arrays.fill(chars, '0');
> -        String content = new String(chars);
> -        return content;
> -    }
> +        return  RandomStringUtils.secure().next(1024 * 1024);    }
>  }
> {code}
> we get
> {code}
> ERROR] Failures:
> [ERROR]   MongoDBExceptionTest.createOrUpdate16MBDoc:156
> Expected: a string containing "Document to upsert is larger than 16777216"
>      but: was "Document size of 37633707 is larger than maximum of 16793600. 
> [/foo]"
> [ERROR]   MongoDBExceptionTest.findAndUpdate16MBDoc:304
> Expected: a string containing "Resulting document after update is larger than 
> 16777216"
>      but: was "Payload document size is larger than maximum of 16793600. 
> [/foo]"
> [ERROR]   MongoDBExceptionTest.multiCreateOrUpdate16MBDoc:263
> Expected: a string containing "Resulting document after update is larger than 
> 16777216"
>      but: was "Payload document size is larger than maximum of 16793600. 
> [/test]"
> [ERROR]   MongoDBExceptionTest.update16MBDoc:231
> Expected: a string containing "Resulting document after update is larger than 
> 16777216"
>      but: was "Payload document size is larger than maximum of 16793600. 
> [/foo]"
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to