summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/health_log.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/catalog/health_log.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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