summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-06-01 13:55:15 -0400
committerEric Milkie <milkie@10gen.com>2015-06-04 09:10:05 -0400
commitbc44c26302d2f377bc0cefb4e8fbffa247d18db6 (patch)
tree24335e29f9b349860a97c51331b399c41cd6edab /src/mongo/db/commands
parent167d6de7241570e8bc73bcd8878fe91f1f77c12a (diff)
downloadmongo-bc44c26302d2f377bc0cefb4e8fbffa247d18db6.tar.gz
SERVER-17923 prohibit database/collection actions when bg index is running
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp12
-rw-r--r--src/mongo/db/commands/compact.cpp14
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp12
-rw-r--r--src/mongo/db/commands/rename_collection.cpp24
4 files changed, 0 insertions, 62 deletions
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index 97e4637d296..772c1682e37 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -136,18 +136,6 @@ namespace mongo {
out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));
}
- std::vector<BSONObj> stopIndexBuilds(OperationContext* opCtx,
- Database* db,
- const NamespaceString& ns) {
- IndexCatalog::IndexKillCriteria criteria;
- criteria.ns = ns;
- Collection* coll = db->getCollection(ns);
- if (coll) {
- return IndexBuilder::killMatchingIndexBuilds(coll, criteria);
- }
- return std::vector<BSONObj>();
- }
-
bool run(OperationContext* txn,
const string& dbname,
BSONObj& jsobj,
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index c0986823389..e0c935a3f19 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -77,16 +77,6 @@ namespace mongo {
}
CompactCmd() : Command("compact") { }
- virtual std::vector<BSONObj> stopIndexBuilds(OperationContext* opCtx,
- Database* db,
- const BSONObj& cmdObj) {
- const std::string ns = parseNsCollectionRequired(db->name(), cmdObj);
-
- IndexCatalog::IndexKillCriteria criteria;
- criteria.ns = ns;
- return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
- }
-
virtual bool run(OperationContext* txn,
const string& db,
BSONObj& cmdObj,
@@ -169,8 +159,6 @@ namespace mongo {
log() << "compact " << ns << " begin, options: " << compactOptions.toString();
- std::vector<BSONObj> indexesInProg = stopIndexBuilds(txn, collDB, cmdObj);
-
StatusWith<CompactStats> status = collection->compact( txn, &compactOptions );
if ( !status.isOK() )
return appendCommandStatus( result, status.getStatus() );
@@ -180,8 +168,6 @@ namespace mongo {
log() << "compact " << ns << " end";
- IndexBuilder::restoreIndexes(txn, indexesInProg);
-
return true;
}
};
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index d4558145bce..52dfba38bf2 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -115,15 +115,6 @@ namespace mongo {
}
CmdReIndex() : Command("reIndex") { }
- virtual std::vector<BSONObj> stopIndexBuilds(OperationContext* opCtx,
- Database* db,
- const BSONObj& cmdObj) {
- const std::string ns = parseNsCollectionRequired(db->name(), cmdObj);
- IndexCatalog::IndexKillCriteria criteria;
- criteria.ns = ns;
- return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria);
- }
-
bool run(OperationContext* txn,
const string& dbname,
BSONObj& jsobj,
@@ -149,8 +140,6 @@ namespace mongo {
BackgroundOperation::assertNoBgOpInProgForNs( toDeleteNs );
- std::vector<BSONObj> indexesInProg = stopIndexBuilds(txn, ctx.db(), jsobj);
-
vector<BSONObj> all;
{
vector<string> indexNames;
@@ -203,7 +192,6 @@ namespace mongo {
result.append( "nIndexes", (int)all.size() );
result.append( "indexes", all );
- IndexBuilder::restoreIndexes(txn, indexesInProg);
return true;
}
} cmdReIndex;
diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp
index 91d7ac3254f..5479ee92a40 100644
--- a/src/mongo/db/commands/rename_collection.cpp
+++ b/src/mongo/db/commands/rename_collection.cpp
@@ -75,30 +75,6 @@ namespace mongo {
help << " example: { renameCollection: foo.a, to: bar.b }";
}
- std::vector<BSONObj> stopIndexBuilds(OperationContext* opCtx,
- Database* db,
- const NamespaceString& source,
- const NamespaceString& target) {
-
- IndexCatalog::IndexKillCriteria criteria;
- criteria.ns = source;
- std::vector<BSONObj> prelim =
- IndexBuilder::killMatchingIndexBuilds(db->getCollection(source), criteria);
-
- std::vector<BSONObj> indexes;
-
- for (int i = 0; i < static_cast<int>(prelim.size()); i++) {
- // Change the ns
- BSONObj stripped = prelim[i].removeField("ns");
- BSONObjBuilder builder;
- builder.appendElements(stripped);
- builder.append("ns", target);
- indexes.push_back(builder.obj());
- }
-
- return indexes;
- }
-
static void dropCollection(OperationContext* txn, Database* db, StringData collName) {
WriteUnitOfWork wunit(txn);
if (db->dropCollection(txn, collName).isOK()) {