summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2014-05-15 13:26:48 -0400
committerHari Khalsa <hkhalsa@10gen.com>2014-05-15 13:56:05 -0400
commit4de88387eec6c0bb08b10d0ba1574a656f56232d (patch)
tree7fdc9a0acd251b5b8b0a8f3de45ce1c2ecf7e94c /src/mongo/db
parent71cbb04eb8262b0bdf255056f26101466c11b43d (diff)
downloadmongo-4de88387eec6c0bb08b10d0ba1574a656f56232d.tar.gz
SERVER-13641 rename TransactionExperiment to OperationContext
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/auth_index_d.cpp6
-rw-r--r--src/mongo/db/auth/auth_index_d.h4
-rw-r--r--src/mongo/db/catalog/collection.cpp38
-rw-r--r--src/mongo/db/catalog/collection.h42
-rw-r--r--src/mongo/db/catalog/database.cpp32
-rw-r--r--src/mongo/db/catalog/database.h28
-rw-r--r--src/mongo/db/catalog/database_holder.cpp4
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp36
-rw-r--r--src/mongo/db/catalog/index_catalog.h38
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.cpp8
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.h6
-rw-r--r--src/mongo/db/catalog/index_create.cpp10
-rw-r--r--src/mongo/db/catalog/index_create.h8
-rw-r--r--src/mongo/db/client.cpp2
-rw-r--r--src/mongo/db/clientcursor.cpp2
-rw-r--r--src/mongo/db/cloner.cpp24
-rw-r--r--src/mongo/db/cloner.h12
-rw-r--r--src/mongo/db/commands.cpp4
-rw-r--r--src/mongo/db/commands.h10
-rw-r--r--src/mongo/db/commands/apply_ops.cpp4
-rw-r--r--src/mongo/db/commands/auth_schema_upgrade_d.cpp2
-rw-r--r--src/mongo/db/commands/authentication_commands.cpp6
-rw-r--r--src/mongo/db/commands/authentication_commands.h2
-rw-r--r--src/mongo/db/commands/cleanup_orphaned_cmd.cpp4
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp8
-rw-r--r--src/mongo/db/commands/compact.cpp4
-rw-r--r--src/mongo/db/commands/connection_status.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp4
-rw-r--r--src/mongo/db/commands/dbhash.cpp2
-rw-r--r--src/mongo/db/commands/dbhash.h2
-rw-r--r--src/mongo/db/commands/distinct.cpp2
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp8
-rw-r--r--src/mongo/db/commands/fail_point_cmd.cpp2
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp8
-rw-r--r--src/mongo/db/commands/fsync.cpp2
-rw-r--r--src/mongo/db/commands/geonear.cpp2
-rw-r--r--src/mongo/db/commands/get_last_error.cpp6
-rw-r--r--src/mongo/db/commands/group.cpp2
-rw-r--r--src/mongo/db/commands/hashcmd.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.h2
-rw-r--r--src/mongo/db/commands/index_stats.cpp2
-rw-r--r--src/mongo/db/commands/isself.cpp2
-rw-r--r--src/mongo/db/commands/merge_chunks_cmd.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp8
-rw-r--r--src/mongo/db/commands/mr.h6
-rw-r--r--src/mongo/db/commands/oplog_note.cpp2
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp2
-rw-r--r--src/mongo/db/commands/parameters.cpp4
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands.h2
-rw-r--r--src/mongo/db/commands/rename_collection.cpp6
-rw-r--r--src/mongo/db/commands/server_status.cpp2
-rw-r--r--src/mongo/db/commands/shutdown.h2
-rw-r--r--src/mongo/db/commands/storage_details.cpp4
-rw-r--r--src/mongo/db/commands/test_commands.cpp10
-rw-r--r--src/mongo/db/commands/touch.cpp4
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp38
-rw-r--r--src/mongo/db/commands/validate.cpp4
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.cpp28
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.h6
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp2
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.h2
-rw-r--r--src/mongo/db/db.cpp10
-rw-r--r--src/mongo/db/dbcommands.cpp38
-rw-r--r--src/mongo/db/dbcommands_admin.cpp2
-rw-r--r--src/mongo/db/dbcommands_generic.cpp22
-rw-r--r--src/mongo/db/dbeval.cpp2
-rw-r--r--src/mongo/db/dbhelpers.cpp14
-rw-r--r--src/mongo/db/dbhelpers.h14
-rw-r--r--src/mongo/db/dbwebserver.cpp18
-rw-r--r--src/mongo/db/dbwebserver.h6
-rw-r--r--src/mongo/db/driverHelpers.cpp2
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp2
-rw-r--r--src/mongo/db/fts/fts_command.cpp2
-rw-r--r--src/mongo/db/fts/fts_command.h2
-rw-r--r--src/mongo/db/geo/haystack.cpp2
-rw-r--r--src/mongo/db/index/btree_based_access_method.cpp16
-rw-r--r--src/mongo/db/index/btree_based_access_method.h14
-rw-r--r--src/mongo/db/index/btree_based_bulk_access_method.cpp6
-rw-r--r--src/mongo/db/index/btree_based_bulk_access_method.h16
-rw-r--r--src/mongo/db/index/index_access_method.h16
-rw-r--r--src/mongo/db/index_builder.cpp6
-rw-r--r--src/mongo/db/index_builder.h4
-rw-r--r--src/mongo/db/index_rebuilder.cpp4
-rw-r--r--src/mongo/db/instance.cpp34
-rw-r--r--src/mongo/db/instance.h10
-rw-r--r--src/mongo/db/introspect.cpp6
-rw-r--r--src/mongo/db/introspect.h6
-rw-r--r--src/mongo/db/operation_context.h (renamed from src/mongo/db/storage/transaction.h)25
-rw-r--r--src/mongo/db/operation_context_impl.cpp (renamed from src/mongo/db/storage/mmap_v1/dur_transaction.cpp)16
-rw-r--r--src/mongo/db/operation_context_impl.h (renamed from src/mongo/db/storage/mmap_v1/dur_transaction.h)15
-rw-r--r--src/mongo/db/ops/delete.cpp2
-rw-r--r--src/mongo/db/ops/delete.h4
-rw-r--r--src/mongo/db/ops/delete_executor.cpp2
-rw-r--r--src/mongo/db/ops/delete_executor.h4
-rw-r--r--src/mongo/db/ops/update.cpp6
-rw-r--r--src/mongo/db/ops/update.h6
-rw-r--r--src/mongo/db/ops/update_executor.cpp2
-rw-r--r--src/mongo/db/ops/update_executor.h4
-rw-r--r--src/mongo/db/pdfile.cpp8
-rw-r--r--src/mongo/db/pdfile.h6
-rw-r--r--src/mongo/db/query/new_find.cpp4
-rw-r--r--src/mongo/db/query/new_find.h4
-rw-r--r--src/mongo/db/range_deleter.cpp10
-rw-r--r--src/mongo/db/range_deleter.h10
-rw-r--r--src/mongo/db/range_deleter_db_env.cpp2
-rw-r--r--src/mongo/db/range_deleter_db_env.h2
-rw-r--r--src/mongo/db/range_deleter_mock_env.cpp2
-rw-r--r--src/mongo/db/range_deleter_mock_env.h2
-rw-r--r--src/mongo/db/range_deleter_stat_test.cpp10
-rw-r--r--src/mongo/db/range_deleter_test.cpp20
-rw-r--r--src/mongo/db/repair_database.cpp6
-rw-r--r--src/mongo/db/repair_database.h4
-rw-r--r--src/mongo/db/repl/consensus.cpp4
-rw-r--r--src/mongo/db/repl/heartbeat.cpp2
-rw-r--r--src/mongo/db/repl/master_slave.cpp24
-rw-r--r--src/mongo/db/repl/master_slave.h16
-rw-r--r--src/mongo/db/repl/oplog.cpp24
-rw-r--r--src/mongo/db/repl/oplog.h6
-rw-r--r--src/mongo/db/repl/repl_settings.cpp2
-rw-r--r--src/mongo/db/repl/replset_commands.cpp18
-rw-r--r--src/mongo/db/repl/replset_web_handler.cpp2
-rw-r--r--src/mongo/db/repl/resync.cpp4
-rw-r--r--src/mongo/db/repl/rs.cpp10
-rw-r--r--src/mongo/db/repl/rs_config.cpp6
-rw-r--r--src/mongo/db/repl/rs_initialsync.cpp6
-rw-r--r--src/mongo/db/repl/rs_initiate.cpp2
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp4
-rw-r--r--src/mongo/db/repl/rs_sync.cpp4
-rw-r--r--src/mongo/db/repl/sync.cpp4
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp4
-rw-r--r--src/mongo/db/repl/sync_tail.cpp4
-rw-r--r--src/mongo/db/restapi.cpp2
-rw-r--r--src/mongo/db/stats/top.cpp2
-rw-r--r--src/mongo/db/storage/data_file.cpp12
-rw-r--r--src/mongo/db/storage/data_file.h12
-rw-r--r--src/mongo/db/storage/extent_manager.h10
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp24
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h24
-rw-r--r--src/mongo/db/structure/btree/btree_interface.cpp14
-rw-r--r--src/mongo/db/structure/btree/btree_interface.h10
-rw-r--r--src/mongo/db/structure/btree/btree_logic.cpp54
-rw-r--r--src/mongo/db/structure/btree/btree_logic.h56
-rw-r--r--src/mongo/db/structure/capped_callback.h4
-rw-r--r--src/mongo/db/structure/catalog/hashtab.h6
-rw-r--r--src/mongo/db/structure/catalog/namespace_details.cpp52
-rw-r--r--src/mongo/db/structure/catalog/namespace_details.h56
-rw-r--r--src/mongo/db/structure/catalog/namespace_details_rsv1_metadata.h20
-rw-r--r--src/mongo/db/structure/catalog/namespace_index.cpp12
-rw-r--r--src/mongo/db/structure/catalog/namespace_index.h14
-rw-r--r--src/mongo/db/structure/collection_compact.cpp4
-rw-r--r--src/mongo/db/structure/head_manager.h4
-rw-r--r--src/mongo/db/structure/record_store.h18
-rw-r--r--src/mongo/db/structure/record_store_heap.cpp18
-rw-r--r--src/mongo/db/structure/record_store_heap.h18
-rw-r--r--src/mongo/db/structure/record_store_v1_base.cpp18
-rw-r--r--src/mongo/db/structure/record_store_v1_base.h42
-rw-r--r--src/mongo/db/structure/record_store_v1_capped.cpp32
-rw-r--r--src/mongo/db/structure/record_store_v1_capped.h30
-rw-r--r--src/mongo/db/structure/record_store_v1_capped_test.cpp4
-rw-r--r--src/mongo/db/structure/record_store_v1_simple.cpp16
-rw-r--r--src/mongo/db/structure/record_store_v1_simple.h14
-rw-r--r--src/mongo/db/structure/record_store_v1_simple_test.cpp30
-rw-r--r--src/mongo/db/structure/record_store_v1_test_help.cpp38
-rw-r--r--src/mongo/db/structure/record_store_v1_test_help.h38
-rw-r--r--src/mongo/db/ttl.cpp4
168 files changed, 919 insertions, 923 deletions
diff --git a/src/mongo/db/auth/auth_index_d.cpp b/src/mongo/db/auth/auth_index_d.cpp
index 09c289b70c7..2b510698b60 100644
--- a/src/mongo/db/auth/auth_index_d.cpp
+++ b/src/mongo/db/auth/auth_index_d.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
@@ -84,7 +84,7 @@ namespace {
// Make sure the old unique index from v2.4 on system.users doesn't exist.
Client::WriteContext wctx(systemUsers);
- DurTransaction txn;
+ OperationContextImpl txn;
Collection* collection = wctx.ctx().db()->getCollection(NamespaceString(systemUsers));
if (!collection) {
return;
@@ -97,7 +97,7 @@ namespace {
}
}
- void createSystemIndexes(TransactionExperiment* txn, Collection* collection) {
+ void createSystemIndexes(OperationContext* txn, Collection* collection) {
invariant( collection );
const NamespaceString& ns = collection->ns();
if (ns == AuthorizationManager::usersCollectionNamespace) {
diff --git a/src/mongo/db/auth/auth_index_d.h b/src/mongo/db/auth/auth_index_d.h
index 09547a1f47c..3d3cf711e40 100644
--- a/src/mongo/db/auth/auth_index_d.h
+++ b/src/mongo/db/auth/auth_index_d.h
@@ -33,7 +33,7 @@
namespace mongo {
class Collection;
- class TransactionExperiment;
+ class OperationContext;
namespace authindex {
@@ -41,7 +41,7 @@ namespace authindex {
* Creates the appropriate indexes on _new_ system collections supporting authentication and
* authorization.
*/
- void createSystemIndexes(TransactionExperiment* txn, Collection* collection);
+ void createSystemIndexes(OperationContext* txn, Collection* collection);
/**
* Ensures that exactly the appropriate indexes to support authentication and authorization
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 531f59eeccf..245d34fa151 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/ops/update.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/structure/catalog/namespace_details_rsv1_metadata.h"
#include "mongo/db/structure/record_store_v1_capped.h"
@@ -76,7 +76,7 @@ namespace mongo {
// ----
- Collection::Collection( TransactionExperiment* txn,
+ Collection::Collection( OperationContext* txn,
const StringData& fullNS,
NamespaceDetails* details,
Database* database )
@@ -169,7 +169,7 @@ namespace mongo {
return BSONObj( rec->data() );
}
- StatusWith<DiskLoc> Collection::insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> Collection::insertDocument( OperationContext* txn,
const DocWriter* doc,
bool enforceQuota ) {
verify( _indexCatalog.numIndexesTotal() == 0 ); // eventually can implement, just not done
@@ -185,7 +185,7 @@ namespace mongo {
return StatusWith<DiskLoc>( loc );
}
- StatusWith<DiskLoc> Collection::insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> Collection::insertDocument( OperationContext* txn,
const BSONObj& docToInsert,
bool enforceQuota ) {
if ( _indexCatalog.findIdIndex() ) {
@@ -211,7 +211,7 @@ namespace mongo {
return status;
}
- StatusWith<DiskLoc> Collection::insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> Collection::insertDocument( OperationContext* txn,
const BSONObj& doc,
MultiIndexBlock& indexBlock ) {
StatusWith<DiskLoc> loc = _recordStore->insertRecord( txn,
@@ -234,7 +234,7 @@ namespace mongo {
}
- StatusWith<DiskLoc> Collection::_insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> Collection::_insertDocument( OperationContext* txn,
const BSONObj& docToInsert,
bool enforceQuota ) {
@@ -271,7 +271,7 @@ namespace mongo {
return loc;
}
- Status Collection::aboutToDeleteCapped( TransactionExperiment* txn, const DiskLoc& loc ) {
+ Status Collection::aboutToDeleteCapped( OperationContext* txn, const DiskLoc& loc ) {
BSONObj doc = docFor( loc );
@@ -283,7 +283,7 @@ namespace mongo {
return Status::OK();
}
- void Collection::deleteDocument( TransactionExperiment* txn,
+ void Collection::deleteDocument( OperationContext* txn,
const DiskLoc& loc,
bool cappedOK,
bool noWarn,
@@ -316,7 +316,7 @@ namespace mongo {
Counter64 moveCounter;
ServerStatusMetricField<Counter64> moveCounterDisplay( "record.moves", &moveCounter );
- StatusWith<DiskLoc> Collection::updateDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> Collection::updateDocument( OperationContext* txn,
const DiskLoc& oldLocation,
const BSONObj& objNew,
bool enforceQuota,
@@ -431,7 +431,7 @@ namespace mongo {
return StatusWith<DiskLoc>( oldLocation );
}
- Status Collection::updateDocumentWithDamages( TransactionExperiment* txn,
+ Status Collection::updateDocumentWithDamages( OperationContext* txn,
const DiskLoc& loc,
const char* damangeSource,
const mutablebson::DamageVector& damages ) {
@@ -466,7 +466,7 @@ namespace mongo {
return _database->getExtentManager();
}
- void Collection::increaseStorageSize(TransactionExperiment* txn, int size, bool enforceQuota) {
+ void Collection::increaseStorageSize(OperationContext* txn, int size, bool enforceQuota) {
_recordStore->increaseStorageSize(txn, size, enforceQuota ? largestFileNumberInQuota() : 0);
}
@@ -513,7 +513,7 @@ namespace mongo {
* 3) truncate record store
* 4) re-write indexes
*/
- Status Collection::truncate(TransactionExperiment* txn) {
+ Status Collection::truncate(OperationContext* txn) {
massert( 17445, "index build in progress", _indexCatalog.numIndexesInProgress() == 0 );
// 1) store index specs
@@ -548,7 +548,7 @@ namespace mongo {
return Status::OK();
}
- void Collection::temp_cappedTruncateAfter(TransactionExperiment* txn,
+ void Collection::temp_cappedTruncateAfter(OperationContext* txn,
DiskLoc end,
bool inclusive) {
invariant( isCapped() );
@@ -572,7 +572,7 @@ namespace mongo {
};
}
- Status Collection::validate( TransactionExperiment* txn,
+ Status Collection::validate( OperationContext* txn,
bool full, bool scanData,
ValidateResults* results, BSONObjBuilder* output ){
@@ -614,7 +614,7 @@ namespace mongo {
return Status::OK();
}
- Status Collection::touch( TransactionExperiment* txn,
+ Status Collection::touch( OperationContext* txn,
bool touchData, bool touchIndexes,
BSONObjBuilder* output ) const {
if ( touchData ) {
@@ -647,21 +647,21 @@ namespace mongo {
return _details->isUserFlagSet( flag );
}
- bool Collection::setUserFlag( TransactionExperiment* txn, int flag ) {
+ bool Collection::setUserFlag( OperationContext* txn, int flag ) {
if ( !_details->setUserFlag( txn, flag ) )
return false;
_syncUserFlags(txn);
return true;
}
- bool Collection::clearUserFlag( TransactionExperiment* txn, int flag ) {
+ bool Collection::clearUserFlag( OperationContext* txn, int flag ) {
if ( !_details->clearUserFlag( txn, flag ) )
return false;
_syncUserFlags(txn);
return true;
}
- void Collection::_syncUserFlags(TransactionExperiment* txn) {
+ void Collection::_syncUserFlags(OperationContext* txn) {
if ( _ns.coll() == "system.namespaces" )
return;
string system_namespaces = _ns.getSisterNS( "system.namespaces" );
@@ -687,7 +687,7 @@ namespace mongo {
}
- void Collection::setMaxCappedDocs( TransactionExperiment* txn, long long max ) {
+ void Collection::setMaxCappedDocs( OperationContext* txn, long long max ) {
_details->setMaxCappedDocs( txn, max );
}
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index 32d34ff5f46..8cccf53dc4a 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -51,7 +51,7 @@ namespace mongo {
class NamespaceDetails;
class IndexCatalog;
class MultiIndexBlock;
- class TransactionExperiment;
+ class OperationContext;
class RecordIterator;
class FlatIterator;
@@ -102,7 +102,7 @@ namespace mongo {
*/
class Collection : CappedDocumentDeleteCallback {
public:
- Collection( TransactionExperiment* txn,
+ Collection( OperationContext* txn,
const StringData& fullNS,
NamespaceDetails* details,
Database* database );
@@ -154,7 +154,7 @@ namespace mongo {
*/
int64_t countTableScan( const MatchExpression* expression );
- void deleteDocument( TransactionExperiment* txn,
+ void deleteDocument( OperationContext* txn,
const DiskLoc& loc,
bool cappedOK = false,
bool noWarn = false,
@@ -164,15 +164,15 @@ namespace mongo {
* this does NOT modify the doc before inserting
* i.e. will not add an _id field for documents that are missing it
*/
- StatusWith<DiskLoc> insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> insertDocument( OperationContext* txn,
const BSONObj& doc,
bool enforceQuota );
- StatusWith<DiskLoc> insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> insertDocument( OperationContext* txn,
const DocWriter* doc,
bool enforceQuota );
- StatusWith<DiskLoc> insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> insertDocument( OperationContext* txn,
const BSONObj& doc,
MultiIndexBlock& indexBlock );
@@ -182,7 +182,7 @@ namespace mongo {
* if not, it is moved
* @return the post update location of the doc (may or may not be the same as oldLocation)
*/
- StatusWith<DiskLoc> updateDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> updateDocument( OperationContext* txn,
const DiskLoc& oldLocation,
const BSONObj& newDoc,
bool enforceQuota,
@@ -191,21 +191,21 @@ namespace mongo {
/**
* right now not allowed to modify indexes
*/
- Status updateDocumentWithDamages( TransactionExperiment* txn,
+ Status updateDocumentWithDamages( OperationContext* txn,
const DiskLoc& loc,
const char* damangeSource,
const mutablebson::DamageVector& damages );
// -----------
- StatusWith<CompactStats> compact(TransactionExperiment* txn, const CompactOptions* options);
+ StatusWith<CompactStats> compact(OperationContext* txn, const CompactOptions* options);
/**
* removes all documents as fast as possible
* indexes before and after will be the same
* as will other characteristics
*/
- Status truncate(TransactionExperiment* txn);
+ Status truncate(OperationContext* txn);
/**
* @param full - does more checks
@@ -214,14 +214,14 @@ namespace mongo {
* OK will be returned even if corruption is found
* deatils will be in result
*/
- Status validate( TransactionExperiment* txn,
+ Status validate( OperationContext* txn,
bool full, bool scanData,
ValidateResults* results, BSONObjBuilder* output );
/**
* forces data into cache
*/
- Status touch( TransactionExperiment* txn,
+ Status touch( OperationContext* txn,
bool touchData, bool touchIndexes,
BSONObjBuilder* output ) const;
@@ -232,7 +232,7 @@ namespace mongo {
* @param inclusive - Truncate 'end' as well iff true
* XXX: this will go away soon, just needed to move for now
*/
- void temp_cappedTruncateAfter( TransactionExperiment* txn, DiskLoc end, bool inclusive );
+ void temp_cappedTruncateAfter( OperationContext* txn, DiskLoc end, bool inclusive );
// -----------
@@ -241,7 +241,7 @@ namespace mongo {
// this will add a new extent the collection
// the new extent will be returned
// it will have been added to the linked list already
- void increaseStorageSize( TransactionExperiment* txn, int size, bool enforceQuota );
+ void increaseStorageSize( OperationContext* txn, int size, bool enforceQuota );
//
// Stats
@@ -268,33 +268,33 @@ namespace mongo {
// TODO(erh) - below till next mark are suspect
bool isUserFlagSet( int flag ) const;
- bool setUserFlag( TransactionExperiment* txn, int flag );
- bool clearUserFlag( TransactionExperiment* txn, int flag );
+ bool setUserFlag( OperationContext* txn, int flag );
+ bool clearUserFlag( OperationContext* txn, int flag );
- void setMaxCappedDocs( TransactionExperiment* txn, long long max );
+ void setMaxCappedDocs( OperationContext* txn, long long max );
// --- end suspect things
private:
- Status aboutToDeleteCapped( TransactionExperiment* txn, const DiskLoc& loc );
+ Status aboutToDeleteCapped( OperationContext* txn, const DiskLoc& loc );
/**
* same semantics as insertDocument, but doesn't do:
* - some user error checks
* - adjust padding
*/
- StatusWith<DiskLoc> _insertDocument( TransactionExperiment* txn,
+ StatusWith<DiskLoc> _insertDocument( OperationContext* txn,
const BSONObj& doc,
bool enforceQuota );
- void _compactExtent(TransactionExperiment* txn,
+ void _compactExtent(OperationContext* txn,
const DiskLoc diskloc,
int extentNumber,
MultiIndexBlock& indexesToInsertTo,
const CompactOptions* compactOptions,
CompactStats* stats );
- void _syncUserFlags(TransactionExperiment* txn); // TODO: this is bizarre, should go away
+ void _syncUserFlags(OperationContext* txn); // TODO: this is bizarre, should go away
// @return 0 for inf., otherwise a number of files
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 7db74ef24c8..8e1c28b7d82 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/storage/data_file.h"
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/structure/catalog/namespace_details.h"
@@ -196,7 +196,7 @@ namespace mongo {
return Status::OK();
}
- Database::Database(TransactionExperiment* txn, const char *nm, bool& newDb, const string& path )
+ Database::Database(OperationContext* txn, const char *nm, bool& newDb, const string& path )
: _name(nm), _path(path),
_namespaceIndex( _path, _name ),
_extentManager(new MmapV1ExtentManager(_name, _path, storageGlobalParams.directoryperdb)),
@@ -299,7 +299,7 @@ namespace mongo {
// todo : we stop once a datafile dne.
// if one datafile were missing we should keep going for
// repair purposes yet we do not.
- void Database::openAllFiles(TransactionExperiment* txn) {
+ void Database::openAllFiles(OperationContext* txn) {
verify(this);
Status s = _extentManager->init(txn);
if ( !s.isOK() ) {
@@ -307,7 +307,7 @@ namespace mongo {
}
}
- void Database::clearTmpCollections(TransactionExperiment* txn) {
+ void Database::clearTmpCollections(OperationContext* txn) {
Lock::assertWriteLocked( _name );
@@ -353,7 +353,7 @@ namespace mongo {
void Database::flushFiles( bool sync ) { return _extentManager->flushFiles( sync ); }
- bool Database::setProfilingLevel( TransactionExperiment* txn, int newLevel , string& errmsg ) {
+ bool Database::setProfilingLevel( OperationContext* txn, int newLevel , string& errmsg ) {
if ( _profile == newLevel )
return true;
@@ -374,7 +374,7 @@ namespace mongo {
return true;
}
- Status Database::dropCollection( TransactionExperiment* txn, const StringData& fullns ) {
+ Status Database::dropCollection( OperationContext* txn, const StringData& fullns ) {
LOG(1) << "dropCollection: " << fullns << endl;
massertNamespaceNotIndex( fullns, "dropCollection" );
@@ -467,11 +467,11 @@ namespace mongo {
}
Collection* Database::getCollection( const StringData& ns ) {
- DurTransaction txn; // TODO remove once we require reads to have transactions
+ OperationContextImpl txn; // TODO remove once we require reads to have transactions
return getCollection(&txn, ns);
}
- Collection* Database::getCollection( TransactionExperiment* txn, const StringData& ns ) {
+ Collection* Database::getCollection( OperationContext* txn, const StringData& ns ) {
verify( _name == nsToDatabaseSubstring( ns ) );
scoped_lock lk( _collectionLock );
@@ -504,7 +504,7 @@ namespace mongo {
- Status Database::renameCollection( TransactionExperiment* txn,
+ Status Database::renameCollection( OperationContext* txn,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp ) {
@@ -574,7 +574,7 @@ namespace mongo {
return Status::OK();
}
- Status Database::_renameSingleNamespace( TransactionExperiment* txn,
+ Status Database::_renameSingleNamespace( OperationContext* txn,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp ) {
@@ -660,10 +660,10 @@ namespace mongo {
}
Collection* Database::getOrCreateCollection( const StringData& ns ) {
- DurTransaction txn; // TODO remove once we require reads to have transactions
+ OperationContextImpl txn; // TODO remove once we require reads to have transactions
return getOrCreateCollection(&txn, ns);
}
- Collection* Database::getOrCreateCollection(TransactionExperiment* txn, const StringData& ns) {
+ Collection* Database::getOrCreateCollection(OperationContext* txn, const StringData& ns) {
Collection* c = getCollection( txn, ns );
if ( !c ) {
c = createCollection( txn, ns );
@@ -681,7 +681,7 @@ namespace mongo {
}
}
- Collection* Database::createCollection( TransactionExperiment* txn,
+ Collection* Database::createCollection( OperationContext* txn,
const StringData& ns,
const CollectionOptions& options,
bool allocateDefaultSpace,
@@ -777,7 +777,7 @@ namespace mongo {
}
- void Database::_addNamespaceToCatalog( TransactionExperiment* txn,
+ void Database::_addNamespaceToCatalog( OperationContext* txn,
const StringData& ns,
const BSONObj* options ) {
LOG(1) << "Database::_addNamespaceToCatalog ns: " << ns << endl;
@@ -799,7 +799,7 @@ namespace mongo {
uassertStatusOK( loc.getStatus() );
}
- Status Database::_dropNS( TransactionExperiment* txn, const StringData& ns ) {
+ Status Database::_dropNS( OperationContext* txn, const StringData& ns ) {
NamespaceDetails* d = _namespaceIndex.details( ns );
if ( !d )
@@ -833,7 +833,7 @@ namespace mongo {
*minor = 0;
return;
}
- DurTransaction txn; // TODO get rid of this once reads need transactions
+ OperationContextImpl txn; // TODO get rid of this once reads need transactions
const DataFile* df = _extentManager->getFile( &txn, 0 );
*major = df->getHeader()->version;
*minor = df->getHeader()->versionMinor;
diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h
index 4e0b61903a2..206d28db060 100644
--- a/src/mongo/db/catalog/database.h
+++ b/src/mongo/db/catalog/database.h
@@ -43,7 +43,7 @@ namespace mongo {
class IndexCatalog;
class MmapV1ExtentManager;
class NamespaceDetails;
- class TransactionExperiment;
+ class OperationContext;
struct CollectionOptions {
CollectionOptions() {
@@ -98,7 +98,7 @@ namespace mongo {
class Database {
public:
// you probably need to be in dbHolderMutex when constructing this
- Database(TransactionExperiment* txn,
+ Database(OperationContext* txn,
const char *nm,
/*out*/ bool& newDb,
const string& path = storageGlobalParams.dbpath);
@@ -111,7 +111,7 @@ namespace mongo {
const string& name() const { return _name; }
const string& path() const { return _path; }
- void clearTmpCollections(TransactionExperiment* txn);
+ void clearTmpCollections(OperationContext* txn);
/**
* tries to make sure that this hasn't been deleted
@@ -132,7 +132,7 @@ namespace mongo {
/**
* @return true if success. false if bad level or error creating profile ns
*/
- bool setProfilingLevel( TransactionExperiment* txn, int newLevel , string& errmsg );
+ bool setProfilingLevel( OperationContext* txn, int newLevel , string& errmsg );
void flushFiles( bool sync );
@@ -156,9 +156,9 @@ namespace mongo {
MmapV1ExtentManager* getExtentManager() { return _extentManager.get(); }
const MmapV1ExtentManager* getExtentManager() const { return _extentManager.get(); }
- Status dropCollection( TransactionExperiment* txn, const StringData& fullns );
+ Status dropCollection( OperationContext* txn, const StringData& fullns );
- Collection* createCollection( TransactionExperiment* txn,
+ Collection* createCollection( OperationContext* txn,
const StringData& ns,
const CollectionOptions& options = CollectionOptions(),
bool allocateSpace = true,
@@ -173,16 +173,16 @@ namespace mongo {
Collection* getCollection( const NamespaceString& ns ) { return getCollection( ns.ns() ); }
- Collection* getCollection( TransactionExperiment* txn, const StringData& ns );
+ Collection* getCollection( OperationContext* txn, const StringData& ns );
- Collection* getCollection( TransactionExperiment* txn, const NamespaceString& ns ) {
+ Collection* getCollection( OperationContext* txn, const NamespaceString& ns ) {
return getCollection( txn, ns.ns() );
}
Collection* getOrCreateCollection( const StringData& ns );
- Collection* getOrCreateCollection( TransactionExperiment* txn, const StringData& ns );
+ Collection* getOrCreateCollection( OperationContext* txn, const StringData& ns );
- Status renameCollection( TransactionExperiment* txn,
+ Status renameCollection( OperationContext* txn,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp );
@@ -205,7 +205,7 @@ namespace mongo {
~Database(); // closes files and other cleanup see below.
- void _addNamespaceToCatalog( TransactionExperiment* txn,
+ void _addNamespaceToCatalog( OperationContext* txn,
const StringData& ns,
const BSONObj* options );
@@ -216,7 +216,7 @@ namespace mongo {
* removes from NamespaceIndex
* NOT RIGHT NOW, removes cache entry in Database TODO?
*/
- Status _dropNS( TransactionExperiment* txn, const StringData& ns );
+ Status _dropNS( OperationContext* txn, const StringData& ns );
/**
* @throws DatabaseDifferCaseCode if the name is a duplicate based on
@@ -224,9 +224,9 @@ namespace mongo {
*/
void checkDuplicateUncasedNames(bool inholderlockalready) const;
- void openAllFiles(TransactionExperiment* txn);
+ void openAllFiles(OperationContext* txn);
- Status _renameSingleNamespace( TransactionExperiment* txn,
+ Status _renameSingleNamespace( OperationContext* txn,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp );
diff --git a/src/mongo/db/catalog/database_holder.cpp b/src/mongo/db/catalog/database_holder.cpp
index bb057697455..a944ce18631 100644
--- a/src/mongo/db/catalog/database_holder.cpp
+++ b/src/mongo/db/catalog/database_holder.cpp
@@ -36,12 +36,12 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/d_concurrency.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
Database* DatabaseHolder::getOrCreate( const string& ns, const string& path, bool& justCreated ) {
- DurTransaction txn; // TODO get rid of this once reads require transactions
+ OperationContextImpl txn; // TODO get rid of this once reads require transactions
string dbname = _todb( ns );
{
SimpleMutex::scoped_lock lk(_m);
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 5dcef027e66..9453f0351a6 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/storage/data_file.h"
#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/structure/catalog/namespace_details_rsv1_metadata.h"
#include "mongo/db/structure/record_store_v1_simple.h"
@@ -92,7 +92,7 @@ namespace mongo {
_magic = 123456;
}
- Status IndexCatalog::init(TransactionExperiment* txn) {
+ Status IndexCatalog::init(OperationContext* txn) {
NamespaceDetails::IndexIterator ii = _details->ii(true);
while ( ii.more() ) {
@@ -125,7 +125,7 @@ namespace mongo {
return Status::OK();
}
- IndexCatalogEntry* IndexCatalog::_setupInMemoryStructures(TransactionExperiment* txn,
+ IndexCatalogEntry* IndexCatalog::_setupInMemoryStructures(OperationContext* txn,
IndexDescriptor* descriptor) {
auto_ptr<IndexDescriptor> descriptorCleanup( descriptor );
@@ -242,7 +242,7 @@ namespace mongo {
// ---------------------------
- Status IndexCatalog::_upgradeDatabaseMinorVersionIfNeeded( TransactionExperiment* txn,
+ Status IndexCatalog::_upgradeDatabaseMinorVersionIfNeeded( OperationContext* txn,
const string& newPluginName ) {
// first check if requested index requires pdfile minor version to be bumped
@@ -307,7 +307,7 @@ namespace mongo {
return StatusWith<BSONObj>( fixed );
}
- Status IndexCatalog::createIndex( TransactionExperiment* txn,
+ Status IndexCatalog::createIndex( OperationContext* txn,
BSONObj spec,
bool mayInterrupt,
ShutdownBehavior shutdownBehavior ) {
@@ -398,7 +398,7 @@ namespace mongo {
}
}
- IndexCatalog::IndexBuildBlock::IndexBuildBlock(TransactionExperiment* txn,
+ IndexCatalog::IndexBuildBlock::IndexBuildBlock(OperationContext* txn,
Collection* collection,
const BSONObj& spec )
: _collection( collection ),
@@ -715,7 +715,7 @@ namespace mongo {
return Status::OK();
}
- Status IndexCatalog::ensureHaveIdIndex(TransactionExperiment* txn) {
+ Status IndexCatalog::ensureHaveIdIndex(OperationContext* txn) {
if ( haveIdIndex() )
return Status::OK();
@@ -735,7 +735,7 @@ namespace mongo {
return s;
}
- Status IndexCatalog::dropAllIndexes(TransactionExperiment* txn,
+ Status IndexCatalog::dropAllIndexes(OperationContext* txn,
bool includingIdIndex) {
Lock::assertWriteLocked( _collection->_database->name() );
@@ -819,7 +819,7 @@ namespace mongo {
return Status::OK();
}
- Status IndexCatalog::dropIndex(TransactionExperiment* txn,
+ Status IndexCatalog::dropIndex(OperationContext* txn,
IndexDescriptor* desc ) {
Lock::assertWriteLocked( _collection->_database->name() );
@@ -834,7 +834,7 @@ namespace mongo {
return _dropIndex(txn, entry);
}
- Status IndexCatalog::_dropIndex(TransactionExperiment* txn,
+ Status IndexCatalog::_dropIndex(OperationContext* txn,
IndexCatalogEntry* entry ) {
/**
* IndexState in order
@@ -901,7 +901,7 @@ namespace mongo {
return Status::OK();
}
- void IndexCatalog::_deleteIndexFromDisk( TransactionExperiment* txn,
+ void IndexCatalog::_deleteIndexFromDisk( OperationContext* txn,
const string& indexName,
const string& indexNamespace,
int idxNo ) {
@@ -927,7 +927,7 @@ namespace mongo {
wassert( n == 1 );
}
- int IndexCatalog::_removeFromSystemIndexes(TransactionExperiment* txn,
+ int IndexCatalog::_removeFromSystemIndexes(OperationContext* txn,
const StringData& indexName) {
BSONObjBuilder b;
b.append( "ns", _collection->ns() );
@@ -942,7 +942,7 @@ namespace mongo {
true ) );
}
- vector<BSONObj> IndexCatalog::getAndClearUnfinishedIndexes(TransactionExperiment* txn) {
+ vector<BSONObj> IndexCatalog::getAndClearUnfinishedIndexes(OperationContext* txn) {
vector<BSONObj> toReturn = _unfinishedIndexes;
_unfinishedIndexes.clear();
for ( size_t i = 0; i < toReturn.size(); i++ ) {
@@ -963,7 +963,7 @@ namespace mongo {
return toReturn;
}
- void IndexCatalog::updateTTLSetting( TransactionExperiment* txn,
+ void IndexCatalog::updateTTLSetting( OperationContext* txn,
const IndexDescriptor* idx,
long long newExpireSeconds ) {
IndexDetails* indexDetails = _getIndexDetails( idx );
@@ -1177,7 +1177,7 @@ namespace mongo {
// ---------------------------
- Status IndexCatalog::_indexRecord(TransactionExperiment* txn,
+ Status IndexCatalog::_indexRecord(OperationContext* txn,
IndexCatalogEntry* index,
const BSONObj& obj,
const DiskLoc &loc ) {
@@ -1194,7 +1194,7 @@ namespace mongo {
return index->accessMethod()->insert(txn, obj, loc, options, &inserted);
}
- Status IndexCatalog::_unindexRecord(TransactionExperiment* txn,
+ Status IndexCatalog::_unindexRecord(OperationContext* txn,
IndexCatalogEntry* index,
const BSONObj& obj,
const DiskLoc &loc,
@@ -1215,7 +1215,7 @@ namespace mongo {
}
- void IndexCatalog::indexRecord(TransactionExperiment* txn,
+ void IndexCatalog::indexRecord(OperationContext* txn,
const BSONObj& obj,
const DiskLoc &loc ) {
@@ -1256,7 +1256,7 @@ namespace mongo {
}
- void IndexCatalog::unindexRecord(TransactionExperiment* txn,
+ void IndexCatalog::unindexRecord(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
bool noWarn) {
diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index a0c802f3b40..7cfb607ca06 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -35,7 +35,7 @@
#include "mongo/db/catalog/index_catalog_entry.h"
#include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/platform/unordered_map.h"
namespace mongo {
@@ -58,7 +58,7 @@ namespace mongo {
~IndexCatalog();
// must be called before used
- Status init(TransactionExperiment* txn);
+ Status init(OperationContext* txn);
bool ok() const;
@@ -136,31 +136,31 @@ namespace mongo {
// ---- index set modifiers ------
- Status ensureHaveIdIndex(TransactionExperiment* txn);
+ Status ensureHaveIdIndex(OperationContext* txn);
enum ShutdownBehavior {
SHUTDOWN_CLEANUP, // fully clean up this build
SHUTDOWN_LEAVE_DIRTY // leave as if kill -9 happened, so have to deal with on restart
};
- Status createIndex( TransactionExperiment* txn,
+ Status createIndex( OperationContext* txn,
BSONObj spec,
bool mayInterrupt,
ShutdownBehavior shutdownBehavior = SHUTDOWN_CLEANUP );
StatusWith<BSONObj> prepareSpecForCreate( const BSONObj& original ) const;
- Status dropAllIndexes(TransactionExperiment* txn,
+ Status dropAllIndexes(OperationContext* txn,
bool includingIdIndex );
- Status dropIndex(TransactionExperiment* txn,
+ Status dropIndex(OperationContext* txn,
IndexDescriptor* desc );
/**
* will drop all incompleted indexes and return specs
* after this, the indexes can be rebuilt
*/
- vector<BSONObj> getAndClearUnfinishedIndexes(TransactionExperiment* txn);
+ vector<BSONObj> getAndClearUnfinishedIndexes(OperationContext* txn);
struct IndexKillCriteria {
@@ -182,7 +182,7 @@ namespace mongo {
* The specified index must already contain an expireAfterSeconds field, and the value in
* that field and newExpireSecs must both be numeric.
*/
- void updateTTLSetting( TransactionExperiment* txn,
+ void updateTTLSetting( OperationContext* txn,
const IndexDescriptor* idx,
long long newExpireSeconds );
@@ -202,7 +202,7 @@ namespace mongo {
*/
class IndexBuildBlock {
public:
- IndexBuildBlock(TransactionExperiment* txn,
+ IndexBuildBlock(OperationContext* txn,
Collection* collection,
const BSONObj& spec );
@@ -239,15 +239,15 @@ namespace mongo {
IndexCatalogEntry* _entry;
bool _inProgress;
- TransactionExperiment* _txn;
+ OperationContext* _txn;
};
// ----- data modifiers ------
// this throws for now
- void indexRecord(TransactionExperiment* txn, const BSONObj& obj, const DiskLoc &loc);
+ void indexRecord(OperationContext* txn, const BSONObj& obj, const DiskLoc &loc);
- void unindexRecord(TransactionExperiment* txn,
+ void unindexRecord(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
bool noWarn);
@@ -264,7 +264,7 @@ namespace mongo {
return _getAccessMethodName( keyPattern );
}
- Status _upgradeDatabaseMinorVersionIfNeeded( TransactionExperiment* txn,
+ Status _upgradeDatabaseMinorVersionIfNeeded( OperationContext* txn,
const string& newPluginName );
// public static helpers
@@ -278,7 +278,7 @@ namespace mongo {
IndexAccessMethod* _createAccessMethod( const IndexDescriptor* desc,
IndexCatalogEntry* entry );
- int _removeFromSystemIndexes(TransactionExperiment* txn,
+ int _removeFromSystemIndexes(OperationContext* txn,
const StringData& indexName );
bool _shouldOverridePlugin( const BSONObj& keyPattern ) const;
@@ -299,12 +299,12 @@ namespace mongo {
// meaning we shouldn't modify catalog
Status _checkUnfinished() const;
- Status _indexRecord(TransactionExperiment* txn,
+ Status _indexRecord(OperationContext* txn,
IndexCatalogEntry* index,
const BSONObj& obj,
const DiskLoc &loc );
- Status _unindexRecord(TransactionExperiment* txn,
+ Status _unindexRecord(OperationContext* txn,
IndexCatalogEntry* index,
const BSONObj& obj,
const DiskLoc &loc,
@@ -313,18 +313,18 @@ namespace mongo {
/**
* this does no sanity checks
*/
- Status _dropIndex(TransactionExperiment* txn,
+ Status _dropIndex(OperationContext* txn,
IndexCatalogEntry* entry );
// just does disk hanges
// doesn't change memory state, etc...
- void _deleteIndexFromDisk( TransactionExperiment* txn,
+ void _deleteIndexFromDisk( OperationContext* txn,
const string& indexName,
const string& indexNamespace,
int idxNo );
// descriptor ownership passes to _setupInMemoryStructures
- IndexCatalogEntry* _setupInMemoryStructures(TransactionExperiment* txn,
+ IndexCatalogEntry* _setupInMemoryStructures(OperationContext* txn,
IndexDescriptor* descriptor );
static BSONObj _fixIndexSpec( const BSONObj& spec );
diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp
index e0c8c0eb746..ed84e9414fe 100644
--- a/src/mongo/db/catalog/index_catalog_entry.cpp
+++ b/src/mongo/db/catalog/index_catalog_entry.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/structure/head_manager.h"
@@ -47,7 +47,7 @@ namespace mongo {
return _catalogEntry->head();
}
- void setHead(TransactionExperiment* txn, const DiskLoc& newHead) {
+ void setHead(OperationContext* txn, const DiskLoc& newHead) {
_catalogEntry->setHead(txn, newHead);
}
@@ -109,7 +109,7 @@ namespace mongo {
verify( isReady() == newIsReady );
}
- void IndexCatalogEntry::setHead( TransactionExperiment* txn, DiskLoc newHead ) {
+ void IndexCatalogEntry::setHead( OperationContext* txn, DiskLoc newHead ) {
NamespaceDetails* nsd = _collection->detailsWritable();
int idxNo = _indexNo();
IndexDetails& id = nsd->idx( idxNo );
@@ -117,7 +117,7 @@ namespace mongo {
_head = newHead;
}
- void IndexCatalogEntry::setMultikey( TransactionExperiment* txn ) {
+ void IndexCatalogEntry::setMultikey( OperationContext* txn ) {
if ( isMultikey() )
return;
NamespaceDetails* nsd = _collection->detailsWritable();
diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h
index 6c8bf38d919..e5b835405be 100644
--- a/src/mongo/db/catalog/index_catalog_entry.h
+++ b/src/mongo/db/catalog/index_catalog_entry.h
@@ -43,7 +43,7 @@ namespace mongo {
class IndexAccessMethod;
class IndexDescriptor;
class RecordStore;
- class TransactionExperiment;
+ class OperationContext;
class IndexCatalogEntry {
MONGO_DISALLOW_COPYING( IndexCatalogEntry );
@@ -73,7 +73,7 @@ namespace mongo {
const DiskLoc& head() const;
- void setHead( TransactionExperiment* txn, DiskLoc newHead );
+ void setHead( OperationContext* txn, DiskLoc newHead );
void setIsReady( bool newIsReady );
@@ -83,7 +83,7 @@ namespace mongo {
bool isMultikey() const;
- void setMultikey( TransactionExperiment* txn );
+ void setMultikey( OperationContext* txn );
// if this ready is ready for queries
bool isReady() const;
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index a33fe7ff9d8..b62d9d1f849 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/repl/is_master.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/catalog/index_details.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/util/processinfo.h"
@@ -55,7 +55,7 @@ namespace mongo {
/**
* Add the provided (obj, dl) pair to the provided index.
*/
- static void addKeysToIndex(TransactionExperiment* txn,
+ static void addKeysToIndex(OperationContext* txn,
Collection* collection,
const IndexDescriptor* descriptor,
IndexAccessMethod* accessMethod,
@@ -76,7 +76,7 @@ namespace mongo {
uassertStatusOK( ret );
}
- unsigned long long addExistingToIndex( TransactionExperiment* txn,
+ unsigned long long addExistingToIndex( OperationContext* txn,
Collection* collection,
const IndexDescriptor* descriptor,
IndexAccessMethod* accessMethod,
@@ -185,7 +185,7 @@ namespace mongo {
// ---------------------------
// throws DBException
- void buildAnIndex( TransactionExperiment* txn,
+ void buildAnIndex( OperationContext* txn,
Collection* collection,
IndexCatalogEntry* btreeState,
bool mayInterrupt ) {
@@ -296,7 +296,7 @@ namespace mongo {
// ----------------------------
- MultiIndexBlock::MultiIndexBlock(TransactionExperiment* txn, Collection* collection)
+ MultiIndexBlock::MultiIndexBlock(OperationContext* txn, Collection* collection)
: _collection(collection), _txn(txn) {
}
diff --git a/src/mongo/db/catalog/index_create.h b/src/mongo/db/catalog/index_create.h
index bc2681465d8..0bfd413c935 100644
--- a/src/mongo/db/catalog/index_create.h
+++ b/src/mongo/db/catalog/index_create.h
@@ -43,12 +43,12 @@ namespace mongo {
class BSONObj;
class Collection;
class IndexCatalogEntry;
- class TransactionExperiment;
+ class OperationContext;
// Build an index in the foreground
// If background is false, uses fast index builder
// If background is true, uses background index builder; blocks until done.
- void buildAnIndex( TransactionExperiment* txn,
+ void buildAnIndex( OperationContext* txn,
Collection* collection,
IndexCatalogEntry* btreeState,
bool mayInterrupt );
@@ -56,7 +56,7 @@ namespace mongo {
class MultiIndexBlock {
MONGO_DISALLOW_COPYING( MultiIndexBlock );
public:
- MultiIndexBlock(TransactionExperiment* txn,
+ MultiIndexBlock(OperationContext* txn,
Collection* collection );
~MultiIndexBlock();
@@ -86,7 +86,7 @@ namespace mongo {
std::vector<IndexState> _states;
// Not owned here, must outlive 'this'
- TransactionExperiment* _txn;
+ OperationContext* _txn;
};
} // namespace mongo
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index b55666dc070..5d1a1494901 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -383,7 +383,7 @@ namespace mongo {
actions.addAction(ActionType::internal);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
Client& c = cc();
c.gotHandshake( cmdObj );
return 1;
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp
index 7495146e4db..65e79b52c5b 100644
--- a/src/mongo/db/clientcursor.cpp
+++ b/src/mongo/db/clientcursor.cpp
@@ -257,7 +257,7 @@ namespace mongo {
actions.addAction(ActionType::cursorInfo);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result,
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result,
bool fromRepl ) {
_appendCursorStats( result );
return true;
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 2bdc738a52b..03b2efa4d4c 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -52,7 +52,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplogreader.h"
#include "mongo/db/pdfile.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
namespace mongo {
@@ -96,7 +96,7 @@ namespace mongo {
Cloner::Cloner() { }
struct Cloner::Fun {
- Fun( TransactionExperiment* txn, Client::Context& ctx )
+ Fun( OperationContext* txn, Client::Context& ctx )
:lastLog(0),
txn(txn),
context(ctx)
@@ -176,7 +176,7 @@ namespace mongo {
}
time_t lastLog;
- TransactionExperiment* txn;
+ OperationContext* txn;
Client::Context& context;
int64_t numSeen;
@@ -193,7 +193,7 @@ namespace mongo {
/* copy the specified collection
isindex - if true, this is system.indexes collection, in which we do some transformation when copying.
*/
- void Cloner::copy(TransactionExperiment* txn,
+ void Cloner::copy(OperationContext* txn,
Client::Context& ctx,
const char *from_collection,
const char *to_collection,
@@ -277,7 +277,7 @@ namespace mongo {
return true;
}
- bool Cloner::copyCollectionFromRemote(TransactionExperiment* txn,
+ bool Cloner::copyCollectionFromRemote(OperationContext* txn,
const string& host,
const string& ns,
string& errmsg) {
@@ -291,7 +291,7 @@ namespace mongo {
return cloner.copyCollection(txn, ns, BSONObj(), errmsg, true, false, true, false);
}
- bool Cloner::copyCollection(TransactionExperiment* txn,
+ bool Cloner::copyCollection(OperationContext* txn,
const string& ns,
const BSONObj& query,
string& errmsg,
@@ -334,7 +334,7 @@ namespace mongo {
extern bool inDBRepair;
- bool Cloner::go(TransactionExperiment* txn,
+ bool Cloner::go(OperationContext* txn,
Client::Context& context,
const string& masterHost,
const CloneOptions& opts,
@@ -513,7 +513,7 @@ namespace mongo {
return true;
}
- bool Cloner::cloneFrom(TransactionExperiment* txn,
+ bool Cloner::cloneFrom(OperationContext* txn,
Client::Context& context,
const string& masterHost,
const CloneOptions& options,
@@ -558,7 +558,7 @@ namespace mongo {
return Status::OK();
}
CmdClone() : Command("clone") { }
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string from = cmdObj.getStringField("clone");
if ( from.empty() )
return false;
@@ -629,7 +629,7 @@ namespace mongo {
"is placed at the same db.collection (namespace) as the source.\n"
;
}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string fromhost = cmdObj.getStringField("from");
if ( fromhost.empty() ) {
errmsg = "missing 'from' parameter";
@@ -696,7 +696,7 @@ namespace mongo {
help << "get a nonce for subsequent copy db request from secure server\n";
help << "usage: {copydbgetnonce: 1, fromhost: <hostname>}";
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string fromhost = cmdObj.getStringField("fromhost");
if ( fromhost.empty() ) {
/* copy from self */
@@ -780,7 +780,7 @@ namespace mongo {
help << "usage: {copydb: 1, fromhost: <connection string>, fromdb: <db>, todb: <db>"
<< "[, slaveOk: <bool>, username: <username>, nonce: <nonce>, key: <key>]}";
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string fromhost = cmdObj.getStringField("fromhost");
bool fromSelf = fromhost.empty();
if ( fromSelf ) {
diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h
index 1cd9e06989f..4c1abbf6c42 100644
--- a/src/mongo/db/cloner.h
+++ b/src/mongo/db/cloner.h
@@ -40,7 +40,7 @@ namespace mongo {
class DBClientBase;
class DBClientCursor;
class Query;
- class TransactionExperiment;
+ class OperationContext;
class Cloner: boost::noncopyable {
public:
@@ -55,14 +55,14 @@ namespace mongo {
void setConnection( DBClientBase *c ) { _conn.reset( c ); }
/** copy the entire database */
- bool go(TransactionExperiment* txn,
+ bool go(OperationContext* txn,
Client::Context& ctx,
const string& masterHost,
const CloneOptions& opts,
set<string>* clonedColls,
string& errmsg, int *errCode = 0);
- bool copyCollection(TransactionExperiment* txn,
+ bool copyCollection(OperationContext* txn,
const string& ns,
const BSONObj& query,
string& errmsg,
@@ -85,7 +85,7 @@ namespace mongo {
* Currently this will only be set if there is an error in the initial
* system.namespaces query.
*/
- static bool cloneFrom(TransactionExperiment* txn,
+ static bool cloneFrom(OperationContext* txn,
Client::Context& context,
const string& masterHost,
const CloneOptions& options,
@@ -96,11 +96,11 @@ namespace mongo {
/**
* Copy a collection (and indexes) from a remote host
*/
- static bool copyCollectionFromRemote(TransactionExperiment* txn,
+ static bool copyCollectionFromRemote(OperationContext* txn,
const string& host, const string& ns, string& errmsg);
private:
- void copy(TransactionExperiment* txn,
+ void copy(OperationContext* txn,
Client::Context& ctx,
const char *from_ns,
const char *to_ns,
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index af626452997..6d2dc6a1433 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -336,7 +336,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) {
shardConnectionPool.flush();
pool.flush();
return true;
@@ -359,7 +359,7 @@ namespace mongo {
actions.addAction(ActionType::connPoolStats);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) {
pool.appendInfo( result );
result.append( "numDBClientConnection" , DBClientConnection::getNumConnections() );
result.append( "numAScopedConnection" , AScopedConnection::getNumConnections() );
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index c9c5920126d..6a8363f7ba4 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -33,7 +33,7 @@ namespace mongo {
class Client;
class Database;
class Timer;
- class TransactionExperiment;
+ class OperationContext;
namespace mutablebson {
class Document;
@@ -72,7 +72,7 @@ namespace mutablebson {
return value is true if succeeded. if false, set errmsg text.
*/
- virtual bool run(TransactionExperiment* txn,
+ virtual bool run(OperationContext* txn,
const string& db,
BSONObj& cmdObj,
int options,
@@ -198,7 +198,7 @@ namespace mutablebson {
int queryOptions = 0);
static Command * findCommand( const string& name );
// For mongod and webserver.
- static void execCommand(TransactionExperiment* txn,
+ static void execCommand(OperationContext* txn,
Command* c,
Client& client,
int queryOptions,
@@ -207,7 +207,7 @@ namespace mutablebson {
BSONObjBuilder& result,
bool fromRepl );
// For mongos
- static void execCommandClientBasic(TransactionExperiment* txn,
+ static void execCommandClientBasic(OperationContext* txn,
Command* c,
ClientBasic& client,
int queryOptions,
@@ -251,7 +251,7 @@ namespace mutablebson {
bool fromRepl);
};
- bool _runCommands(TransactionExperiment* txn,
+ bool _runCommands(OperationContext* txn,
const char* ns,
BSONObj& jsobj,
BufBuilder& b,
diff --git a/src/mongo/db/commands/apply_ops.cpp b/src/mongo/db/commands/apply_ops.cpp
index 285c83c7186..82e0b4d5c4d 100644
--- a/src/mongo/db/commands/apply_ops.cpp
+++ b/src/mongo/db/commands/apply_ops.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/instance.h"
#include "mongo/db/matcher/matcher.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
class ApplyOpsCmd : public Command {
@@ -59,7 +59,7 @@ namespace mongo {
// applyOps can do pretty much anything, so require all privileges.
RoleGraph::generateUniversalPrivileges(out);
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if ( cmdObj.firstElement().type() != Array ) {
errmsg = "ops has to be an array";
diff --git a/src/mongo/db/commands/auth_schema_upgrade_d.cpp b/src/mongo/db/commands/auth_schema_upgrade_d.cpp
index bd27c4a68b1..90384c524fa 100644
--- a/src/mongo/db/commands/auth_schema_upgrade_d.cpp
+++ b/src/mongo/db/commands/auth_schema_upgrade_d.cpp
@@ -113,7 +113,7 @@ namespace {
class CmdAuthSchemaUpgradeD : public CmdAuthSchemaUpgrade {
virtual bool run(
- TransactionExperiment* txn,
+ OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int options,
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp
index 249fc0d93e4..8cd8b7afb2f 100644
--- a/src/mongo/db/commands/authentication_commands.cpp
+++ b/src/mongo/db/commands/authentication_commands.cpp
@@ -99,7 +99,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
nonce64 n = getNextNonce();
stringstream ss;
ss << hex << n;
@@ -133,7 +133,7 @@ namespace mongo {
}
}
- bool CmdAuthenticate::run(TransactionExperiment* txn, const string& dbname,
+ bool CmdAuthenticate::run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
@@ -351,7 +351,7 @@ namespace mongo {
void help(stringstream& h) const { h << "de-authenticate"; }
virtual bool isWriteCommandForConfigServer() const { return false; }
CmdLogout() : Command("logout") {}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h
index 4c6a2420695..0b4b0a3242a 100644
--- a/src/mongo/db/commands/authentication_commands.h
+++ b/src/mongo/db/commands/authentication_commands.h
@@ -51,7 +51,7 @@ namespace mongo {
virtual void redactForLogging(mutablebson::Document* cmdObj);
CmdAuthenticate() : Command("authenticate") {}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
index fa9330d358e..dac324345bd 100644
--- a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
@@ -61,7 +61,7 @@ namespace mongo {
*
* If the collection is not sharded, returns CleanupResult_Done.
*/
- CleanupResult cleanupOrphanedData( TransactionExperiment* txn,
+ CleanupResult cleanupOrphanedData( OperationContext* txn,
const NamespaceString& ns,
const BSONObj& startingFromKeyConst,
bool secondaryThrottle,
@@ -179,7 +179,7 @@ namespace mongo {
// Output
static BSONField<BSONObj> stoppedAtKeyField;
- bool run( TransactionExperiment* txn,
+ bool run( OperationContext* txn,
string const &db,
BSONObj &cmdObj,
int,
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index 844ec2eec8e..756569d806e 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -36,11 +36,11 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/new_find.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
- Status cloneCollectionAsCapped( TransactionExperiment* txn,
+ Status cloneCollectionAsCapped( OperationContext* txn,
Database* db,
const string& shortFrom,
const string& shortTo,
@@ -142,7 +142,7 @@ namespace mongo {
NamespaceString(dbname, collection)),
targetActions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
string from = jsobj.getStringField( "cloneCollectionAsCapped" );
string to = jsobj.getStringField( "toCollection" );
double size = jsobj.getField( "size" ).number();
@@ -196,7 +196,7 @@ namespace mongo {
return std::vector<BSONObj>();
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
// calls renamecollection which does a global lock, so we must too:
//
Lock::GlobalWrite globalWriteLock;
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index ec301bac843..14af4c56d03 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/kill_current_op.h"
#include "mongo/db/catalog/collection.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -83,7 +83,7 @@ namespace mongo {
return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
}
- virtual bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string coll = cmdObj.firstElement().valuestr();
if( coll.empty() || db.empty() ) {
errmsg = "no collection name specified";
diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp
index 1f9e9b7685e..35da228269f 100644
--- a/src/mongo/db/commands/connection_status.cpp
+++ b/src/mongo/db/commands/connection_status.cpp
@@ -46,7 +46,7 @@ namespace mongo {
h << "Returns connection-specific information such as logged-in users";
}
- bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg,
+ bool run(OperationContext* txn, const string&, BSONObj& cmdObj, int, string& errmsg,
BSONObjBuilder& result, bool fromRepl) {
AuthorizationSession* authSession =
ClientBasic::getCurrent()->getAuthorizationSession();
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 76a3c731637..978f0268863 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/s/d_logic.h"
#include "mongo/s/shard_key_pattern.h"
@@ -70,7 +70,7 @@ namespace mongo {
return b.obj();
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options,
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int options,
string& errmsg, BSONObjBuilder& result,
bool fromRepl = false ) {
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 802a99cba5f..183813f196b 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -125,7 +125,7 @@ namespace mongo {
return hash;
}
- bool DBHashCmd::run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ bool DBHashCmd::run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
Timer timer;
set<string> desiredCollections;
diff --git a/src/mongo/db/commands/dbhash.h b/src/mongo/db/commands/dbhash.h
index cb0cbdefa1c..688ccada6a5 100644
--- a/src/mongo/db/commands/dbhash.h
+++ b/src/mongo/db/commands/dbhash.h
@@ -46,7 +46,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out);
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool);
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool);
void wipeCacheForCollection( const StringData& ns );
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index 5b6888154d6..bc05c80195a 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -68,7 +68,7 @@ namespace mongo {
help << "{ distinct : 'collection name' , key : 'a.b' , query : {} }";
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result,
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result,
bool fromRepl ) {
Timer t;
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index ac9deff5ded..332da8c6e3e 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/catalog/index_key_validate.h"
#include "mongo/db/pdfile.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -92,14 +92,14 @@ namespace mongo {
}
CmdDropIndexes() : Command("dropIndexes", false, "deleteIndexes") { }
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& anObjBuilder, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& anObjBuilder, bool fromRepl) {
Lock::DBWrite dbXLock(dbname);
bool ok = wrappedRun(txn, dbname, jsobj, errmsg, anObjBuilder);
if (ok && !fromRepl)
logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj);
return ok;
}
- bool wrappedRun(TransactionExperiment* txn,
+ bool wrappedRun(OperationContext* txn,
const string& dbname,
BSONObj& jsobj,
string& errmsg,
@@ -212,7 +212,7 @@ namespace mongo {
return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
static DBDirectClient db;
BSONElement e = jsobj.firstElement();
diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp
index bcb46cc4332..aa3c79c5bcb 100644
--- a/src/mongo/db/commands/fail_point_cmd.cpp
+++ b/src/mongo/db/commands/fail_point_cmd.cpp
@@ -81,7 +81,7 @@ namespace mongo {
h << "modifies the settings of a fail point";
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index 47043005667..44ca0e36609 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/ops/update.h"
#include "mongo/db/ops/update_lifecycle_impl.h"
#include "mongo/db/query/get_runner.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -65,7 +65,7 @@ namespace mongo {
find_and_modify::addPrivilegesRequiredForFindAndModify(this, dbname, cmdObj, out);
}
/* this will eventually replace run, once sort is handled */
- bool runNoDirectClient( TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ bool runNoDirectClient( OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
verify( cmdObj["sort"].eoo() );
const string ns = dbname + '.' + cmdObj.firstElement().valuestr();
@@ -122,7 +122,7 @@ namespace mongo {
result.append( "value" , p.transform( doc ) );
}
- static bool runNoDirectClient(TransactionExperiment* txn,
+ static bool runNoDirectClient(OperationContext* txn,
const string& ns,
const BSONObj& queryOriginal,
const BSONObj& fields,
@@ -297,7 +297,7 @@ namespace mongo {
return true;
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int x, string& errmsg, BSONObjBuilder& result, bool y) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int x, string& errmsg, BSONObjBuilder& result, bool y) {
DBDirectClient db(txn);
if (cmdObj["sort"].eoo()) {
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 8837c91c05c..428dfd2cf66 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -92,7 +92,7 @@ namespace mongo {
actions.addAction(ActionType::fsync);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if (Lock::isLocked()) {
errmsg = "fsync: Cannot execute fsync command from contexts that hold a data lock";
diff --git a/src/mongo/db/commands/geonear.cpp b/src/mongo/db/commands/geonear.cpp
index 9a6582fede5..5976d8a4e3d 100644
--- a/src/mongo/db/commands/geonear.cpp
+++ b/src/mongo/db/commands/geonear.cpp
@@ -68,7 +68,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
const string ns = dbname + "." + cmdObj.firstElement().valuestr();
if (!cmdObj["start"].eoo()) {
diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp
index dde7a40e84f..31005f5e1fb 100644
--- a/src/mongo/db/commands/get_last_error.cpp
+++ b/src/mongo/db/commands/get_last_error.cpp
@@ -57,7 +57,7 @@ namespace mongo {
help << "reset error state (used with getpreverror)";
}
CmdResetError() : Command("resetError", false, "reseterror") {}
- bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
LastError *le = lastError.get();
verify( le );
le->reset();
@@ -91,7 +91,7 @@ namespace mongo {
<< " { wtimeout:m} - timeout for w in m milliseconds";
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
@@ -262,7 +262,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
CmdGetPrevError() : Command("getPrevError", false, "getpreverror") {}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
LastError *le = lastError.disableForCommand();
le->appendSelf( result );
if ( le->valid )
diff --git a/src/mongo/db/commands/group.cpp b/src/mongo/db/commands/group.cpp
index 8a1608f7e71..6e80bbef1f6 100644
--- a/src/mongo/db/commands/group.cpp
+++ b/src/mongo/db/commands/group.cpp
@@ -202,7 +202,7 @@ namespace mongo {
return true;
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
if ( !globalScriptEngine ) {
errmsg = "server-side JavaScript execution is disabled";
diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp
index cff86b33e42..8af317bf0ef 100644
--- a/src/mongo/db/commands/hashcmd.cpp
+++ b/src/mongo/db/commands/hashcmd.cpp
@@ -72,7 +72,7 @@ namespace mongo {
*> "out" : NumberLong(6271151123721111923),
*> "ok" : 1 }
**/
- bool run(TransactionExperiment* txn, const string& db,
+ bool run(OperationContext* txn, const string& db,
BSONObj& cmdObj,
int options, string& errmsg,
BSONObjBuilder& result,
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index b4d9d6c93e4..60346f782c4 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -120,7 +120,7 @@ namespace mongo {
: Command(name),
helpText(helpText) { }
- bool IndexFilterCommand::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options,
+ bool IndexFilterCommand::run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int options,
string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string ns = parseNs(dbname, cmdObj);
diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h
index ac372668769..a08ddd816db 100644
--- a/src/mongo/db/commands/index_filter_commands.h
+++ b/src/mongo/db/commands/index_filter_commands.h
@@ -63,7 +63,7 @@ namespace mongo {
* implement plan cache command functionality.
*/
- bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options,
+ bool run(OperationContext* txn, const std::string& dbname, BSONObj& cmdObj, int options,
std::string& errmsg, BSONObjBuilder& result, bool fromRepl);
virtual bool isWriteCommandForConfigServer() const;
diff --git a/src/mongo/db/commands/index_stats.cpp b/src/mongo/db/commands/index_stats.cpp
index 1b0c69e42b2..b8eba5fdce7 100644
--- a/src/mongo/db/commands/index_stats.cpp
+++ b/src/mongo/db/commands/index_stats.cpp
@@ -492,7 +492,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg,
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg,
BSONObjBuilder& result, bool fromRepl) {
NamespaceString nss( dbname, cmdObj.firstElement().valuestrsafe() );
diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp
index 8f5fc57210d..df6a9dbb26b 100644
--- a/src/mongo/db/commands/isself.cpp
+++ b/src/mongo/db/commands/isself.cpp
@@ -184,7 +184,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
init();
result.append( "id" , _id );
return true;
diff --git a/src/mongo/db/commands/merge_chunks_cmd.cpp b/src/mongo/db/commands/merge_chunks_cmd.cpp
index d7c39a6ecd5..8e9d9f38b28 100644
--- a/src/mongo/db/commands/merge_chunks_cmd.cpp
+++ b/src/mongo/db/commands/merge_chunks_cmd.cpp
@@ -80,7 +80,7 @@ namespace mongo {
static BSONField<string> shardNameField;
static BSONField<string> configField;
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 543cae19cf0..5ecd9dd52e9 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/repl/is_master.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/range_preserver.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/scripting/engine.h"
#include "mongo/s/collection_metadata.h"
@@ -664,7 +664,7 @@ namespace mongo {
_txn->commitIfNeeded();
}
- State::State(TransactionExperiment* txn, const Config& c) :
+ State::State(OperationContext* txn, const Config& c) :
_config(c),
_useIncremental(true),
_txn(txn),
@@ -1208,7 +1208,7 @@ namespace mongo {
addPrivilegesRequiredForMapReduce(this, dbname, cmdObj, out);
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmd, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmd, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
Timer t;
Client& client = cc();
CurOp * op = client.curop();
@@ -1446,7 +1446,7 @@ namespace mongo {
actions.addAction(ActionType::internal);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
ShardedConnectionInfo::addHook();
// legacy name
string shardedOutputCollection = cmdObj["shardedOutputCollection"].valuestrsafe();
diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h
index 88d114fb5b9..9eddac77efc 100644
--- a/src/mongo/db/commands/mr.h
+++ b/src/mongo/db/commands/mr.h
@@ -42,7 +42,7 @@
namespace mongo {
- class TransactionExperiment;
+ class OperationContext;
namespace mr {
@@ -239,7 +239,7 @@ namespace mongo {
/**
* txn must outlive this State.
*/
- State( TransactionExperiment* txn, const Config& c );
+ State( OperationContext* txn, const Config& c );
~State();
void init();
@@ -343,7 +343,7 @@ namespace mongo {
*/
int _add(InMemory* im , const BSONObj& a);
- TransactionExperiment* _txn;
+ OperationContext* _txn;
scoped_ptr<Scope> _scope;
bool _onDisk; // if the end result of this map reduce is disk or not
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index bd5a67fc098..e4d8924408e 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -56,7 +56,7 @@ namespace mongo {
}
return Status::OK();
}
- virtual bool run(TransactionExperiment* txn, const string& dbname,
+ virtual bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 58a530184b5..fa0939fc1f1 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -159,7 +159,7 @@ namespace mongo {
return Status(ErrorCodes::Unauthorized, "Unauthorized");
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options,
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int options,
string& errmsg, BSONObjBuilder& result,
bool fromRepl = false ) {
diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp
index af9ad7c822f..981e04c26a5 100644
--- a/src/mongo/db/commands/parameters.cpp
+++ b/src/mongo/db/commands/parameters.cpp
@@ -72,7 +72,7 @@ namespace mongo {
appendParameterNames( help );
help << "{ getParameter:'*' } to get everything\n";
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
bool all = *cmdObj.firstElement().valuestrsafe() == '*';
int before = result.len();
@@ -126,7 +126,7 @@ namespace mongo {
help << "{ setParameter:1, <param>:<value> }\n";
appendParameterNames( help );
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
int s = 0;
bool found = false;
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 34652d66daf..6967dbe51a6 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -273,7 +273,7 @@ namespace {
Pipeline::addRequiredPrivileges(this, dbname, cmdObj, out);
}
- virtual bool run(TransactionExperiment* txn, const string &db, BSONObj &cmdObj, int options, string &errmsg,
+ virtual bool run(OperationContext* txn, const string &db, BSONObj &cmdObj, int options, string &errmsg,
BSONObjBuilder &result, bool fromRepl) {
string ns = parseNs(db, cmdObj);
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index a58dcb78851..f7e97c68072 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -114,7 +114,7 @@ namespace mongo {
helpText(helpText),
actionType(actionType) { }
- bool PlanCacheCommand::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options,
+ bool PlanCacheCommand::run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int options,
string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string ns = parseNs(dbname, cmdObj);
diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h
index 1c1de2da9f5..8e7eb9667a4 100644
--- a/src/mongo/db/commands/plan_cache_commands.h
+++ b/src/mongo/db/commands/plan_cache_commands.h
@@ -58,7 +58,7 @@ namespace mongo {
* implement plan cache command functionality.
*/
- bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options,
+ bool run(OperationContext* txn, const std::string& dbname, BSONObj& cmdObj, int options,
std::string& errmsg, BSONObjBuilder& result, bool fromRepl);
virtual bool isWriteCommandForConfigServer() const;
diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp
index 196d28ae735..9f173c03d72 100644
--- a/src/mongo/db/commands/rename_collection.cpp
+++ b/src/mongo/db/commands/rename_collection.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -91,14 +91,14 @@ namespace mongo {
IndexBuilder::restoreIndexes( indexesInProg );
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
Lock::GlobalWrite globalWriteLock;
bool ok = wrappedRun(txn, dbname, cmdObj, errmsg, result, fromRepl);
if (ok && !fromRepl)
logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj);
return ok;
}
- virtual bool wrappedRun(TransactionExperiment* txn,
+ virtual bool wrappedRun(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
string& errmsg,
diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp
index 8a6923c8772..e5d9a791589 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -71,7 +71,7 @@ namespace mongo {
actions.addAction(ActionType::serverStatus);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
_runCalled = true;
diff --git a/src/mongo/db/commands/shutdown.h b/src/mongo/db/commands/shutdown.h
index 7120da6fbad..3fdf347a50a 100644
--- a/src/mongo/db/commands/shutdown.h
+++ b/src/mongo/db/commands/shutdown.h
@@ -49,7 +49,7 @@ namespace mongo {
virtual bool isWriteCommandForConfigServer() const { return false; }
virtual void help( stringstream& help ) const;
CmdShutdown() : Command("shutdown") {}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/commands/storage_details.cpp b/src/mongo/db/commands/storage_details.cpp
index 1121a3e22dd..9649cdcdfcf 100644
--- a/src/mongo/db/commands/storage_details.cpp
+++ b/src/mongo/db/commands/storage_details.cpp
@@ -323,7 +323,7 @@ namespace {
/**
* Entry point, parses command parameters and invokes runInternal.
*/
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg,
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg,
BSONObjBuilder& result, bool fromRepl);
};
@@ -756,7 +756,7 @@ namespace {
static const char* USE_ANALYZE_STR = "use {analyze: 'diskStorage' | 'pagesInRAM'}";
- bool StorageDetailsCmd::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg,
+ bool StorageDetailsCmd::run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg,
BSONObjBuilder& result, bool fromRepl) {
// { analyze: subcommand }
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 3abd64cd40d..a257aa1d335 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -55,7 +55,7 @@ namespace mongo {
virtual void help( stringstream &help ) const {
help << "internal. for testing only.";
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
string coll = cmdObj[ "godinsert" ].valuestrsafe();
log() << "test only command godinsert invoked coll:" << coll << endl;
uassert( 13049, "godinsert must specify a collection", !coll.empty() );
@@ -93,7 +93,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out) {}
CmdSleep() : Command("sleep") { }
- bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
log() << "test only command sleep invoked" << endl;
long long millis = 10 * 1000;
@@ -133,7 +133,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
string coll = cmdObj[ "captrunc" ].valuestrsafe();
uassert( 13416, "captrunc must specify a collection", !coll.empty() );
NamespaceString nss( dbname, coll );
@@ -180,7 +180,7 @@ namespace mongo {
return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string coll = cmdObj[ "emptycapped" ].valuestrsafe();
uassert( 13428, "emptycapped must specify a collection", !coll.empty() );
NamespaceString nss( dbname, coll );
diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp
index 4039d386ef4..e44a84b6bae 100644
--- a/src/mongo/db/commands/touch.cpp
+++ b/src/mongo/db/commands/touch.cpp
@@ -50,7 +50,7 @@
#include "mongo/db/pdfile.h"
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/timer.h"
#include "mongo/util/touch_pages.h"
@@ -77,7 +77,7 @@ namespace mongo {
}
TouchCmd() : Command("touch") { }
- virtual bool run(TransactionExperiment* txn,
+ virtual bool run(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int,
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index b6e6cc65545..4d9aa3b943e 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -341,7 +341,7 @@ namespace mongo {
return checkAuthorizedToGrantRoles(authzSession, args.roles);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -527,7 +527,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -651,7 +651,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -737,7 +737,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -819,7 +819,7 @@ namespace mongo {
return checkAuthorizedToGrantRoles(authzSession, roles);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -917,7 +917,7 @@ namespace mongo {
return checkAuthorizedToRevokeRoles(authzSession, roles);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1033,7 +1033,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1175,7 +1175,7 @@ namespace mongo {
return checkAuthorizedToGrantPrivileges(authzSession, args.privileges);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1321,7 +1321,7 @@ namespace mongo {
return checkAuthorizedToGrantPrivileges(authzSession, args.privileges);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1442,7 +1442,7 @@ namespace mongo {
return checkAuthorizedToGrantPrivileges(authzSession, privileges);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1578,7 +1578,7 @@ namespace mongo {
return checkAuthorizedToRevokePrivileges(authzSession, privileges);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1715,7 +1715,7 @@ namespace mongo {
return checkAuthorizedToGrantRoles(authzSession, roles);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1834,7 +1834,7 @@ namespace mongo {
return checkAuthorizedToRevokeRoles(authzSession, roles);
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -1953,7 +1953,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -2121,7 +2121,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -2276,7 +2276,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -2356,7 +2356,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
@@ -2400,7 +2400,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn,
+ bool run(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int options,
@@ -2809,7 +2809,7 @@ namespace mongo {
return Status::OK();
}
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index 56f5382548c..28d06c9ae05 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/pdfile.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/runner.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/catalog/collection.h"
namespace mongo {
@@ -59,7 +59,7 @@ namespace mongo {
}
//{ validate: "collectionnamewithoutthedbpart" [, scandata: <bool>] [, full: <bool> } */
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
string ns = dbname + "." + cmdObj.firstElement().valuestrsafe();
NamespaceString ns_string(ns);
diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp
index d7295a5458f..dd86b3eb476 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.cpp
+++ b/src/mongo/db/commands/write_commands/batch_executor.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/repl/rs.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/counters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/write_concern.h"
#include "mongo/s/collection_metadata.h"
#include "mongo/s/d_logic.h"
@@ -89,7 +89,7 @@ namespace mongo {
using mongoutils::str::stream;
- WriteBatchExecutor::WriteBatchExecutor( TransactionExperiment* txn,
+ WriteBatchExecutor::WriteBatchExecutor( OperationContext* txn,
const BSONObj& wc,
Client* client,
OpCounters* opCounters,
@@ -579,7 +579,7 @@ namespace mongo {
}
}
- static void finishCurrentOp( TransactionExperiment* txn,
+ static void finishCurrentOp( OperationContext* txn,
Client* client,
CurOp* currentOp,
WriteErrorDetail* opError ) {
@@ -618,21 +618,21 @@ namespace mongo {
// - error
//
- static void singleInsert( TransactionExperiment* txn,
+ static void singleInsert( OperationContext* txn,
const BSONObj& docToInsert,
Collection* collection,
WriteOpResult* result );
- static void singleCreateIndex( TransactionExperiment* txn,
+ static void singleCreateIndex( OperationContext* txn,
const BSONObj& indexDesc,
Collection* collection,
WriteOpResult* result );
- static void multiUpdate( TransactionExperiment* txn,
+ static void multiUpdate( OperationContext* txn,
const BatchItemRef& updateItem,
WriteOpResult* result );
- static void multiRemove( TransactionExperiment* txn,
+ static void multiRemove( OperationContext* txn,
const BatchItemRef& removeItem,
WriteOpResult* result );
@@ -653,7 +653,7 @@ namespace mongo {
/**
* Constructs a new instance, for performing inserts described in "aRequest".
*/
- explicit ExecInsertsState(TransactionExperiment* txn,
+ explicit ExecInsertsState(OperationContext* txn,
const BatchedCommandRequest* aRequest);
/**
@@ -687,7 +687,7 @@ namespace mongo {
*/
Collection* getCollection() { return _collection; }
- TransactionExperiment* txn;
+ OperationContext* txn;
// Request object describing the inserts.
const BatchedCommandRequest* request;
@@ -887,7 +887,7 @@ namespace mongo {
// IN-DB-LOCK CORE OPERATIONS
//
- WriteBatchExecutor::ExecInsertsState::ExecInsertsState(TransactionExperiment* txn,
+ WriteBatchExecutor::ExecInsertsState::ExecInsertsState(OperationContext* txn,
const BatchedCommandRequest* aRequest) :
txn(txn),
request(aRequest),
@@ -1015,7 +1015,7 @@ namespace mongo {
*
* Might fault or error, otherwise populates the result.
*/
- static void singleInsert( TransactionExperiment* txn,
+ static void singleInsert( OperationContext* txn,
const BSONObj& docToInsert,
Collection* collection,
WriteOpResult* result ) {
@@ -1042,7 +1042,7 @@ namespace mongo {
*
* Might fault or error, otherwise populates the result.
*/
- static void singleCreateIndex( TransactionExperiment* txn,
+ static void singleCreateIndex( OperationContext* txn,
const BSONObj& indexDesc,
Collection* collection,
WriteOpResult* result ) {
@@ -1065,7 +1065,7 @@ namespace mongo {
}
}
- static void multiUpdate( TransactionExperiment* txn,
+ static void multiUpdate( OperationContext* txn,
const BatchItemRef& updateItem,
WriteOpResult* result ) {
@@ -1126,7 +1126,7 @@ namespace mongo {
*
* Might fault or error, otherwise populates the result.
*/
- static void multiRemove( TransactionExperiment* txn,
+ static void multiRemove( OperationContext* txn,
const BatchItemRef& removeItem,
WriteOpResult* result ) {
diff --git a/src/mongo/db/commands/write_commands/batch_executor.h b/src/mongo/db/commands/write_commands/batch_executor.h
index 6406474e396..fcb55f2b6b6 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.h
+++ b/src/mongo/db/commands/write_commands/batch_executor.h
@@ -43,7 +43,7 @@ namespace mongo {
class BSONObjBuilder;
class CurOp;
class OpCounters;
- class TransactionExperiment;
+ class OperationContext;
struct LastError;
struct WriteOpStats;
@@ -59,7 +59,7 @@ namespace mongo {
// State object used by private execInserts. TODO: Do not expose this type.
class ExecInsertsState;
- WriteBatchExecutor( TransactionExperiment* txn,
+ WriteBatchExecutor( OperationContext* txn,
const BSONObj& defaultWriteConcern,
Client* client,
OpCounters* opCounters,
@@ -134,7 +134,7 @@ namespace mongo {
const WriteErrorDetail* error,
CurOp* currentOp );
- TransactionExperiment* _txn;
+ OperationContext* _txn;
// Default write concern, if one isn't provide in the batches.
const BSONObj _defaultWriteConcern;
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index dcdd527f19f..c9b77e1b831 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -102,7 +102,7 @@ namespace mongo {
// Write commands are counted towards their corresponding opcounters, not command opcounters.
bool WriteCmd::shouldAffectCommandCounter() const { return false; }
- bool WriteCmd::run(TransactionExperiment* txn,
+ bool WriteCmd::run(OperationContext* txn,
const string& dbName,
BSONObj& cmdObj,
int options,
diff --git a/src/mongo/db/commands/write_commands/write_commands.h b/src/mongo/db/commands/write_commands/write_commands.h
index 9a8d96b5ac2..42cbc3e7b87 100644
--- a/src/mongo/db/commands/write_commands/write_commands.h
+++ b/src/mongo/db/commands/write_commands/write_commands.h
@@ -73,7 +73,7 @@ namespace mongo {
// Write command entry point.
virtual bool run(
- TransactionExperiment* txn,
+ OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int options,
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 8914bb981d0..3e5aee43993 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -75,7 +75,7 @@
#include "mongo/db/stats/snapshots.h"
#include "mongo/db/storage/data_file.h"
#include "mongo/db/storage/extent_manager.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/ttl.h"
@@ -188,7 +188,7 @@ namespace mongo {
}
virtual void process( Message& m , AbstractMessagingPort* port , LastError * le) {
- DurTransaction txn;
+ OperationContextImpl txn;
while ( true ) {
if ( inShutdown() ) {
log() << "got request after shutdown()" << endl;
@@ -282,7 +282,7 @@ namespace mongo {
if (serverGlobalParams.isHttpInterfaceEnabled)
boost::thread web( boost::bind(&webServerThread,
new RestAdminAccess(), // takes ownership
- DurTransaction::factory) ); // XXX SERVER-13931
+ OperationContextImpl::factory) ); // XXX SERVER-13931
#if(TESTEXHAUST)
boost::thread thr(testExhaust);
@@ -292,7 +292,7 @@ namespace mongo {
void doDBUpgrade( const string& dbName, DataFileHeader* h ) {
- DurTransaction txn;
+ OperationContextImpl txn;
DBDirectClient db(&txn);
if ( h->version == 4 && h->versionMinor == 4 ) {
@@ -359,7 +359,7 @@ namespace mongo {
LOG(1) << "enter repairDatabases (to check pdfile version #)" << endl;
Lock::GlobalWrite lk;
- DurTransaction txn;
+ OperationContextImpl txn;
vector< string > dbNames;
getDatabaseNames( dbNames );
for ( vector< string >::iterator i = dbNames.begin(); i != dbNames.end(); ++i ) {
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index bf31ff9d1e7..a6c5444614a 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -94,7 +94,7 @@ namespace mongo {
<< "N to wait N seconds for other members to catch up.";
}
- bool CmdShutdown::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool CmdShutdown::run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue();
if (!force &&
@@ -191,7 +191,7 @@ namespace mongo {
CmdDropDatabase() : Command("dropDatabase") {}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
// disallow dropping the config database
if (serverGlobalParams.configsvr && (dbname == "config")) {
errmsg = "Cannot drop 'config' database if mongod started with --configsvr";
@@ -275,7 +275,7 @@ namespace mongo {
return allKilledIndexes;
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
BSONElement e = cmdObj.firstElement();
if ( e.numberInt() != 1 ) {
errmsg = "bad option";
@@ -351,7 +351,7 @@ namespace mongo {
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
// Needs to be locked exclusively, because creates the system.profile collection
// in the local database.
//
@@ -401,7 +401,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
// This doesn't look like it requires exclusive DB lock, because it uses its own diag
// locking, but originally the lock was set to be WRITE, so preserving the behaviour.
//
@@ -448,7 +448,7 @@ namespace mongo {
return IndexBuilder::killMatchingIndexBuilds(db->getCollection(nsToDrop), criteria);
}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
const string nsToDrop = dbname + '.' + cmdObj.firstElement().valuestr();
if (!serverGlobalParams.quiet) {
MONGO_TLOG(0) << "CMD: drop " << nsToDrop << endl;
@@ -512,7 +512,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
long long skip = 0;
if ( cmdObj["skip"].isNumber() ) {
skip = cmdObj["skip"].numberLong();
@@ -595,7 +595,7 @@ namespace mongo {
return Status(ErrorCodes::Unauthorized, "unauthorized");
}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
BSONObjIterator it(cmdObj);
// Extract ns from first cmdObj element.
@@ -653,7 +653,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdListDatabases() : Command("listDatabases" , true ) {}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
vector< string > dbNames;
getDatabaseNames( dbNames );
vector< BSONObj > dbInfos;
@@ -735,7 +735,7 @@ namespace mongo {
}
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
Lock::GlobalWrite globalWriteLock;
Client::Context ctx(dbname);
@@ -784,7 +784,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), ActionType::find));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
const std::string ns = parseNs(dbname, jsobj);
md5digest d;
@@ -913,7 +913,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
Timer timer;
string ns = jsobj.firstElement().String();
@@ -1070,7 +1070,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
const string ns = dbname + "." + jsobj.firstElement().valuestr();
Client::ReadContext cx( ns );
@@ -1144,7 +1144,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
const string ns = dbname + "." + jsobj.firstElement().valuestr();
Lock::DBWrite dbXLock(dbname);
@@ -1266,7 +1266,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
int scale = 1;
if ( jsobj["scale"].isNumber() ) {
scale = jsobj["scale"].numberInt();
@@ -1379,7 +1379,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
BSONObj info = cc().curop()->info();
result << "you" << info[ "client" ];
return true;
@@ -1387,7 +1387,7 @@ namespace mongo {
} cmdWhatsMyUri;
- bool _execCommand(TransactionExperiment* txn,
+ bool _execCommand(OperationContext* txn,
Command *c,
const string& dbname,
BSONObj& cmdObj,
@@ -1477,7 +1477,7 @@ namespace mongo {
- context
then calls run()
*/
- void Command::execCommand(TransactionExperiment* txn,
+ void Command::execCommand(OperationContext* txn,
Command * c ,
Client& client,
int queryOptions,
@@ -1603,7 +1603,7 @@ namespace mongo {
returns true if ran a cmd
*/
- bool _runCommands(TransactionExperiment* txn,
+ bool _runCommands(OperationContext* txn,
const char* ns,
BSONObj& _cmdobj,
BufBuilder& b,
diff --git a/src/mongo/db/dbcommands_admin.cpp b/src/mongo/db/dbcommands_admin.cpp
index 5856d0eace7..736e932d4d3 100644
--- a/src/mongo/db/dbcommands_admin.cpp
+++ b/src/mongo/db/dbcommands_admin.cpp
@@ -82,7 +82,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
boost::filesystem::path p = dur::getJournalDir();
p /= "journalLatencyTest";
diff --git a/src/mongo/db/dbcommands_generic.cpp b/src/mongo/db/dbcommands_generic.cpp
index 2ce435d136d..097e659e86d 100644
--- a/src/mongo/db/dbcommands_generic.cpp
+++ b/src/mongo/db/dbcommands_generic.cpp
@@ -101,7 +101,7 @@ namespace mongo {
virtual void help( stringstream &help ) const {
help << "internal command facilitating running in certain cloud computing environments";
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& obj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& obj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
if( !obj.hasElement("servers") ) {
vector<string> ips;
obj["servers"].Obj().Vals(ips);
@@ -133,7 +133,7 @@ namespace mongo {
help << "{ buildinfo:1 }";
}
- bool run(TransactionExperiment* txn, const std::string& dbname,
+ bool run(OperationContext* txn, const std::string& dbname,
BSONObj& jsobj,
int, // options
std::string& errmsg,
@@ -156,7 +156,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& badns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& badns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
// IMPORTANT: Don't put anything in here that might lock db - including authentication
return true;
}
@@ -171,7 +171,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if ( globalScriptEngine ) {
BSONObjBuilder bb( result.subobjStart( "js" ) );
result.append( "utf8" , globalScriptEngine->utf8Ok() );
@@ -206,7 +206,7 @@ namespace mongo {
actions.addAction(ActionType::hostInfo);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
ProcessInfo p;
BSONObjBuilder bSys, bOs;
@@ -243,7 +243,7 @@ namespace mongo {
actions.addAction(ActionType::logRotate);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
bool didRotate = rotateLogs();
if (didRotate)
logProcessDetailsForLogRotate();
@@ -262,7 +262,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
BSONObjBuilder b( result.subobjStart( "commands" ) );
for ( map<string,Command*>::iterator i=_commands->begin(); i!=_commands->end(); ++i ) {
Command * c = i->second;
@@ -339,7 +339,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
CmdForceError() : Command("forceerror") {}
- bool run(TransactionExperiment* txn, const string& dbnamne, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbnamne, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
uassert( 10038 , "forced error", false);
return true;
}
@@ -353,7 +353,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
result << "options" << QueryOption_AllSupported;
return true;
}
@@ -377,7 +377,7 @@ namespace mongo {
help << "{ getLog : '*' } OR { getLog : 'global' }";
}
- virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
+ virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
string p = cmdObj.firstElement().String();
if ( p == "*" ) {
vector<string> names;
@@ -424,7 +424,7 @@ namespace mongo {
actions.addAction(ActionType::getCmdLineOpts);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
result.append("argv", serverGlobalParams.argvArray);
result.append("parsed", serverGlobalParams.parsedOpts);
return true;
diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp
index 4c33a0a7506..79207366e77 100644
--- a/src/mongo/db/dbeval.cpp
+++ b/src/mongo/db/dbeval.cpp
@@ -139,7 +139,7 @@ namespace mongo {
RoleGraph::generateUniversalPrivileges(out);
}
CmdEval() : Command("eval", false, "$eval") { }
- bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if ( cmdObj["nolock"].trueValue() ) {
return dbEval(dbname, cmdObj, result, errmsg);
}
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 72d60dffbcd..063a2fd7bb0 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/query/query_planner.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/write_concern.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/s/d_logic.h"
@@ -60,7 +60,7 @@ namespace mongo {
const BSONObj reverseNaturalObj = BSON( "$natural" << -1 );
- void Helpers::ensureIndex(TransactionExperiment* txn,
+ void Helpers::ensureIndex(OperationContext* txn,
Collection* collection,
BSONObj keyPattern,
bool unique,
@@ -221,7 +221,7 @@ namespace mongo {
return Runner::RUNNER_ADVANCED == state;
}
- void Helpers::upsert( TransactionExperiment* txn,
+ void Helpers::upsert( OperationContext* txn,
const string& ns,
const BSONObj& o,
bool fromMigrate ) {
@@ -246,7 +246,7 @@ namespace mongo {
update(txn, context.db(), request, &debug);
}
- void Helpers::putSingleton(TransactionExperiment* txn, const char *ns, BSONObj obj) {
+ void Helpers::putSingleton(OperationContext* txn, const char *ns, BSONObj obj) {
OpDebug debug;
Client::Context context(ns);
@@ -264,7 +264,7 @@ namespace mongo {
context.getClient()->curop()->done();
}
- void Helpers::putSingletonGod(TransactionExperiment* txn, const char *ns, BSONObj obj, bool logTheOp) {
+ void Helpers::putSingletonGod(OperationContext* txn, const char *ns, BSONObj obj, bool logTheOp) {
OpDebug debug;
Client::Context context(ns);
@@ -318,7 +318,7 @@ namespace mongo {
return true;
}
- long long Helpers::removeRange( TransactionExperiment* txn,
+ long long Helpers::removeRange( OperationContext* txn,
const KeyRange& range,
bool maxInclusive,
bool secondaryThrottle,
@@ -555,7 +555,7 @@ namespace mongo {
}
- void Helpers::emptyCollection(TransactionExperiment* txn, const char *ns) {
+ void Helpers::emptyCollection(OperationContext* txn, const char *ns) {
Client::Context context(ns);
deleteObjects(txn, context.db(), ns, BSONObj(), false);
}
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h
index c10c6f24a21..76ef3271c91 100644
--- a/src/mongo/db/dbhelpers.h
+++ b/src/mongo/db/dbhelpers.h
@@ -42,7 +42,7 @@ namespace mongo {
class Collection;
class Cursor;
- class TransactionExperiment;
+ class OperationContext;
/**
* db helpers are helper functions and classes that let us easily manipulate the local
@@ -64,7 +64,7 @@ namespace mongo {
Note: does nothing if collection does not yet exist.
*/
- static void ensureIndex(TransactionExperiment* txn,
+ static void ensureIndex(OperationContext* txn,
Collection* collection,
BSONObj keyPattern,
bool unique,
@@ -113,8 +113,8 @@ namespace mongo {
@return true if object exists.
*/
static bool getSingleton(const char *ns, BSONObj& result);
- static void putSingleton(TransactionExperiment* txn, const char *ns, BSONObj obj);
- static void putSingletonGod(TransactionExperiment* txn, const char *ns, BSONObj obj, bool logTheOp);
+ static void putSingleton(OperationContext* txn, const char *ns, BSONObj obj);
+ static void putSingletonGod(OperationContext* txn, const char *ns, BSONObj obj, bool logTheOp);
static bool getFirst(const char *ns, BSONObj& result) { return getSingleton(ns, result); }
static bool getLast(const char *ns, BSONObj& result); // get last object int he collection; e.g. {$natural : -1}
@@ -123,7 +123,7 @@ namespace mongo {
* you do not have to have Context set
* o has to have an _id field or will assert
*/
- static void upsert( TransactionExperiment* txn,
+ static void upsert( OperationContext* txn,
const string& ns,
const BSONObj& o,
bool fromMigrate = false );
@@ -162,7 +162,7 @@ namespace mongo {
* Does oplog the individual document deletions.
* // TODO: Refactor this mechanism, it is growing too large
*/
- static long long removeRange( TransactionExperiment* txn,
+ static long long removeRange( OperationContext* txn,
const KeyRange& range,
bool maxInclusive = false,
bool secondaryThrottle = false,
@@ -201,7 +201,7 @@ namespace mongo {
* You do not need to set the database before calling.
* Does not oplog the operation.
*/
- static void emptyCollection(TransactionExperiment* txn, const char *ns);
+ static void emptyCollection(OperationContext* txn, const char *ns);
/**
* for saving deleted bson objects to a flat file
diff --git a/src/mongo/db/dbwebserver.cpp b/src/mongo/db/dbwebserver.cpp
index c5ce87bb068..233e965b27b 100644
--- a/src/mongo/db/dbwebserver.cpp
+++ b/src/mongo/db/dbwebserver.cpp
@@ -50,7 +50,7 @@
#include "mongo/db/db.h"
#include "mongo/db/instance.h"
#include "mongo/db/stats/snapshots.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/admin_access.h"
#include "mongo/util/md5.hpp"
#include "mongo/util/mongoutils/html.h"
@@ -77,7 +77,7 @@ namespace mongo {
DbWebServer(const string& ip,
int port,
const AdminAccess* webUsers,
- TransactionExperiment::Factory transactionFactory)
+ OperationContext::Factory transactionFactory)
: MiniWebServer("admin web console", ip, port),
_webUsers(webUsers),
_transactionFactory(transactionFactory) {
@@ -87,7 +87,7 @@ namespace mongo {
private:
const AdminAccess* _webUsers; // not owned here
- const TransactionExperiment::Factory _transactionFactory;
+ const OperationContext::Factory _transactionFactory;
void doUnlockedStuff(stringstream& ss) {
/* this is in the header already ss << "port: " << port << '\n'; */
@@ -188,7 +188,7 @@ namespace mongo {
const SockAddr &from
) {
- boost::scoped_ptr<TransactionExperiment> txn(_transactionFactory()); // XXX SERVER-13931
+ boost::scoped_ptr<OperationContext> txn(_transactionFactory()); // XXX SERVER-13931
if ( url.size() > 1 ) {
@@ -421,7 +421,7 @@ namespace mongo {
public:
FavIconHandler() : DbWebHandler( "favicon.ico" , 0 , false ) {}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
@@ -436,7 +436,7 @@ namespace mongo {
public:
StatusHandler() : DbWebHandler( "_status" , 1 , false ) {}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
@@ -488,7 +488,7 @@ namespace mongo {
public:
CommandListHandler() : DbWebHandler( "_commands" , 1 , true ) {}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
@@ -541,7 +541,7 @@ namespace mongo {
return _cmd(cmd) != 0;
}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
@@ -577,7 +577,7 @@ namespace mongo {
// --- external ----
void webServerThread(const AdminAccess* adminAccess,
- TransactionExperiment::Factory transactionFactory) {
+ OperationContext::Factory transactionFactory) {
boost::scoped_ptr<const AdminAccess> adminAccessPtr(adminAccess); // adminAccess is owned here
Client::initThread("websvr");
const int p = serverGlobalParams.port + 1000;
diff --git a/src/mongo/db/dbwebserver.h b/src/mongo/db/dbwebserver.h
index 445f3f2ef33..42e686b3315 100644
--- a/src/mongo/db/dbwebserver.h
+++ b/src/mongo/db/dbwebserver.h
@@ -34,7 +34,7 @@
#include "mongo/util/admin_access.h"
#include "mongo/util/net/sock.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
namespace mongo {
@@ -55,7 +55,7 @@ namespace mongo {
virtual bool requiresREST( const string& url ) const { return _requiresREST; }
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, // the full request
const std::string& url,
BSONObj params,
@@ -96,7 +96,7 @@ namespace mongo {
static vector<WebStatusPlugin*> * _plugins;
};
- void webServerThread( const AdminAccess* admins, TransactionExperiment::Factory transactionFactory );
+ void webServerThread( const AdminAccess* admins, OperationContext::Factory transactionFactory );
string prettyHostName();
};
diff --git a/src/mongo/db/driverHelpers.cpp b/src/mongo/db/driverHelpers.cpp
index 135eb2256f5..f98fa46cbb3 100644
--- a/src/mongo/db/driverHelpers.cpp
+++ b/src/mongo/db/driverHelpers.cpp
@@ -66,7 +66,7 @@ namespace mongo {
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if ( cmdObj.firstElement().type() != jstOID ) {
errmsg = "not oid";
return false;
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index bae67717c07..5446d2b5c2d 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -102,7 +102,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result,
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result,
bool fromRepl) {
BSONElement argElt = cmdObj["stageDebug"];
if (argElt.eoo() || !argElt.isABSONObj()) { return false; }
diff --git a/src/mongo/db/fts/fts_command.cpp b/src/mongo/db/fts/fts_command.cpp
index 853afd04f5d..c95a6c52bb1 100644
--- a/src/mongo/db/fts/fts_command.cpp
+++ b/src/mongo/db/fts/fts_command.cpp
@@ -57,7 +57,7 @@ namespace mongo {
}
- bool FTSCommand::run(TransactionExperiment* txn, const string& dbname,
+ bool FTSCommand::run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/fts/fts_command.h b/src/mongo/db/fts/fts_command.h
index e5cc881feb4..4dc84bfb6e8 100644
--- a/src/mongo/db/fts/fts_command.h
+++ b/src/mongo/db/fts/fts_command.h
@@ -56,7 +56,7 @@ namespace mongo {
std::vector<Privilege>* out);
- bool run(TransactionExperiment* txn, const string& dbname,
+ bool run(OperationContext* txn, const string& dbname,
BSONObj& cmdObj,
int options,
string& errmsg,
diff --git a/src/mongo/db/geo/haystack.cpp b/src/mongo/db/geo/haystack.cpp
index aa05540eeba..13eb964376d 100644
--- a/src/mongo/db/geo/haystack.cpp
+++ b/src/mongo/db/geo/haystack.cpp
@@ -68,7 +68,7 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int,
+ bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int,
string& errmsg, BSONObjBuilder& result, bool fromRepl) {
const string ns = dbname + "." + cmdObj.firstElement().valuestr();
Client::ReadContext ctx(ns);
diff --git a/src/mongo/db/index/btree_based_access_method.cpp b/src/mongo/db/index/btree_based_access_method.cpp
index 982a9c70097..6d16f375dc0 100644
--- a/src/mongo/db/index/btree_based_access_method.cpp
+++ b/src/mongo/db/index/btree_based_access_method.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/repl/is_master.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/server_parameters.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/btree/btree_interface.h"
#include "mongo/db/structure/btree/bucket_deletion_notification.h"
#include "mongo/util/progress_meter.h"
@@ -79,7 +79,7 @@ namespace mongo {
}
// Find the keys for obj, put them in the tree pointing to loc
- Status BtreeBasedAccessMethod::insert(TransactionExperiment* txn,
+ Status BtreeBasedAccessMethod::insert(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -138,7 +138,7 @@ namespace mongo {
return ret;
}
- bool BtreeBasedAccessMethod::removeOneKey(TransactionExperiment* txn,
+ bool BtreeBasedAccessMethod::removeOneKey(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc) {
bool ret = false;
@@ -165,7 +165,7 @@ namespace mongo {
}
// Remove the provided doc from the index.
- Status BtreeBasedAccessMethod::remove(TransactionExperiment* txn,
+ Status BtreeBasedAccessMethod::remove(OperationContext* txn,
const BSONObj &obj,
const DiskLoc& loc,
const InsertDeleteOptions &options,
@@ -210,7 +210,7 @@ namespace mongo {
}
}
- Status BtreeBasedAccessMethod::initializeAsEmpty(TransactionExperiment* txn) {
+ Status BtreeBasedAccessMethod::initializeAsEmpty(OperationContext* txn) {
return _newInterface->initAsEmpty(txn);
}
@@ -227,7 +227,7 @@ namespace mongo {
return Status::OK();
}
- Status BtreeBasedAccessMethod::touch( TransactionExperiment* txn ) const {
+ Status BtreeBasedAccessMethod::touch( OperationContext* txn ) const {
return _btreeState->recordStore()->touch( txn, NULL );
}
@@ -296,7 +296,7 @@ namespace mongo {
return Status::OK();
}
- Status BtreeBasedAccessMethod::update(TransactionExperiment* txn,
+ Status BtreeBasedAccessMethod::update(OperationContext* txn,
const UpdateTicket& ticket,
int64_t* numUpdated) {
if (!ticket._isValid) {
@@ -323,7 +323,7 @@ namespace mongo {
return Status::OK();
}
- IndexAccessMethod* BtreeBasedAccessMethod::initiateBulk(TransactionExperiment* txn) {
+ IndexAccessMethod* BtreeBasedAccessMethod::initiateBulk(OperationContext* txn) {
// If there's already data in the index, don't do anything.
if (!_newInterface->isEmpty()) {
return NULL;
diff --git a/src/mongo/db/index/btree_based_access_method.h b/src/mongo/db/index/btree_based_access_method.h
index 294c2ece470..cee96988710 100644
--- a/src/mongo/db/index/btree_based_access_method.h
+++ b/src/mongo/db/index/btree_based_access_method.h
@@ -60,13 +60,13 @@ namespace mongo {
virtual ~BtreeBasedAccessMethod() { }
- virtual Status insert(TransactionExperiment* txn,
+ virtual Status insert(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
int64_t* numInserted);
- virtual Status remove(TransactionExperiment* txn,
+ virtual Status remove(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -78,15 +78,15 @@ namespace mongo {
const InsertDeleteOptions& options,
UpdateTicket* ticket);
- virtual Status update(TransactionExperiment* txn,
+ virtual Status update(OperationContext* txn,
const UpdateTicket& ticket,
int64_t* numUpdated);
virtual Status newCursor(IndexCursor **out) const;
- virtual Status initializeAsEmpty(TransactionExperiment* txn);
+ virtual Status initializeAsEmpty(OperationContext* txn);
- virtual IndexAccessMethod* initiateBulk(TransactionExperiment* txn) ;
+ virtual IndexAccessMethod* initiateBulk(OperationContext* txn) ;
virtual Status commitBulk( IndexAccessMethod* bulk,
bool mayInterrupt,
@@ -94,7 +94,7 @@ namespace mongo {
virtual Status touch(const BSONObj& obj);
- virtual Status touch(TransactionExperiment* txn) const;
+ virtual Status touch(OperationContext* txn) const;
virtual Status validate(int64_t* numKeys);
@@ -121,7 +121,7 @@ namespace mongo {
}
private:
- bool removeOneKey(TransactionExperiment* txn,
+ bool removeOneKey(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc);
diff --git a/src/mongo/db/index/btree_based_bulk_access_method.cpp b/src/mongo/db/index/btree_based_bulk_access_method.cpp
index 5b77a26a360..09af9df2ee1 100644
--- a/src/mongo/db/index/btree_based_bulk_access_method.cpp
+++ b/src/mongo/db/index/btree_based_bulk_access_method.cpp
@@ -31,7 +31,7 @@
#include "mongo/db/kill_current_op.h"
#include "mongo/db/pdfile_private.h" // This is for inDBRepair.
#include "mongo/db/repl/rs.h" // This is for ignoreUniqueIndex.
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/progress_meter.h"
namespace mongo {
@@ -90,7 +90,7 @@ namespace mongo {
return NULL;
}
- BtreeBasedBulkAccessMethod::BtreeBasedBulkAccessMethod(TransactionExperiment* txn,
+ BtreeBasedBulkAccessMethod::BtreeBasedBulkAccessMethod(OperationContext* txn,
BtreeBasedAccessMethod* real,
BtreeInterface* interface,
const IndexDescriptor* descriptor,
@@ -108,7 +108,7 @@ namespace mongo {
_sorter->hintNumObjects(numRecords);
}
- Status BtreeBasedBulkAccessMethod::insert(TransactionExperiment* txn,
+ Status BtreeBasedBulkAccessMethod::insert(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
diff --git a/src/mongo/db/index/btree_based_bulk_access_method.h b/src/mongo/db/index/btree_based_bulk_access_method.h
index cc27f46a71d..cedf1eedf80 100644
--- a/src/mongo/db/index/btree_based_bulk_access_method.h
+++ b/src/mongo/db/index/btree_based_bulk_access_method.h
@@ -47,7 +47,7 @@ namespace mongo {
* Does not take ownership of any pointers.
* All pointers must outlive 'this'.
*/
- BtreeBasedBulkAccessMethod(TransactionExperiment* txn,
+ BtreeBasedBulkAccessMethod(OperationContext* txn,
BtreeBasedAccessMethod* real,
BtreeInterface* interface,
const IndexDescriptor* descriptor,
@@ -55,7 +55,7 @@ namespace mongo {
~BtreeBasedBulkAccessMethod() {}
- virtual Status insert(TransactionExperiment* txn,
+ virtual Status insert(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -81,7 +81,7 @@ namespace mongo {
return _notAllowed();
}
- virtual Status touch(TransactionExperiment* txn) const {
+ virtual Status touch(OperationContext* txn) const {
return _notAllowed();
}
@@ -89,7 +89,7 @@ namespace mongo {
return _notAllowed();
}
- virtual Status remove(TransactionExperiment* txn,
+ virtual Status remove(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -105,7 +105,7 @@ namespace mongo {
return _notAllowed();
}
- virtual Status update(TransactionExperiment* txn,
+ virtual Status update(OperationContext* txn,
const UpdateTicket& ticket,
int64_t* numUpdated) {
return _notAllowed();
@@ -115,11 +115,11 @@ namespace mongo {
return _notAllowed();
}
- virtual Status initializeAsEmpty(TransactionExperiment* txn) {
+ virtual Status initializeAsEmpty(OperationContext* txn) {
return _notAllowed();
}
- virtual IndexAccessMethod* initiateBulk(TransactionExperiment* txn) {
+ virtual IndexAccessMethod* initiateBulk(OperationContext* txn) {
return NULL;
}
@@ -149,7 +149,7 @@ namespace mongo {
// Does any document have >1 key?
bool _isMultiKey;
- TransactionExperiment* _txn;
+ OperationContext* _txn;
};
} // namespace mongo
diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h
index e4666ea99d1..6268ad0cb90 100644
--- a/src/mongo/db/index/index_access_method.h
+++ b/src/mongo/db/index/index_access_method.h
@@ -32,7 +32,7 @@
#include "mongo/db/index/index_cursor.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
namespace mongo {
@@ -65,7 +65,7 @@ namespace mongo {
*
* The behavior of the insertion can be specified through 'options'.
*/
- virtual Status insert(TransactionExperiment* txn,
+ virtual Status insert(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -75,7 +75,7 @@ namespace mongo {
* Analogous to above, but remove the records instead of inserting them. If not NULL,
* numDeleted will be set to the number of keys removed from the index for the document.
*/
- virtual Status remove(TransactionExperiment* txn,
+ virtual Status remove(OperationContext* txn,
const BSONObj& obj,
const DiskLoc& loc,
const InsertDeleteOptions& options,
@@ -105,7 +105,7 @@ namespace mongo {
* called. If the index was changed, we may return an error, as our ticket may have been
* invalidated.
*/
- virtual Status update(TransactionExperiment* txn,
+ virtual Status update(OperationContext* txn,
const UpdateTicket& ticket,
int64_t* numUpdated) = 0;
@@ -123,7 +123,7 @@ namespace mongo {
* only called once for the lifetime of the index
* if called multiple times, is an error
*/
- virtual Status initializeAsEmpty(TransactionExperiment* txn) = 0;
+ virtual Status initializeAsEmpty(OperationContext* txn) = 0;
/**
* Try to page-in the pages that contain the keys generated from 'obj'.
@@ -136,7 +136,7 @@ namespace mongo {
/**
* this pages in the entire index
*/
- virtual Status touch( TransactionExperiment* txn ) const = 0;
+ virtual Status touch( OperationContext* txn ) const = 0;
/**
* Walk the entire index, checking the internal structure for consistency.
@@ -163,12 +163,12 @@ namespace mongo {
*
* Caller owns the returned IndexAccessMethod.
*
- * The provided TransactionExperiment must outlive the IndexAccessMethod returned.
+ * The provided OperationContext must outlive the IndexAccessMethod returned.
*
* For now (1/8/14) you can only do bulk when the index is empty
* it will fail if you try other times.
*/
- virtual IndexAccessMethod* initiateBulk(TransactionExperiment* txn) = 0;
+ virtual IndexAccessMethod* initiateBulk(OperationContext* txn) = 0;
/**
* Call this when you are ready to finish your bulk work.
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp
index 2bea4ef36ed..0def5596b82 100644
--- a/src/mongo/db/index_builder.cpp
+++ b/src/mongo/db/index_builder.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/d_concurrency.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -63,7 +63,7 @@ namespace mongo {
cc().curop()->reset(HostAndPort(), dbInsert);
NamespaceString ns(_index["ns"].String());
Client::WriteContext ctx(ns.getSystemIndexesCollection());
- DurTransaction txn;
+ OperationContextImpl txn;
Database* db = dbHolder().get(ns.db().toString(), storageGlobalParams.dbpath);
@@ -75,7 +75,7 @@ namespace mongo {
cc().shutdown();
}
- Status IndexBuilder::build(TransactionExperiment* txn, Database* db) const {
+ Status IndexBuilder::build(OperationContext* txn, Database* db) const {
const string ns = _index["ns"].String();
Collection* c = db->getCollection( ns );
diff --git a/src/mongo/db/index_builder.h b/src/mongo/db/index_builder.h
index 82b7b6bfd98..e825794a4c3 100644
--- a/src/mongo/db/index_builder.h
+++ b/src/mongo/db/index_builder.h
@@ -41,7 +41,7 @@
namespace mongo {
class Collection;
- class TransactionExperiment;
+ class OperationContext;
class IndexBuilder : public BackgroundJob {
public:
@@ -55,7 +55,7 @@ namespace mongo {
*/
virtual std::string name() const;
- Status build(TransactionExperiment* txn, Database* db) const;
+ Status build(OperationContext* txn, Database* db) const;
/**
* Kill all in-progress indexes matching criteria, if non-empty:
diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp
index fddb9f59ccb..da1dc347cec 100644
--- a/src/mongo/db/index_rebuilder.cpp
+++ b/src/mongo/db/index_rebuilder.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/instance.h"
#include "mongo/db/pdfile.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/scopeguard.h"
namespace mongo {
@@ -90,7 +90,7 @@ namespace mongo {
// This write lock is held throughout the index building process
// for this namespace.
Client::WriteContext ctx(ns);
- DurTransaction txn; // XXX???
+ OperationContextImpl txn; // XXX???
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( collection == NULL )
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index ab711aab742..aff142187c6 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -55,7 +55,7 @@
#include "mongo/db/storage/mmap_v1/dur_commitjob.h"
#include "mongo/db/storage/mmap_v1/dur_journal.h"
#include "mongo/db/storage/mmap_v1/dur_recover.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/global_optime.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
@@ -96,11 +96,11 @@ namespace mongo {
inline void opread(Message& m) { if( _diaglog.getLevel() & 2 ) _diaglog.readop((char *) m.singleData(), m.header()->len); }
inline void opwrite(Message& m) { if( _diaglog.getLevel() & 1 ) _diaglog.writeop((char *) m.singleData(), m.header()->len); }
- void receivedKillCursors(TransactionExperiment* txn, Message& m);
- void receivedUpdate(TransactionExperiment* txn, Message& m, CurOp& op);
- void receivedDelete(TransactionExperiment* txn, Message& m, CurOp& op);
- void receivedInsert(TransactionExperiment* txn, Message& m, CurOp& op);
- bool receivedGetMore(TransactionExperiment* txn, DbResponse& dbresponse, Message& m, CurOp& curop );
+ void receivedKillCursors(OperationContext* txn, Message& m);
+ void receivedUpdate(OperationContext* txn, Message& m, CurOp& op);
+ void receivedDelete(OperationContext* txn, Message& m, CurOp& op);
+ void receivedInsert(OperationContext* txn, Message& m, CurOp& op);
+ bool receivedGetMore(OperationContext* txn, DbResponse& dbresponse, Message& m, CurOp& curop );
int nloggedsome = 0;
#define LOGWITHRATELIMIT if( ++nloggedsome < 1000 || nloggedsome % 100 == 0 )
@@ -232,7 +232,7 @@ namespace mongo {
replyToQuery(0, m, dbresponse, obj);
}
- static bool receivedQuery(TransactionExperiment* txn, Client& c, DbResponse& dbresponse, Message& m ) {
+ static bool receivedQuery(OperationContext* txn, Client& c, DbResponse& dbresponse, Message& m ) {
bool ok = true;
MSGID responseTo = m.header()->id;
@@ -329,7 +329,7 @@ namespace mongo {
}
// Returns false when request includes 'end'
- void assembleResponse( TransactionExperiment* txn,
+ void assembleResponse( OperationContext* txn,
Message& m,
DbResponse& dbresponse,
const HostAndPort& remote ) {
@@ -514,7 +514,7 @@ namespace mongo {
debug.reset();
} /* assembleResponse() */
- void receivedKillCursors(TransactionExperiment* txn, Message& m) {
+ void receivedKillCursors(OperationContext* txn, Message& m) {
int *x = (int *) m.singleData()->_data;
x++; // reserved
int n = *x++;
@@ -563,7 +563,7 @@ namespace mongo {
delete database; // closes files
}
- void receivedUpdate(TransactionExperiment* txn, Message& m, CurOp& op) {
+ void receivedUpdate(OperationContext* txn, Message& m, CurOp& op) {
DbMessage d(m);
NamespaceString ns(d.getns());
uassertStatusOK( userAllowedWriteNS( ns ) );
@@ -618,7 +618,7 @@ namespace mongo {
lastError.getSafe()->recordUpdate( res.existing , res.numMatched , res.upserted );
}
- void receivedDelete(TransactionExperiment* txn, Message& m, CurOp& op) {
+ void receivedDelete(OperationContext* txn, Message& m, CurOp& op) {
DbMessage d(m);
NamespaceString ns(d.getns());
uassertStatusOK( userAllowedWriteNS( ns ) );
@@ -658,7 +658,7 @@ namespace mongo {
QueryResult* emptyMoreResult(long long);
- bool receivedGetMore(TransactionExperiment* txn, DbResponse& dbresponse, Message& m, CurOp& curop ) {
+ bool receivedGetMore(OperationContext* txn, DbResponse& dbresponse, Message& m, CurOp& curop ) {
bool ok = true;
DbMessage d(m);
@@ -781,7 +781,7 @@ namespace mongo {
return ok;
}
- void checkAndInsert(TransactionExperiment* txn,
+ void checkAndInsert(OperationContext* txn,
Client::Context& ctx,
const char *ns,
/*modifies*/BSONObj& js) {
@@ -830,7 +830,7 @@ namespace mongo {
logOp(txn, "i", ns, js);
}
- NOINLINE_DECL void insertMulti(TransactionExperiment* txn,
+ NOINLINE_DECL void insertMulti(OperationContext* txn,
Client::Context& ctx,
bool keepGoing,
const char *ns,
@@ -854,7 +854,7 @@ namespace mongo {
op.debug().ninserted = i;
}
- void receivedInsert(TransactionExperiment* txn, Message& m, CurOp& op) {
+ void receivedInsert(OperationContext* txn, Message& m, CurOp& op) {
DbMessage d(m);
const char *ns = d.getns();
op.debug().ns = ns;
@@ -942,11 +942,11 @@ namespace mongo {
}
DBDirectClient::DBDirectClient()
- : _txnOwned(new DurTransaction),
+ : _txnOwned(new OperationContextImpl),
_txn(_txnOwned.get())
{}
- DBDirectClient::DBDirectClient(TransactionExperiment* txn)
+ DBDirectClient::DBDirectClient(OperationContext* txn)
: _txn(txn)
{}
diff --git a/src/mongo/db/instance.h b/src/mongo/db/instance.h
index 50a988917ad..1e475f9e89d 100644
--- a/src/mongo/db/instance.h
+++ b/src/mongo/db/instance.h
@@ -35,7 +35,7 @@
#include "mongo/db/client.h"
#include "mongo/db/curop-inl.h"
#include "mongo/db/dbmessage.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/storage_options.h"
namespace mongo {
@@ -68,7 +68,7 @@ namespace mongo {
extern DiagLog _diaglog;
- void assembleResponse( TransactionExperiment* txn,
+ void assembleResponse( OperationContext* txn,
Message& m,
DbResponse& dbresponse,
const HostAndPort &client );
@@ -87,7 +87,7 @@ namespace mongo {
class DBDirectClient : public DBClientBase {
public:
DBDirectClient(); // DEPRECATED
- DBDirectClient(TransactionExperiment* txn); // txn must outlive this object
+ DBDirectClient(OperationContext* txn); // txn must outlive this object
using DBClientBase::query;
@@ -133,8 +133,8 @@ namespace mongo {
private:
static HostAndPort _clientHost;
- boost::scoped_ptr<TransactionExperiment> _txnOwned;
- TransactionExperiment* _txn; // Points either to _txnOwned or a passed-in transaction.
+ boost::scoped_ptr<OperationContext> _txnOwned;
+ OperationContext* _txn; // Points either to _txnOwned or a passed-in transaction.
};
extern int lockFile;
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp
index 77f7835d39e..79894bf88c7 100644
--- a/src/mongo/db/introspect.cpp
+++ b/src/mongo/db/introspect.cpp
@@ -79,7 +79,7 @@ namespace {
}
} // namespace
- static void _profile(TransactionExperiment* txn,
+ static void _profile(OperationContext* txn,
const Client& c,
Database* db,
CurOp& currentOp,
@@ -129,7 +129,7 @@ namespace {
}
}
- void profile(TransactionExperiment* txn, const Client& c, int op, CurOp& currentOp) {
+ void profile(OperationContext* txn, const Client& c, int op, CurOp& currentOp) {
// initialize with 1kb to start, to avoid realloc later
// doing this outside the dblock to improve performance
BufBuilder profileBufBuilder(1024);
@@ -155,7 +155,7 @@ namespace {
}
}
- Collection* getOrCreateProfileCollection(TransactionExperiment* txn,
+ Collection* getOrCreateProfileCollection(OperationContext* txn,
Database *db,
bool force,
string* errmsg ) {
diff --git a/src/mongo/db/introspect.h b/src/mongo/db/introspect.h
index f45d9796b34..07af4ba6653 100644
--- a/src/mongo/db/introspect.h
+++ b/src/mongo/db/introspect.h
@@ -40,13 +40,13 @@ namespace mongo {
class Collection;
class Database;
- class TransactionExperiment;
+ class OperationContext;
/* --- profiling --------------------------------------------
do when database->profile is set
*/
- void profile(TransactionExperiment* txn, const Client& c, int op, CurOp& currentOp);
+ void profile(OperationContext* txn, const Client& c, int op, CurOp& currentOp);
/**
* Get (or create) the profile collection
@@ -55,7 +55,7 @@ namespace mongo {
* @param force Always create the collection if it does not exist
* @return Collection for the newly created collection, or NULL on error
**/
- Collection* getOrCreateProfileCollection(TransactionExperiment* txn,
+ Collection* getOrCreateProfileCollection(OperationContext* txn,
Database *db,
bool force = false,
std::string* errmsg = NULL);
diff --git a/src/mongo/db/storage/transaction.h b/src/mongo/db/operation_context.h
index e76e1ab49ca..ac155fe0240 100644
--- a/src/mongo/db/storage/transaction.h
+++ b/src/mongo/db/operation_context.h
@@ -39,20 +39,19 @@ namespace mongo {
class ProgressMeter;
/**
- * This name and this class are both a work in progress.
+ * This class encompasses the state required by an operation.
*
- * TODO(hk): move up a level, rename to OperationContext (or OpCtx if you're into the whole
- * brevity thing)
+ * TODO(HK): clarify what this means. There's one OperationContext for one user operation...
+ * but is this true for getmore? Also what about things like fsyncunlock / internal
+ * users / etc.?
*/
- class TransactionExperiment {
- MONGO_DISALLOW_COPYING(TransactionExperiment);
+ class OperationContext {
+ MONGO_DISALLOW_COPYING(OperationContext);
public:
- virtual ~TransactionExperiment() { }
+ virtual ~OperationContext() { }
/**
* Interface for durability. Caller DOES NOT own pointer.
- *
- * XXX: what's a better name for this
*/
virtual RecoveryUnit* recoveryUnit() const = 0;
@@ -113,7 +112,7 @@ namespace mongo {
int secondsBetween = 3) = 0;
/**
- * Returns a TransactionExperiment. Caller takes ownership.
+ * Returns a OperationContext. Caller takes ownership.
*
* This interface is used for functions that need to create transactions (aka OpCtx), but
* don't know which implementation they should create. It allows the calling code to make
@@ -121,16 +120,16 @@ namespace mongo {
*
* TODO come up with a better Factory API once we split this class up (SERVER-13931).
*/
- typedef TransactionExperiment* (*Factory)();
+ typedef OperationContext* (*Factory)();
/**
- * A TransactionExperiment::Factory that always returns NULL. For things that shouldn't be
+ * A OperationContext::Factory that always returns NULL. For things that shouldn't be
* touching their txns such as mongos or some unittests.
*/
- static TransactionExperiment* factoryNULL() { return NULL; }
+ static OperationContext* factoryNULL() { return NULL; }
protected:
- TransactionExperiment() {}
+ OperationContext() { }
};
} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/dur_transaction.cpp b/src/mongo/db/operation_context_impl.cpp
index 8dbf008d5d3..055ab5d6ef0 100644
--- a/src/mongo/db/storage/mmap_v1/dur_transaction.cpp
+++ b/src/mongo/db/operation_context_impl.cpp
@@ -26,7 +26,7 @@
* it in the license file.
*/
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/client.h"
#include "mongo/db/curop.h"
@@ -35,26 +35,26 @@
namespace mongo {
- DurTransaction::DurTransaction() {
+ OperationContextImpl::OperationContextImpl() {
_recovery.reset(new DurRecoveryUnit());
}
- RecoveryUnit* DurTransaction::recoveryUnit() const {
+ RecoveryUnit* OperationContextImpl::recoveryUnit() const {
return _recovery.get();
}
- ProgressMeter* DurTransaction::setMessage(const char* msg,
+ ProgressMeter* OperationContextImpl::setMessage(const char* msg,
const std::string& name,
unsigned long long progressMeterTotal,
int secondsBetween) {
return &cc().curop()->setMessage( msg, name, progressMeterTotal, secondsBetween );
}
- void DurTransaction::checkForInterrupt(bool heedMutex) const {
+ void OperationContextImpl::checkForInterrupt(bool heedMutex) const {
killCurrentOp.checkForInterrupt(heedMutex);
}
- Status DurTransaction::checkForInterruptNoAssert() const {
+ Status OperationContextImpl::checkForInterruptNoAssert() const {
const char* killed = killCurrentOp.checkForInterruptNoAssert();
if ( !killed || !killed[0] )
return Status::OK();
@@ -62,8 +62,8 @@ namespace mongo {
return Status( ErrorCodes::Interrupted, killed );
}
- TransactionExperiment* DurTransaction::factory() {
- return new DurTransaction();
+ OperationContext* OperationContextImpl::factory() {
+ return new OperationContextImpl();
}
} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/dur_transaction.h b/src/mongo/db/operation_context_impl.h
index a0dc1029e6a..6f7b5a7ff2d 100644
--- a/src/mongo/db/storage/mmap_v1/dur_transaction.h
+++ b/src/mongo/db/operation_context_impl.h
@@ -29,20 +29,17 @@
#include <boost/scoped_ptr.hpp>
#include <string>
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#pragma once
namespace mongo {
- /**
- * TODO(hk): Move to db/ and rename to OperationContextMongoDImpl or something better?
- */
- class DurTransaction : public TransactionExperiment {
+ class OperationContextImpl : public OperationContext {
public:
- DurTransaction();
+ OperationContextImpl();
- virtual ~DurTransaction() { }
+ virtual ~OperationContextImpl() { }
virtual RecoveryUnit* recoveryUnit() const;
@@ -56,9 +53,9 @@ namespace mongo {
virtual Status checkForInterruptNoAssert() const;
/**
- * Returns a DurTransaction. Caller takes ownership.
+ * Returns an OperationContext. Caller takes ownership.
*/
- static TransactionExperiment* factory();
+ static OperationContext* factory();
private:
boost::scoped_ptr<RecoveryUnit> _recovery;
diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp
index 1e28a895855..c78ca1692f1 100644
--- a/src/mongo/db/ops/delete.cpp
+++ b/src/mongo/db/ops/delete.cpp
@@ -38,7 +38,7 @@ namespace mongo {
justOne: stop after 1 match
god: allow access to system namespaces, and don't yield
*/
- long long deleteObjects(TransactionExperiment* txn,
+ long long deleteObjects(OperationContext* txn,
Database* db,
const StringData& ns,
BSONObj pattern,
diff --git a/src/mongo/db/ops/delete.h b/src/mongo/db/ops/delete.h
index 28327c42c06..f0536b63dd2 100644
--- a/src/mongo/db/ops/delete.h
+++ b/src/mongo/db/ops/delete.h
@@ -36,10 +36,10 @@
namespace mongo {
class Database;
- class TransactionExperiment;
+ class OperationContext;
// If justOne is true, deletedId is set to the id of the deleted object.
- long long deleteObjects(TransactionExperiment* txn,
+ long long deleteObjects(OperationContext* txn,
Database* db,
const StringData& ns,
BSONObj pattern,
diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp
index 7c16d203756..9c14c772bdc 100644
--- a/src/mongo/db/ops/delete_executor.cpp
+++ b/src/mongo/db/ops/delete_executor.cpp
@@ -79,7 +79,7 @@ namespace mongo {
return status;
}
- long long DeleteExecutor::execute(TransactionExperiment* txn, Database* db) {
+ long long DeleteExecutor::execute(OperationContext* txn, Database* db) {
uassertStatusOK(prepare());
uassert(17417,
mongoutils::str::stream() <<
diff --git a/src/mongo/db/ops/delete_executor.h b/src/mongo/db/ops/delete_executor.h
index ee072d957ad..475df92a105 100644
--- a/src/mongo/db/ops/delete_executor.h
+++ b/src/mongo/db/ops/delete_executor.h
@@ -39,7 +39,7 @@ namespace mongo {
class CanonicalQuery;
class Database;
class DeleteRequest;
- class TransactionExperiment;
+ class OperationContext;
/**
* Implementation of the processing of a delete operation in a mongod.
@@ -92,7 +92,7 @@ namespace mongo {
*
* Returns the number of documents deleted.
*/
- long long execute(TransactionExperiment* txn, Database* db);
+ long long execute(OperationContext* txn, Database* db);
private:
/// Unowned pointer to the request object that this executor will process.
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp
index 6559c2203a0..07e292f6320 100644
--- a/src/mongo/db/ops/update.cpp
+++ b/src/mongo/db/ops/update.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/query/query_planner_common.h"
#include "mongo/db/repl/is_master.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/platform/unordered_set.h"
@@ -416,7 +416,7 @@ namespace mongo {
}
} // namespace
- UpdateResult update(TransactionExperiment* txn,
+ UpdateResult update(OperationContext* txn,
Database* db,
const UpdateRequest& request,
OpDebug* opDebug) {
@@ -426,7 +426,7 @@ namespace mongo {
}
UpdateResult update(
- TransactionExperiment* txn,
+ OperationContext* txn,
Database* db,
const UpdateRequest& request,
OpDebug* opDebug,
diff --git a/src/mongo/db/ops/update.h b/src/mongo/db/ops/update.h
index cdb76718f3e..f950fbaf08c 100644
--- a/src/mongo/db/ops/update.h
+++ b/src/mongo/db/ops/update.h
@@ -38,7 +38,7 @@
namespace mongo {
class CanonicalQuery;
- class TransactionExperiment;
+ class OperationContext;
class UpdateDriver;
/**
@@ -46,7 +46,7 @@ namespace mongo {
*
* Caller must hold the appropriate database locks.
*/
- UpdateResult update(TransactionExperiment* txn,
+ UpdateResult update(OperationContext* txn,
Database* db,
const UpdateRequest& request,
OpDebug* opDebug);
@@ -59,7 +59,7 @@ namespace mongo {
*
* TODO: Move this into a private method of UpdateExecutor.
*/
- UpdateResult update(TransactionExperiment* txn,
+ UpdateResult update(OperationContext* txn,
Database* db,
const UpdateRequest& request,
OpDebug* opDebug,
diff --git a/src/mongo/db/ops/update_executor.cpp b/src/mongo/db/ops/update_executor.cpp
index 109a11ebed9..fd2f11701a7 100644
--- a/src/mongo/db/ops/update_executor.cpp
+++ b/src/mongo/db/ops/update_executor.cpp
@@ -62,7 +62,7 @@ namespace mongo {
return Status::OK();
}
- UpdateResult UpdateExecutor::execute(TransactionExperiment* txn, Database* db) {
+ UpdateResult UpdateExecutor::execute(OperationContext* txn, Database* db) {
uassertStatusOK(prepare());
return update(txn,
db,
diff --git a/src/mongo/db/ops/update_executor.h b/src/mongo/db/ops/update_executor.h
index ef2ca7ba503..881c0cc0d36 100644
--- a/src/mongo/db/ops/update_executor.h
+++ b/src/mongo/db/ops/update_executor.h
@@ -39,7 +39,7 @@ namespace mongo {
class CanonicalQuery;
class OpDebug;
- class TransactionExperiment;
+ class OperationContext;
class UpdateRequest;
/**
@@ -91,7 +91,7 @@ namespace mongo {
* Execute an update. Requires the caller to hold the database lock on the
* appropriate resources for the request.
*/
- UpdateResult execute(TransactionExperiment* txn, Database* db);
+ UpdateResult execute(OperationContext* txn, Database* db);
private:
/**
diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp
index 903a78cd12d..3b9170b5c56 100644
--- a/src/mongo/db/pdfile.cpp
+++ b/src/mongo/db/pdfile.cpp
@@ -78,7 +78,7 @@ _ disallow system* manipulations from the database.
#include "mongo/util/processinfo.h"
#include "mongo/db/stats/timer_stats.h"
#include "mongo/db/stats/counters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -97,7 +97,7 @@ namespace mongo {
* @param createDefaultIndexes - if false, defers id (and other) index creation.
* @return true if successful
*/
- Status userCreateNS( TransactionExperiment* txn,
+ Status userCreateNS( OperationContext* txn,
Database* db,
const StringData& ns,
BSONObj options,
@@ -141,7 +141,7 @@ namespace mongo {
void dropAllDatabasesExceptLocal() {
Lock::GlobalWrite lk;
- DurTransaction txn;
+ OperationContextImpl txn;
vector<string> n;
getDatabaseNames(n);
@@ -155,7 +155,7 @@ namespace mongo {
}
}
- void dropDatabase(TransactionExperiment* txn, Database* db ) {
+ void dropDatabase(OperationContext* txn, Database* db ) {
invariant( db );
string name = db->name(); // just to have safe
diff --git a/src/mongo/db/pdfile.h b/src/mongo/db/pdfile.h
index 8216e56b08b..92848f13afc 100644
--- a/src/mongo/db/pdfile.h
+++ b/src/mongo/db/pdfile.h
@@ -45,11 +45,11 @@
namespace mongo {
class Database;
- class TransactionExperiment;
+ class OperationContext;
- void dropDatabase(TransactionExperiment* txn, Database* db);
+ void dropDatabase(OperationContext* txn, Database* db);
- Status userCreateNS( TransactionExperiment* txn,
+ Status userCreateNS( OperationContext* txn,
Database* db,
const StringData& ns,
BSONObj options,
diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp
index 9236cb92333..51ce8036664 100644
--- a/src/mongo/db/query/new_find.cpp
+++ b/src/mongo/db/query/new_find.cpp
@@ -109,7 +109,7 @@ namespace {
namespace mongo {
// TODO: Move this and the other command stuff in newRunQuery outta here and up a level.
- static bool runCommands(TransactionExperiment* txn,
+ static bool runCommands(OperationContext* txn,
const char *ns,
BSONObj& jsobj,
CurOp& curop,
@@ -398,7 +398,7 @@ namespace mongo {
return Status::OK();
}
- std::string newRunQuery(TransactionExperiment* txn,
+ std::string newRunQuery(OperationContext* txn,
Message& m,
QueryMessage& q,
CurOp& curop,
diff --git a/src/mongo/db/query/new_find.h b/src/mongo/db/query/new_find.h
index 149bcce9b0a..263bf77065d 100644
--- a/src/mongo/db/query/new_find.h
+++ b/src/mongo/db/query/new_find.h
@@ -39,7 +39,7 @@
namespace mongo {
- class TransactionExperiment;
+ class OperationContext;
/**
* Called from the getMore entry point in ops/query.cpp.
@@ -50,7 +50,7 @@ namespace mongo {
/**
* Run the query 'q' and place the result in 'result'.
*/
- std::string newRunQuery(TransactionExperiment* txn,
+ std::string newRunQuery(OperationContext* txn,
Message& m,
QueryMessage& q,
CurOp& curop,
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp
index 229f7e82060..9ae7fdd2674 100644
--- a/src/mongo/db/range_deleter.cpp
+++ b/src/mongo/db/range_deleter.cpp
@@ -74,7 +74,7 @@ namespace mongo {
RangeDeleteEntry():
secondaryThrottle(true),
notifyDone(NULL),
- transactionFactory(TransactionExperiment::factoryNULL) { // XXX SERVER-13931
+ transactionFactory(OperationContext::factoryNULL) { // XXX SERVER-13931
}
std::string ns;
@@ -100,7 +100,7 @@ namespace mongo {
// Important invariant: Can only be set and used by one thread.
Notification* notifyDone;
- TransactionExperiment::Factory transactionFactory;
+ OperationContext::Factory transactionFactory;
// For debugging only
BSONObj toBSON() const {
@@ -196,7 +196,7 @@ namespace mongo {
}
}
- bool RangeDeleter::queueDelete(TransactionExperiment::Factory transactionFactory,
+ bool RangeDeleter::queueDelete(OperationContext::Factory transactionFactory,
const std::string& ns,
const BSONObj& min,
const BSONObj& max,
@@ -252,7 +252,7 @@ namespace mongo {
return true;
}
- bool RangeDeleter::deleteNow(TransactionExperiment* txn,
+ bool RangeDeleter::deleteNow(OperationContext* txn,
const std::string& ns,
const BSONObj& min,
const BSONObj& max,
@@ -475,7 +475,7 @@ namespace mongo {
}
{
- boost::scoped_ptr<TransactionExperiment> txn(nextTask->transactionFactory()); // XXX SERVER-13931
+ boost::scoped_ptr<OperationContext> txn(nextTask->transactionFactory()); // XXX SERVER-13931
if (!_env->deleteRange(txn.get(),
nextTask->ns,
nextTask->min,
diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h
index 653fb0105b0..9c47659bf0d 100644
--- a/src/mongo/db/range_deleter.h
+++ b/src/mongo/db/range_deleter.h
@@ -37,7 +37,7 @@
#include "mongo/base/string_data.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/concurrency/synchronization.h"
@@ -45,7 +45,7 @@ namespace mongo {
struct RangeDeleterEnv;
class RangeDeleterStats;
- class TransactionExperiment;
+ class OperationContext;
/**
* Class for deleting documents for a given namespace and range. It contains a queue of
@@ -131,7 +131,7 @@ namespace mongo {
* Returns true if the task is queued and false If the given range is blacklisted,
* is already queued, or stopWorkers() was called.
*/
- bool queueDelete(TransactionExperiment::Factory transactionFactory,
+ bool queueDelete(OperationContext::Factory transactionFactory,
const std::string& ns,
const BSONObj& min,
const BSONObj& max,
@@ -147,7 +147,7 @@ namespace mongo {
* Returns true if the deletion was performed. False if the range is blacklisted,
* was already queued, or stopWorkers() was called.
*/
- bool deleteNow(TransactionExperiment* txn,
+ bool deleteNow(OperationContext* txn,
const std::string& ns,
const BSONObj& min,
const BSONObj& max,
@@ -288,7 +288,7 @@ namespace mongo {
* Must be a synchronous call. Docs should be deleted after call ends.
* Must not throw Exceptions.
*/
- virtual bool deleteRange(TransactionExperiment* txn,
+ virtual bool deleteRange(OperationContext* txn,
const StringData& ns,
const BSONObj& inclusiveLower,
const BSONObj& exclusiveUpper,
diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp
index 71a0ca86796..44dd93e0c06 100644
--- a/src/mongo/db/range_deleter_db_env.cpp
+++ b/src/mongo/db/range_deleter_db_env.cpp
@@ -54,7 +54,7 @@ namespace mongo {
* 5. Delete range.
* 6. Wait until the majority of the secondaries catch up.
*/
- bool RangeDeleterDBEnv::deleteRange(TransactionExperiment* txn,
+ bool RangeDeleterDBEnv::deleteRange(OperationContext* txn,
const StringData& ns,
const BSONObj& inclusiveLower,
const BSONObj& exclusiveUpper,
diff --git a/src/mongo/db/range_deleter_db_env.h b/src/mongo/db/range_deleter_db_env.h
index 01089fc9d3d..9708fa49495 100644
--- a/src/mongo/db/range_deleter_db_env.h
+++ b/src/mongo/db/range_deleter_db_env.h
@@ -51,7 +51,7 @@ namespace mongo {
*
* Does not throw Exceptions.
*/
- virtual bool deleteRange(TransactionExperiment* txn,
+ virtual bool deleteRange(OperationContext* txn,
const StringData& ns,
const BSONObj& inclusiveLower,
const BSONObj& exclusiveUpper,
diff --git a/src/mongo/db/range_deleter_mock_env.cpp b/src/mongo/db/range_deleter_mock_env.cpp
index 22ecff1bea4..2b40a3e7bc6 100644
--- a/src/mongo/db/range_deleter_mock_env.cpp
+++ b/src/mongo/db/range_deleter_mock_env.cpp
@@ -100,7 +100,7 @@ namespace mongo {
return _deleteList.back();
}
- bool RangeDeleterMockEnv::deleteRange(TransactionExperiment* txn,
+ bool RangeDeleterMockEnv::deleteRange(OperationContext* txn,
const StringData& ns,
const BSONObj& min,
const BSONObj& max,
diff --git a/src/mongo/db/range_deleter_mock_env.h b/src/mongo/db/range_deleter_mock_env.h
index 4ba3e686d9d..2bffc7a418b 100644
--- a/src/mongo/db/range_deleter_mock_env.h
+++ b/src/mongo/db/range_deleter_mock_env.h
@@ -126,7 +126,7 @@ namespace mongo {
* but simply keeps a record of it. Can also be paused by pauseDeletes and
* resumed with resumeDeletes.
*/
- bool deleteRange(TransactionExperiment* txn,
+ bool deleteRange(OperationContext* txn,
const StringData& ns,
const BSONObj& min,
const BSONObj& max,
diff --git a/src/mongo/db/range_deleter_stat_test.cpp b/src/mongo/db/range_deleter_stat_test.cpp
index 695da1d8a26..19d85b8a7f1 100644
--- a/src/mongo/db/range_deleter_stat_test.cpp
+++ b/src/mongo/db/range_deleter_stat_test.cpp
@@ -48,9 +48,9 @@ namespace {
using mongo::RangeDeleter;
using mongo::RangeDeleterMockEnv;
using mongo::RangeDeleterStats;
- using mongo::TransactionExperiment;
+ using mongo::OperationContext;
- TransactionExperiment* const noTxn = NULL; // MockEnv doesn't need txn XXX SERVER-13931
+ OperationContext* const noTxn = NULL; // MockEnv doesn't need txn XXX SERVER-13931
TEST(NoDeletes, InitialState) {
RangeDeleterMockEnv* env = new RangeDeleterMockEnv();
@@ -88,7 +88,7 @@ namespace {
string errMsg;
Notification notifyDone;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL,
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL,
ns,
BSON("x" << 0),
BSON("x" << 10),
@@ -131,7 +131,7 @@ namespace {
Notification deleteDone;
string errMsg;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns,
BSON("x" << 0),
BSON("x" << 10),
@@ -175,7 +175,7 @@ namespace {
string errMsg;
Notification notifyDone;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns,
BSON("x" << 0),
BSON("x" << 10),
diff --git a/src/mongo/db/range_deleter_test.cpp b/src/mongo/db/range_deleter_test.cpp
index 1bc2ac0beae..5ae950a606b 100644
--- a/src/mongo/db/range_deleter_test.cpp
+++ b/src/mongo/db/range_deleter_test.cpp
@@ -49,9 +49,9 @@ namespace {
using mongo::RangeDeleter;
using mongo::RangeDeleterMockEnv;
using mongo::RangeDeleterStats;
- using mongo::TransactionExperiment;
+ using mongo::OperationContext;
- TransactionExperiment* const noTxn = NULL; // MockEnv doesn't need txn XXX SERVER-13931
+ OperationContext* const noTxn = NULL; // MockEnv doesn't need txn XXX SERVER-13931
// Capped sleep interval is 640 mSec, Nyquist frequency is 1280 mSec => round up to 2 sec.
const int MAX_IMMEDIATE_DELETE_WAIT_SECS = 2;
@@ -65,7 +65,7 @@ namespace {
deleter.stopWorkers();
string errMsg;
- ASSERT_FALSE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_FALSE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
"test.user",
BSON("x" << 120),
BSON("x" << 200),
@@ -88,7 +88,7 @@ namespace {
env->addCursorId(ns, 345);
Notification notifyDone;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns, BSON("x" << 0), BSON("x" << 10), BSON("x" << 1),
true, &notifyDone, NULL /* errMsg not needed */));
@@ -127,7 +127,7 @@ namespace {
env->addCursorId(ns, 345);
Notification notifyDone;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns, BSON("x" << 0), BSON("x" << 10), BSON("x" << 1),
true, &notifyDone, NULL /* errMsg not needed */));
@@ -246,7 +246,7 @@ namespace {
env->pauseDeletes();
Notification notifyDone1;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns,
BSON("x" << 10),
BSON("x" << 20),
@@ -265,7 +265,7 @@ namespace {
ASSERT_EQUALS(1, inProgressCount);
Notification notifyDone2;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
blockedNS,
BSON("x" << 20),
BSON("x" << 30),
@@ -275,7 +275,7 @@ namespace {
NULL /* don't care errMsg */));
Notification notifyDone3;
- ASSERT_TRUE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_TRUE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns,
BSON("x" << 30),
BSON("x" << 40),
@@ -363,7 +363,7 @@ namespace {
ASSERT_TRUE(errMsg.empty());
errMsg.clear();
- ASSERT_FALSE(deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ ASSERT_FALSE(deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns, BSON("x" << 120), BSON("x" << 140), BSON("x" << 1),
false, NULL /* notifier not needed */, &errMsg));
ASSERT_FALSE(errMsg.empty());
@@ -412,7 +412,7 @@ namespace {
env->addCursorId(ns, 58);
Notification notifyDone;
- deleter.queueDelete(TransactionExperiment::factoryNULL, // XXX SERVER-13931
+ deleter.queueDelete(OperationContext::factoryNULL, // XXX SERVER-13931
ns, BSON("x" << 0), BSON("x" << 10), BSON("x" << 1),
false, &notifyDone, NULL /* errMsg not needed */);
diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp
index 9151e81300a..aa69da2b021 100644
--- a/src/mongo/db/repair_database.cpp
+++ b/src/mongo/db/repair_database.cpp
@@ -225,7 +225,7 @@ namespace mongo {
class RepairFileDeleter {
public:
- RepairFileDeleter( TransactionExperiment* txn,
+ RepairFileDeleter( OperationContext* txn,
const string& dbName,
const string& pathString,
const Path& path )
@@ -264,14 +264,14 @@ namespace mongo {
}
private:
- TransactionExperiment* _txn;
+ OperationContext* _txn;
string _dbName;
string _pathString;
Path _path;
bool _success;
};
- Status repairDatabase( TransactionExperiment* txn,
+ Status repairDatabase( OperationContext* txn,
string dbName,
bool preserveClonedFilesOnFailure,
bool backupOriginalFiles ) {
diff --git a/src/mongo/db/repair_database.h b/src/mongo/db/repair_database.h
index 16f5ae1d747..eb4f0f9b4e7 100644
--- a/src/mongo/db/repair_database.h
+++ b/src/mongo/db/repair_database.h
@@ -36,7 +36,7 @@
#include "mongo/platform/cstdint.h"
namespace mongo {
- class TransactionExperiment;
+ class OperationContext;
// TODO: move
intmax_t dbSize( const std::string& database );
@@ -45,7 +45,7 @@ namespace mongo {
void _deleteDataFiles(const std::string& database);
// must have a global lock
- Status repairDatabase( TransactionExperiment* txn,
+ Status repairDatabase( OperationContext* txn,
std::string db,
bool preserveClonedFilesOnFailure = false,
bool backupOriginalFiles = false );
diff --git a/src/mongo/db/repl/consensus.cpp b/src/mongo/db/repl/consensus.cpp
index 90c1197aaa9..86bcc17f9df 100644
--- a/src/mongo/db/repl/consensus.cpp
+++ b/src/mongo/db/repl/consensus.cpp
@@ -101,7 +101,7 @@ namespace mongo {
return false;
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
@@ -149,7 +149,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
private:
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
theReplSet->elect.electCmdReceived(cmdObj, &result);
diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp
index 7956dc40877..f6b627a70f9 100644
--- a/src/mongo/db/repl/heartbeat.cpp
+++ b/src/mongo/db/repl/heartbeat.cpp
@@ -68,7 +68,7 @@ namespace mongo {
actions.addAction(ActionType::internal);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( replSetBlind ) {
if (theReplSet) {
errmsg = str::stream() << theReplSet->selfFullName() << " is blind";
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index a08ad3ccf97..4326a1d146c 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -53,7 +53,7 @@
#include "mongo/db/repl/repl_settings.h" // replSettings
#include "mongo/db/repl/rs.h" // replLocalAuth()
#include "mongo/db/server_parameters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/exit.h"
@@ -162,7 +162,7 @@ namespace mongo {
string myname = getHostName();
{
Client::WriteContext ctx("local");
- DurTransaction txn;
+ OperationContextImpl txn;
// local.me is an identifier for a server for getLastError w:2+
if (!Helpers::getSingleton("local.me", _me) ||
!_me.hasField("host") ||
@@ -196,7 +196,7 @@ namespace mongo {
{
OpDebug debug;
Client::Context ctx("local.sources");
- DurTransaction txn;
+ OperationContextImpl txn;
const NamespaceString requestNs("local.sources");
UpdateRequest request(requestNs);
@@ -304,7 +304,7 @@ namespace mongo {
uassert(17066, "Internal error reading from local.sources", Runner::RUNNER_EOF == state);
}
- bool ReplSource::throttledForceResyncDead( TransactionExperiment* txn, const char *requester ) {
+ bool ReplSource::throttledForceResyncDead( OperationContext* txn, const char *requester ) {
if ( time( 0 ) - lastForcedResync > 600 ) {
forceResyncDead( txn, requester );
lastForcedResync = time( 0 );
@@ -313,7 +313,7 @@ namespace mongo {
return false;
}
- void ReplSource::forceResyncDead( TransactionExperiment* txn, const char *requester ) {
+ void ReplSource::forceResyncDead( OperationContext* txn, const char *requester ) {
if ( !replAllDead )
return;
SourceVector sources;
@@ -325,7 +325,7 @@ namespace mongo {
replAllDead = 0;
}
- void ReplSource::forceResync( TransactionExperiment* txn, const char *requester ) {
+ void ReplSource::forceResync( OperationContext* txn, const char *requester ) {
BSONObj info;
{
dbtemprelease t;
@@ -355,14 +355,14 @@ namespace mongo {
save();
}
- void ReplSource::resyncDrop( TransactionExperiment* txn, const string& db ) {
+ void ReplSource::resyncDrop( OperationContext* txn, const string& db ) {
log() << "resync: dropping database " << db;
Client::Context ctx(db);
dropDatabase(txn, ctx.db());
}
/* grab initial copy of a database from the master */
- void ReplSource::resync(TransactionExperiment* txn, const std::string& dbName) {
+ void ReplSource::resync(OperationContext* txn, const std::string& dbName) {
const std::string db(dbName); // need local copy of the name, we're dropping the original
resyncDrop( txn, db );
Client::Context ctx( db );
@@ -420,7 +420,7 @@ namespace mongo {
}
}
- bool ReplSource::handleDuplicateDbName( TransactionExperiment* txn,
+ bool ReplSource::handleDuplicateDbName( OperationContext* txn,
const BSONObj &op,
const char* ns,
const char* db ) {
@@ -504,7 +504,7 @@ namespace mongo {
return true;
}
- void ReplSource::applyOperation(TransactionExperiment* txn, Database* db, const BSONObj& op) {
+ void ReplSource::applyOperation(OperationContext* txn, Database* db, const BSONObj& op) {
try {
bool failedUpdate = applyOperation_inlock( txn, db, op );
if (failedUpdate) {
@@ -598,7 +598,7 @@ namespace mongo {
}
scoped_ptr<Lock::GlobalWrite> lk( alreadyLocked ? 0 : new Lock::GlobalWrite() );
- DurTransaction txn; // XXX?
+ OperationContextImpl txn; // XXX?
if ( replAllDead ) {
// hmmm why is this check here and not at top of this function? does it get set between top and here?
@@ -1090,7 +1090,7 @@ namespace mongo {
int s = 0;
{
Lock::GlobalWrite lk;
- DurTransaction txn;
+ OperationContextImpl txn;
if ( replAllDead ) {
// throttledForceResyncDead can throw
if ( !replSettings.autoresync || !ReplSource::throttledForceResyncDead( &txn, "auto" ) ) {
diff --git a/src/mongo/db/repl/master_slave.h b/src/mongo/db/repl/master_slave.h
index 41c1e04e146..dbcd0953fb5 100644
--- a/src/mongo/db/repl/master_slave.h
+++ b/src/mongo/db/repl/master_slave.h
@@ -42,7 +42,7 @@
namespace mongo {
class Database;
- class TransactionExperiment;
+ class OperationContext;
// Main entry point for master/slave at startup time.
void startMasterSlave();
@@ -77,7 +77,7 @@ namespace mongo {
class ReplSource {
shared_ptr<threadpool::ThreadPool> tp;
- void resync(TransactionExperiment* txn, const std::string& dbName);
+ void resync(OperationContext* txn, const std::string& dbName);
/** @param alreadyLocked caller already put us in write lock if true */
void sync_pullOpLog_applyOperation(BSONObj& op, bool alreadyLocked);
@@ -100,7 +100,7 @@ namespace mongo {
ReplSource();
- void resyncDrop( TransactionExperiment* txn, const string& db );
+ void resyncDrop( OperationContext* txn, const string& db );
// call without the db mutex
void syncToTailOfRemoteLog();
string ns() const { return string( "local.oplog.$" ) + sourceName(); }
@@ -112,7 +112,7 @@ namespace mongo {
* master.
* @return true iff an op with the specified ns may be applied.
*/
- bool handleDuplicateDbName( TransactionExperiment* txn,
+ bool handleDuplicateDbName( OperationContext* txn,
const BSONObj &op,
const char* ns,
const char* db );
@@ -123,7 +123,7 @@ namespace mongo {
public:
OplogReader oplogReader;
- void applyOperation(TransactionExperiment* txn, Database* db, const BSONObj& op);
+ void applyOperation(OperationContext* txn, Database* db, const BSONObj& op);
string hostName; // ip addr or hostname plus optionally, ":<port>"
string _sourceName; // a logical source name.
string sourceName() const { return _sourceName.empty() ? "main" : _sourceName; }
@@ -160,9 +160,9 @@ namespace mongo {
return wait > 0 ? wait : 0;
}
- static bool throttledForceResyncDead( TransactionExperiment* txn, const char *requester );
- static void forceResyncDead( TransactionExperiment* txn, const char *requester );
- void forceResync( TransactionExperiment* txn, const char *requester );
+ static bool throttledForceResyncDead( OperationContext* txn, const char *requester );
+ static void forceResyncDead( OperationContext* txn, const char *requester );
+ void forceResync( OperationContext* txn, const char *requester );
};
/**
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 61cb23f914b..41c4ac7aacf 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -55,7 +55,7 @@
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/write_concern.h"
#include "mongo/db/stats/counters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/s/d_logic.h"
@@ -97,7 +97,7 @@ namespace mongo {
result.isOK() );
}
- static void _logOpUninitialized(TransactionExperiment* txn,
+ static void _logOpUninitialized(OperationContext* txn,
const char *opstr,
const char *ns,
const char *logNS,
@@ -113,7 +113,7 @@ namespace mongo {
*/
void _logOpObjRS(const BSONObj& op) {
Lock::DBWrite lk("local");
- DurTransaction txn;
+ OperationContextImpl txn;
const OpTime ts = op["ts"]._opTime();
long long h = op["h"].numberLong();
@@ -222,7 +222,7 @@ namespace mongo {
// on every logop call.
static BufBuilder logopbufbuilder(8*1024);
static const int OPLOG_VERSION = 2;
- static void _logOpRS(TransactionExperiment* txn,
+ static void _logOpRS(OperationContext* txn,
const char *opstr,
const char *ns,
const char *logNS,
@@ -312,7 +312,7 @@ namespace mongo {
}
- static void _logOpOld(TransactionExperiment* txn,
+ static void _logOpOld(OperationContext* txn,
const char *opstr,
const char *ns,
const char *logNS,
@@ -373,7 +373,7 @@ namespace mongo {
context.getClient()->setLastOp( ts );
}
- static void (*_logOp)(TransactionExperiment* txn,
+ static void (*_logOp)(OperationContext* txn,
const char *opstr,
const char *ns,
const char *logNS,
@@ -392,14 +392,14 @@ namespace mongo {
void oldRepl() { _logOp = _logOpOld; }
void logKeepalive() {
- DurTransaction txn;
+ OperationContextImpl txn;
_logOp(&txn, "n", "", 0, BSONObj(), 0, 0, false);
}
void logOpComment(const BSONObj& obj) {
- DurTransaction txn;
+ OperationContextImpl txn;
_logOp(&txn, "n", "", 0, obj, 0, 0, false);
}
- void logOpInitiate(TransactionExperiment* txn, const BSONObj& obj) {
+ void logOpInitiate(OperationContext* txn, const BSONObj& obj) {
_logOpRS(txn, "n", "", 0, obj, 0, 0, false);
}
@@ -410,7 +410,7 @@ namespace mongo {
d delete / remove
u update
*/
- void logOp(TransactionExperiment* txn,
+ void logOp(OperationContext* txn,
const char* opstr,
const char* ns,
const BSONObj& obj,
@@ -441,7 +441,7 @@ namespace mongo {
ns = rsoplog;
Client::Context ctx(ns);
- DurTransaction txn;
+ OperationContextImpl txn;
Collection* collection = ctx.db()->getCollection( &txn, ns );
if ( collection ) {
@@ -512,7 +512,7 @@ namespace mongo {
/** @param fromRepl false if from ApplyOpsCmd
@return true if was and update should have happened and the document DNE. see replset initial sync code.
*/
- bool applyOperation_inlock(TransactionExperiment* txn,
+ bool applyOperation_inlock(OperationContext* txn,
Database* db,
const BSONObj& op,
bool fromRepl,
diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h
index f64828bef0d..68714dea96d 100644
--- a/src/mongo/db/repl/oplog.h
+++ b/src/mongo/db/repl/oplog.h
@@ -32,7 +32,7 @@ namespace mongo {
class BSONObj;
class Database;
- class TransactionExperiment;
+ class OperationContext;
class OpTime;
// These functions redefine the function for logOp(),
@@ -68,7 +68,7 @@ namespace mongo {
See _logOp() in oplog.cpp for more details.
*/
- void logOp( TransactionExperiment* txn,
+ void logOp( OperationContext* txn,
const char *opstr,
const char *ns,
const BSONObj& obj,
@@ -96,7 +96,7 @@ namespace mongo {
* @param convertUpdateToUpsert convert some updates to upserts for idempotency reasons
* Returns if the op was an update that could not be applied (true on failure)
*/
- bool applyOperation_inlock(TransactionExperiment* txn,
+ bool applyOperation_inlock(OperationContext* txn,
Database* db,
const BSONObj& op,
bool fromRepl = true,
diff --git a/src/mongo/db/repl/repl_settings.cpp b/src/mongo/db/repl/repl_settings.cpp
index 623b76ce557..474631dd5e8 100644
--- a/src/mongo/db/repl/repl_settings.cpp
+++ b/src/mongo/db/repl/repl_settings.cpp
@@ -188,7 +188,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
CmdIsMaster() : Command("isMaster", true, "ismaster") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
/* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not
authenticated.
*/
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp
index e67b24395f4..1ac6e0daec3 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/replset_commands.cpp
@@ -65,7 +65,7 @@ namespace mongo {
const BSONObj& cmdObj,
std::vector<Privilege>* out) {}
CmdReplSetTest() : ReplSetCommand("replSetTest") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
log() << "replSet replSetTest command received: " << cmdObj.toString() << rsLog;
if( cmdObj.hasElement("forceInitialSyncFailure") ) {
@@ -120,7 +120,7 @@ namespace mongo {
actions.addAction(ActionType::internal);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
result.append("rbid",rbid);
@@ -155,7 +155,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetGetStatus() : ReplSetCommand("replSetGetStatus", true) { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if ( cmdObj["forShell"].trueValue() )
lastError.disableForCommand();
@@ -182,7 +182,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetReconfig() : ReplSetCommand("replSetReconfig"), mutex("rsreconfig") { }
- virtual bool run(TransactionExperiment* txn, const string& a, BSONObj& b, int e, string& errmsg, BSONObjBuilder& c, bool d) {
+ virtual bool run(OperationContext* txn, const string& a, BSONObj& b, int e, string& errmsg, BSONObjBuilder& c, bool d) {
try {
rwlock_try_write lk(mutex);
return _run(a,b,e,errmsg,c,d);
@@ -277,7 +277,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetFreeze() : ReplSetCommand("replSetFreeze") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
int secs = (int) cmdObj.firstElement().numberInt();
@@ -307,7 +307,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetStepDown() : ReplSetCommand("replSetStepDown") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
if( !theReplSet->box.getState().primary() ) {
@@ -362,7 +362,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetMaintenance() : ReplSetCommand("replSetMaintenance") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !check(errmsg, result) )
return false;
@@ -394,7 +394,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetSyncFrom() : ReplSetCommand("replSetSyncFrom") { }
- virtual bool run(TransactionExperiment* txn, const string&,
+ virtual bool run(OperationContext* txn, const string&,
BSONObj& cmdObj,
int,
string& errmsg,
@@ -422,7 +422,7 @@ namespace mongo {
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
CmdReplSetUpdatePosition() : ReplSetCommand("replSetUpdatePosition") { }
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg,
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg,
BSONObjBuilder& result, bool fromRepl) {
if (!check(errmsg, result))
return false;
diff --git a/src/mongo/db/repl/replset_web_handler.cpp b/src/mongo/db/repl/replset_web_handler.cpp
index 5cd7b14ae48..0f4c9b96bca 100644
--- a/src/mongo/db/repl/replset_web_handler.cpp
+++ b/src/mongo/db/repl/replset_web_handler.cpp
@@ -53,7 +53,7 @@ namespace {
return startsWith( url , "/_replSet" );
}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp
index dd412358b7d..c9c608d6f80 100644
--- a/src/mongo/db/repl/resync.cpp
+++ b/src/mongo/db/repl/resync.cpp
@@ -30,7 +30,7 @@
#include "mongo/db/repl/master_slave.h" // replSettings
#include "mongo/db/repl/repl_settings.h" // replSettings
#include "mongo/db/repl/rs.h" // replLocalAuth()
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -57,7 +57,7 @@ namespace mongo {
}
CmdResync() : Command("resync") { }
- virtual bool run(TransactionExperiment* txn,
+ virtual bool run(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int,
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index e25bf26bd90..4b52a60f68a 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/repl/repl_start.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/server_parameters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/platform/bits.h"
#include "mongo/s/d_logic.h"
#include "mongo/util/exit.h"
@@ -120,7 +120,7 @@ namespace {
void dropAllTempCollections() {
vector<string> dbNames;
getDatabaseNames(dbNames);
- DurTransaction txn;
+ OperationContextImpl txn;
for (vector<string>::const_iterator it = dbNames.begin(); it != dbNames.end(); ++it) {
// The local db is special because it isn't replicated. It is cleared at startup even on
// replica set members.
@@ -939,13 +939,13 @@ namespace {
void ReplSetImpl::clearInitialSyncFlag() {
Lock::DBWrite lk( "local" );
- DurTransaction txn; // XXX?
+ OperationContextImpl txn; // XXX?
Helpers::putSingleton(&txn, "local.replset.minvalid", BSON( "$unset" << _initialSyncFlag ));
}
void ReplSetImpl::setInitialSyncFlag() {
Lock::DBWrite lk( "local" );
- DurTransaction txn; // XXX?
+ OperationContextImpl txn; // XXX?
Helpers::putSingleton(&txn, "local.replset.minvalid", BSON( "$set" << _initialSyncFlag ));
}
@@ -964,7 +964,7 @@ namespace {
subobj.appendTimestamp("ts", obj["ts"].date());
subobj.done();
Lock::DBWrite lk( "local" );
- DurTransaction txn; // XXX?
+ OperationContextImpl txn; // XXX?
Helpers::putSingleton(&txn, "local.replset.minvalid", builder.obj());
}
diff --git a/src/mongo/db/repl/rs_config.cpp b/src/mongo/db/repl/rs_config.cpp
index 75186b24d52..889e79466dd 100644
--- a/src/mongo/db/repl/rs_config.cpp
+++ b/src/mongo/db/repl/rs_config.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_settings.h" // replSettings
#include "mongo/db/repl/rs.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/text.h"
@@ -51,7 +51,7 @@ namespace mongo {
const int ReplSetConfig::DEFAULT_HB_TIMEOUT = 10;
static AtomicUInt _warnedAboutVotes = 0;
- void logOpInitiate(TransactionExperiment* txn, const bo&);
+ void logOpInitiate(OperationContext* txn, const bo&);
void assertOnlyHas(BSONObj o, const set<string>& fields) {
BSONObj::iterator i(o);
@@ -82,7 +82,7 @@ namespace mongo {
<< newConfigBSON << rsLog;
{
Client::WriteContext cx( rsConfigNs );
- DurTransaction txn;
+ OperationContextImpl txn;
//theReplSet->lastOpTimeWritten = ??;
//rather than above, do a logOp()? probably
diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp
index 506e9a8d9a6..25626d83491 100644
--- a/src/mongo/db/repl/rs_initialsync.cpp
+++ b/src/mongo/db/repl/rs_initialsync.cpp
@@ -42,7 +42,7 @@
#include "mongo/bson/optime.h"
#include "mongo/db/repl/repl_settings.h" // replSettings
#include "mongo/db/repl/initial_sync.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/util/mongoutils/str.h"
@@ -98,7 +98,7 @@ namespace mongo {
sethbmsg( str::stream() << "initial sync cloning indexes for : " << db , 0);
Client::WriteContext ctx(db);
- DurTransaction txn;
+ OperationContextImpl txn;
string err;
int errCode;
@@ -129,7 +129,7 @@ namespace mongo {
static void emptyOplog() {
Client::WriteContext ctx(rsoplog);
- DurTransaction txn;
+ OperationContextImpl txn;
Collection* collection = ctx.ctx().db()->getCollection(rsoplog);
// temp
diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp
index 82e5c9d4934..b007c1fc8bf 100644
--- a/src/mongo/db/repl/rs_initiate.cpp
+++ b/src/mongo/db/repl/rs_initiate.cpp
@@ -178,7 +178,7 @@ namespace mongo {
actions.addAction(ActionType::replSetConfigure);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
log() << "replSet replSetInitiate admin command received from client" << rsLog;
if( !replSet ) {
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 93c9e2306fb..0fa386adb00 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/structure/catalog/namespace_details.h"
/* Scenarios
@@ -337,7 +337,7 @@ namespace mongo {
void ReplSetImpl::syncFixUp(HowToFixUp& h, OplogReader& r) {
DBClientConnection *them = r.conn();
- DurTransaction txn;
+ OperationContextImpl txn;
// fetch all first so we needn't handle interruption in a fancy way
diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp
index d9867296388..09f0deb86a7 100644
--- a/src/mongo/db/repl/rs_sync.cpp
+++ b/src/mongo/db/repl/rs_sync.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/repl/sync_tail.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/timer_stats.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/fail_point_service.h"
@@ -230,7 +230,7 @@ namespace mongo {
changeState(MemberState::RS_RECOVERING);
Client::Context ctx("local");
- DurTransaction txn;
+ OperationContextImpl txn;
ctx.db()->dropCollection(&txn, "local.oplog.rs");
{
boost::unique_lock<boost::mutex> lock(theReplSet->initialSyncMutex);
diff --git a/src/mongo/db/repl/sync.cpp b/src/mongo/db/repl/sync.cpp
index 9a4b5ad8073..814ea19997c 100644
--- a/src/mongo/db/repl/sync.cpp
+++ b/src/mongo/db/repl/sync.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/db/pdfile.h"
#include "mongo/db/repl/oplogreader.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
@@ -110,7 +110,7 @@ namespace mongo {
// should already have write lock
const char *ns = o.getStringField("ns");
Client::Context ctx(ns);
- DurTransaction txn;
+ OperationContextImpl txn;
// we don't have the object yet, which is possible on initial sync. get it.
log() << "replication info adding missing object" << endl; // rare enough we can log
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index 58daadb7bf2..03c243683b4 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/rs.h" // theReplSet
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
namespace mongo {
@@ -66,7 +66,7 @@ namespace mongo {
string myname = getHostName();
{
Client::WriteContext ctx("local");
- DurTransaction txn;
+ OperationContextImpl txn;
// local.me is an identifier for a server for getLastError w:2+
if (!Helpers::getSingleton("local.me", _me) ||
!_me.hasField("host") ||
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 91eb4b291db..6071905e8f1 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/stats/timer_stats.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/fail_point_service.h"
namespace mongo {
@@ -106,7 +106,7 @@ namespace replset {
}
Client::Context ctx(ns, storageGlobalParams.dbpath);
- DurTransaction txn;
+ OperationContextImpl txn;
ctx.getClient()->curop()->reset();
// For non-initial-sync, we convert updates to upserts
// to suppress errors when replaying oplog entries.
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index bb2243272ea..4ddf39ff3e2 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -66,7 +66,7 @@ namespace mongo {
url.find_last_of( '/' ) > 0;
}
- virtual void handle( TransactionExperiment* txn,
+ virtual void handle( OperationContext* txn,
const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp
index d1855f842e6..2ec710ae57d 100644
--- a/src/mongo/db/stats/top.cpp
+++ b/src/mongo/db/stats/top.cpp
@@ -188,7 +188,7 @@ namespace mongo {
actions.addAction(ActionType::top);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ virtual bool run(OperationContext* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
{
BSONObjBuilder b( result.subobjStart( "totals" ) );
b.append( "note" , "all times in microseconds" );
diff --git a/src/mongo/db/storage/data_file.cpp b/src/mongo/db/storage/data_file.cpp
index adeaf34b129..b6466fd5b71 100644
--- a/src/mongo/db/storage/data_file.cpp
+++ b/src/mongo/db/storage/data_file.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/d_concurrency.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/lockstate.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/file_allocator.h"
namespace mongo {
@@ -88,7 +88,7 @@ namespace mongo {
}
/** @return true if found and opened. if uninitialized (prealloc only) does not open. */
- Status DataFile::openExisting( TransactionExperiment* txn, const char *filename ) {
+ Status DataFile::openExisting( OperationContext* txn, const char *filename ) {
verify( _mb == 0 );
if( !boost::filesystem::exists(filename) )
return Status( ErrorCodes::InvalidPath, "DataFile::openExisting - file does not exist" );
@@ -118,7 +118,7 @@ namespace mongo {
return Status::OK();
}
- void DataFile::open( TransactionExperiment* txn,
+ void DataFile::open( OperationContext* txn,
const char *filename,
int minSize,
bool preallocateOnly ) {
@@ -160,7 +160,7 @@ namespace mongo {
mmf.flush( sync );
}
- DiskLoc DataFile::allocExtentArea( TransactionExperiment* txn, int size ) {
+ DiskLoc DataFile::allocExtentArea( OperationContext* txn, int size ) {
massert( 10357, "shutdown in progress", !inShutdown() );
massert( 10359, "header==0 on new extent: 32 bit mmap space exceeded?", header() ); // null if file open failed
@@ -178,7 +178,7 @@ namespace mongo {
// -------------------------------------------------------------------------------
- void DataFileHeader::init(TransactionExperiment* txn, int fileno, int filelength, const char* filename) {
+ void DataFileHeader::init(OperationContext* txn, int fileno, int filelength, const char* filename) {
if ( uninitialized() ) {
DEV log() << "datafileheader::init initializing " << filename << " n:" << fileno << endl;
if( !(filelength > 32768 ) ) {
@@ -217,7 +217,7 @@ namespace mongo {
}
}
- void DataFileHeader::checkUpgrade(TransactionExperiment* txn) {
+ void DataFileHeader::checkUpgrade(OperationContext* txn) {
if ( freeListStart == minDiskLoc ) {
// we are upgrading from 2.4 to 2.6
invariant( freeListEnd == minDiskLoc ); // both start and end should be (0,0) or real
diff --git a/src/mongo/db/storage/data_file.h b/src/mongo/db/storage/data_file.h
index d96d20dffd7..f83e9f8f08f 100644
--- a/src/mongo/db/storage/data_file.h
+++ b/src/mongo/db/storage/data_file.h
@@ -37,7 +37,7 @@
namespace mongo {
class ExtentManager;
- class TransactionExperiment;
+ class OperationContext;
/* a datafile - i.e. the "dbname.<#>" files :
@@ -77,9 +77,9 @@ namespace mongo {
bool uninitialized() const { return version == 0; }
- void init(TransactionExperiment* txn, int fileno, int filelength, const char* filename);
+ void init(OperationContext* txn, int fileno, int filelength, const char* filename);
- void checkUpgrade(TransactionExperiment* txn);
+ void checkUpgrade(OperationContext* txn);
bool isEmpty() const {
return uninitialized() || ( unusedLength == fileLength - HeaderSize - 16 );
@@ -95,15 +95,15 @@ namespace mongo {
DataFile(int fn) : _mb(0), fileNo(fn) { }
/** @return true if found and opened. if uninitialized (prealloc only) does not open. */
- Status openExisting( TransactionExperiment* txn, const char *filename );
+ Status openExisting( OperationContext* txn, const char *filename );
/** creates if DNE */
- void open(TransactionExperiment* txn,
+ void open(OperationContext* txn,
const char *filename,
int requestedDataSize = 0,
bool preallocateOnly = false);
- DiskLoc allocExtentArea( TransactionExperiment* txn, int size );
+ DiskLoc allocExtentArea( OperationContext* txn, int size );
DataFileHeader* getHeader() { return header(); }
const DataFileHeader* getHeader() const { return header(); }
diff --git a/src/mongo/db/storage/extent_manager.h b/src/mongo/db/storage/extent_manager.h
index 7ebb7b199c4..671f4271698 100644
--- a/src/mongo/db/storage/extent_manager.h
+++ b/src/mongo/db/storage/extent_manager.h
@@ -41,7 +41,7 @@ namespace mongo {
class DataFile;
class Record;
- class TransactionExperiment;
+ class OperationContext;
struct Extent;
@@ -68,7 +68,7 @@ namespace mongo {
/**
* opens all current files
*/
- virtual Status init(TransactionExperiment* txn) = 0;
+ virtual Status init(OperationContext* txn) = 0;
virtual size_t numFiles() const = 0;
virtual long long fileSize() const = 0;
@@ -76,7 +76,7 @@ namespace mongo {
virtual void flushFiles( bool sync ) = 0;
// must call Extent::reuse on the returned extent
- virtual DiskLoc allocateExtent( TransactionExperiment* txn,
+ virtual DiskLoc allocateExtent( OperationContext* txn,
bool capped,
int size,
int quotaMax ) = 0;
@@ -84,14 +84,14 @@ namespace mongo {
/**
* firstExt has to be == lastExt or a chain
*/
- virtual void freeExtents( TransactionExperiment* txn,
+ virtual void freeExtents( OperationContext* txn,
DiskLoc firstExt, DiskLoc lastExt ) = 0;
/**
* frees a single extent
* ignores all fields in the Extent except: magic, myLoc, length
*/
- virtual void freeExtent( TransactionExperiment* txn, DiskLoc extent ) = 0;
+ virtual void freeExtent( OperationContext* txn, DiskLoc extent ) = 0;
virtual void freeListStats( int* numExtents, int64_t* totalFreeSize ) const = 0;
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
index 84bfae056e7..85ad027b39b 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
namespace mongo {
@@ -74,7 +74,7 @@ namespace mongo {
}
- Status MmapV1ExtentManager::init(TransactionExperiment* txn) {
+ Status MmapV1ExtentManager::init(OperationContext* txn) {
verify( _files.size() == 0 );
for ( int n = 0; n < DiskLoc::MaxFiles; n++ ) {
@@ -113,7 +113,7 @@ namespace mongo {
// todo: this is called a lot. streamline the common case
- DataFile* MmapV1ExtentManager::getFile( TransactionExperiment* txn,
+ DataFile* MmapV1ExtentManager::getFile( OperationContext* txn,
int n,
int sizeNeeded ,
bool preallocateOnly) {
@@ -174,7 +174,7 @@ namespace mongo {
return preallocateOnly ? 0 : p;
}
- DataFile* MmapV1ExtentManager::_addAFile( TransactionExperiment* txn,
+ DataFile* MmapV1ExtentManager::_addAFile( OperationContext* txn,
int sizeNeeded,
bool preallocateNextFile ) {
DEV Lock::assertWriteLocked( _dbname );
@@ -243,7 +243,7 @@ namespace mongo {
return DataFile::maxSize() - DataFileHeader::HeaderSize - 16;
}
- DiskLoc MmapV1ExtentManager::_createExtentInFile( TransactionExperiment* txn,
+ DiskLoc MmapV1ExtentManager::_createExtentInFile( OperationContext* txn,
int fileNo,
DataFile* f,
int size,
@@ -276,7 +276,7 @@ namespace mongo {
}
- DiskLoc MmapV1ExtentManager::_createExtent( TransactionExperiment* txn,
+ DiskLoc MmapV1ExtentManager::_createExtent( OperationContext* txn,
int size,
int maxFileNoForQuota ) {
size = quantizeExtentSize( size );
@@ -315,7 +315,7 @@ namespace mongo {
msgasserted(14810, "couldn't allocate space for a new extent" );
}
- DiskLoc MmapV1ExtentManager::_allocFromFreeList( TransactionExperiment* txn,
+ DiskLoc MmapV1ExtentManager::_allocFromFreeList( OperationContext* txn,
int approxSize,
bool capped ) {
// setup extent constraints
@@ -400,7 +400,7 @@ namespace mongo {
return best->myLoc;
}
- DiskLoc MmapV1ExtentManager::allocateExtent( TransactionExperiment* txn,
+ DiskLoc MmapV1ExtentManager::allocateExtent( OperationContext* txn,
bool capped,
int size,
int quotaMax ) {
@@ -423,7 +423,7 @@ namespace mongo {
return eloc;
}
- void MmapV1ExtentManager::freeExtent(TransactionExperiment* txn, DiskLoc firstExt ) {
+ void MmapV1ExtentManager::freeExtent(OperationContext* txn, DiskLoc firstExt ) {
Extent* e = getExtent( firstExt );
txn->writing( &e->xnext )->Null();
txn->writing( &e->xprev )->Null();
@@ -445,7 +445,7 @@ namespace mongo {
}
- void MmapV1ExtentManager::freeExtents(TransactionExperiment* txn, DiskLoc firstExt, DiskLoc lastExt) {
+ void MmapV1ExtentManager::freeExtents(OperationContext* txn, DiskLoc firstExt, DiskLoc lastExt) {
if ( firstExt.isNull() && lastExt.isNull() )
return;
@@ -488,13 +488,13 @@ namespace mongo {
return file->header()->freeListEnd;
}
- void MmapV1ExtentManager::_setFreeListStart( TransactionExperiment* txn, DiskLoc loc ) {
+ void MmapV1ExtentManager::_setFreeListStart( OperationContext* txn, DiskLoc loc ) {
invariant( !_files.empty() );
DataFile* file = _files[0];
*txn->writing( &file->header()->freeListStart ) = loc;
}
- void MmapV1ExtentManager::_setFreeListEnd( TransactionExperiment* txn, DiskLoc loc ) {
+ void MmapV1ExtentManager::_setFreeListEnd( OperationContext* txn, DiskLoc loc ) {
invariant( !_files.empty() );
DataFile* file = _files[0];
*txn->writing( &file->header()->freeListEnd ) = loc;
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h
index c045a075df4..47a35d3eb91 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h
@@ -44,7 +44,7 @@ namespace mongo {
class DataFile;
class Record;
- class TransactionExperiment;
+ class OperationContext;
struct Extent;
@@ -83,13 +83,13 @@ namespace mongo {
/**
* opens all current files
*/
- Status init(TransactionExperiment* txn);
+ Status init(OperationContext* txn);
size_t numFiles() const;
long long fileSize() const;
// TODO: make private
- DataFile* getFile( TransactionExperiment* txn,
+ DataFile* getFile( OperationContext* txn,
int n,
int sizeNeeded = 0,
bool preallocateOnly = false );
@@ -97,7 +97,7 @@ namespace mongo {
void flushFiles( bool sync );
// must call Extent::reuse on the returned extent
- DiskLoc allocateExtent( TransactionExperiment* txn,
+ DiskLoc allocateExtent( OperationContext* txn,
bool capped,
int size,
int quotaMax );
@@ -105,13 +105,13 @@ namespace mongo {
/**
* firstExt has to be == lastExt or a chain
*/
- void freeExtents( TransactionExperiment* txn, DiskLoc firstExt, DiskLoc lastExt );
+ void freeExtents( OperationContext* txn, DiskLoc firstExt, DiskLoc lastExt );
/**
* frees a single extent
* ignores all fields in the Extent except: magic, myLoc, length
*/
- void freeExtent( TransactionExperiment* txn, DiskLoc extent );
+ void freeExtent( OperationContext* txn, DiskLoc extent );
void printFreeList() const;
@@ -153,23 +153,23 @@ namespace mongo {
/**
* will return NULL if nothing suitable in free list
*/
- DiskLoc _allocFromFreeList( TransactionExperiment* txn, int approxSize, bool capped );
+ DiskLoc _allocFromFreeList( OperationContext* txn, int approxSize, bool capped );
/* allocate a new Extent, does not check free list
* @param maxFileNoForQuota - 0 for unlimited
*/
- DiskLoc _createExtent( TransactionExperiment* txn, int approxSize, int maxFileNoForQuota );
+ DiskLoc _createExtent( OperationContext* txn, int approxSize, int maxFileNoForQuota );
- DataFile* _addAFile( TransactionExperiment* txn, int sizeNeeded, bool preallocateNextFile );
+ DataFile* _addAFile( OperationContext* txn, int sizeNeeded, bool preallocateNextFile );
DiskLoc _getFreeListStart() const;
DiskLoc _getFreeListEnd() const;
- void _setFreeListStart( TransactionExperiment* txn, DiskLoc loc );
- void _setFreeListEnd( TransactionExperiment* txn, DiskLoc loc );
+ void _setFreeListStart( OperationContext* txn, DiskLoc loc );
+ void _setFreeListEnd( OperationContext* txn, DiskLoc loc );
const DataFile* _getOpenFile( int n ) const;
- DiskLoc _createExtentInFile( TransactionExperiment* txn,
+ DiskLoc _createExtentInFile( OperationContext* txn,
int fileNo,
DataFile* f,
int size,
diff --git a/src/mongo/db/structure/btree/btree_interface.cpp b/src/mongo/db/structure/btree/btree_interface.cpp
index c6601c31330..0511029a40b 100644
--- a/src/mongo/db/structure/btree/btree_interface.cpp
+++ b/src/mongo/db/structure/btree/btree_interface.cpp
@@ -28,7 +28,7 @@
#include "mongo/db/structure/btree/btree_interface.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/btree/btree_logic.h"
@@ -37,7 +37,7 @@ namespace mongo {
template <class OnDiskFormat>
class BtreeBuilderInterfaceImpl : public BtreeBuilderInterface {
public:
- BtreeBuilderInterfaceImpl(TransactionExperiment* trans,
+ BtreeBuilderInterfaceImpl(OperationContext* trans,
typename BtreeLogic<OnDiskFormat>::Builder* builder)
: _builder(builder), _trans(trans) { }
@@ -55,7 +55,7 @@ namespace mongo {
typename BtreeLogic<OnDiskFormat>::Builder* _builder;
// Not owned here.
- TransactionExperiment* _trans;
+ OperationContext* _trans;
};
template <class OnDiskFormat>
@@ -76,14 +76,14 @@ namespace mongo {
virtual ~BtreeInterfaceImpl() { }
- virtual BtreeBuilderInterface* getBulkBuilder(TransactionExperiment* txn,
+ virtual BtreeBuilderInterface* getBulkBuilder(OperationContext* txn,
bool dupsAllowed) {
return new BtreeBuilderInterfaceImpl<OnDiskFormat>(
txn, _btree->newBuilder(txn, dupsAllowed));
}
- virtual Status insert(TransactionExperiment* txn,
+ virtual Status insert(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc,
bool dupsAllowed) {
@@ -91,7 +91,7 @@ namespace mongo {
return _btree->insert(txn, key, loc, dupsAllowed);
}
- virtual bool unindex(TransactionExperiment* txn,
+ virtual bool unindex(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc) {
@@ -185,7 +185,7 @@ namespace mongo {
_btree->restorePosition(saved.key, saved.loc, direction, bucketInOut, keyOffsetInOut);
}
- virtual Status initAsEmpty(TransactionExperiment* txn) {
+ virtual Status initAsEmpty(OperationContext* txn) {
return _btree->initAsEmpty(txn);
}
diff --git a/src/mongo/db/structure/btree/btree_interface.h b/src/mongo/db/structure/btree/btree_interface.h
index 7391420a875..35884a809e8 100644
--- a/src/mongo/db/structure/btree/btree_interface.h
+++ b/src/mongo/db/structure/btree/btree_interface.h
@@ -29,7 +29,7 @@
#include "mongo/bson/ordering.h"
#include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/head_manager.h"
#include "mongo/db/structure/record_store.h"
@@ -100,15 +100,15 @@ namespace mongo {
* Caller owns returned pointer.
* 'this' must outlive the returned pointer.
*/
- virtual BtreeBuilderInterface* getBulkBuilder(TransactionExperiment* txn,
+ virtual BtreeBuilderInterface* getBulkBuilder(OperationContext* txn,
bool dupsAllowed) = 0;
- virtual Status insert(TransactionExperiment* txn,
+ virtual Status insert(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc,
bool dupsAllowed) = 0;
- virtual bool unindex(TransactionExperiment* txn,
+ virtual bool unindex(OperationContext* txn,
const BSONObj& key,
const DiskLoc& loc) = 0;
@@ -181,7 +181,7 @@ namespace mongo {
// Index creation
//
- virtual Status initAsEmpty(TransactionExperiment* txn) = 0;
+ virtual Status initAsEmpty(OperationContext* txn) = 0;
};
} // namespace mongo
diff --git a/src/mongo/db/structure/btree/btree_logic.cpp b/src/mongo/db/structure/btree/btree_logic.cpp
index 6c75249df6e..ceb1e770db3 100644
--- a/src/mongo/db/structure/btree/btree_logic.cpp
+++ b/src/mongo/db/structure/btree/btree_logic.cpp
@@ -29,7 +29,7 @@
#include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/btree/btree_logic.h"
#include "mongo/db/structure/btree/key.h"
#include "mongo/db/structure/record_store.h"
@@ -43,13 +43,13 @@ namespace mongo {
template <class BtreeLayout>
typename BtreeLogic<BtreeLayout>::Builder*
- BtreeLogic<BtreeLayout>::newBuilder(TransactionExperiment* trans, bool dupsAllowed) {
+ BtreeLogic<BtreeLayout>::newBuilder(OperationContext* trans, bool dupsAllowed) {
return new Builder(this, trans, dupsAllowed);
}
template <class BtreeLayout>
BtreeLogic<BtreeLayout>::Builder::Builder(BtreeLogic* logic,
- TransactionExperiment* trans,
+ OperationContext* trans,
bool dupsAllowed)
: _logic(logic),
_dupsAllowed(dupsAllowed),
@@ -241,7 +241,7 @@ namespace mongo {
template <class BtreeLayout>
typename BtreeLogic<BtreeLayout>::BucketType*
- BtreeLogic<BtreeLayout>::btreemod(TransactionExperiment* trans, BucketType* bucket) {
+ BtreeLogic<BtreeLayout>::btreemod(OperationContext* trans, BucketType* bucket) {
trans->writingPtr(bucket, BtreeLayout::BucketSize);
return bucket;
}
@@ -426,7 +426,7 @@ namespace mongo {
* Returns false if a split is required.
*/
template <class BtreeLayout>
- bool BtreeLogic<BtreeLayout>::basicInsert(TransactionExperiment* trans,
+ bool BtreeLogic<BtreeLayout>::basicInsert(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int& keypos,
@@ -510,7 +510,7 @@ namespace mongo {
* it.
*/
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::_pack(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::_pack(OperationContext* trans,
BucketType* bucket,
const DiskLoc thisLoc,
int &refPos) {
@@ -1256,7 +1256,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::delBucket(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::delBucket(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc) {
invariant(bucketLoc != getRootLoc());
@@ -1270,7 +1270,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::deallocBucket(TransactionExperiment* txn,
+ void BtreeLogic<BtreeLayout>::deallocBucket(OperationContext* txn,
BucketType* bucket,
const DiskLoc bucketLoc) {
bucket->n = BtreeLayout::INVALID_N_SENTINEL;
@@ -1336,7 +1336,7 @@ namespace mongo {
* May delete the bucket 'bucket' rendering 'bucketLoc' invalid.
*/
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::delKeyAtPos(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::delKeyAtPos(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int p) {
@@ -1396,7 +1396,7 @@ namespace mongo {
* legacy btree.
*/
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::deleteInternalKey(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::deleteInternalKey(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos) {
@@ -1429,7 +1429,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::replaceWithNextChild(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::replaceWithNextChild(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc) {
@@ -1539,7 +1539,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::doMergeChildren(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::doMergeChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex) {
@@ -1609,7 +1609,7 @@ namespace mongo {
}
template <class BtreeLayout>
- bool BtreeLogic<BtreeLayout>::tryBalanceChildren(TransactionExperiment* trans,
+ bool BtreeLogic<BtreeLayout>::tryBalanceChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex) {
@@ -1625,7 +1625,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::doBalanceLeftToRight(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::doBalanceLeftToRight(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex,
@@ -1666,7 +1666,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::doBalanceRightToLeft(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::doBalanceRightToLeft(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex,
@@ -1710,7 +1710,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::doBalanceChildren(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::doBalanceChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex) {
@@ -1739,7 +1739,7 @@ namespace mongo {
}
template <class BtreeLayout>
- bool BtreeLogic<BtreeLayout>::mayBalanceWithNeighbors(TransactionExperiment* trans,
+ bool BtreeLogic<BtreeLayout>::mayBalanceWithNeighbors(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc) {
if (bucket->parent.isNull()) {
@@ -1783,7 +1783,7 @@ namespace mongo {
}
template <class BtreeLayout>
- bool BtreeLogic<BtreeLayout>::unindex(TransactionExperiment* trans,
+ bool BtreeLogic<BtreeLayout>::unindex(OperationContext* trans,
const BSONObj& key,
const DiskLoc& recordLoc) {
int pos;
@@ -1804,7 +1804,7 @@ namespace mongo {
}
template <class BtreeLayout>
- inline void BtreeLogic<BtreeLayout>::fix(TransactionExperiment* trans,
+ inline void BtreeLogic<BtreeLayout>::fix(OperationContext* trans,
const DiskLoc bucketLoc,
const DiskLoc child) {
if (!child.isNull()) {
@@ -1817,7 +1817,7 @@ namespace mongo {
* Maybe get rid of parent ptrs?
*/
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::fixParentPtrs(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::fixParentPtrs(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int firstIndex,
@@ -1835,7 +1835,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::setInternalKey(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::setInternalKey(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos,
@@ -1869,7 +1869,7 @@ namespace mongo {
* intent code in basicInsert().
*/
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::insertHere(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::insertHere(OperationContext* trans,
const DiskLoc bucketLoc,
int pos,
const KeyDataType& key,
@@ -1915,7 +1915,7 @@ namespace mongo {
}
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::split(TransactionExperiment* trans,
+ void BtreeLogic<BtreeLayout>::split(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos,
@@ -1995,7 +1995,7 @@ namespace mongo {
};
template <class BtreeLayout>
- Status BtreeLogic<BtreeLayout>::initAsEmpty(TransactionExperiment* trans) {
+ Status BtreeLogic<BtreeLayout>::initAsEmpty(OperationContext* trans) {
if (!_headManager->getHead().isNull()) {
return Status(ErrorCodes::InternalError, "index already initialized");
}
@@ -2005,7 +2005,7 @@ namespace mongo {
}
template <class BtreeLayout>
- DiskLoc BtreeLogic<BtreeLayout>::addBucket(TransactionExperiment* trans) {
+ DiskLoc BtreeLogic<BtreeLayout>::addBucket(OperationContext* trans) {
DummyDocWriter docWriter(BtreeLayout::BucketSize);
StatusWith<DiskLoc> loc = _recordStore->insertRecord(trans, &docWriter, 0);
// XXX: remove this(?) or turn into massert or sanely bubble it back up.
@@ -2200,7 +2200,7 @@ namespace mongo {
}
template <class BtreeLayout>
- Status BtreeLogic<BtreeLayout>::insert(TransactionExperiment* trans,
+ Status BtreeLogic<BtreeLayout>::insert(OperationContext* trans,
const BSONObj& rawKey,
const DiskLoc& value,
bool dupsAllowed) {
@@ -2227,7 +2227,7 @@ namespace mongo {
}
template <class BtreeLayout>
- Status BtreeLogic<BtreeLayout>::_insert(TransactionExperiment* trans,
+ Status BtreeLogic<BtreeLayout>::_insert(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
const KeyDataType& key,
diff --git a/src/mongo/db/structure/btree/btree_logic.h b/src/mongo/db/structure/btree/btree_logic.h
index c2398d86044..de36c8aa11c 100644
--- a/src/mongo/db/structure/btree/btree_logic.h
+++ b/src/mongo/db/structure/btree/btree_logic.h
@@ -32,7 +32,7 @@
#include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/btree/btree_ondisk.h"
#include "mongo/db/structure/btree/key.h"
#include "mongo/db/structure/btree/bucket_deletion_notification.h"
@@ -101,7 +101,7 @@ namespace mongo {
private:
friend class BtreeLogic;
- Builder(BtreeLogic* logic, TransactionExperiment* trans, bool dupsAllowed);
+ Builder(BtreeLogic* logic, OperationContext* trans, bool dupsAllowed);
// Direct ports of functionality
void newBucket();
@@ -124,18 +124,18 @@ namespace mongo {
auto_ptr<KeyDataOwnedType> _keyLast;
// Not owned.
- TransactionExperiment* _trans;
+ OperationContext* _trans;
};
/**
* Caller owns the returned pointer.
* 'this' must outlive the returned pointer.
*/
- Builder* newBuilder(TransactionExperiment* trans, bool dupsAllowed);
+ Builder* newBuilder(OperationContext* trans, bool dupsAllowed);
Status dupKeyCheck(const BSONObj& key, const DiskLoc& loc) const;
- Status insert(TransactionExperiment* trans,
+ Status insert(OperationContext* trans,
const BSONObj& rawKey,
const DiskLoc& value,
bool dupsAllowed);
@@ -158,7 +158,7 @@ namespace mongo {
bool exists(const KeyDataType& key) const;
- bool unindex(TransactionExperiment* trans,
+ bool unindex(OperationContext* trans,
const BSONObj& key,
const DiskLoc& recordLoc);
@@ -213,7 +213,7 @@ namespace mongo {
/**
* Returns OK if the index was uninitialized before, error status otherwise.
*/
- Status initAsEmpty(TransactionExperiment* trans);
+ Status initAsEmpty(OperationContext* trans);
private:
friend class BtreeLogic::Builder;
@@ -286,7 +286,7 @@ namespace mongo {
static void setNotPacked(BucketType* bucket);
- static BucketType* btreemod(TransactionExperiment* trans, BucketType* bucket);
+ static BucketType* btreemod(OperationContext* trans, BucketType* bucket);
static int splitPos(BucketType* bucket, int keypos);
@@ -312,7 +312,7 @@ namespace mongo {
// information).
//
- bool basicInsert(TransactionExperiment* trans,
+ bool basicInsert(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int& keypos,
@@ -321,7 +321,7 @@ namespace mongo {
void dropFront(BucketType* bucket, int nDrop, int& refpos);
- void _pack(TransactionExperiment* trans, BucketType* bucket, const DiskLoc thisLoc, int &refPos);
+ void _pack(OperationContext* trans, BucketType* bucket, const DiskLoc thisLoc, int &refPos);
void customLocate(DiskLoc* locInOut,
int* keyOfsInOut,
@@ -383,7 +383,7 @@ namespace mongo {
bool dumpBuckets,
unsigned depth);
- DiskLoc addBucket(TransactionExperiment* trans);
+ DiskLoc addBucket(OperationContext* trans);
bool canMergeChildren(BucketType* bucket,
const DiskLoc bucketLoc,
@@ -398,7 +398,7 @@ namespace mongo {
void truncateTo(BucketType* bucket, int N, int &refPos);
- void split(TransactionExperiment* trans,
+ void split(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos,
@@ -407,7 +407,7 @@ namespace mongo {
const DiskLoc lchild,
const DiskLoc rchild);
- Status _insert(TransactionExperiment* trans,
+ Status _insert(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
const KeyDataType& key,
@@ -417,7 +417,7 @@ namespace mongo {
const DiskLoc rightChild);
// TODO take a BucketType*?
- void insertHere(TransactionExperiment* trans,
+ void insertHere(OperationContext* trans,
const DiskLoc bucketLoc,
int pos,
const KeyDataType& key,
@@ -427,7 +427,7 @@ namespace mongo {
string dupKeyError(const KeyDataType& key) const;
- void setInternalKey(TransactionExperiment* trans,
+ void setInternalKey(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos,
@@ -436,22 +436,22 @@ namespace mongo {
const DiskLoc lchild,
const DiskLoc rchild);
- void fix(TransactionExperiment* trans, const DiskLoc bucketLoc, const DiskLoc child);
+ void fix(OperationContext* trans, const DiskLoc bucketLoc, const DiskLoc child);
- void fixParentPtrs(TransactionExperiment* trans,
+ void fixParentPtrs(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int firstIndex = 0,
int lastIndex = -1);
- bool mayBalanceWithNeighbors(TransactionExperiment* trans, BucketType* bucket, const DiskLoc bucketLoc);
+ bool mayBalanceWithNeighbors(OperationContext* trans, BucketType* bucket, const DiskLoc bucketLoc);
- void doBalanceChildren(TransactionExperiment* trans,
+ void doBalanceChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex);
- void doBalanceLeftToRight(TransactionExperiment* trans,
+ void doBalanceLeftToRight(OperationContext* trans,
BucketType* bucket,
const DiskLoc thisLoc,
int leftIndex,
@@ -461,7 +461,7 @@ namespace mongo {
BucketType* r,
const DiskLoc rchild);
- void doBalanceRightToLeft(TransactionExperiment* trans,
+ void doBalanceRightToLeft(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex,
@@ -471,37 +471,37 @@ namespace mongo {
BucketType* r,
const DiskLoc rchild);
- bool tryBalanceChildren(TransactionExperiment* trans,
+ bool tryBalanceChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex);
int indexInParent(BucketType* bucket, const DiskLoc bucketLoc) const;
- void doMergeChildren(TransactionExperiment* trans,
+ void doMergeChildren(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int leftIndex);
- void replaceWithNextChild(TransactionExperiment* trans,
+ void replaceWithNextChild(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc);
- void deleteInternalKey(TransactionExperiment* trans,
+ void deleteInternalKey(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int keypos);
- void delKeyAtPos(TransactionExperiment* trans,
+ void delKeyAtPos(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc,
int p);
- void delBucket(TransactionExperiment* trans,
+ void delBucket(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc);
- void deallocBucket(TransactionExperiment* trans,
+ void deallocBucket(OperationContext* trans,
BucketType* bucket,
const DiskLoc bucketLoc);
diff --git a/src/mongo/db/structure/capped_callback.h b/src/mongo/db/structure/capped_callback.h
index 0b86bd81709..59c23f9dab9 100644
--- a/src/mongo/db/structure/capped_callback.h
+++ b/src/mongo/db/structure/capped_callback.h
@@ -34,7 +34,7 @@
namespace mongo {
- class TransactionExperiment;
+ class OperationContext;
/**
* When a capped collection has to delete a document, it needs a way to tell the caller
@@ -48,7 +48,7 @@ namespace mongo {
/**
* This will be called right before loc is deleted when wrapping.
*/
- virtual Status aboutToDeleteCapped( TransactionExperiment* txn, const DiskLoc& loc ) = 0;
+ virtual Status aboutToDeleteCapped( OperationContext* txn, const DiskLoc& loc ) = 0;
};
}
diff --git a/src/mongo/db/structure/catalog/hashtab.h b/src/mongo/db/structure/catalog/hashtab.h
index 12195cde70b..66ecb5af9dc 100644
--- a/src/mongo/db/structure/catalog/hashtab.h
+++ b/src/mongo/db/structure/catalog/hashtab.h
@@ -25,7 +25,7 @@
#include "mongo/pch.h"
#include <map>
#include "mongo/db/storage/mmap_v1/dur.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
namespace mongo {
@@ -122,7 +122,7 @@ namespace mongo {
return 0;
}
- void kill(TransactionExperiment* txn, const Key& k) {
+ void kill(OperationContext* txn, const Key& k) {
bool found;
int i = _find(k, found);
if ( i >= 0 && found ) {
@@ -134,7 +134,7 @@ namespace mongo {
}
/** returns false if too full */
- bool put(TransactionExperiment* txn, const Key& k, const Type& value) {
+ bool put(OperationContext* txn, const Key& k, const Type& value) {
bool found;
int i = _find(k, found);
if ( i < 0 )
diff --git a/src/mongo/db/structure/catalog/namespace_details.cpp b/src/mongo/db/structure/catalog/namespace_details.cpp
index 70e1b8eb763..8eb6132890e 100644
--- a/src/mongo/db/structure/catalog/namespace_details.cpp
+++ b/src/mongo/db/structure/catalog/namespace_details.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/ops/delete.h"
#include "mongo/db/ops/update.h"
#include "mongo/db/structure/catalog/hashtab.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/scripting/engine.h"
#include "mongo/util/startup_test.h"
@@ -84,7 +84,7 @@ namespace mongo {
memset(_reserved, 0, sizeof(_reserved));
}
- NamespaceDetails::Extra* NamespaceDetails::allocExtra( TransactionExperiment* txn,
+ NamespaceDetails::Extra* NamespaceDetails::allocExtra( OperationContext* txn,
const StringData& ns,
NamespaceIndex& ni,
int nindexessofar) {
@@ -119,7 +119,7 @@ namespace mongo {
return e;
}
- bool NamespaceDetails::setIndexIsMultikey(TransactionExperiment* txn, int i, bool multikey) {
+ bool NamespaceDetails::setIndexIsMultikey(OperationContext* txn, int i, bool multikey) {
massert(16577, "index number greater than NIndexesMax", i < NIndexesMax );
unsigned long long mask = 1ULL << i;
@@ -146,7 +146,7 @@ namespace mongo {
return true;
}
- IndexDetails& NamespaceDetails::getNextIndexDetails(TransactionExperiment* txn,
+ IndexDetails& NamespaceDetails::getNextIndexDetails(OperationContext* txn,
Collection* collection) {
IndexDetails *id;
try {
@@ -220,7 +220,7 @@ namespace mongo {
}
// must be called when renaming a NS to fix up extra
- void NamespaceDetails::copyingFrom( TransactionExperiment* txn,
+ void NamespaceDetails::copyingFrom( OperationContext* txn,
const char* thisns,
NamespaceIndex& ni,
NamespaceDetails* src) {
@@ -242,20 +242,20 @@ namespace mongo {
}
}
- NamespaceDetails* NamespaceDetails::writingWithoutExtra( TransactionExperiment* txn ) {
+ NamespaceDetails* NamespaceDetails::writingWithoutExtra( OperationContext* txn ) {
return txn->writing( this );
}
// XXX - this method should go away
- NamespaceDetails *NamespaceDetails::writingWithExtra( TransactionExperiment* txn ) {
+ NamespaceDetails *NamespaceDetails::writingWithExtra( OperationContext* txn ) {
for( Extra *e = extra(); e; e = e->next( this ) ) {
txn->writing( e );
}
return writingWithoutExtra( txn );
}
- void NamespaceDetails::setMaxCappedDocs( TransactionExperiment* txn, long long max ) {
+ void NamespaceDetails::setMaxCappedDocs( OperationContext* txn, long long max ) {
massert( 16499,
"max in a capped collection has to be < 2^31 or -1",
validMaxCappedDocs( &max ) );
@@ -285,13 +285,13 @@ namespace mongo {
/* ------------------------------------------------------------------------- */
- void NamespaceDetails::setLastExtentSize( TransactionExperiment* txn, int newMax ) {
+ void NamespaceDetails::setLastExtentSize( OperationContext* txn, int newMax ) {
if ( _lastExtentSize == newMax )
return;
txn->writingInt(_lastExtentSize) = newMax;
}
- void NamespaceDetails::incrementStats( TransactionExperiment* txn,
+ void NamespaceDetails::incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) {
@@ -301,7 +301,7 @@ namespace mongo {
s->nrecords += numRecordsIncrement;
}
- void NamespaceDetails::setStats( TransactionExperiment* txn,
+ void NamespaceDetails::setStats( OperationContext* txn,
long long dataSize,
long long numRecords ) {
Stats* s = txn->writing( &_stats );
@@ -309,40 +309,40 @@ namespace mongo {
s->nrecords = numRecords;
}
- void NamespaceDetails::setFirstExtent( TransactionExperiment* txn,
+ void NamespaceDetails::setFirstExtent( OperationContext* txn,
const DiskLoc& loc ) {
*txn->writing( &_firstExtent ) = loc;
}
- void NamespaceDetails::setLastExtent( TransactionExperiment* txn,
+ void NamespaceDetails::setLastExtent( OperationContext* txn,
const DiskLoc& loc ) {
*txn->writing( &_lastExtent ) = loc;
}
- void NamespaceDetails::setCapExtent( TransactionExperiment* txn,
+ void NamespaceDetails::setCapExtent( OperationContext* txn,
const DiskLoc& loc ) {
*txn->writing( &_capExtent ) = loc;
}
- void NamespaceDetails::setCapFirstNewRecord( TransactionExperiment* txn,
+ void NamespaceDetails::setCapFirstNewRecord( OperationContext* txn,
const DiskLoc& loc ) {
*txn->writing( &_capFirstNewRecord ) = loc;
}
- void NamespaceDetails::setFirstExtentInvalid( TransactionExperiment* txn ) {
+ void NamespaceDetails::setFirstExtentInvalid( OperationContext* txn ) {
*txn->writing( &_firstExtent ) = DiskLoc().setInvalid();
}
- void NamespaceDetails::setLastExtentInvalid( TransactionExperiment* txn ) {
+ void NamespaceDetails::setLastExtentInvalid( OperationContext* txn ) {
*txn->writing( &_lastExtent ) = DiskLoc().setInvalid();
}
- void NamespaceDetails::setDeletedListEntry( TransactionExperiment* txn,
+ void NamespaceDetails::setDeletedListEntry( OperationContext* txn,
int bucket, const DiskLoc& loc ) {
*txn->writing( &_deletedList[bucket] ) = loc;
}
- bool NamespaceDetails::setUserFlag( TransactionExperiment* txn, int flags ) {
+ bool NamespaceDetails::setUserFlag( OperationContext* txn, int flags ) {
if ( ( _userFlags & flags ) == flags )
return false;
@@ -350,7 +350,7 @@ namespace mongo {
return true;
}
- bool NamespaceDetails::clearUserFlag( TransactionExperiment* txn, int flags ) {
+ bool NamespaceDetails::clearUserFlag( OperationContext* txn, int flags ) {
if ( ( _userFlags & flags ) == 0 )
return false;
@@ -358,7 +358,7 @@ namespace mongo {
return true;
}
- bool NamespaceDetails::replaceUserFlags( TransactionExperiment* txn, int flags ) {
+ bool NamespaceDetails::replaceUserFlags( OperationContext* txn, int flags ) {
if ( flags == _userFlags )
return false;
@@ -366,7 +366,7 @@ namespace mongo {
return true;
}
- void NamespaceDetails::setPaddingFactor( TransactionExperiment* txn, double paddingFactor ) {
+ void NamespaceDetails::setPaddingFactor( OperationContext* txn, double paddingFactor ) {
if ( paddingFactor == _paddingFactor )
return;
@@ -388,7 +388,7 @@ namespace mongo {
((tmp >> (x+1)) << x);
}
- void NamespaceDetails::_removeIndexFromMe( TransactionExperiment* txn, int idxNumber ) {
+ void NamespaceDetails::_removeIndexFromMe( OperationContext* txn, int idxNumber ) {
// TODO: don't do this whole thing, do it piece meal for readability
NamespaceDetails* d = writingWithExtra( txn );
@@ -407,7 +407,7 @@ namespace mongo {
d->idx( getTotalIndexCount() ) = IndexDetails();
}
- void NamespaceDetails::swapIndex( TransactionExperiment* txn, int a, int b ) {
+ void NamespaceDetails::swapIndex( OperationContext* txn, int a, int b ) {
// flip main meta data
IndexDetails temp = idx(a);
@@ -420,7 +420,7 @@ namespace mongo {
setIndexIsMultikey( txn, b, tempMultikey );
}
- void NamespaceDetails::orphanDeletedList( TransactionExperiment* txn ) {
+ void NamespaceDetails::orphanDeletedList( OperationContext* txn ) {
for( int i = 0; i < Buckets; i++ ) {
*txn->writing(&_deletedList[i]) = DiskLoc();
}
@@ -438,7 +438,7 @@ namespace mongo {
return -1;
}
- void NamespaceDetails::Extra::setNext( TransactionExperiment* txn,
+ void NamespaceDetails::Extra::setNext( OperationContext* txn,
long ofs ) {
*txn->writing(&_next) = ofs;
}
diff --git a/src/mongo/db/structure/catalog/namespace_details.h b/src/mongo/db/structure/catalog/namespace_details.h
index 90b5d845c21..2c7dc3c6df5 100644
--- a/src/mongo/db/structure/catalog/namespace_details.h
+++ b/src/mongo/db/structure/catalog/namespace_details.h
@@ -37,7 +37,7 @@
namespace mongo {
class Collection;
- class TransactionExperiment;
+ class OperationContext;
/* deleted lists -- linked lists of deleted records -- are placed in 'buckets' of various sizes
so you can look for a deleterecord about the right size.
@@ -130,7 +130,7 @@ namespace mongo {
if( _next == 0 ) return 0;
return (Extra*) (((char *) d) + _next);
}
- void setNext(TransactionExperiment* txn, long ofs);
+ void setNext(OperationContext* txn, long ofs);
void copy(NamespaceDetails *d, const Extra& e) {
memcpy(this, &e, sizeof(Extra));
_next = 0;
@@ -141,60 +141,60 @@ namespace mongo {
return (Extra *) (((char *) this) + _extraOffset);
}
/* add extra space for indexes when more than 10 */
- Extra* allocExtra( TransactionExperiment* txn,
+ Extra* allocExtra( OperationContext* txn,
const StringData& ns,
NamespaceIndex& ni,
int nindexessofar );
- void copyingFrom( TransactionExperiment* txn,
+ void copyingFrom( OperationContext* txn,
const char* thisns,
NamespaceIndex& ni,
NamespaceDetails *src); // must be called when renaming a NS to fix up extra
public:
const DiskLoc& capExtent() const { return _capExtent; }
- void setCapExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ void setCapExtent( OperationContext* txn, const DiskLoc& loc );
const DiskLoc& capFirstNewRecord() const { return _capFirstNewRecord; }
- void setCapFirstNewRecord( TransactionExperiment* txn, const DiskLoc& loc );
+ void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc );
bool capLooped() const { return _capFirstNewRecord.isValid(); }
public:
const DiskLoc& firstExtent() const { return _firstExtent; }
- void setFirstExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ void setFirstExtent( OperationContext* txn, const DiskLoc& loc );
const DiskLoc& lastExtent() const { return _lastExtent; }
- void setLastExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ void setLastExtent( OperationContext* txn, const DiskLoc& loc );
- void setFirstExtentInvalid( TransactionExperiment* txn );
- void setLastExtentInvalid( TransactionExperiment* txn );
+ void setFirstExtentInvalid( OperationContext* txn );
+ void setLastExtentInvalid( OperationContext* txn );
long long dataSize() const { return _stats.datasize; }
long long numRecords() const { return _stats.nrecords; }
- void incrementStats( TransactionExperiment* txn,
+ void incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement );
- void setStats( TransactionExperiment* txn,
+ void setStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement );
bool isCapped() const { return _isCapped; }
long long maxCappedDocs() const;
- void setMaxCappedDocs( TransactionExperiment* txn, long long max );
+ void setMaxCappedDocs( OperationContext* txn, long long max );
int lastExtentSize() const { return _lastExtentSize; }
- void setLastExtentSize( TransactionExperiment* txn, int newMax );
+ void setLastExtentSize( OperationContext* txn, int newMax );
const DiskLoc& deletedListEntry( int bucket ) const { return _deletedList[bucket]; }
- void setDeletedListEntry( TransactionExperiment* txn, int bucket, const DiskLoc& loc );
+ void setDeletedListEntry( OperationContext* txn, int bucket, const DiskLoc& loc );
- void orphanDeletedList( TransactionExperiment* txn );
+ void orphanDeletedList( OperationContext* txn );
/**
* @param max in and out, will be adjusted
@@ -243,17 +243,17 @@ namespace mongo {
/**
* @return - if any state was changed
*/
- bool setIndexIsMultikey(TransactionExperiment* txn, int i, bool multikey = true);
+ bool setIndexIsMultikey(OperationContext* txn, int i, bool multikey = true);
/**
* This fetches the IndexDetails for the next empty index slot. The caller must populate
* returned object. This handles allocating extra index space, if necessary.
*/
- IndexDetails& getNextIndexDetails(TransactionExperiment* txn, Collection* collection);
+ IndexDetails& getNextIndexDetails(OperationContext* txn, Collection* collection);
double paddingFactor() const { return _paddingFactor; }
- void setPaddingFactor( TransactionExperiment* txn, double paddingFactor );
+ void setPaddingFactor( OperationContext* txn, double paddingFactor );
/* called to indicate that an update fit in place.
fits also called on an insert -- idea there is that if you had some mix and then went to
@@ -264,13 +264,13 @@ namespace mongo {
size of documents might be considered -- in some cases smaller ones are more likely
to grow than larger ones in the same collection? (not always)
*/
- void paddingFits( TransactionExperiment* txn ) {
+ void paddingFits( OperationContext* txn ) {
MONGO_SOMETIMES(sometimes, 4) { // do this on a sampled basis to journal less
double x = max(1.0, _paddingFactor - 0.001 );
setPaddingFactor( txn, x );
}
}
- void paddingTooSmall( TransactionExperiment* txn ) {
+ void paddingTooSmall( OperationContext* txn ) {
MONGO_SOMETIMES(sometimes, 4) { // do this on a sampled basis to journal less
/* the more indexes we have, the higher the cost of a move. so we take that into
account herein. note on a move that insert() calls paddingFits(), thus
@@ -297,14 +297,14 @@ namespace mongo {
}
* these methods all return true iff only something was modified
*/
- bool setUserFlag( TransactionExperiment* txn, int flag );
- bool clearUserFlag( TransactionExperiment* txn, int flag );
- bool replaceUserFlags( TransactionExperiment* txn, int flags );
+ bool setUserFlag( OperationContext* txn, int flag );
+ bool clearUserFlag( OperationContext* txn, int flag );
+ bool replaceUserFlags( OperationContext* txn, int flags );
- NamespaceDetails *writingWithoutExtra( TransactionExperiment* txn );
+ NamespaceDetails *writingWithoutExtra( OperationContext* txn );
/** Make all linked Extra objects writeable as well */
- NamespaceDetails *writingWithExtra( TransactionExperiment* txn );
+ NamespaceDetails *writingWithExtra( OperationContext* txn );
/**
* Returns the offset of the specified index name within the array of indexes. Must be
@@ -318,14 +318,14 @@ namespace mongo {
private:
- void _removeIndexFromMe( TransactionExperiment* txn, int idx );
+ void _removeIndexFromMe( OperationContext* txn, int idx );
/**
* swaps all meta data for 2 indexes
* a and b are 2 index ids, whose contents will be swapped
* must have a lock on the entire collection to do this
*/
- void swapIndex( TransactionExperiment* txn, int a, int b );
+ void swapIndex( OperationContext* txn, int a, int b );
friend class IndexCatalog;
friend class IndexCatalogEntry;
diff --git a/src/mongo/db/structure/catalog/namespace_details_rsv1_metadata.h b/src/mongo/db/structure/catalog/namespace_details_rsv1_metadata.h
index 0fd008adf8f..397affa16a3 100644
--- a/src/mongo/db/structure/catalog/namespace_details_rsv1_metadata.h
+++ b/src/mongo/db/structure/catalog/namespace_details_rsv1_metadata.h
@@ -51,7 +51,7 @@ namespace mongo {
return _details->capExtent();
}
- virtual void setCapExtent( TransactionExperiment* txn, const DiskLoc& loc ) {
+ virtual void setCapExtent( OperationContext* txn, const DiskLoc& loc ) {
_details->setCapExtent( txn, loc );
}
@@ -59,7 +59,7 @@ namespace mongo {
return _details->capFirstNewRecord();
}
- virtual void setCapFirstNewRecord( TransactionExperiment* txn, const DiskLoc& loc ) {
+ virtual void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc ) {
_details->setCapFirstNewRecord( txn, loc );
}
@@ -74,13 +74,13 @@ namespace mongo {
return _details->numRecords();
}
- virtual void incrementStats( TransactionExperiment* txn,
+ virtual void incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) {
_details->incrementStats( txn, dataSizeIncrement, numRecordsIncrement );
}
- virtual void setStats( TransactionExperiment* txn,
+ virtual void setStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) {
_details->setStats( txn,
@@ -92,13 +92,13 @@ namespace mongo {
return _details->deletedListEntry( bucket );
}
- virtual void setDeletedListEntry( TransactionExperiment* txn,
+ virtual void setDeletedListEntry( OperationContext* txn,
int bucket,
const DiskLoc& loc ) {
_details->setDeletedListEntry( txn, bucket, loc );
}
- virtual void orphanDeletedList(TransactionExperiment* txn) {
+ virtual void orphanDeletedList(OperationContext* txn) {
_details->orphanDeletedList( txn );
}
@@ -106,7 +106,7 @@ namespace mongo {
return _details->firstExtent();
}
- virtual void setFirstExtent( TransactionExperiment* txn, const DiskLoc& loc ) {
+ virtual void setFirstExtent( OperationContext* txn, const DiskLoc& loc ) {
_details->setFirstExtent( txn, loc );
}
@@ -114,7 +114,7 @@ namespace mongo {
return _details->lastExtent();
}
- virtual void setLastExtent( TransactionExperiment* txn, const DiskLoc& loc ) {
+ virtual void setLastExtent( OperationContext* txn, const DiskLoc& loc ) {
_details->setLastExtent( txn, loc );
}
@@ -130,7 +130,7 @@ namespace mongo {
return _details->lastExtentSize();
}
- virtual void setLastExtentSize( TransactionExperiment* txn, int newMax ) {
+ virtual void setLastExtentSize( OperationContext* txn, int newMax ) {
_details->setLastExtentSize( txn, newMax );
}
@@ -142,7 +142,7 @@ namespace mongo {
return _details->paddingFactor();
}
- virtual void setPaddingFactor( TransactionExperiment* txn, double paddingFactor ) {
+ virtual void setPaddingFactor( OperationContext* txn, double paddingFactor ) {
_details->setPaddingFactor( txn, paddingFactor );
}
diff --git a/src/mongo/db/structure/catalog/namespace_index.cpp b/src/mongo/db/structure/catalog/namespace_index.cpp
index e4f8d58517c..d7863519423 100644
--- a/src/mongo/db/structure/catalog/namespace_index.cpp
+++ b/src/mongo/db/structure/catalog/namespace_index.cpp
@@ -33,7 +33,7 @@
#include <boost/filesystem/operations.hpp>
#include "mongo/db/d_concurrency.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/catalog/namespace_details.h"
#include "mongo/util/exit.h"
@@ -50,19 +50,19 @@ namespace mongo {
return _ht->get(ns);
}
- void NamespaceIndex::add_ns( TransactionExperiment* txn,
+ void NamespaceIndex::add_ns( OperationContext* txn,
const StringData& ns, const DiskLoc& loc, bool capped) {
NamespaceDetails details( loc, capped );
add_ns( txn, ns, &details );
}
- void NamespaceIndex::add_ns( TransactionExperiment* txn,
+ void NamespaceIndex::add_ns( OperationContext* txn,
const StringData& ns, const NamespaceDetails* details ) {
Namespace n(ns);
add_ns( txn, n, details );
}
- void NamespaceIndex::add_ns( TransactionExperiment* txn,
+ void NamespaceIndex::add_ns( OperationContext* txn,
const Namespace& ns, const NamespaceDetails* details ) {
string nsString = ns.toString();
Lock::assertWriteLocked( nsString );
@@ -71,7 +71,7 @@ namespace mongo {
uassert( 10081, "too many namespaces/collections", _ht->put(txn, ns, *details));
}
- void NamespaceIndex::kill_ns( TransactionExperiment* txn, const StringData& ns) {
+ void NamespaceIndex::kill_ns( OperationContext* txn, const StringData& ns) {
Lock::assertWriteLocked(ns);
if ( !_ht.get() )
return;
@@ -132,7 +132,7 @@ namespace mongo {
MONGO_ASSERT_ON_EXCEPTION_WITH_MSG( boost::filesystem::create_directory( dir ), "create dir for db " );
}
- NOINLINE_DECL void NamespaceIndex::_init( TransactionExperiment* txn ) {
+ NOINLINE_DECL void NamespaceIndex::_init( OperationContext* txn ) {
verify( !_ht.get() );
Lock::assertWriteLocked(_database);
diff --git a/src/mongo/db/structure/catalog/namespace_index.h b/src/mongo/db/structure/catalog/namespace_index.h
index b099d92f066..85d05fc861d 100644
--- a/src/mongo/db/structure/catalog/namespace_index.h
+++ b/src/mongo/db/structure/catalog/namespace_index.h
@@ -40,7 +40,7 @@
namespace mongo {
class NamespaceDetails;
- class TransactionExperiment;
+ class OperationContext;
/* NamespaceIndex is the ".ns" file you see in the data directory. It is the "system catalog"
if you will: at least the core parts. (Additional info in system.* collections.)
@@ -53,22 +53,22 @@ namespace mongo {
/* returns true if new db will be created if we init lazily */
bool exists() const;
- void init( TransactionExperiment* txn ) {
+ void init( OperationContext* txn ) {
if ( !_ht.get() )
_init( txn );
}
- void add_ns( TransactionExperiment* txn,
+ void add_ns( OperationContext* txn,
const StringData& ns, const DiskLoc& loc, bool capped);
- void add_ns( TransactionExperiment* txn,
+ void add_ns( OperationContext* txn,
const StringData& ns, const NamespaceDetails* details );
- void add_ns( TransactionExperiment* txn,
+ void add_ns( OperationContext* txn,
const Namespace& ns, const NamespaceDetails* details );
NamespaceDetails* details(const StringData& ns);
NamespaceDetails* details(const Namespace& ns);
- void kill_ns( TransactionExperiment* txn,
+ void kill_ns( OperationContext* txn,
const StringData& ns);
bool allocated() const { return _ht.get() != 0; }
@@ -80,7 +80,7 @@ namespace mongo {
unsigned long long fileLength() const { return _f.length(); }
private:
- void _init( TransactionExperiment* txn );
+ void _init( OperationContext* txn );
void maybeMkdir() const;
DurableMappedFile _f;
diff --git a/src/mongo/db/structure/collection_compact.cpp b/src/mongo/db/structure/collection_compact.cpp
index 86b75523859..2777d51918e 100644
--- a/src/mongo/db/structure/collection_compact.cpp
+++ b/src/mongo/db/structure/collection_compact.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/util/touch_pages.h"
namespace mongo {
@@ -104,7 +104,7 @@ namespace mongo {
}
- StatusWith<CompactStats> Collection::compact( TransactionExperiment* txn,
+ StatusWith<CompactStats> Collection::compact( OperationContext* txn,
const CompactOptions* compactOptions ) {
if ( !_recordStore->compactSupported() )
return StatusWith<CompactStats>( ErrorCodes::BadValue,
diff --git a/src/mongo/db/structure/head_manager.h b/src/mongo/db/structure/head_manager.h
index 1df38f56fd6..9460b930210 100644
--- a/src/mongo/db/structure/head_manager.h
+++ b/src/mongo/db/structure/head_manager.h
@@ -32,7 +32,7 @@
namespace mongo {
- class TransactionExperiment;
+ class OperationContext;
/**
* An abstraction for setting and getting data about the 'head' of an index. This is the data
@@ -44,7 +44,7 @@ namespace mongo {
virtual const DiskLoc& getHead() const = 0;
- virtual void setHead(TransactionExperiment* txn, const DiskLoc& newHead) = 0;
+ virtual void setHead(OperationContext* txn, const DiskLoc& newHead) = 0;
};
} // namespace mongo
diff --git a/src/mongo/db/structure/record_store.h b/src/mongo/db/structure/record_store.h
index 3d3b5675123..1b006c464cd 100644
--- a/src/mongo/db/structure/record_store.h
+++ b/src/mongo/db/structure/record_store.h
@@ -45,7 +45,7 @@ namespace mongo {
class MAdvise;
class NamespaceDetails;
class Record;
- class TransactionExperiment;
+ class OperationContext;
class RecordStoreCompactAdaptor;
class RecordStore;
@@ -123,14 +123,14 @@ namespace mongo {
virtual Record* recordFor( const DiskLoc& loc ) const = 0;
- virtual void deleteRecord( TransactionExperiment* txn, const DiskLoc& dl ) = 0;
+ virtual void deleteRecord( OperationContext* txn, const DiskLoc& dl ) = 0;
- virtual StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const char* data,
int len,
int quotaMax ) = 0;
- virtual StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const DocWriter* doc,
int quotaMax ) = 0;
@@ -161,11 +161,11 @@ namespace mongo {
/**
* removes all Records
*/
- virtual Status truncate( TransactionExperiment* txn ) = 0;
+ virtual Status truncate( OperationContext* txn ) = 0;
// does this RecordStore support the compact operation
virtual bool compactSupported() const = 0;
- virtual Status compact( TransactionExperiment* txn,
+ virtual Status compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats ) = 0;
@@ -177,7 +177,7 @@ namespace mongo {
* OK will be returned even if corruption is found
* deatils will be in result
*/
- virtual Status validate( TransactionExperiment* txn,
+ virtual Status validate( OperationContext* txn,
bool full, bool scanData,
ValidateAdaptor* adaptor,
ValidateResults* results, BSONObjBuilder* output ) const = 0;
@@ -187,11 +187,11 @@ namespace mongo {
* What cache depends on implementation.
* @param output (optional) - where to put detailed stats
*/
- virtual Status touch( TransactionExperiment* txn, BSONObjBuilder* output ) const = 0;
+ virtual Status touch( OperationContext* txn, BSONObjBuilder* output ) const = 0;
// TODO: this makes me sad, it shouldn't be in the interface
// do not use this anymore
- virtual void increaseStorageSize( TransactionExperiment* txn, int size, int quotaMax ) = 0;
+ virtual void increaseStorageSize( OperationContext* txn, int size, int quotaMax ) = 0;
protected:
std::string _ns;
diff --git a/src/mongo/db/structure/record_store_heap.cpp b/src/mongo/db/structure/record_store_heap.cpp
index da56f288867..162c3c69125 100644
--- a/src/mongo/db/structure/record_store_heap.cpp
+++ b/src/mongo/db/structure/record_store_heap.cpp
@@ -70,7 +70,7 @@ namespace mongo {
return reinterpret_cast<Record*>(it->second.get());
}
- void HeapRecordStore::deleteRecord(TransactionExperiment* txn, const DiskLoc& loc) {
+ void HeapRecordStore::deleteRecord(OperationContext* txn, const DiskLoc& loc) {
Record* rec = recordFor(loc);
_dataSize -= rec->netLength();
invariant(_records.erase(loc) == 1);
@@ -89,7 +89,7 @@ namespace mongo {
return false;
}
- void HeapRecordStore::cappedDeleteAsNeeded(TransactionExperiment* txn) {
+ void HeapRecordStore::cappedDeleteAsNeeded(OperationContext* txn) {
while (cappedAndNeedDelete()) {
invariant(!_records.empty());
@@ -102,7 +102,7 @@ namespace mongo {
}
}
- StatusWith<DiskLoc> HeapRecordStore::insertRecord(TransactionExperiment* txn,
+ StatusWith<DiskLoc> HeapRecordStore::insertRecord(OperationContext* txn,
const char* data,
int len,
int quotaMax) {
@@ -129,7 +129,7 @@ namespace mongo {
return StatusWith<DiskLoc>(loc);
}
- StatusWith<DiskLoc> HeapRecordStore::insertRecord(TransactionExperiment* txn,
+ StatusWith<DiskLoc> HeapRecordStore::insertRecord(OperationContext* txn,
const DocWriter* doc,
int quotaMax) {
const int len = doc->documentSize();
@@ -182,7 +182,7 @@ namespace mongo {
return out;
}
- Status HeapRecordStore::truncate(TransactionExperiment* txn) {
+ Status HeapRecordStore::truncate(OperationContext* txn) {
_records.clear();
_dataSize = 0;
return Status::OK();
@@ -191,7 +191,7 @@ namespace mongo {
bool HeapRecordStore::compactSupported() const {
return false;
}
- Status HeapRecordStore::compact(TransactionExperiment* txn,
+ Status HeapRecordStore::compact(OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats) {
@@ -199,7 +199,7 @@ namespace mongo {
invariant(!"compact not yet implemented");
}
- Status HeapRecordStore::validate(TransactionExperiment* txn,
+ Status HeapRecordStore::validate(OperationContext* txn,
bool full,
bool scanData,
ValidateAdaptor* adaptor,
@@ -225,7 +225,7 @@ namespace mongo {
}
- Status HeapRecordStore::touch(TransactionExperiment* txn, BSONObjBuilder* output) const {
+ Status HeapRecordStore::touch(OperationContext* txn, BSONObjBuilder* output) const {
if (output) {
output->append("numRanges", 1);
output->append("millis", 0);
@@ -233,7 +233,7 @@ namespace mongo {
return Status::OK();
}
- void HeapRecordStore::increaseStorageSize(TransactionExperiment* txn, int size, int quotaMax) {
+ void HeapRecordStore::increaseStorageSize(OperationContext* txn, int size, int quotaMax) {
// unclear what this would mean for this class. For now, just error if called.
invariant(!"increaseStorageSize not yet implemented");
}
diff --git a/src/mongo/db/structure/record_store_heap.h b/src/mongo/db/structure/record_store_heap.h
index f9d752cbe84..42fc085ea64 100644
--- a/src/mongo/db/structure/record_store_heap.h
+++ b/src/mongo/db/structure/record_store_heap.h
@@ -56,14 +56,14 @@ namespace mongo {
virtual Record* recordFor( const DiskLoc& loc ) const;
- virtual void deleteRecord( TransactionExperiment* txn, const DiskLoc& dl );
+ virtual void deleteRecord( OperationContext* txn, const DiskLoc& dl );
- virtual StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const char* data,
int len,
int quotaMax );
- virtual StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const DocWriter* doc,
int quotaMax );
@@ -74,23 +74,23 @@ namespace mongo {
virtual std::vector<RecordIterator*> getManyIterators() const;
- virtual Status truncate( TransactionExperiment* txn );
+ virtual Status truncate( OperationContext* txn );
virtual bool compactSupported() const;
- virtual Status compact( TransactionExperiment* txn,
+ virtual Status compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats );
- virtual Status validate( TransactionExperiment* txn,
+ virtual Status validate( OperationContext* txn,
bool full,
bool scanData,
ValidateAdaptor* adaptor,
ValidateResults* results, BSONObjBuilder* output ) const;
- virtual Status touch( TransactionExperiment* txn, BSONObjBuilder* output ) const;
+ virtual Status touch( OperationContext* txn, BSONObjBuilder* output ) const;
- virtual void increaseStorageSize( TransactionExperiment* txn, int size, int quotaMax );
+ virtual void increaseStorageSize( OperationContext* txn, int size, int quotaMax );
virtual int64_t storageSize(BSONObjBuilder* extraInfo = NULL, int infoLevel = 0) const;
@@ -111,7 +111,7 @@ namespace mongo {
private:
DiskLoc allocateLoc();
bool cappedAndNeedDelete() const;
- void cappedDeleteAsNeeded(TransactionExperiment* txn);
+ void cappedDeleteAsNeeded(OperationContext* txn);
// TODO figure out a proper solution to metadata
const bool _isCapped;
diff --git a/src/mongo/db/structure/record_store_v1_base.cpp b/src/mongo/db/structure/record_store_v1_base.cpp
index b3c844687e2..97a421de8d0 100644
--- a/src/mongo/db/structure/record_store_v1_base.cpp
+++ b/src/mongo/db/structure/record_store_v1_base.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/record_store_v1_repair_iterator.h"
#include "mongo/util/timer.h"
#include "mongo/util/touch_pages.h"
@@ -161,7 +161,7 @@ namespace mongo {
}
- DiskLoc RecordStoreV1Base::_findFirstSpot( TransactionExperiment* txn,
+ DiskLoc RecordStoreV1Base::_findFirstSpot( OperationContext* txn,
const DiskLoc& extDiskLoc, Extent* e ) {
DiskLoc emptyLoc = extDiskLoc;
emptyLoc.inc( Extent::HeaderSize() );
@@ -205,7 +205,7 @@ namespace mongo {
}
- StatusWith<DiskLoc> RecordStoreV1Base::insertRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> RecordStoreV1Base::insertRecord( OperationContext* txn,
const DocWriter* doc,
int quotaMax ) {
int docSize = doc->documentSize();
@@ -235,7 +235,7 @@ namespace mongo {
}
- StatusWith<DiskLoc> RecordStoreV1Base::insertRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> RecordStoreV1Base::insertRecord( OperationContext* txn,
const char* data,
int len,
int quotaMax ) {
@@ -265,7 +265,7 @@ namespace mongo {
return loc;
}
- void RecordStoreV1Base::deleteRecord( TransactionExperiment* txn, const DiskLoc& dl ) {
+ void RecordStoreV1Base::deleteRecord( OperationContext* txn, const DiskLoc& dl ) {
Record* todelete = recordFor( dl );
invariant( todelete->netLength() >= 4 ); // this is required for defensive code
@@ -329,7 +329,7 @@ namespace mongo {
return new RecordStoreV1RepairIterator(this);
}
- void RecordStoreV1Base::_addRecordToRecListInExtent(TransactionExperiment* txn,
+ void RecordStoreV1Base::_addRecordToRecListInExtent(OperationContext* txn,
Record *r,
DiskLoc loc) {
dassert( recordFor(loc) == r );
@@ -348,7 +348,7 @@ namespace mongo {
}
}
- void RecordStoreV1Base::increaseStorageSize( TransactionExperiment* txn,
+ void RecordStoreV1Base::increaseStorageSize( OperationContext* txn,
int size,
int quotaMax ) {
DiskLoc eloc = _extentManager->allocateExtent( txn,
@@ -388,7 +388,7 @@ namespace mongo {
addDeletedRec(txn, emptyLoc);
}
- Status RecordStoreV1Base::validate( TransactionExperiment* txn,
+ Status RecordStoreV1Base::validate( OperationContext* txn,
bool full, bool scanData,
ValidateAdaptor* adaptor,
ValidateResults* results, BSONObjBuilder* output ) const {
@@ -693,7 +693,7 @@ namespace mongo {
};
}
- Status RecordStoreV1Base::touch( TransactionExperiment* txn, BSONObjBuilder* output ) const {
+ Status RecordStoreV1Base::touch( OperationContext* txn, BSONObjBuilder* output ) const {
Timer t;
// Note: when this class has document level locking, we'll need a lock to get extents
diff --git a/src/mongo/db/structure/record_store_v1_base.h b/src/mongo/db/structure/record_store_v1_base.h
index d2d989a21e4..3bd569c095a 100644
--- a/src/mongo/db/structure/record_store_v1_base.h
+++ b/src/mongo/db/structure/record_store_v1_base.h
@@ -38,7 +38,7 @@ namespace mongo {
class DocWriter;
class ExtentManager;
class Record;
- class TransactionExperiment;
+ class OperationContext;
struct Extent;
@@ -47,48 +47,48 @@ namespace mongo {
virtual ~RecordStoreV1MetaData(){}
virtual const DiskLoc& capExtent() const = 0;
- virtual void setCapExtent( TransactionExperiment* txn, const DiskLoc& loc ) = 0;
+ virtual void setCapExtent( OperationContext* txn, const DiskLoc& loc ) = 0;
virtual const DiskLoc& capFirstNewRecord() const = 0;
- virtual void setCapFirstNewRecord( TransactionExperiment* txn, const DiskLoc& loc ) = 0;
+ virtual void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc ) = 0;
virtual bool capLooped() const = 0;
virtual long long dataSize() const = 0;
virtual long long numRecords() const = 0;
- virtual void incrementStats( TransactionExperiment* txn,
+ virtual void incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) = 0;
- virtual void setStats( TransactionExperiment* txn,
+ virtual void setStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) = 0;
virtual const DiskLoc& deletedListEntry( int bucket ) const = 0;
- virtual void setDeletedListEntry( TransactionExperiment* txn,
+ virtual void setDeletedListEntry( OperationContext* txn,
int bucket,
const DiskLoc& loc ) = 0;
- virtual void orphanDeletedList(TransactionExperiment* txn) = 0;
+ virtual void orphanDeletedList(OperationContext* txn) = 0;
virtual const DiskLoc& firstExtent() const = 0;
- virtual void setFirstExtent( TransactionExperiment* txn, const DiskLoc& loc ) = 0;
+ virtual void setFirstExtent( OperationContext* txn, const DiskLoc& loc ) = 0;
virtual const DiskLoc& lastExtent() const = 0;
- virtual void setLastExtent( TransactionExperiment* txn, const DiskLoc& loc ) = 0;
+ virtual void setLastExtent( OperationContext* txn, const DiskLoc& loc ) = 0;
virtual bool isCapped() const = 0;
virtual bool isUserFlagSet( int flag ) const = 0;
virtual int lastExtentSize() const = 0;
- virtual void setLastExtentSize( TransactionExperiment* txn, int newMax ) = 0;
+ virtual void setLastExtentSize( OperationContext* txn, int newMax ) = 0;
virtual long long maxCappedDocs() const = 0;
virtual double paddingFactor() const = 0;
- virtual void setPaddingFactor( TransactionExperiment* txn, double paddingFactor ) = 0;
+ virtual void setPaddingFactor( OperationContext* txn, double paddingFactor ) = 0;
};
@@ -126,28 +126,28 @@ namespace mongo {
Record* recordFor( const DiskLoc& loc ) const;
- void deleteRecord( TransactionExperiment* txn,
+ void deleteRecord( OperationContext* txn,
const DiskLoc& dl );
- StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const char* data,
int len,
int quotaMax );
- StatusWith<DiskLoc> insertRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> insertRecord( OperationContext* txn,
const DocWriter* doc,
int quotaMax );
virtual RecordIterator* getIteratorForRepair() const;
- void increaseStorageSize( TransactionExperiment* txn, int size, int quotaMax );
+ void increaseStorageSize( OperationContext* txn, int size, int quotaMax );
- virtual Status validate( TransactionExperiment* txn,
+ virtual Status validate( OperationContext* txn,
bool full, bool scanData,
ValidateAdaptor* adaptor,
ValidateResults* results, BSONObjBuilder* output ) const;
- virtual Status touch( TransactionExperiment* txn, BSONObjBuilder* output ) const;
+ virtual Status touch( OperationContext* txn, BSONObjBuilder* output ) const;
const DeletedRecord* deletedRecordFor( const DiskLoc& loc ) const;
@@ -186,12 +186,12 @@ namespace mongo {
virtual bool isCapped() const = 0;
- virtual StatusWith<DiskLoc> allocRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> allocRecord( OperationContext* txn,
int lengthWithHeaders,
int quotaMax ) = 0;
// TODO: document, remove, what have you
- virtual void addDeletedRec( TransactionExperiment* txn, const DiskLoc& dloc) = 0;
+ virtual void addDeletedRec( OperationContext* txn, const DiskLoc& dloc) = 0;
// TODO: another sad one
virtual DeletedRecord* drec( const DiskLoc& loc ) const;
@@ -211,12 +211,12 @@ namespace mongo {
* finds the first suitable DiskLoc for data
* will return the DiskLoc of a newly created DeletedRecord
*/
- DiskLoc _findFirstSpot( TransactionExperiment* txn, const DiskLoc& extDiskLoc, Extent* e );
+ DiskLoc _findFirstSpot( OperationContext* txn, const DiskLoc& extDiskLoc, Extent* e );
/** add a record to the end of the linked list chain within this extent.
require: you must have already declared write intent for the record header.
*/
- void _addRecordToRecListInExtent(TransactionExperiment* txn, Record* r, DiskLoc loc);
+ void _addRecordToRecListInExtent(OperationContext* txn, Record* r, DiskLoc loc);
scoped_ptr<RecordStoreV1MetaData> _details;
ExtentManager* _extentManager;
diff --git a/src/mongo/db/structure/record_store_v1_capped.cpp b/src/mongo/db/structure/record_store_v1_capped.cpp
index 9e5455dccbc..9b1d4d3f3e4 100644
--- a/src/mongo/db/structure/record_store_v1_capped.cpp
+++ b/src/mongo/db/structure/record_store_v1_capped.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/record.h"
#include "mongo/db/structure/record_store_v1_capped_iterator.h"
#include "mongo/util/mmap.h"
@@ -58,7 +58,7 @@
namespace mongo {
- CappedRecordStoreV1::CappedRecordStoreV1( TransactionExperiment* txn,
+ CappedRecordStoreV1::CappedRecordStoreV1( OperationContext* txn,
CappedDocumentDeleteCallback* collection,
const StringData& ns,
RecordStoreV1MetaData* details,
@@ -82,7 +82,7 @@ namespace mongo {
CappedRecordStoreV1::~CappedRecordStoreV1() {
}
- StatusWith<DiskLoc> CappedRecordStoreV1::allocRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> CappedRecordStoreV1::allocRecord( OperationContext* txn,
int lenToAlloc,
int quotaMax ) {
{
@@ -215,7 +215,7 @@ namespace mongo {
return StatusWith<DiskLoc>( loc );
}
- Status CappedRecordStoreV1::truncate(TransactionExperiment* txn) {
+ Status CappedRecordStoreV1::truncate(OperationContext* txn) {
setLastDelRecLastExtent( txn, DiskLoc() );
setListOfAllDeletedRecords( txn, DiskLoc() );
@@ -248,7 +248,7 @@ namespace mongo {
return Status::OK();
}
- void CappedRecordStoreV1::temp_cappedTruncateAfter( TransactionExperiment* txn,
+ void CappedRecordStoreV1::temp_cappedTruncateAfter( OperationContext* txn,
DiskLoc end,
bool inclusive ) {
cappedTruncateAfter( txn, _ns.c_str(), end, inclusive );
@@ -259,7 +259,7 @@ namespace mongo {
this is O(n^2) but we call it for capped tables where typically n==1 or 2!
(or 3...there will be a little unused sliver at the end of the extent.)
*/
- void CappedRecordStoreV1::compact(TransactionExperiment* txn) {
+ void CappedRecordStoreV1::compact(OperationContext* txn) {
DDD( "CappedRecordStoreV1::compact enter" );
vector<DiskLoc> drecs;
@@ -314,7 +314,7 @@ namespace mongo {
return drec(cappedLastDelRecLastExtent())->nextDeleted();
}
- void CappedRecordStoreV1::setFirstDeletedInCurExtent( TransactionExperiment* txn,
+ void CappedRecordStoreV1::setFirstDeletedInCurExtent( OperationContext* txn,
const DiskLoc& loc ) {
if ( cappedLastDelRecLastExtent().isNull() )
setListOfAllDeletedRecords( txn, loc );
@@ -322,7 +322,7 @@ namespace mongo {
*txn->writing( &drec(cappedLastDelRecLastExtent())->nextDeleted() ) = loc;
}
- void CappedRecordStoreV1::cappedCheckMigrate(TransactionExperiment* txn) {
+ void CappedRecordStoreV1::cappedCheckMigrate(OperationContext* txn) {
// migrate old RecordStoreV1MetaData format
if ( _details->capExtent().a() == 0 && _details->capExtent().getOfs() == 0 ) {
_details->setCapFirstNewRecord( txn, DiskLoc().setInvalid() );
@@ -366,7 +366,7 @@ namespace mongo {
return inCapExtent( next );
}
- void CappedRecordStoreV1::advanceCapExtent( TransactionExperiment* txn, const StringData& ns ) {
+ void CappedRecordStoreV1::advanceCapExtent( OperationContext* txn, const StringData& ns ) {
// We want cappedLastDelRecLastExtent() to be the last DeletedRecord of the prev cap extent
// (or DiskLoc() if new capExtent == firstExtent)
if ( _details->capExtent() == _details->lastExtent() )
@@ -388,7 +388,7 @@ namespace mongo {
_details->setCapFirstNewRecord( txn, DiskLoc() );
}
- DiskLoc CappedRecordStoreV1::__capAlloc( TransactionExperiment* txn, int len ) {
+ DiskLoc CappedRecordStoreV1::__capAlloc( OperationContext* txn, int len ) {
DiskLoc prev = cappedLastDelRecLastExtent();
DiskLoc i = cappedFirstDeletedInCurExtent();
DiskLoc ret;
@@ -414,7 +414,7 @@ namespace mongo {
return ret;
}
- void CappedRecordStoreV1::cappedTruncateLastDelUpdate(TransactionExperiment* txn) {
+ void CappedRecordStoreV1::cappedTruncateLastDelUpdate(OperationContext* txn) {
if ( _details->capExtent() == _details->firstExtent() ) {
// Only one extent of the collection is in use, so there
// is no deleted record in a previous extent, so nullify
@@ -440,7 +440,7 @@ namespace mongo {
}
}
- void CappedRecordStoreV1::cappedTruncateAfter(TransactionExperiment* txn,
+ void CappedRecordStoreV1::cappedTruncateAfter(OperationContext* txn,
const char* ns,
DiskLoc end,
bool inclusive) {
@@ -545,7 +545,7 @@ namespace mongo {
return _details->deletedListEntry(0);
}
- void CappedRecordStoreV1::setListOfAllDeletedRecords( TransactionExperiment* txn,
+ void CappedRecordStoreV1::setListOfAllDeletedRecords( OperationContext* txn,
const DiskLoc& loc ) {
return _details->setDeletedListEntry(txn, 0, loc);
}
@@ -554,7 +554,7 @@ namespace mongo {
return _details->deletedListEntry(1);
}
- void CappedRecordStoreV1::setLastDelRecLastExtent( TransactionExperiment* txn,
+ void CappedRecordStoreV1::setLastDelRecLastExtent( OperationContext* txn,
const DiskLoc& loc ) {
return _details->setDeletedListEntry(txn, 1, loc);
}
@@ -567,7 +567,7 @@ namespace mongo {
return _extentManager->getExtent(_details->capExtent());
}
- void CappedRecordStoreV1::addDeletedRec( TransactionExperiment* txn, const DiskLoc& dloc ) {
+ void CappedRecordStoreV1::addDeletedRec( OperationContext* txn, const DiskLoc& dloc ) {
DeletedRecord* d = txn->writing( drec( dloc ) );
DEBUGGING log() << "TEMP: add deleted rec " << dloc.toString() << ' ' << hex << d->extentOfs() << endl;
@@ -647,7 +647,7 @@ namespace mongo {
return iterators.release();
}
- Status CappedRecordStoreV1::compact( TransactionExperiment* txn,
+ Status CappedRecordStoreV1::compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats ) {
diff --git a/src/mongo/db/structure/record_store_v1_capped.h b/src/mongo/db/structure/record_store_v1_capped.h
index b0483230f20..a84b8884ded 100644
--- a/src/mongo/db/structure/record_store_v1_capped.h
+++ b/src/mongo/db/structure/record_store_v1_capped.h
@@ -40,7 +40,7 @@ namespace mongo {
class CappedRecordStoreV1 : public RecordStoreV1Base {
public:
- CappedRecordStoreV1( TransactionExperiment* txn,
+ CappedRecordStoreV1( OperationContext* txn,
CappedDocumentDeleteCallback* collection,
const StringData& ns,
RecordStoreV1MetaData* details,
@@ -51,7 +51,7 @@ namespace mongo {
const char* name() const { return "CappedRecordStoreV1"; }
- virtual Status truncate(TransactionExperiment* txn);
+ virtual Status truncate(OperationContext* txn);
/**
* Truncate documents newer than the document at 'end' from the capped
@@ -60,7 +60,7 @@ namespace mongo {
* @param inclusive - Truncate 'end' as well iff true
* XXX: this will go away soon, just needed to move for now
*/
- void temp_cappedTruncateAfter( TransactionExperiment* txn, DiskLoc end, bool inclusive );
+ void temp_cappedTruncateAfter( OperationContext* txn, DiskLoc end, bool inclusive );
virtual RecordIterator* getIterator( const DiskLoc& start, bool tailable,
const CollectionScanParams::Direction& dir) const;
@@ -69,7 +69,7 @@ namespace mongo {
virtual bool compactSupported() const { return false; }
- virtual Status compact( TransactionExperiment* txn,
+ virtual Status compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats );
@@ -83,29 +83,29 @@ namespace mongo {
virtual bool isCapped() const { return true; }
- virtual StatusWith<DiskLoc> allocRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> allocRecord( OperationContext* txn,
int lengthWithHeaders,
int quotaMax );
- virtual void addDeletedRec(TransactionExperiment* txn, const DiskLoc& dloc);
+ virtual void addDeletedRec(OperationContext* txn, const DiskLoc& dloc);
private:
// -- start copy from cap.cpp --
- void compact(TransactionExperiment* txn);
+ void compact(OperationContext* txn);
const DiskLoc& cappedFirstDeletedInCurExtent() const;
- void setFirstDeletedInCurExtent( TransactionExperiment* txn, const DiskLoc& loc );
- void cappedCheckMigrate(TransactionExperiment* txn);
- DiskLoc __capAlloc( TransactionExperiment* txn, int len );
+ void setFirstDeletedInCurExtent( OperationContext* txn, const DiskLoc& loc );
+ void cappedCheckMigrate(OperationContext* txn);
+ DiskLoc __capAlloc( OperationContext* txn, int len );
bool inCapExtent( const DiskLoc &dl ) const;
const DiskLoc& cappedListOfAllDeletedRecords() const;
const DiskLoc& cappedLastDelRecLastExtent() const;
- void setListOfAllDeletedRecords( TransactionExperiment* txn, const DiskLoc& loc );
- void setLastDelRecLastExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ void setListOfAllDeletedRecords( OperationContext* txn, const DiskLoc& loc );
+ void setLastDelRecLastExtent( OperationContext* txn, const DiskLoc& loc );
bool capLooped() const;
Extent *theCapExtent() const;
bool nextIsInCapExtent( const DiskLoc &dl ) const;
- void advanceCapExtent( TransactionExperiment* txn, const StringData& ns );
- void cappedTruncateLastDelUpdate(TransactionExperiment* txn);
+ void advanceCapExtent( OperationContext* txn, const StringData& ns );
+ void cappedTruncateLastDelUpdate(OperationContext* txn);
/**
* Truncate documents newer than the document at 'end' from the capped
@@ -113,7 +113,7 @@ namespace mongo {
* function. An assertion will be thrown if that is attempted.
* @param inclusive - Truncate 'end' as well iff true
*/
- void cappedTruncateAfter(TransactionExperiment* txn,
+ void cappedTruncateAfter(OperationContext* txn,
const char* ns,
DiskLoc end,
bool inclusive);
diff --git a/src/mongo/db/structure/record_store_v1_capped_test.cpp b/src/mongo/db/structure/record_store_v1_capped_test.cpp
index eefe8803d82..9bf2cdd8ea1 100644
--- a/src/mongo/db/structure/record_store_v1_capped_test.cpp
+++ b/src/mongo/db/structure/record_store_v1_capped_test.cpp
@@ -40,7 +40,7 @@ namespace {
class DummyCappedDocumentDeleteCallback : public CappedDocumentDeleteCallback {
public:
- Status aboutToDeleteCapped( TransactionExperiment* txn, const DiskLoc& loc ) {
+ Status aboutToDeleteCapped( OperationContext* txn, const DiskLoc& loc ) {
deleted.push_back( loc );
return Status::OK();
}
@@ -49,7 +49,7 @@ namespace {
void simpleInsertTest( const char* buf, int size ) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( true, 0 );
DummyCappedDocumentDeleteCallback cb;
diff --git a/src/mongo/db/structure/record_store_v1_simple.cpp b/src/mongo/db/structure/record_store_v1_simple.cpp
index 87c8b28cd1e..fa43a2087a7 100644
--- a/src/mongo/db/structure/record_store_v1_simple.cpp
+++ b/src/mongo/db/structure/record_store_v1_simple.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/storage/extent.h"
#include "mongo/db/storage/extent_manager.h"
#include "mongo/db/storage/record.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/record_store_v1_simple_iterator.h"
#include "mongo/util/progress_meter.h"
#include "mongo/util/timer.h"
@@ -57,7 +57,7 @@ namespace mongo {
static ServerStatusMetricField<Counter64> dFreelist3( "storage.freelist.search.scanned",
&freelistIterations );
- SimpleRecordStoreV1::SimpleRecordStoreV1( TransactionExperiment* txn,
+ SimpleRecordStoreV1::SimpleRecordStoreV1( OperationContext* txn,
const StringData& ns,
RecordStoreV1MetaData* details,
ExtentManager* em,
@@ -76,7 +76,7 @@ namespace mongo {
SimpleRecordStoreV1::~SimpleRecordStoreV1() {
}
- DiskLoc SimpleRecordStoreV1::_allocFromExistingExtents( TransactionExperiment* txn,
+ DiskLoc SimpleRecordStoreV1::_allocFromExistingExtents( OperationContext* txn,
int lenToAlloc ) {
// align very slightly.
lenToAlloc = (lenToAlloc + 3) & 0xfffffffc;
@@ -219,7 +219,7 @@ namespace mongo {
}
- StatusWith<DiskLoc> SimpleRecordStoreV1::allocRecord( TransactionExperiment* txn,
+ StatusWith<DiskLoc> SimpleRecordStoreV1::allocRecord( OperationContext* txn,
int lengthWithHeaders,
int quotaMax ) {
DiskLoc loc = _allocFromExistingExtents( txn, lengthWithHeaders );
@@ -259,12 +259,12 @@ namespace mongo {
return StatusWith<DiskLoc>( ErrorCodes::InternalError, "cannot allocate space" );
}
- Status SimpleRecordStoreV1::truncate(TransactionExperiment* txn) {
+ Status SimpleRecordStoreV1::truncate(OperationContext* txn) {
return Status( ErrorCodes::InternalError,
"SimpleRecordStoreV1::truncate not implemented" );
}
- void SimpleRecordStoreV1::addDeletedRec( TransactionExperiment* txn, const DiskLoc& dloc ) {
+ void SimpleRecordStoreV1::addDeletedRec( OperationContext* txn, const DiskLoc& dloc ) {
DeletedRecord* d = drec( dloc );
DEBUGGING log() << "TEMP: add deleted rec " << dloc.toString() << ' ' << hex << d->extentOfs() << endl;
@@ -324,7 +324,7 @@ namespace mongo {
size_t _allocationSize;
};
- void SimpleRecordStoreV1::_compactExtent(TransactionExperiment* txn,
+ void SimpleRecordStoreV1::_compactExtent(OperationContext* txn,
const DiskLoc diskloc,
int extentNumber,
RecordStoreCompactAdaptor* adaptor,
@@ -446,7 +446,7 @@ namespace mongo {
}
- Status SimpleRecordStoreV1::compact( TransactionExperiment* txn,
+ Status SimpleRecordStoreV1::compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats ) {
diff --git a/src/mongo/db/structure/record_store_v1_simple.h b/src/mongo/db/structure/record_store_v1_simple.h
index 79139d93437..5e32f390938 100644
--- a/src/mongo/db/structure/record_store_v1_simple.h
+++ b/src/mongo/db/structure/record_store_v1_simple.h
@@ -40,7 +40,7 @@ namespace mongo {
// used by index and original collections
class SimpleRecordStoreV1 : public RecordStoreV1Base {
public:
- SimpleRecordStoreV1( TransactionExperiment* txn,
+ SimpleRecordStoreV1( OperationContext* txn,
const StringData& ns,
RecordStoreV1MetaData* details,
ExtentManager* em,
@@ -55,10 +55,10 @@ namespace mongo {
virtual std::vector<RecordIterator*> getManyIterators() const;
- virtual Status truncate(TransactionExperiment* txn);
+ virtual Status truncate(OperationContext* txn);
virtual bool compactSupported() const { return true; }
- virtual Status compact( TransactionExperiment* txn,
+ virtual Status compact( OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats );
@@ -66,17 +66,17 @@ namespace mongo {
protected:
virtual bool isCapped() const { return false; }
- virtual StatusWith<DiskLoc> allocRecord( TransactionExperiment* txn,
+ virtual StatusWith<DiskLoc> allocRecord( OperationContext* txn,
int lengthWithHeaders,
int quotaMax );
- virtual void addDeletedRec(TransactionExperiment* txn,
+ virtual void addDeletedRec(OperationContext* txn,
const DiskLoc& dloc);
private:
- DiskLoc _allocFromExistingExtents( TransactionExperiment* txn,
+ DiskLoc _allocFromExistingExtents( OperationContext* txn,
int lengthWithHeaders );
- void _compactExtent(TransactionExperiment* txn,
+ void _compactExtent(OperationContext* txn,
const DiskLoc diskloc,
int extentNumber,
RecordStoreCompactAdaptor* adaptor,
diff --git a/src/mongo/db/structure/record_store_v1_simple_test.cpp b/src/mongo/db/structure/record_store_v1_simple_test.cpp
index c515cde0d8d..08a32c5d137 100644
--- a/src/mongo/db/structure/record_store_v1_simple_test.cpp
+++ b/src/mongo/db/structure/record_store_v1_simple_test.cpp
@@ -149,7 +149,7 @@ namespace {
/** alloc() quantizes the requested size using quantizeAllocationSpace() rules. */
TEST(SimpleRecordStoreV1, AllocQuantized) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
@@ -169,7 +169,7 @@ namespace {
* rules.
*/
TEST(SimpleRecordStoreV1, AllocIndexNamespaceNotQuantized) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
@@ -187,7 +187,7 @@ namespace {
/** alloc() quantizes records in index collections to the nearest multiple of 4. */
TEST(SimpleRecordStoreV1, AllocIndexNamespaceSlightlyQuantized) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
@@ -205,7 +205,7 @@ namespace {
* 'cook' the deletedList by shrinking the smallest deleted record to size
* 'newDeletedRecordSize'.
*/
- void cookDeletedList(TransactionExperiment* txn,
+ void cookDeletedList(OperationContext* txn,
RecordStoreV1Base* rs,
RecordStoreV1MetaData* md,
int newDeletedRecordSize) {
@@ -247,7 +247,7 @@ namespace {
/** alloc() returns a non quantized record larger than the requested size. */
TEST(SimpleRecordStoreV1, AllocUseNonQuantizedDeletedRecord) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -266,7 +266,7 @@ namespace {
/** alloc() returns a non quantized record equal to the requested size. */
TEST(SimpleRecordStoreV1, AllocExactSizeNonQuantizedDeletedRecord) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -288,7 +288,7 @@ namespace {
* too small to make a DeletedRecord.
*/
TEST(SimpleRecordStoreV1, AllocQuantizedWithExtra) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -310,7 +310,7 @@ namespace {
* is large enough to form a new deleted record.
*/
TEST(SimpleRecordStoreV1, AllocQuantizedWithoutExtra) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -335,7 +335,7 @@ namespace {
* if a quantized portion of the deleted record could be used instead.
*/
TEST(SimpleRecordStoreV1, AllocNotQuantizedNearDeletedSize) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -356,7 +356,7 @@ namespace {
/** getRecordAllocationSize() returns its argument when the padding factor is 1.0. */
TEST(SimpleRecordStoreV1, GetRecordAllocationSizeNoPadding) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -366,7 +366,7 @@ namespace {
/** getRecordAllocationSize() multiplies by a padding factor > 1.0. */
TEST(SimpleRecordStoreV1, GetRecordAllocationSizeWithPadding) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
@@ -381,7 +381,7 @@ namespace {
* is set.
*/
TEST(SimpleRecordStoreV1, GetRecordAllocationSizePowerOf2) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData(
false,
@@ -396,7 +396,7 @@ namespace {
* is set, ignoring the padding factor.
*/
TEST(SimpleRecordStoreV1, GetRecordAllocationSizePowerOf2PaddingIgnored) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData(
false,
@@ -412,7 +412,7 @@ namespace {
// -----------------
TEST( SimpleRecordStoreV1, FullSimple1 ) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn,
@@ -436,7 +436,7 @@ namespace {
* Inserts take the first deleted record with the correct size.
*/
TEST( SimpleRecordStoreV1, InsertTakesFirstDeletedWithExactSize ) {
- DummyTransactionExperiment txn;
+ DummyOperationContext txn;
DummyExtentManager em;
DummyRecordStoreV1MetaData* md = new DummyRecordStoreV1MetaData( false, 0 );
SimpleRecordStoreV1 rs( &txn, "test.foo", md, &em, false );
diff --git a/src/mongo/db/structure/record_store_v1_test_help.cpp b/src/mongo/db/structure/record_store_v1_test_help.cpp
index 486251821ff..95cd609e6cf 100644
--- a/src/mongo/db/structure/record_store_v1_test_help.cpp
+++ b/src/mongo/db/structure/record_store_v1_test_help.cpp
@@ -59,21 +59,21 @@ namespace mongo {
void DummyRecoveryUnit::syncDataAndTruncateJournal() {
}
- DummyTransactionExperiment::DummyTransactionExperiment() {
+ DummyOperationContext::DummyOperationContext() {
_recoveryUnit.reset(new DummyRecoveryUnit());
}
- ProgressMeter* DummyTransactionExperiment::setMessage(const char* msg,
+ ProgressMeter* DummyOperationContext::setMessage(const char* msg,
const std::string& name ,
unsigned long long progressMeterTotal,
int secondsBetween) {
invariant( false );
}
- void DummyTransactionExperiment::checkForInterrupt(bool heedMutex ) const {
+ void DummyOperationContext::checkForInterrupt(bool heedMutex ) const {
}
- Status DummyTransactionExperiment::checkForInterruptNoAssert() const {
+ Status DummyOperationContext::checkForInterruptNoAssert() const {
return Status::OK();
}
@@ -98,7 +98,7 @@ namespace mongo {
return _capExtent;
}
- void DummyRecordStoreV1MetaData::setCapExtent( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setCapExtent( OperationContext* txn,
const DiskLoc& loc ) {
_capExtent = loc;
}
@@ -107,7 +107,7 @@ namespace mongo {
return _capFirstNewRecord;
}
- void DummyRecordStoreV1MetaData::setCapFirstNewRecord( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setCapFirstNewRecord( OperationContext* txn,
const DiskLoc& loc ) {
_capFirstNewRecord = loc;
}
@@ -124,14 +124,14 @@ namespace mongo {
return _numRecords;
}
- void DummyRecordStoreV1MetaData::incrementStats( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) {
_dataSize += dataSizeIncrement;
_numRecords += numRecordsIncrement;
}
- void DummyRecordStoreV1MetaData::setStats( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement ) {
_dataSize = dataSizeIncrement;
@@ -149,7 +149,7 @@ namespace mongo {
return _deletedLists[bucket];
}
- void DummyRecordStoreV1MetaData::setDeletedListEntry( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setDeletedListEntry( OperationContext* txn,
int bucket,
const DiskLoc& loc ) {
invariant( bucket >= 0 );
@@ -159,7 +159,7 @@ namespace mongo {
_deletedLists[bucket] = loc;
}
- void DummyRecordStoreV1MetaData::orphanDeletedList(TransactionExperiment* txn) {
+ void DummyRecordStoreV1MetaData::orphanDeletedList(OperationContext* txn) {
invariant( false );
}
@@ -167,7 +167,7 @@ namespace mongo {
return _firstExtent;
}
- void DummyRecordStoreV1MetaData::setFirstExtent( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setFirstExtent( OperationContext* txn,
const DiskLoc& loc ) {
_firstExtent = loc;
}
@@ -176,7 +176,7 @@ namespace mongo {
return _lastExtent;
}
- void DummyRecordStoreV1MetaData::setLastExtent( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setLastExtent( OperationContext* txn,
const DiskLoc& loc ) {
_lastExtent = loc;
}
@@ -193,7 +193,7 @@ namespace mongo {
return _lastExtentSize;
}
- void DummyRecordStoreV1MetaData::setLastExtentSize( TransactionExperiment* txn, int newMax ) {
+ void DummyRecordStoreV1MetaData::setLastExtentSize( OperationContext* txn, int newMax ) {
_lastExtentSize = newMax;
}
@@ -205,7 +205,7 @@ namespace mongo {
return _paddingFactor;
}
- void DummyRecordStoreV1MetaData::setPaddingFactor( TransactionExperiment* txn,
+ void DummyRecordStoreV1MetaData::setPaddingFactor( OperationContext* txn,
double paddingFactor ) {
_paddingFactor = paddingFactor;
}
@@ -219,7 +219,7 @@ namespace mongo {
}
}
- Status DummyExtentManager::init(TransactionExperiment* txn) {
+ Status DummyExtentManager::init(OperationContext* txn) {
return Status::OK();
}
@@ -235,7 +235,7 @@ namespace mongo {
void DummyExtentManager::flushFiles( bool sync ) {
}
- DiskLoc DummyExtentManager::allocateExtent( TransactionExperiment* txn,
+ DiskLoc DummyExtentManager::allocateExtent( OperationContext* txn,
bool capped,
int size,
int quotaMax ) {
@@ -261,12 +261,12 @@ namespace mongo {
}
- void DummyExtentManager::freeExtents( TransactionExperiment* txn,
+ void DummyExtentManager::freeExtents( OperationContext* txn,
DiskLoc firstExt, DiskLoc lastExt ) {
// XXX
}
- void DummyExtentManager::freeExtent( TransactionExperiment* txn, DiskLoc extent ) {
+ void DummyExtentManager::freeExtent( OperationContext* txn, DiskLoc extent ) {
// XXX
}
void DummyExtentManager::freeListStats( int* numExtents, int64_t* totalFreeSize ) const {
@@ -372,7 +372,7 @@ namespace {
}
}
- void initializeV1RS(TransactionExperiment* txn,
+ void initializeV1RS(OperationContext* txn,
const LocAndSize* records,
const LocAndSize* drecs,
DummyExtentManager* em,
diff --git a/src/mongo/db/structure/record_store_v1_test_help.h b/src/mongo/db/structure/record_store_v1_test_help.h
index 55feadb449f..0de1350c1c3 100644
--- a/src/mongo/db/structure/record_store_v1_test_help.h
+++ b/src/mongo/db/structure/record_store_v1_test_help.h
@@ -33,7 +33,7 @@
#include <vector>
#include "mongo/db/storage/extent_manager.h"
-#include "mongo/db/storage/transaction.h"
+#include "mongo/db/operation_context.h"
#include "mongo/db/structure/record_store_v1_base.h"
namespace mongo {
@@ -51,11 +51,11 @@ namespace mongo {
virtual void syncDataAndTruncateJournal();
};
- class DummyTransactionExperiment : public TransactionExperiment {
+ class DummyOperationContext : public OperationContext {
public:
- DummyTransactionExperiment();
+ DummyOperationContext();
- virtual ~DummyTransactionExperiment() { }
+ virtual ~DummyOperationContext() { }
virtual RecoveryUnit* recoveryUnit() const {
return _recoveryUnit.get();
@@ -80,48 +80,48 @@ namespace mongo {
virtual ~DummyRecordStoreV1MetaData(){}
virtual const DiskLoc& capExtent() const;
- virtual void setCapExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ virtual void setCapExtent( OperationContext* txn, const DiskLoc& loc );
virtual const DiskLoc& capFirstNewRecord() const;
- virtual void setCapFirstNewRecord( TransactionExperiment* txn, const DiskLoc& loc );
+ virtual void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc );
virtual bool capLooped() const;
virtual long long dataSize() const;
virtual long long numRecords() const;
- virtual void incrementStats( TransactionExperiment* txn,
+ virtual void incrementStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement );
- virtual void setStats( TransactionExperiment* txn,
+ virtual void setStats( OperationContext* txn,
long long dataSizeIncrement,
long long numRecordsIncrement );
virtual const DiskLoc& deletedListEntry( int bucket ) const;
- virtual void setDeletedListEntry( TransactionExperiment* txn,
+ virtual void setDeletedListEntry( OperationContext* txn,
int bucket,
const DiskLoc& loc );
- virtual void orphanDeletedList(TransactionExperiment* txn);
+ virtual void orphanDeletedList(OperationContext* txn);
virtual const DiskLoc& firstExtent() const;
- virtual void setFirstExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ virtual void setFirstExtent( OperationContext* txn, const DiskLoc& loc );
virtual const DiskLoc& lastExtent() const;
- virtual void setLastExtent( TransactionExperiment* txn, const DiskLoc& loc );
+ virtual void setLastExtent( OperationContext* txn, const DiskLoc& loc );
virtual bool isCapped() const;
virtual bool isUserFlagSet( int flag ) const;
virtual int lastExtentSize() const;
- virtual void setLastExtentSize( TransactionExperiment* txn, int newMax );
+ virtual void setLastExtentSize( OperationContext* txn, int newMax );
virtual long long maxCappedDocs() const;
virtual double paddingFactor() const;
- virtual void setPaddingFactor( TransactionExperiment* txn, double paddingFactor );
+ virtual void setPaddingFactor( OperationContext* txn, double paddingFactor );
protected:
@@ -148,22 +148,22 @@ namespace mongo {
public:
virtual ~DummyExtentManager();
- virtual Status init(TransactionExperiment* txn);
+ virtual Status init(OperationContext* txn);
virtual size_t numFiles() const;
virtual long long fileSize() const;
virtual void flushFiles( bool sync );
- virtual DiskLoc allocateExtent( TransactionExperiment* txn,
+ virtual DiskLoc allocateExtent( OperationContext* txn,
bool capped,
int size,
int quotaMax );
- virtual void freeExtents( TransactionExperiment* txn,
+ virtual void freeExtents( OperationContext* txn,
DiskLoc firstExt, DiskLoc lastExt );
- virtual void freeExtent( TransactionExperiment* txn, DiskLoc extent );
+ virtual void freeExtent( OperationContext* txn, DiskLoc extent );
virtual void freeListStats( int* numExtents, int64_t* totalFreeSize ) const;
@@ -209,7 +209,7 @@ namespace mongo {
*
* ExtentManager and MetaData must both be empty.
*/
- void initializeV1RS(TransactionExperiment* txn,
+ void initializeV1RS(OperationContext* txn,
const LocAndSize* records,
const LocAndSize* drecs,
DummyExtentManager* em,
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index affef462400..f1d7e9cd8e2 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/ops/delete.h"
#include "mongo/db/repl/is_master.h"
#include "mongo/db/server_parameters.h"
-#include "mongo/db/storage/mmap_v1/dur_transaction.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/util/background.h"
namespace mongo {
@@ -115,7 +115,7 @@ namespace mongo {
{
string ns = idx["ns"].String();
Client::WriteContext ctx( ns );
- DurTransaction txn;
+ OperationContextImpl txn;
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( !collection ) {
// collection was dropped