[SERVER-60588] $multiply incorrectly throws an error in some cases in the classic engine Created: 09/Oct/21  Updated: 29/Oct/23  Resolved: 20/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.11, 4.2.18, 4.0.28, 5.0.4, 5.1.0-rc2

Type: Bug Priority: Major - P3
Reporter: Drew Paroski Assignee: Jennifer Peshansky (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Related
is related to SERVER-60584 Write a test to ensure SBE's implemen... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Backport Requested:
v5.1, v5.0, v4.4, v4.2, v4.0
Sprint: QE 2021-10-18, QE 2021-11-01
Participants:
Linked BF Score: 149

 Description   

I came across a simple case in the classic engine where $multiply throws an error when it shouldn't. Here is the repro:

> db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true});
> db.c.drop();
> db.c.insert({a: 1.0});
> db.c.find({}, {x: {$multiply: ["$a", 1.0e+35]}})

When I run the commands above in the classic engine, I get the following error:

"Executor error during find command :: caused by :: Can't coerce out of range value -9.8696e+34 to long"

The example above is simply multiplying the double 1.0 by the double 1.0e+35. There is no reason that this operation should fail.

The goal of this task is to investigate why the failure described above is occurring, and to implement the appropriate fix.

As part of this work, once the issue is solved, $multiply should be marked as sbe-compatible again (undoing SERVER-60583.)



 Comments   
Comment by Githook User [ 03/Nov/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long

(cherry picked from commit d0a023d1cba8782c761890c20752ecf494d22a62)
(cherry picked from commit f6c05d4d028fe6712e81396be335fd144124c561)
Branch: v4.4
https://github.com/mongodb/mongo/commit/a91d571a9ca63a0cbc939c041a41a6a037911c94

Comment by Githook User [ 03/Nov/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long

(cherry picked from commit d0a023d1cba8782c761890c20752ecf494d22a62)
(cherry picked from commit f6c05d4d028fe6712e81396be335fd144124c561)
(cherry picked from commit 9aa24cb9aaa12578a81361e64a5e57dbe1c34b1e)
(cherry picked from commit 4ea0988ab20a69369b8a8ceaf5015c94f253a289)
Branch: v4.0
https://github.com/mongodb/mongo/commit/062c6c13cabb6dc26bed460954982925f2e9f611

Comment by Githook User [ 03/Nov/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long

(cherry picked from commit d0a023d1cba8782c761890c20752ecf494d22a62)
(cherry picked from commit f6c05d4d028fe6712e81396be335fd144124c561)
(cherry picked from commit 9aa24cb9aaa12578a81361e64a5e57dbe1c34b1e)
Branch: v4.2
https://github.com/mongodb/mongo/commit/60ce48d31de63b06dab060bd79533d5aa5b72375

Comment by Githook User [ 20/Oct/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long

(cherry picked from commit d0a023d1cba8782c761890c20752ecf494d22a62)
Branch: v5.1
https://github.com/mongodb/mongo/commit/cb1e9d3b1e5c964d3a54fd9f6d85da817e7d5372

Comment by Githook User [ 20/Oct/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long

(cherry picked from commit d0a023d1cba8782c761890c20752ecf494d22a62)
Branch: v5.0
https://github.com/mongodb/mongo/commit/f6c05d4d028fe6712e81396be335fd144124c561

Comment by Githook User [ 20/Oct/21 ]

Author:

{'name': 'Jennifer Peshansky', 'email': 'jennifer.peshansky@mongodb.com', 'username': 'jenniferpeshansky'}

Message: SERVER-60588 Don't attempt to coerce a double product to long
Branch: master
https://github.com/mongodb/mongo/commit/3df7340a53ce8b8c7e0fa7e29e7d25490e9032cf

Generated at Thu Feb 08 05:50:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.