You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/04/06 16:19:55 UTC

[GitHub] [jackrabbit-oak] mreutegg opened a new pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

mreutegg opened a new pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283


   Introduces a new configuration that sets a socket timeout for operations on the clusterNodes collection.
   
   Default is up for discussion. Initially I set it to 30 seconds.


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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r610556883



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBClient.java
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.mongo;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoClientURI;
+import com.mongodb.ReadConcernLevel;
+import com.mongodb.client.ClientSession;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.plugins.document.util.MongoConnection.readConcernLevel;
+
+/**
+ * Simple struct that contains {@code MongoClient}, {@code MongoDatabase} and
+ * {@code MongoStatus}.
+ */
+final class MongoDBClient {

Review comment:
       Renamed `MongoDBClient` to `MongoDBConnection` in https://github.com/apache/jackrabbit-oak/pull/283/commits/10404cbdd52341ba517e57a0e671537fa8a8853d




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

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



[GitHub] [jackrabbit-oak] reschke commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
reschke commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609590901



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfiguration.java
##########
@@ -73,6 +73,12 @@
      */
     private static final String FWK_PROP_SO_KEEP_ALIVE = "oak.mongo.socketKeepAlive";
 
+    /**
+     * Name of framework property to configure socket timeout for lease update
+     * operations on MongoDB.
+     */
+    private static final String FWK_PROP_LEASE_SO_TIMEOUT = "oak.mongo.leaseSocketTimeout";

Review comment:
       Ack; I misread the original ticket; primary/secondary config does not apply to RDB.




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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r610550955



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfiguration.java
##########
@@ -73,6 +73,12 @@
      */
     private static final String FWK_PROP_SO_KEEP_ALIVE = "oak.mongo.socketKeepAlive";
 
+    /**
+     * Name of framework property to configure socket timeout for lease update
+     * operations on MongoDB.
+     */
+    private static final String FWK_PROP_LEASE_SO_TIMEOUT = "oak.mongo.leaseSocketTimeout";

Review comment:
       Done with https://github.com/apache/jackrabbit-oak/pull/283/commits/da55aa3195fe63a249b19ebc86e3e7509cb92439




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

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



[GitHub] [jackrabbit-oak] stefan-egli commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
stefan-egli commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609570848



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoSessionFactory.java
##########
@@ -37,22 +37,23 @@
 
     private final ClientSessionOptions options;
 
+    private final MongoClock clock;

Review comment:
       I might not fully understand this, but MongoClock is somewhat confusing me. IIUC it is only used by MongoSessionFactory and serves as a replacement for the `clusterTime` and `operationTime` fields that were previously used (and now become obsolete). In that case, could the scope `MongoClock` not actually be limited to be a private/inner class of MongoSessionFactory - or is the MongoClock indeed being used outside of this class?

##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBClient.java
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.mongo;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoClientURI;
+import com.mongodb.ReadConcernLevel;
+import com.mongodb.client.ClientSession;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.plugins.document.util.MongoConnection.readConcernLevel;
+
+/**
+ * Simple struct that contains {@code MongoClient}, {@code MongoDatabase} and
+ * {@code MongoStatus}.
+ */
+final class MongoDBClient {

Review comment:
       I was wondering if there would be an alternative name for `MongoDBClient`. Reason is that there is code that does `client.getClient()` which is a bit difficult to read, as you need to know that there are effectively 2 layers or 2 concepts of client (the MongoDBClient and the MongoClient).. IIUC this is like a `Holder` or an `Info` (but the latter is also a bit underappreciating the functionality of this class).. so, not sure what's a better name, but at least this name was initially not directly intuitive (as it collides with MongoClient)

##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfiguration.java
##########
@@ -73,6 +73,12 @@
      */
     private static final String FWK_PROP_SO_KEEP_ALIVE = "oak.mongo.socketKeepAlive";
 
+    /**
+     * Name of framework property to configure socket timeout for lease update
+     * operations on MongoDB.
+     */
+    private static final String FWK_PROP_LEASE_SO_TIMEOUT = "oak.mongo.leaseSocketTimeout";

Review comment:
       To @reschke 's comment re naming/generalising : what I noticed is that the property key has `mongo` in it (to make it clear, it is only for mongo) - but this field does not. Perhaps it could be renamed to sth like `FWK_PROP_MONGO_LEASE_SO_TIMEOUT` (and the same would then also apply to other places/methods that use leaseSoTimeout and not specifically call it out as belonging to mongo




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

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



[GitHub] [jackrabbit-oak] mreutegg closed pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg closed pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283


   


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

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



[GitHub] [jackrabbit-oak] stefan-egli commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
stefan-egli commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609570848



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoSessionFactory.java
##########
@@ -37,22 +37,23 @@
 
     private final ClientSessionOptions options;
 
+    private final MongoClock clock;

Review comment:
       I might not fully understand this, but MongoClock is somewhat confusing me. IIUC it is only used by MongoSessionFactory and serves as a replacement for the `clusterTime` and `operationTime` fields that were previously used (and now become obsolete). In that case, could the scope of `MongoClock` not actually be limited to be a private/inner class of MongoSessionFactory - or is the MongoClock indeed being used outside of this class?




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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r610556883



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBClient.java
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.mongo;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoClientURI;
+import com.mongodb.ReadConcernLevel;
+import com.mongodb.client.ClientSession;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.plugins.document.util.MongoConnection.readConcernLevel;
+
+/**
+ * Simple struct that contains {@code MongoClient}, {@code MongoDatabase} and
+ * {@code MongoStatus}.
+ */
+final class MongoDBClient {

Review comment:
       Renamed `MongoDBClient` to `MongoDBConnection`.




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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609578351



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoSessionFactory.java
##########
@@ -37,22 +37,23 @@
 
     private final ClientSessionOptions options;
 
+    private final MongoClock clock;

Review comment:
       The only usage is test, which is the reason I pulled it out of MongoSessionFactory. Otherwise, it is somewhat of an implementation details.




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

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



[GitHub] [jackrabbit-oak] stefan-egli commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
stefan-egli commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609586767



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfiguration.java
##########
@@ -73,6 +73,12 @@
      */
     private static final String FWK_PROP_SO_KEEP_ALIVE = "oak.mongo.socketKeepAlive";
 
+    /**
+     * Name of framework property to configure socket timeout for lease update
+     * operations on MongoDB.
+     */
+    private static final String FWK_PROP_LEASE_SO_TIMEOUT = "oak.mongo.leaseSocketTimeout";

Review comment:
       I meant making it fully MongoDB specific




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

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



[GitHub] [jackrabbit-oak] mreutegg commented on pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#issuecomment-815508146


   I consider this issue MongoDocumentStore specific, based on how the MongoDB Java driver interacts with the replica-set. I don't know whether a similar problem exists for RDB, but it would probably depend on the JDBC driver.


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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609578803



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBClient.java
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document.mongo;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.MongoClient;
+import com.mongodb.MongoClientOptions;
+import com.mongodb.MongoClientURI;
+import com.mongodb.ReadConcernLevel;
+import com.mongodb.client.ClientSession;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+
+import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
+import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.plugins.document.util.MongoConnection.readConcernLevel;
+
+/**
+ * Simple struct that contains {@code MongoClient}, {@code MongoDatabase} and
+ * {@code MongoStatus}.
+ */
+final class MongoDBClient {

Review comment:
       Agreed, will think of something better.




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

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



[GitHub] [jackrabbit-oak] mreutegg commented on a change in pull request #283: OAK-9392: Improve resilience when primary becomes unavailable

Posted by GitBox <gi...@apache.org>.
mreutegg commented on a change in pull request #283:
URL: https://github.com/apache/jackrabbit-oak/pull/283#discussion_r609581525



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfiguration.java
##########
@@ -73,6 +73,12 @@
      */
     private static final String FWK_PROP_SO_KEEP_ALIVE = "oak.mongo.socketKeepAlive";
 
+    /**
+     * Name of framework property to configure socket timeout for lease update
+     * operations on MongoDB.
+     */
+    private static final String FWK_PROP_LEASE_SO_TIMEOUT = "oak.mongo.leaseSocketTimeout";

Review comment:
       Not sure I understand. Do you suggest turning the configuration `leaseSocketTimeout` into a generic one that also applies to RDB or rather making it fully MongoDB specific?




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

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