MongoDocumentStore should avoid logging warning when connect in read only mode
@@ -271,10 +271,12 @@ public class MongoDocumentStore implements DocumentStore, RevisionListener {
new boolean[]{true, true}, false, false);
} else if (!hasIndex(nodes, NodeDocument.MODIFIED_IN_SECS, Document.ID)) {
hasModifiedIdCompoundIndex = false;
+ 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
createIndex(nodes, NodeDocument.HAS_BINARY_FLAG, true, false, true);
@@ -289,6 +291,7 @@ public class MongoDocumentStore implements DocumentStore, RevisionListener {
createIndex(nodes, NodeDocument.DELETED_ONCE, true, false, true);
}
} else if (!hasIndex(nodes, DELETED_ONCE, MODIFIED_IN_SECS)) {
+ 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 " +
@@ -296,6 +299,7 @@ public class MongoDocumentStore implements DocumentStore, RevisionListener {
"{_deletedOnce:true}. Partial indexes require MongoDB 3.2 " +
"or higher.");
}
+ }
// compound index on _sdType and _sdMaxRevTime
if (initialDocsCount == 0) {
@@ -304,11 +308,13 @@ public class MongoDocumentStore implements DocumentStore, RevisionListener {
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)) {
+ 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
createIndex(journal, JournalEntry.MODIFIED, true, false, false);
