Description
This fails with the code modifications to implicitly_shard_accessed_collections.js introduced by SERVER-26315. In that code, we are over-riding the DBCollection.prototype.drop() function to re-shard collections after they are dropped, in sharded cluster environments.
Note: This does not fail in non-sharded collections.
t = db.mr_undef;
|
t.drop();
|
|
outname = "mr_undef_out"; |
out = db[outname];
|
out.drop();
|
|
t.insert({x: 0});
|
|
var m = function() { |
emit(undefined, this.x); // the key can be 'null' also |
};
|
var r = function(k, v) { |
total = 0;
|
for (i in v) { |
total += v[i];
|
}
|
return total; |
};
|
|
res = t.mapReduce(m, r, {out: outname});
|
printjson(res);
|
printjson(out.find().toArray());
|
assert.eq(1, out.find({_id: {$type: 10}}).itcount(), "A2"); |
|
It fails because there are no documents in the out collection even though the res object shows there was an output document.
[js_test:mr_undef] 2017-03-15T03:59:11.699-0400 {
|
[js_test:mr_undef] 2017-03-15T03:59:11.699-0400 "result" : "mr_undef_out",
|
[js_test:mr_undef] 2017-03-15T03:59:11.699-0400 "counts" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "input" : NumberLong(1),
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "emit" : NumberLong(1),
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "reduce" : NumberLong(0),
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "output" : NumberLong(0)
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 },
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "timeMillis" : 51,
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "timing" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "shardProcessing" : 24,
|
[js_test:mr_undef] 2017-03-15T03:59:11.700-0400 "postProcessing" : 26
|
[js_test:mr_undef] 2017-03-15T03:59:11.701-0400 },
|
[js_test:mr_undef] 2017-03-15T03:59:11.701-0400 "shardCounts" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.701-0400 "huracan:20003" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.702-0400 "input" : 1,
|
[js_test:mr_undef] 2017-03-15T03:59:11.702-0400 "emit" : 1,
|
[js_test:mr_undef] 2017-03-15T03:59:11.702-0400 "reduce" : 0,
|
[js_test:mr_undef] 2017-03-15T03:59:11.702-0400 "output" : 1 <---------------this suggests there was an output document.
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 }
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 },
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 "postProcessCounts" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 "huracan:20003" : {
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 "input" : NumberLong(0),
|
[js_test:mr_undef] 2017-03-15T03:59:11.703-0400 "reduce" : NumberLong(0),
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 "output" : NumberLong(0)
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 }
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 },
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 "ok" : 1
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 }
|
[js_test:mr_undef] 2017-03-15T03:59:11.704-0400 [ ] <------- this is from the "printjson(out.find().toArray());" which shows no output document.
|
....
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400 assert: [1] != [0] are not equal : A2
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400 doassert@src/mongo/shell/assert.js:18:14
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400 assert.eq@src/mongo/shell/assert.js:54:5
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400 @jstests/core/mr_undef.js:26:1
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400
|
[js_test:mr_undef] 2017-03-15T03:59:11.707-0400 2017-03-15T03:59:11.707-0400 E QUERY [thread1] Error: [1] != [0] are not equal : A2 :
|
[js_test:mr_undef] 2017-03-15T03:59:11.708-0400 doassert@src/mongo/shell/assert.js:18:14
|
[js_test:mr_undef] 2017-03-15T03:59:11.708-0400 assert.eq@src/mongo/shell/assert.js:54:5
|
[js_test:mr_undef] 2017-03-15T03:59:11.708-0400 @jstests/core/mr_undef.js:26:1
|
[js_test:mr_undef] 2017-03-15T03:59:11.708-0400 failed to load: jstests/core/mr_undef.js
|
Attachments
Issue Links
- duplicates
-
SERVER-14324 MapReduce does not respect existing shard key on output:sharded
-
- Closed
-
- is related to
-
SERVER-26315 sharded_collections_jscore_passthrough should re-shard the collection after the test drops it
-
- Closed
-