This is an automated email from the ASF dual-hosted git repository. joscorbe pushed a commit to branch OAK-11835 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit f342027d978af274e83cdefc3866a265b9c6b3c9 Author: Jose Cordero <corde...@adobe.com> AuthorDate: Tue Aug 5 03:40:25 2025 +0200 OAK-11835: Add default constants for Mongo connection pool. --- .../oak/plugins/document/Configuration.java | 22 +++++++++++----------- .../plugins/document/DocumentNodeStoreService.java | 12 ++++++++++++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java index 38f37a67a6..0cd88b1bd0 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java @@ -91,69 +91,69 @@ import static org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreServic name = "MongoDB Max Pool Size", description = "The maximum number of connections in the MongoDB connection pool. " + "Note that this value can be overridden via framework property 'oak.mongo.maxPoolSize'") - int mongoMaxPoolSize() default 100; + int mongoMaxPoolSize() default DocumentNodeStoreService.DEFAULT_MONGO_MAX_POOL_SIZE; @AttributeDefinition( name = "MongoDB Min Pool Size", description = "The minimum number of connections in the MongoDB connection pool. " + "Note that this value can be overridden via framework property 'oak.mongo.minPoolSize'") - int mongoMinPoolSize() default 0; + int mongoMinPoolSize() default DocumentNodeStoreService.DEFAULT_MONGO_MIN_POOL_SIZE; @AttributeDefinition( name = "MongoDB Max Connecting", description = "Maximum number of connections the MongoDB pool may be establishing concurrently. " + "Note that this value can be overridden via framework property 'oak.mongo.maxConnecting'") - int mongoMaxConnecting() default 2; + int mongoMaxConnecting() default DocumentNodeStoreService.DEFAULT_MONGO_MAX_CONNECTING; @AttributeDefinition( name = "MongoDB Max Idle Time (ms)", description = "The maximum idle time in milliseconds of a MongoDB pooled connection. " + "A value of 0 means no limit. " + "Note that this value can be overridden via framework property 'oak.mongo.maxIdleTimeMS'") - int mongoMaxIdleTimeMS() default 0; + int mongoMaxIdleTimeMS() default DocumentNodeStoreService.DEFAULT_MONGO_MAX_IDLE_TIME_MS; @AttributeDefinition( name = "MongoDB Max Life Time (ms)", description = "The maximum lifetime in milliseconds of a MongoDB pooled connection. " + "A value of 0 means no limit. " + "Note that this value can be overridden via framework property 'oak.mongo.maxLifeTimeMS'") - int mongoMaxLifeTimeMS() default 0; + int mongoMaxLifeTimeMS() default DocumentNodeStoreService.DEFAULT_MONGO_MAX_LIFE_TIME_MS; @AttributeDefinition( name = "MongoDB Connect Timeout (ms)", description = "The connection timeout in milliseconds for establishing connections to MongoDB. " + "Note that this value can be overridden via framework property 'oak.mongo.connectTimeoutMS'") - int mongoConnectTimeoutMS() default 10000; + int mongoConnectTimeoutMS() default DocumentNodeStoreService.DEFAULT_MONGO_CONNECT_TIMEOUT_MS; @AttributeDefinition( name = "MongoDB Heartbeat Frequency (ms)", description = "The frequency in milliseconds of the driver checking the state of MongoDB servers. " + "Note that this value can be overridden via framework property 'oak.mongo.heartbeatFrequencyMS'") - int mongoHeartbeatFrequencyMS() default 10000; + int mongoHeartbeatFrequencyMS() default DocumentNodeStoreService.DEFAULT_MONGO_HEARTBEAT_FREQUENCY_MS; @AttributeDefinition( name = "MongoDB Server Selection Timeout (ms)", description = "How long the driver will wait for server selection to succeed before throwing an exception, in milliseconds. " + "Note that this value can be overridden via framework property 'oak.mongo.serverSelectionTimeoutMS'") - int mongoServerSelectionTimeoutMS() default 30000; + int mongoServerSelectionTimeoutMS() default DocumentNodeStoreService.DEFAULT_MONGO_SERVER_SELECTION_TIMEOUT_MS; @AttributeDefinition( name = "MongoDB Wait Queue Timeout (ms)", description = "The maximum time in milliseconds that a thread can wait for a connection to become available (deprecated but still supported). " + "Note that this value can be overridden via framework property 'oak.mongo.waitQueueTimeoutMS'") - int mongoWaitQueueTimeoutMS() default 120000; + int mongoWaitQueueTimeoutMS() default DocumentNodeStoreService.DEFAULT_MONGO_WAIT_QUEUE_TIMEOUT_MS; @AttributeDefinition( name = "MongoDB Socket Read Timeout (ms)", description = "The socket read timeout in milliseconds. A value of 0 means no timeout. " + "Note that this value can be overridden via framework property 'oak.mongo.readTimeoutMS'") - int mongoReadTimeoutMS() default 0; + int mongoReadTimeoutMS() default DocumentNodeStoreService.DEFAULT_MONGO_READ_TIMEOUT_MS; @AttributeDefinition( name = "MongoDB Min Heartbeat Frequency (ms)", description = "The minimum heartbeat frequency in milliseconds for MongoDB server monitoring. " + "Note that this value can be overridden via framework property 'oak.mongo.minHeartbeatFrequencyMS'") - int mongoMinHeartbeatFrequencyMS() default 500; + int mongoMinHeartbeatFrequencyMS() default DocumentNodeStoreService.DEFAULT_MONGO_MIN_HEARTBEAT_FREQUENCY_MS; @AttributeDefinition( name = "Cache Size (in MB)", diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java index 11112c0409..a2a90f383a 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java @@ -143,6 +143,18 @@ public class DocumentNodeStoreService { static final int DEFAULT_FULL_GC_MODE = 0; static final int DEFAULT_FULL_GC_GENERATION = 0; static final int DEFAULT_MONGO_LEASE_SO_TIMEOUT_MILLIS = 30000; + // MongoDB Connection Pool Settings + static final int DEFAULT_MONGO_MAX_POOL_SIZE = 100; + static final int DEFAULT_MONGO_MIN_POOL_SIZE = 0; + static final int DEFAULT_MONGO_MAX_CONNECTING = 2; + static final int DEFAULT_MONGO_MAX_IDLE_TIME_MS = 0; + static final int DEFAULT_MONGO_MAX_LIFE_TIME_MS = 0; + static final int DEFAULT_MONGO_CONNECT_TIMEOUT_MS = 10000; + static final int DEFAULT_MONGO_HEARTBEAT_FREQUENCY_MS = 5000; + static final int DEFAULT_MONGO_SERVER_SELECTION_TIMEOUT_MS = 30000; + static final int DEFAULT_MONGO_WAIT_QUEUE_TIMEOUT_MS = 60000; + static final int DEFAULT_MONGO_READ_TIMEOUT_MS = 0; + static final int DEFAULT_MONGO_MIN_HEARTBEAT_FREQUENCY_MS = 500; static final String DEFAULT_PERSISTENT_CACHE = "cache"; static final String DEFAULT_JOURNAL_CACHE = "diff-cache"; static final boolean DEFAULT_CUSTOM_BLOB_STORE = false;