summaryrefslogtreecommitdiff
path: root/jstests/replsets
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2023-05-02 19:24:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-02 20:32:16 +0000
commitc4c70867481f1e0a004fe7dd879b4810ddeb29b8 (patch)
treee092edfbf09ca1d85b17f4f04e994dc2c01aad00 /jstests/replsets
parent63cc48d21b065e8ed09d672b5af6f8a69cec0dba (diff)
downloadmongo-c4c70867481f1e0a004fe7dd879b4810ddeb29b8.tar.gz
SERVER-73526 Invert logic for when DocumentSourceGroup does extra spilling in debug builds
This behavior is intended to provide extra test coverage for $group spilling. In the past, the extra spilling happened unless disk use was explicitly enabled. Now that disk use is allowed by default, it makes more sense to spill unless disk use is explicitly disallowed.
Diffstat (limited to 'jstests/replsets')
-rw-r--r--jstests/replsets/commands_that_write_accept_wc.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/jstests/replsets/commands_that_write_accept_wc.js b/jstests/replsets/commands_that_write_accept_wc.js
index 8a8adffad5e..75d06682da8 100644
--- a/jstests/replsets/commands_that_write_accept_wc.js
+++ b/jstests/replsets/commands_that_write_accept_wc.js
@@ -44,7 +44,7 @@ commands.push({
commands.push({
req: {createIndexes: collName, indexes: [{key: {'type': 1}, name: 'type_index'}]},
setupFunc: function() {
- coll.insert({type: 'oak'});
+ assert.commandWorked(coll.insert({type: 'oak'}));
assert.eq(coll.getIndexes().length, 1);
},
confirmFunc: function() {
@@ -62,7 +62,7 @@ commands.push({
writeConcern: {w: 'majority'}
},
setupFunc: function() {
- coll.insert({type: 'oak'});
+ assert.commandWorked(coll.insert({type: 'oak'}));
assert.eq(coll.count({type: 'ginkgo'}), 0);
assert.eq(coll.count({type: 'oak'}), 1);
},
@@ -80,7 +80,7 @@ commands.push({
writeConcern: {w: 'majority'}
},
setupFunc: function() {
- coll.insert({type: 'oak'});
+ assert.commandWorked(coll.insert({type: 'oak'}));
assert.eq(coll.count({type: 'ginkgo'}), 0);
assert.eq(coll.count({type: 'oak'}), 1);
},
@@ -98,7 +98,7 @@ commands.push({
writeConcern: {w: 'majority'}
},
setupFunc: function() {
- coll.insert({type: 'oak'});
+ assert.commandWorked(coll.insert({type: 'oak'}));
assert.eq(coll.count({type: 'ginkgo'}), 0);
assert.eq(coll.count({type: 'oak'}), 1);
},
@@ -111,7 +111,7 @@ commands.push({
commands.push({
req: {applyOps: [{op: "u", ns: coll.getFullName(), o: {_id: 1, type: "willow"}, o2: {_id: 1}}]},
setupFunc: function() {
- coll.insert({_id: 1, type: 'oak'});
+ assert.commandWorked(coll.insert({_id: 1, type: 'oak'}));
assert.eq(coll.count({type: 'willow'}), 0);
},
confirmFunc: function() {
@@ -141,15 +141,24 @@ commands.push({
});
},
reduce: function(key, values) {
- return {count: values.length};
+ // We may be re-reducing values that have already been partially reduced. In that case,
+ // we expect to see an object like {count: <count>} in the array of input values.
+ const numValues = values.reduce(function(acc, currentValue) {
+ if (typeof currentValue === "object") {
+ return acc + currentValue.count;
+ } else {
+ return acc + 1;
+ }
+ }, 0);
+ return {count: numValues};
},
out: "foo"
},
setupFunc: function() {
- coll.insert({x: 1, tags: ["a", "b"]});
- coll.insert({x: 2, tags: ["b", "c"]});
- coll.insert({x: 3, tags: ["c", "a"]});
- coll.insert({x: 4, tags: ["b", "c"]});
+ assert.commandWorked(coll.insert({x: 1, tags: ["a", "b"]}));
+ assert.commandWorked(coll.insert({x: 2, tags: ["b", "c"]}));
+ assert.commandWorked(coll.insert({x: 3, tags: ["c", "a"]}));
+ assert.commandWorked(coll.insert({x: 4, tags: ["b", "c"]}));
},
confirmFunc: function() {
assert.eq(db.foo.findOne({_id: 'a'}).value.count, 2);