bool VersionManager::forceRemoteCheckShardVersionCB(const string& ns) { const NamespaceString nss(ns); // This will force the database catalog entry to be reloaded grid.catalogCache()->invalidate(nss.db().toString()); auto status = grid.catalogCache()->getDatabase(nss.db().toString()); if (!status.isOK()) { return false; } shared_ptr<DBConfig> conf = status.getValue(); // If we don't have a collection, don't refresh the chunk manager if (nsGetCollection(ns).size() == 0) { return false; } ChunkManagerPtr manager = conf->getChunkManagerIfExists(ns, true, true); if (!manager) { return false; } return true; }
BSONObj DBClientWithCommands::mapreduce(const string &ns, const string &jsmapf, const string &jsreducef, BSONObj query, MROutput output) { BSONObjBuilder b; b.append("mapreduce", nsGetCollection(ns)); b.appendCode("map", jsmapf); b.appendCode("reduce", jsreducef); if( !query.isEmpty() ) b.append("query", query); b.append("out", output.out); BSONObj info; runCommand(nsGetDB(ns), b.done(), info); return info; }
bool VersionManager::forceRemoteCheckShardVersionCB( const string& ns ){ DBConfigPtr conf = grid.getDBConfig( ns ); if ( ! conf ) return false; conf->reload(); // If we don't have a collection, don't refresh the chunk manager if( nsGetCollection( ns ).size() == 0 ) return false; ChunkManagerPtr manager = conf->getChunkManagerIfExists( ns, true, true ); if( ! manager ) return false; return true; }