Author: chetanm Date: Mon Aug 28 09:25:26 2017 New Revision: 1806416 URL: http://svn.apache.org/viewvc?rev=1806416&view=rev Log: OAK-6588 - MongoDocumentStore should avoid logging warning when connect in read only mode
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java?rev=1806416&r1=1806415&r2=1806416&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java (original) +++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java Mon Aug 28 09:25:26 2017 @@ -271,9 +271,11 @@ public class MongoDocumentStore implemen new boolean[]{true, true}, false, false); } else if (!hasIndex(nodes, NodeDocument.MODIFIED_IN_SECS, Document.ID)) { hasModifiedIdCompoundIndex = false; - LOG.warn("Detected an upgrade from Oak version <= 1.2. For optimal " + - "performance it is recommended to create a compound index " + - "for the 'nodes' collection on {_modified:1, _id:1}."); + if (!builder.getReadOnlyMode()) { + LOG.warn("Detected an upgrade from Oak version <= 1.2. For optimal " + + "performance it is recommended to create a compound index " + + "for the 'nodes' collection on {_modified:1, _id:1}."); + } } // index on the _bin flag to faster access nodes with binaries for GC @@ -289,12 +291,14 @@ public class MongoDocumentStore implemen createIndex(nodes, NodeDocument.DELETED_ONCE, true, false, true); } } else if (!hasIndex(nodes, DELETED_ONCE, MODIFIED_IN_SECS)) { - LOG.warn("Detected an upgrade from Oak version <= 1.6. For optimal " + - "Revision GC performance it is recommended to create a " + - "partial index for the 'nodes' collection on " + - "{_deletedOnce:1, _modified:1} with a partialFilterExpression " + - "{_deletedOnce:true}. Partial indexes require MongoDB 3.2 " + - "or higher."); + if (!builder.getReadOnlyMode()) { + LOG.warn("Detected an upgrade from Oak version <= 1.6. For optimal " + + "Revision GC performance it is recommended to create a " + + "partial index for the 'nodes' collection on " + + "{_deletedOnce:1, _modified:1} with a partialFilterExpression " + + "{_deletedOnce:true}. Partial indexes require MongoDB 3.2 " + + "or higher."); + } } // compound index on _sdType and _sdMaxRevTime @@ -304,10 +308,12 @@ public class MongoDocumentStore implemen createIndex(nodes, new String[]{SD_TYPE, SD_MAX_REV_TIME_IN_SECS}, new boolean[]{true, true}, false, true); } else if (!hasIndex(nodes, SD_TYPE, SD_MAX_REV_TIME_IN_SECS)) { - LOG.warn("Detected an upgrade from Oak version <= 1.6. For optimal " + - "Revision GC performance it is recommended to create a " + - "sparse compound index for the 'nodes' collection on " + - "{_sdType:1, _sdMaxRevTime:1}."); + if (!builder.getReadOnlyMode()) { + LOG.warn("Detected an upgrade from Oak version <= 1.6. For optimal " + + "Revision GC performance it is recommended to create a " + + "sparse compound index for the 'nodes' collection on " + + "{_sdType:1, _sdMaxRevTime:1}."); + } } // index on _modified for journal entries