Operational Defect Database

BugZero found this defect 79 days ago.

MongoDB | 2596098

Bugs from SERVER-84488 block processing buildBlockAccumulatorSum()

Last update date:

3/13/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

SERVER-84488 delivered a new method buildBlockAccumulatorSum() that injected some bugs. It also does not make $sum work in block processing mode (though the ticket was officially about making $count work in block processing mode, so maybe that bit was expected). Reproduction (requires featureFlagSbeFull) These repros are from master branch SHA f726b6db from 2024-03-01, which is four commits after SERVER-84488's commit d2663eca, also from 2024-03-01, that injected the issues. 0. Setup db.coll.drop() db.createCollection("coll", {timeseries: {timeField: "t"}}) db.coll.insert({t: new Date(), a: 4, b: 7, c: 5}) db.coll.insert({t: new Date(), a: 2, b: 9, c: 8}) db.coll.insert({t: new Date(), a: 3, b: 1, c: 6}) 1. {$sum: "$a"} does NOT use block processing mode, because buildBlockAccumulatorSum() returns an empty vector unless the argument to $sum is a constant. Thus the caller falls back to the existing row-based $sum accumulator and gets the correct answer, but it may be a bug that it did not use block processing mode: > db.coll.aggregate([{$project: {a: 1}}, {$group: {_id: null, x: {$sum : "$a"}}}], {allowDiskUse: false}) { "_id" : null, "x" : 9 } 2. {$sum: 10} DOES use block processing mode, but gives wrong results (the sum of three 10s should be 30 but comes out as 10): > db.coll.aggregate([{$project: {a: 1}}, {$group: {_id: null, x: {$sum : 10}}}], {allowDiskUse: false}) { "_id" : null, "x" : 10 } 3. {$sum: "10"} (arg is a non-numeric constant) DOES use block processing mode but results in the server core dumping in the SBE VM: > db.coll.aggregate([{$project: {a: 1}}, {$group: {_id: null, x: {$sum : "10"}}}], {allowDiskUse: false}) Error: network error while attempting to run command 'aggregate' on host '127.0.0.1:27017' :: caused by :: dbclient error communicating with server 127.0.0.1:27017 :: caused by :: futurize :: caused by :: Connection closed by peer : Mongo.prototype.runCommand@src/mongo/shell/mongo.js:163:17 runClientFunctionWithRetries@src/mongo/shell/session.js:348:42 runCommand@src/mongo/shell/session.js:465:53 DB.prototype._runCommandImpl@src/mongo/shell/db.js:163:45 DB.prototype.runCommand@src/mongo/shell/db.js:178:21 DB.prototype.runReadCommand@src/mongo/shell/db.js:157:17 DB.prototype._runAggregate@src/mongo/shell/db.js:264:22 DBCollection.prototype.aggregate@src/mongo/shell/collection.js:985:21 @(shell):1:9

Top User Comments

JIRAUSER1270811 commented on Wed, 13 Mar 2024 20:28:30 +0000: Fixed by reversion of original SERVER-84488 commit https://github.com/mongodb/mongo/commit/8bc6101553ac157c45e89021d06338b3f9c021a3

Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Closed

Learn More

Search:

...