summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-12-19 13:22:41 -0500
committerRandolph Tan <randolph@10gen.com>2014-12-22 15:31:46 -0500
commitbf0cdcee577aa5a05ba65506d8bd47f33eac30d2 (patch)
treed67138584e3d65153ac2e0e5684f48ae5cd88b41 /src/mongo/db/dbhelpers.cpp
parent1921c8c3f1cdaf0eebec76d328bc773018594bdf (diff)
downloadmongo-bf0cdcee577aa5a05ba65506d8bd47f33eac30d2.tar.gz
SERVER-15798 Helpers::removeRange does not check if node is primary
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index e6258c23a2c..7c21615f3d6 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -446,6 +446,14 @@ namespace mongo {
break;
}
}
+
+ if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesForDatabase(ns)) {
+ warning() << "stepped down from primary while deleting chunk; "
+ << "orphaning data in " << ns
+ << " in range [" << min << ", " << max << ")";
+ return numDeleted;
+ }
+
if ( callback )
callback->goingToDelete( obj );