Joscorbe commented on code in PR #2226:
URL: https://github.com/apache/jackrabbit-oak/pull/2226#discussion_r2085378134


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MongoConnection.java:
##########
@@ -179,11 +198,8 @@ public static String toString(MongoClientOptions opts) {
      *      otherwise.
      */
     public static boolean hasWriteConcern(@NotNull String uri) {
-        MongoClientOptions.Builder builder = MongoClientOptions.builder();
-        builder.writeConcern(WC_UNKNOWN);
-        WriteConcern wc = new MongoClientURI(requireNonNull(uri), builder)
-                .getOptions().getWriteConcern();
-        return !WC_UNKNOWN.equals(wc);
+        ConnectionString connectionString = new 
ConnectionString(requireNonNull(uri));

Review Comment:
   The behavior is the same: both implementations check whether the URI 
explicitly sets a `writeConcern`. The previous version used a workaround with 
`WC_UNKNOWN` to detect this, but the new API exposes this check directly via 
`getWriteConcern()`.
   
   Since now there is a native method in the driver that does exactly what we 
need, I don't think we need the workaround anymore.
   
   There are tests that checks this and I introduced a few more test cases in 
[MongoConnectionTest.java](https://github.com/apache/jackrabbit-oak/pull/2226/files/974372ee2b6d26cfb898864d58eaa45b0a352a7b#diff-b17e7e53cb9e04dbff6c53c1bb9b53ae708714314c21b2daf515acf1ee7b5e97)
 to ensure no regressions are introduced.



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

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

Reply via email to