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

fix finalize error message WAS: Database/table creation does not work from getSisterDB in sharded map/reduce (should assert?)

    • Linux
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      When running a map/reduce on a sharded collection with a finalize() function, cross-database creation does not work (or assert):

      Finalize example (assuming new_db does not yet exist):

      finalize = function (key, value) {

      var new_db = db.getSisterDB("new_db");
      stat = value;
      stat._id = key;
      new_db.table.save(stat);

      return value;
      };

      In this instance the new_db database is created, but is completely inaccessible and produces inconsistent errors:

      > db.getCollectionNames();
      Mon Mar 21 15:15:04 uncaught exception: error:

      { "$err" : "no primary!", "code" : 10178 }

      > db.repairDatabase();
      Mon Mar 21 15:09:00 uncaught exception: error

      { "$err" : "wrong type for BSONElement () 0 != 8", "code" : 13111 }

      > db.repairDatabase();
      {
      "assertion" : "no primary shard configured for db: new_db",
      "assertionCode" : 8041,
      "errmsg" : "db assertion failure",
      "ok" : 0
      }

      The database also cannot be dropped:

      > db.dropDatabase();
      {
      "assertion" : "assertion client/../s/shard.h:80",
      "errmsg" : "db assertion failure",
      "ok" : 0
      }

            Assignee:
            Unassigned Unassigned
            Reporter:
            alan Alan Milford
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: