summaryrefslogtreecommitdiff
path: root/src/mongo/db/views/durable_view_catalog.h
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2019-06-19 17:21:34 -0400
committerBlake Oler <blake.oler@mongodb.com>2019-06-26 16:50:38 -0400
commit42c1fa4f55a55fd9cc98a57f691160152acacf7e (patch)
tree37808992e4e943149e86098b7789feabec84a4fb /src/mongo/db/views/durable_view_catalog.h
parent4d06ab3d983463ab1f593ef2d43554d8f095fd39 (diff)
downloadmongo-42c1fa4f55a55fd9cc98a57f691160152acacf7e.tar.gz
SERVER-41813 Allow ViewCatalog lookup without validating system views
Diffstat (limited to 'src/mongo/db/views/durable_view_catalog.h')
-rw-r--r--src/mongo/db/views/durable_view_catalog.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mongo/db/views/durable_view_catalog.h b/src/mongo/db/views/durable_view_catalog.h
index 41c2f5837c3..03bacb2f3fb 100644
--- a/src/mongo/db/views/durable_view_catalog.h
+++ b/src/mongo/db/views/durable_view_catalog.h
@@ -41,6 +41,14 @@ namespace mongo {
class BSONObj;
class Database;
class OperationContext;
+class RecordData;
+
+/**
+ * ViewCatalogLookupBehavior specifies whether a lookup into the view catalog should attempt to
+ * validate the durable entries that currently exist within the catalog. This validation should
+ * rarely be skipped.
+ */
+enum class ViewCatalogLookupBehavior { kValidateDurableViews, kAllowInvalidDurableViews };
/**
* Interface for system.views collection operations associated with view catalog management.
@@ -60,7 +68,8 @@ public:
static void onExternalChange(OperationContext* opCtx, const NamespaceString& name);
using Callback = std::function<Status(const BSONObj& view)>;
- virtual Status iterate(OperationContext* opCtx, Callback callback) = 0;
+ virtual void iterate(OperationContext* opCtx, Callback callback) = 0;
+ virtual void iterateIgnoreInvalidEntries(OperationContext* opCtx, Callback callback) = 0;
virtual void upsert(OperationContext* opCtx,
const NamespaceString& name,
const BSONObj& view) = 0;
@@ -77,12 +86,21 @@ class DurableViewCatalogImpl final : public DurableViewCatalog {
public:
explicit DurableViewCatalogImpl(Database* db) : _db(db) {}
- Status iterate(OperationContext* opCtx, Callback callback);
+ void iterate(OperationContext* opCtx, Callback callback);
+
+ void iterateIgnoreInvalidEntries(OperationContext* opCtx, Callback callback);
+
void upsert(OperationContext* opCtx, const NamespaceString& name, const BSONObj& view);
void remove(OperationContext* opCtx, const NamespaceString& name);
const std::string& getName() const;
private:
+ void _iterate(OperationContext* opCtx,
+ Callback callback,
+ ViewCatalogLookupBehavior lookupBehavior);
+
+ BSONObj _validateViewDefinition(OperationContext* opCtx, const RecordData& recordData);
+
Database* const _db;
};
} // namespace mongo