Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6819

"db.ad.find()" from "map" callback, when sharding for collection is enabled

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: MapReduce, Sharding
    • Labels:
      None
    • Environment:
      git hash is "9e1a79dc4a2cc632d45e6af67f574c41aeff54ac"
    • ALL

      If you trying to query some additional info from another collection(for example "foo") for "map" callback,
      it works only if there is copy of "foo" at every shard, that will run this MR job.

      Is it right or not?
      Even if you create "Mongo" instance like this "new Mongo('host:port');" ?

      Code for reproduce this:

      // foo
      db.foo.insert({foo: 1});
      db.foo.insert({foo: 2});
      
      // sharding
      sh.enableSharding('current_db');
      sh.shardCollection('current_db.barSharded', {_id: 1});
      // insert 10m rows
      for (var i = 0; i < 10000000; ++i) {
      	db.barSharded.insert({i: i});
      }
      
      var map = function() {                                                                                                                            
      	var db = (new Mongo()).getDB(database);
      	if (!db.foo.findOne()) {
      		throw "reproduced";
      	}
      }
      var reduce = function(rows) {}
      
      db.barSharded.mapreduce(map, reduce, {out: "baz"});
      

            Assignee:
            michael.grundy Michael Grundy
            Reporter:
            azat Azat Khuzhin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: