[SERVER-47445] Scope can forget to load system.js procedures if interrupted Created: 09/Apr/20  Updated: 29/Oct/23  Resolved: 17/Apr/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.5.1
Fix Version/s: 4.4.0-rc2, 4.7.0

Type: Bug Priority: Major - P3
Reporter: David Percy Assignee: David Percy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-47168 ensure replication of the system.js c... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Query 2020-04-20, Query 2020-05-04
Participants:
Linked BF Score: 32

 Description   

When you tell a Scope instance to load procedures from system.js, it uses a version number to decide whether the contents of system.js are unchanged. When the version number matches, it does nothing; when the version number is different, it does the actual work of loading stored procedures.

The problem is, the Scope instance updates its version number before doing the work, so if an exception happens during the work, the Scope thinks it's up to date when it's not.

To fix it we can move this line to the bottom of the function: https://github.com/mongodb/mongo/blob/master/src/mongo/scripting/engine.cpp#L227



 Comments   
Comment by Githook User [ 20/Apr/20 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-47445 Don't update Scope::_loadedVersion before loadStored succeeds
Branch: v4.4
https://github.com/mongodb/mongo/commit/814b60b79e4bc6a33aa84eeec4f96cdc8a2171ae

Comment by Githook User [ 17/Apr/20 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-47445 Don't update Scope::_loadedVersion before loadStored succeeds
Branch: master
https://github.com/mongodb/mongo/commit/2a4609e4ebed7503a319c219133a2756f67fd111

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