summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2018-11-13 14:05:34 -0500
committerXiangyu Yao <xiangyu.yao@mongodb.com>2018-11-19 09:53:13 -0500
commit0d71197c9fa8a69203fbe0e81e85acb5766c9428 (patch)
treea91c6f3bca65b73953126c47ea0cc073b393bded /src/mongo
parentcb11cd44ba3289f191cb2fb3bb70677ed50759aa (diff)
downloadmongo-0d71197c9fa8a69203fbe0e81e85acb5766c9428.tar.gz
SERVER-37985 Create aggregation stage $backupCursorExtend
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/mongo_process_interface.h6
-rw-r--r--src/mongo/db/pipeline/mongos_process_interface.h8
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.cpp13
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.h5
-rw-r--r--src/mongo/db/pipeline/stub_mongo_process_interface.h8
-rw-r--r--src/mongo/db/storage/backup_cursor_hooks.cpp8
-rw-r--r--src/mongo/db/storage/backup_cursor_hooks.h6
-rw-r--r--src/mongo/db/storage/backup_cursor_state.h4
8 files changed, 51 insertions, 7 deletions
diff --git a/src/mongo/db/pipeline/mongo_process_interface.h b/src/mongo/db/pipeline/mongo_process_interface.h
index 8071043c1b3..947bc5e6972 100644
--- a/src/mongo/db/pipeline/mongo_process_interface.h
+++ b/src/mongo/db/pipeline/mongo_process_interface.h
@@ -266,7 +266,11 @@ public:
*/
virtual BackupCursorState openBackupCursor(OperationContext* opCtx) = 0;
- virtual void closeBackupCursor(OperationContext* opCtx, UUID backupId) = 0;
+ virtual void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) = 0;
+
+ virtual BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) = 0;
/**
* Returns a vector of BSON objects, where each entry in the vector describes a plan cache entry
diff --git a/src/mongo/db/pipeline/mongos_process_interface.h b/src/mongo/db/pipeline/mongos_process_interface.h
index 6f7c1e35505..2cd8b80f2be 100644
--- a/src/mongo/db/pipeline/mongos_process_interface.h
+++ b/src/mongo/db/pipeline/mongos_process_interface.h
@@ -148,7 +148,13 @@ public:
MONGO_UNREACHABLE;
}
- void closeBackupCursor(OperationContext* opCtx, UUID backupId) final {
+ void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) final {
+ MONGO_UNREACHABLE;
+ }
+
+ BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) final {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/pipeline/process_interface_standalone.cpp b/src/mongo/db/pipeline/process_interface_standalone.cpp
index 86dfbd0f09a..949f6a7c195 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.cpp
+++ b/src/mongo/db/pipeline/process_interface_standalone.cpp
@@ -402,7 +402,7 @@ BackupCursorState MongoInterfaceStandalone::openBackupCursor(OperationContext* o
}
}
-void MongoInterfaceStandalone::closeBackupCursor(OperationContext* opCtx, UUID backupId) {
+void MongoInterfaceStandalone::closeBackupCursor(OperationContext* opCtx, const UUID& backupId) {
auto backupCursorHooks = BackupCursorHooks::get(opCtx->getServiceContext());
if (backupCursorHooks->enabled()) {
backupCursorHooks->closeBackupCursor(opCtx, backupId);
@@ -411,6 +411,17 @@ void MongoInterfaceStandalone::closeBackupCursor(OperationContext* opCtx, UUID b
}
}
+BackupCursorExtendState MongoInterfaceStandalone::extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) {
+ auto backupCursorHooks = BackupCursorHooks::get(opCtx->getServiceContext());
+ if (backupCursorHooks->enabled()) {
+ return backupCursorHooks->extendBackupCursor(opCtx, backupId, extendTo);
+ } else {
+ uasserted(51010, "Backup cursors are an enterprise only feature.");
+ }
+}
+
std::vector<BSONObj> MongoInterfaceStandalone::getMatchingPlanCacheEntryStats(
OperationContext* opCtx, const NamespaceString& nss, const MatchExpression* matchExp) const {
const auto serializer = [](const PlanCacheEntry& entry) {
diff --git a/src/mongo/db/pipeline/process_interface_standalone.h b/src/mongo/db/pipeline/process_interface_standalone.h
index cdbbcd93c9d..6d36a1fd5f2 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.h
+++ b/src/mongo/db/pipeline/process_interface_standalone.h
@@ -107,7 +107,10 @@ public:
std::vector<GenericCursor> getIdleCursors(const boost::intrusive_ptr<ExpressionContext>& expCtx,
CurrentOpUserMode userMode) const final;
BackupCursorState openBackupCursor(OperationContext* opCtx) final;
- void closeBackupCursor(OperationContext* opCtx, UUID backupId) final;
+ void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) final;
+ BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) final;
std::vector<BSONObj> getMatchingPlanCacheEntryStats(OperationContext*,
const NamespaceString&,
diff --git a/src/mongo/db/pipeline/stub_mongo_process_interface.h b/src/mongo/db/pipeline/stub_mongo_process_interface.h
index bdcea8dcd48..fd733087b18 100644
--- a/src/mongo/db/pipeline/stub_mongo_process_interface.h
+++ b/src/mongo/db/pipeline/stub_mongo_process_interface.h
@@ -169,7 +169,13 @@ public:
MONGO_UNREACHABLE;
}
- void closeBackupCursor(OperationContext* opCtx, UUID backupId) final {
+ void closeBackupCursor(OperationContext* opCtx, const UUID& backupId) final {
+ MONGO_UNREACHABLE;
+ }
+
+ BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) final {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/storage/backup_cursor_hooks.cpp b/src/mongo/db/storage/backup_cursor_hooks.cpp
index 06bf9e4f358..5ad3ef93107 100644
--- a/src/mongo/db/storage/backup_cursor_hooks.cpp
+++ b/src/mongo/db/storage/backup_cursor_hooks.cpp
@@ -82,7 +82,13 @@ BackupCursorState BackupCursorHooks::openBackupCursor(OperationContext* opCtx) {
MONGO_UNREACHABLE;
}
-void BackupCursorHooks::closeBackupCursor(OperationContext* opCtx, UUID backupId) {
+void BackupCursorHooks::closeBackupCursor(OperationContext* opCtx, const UUID& backupId) {
+ MONGO_UNREACHABLE;
+}
+
+BackupCursorExtendState BackupCursorHooks::extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo) {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/storage/backup_cursor_hooks.h b/src/mongo/db/storage/backup_cursor_hooks.h
index 658ae16370c..a130d3c27b3 100644
--- a/src/mongo/db/storage/backup_cursor_hooks.h
+++ b/src/mongo/db/storage/backup_cursor_hooks.h
@@ -64,7 +64,11 @@ public:
virtual BackupCursorState openBackupCursor(OperationContext* opCtx);
- virtual void closeBackupCursor(OperationContext* opCtx, UUID backupId);
+ virtual void closeBackupCursor(OperationContext* opCtx, const UUID& backupId);
+
+ virtual BackupCursorExtendState extendBackupCursor(OperationContext* opCtx,
+ const UUID& backupId,
+ const Timestamp& extendTo);
virtual bool isBackupCursorOpen() const;
};
diff --git a/src/mongo/db/storage/backup_cursor_state.h b/src/mongo/db/storage/backup_cursor_state.h
index be4b43f7e19..0777c3c2a49 100644
--- a/src/mongo/db/storage/backup_cursor_state.h
+++ b/src/mongo/db/storage/backup_cursor_state.h
@@ -44,4 +44,8 @@ struct BackupCursorState {
std::vector<std::string> filenames;
};
+struct BackupCursorExtendState {
+ std::vector<std::string> filenames;
+};
+
} // namespace mongo