summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/health_log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/health_log.cpp')
-rw-r--r--src/mongo/db/catalog/health_log.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/health_log.cpp b/src/mongo/db/catalog/health_log.cpp
index 9626d456111..aa49302f169 100644
--- a/src/mongo/db/catalog/health_log.cpp
+++ b/src/mongo/db/catalog/health_log.cpp
@@ -27,14 +27,19 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/db/catalog/health_log.h"
#include "mongo/db/catalog/health_log_gen.h"
+#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/namespace_string.h"
namespace mongo {
namespace {
+const ServiceContext::Decoration<HealthLog> getHealthLog =
+ ServiceContext::declareDecoration<HealthLog>();
+
const int64_t kDefaultHealthlogSize = 100'000'000;
CollectionOptions getOptions(void) {
@@ -46,17 +51,24 @@ CollectionOptions getOptions(void) {
}
} // namespace
-HealthLog::HealthLog()
- : _writer(NamespaceString::kLocalHealthLogNamespace, getOptions(), kMaxBufferSize) {}
+HealthLog::HealthLog() : _writer(nss, getOptions(), kMaxBufferSize) {}
-void HealthLog::startup() {
+void HealthLog::startup(void) {
_writer.startup(std::string("healthlog writer"));
}
-void HealthLog::shutdown() {
+void HealthLog::shutdown(void) {
_writer.shutdown();
}
+HealthLog& HealthLog::get(ServiceContext* svcCtx) {
+ return getHealthLog(svcCtx);
+}
+
+HealthLog& HealthLog::get(OperationContext* opCtx) {
+ return getHealthLog(opCtx->getServiceContext());
+}
+
bool HealthLog::log(const HealthLogEntry& entry) {
BSONObjBuilder builder;
OID oid;
@@ -65,4 +77,6 @@ bool HealthLog::log(const HealthLogEntry& entry) {
entry.serialize(&builder);
return _writer.insertDocument(builder.obj());
}
+
+const NamespaceString HealthLog::nss("local", "system.healthlog");
} // namespace mongo