summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/SConscript14
-rw-r--r--src/mongo/db/repl/tla_plus_trace_repl.cpp44
-rw-r--r--src/mongo/db/repl/tla_plus_trace_repl.h43
-rw-r--r--src/mongo/logger/log_component.cpp4
-rw-r--r--src/mongo/logger/log_component.h3
5 files changed, 106 insertions, 2 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index a0659443834..93d8db2fea0 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -550,6 +550,18 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/commands/mongod_fsync',
'replication_auth',
+ 'tla_plus_trace_repl',
+ ],
+)
+
+env.Library(
+ target='tla_plus_trace_repl',
+ source=[
+ 'tla_plus_trace_repl.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/util/fail_point',
],
)
@@ -938,7 +950,7 @@ env.Library(
'$BUILD_DIR/mongo/client/clientdriver_network',
'$BUILD_DIR/mongo/util/concurrency/thread_pool',
'$BUILD_DIR/mongo/util/net/network',
- ],
+ ],
LIBDEPS_PRIVATE=[
'repl_server_parameters',
'replication_auth',
diff --git a/src/mongo/db/repl/tla_plus_trace_repl.cpp b/src/mongo/db/repl/tla_plus_trace_repl.cpp
new file mode 100644
index 00000000000..31a345daf83
--- /dev/null
+++ b/src/mongo/db/repl/tla_plus_trace_repl.cpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2019-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kTlaPlusTrace
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/tla_plus_trace_repl.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+namespace repl {
+
+MONGO_FAIL_POINT_DEFINE(logForTLAPlusSpecs)
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/tla_plus_trace_repl.h b/src/mongo/db/repl/tla_plus_trace_repl.h
new file mode 100644
index 00000000000..bf0e9412601
--- /dev/null
+++ b/src/mongo/db/repl/tla_plus_trace_repl.h
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2019-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/util/fail_point.h"
+
+namespace mongo {
+namespace repl {
+
+/*
+ * Log execution traces so we can compare MongoDB's implementation to our TLA+ specs.
+ */
+extern FailPoint logForTLAPlusSpecs;
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/logger/log_component.cpp b/src/mongo/logger/log_component.cpp
index ec389788d43..56a93625b23 100644
--- a/src/mongo/logger/log_component.cpp
+++ b/src/mongo/logger/log_component.cpp
@@ -146,6 +146,8 @@ StringData LogComponent::toStringData() const {
return "transaction"_sd;
case kConnectionPool:
return "connectionPool"_sd;
+ case kTlaPlusTrace:
+ return "tlaPlusTrace"_sd;
case kNumLogComponents:
return "total"_sd;
// No default. Compiler should complain if there's a log component that's not handled.
@@ -234,6 +236,8 @@ StringData LogComponent::getNameForLog() const {
return "TXN "_sd;
case kConnectionPool:
return "CONNPOOL"_sd;
+ case kTlaPlusTrace:
+ return "TLA_PLUS"_sd;
case kNumLogComponents:
return "TOTAL "_sd;
// No default. Compiler should complain if there's a log component that's not handled.
diff --git a/src/mongo/logger/log_component.h b/src/mongo/logger/log_component.h
index 50b07b55283..324c36ed55c 100644
--- a/src/mongo/logger/log_component.h
+++ b/src/mongo/logger/log_component.h
@@ -71,7 +71,8 @@ public:
kTracking,
kTransaction,
kConnectionPool,
- kNumLogComponents
+ kTlaPlusTrace,
+ kNumLogComponents,
};
/* implicit */ LogComponent(Value value) : _value(value) {}