summaryrefslogtreecommitdiff
path: root/src/mongo/db/ftdc
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-09-14 15:10:22 -0400
committerMathias Stearn <mathias@10gen.com>2016-09-16 16:52:29 -0400
commit91ab6853106b59f9583df7eb14716a8ec932c216 (patch)
tree38326a331e51f8b642618b8cf2133cd2694b9050 /src/mongo/db/ftdc
parentdc83fb0433fcae6e72f035df7458473b59223eb5 (diff)
downloadmongo-91ab6853106b59f9583df7eb14716a8ec932c216.tar.gz
SERVER-26005 FTDC shouldn't conflict with secondary batch application
Diffstat (limited to 'src/mongo/db/ftdc')
-rw-r--r--src/mongo/db/ftdc/collector.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/ftdc/collector.cpp b/src/mongo/db/ftdc/collector.cpp
index 8a391598f79..611f12dff5a 100644
--- a/src/mongo/db/ftdc/collector.cpp
+++ b/src/mongo/db/ftdc/collector.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/ftdc/constants.h"
#include "mongo/db/ftdc/util.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/time_support.h"
namespace mongo {
@@ -61,6 +62,12 @@ std::tuple<BSONObj, Date_t> FTDCCollectorCollection::collect(Client* client) {
builder.appendDate(kFTDCCollectStartField, start);
+ // All collectors should be ok seeing the inconsistent states in the middle of replication
+ // batches. This is desirable because we want to be able to collect data in the middle of
+ // batches that are taking a long time.
+ auto txn = client->makeOperationContext();
+ txn->lockState()->setShouldConflictWithSecondaryBatchApplication(false);
+
for (auto& collector : _collectors) {
BSONObjBuilder subObjBuilder(builder.subobjStart(collector->name()));
@@ -77,10 +84,7 @@ std::tuple<BSONObj, Date_t> FTDCCollectorCollection::collect(Client* client) {
subObjBuilder.appendDate(kFTDCCollectStartField, now);
{
- // Create a operation context per command so that we do not share operation contexts
- // across multiple command invocations.
- auto txn = client->makeOperationContext();
-
+ ScopedTransaction st(txn.get(), MODE_IS);
collector->collect(txn.get(), subObjBuilder);
}