summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/compact.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2014-03-21 10:17:20 -0400
committerEric Milkie <milkie@10gen.com>2014-03-21 10:17:33 -0400
commit70c062eb0646506df8979b49c052a54e6e4f9f8e (patch)
treea73a3994cbbab8856d191ed044e8a783b12ede84 /src/mongo/db/commands/compact.cpp
parentf6713955af2bfe8a2c5f5ac7d0dfcabebbc821c5 (diff)
downloadmongo-70c062eb0646506df8979b49c052a54e6e4f9f8e.tar.gz
SERVER-13053 track index builds explicitly instead of using CurOp
Diffstat (limited to 'src/mongo/db/commands/compact.cpp')
-rw-r--r--src/mongo/db/commands/compact.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index 6107a53b44a..b020bf1e4e8 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -73,14 +73,14 @@ namespace mongo {
}
CompactCmd() : Command("compact") { }
- virtual std::vector<BSONObj> stopIndexBuilds(const std::string& dbname,
+ virtual std::vector<BSONObj> stopIndexBuilds(Database* db,
const BSONObj& cmdObj) {
- std::string systemIndexes = dbname+".system.indexes";
std::string coll = cmdObj.firstElement().valuestr();
- std::string ns = dbname + "." + coll;
- BSONObj criteria = BSON("ns" << systemIndexes << "op" << "insert" << "insert.ns" << ns);
+ std::string ns = db->name() + "." + coll;
- return IndexBuilder::killMatchingIndexBuilds(criteria);
+ IndexCatalog::IndexKillCriteria criteria;
+ criteria.ns = ns;
+ return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
}
virtual bool run(const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
@@ -159,7 +159,7 @@ namespace mongo {
log() << "compact " << ns << " begin, options: " << compactOptions.toString();
- std::vector<BSONObj> indexesInProg = stopIndexBuilds(db, cmdObj);
+ std::vector<BSONObj> indexesInProg = stopIndexBuilds(ctx.db(), cmdObj);
StatusWith<CompactStats> status = collection->compact( &compactOptions );
if ( !status.isOK() )