summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2019-11-07 20:49:43 +0000
committerevergreen <evergreen@mongodb.com>2019-11-07 20:49:43 +0000
commiteda99cf7ca668908e5eb0498845b0270265c44e7 (patch)
treef49af824740d3ca8b00441db64026da4309e6f0f /src/mongo/db
parenta74075b0e459a9e92319602192eaef1e6b1ba2dd (diff)
downloadmongo-eda99cf7ca668908e5eb0498845b0270265c44e7.tar.gz
SERVER-43589 Failpoint to log TLA+ trace events
Diffstat (limited to 'src/mongo/db')
-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
3 files changed, 100 insertions, 1 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