summaryrefslogtreecommitdiff
path: root/s/strategy_shard.cpp
diff options
context:
space:
mode:
authoragirbal <antoine@10gen.com>2011-06-26 18:59:37 -0700
committeragirbal <antoine@10gen.com>2011-06-26 19:00:52 -0700
commit1388ecbdb76160bbfbb2df018ed860c2c81f592a (patch)
tree5a6f8e67b02168d49573451aaaecd2066ba70403 /s/strategy_shard.cpp
parent5a2f4ceb93b44283500f1ed346898439ca33b137 (diff)
downloadmongo-1388ecbdb76160bbfbb2df018ed860c2c81f592a.tar.gz
SERVER-2531: added REDUCE mode for M/R to sharded output collection
Diffstat (limited to 's/strategy_shard.cpp')
-rw-r--r--s/strategy_shard.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/s/strategy_shard.cpp b/s/strategy_shard.cpp
index 7710c00bf8f..4ff35673220 100644
--- a/s/strategy_shard.cpp
+++ b/s/strategy_shard.cpp
@@ -191,8 +191,10 @@ namespace mongo {
}
}
- void insertSharded( DBConfigPtr conf, const char* ns, BSONObj& o, int flags ) {
- ChunkManagerPtr manager = conf->getChunkManager(ns);
+ void insertSharded( DBConfigPtr conf, const char* ns, BSONObj& o, int flags, bool safe, const char* nsChunkLookup ) {
+ if (!nsChunkLookup)
+ nsChunkLookup = ns;
+ ChunkManagerPtr manager = conf->getChunkManager(nsChunkLookup);
if ( ! manager->hasShardKey( o ) ) {
bool bad = true;
@@ -206,7 +208,7 @@ namespace mongo {
}
if ( bad ) {
- log() << "tried to insert object without shard key: " << ns << " " << o << endl;
+ log() << "tried to insert object without shard key: " << nsChunkLookup << " " << o << endl;
uasserted( 14842 , "tried to insert object without shard key" );
}
@@ -221,7 +223,7 @@ namespace mongo {
try {
ChunkPtr c = manager->findChunk( o );
log(4) << " server:" << c->getShard().toString() << " " << o << endl;
- insert( c->getShard() , ns , o , flags);
+ insert( c->getShard() , ns , o , flags, safe);
// r.gotInsert();
// if ( r.getClientInfo()->autoSplitOk() )
@@ -344,7 +346,7 @@ namespace mongo {
}
}
- void updateSharded( DBConfigPtr conf, const char* ns, BSONObj& query, BSONObj& toupdate, int flags ) {
+ void updateSharded( DBConfigPtr conf, const char* ns, BSONObj& query, BSONObj& toupdate, int flags, bool safe ) {
ChunkManagerPtr manager = conf->getChunkManager(ns);
BSONObj chunkFinder = query;
@@ -410,7 +412,7 @@ namespace mongo {
// int * x = (int*)(r.d().afterNS());
// x[0] |= UpdateOption_Broadcast;
for ( set<Shard>::iterator i=shards.begin(); i!=shards.end(); i++) {
- update(*i, ns, query, toupdate, flags);
+ update(*i, ns, query, toupdate, flags, safe);
}
}
else {