From c088ca1af8b410248aea7cfdda58c17550215f5e Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Thu, 23 Sep 2010 17:00:53 -0400 Subject: [PATCH] check for background indexing in progress after dup check SERVER-1317 --- db/index.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/db/index.cpp b/db/index.cpp index 33c1038ef0e..8c3e69e9521 100644 --- a/db/index.cpp +++ b/db/index.cpp @@ -172,11 +172,6 @@ namespace mongo { uassert(10097, "bad table to index name on add index attempt", cc().database()->name == nsToDatabase(sourceNS.c_str())); - /* we can't build a new index for the ns if a build is already in progress in the background - - EVEN IF this is a foreground build. - */ - uassert(12588, "cannot add index with a background operation in progress", - !BackgroundOperation::inProgForNs(sourceNS.c_str())); BSONObj key = io.getObjectField("key"); uassert(12524, "index key pattern too large", key.objsize() <= 2048); @@ -222,6 +217,13 @@ namespace mongo { uasserted(12505,s); } + /* we can't build a new index for the ns if a build is already in progress in the background - + EVEN IF this is a foreground build. + */ + uassert(12588, "cannot add index with a background operation in progress", + !BackgroundOperation::inProgForNs(sourceNS.c_str())); + + /* this is because we want key patterns like { _id : 1 } and { _id : } to all be treated as the same pattern. */