[SERVER-45105] Keep supporting finalize: null in mapReduce command Created: 12/Dec/19  Updated: 29/Oct/23  Resolved: 18/Dec/19

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: None
Fix Version/s: 4.3.3

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Ted Tuckman
Resolution: Fixed Votes: 1
Labels: qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-3555 Work around changes to mapReduce impl... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2019-12-30
Participants:

 Description   

A recent commit to master made it an error to pass a null value for the finalize field in a mapReduce command. The error is:

 {
   “ok”: 0.0, 
   “errmsg”: “‘finalize’ must be of string or code type”, 
   “code”: 2, 
   “codeName”: “BadValue”
  }  

Previous versions of mongod treated this the same as a missing finalize field.

Unfortunately, all existing releases of the Java driver trigger this error when there is no finalize function specified by the application. While we could easily update later releases to non include the field instead of sending a null value for it, any existing application that uses a current driver and updates their server will run into this.

Please consider continuing to allow a null value for finalize.

Update:

The driver treats the query, sort, and scope fields similarly: it passes a null value if the application doesn't provide values. ]



 Comments   
Comment by Jeffrey Yemin [ 17/Dec/19 ]

Looks good.

Comment by Ted Tuckman [ 17/Dec/19 ]

jeff.yemin those seem to be working already with the new implementation. If you look at the test in the above commit I checked all the fields you listed here in this ticket. Let me know if I missed something, otherwise I'll close the ticket.

Comment by Jeffrey Yemin [ 17/Dec/19 ]

ted.tuckman do you also plan to change query and sort field expectations?

Comment by Githook User [ 17/Dec/19 ]

Author:

{'name': 'Ted Tuckman', 'email': 'ted.tuckman@mongodb.com', 'username': 'TedTuckman'}

Message: SERVER-45105 Keep allowing scope and finalize to be explicit null in mapReduce command
Branch: master
https://github.com/mongodb/mongo/commit/ff8bc31e9b64b2ecc68ad4952cd108d2284b6861

Comment by Jeffrey Yemin [ 12/Dec/19 ]

Updated the description with a list of other fields that are handled similarly by the Java driver.

Comment by James Wahlin [ 12/Dec/19 ]

Thanks for filing this Jeff. Our recent commit was to switch over from using the legacy mapReduce command implementation to one executed by the aggregation framework. I expect that we can make this change to accommodate drivers.

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