summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-04-30 20:56:36 -0400
committerMathias Stearn <mathias@10gen.com>2014-05-01 12:36:50 -0400
commiteda1e63580ec6594ad2a693ca8b992c240576f26 (patch)
tree90ed223e4696e6e39107f147304ad483dadd38e1 /src/mongo
parentf3ce37598c85a56f3b3eb33d6c48196fc811cafb (diff)
downloadmongo-eda1e63580ec6594ad2a693ca8b992c240576f26.tar.gz
SERVER-13643 Use TransactionExperiment in setHead()
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.cpp9
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.h3
-rw-r--r--src/mongo/db/index/btree_based_bulk_access_method.cpp2
-rw-r--r--src/mongo/db/structure/btree/btree_logic.cpp8
-rw-r--r--src/mongo/db/structure/head_manager.h4
5 files changed, 15 insertions, 11 deletions
diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp
index c8c55e371ef..835c98add57 100644
--- a/src/mongo/db/catalog/index_catalog_entry.cpp
+++ b/src/mongo/db/catalog/index_catalog_entry.cpp
@@ -32,6 +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/structure/catalog/namespace_details.h"
#include "mongo/db/structure/head_manager.h"
@@ -46,8 +47,8 @@ namespace mongo {
return _catalogEntry->head();
}
- void setHead(const DiskLoc& newHead) {
- _catalogEntry->setHead(newHead);
+ void setHead(TransactionExperiment* txn, const DiskLoc& newHead) {
+ _catalogEntry->setHead(txn, newHead);
}
private:
@@ -108,11 +109,11 @@ namespace mongo {
verify( isReady() == newIsReady );
}
- void IndexCatalogEntry::setHead( DiskLoc newHead ) {
+ void IndexCatalogEntry::setHead( TransactionExperiment* txn, DiskLoc newHead ) {
NamespaceDetails* nsd = _collection->detailsWritable();
int idxNo = _indexNo();
IndexDetails& id = nsd->idx( idxNo );
- *getDur().writing(&id.head) = newHead;
+ *txn->writing(&id.head) = newHead;
_head = newHead;
}
diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h
index 19ee75ad4a6..66afbd09c02 100644
--- a/src/mongo/db/catalog/index_catalog_entry.h
+++ b/src/mongo/db/catalog/index_catalog_entry.h
@@ -43,6 +43,7 @@ namespace mongo {
class IndexAccessMethod;
class IndexDescriptor;
class RecordStore;
+ class TransactionExperiment;
class IndexCatalogEntry {
MONGO_DISALLOW_COPYING( IndexCatalogEntry );
@@ -72,7 +73,7 @@ namespace mongo {
const DiskLoc& head() const;
- void setHead( DiskLoc newHead );
+ void setHead( TransactionExperiment* txn, DiskLoc newHead );
void setIsReady( bool newIsReady );
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 fdf288151d0..81f46fb5604 100644
--- a/src/mongo/db/index/btree_based_bulk_access_method.cpp
+++ b/src/mongo/db/index/btree_based_bulk_access_method.cpp
@@ -138,7 +138,7 @@ namespace mongo {
// XXX: do we expect the tree to be empty but have a head set? Looks like so from old code.
invariant(!oldHead.isNull());
- _real->_btreeState->setHead(DiskLoc());
+ _real->_btreeState->setHead(_txn, DiskLoc());
_real->_btreeState->recordStore()->deleteRecord(_txn, oldHead);
if (_isMultiKey) {
diff --git a/src/mongo/db/structure/btree/btree_logic.cpp b/src/mongo/db/structure/btree/btree_logic.cpp
index dfc1105f530..7e7dd15a8f4 100644
--- a/src/mongo/db/structure/btree/btree_logic.cpp
+++ b/src/mongo/db/structure/btree/btree_logic.cpp
@@ -125,7 +125,7 @@ namespace mongo {
for (;;) {
if (_getBucket(loc)->parent.isNull()) {
// only 1 bucket at this level. we are done.
- _logic->_headManager->setHead(loc);
+ _logic->_headManager->setHead(_trans, loc);
break;
}
@@ -1438,7 +1438,7 @@ namespace mongo {
invariant(bucket->n == 0 && !bucket->nextChild.isNull() );
if (bucket->parent.isNull()) {
invariant(getRootLoc() == bucketLoc);
- _headManager->setHead(bucket->nextChild);
+ _headManager->setHead(trans, bucket->nextChild);
}
else {
BucketType* parentBucket = getBucket(bucket->parent);
@@ -1955,7 +1955,7 @@ namespace mongo {
p->nextChild = rLoc;
assertValid(_indexName, p, _ordering);
bucket->parent = L;
- _headManager->setHead(L);
+ _headManager->setHead(trans, L);
*trans->writing(&getBucket(rLoc)->parent) = bucket->parent;
}
else {
@@ -2002,7 +2002,7 @@ namespace mongo {
return Status(ErrorCodes::InternalError, "index already initialized");
}
- _headManager->setHead(addBucket(trans));
+ _headManager->setHead(trans, addBucket(trans));
return Status::OK();
}
diff --git a/src/mongo/db/structure/head_manager.h b/src/mongo/db/structure/head_manager.h
index d4a9da5dab3..1df38f56fd6 100644
--- a/src/mongo/db/structure/head_manager.h
+++ b/src/mongo/db/structure/head_manager.h
@@ -32,6 +32,8 @@
namespace mongo {
+ class TransactionExperiment;
+
/**
* An abstraction for setting and getting data about the 'head' of an index. This is the data
* that lives in the catalog to identify where an index lives.
@@ -42,7 +44,7 @@ namespace mongo {
virtual const DiskLoc& getHead() const = 0;
- virtual void setHead(const DiskLoc& newHead) = 0;
+ virtual void setHead(TransactionExperiment* txn, const DiskLoc& newHead) = 0;
};
} // namespace mongo