diff options
author | David Percy <david.percy@mongodb.com> | 2020-04-13 16:19:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-17 20:53:40 +0000 |
commit | 2a4609e4ebed7503a319c219133a2756f67fd111 (patch) | |
tree | 1483cc31ca2e3e049ecf99e15234ebea56e160fe /src/mongo/scripting | |
parent | 7dcdf00a34e6b030d63001c7586cbc161ef5229a (diff) | |
download | mongo-2a4609e4ebed7503a319c219133a2756f67fd111.tar.gz |
SERVER-47445 Don't update Scope::_loadedVersion before loadStored succeeds
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/engine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 14a75d6b959..ef92e2b49a5 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -224,7 +224,6 @@ void Scope::loadStored(OperationContext* opCtx, bool ignoreNotConnected) { if (_loadedVersion == lastVersion) return; - _loadedVersion = lastVersion; NamespaceString coll(_localDBName, "system.js"); auto directDBClient = DBDirectClientFactory::get(opCtx).create(opCtx); @@ -284,6 +283,10 @@ void Scope::loadStored(OperationContext* opCtx, bool ignoreNotConnected) { ++i; } } + + // Only update _loadedVersion if loading system.js completed successfully. + // If any one operation failed or was interrupted we will start over next time. + _loadedVersion = lastVersion; } ScriptingFunction Scope::createFunction(const char* code) { |