summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2019-03-13 21:34:34 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2019-03-15 13:52:00 -0400
commitc346f2db39f1ddae16ecf8643041e19a31a83d84 (patch)
treeebaaafca11d49aacf77c55448c63bb9d0ba1fd98 /src/mongo/db
parent4cfb6cd851ef56c8e33bb0587567e9b91153c0de (diff)
downloadmongo-c346f2db39f1ddae16ecf8643041e19a31a83d84.tar.gz
SERVER-39942 Extract transaction library from catalog_raii library.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/SConscript45
-rw-r--r--src/mongo/db/db_raii.cpp6
-rw-r--r--src/mongo/db/ops/SConscript1
-rw-r--r--src/mongo/db/read_concern_mongod.cpp1
-rw-r--r--src/mongo/db/s/SConscript2
5 files changed, 33 insertions, 22 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index a9389aaad96..b9146fca1d1 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -709,6 +709,23 @@ env.Library(
target='catalog_raii',
source=[
'catalog_raii.cpp',
+ ],
+ LIBDEPS=[
+ 'catalog/collection',
+ 'catalog/uuid_catalog',
+ 'concurrency/lock_manager',
+ 'namespace_string',
+ 'views/views',
+ ],
+ LIBDEPS_PRIVATE=[
+ 'catalog/database_holder',
+ 's/sharding_api_d',
+ ]
+)
+
+env.Library(
+ target='transaction',
+ source=[
'retryable_writes_stats.cpp',
'server_transactions_metrics.cpp',
'session_catalog_mongod.cpp',
@@ -721,30 +738,23 @@ env.Library(
env.Idlc('transactions_stats.idl')[0],
],
LIBDEPS=[
- '$BUILD_DIR/mongo/idl/idl_parser',
- 'catalog/collection',
- 'catalog/database_holder',
- 'catalog/uuid_catalog',
- 'commands/test_commands_enabled',
'commands/txn_cmd_request',
- 'concurrency/lock_manager',
- 'curop_failpoint_helpers',
- 'curop_metrics',
- 'dbdirectclient',
- 'index/index_access_method',
- 'namespace_string',
'repl/oplog_entry',
'repl/oplog_shim',
- 's/sharding_api_d',
'session_catalog',
- 'stats/fill_locker_info',
- 'stats/top',
- 'views/views',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/util/concurrency/thread_pool',
+ '$BUILD_DIR/mongo/idl/idl_parser',
'$BUILD_DIR/mongo/idl/server_parameter',
+ '$BUILD_DIR/mongo/util/concurrency/thread_pool',
+ 'catalog_raii',
'commands/server_status',
+ 'commands/test_commands_enabled',
+ 'curop_failpoint_helpers',
+ 'dbdirectclient',
+ 'index/index_access_method',
+ 'stats/fill_locker_info',
+ 'stats/top',
'update/update_driver',
]
)
@@ -901,6 +911,7 @@ env.Library(
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/auth/authprivilege',
'$BUILD_DIR/mongo/db/command_can_run_here',
+ '$BUILD_DIR/mongo/db/curop_metrics',
'$BUILD_DIR/mongo/db/ops/write_ops_exec',
'$BUILD_DIR/mongo/db/rw_concern_d',
'$BUILD_DIR/mongo/db/s/sharding_api_d',
@@ -1109,6 +1120,7 @@ env.Library(
"$BUILD_DIR/mongo/s/grid",
"catalog_raii",
"curop",
+ "concurrency/write_conflict_exception",
"repl/repl_coordinator_interface",
"repl/speculative_majority_read_info",
"s/sharding_api_d",
@@ -1248,6 +1260,7 @@ env.Library(
'curop',
'cursor_server_params',
'db_raii',
+ 'transaction',
'dbdirectclient',
'exec/scoped_timer',
'exec/working_set',
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index cf87b7be354..dd48bc7c36e 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -39,7 +39,6 @@
#include "mongo/db/db_raii_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/db/transaction_participant.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -331,9 +330,8 @@ OldClientContext::~OldClientContext() {
LockMode getLockModeForQuery(OperationContext* opCtx, const boost::optional<NamespaceString>& nss) {
invariant(opCtx);
- // Use IX locks for autocommit:false multi-statement transactions; otherwise, use IS locks.
- auto txnParticipant = TransactionParticipant::get(opCtx);
- if (txnParticipant && txnParticipant.inMultiDocumentTransaction()) {
+ // Use IX locks for multi-statement transactions; otherwise, use IS locks.
+ if (opCtx->getWriteUnitOfWork()) {
uassert(51071,
"Cannot query system.views within a transaction",
!nss || !nss->isSystemDotViews());
diff --git a/src/mongo/db/ops/SConscript b/src/mongo/db/ops/SConscript
index 3141a119179..cc55c458903 100644
--- a/src/mongo/db/ops/SConscript
+++ b/src/mongo/db/ops/SConscript
@@ -14,6 +14,7 @@ env.Library(
'$BUILD_DIR/mongo/db/catalog_raii',
'$BUILD_DIR/mongo/db/catalog/collection_options',
'$BUILD_DIR/mongo/db/curop',
+ '$BUILD_DIR/mongo/db/curop_metrics',
'$BUILD_DIR/mongo/db/repl/oplog',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/stats/counters',
diff --git a/src/mongo/db/read_concern_mongod.cpp b/src/mongo/db/read_concern_mongod.cpp
index 2b06367f1bc..f3cb33c24dd 100644
--- a/src/mongo/db/read_concern_mongod.cpp
+++ b/src/mongo/db/read_concern_mongod.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/repl/speculative_majority_read_info.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/transaction_participant.h"
#include "mongo/s/grid.h"
#include "mongo/util/concurrency/notification.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index 0644f90e1ce..9fba1966671 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -129,7 +129,7 @@ env.Library(
env.Idlc('transaction_coordinator_document.idl')[0],
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/db/catalog_raii',
+ '$BUILD_DIR/mongo/db/transaction',
'$BUILD_DIR/mongo/db/commands/txn_cmd_request',
'$BUILD_DIR/mongo/db/dbdirectclient',
'$BUILD_DIR/mongo/db/rw_concern_d',