summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/index_catalog.cpp
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2016-09-20 17:08:16 -0400
committerGeert Bosch <geert@mongodb.com>2016-09-21 11:39:49 -0400
commitc66a623167c156f953781949deef68b07ee1b9f0 (patch)
tree0c4c946f957b03ccacfe4ac3b3a096b98a76f5d5 /src/mongo/db/catalog/index_catalog.cpp
parent350f32dbb72909678e9ec4836edb662e1e357f42 (diff)
downloadmongo-c66a623167c156f953781949deef68b07ee1b9f0.tar.gz
SERVER-26139 Abandon snapshot after spawning a background index build
Also adds extra logging to help debug similar future issues.
Diffstat (limited to 'src/mongo/db/catalog/index_catalog.cpp')
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index e48040cb591..2315180d796 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -405,6 +405,8 @@ void IndexCatalog::IndexBuildBlock::fail() {
void IndexCatalog::IndexBuildBlock::success() {
Collection* collection = _catalog->_collection;
fassert(17207, collection->ok());
+ NamespaceString ns(_indexNamespace);
+ invariant(_txn->lockState()->isDbLockedForMode(ns.db(), MODE_X));
collection->getCatalogEntry()->indexBuildSuccess(_txn, _indexName);
@@ -414,6 +416,8 @@ void IndexCatalog::IndexBuildBlock::success() {
fassert(17331, entry && entry == _entry);
OperationContext* txn = _txn;
+ LOG(2) << "marking index " << _indexName << " as ready in snapshot id "
+ << txn->recoveryUnit()->getSnapshotId();
_txn->recoveryUnit()->onCommit([txn, entry, collection] {
// Note: this runs after the WUOW commits but before we release our X lock on the
// collection. This means that any snapshot created after this must include the full index,