summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Jackson <spencer.jackson@mongodb.com>2018-02-02 17:51:30 -0500
committerSpencer Jackson <spencer.jackson@mongodb.com>2018-02-05 16:03:41 -0500
commitbfde702b19c1baad532ed183a871c12630c1bbba (patch)
tree8b024d0817d8c2c19ee65120d04e75cfe77a00ad
parent243f03c9070080c28930cd62fde243704e84b63c (diff)
downloadmongo-bfde702b19c1baad532ed183a871c12630c1bbba.tar.gz
SERVER-33089 Do not regenerate auth indexes in queryable backup moder3.4.12-rc0r3.4.12
(cherry picked from commit ce5691d634b9228b0686e6241e071f6691e46a3f)
-rw-r--r--src/mongo/db/auth/auth_index_d.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/auth/auth_index_d.cpp b/src/mongo/db/auth/auth_index_d.cpp
index 0284e561bc0..47987ac40c4 100644
--- a/src/mongo/db/auth/auth_index_d.cpp
+++ b/src/mongo/db/auth/auth_index_d.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/storage/storage_options.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
@@ -97,6 +98,13 @@ void generateSystemIndexForExistingCollection(OperationContext* opCtx,
Collection* collection,
const NamespaceString& ns,
const IndexSpec& spec) {
+ // Do not try and generate any system indexes in read only mode.
+ if (storageGlobalParams.readOnly) {
+ warning() << "Running in queryable backup mode. Unable to create authorization index on "
+ << ns;
+ return;
+ }
+
try {
auto indexSpecStatus = index_key_validate::validateIndexSpec(
spec.toBSON(), ns, serverGlobalParams.featureCompatibility);