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


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java:
##########
@@ -502,7 +502,7 @@ private void configureEstimators(IndexingProgressReporter 
progressReporter) {
     private long getEstimatedDocumentCount() {
         MongoConnection mongoConnection = 
indexHelper.getService(MongoConnection.class);
         if (mongoConnection != null) {
-            return 
mongoConnection.getDatabase().getCollection("nodes").count();
+            return 
mongoConnection.getDatabase().getCollection("nodes").countDocuments();

Review Comment:
   please use 
https://mongodb.github.io/mongo-java-driver/5.5/apidocs/driver-sync/com/mongodb/client/MongoCollection.html#estimatedDocumentCount().
 `countDocuments` is pretty slow [1].
   
   [1] 
https://mongodb.github.io/mongo-java-driver/5.5/apidocs/driver-sync/com/mongodb/client/MongoCollection.html#countDocuments()



##########
oak-store-document/pom.xml:
##########
@@ -43,8 +43,8 @@
         <configuration>
           <instructions>
             <Import-Package>
-              com.mongodb*;version="[3.8, 4)";resolution:=optional,
-              org.bson*;version="[3.8, 4)";resolution:=optional,
+              com.mongodb*;version="[5.2, 5.3)";resolution:=optional,
+              org.bson*;version="[5.2, 5.3)";resolution:=optional,

Review Comment:
   we already have version `5.5.0` released for mongo-driver-sync [1]
   
   [1] https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-sync



##########
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:
   why do we need need to change this behavior here, this might cause an 
regression.



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java:
##########
@@ -340,7 +342,11 @@ private void registerNodeStore() throws IOException {
             String db = config.db();
             boolean soKeepAlive = config.socketKeepAlive();
 
-            MongoClientURI mongoURI = new MongoClientURI(uri);
+            ConnectionString mongoURI = new ConnectionString(uri);
+            MongoClientSettings settings = MongoClientSettings.builder()
+                    .applyConnectionString(mongoURI)

Review Comment:
   variable `mongoURI` can be inlined.
   ```suggestion
                       .applyConnectionString(new ConnectionString(uri))
   ```



##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoConnectionTest.java:
##########
@@ -85,26 +95,6 @@ public void sufficientReadConcern() throws Exception {
         sufficientReadConcernSingleNode(ReadConcern.MAJORITY, true);
     }
 
-    @Test
-    public void socketKeepAlive() throws Exception {

Review Comment:
   Again, I would keep this alive till we remove the config.



##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java:
##########
@@ -155,18 +153,6 @@ public void setUpdateLimit() throws Exception {
         assertEquals(17, store.getUpdateLimit());
     }
 
-    @Test
-    public void keepAlive() throws Exception {

Review Comment:
   `keepAlive` config is only marked as deprecated not removed. I would suggest 
to keep these test till we remove that.



-- 
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