summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-06-26 12:32:02 +0200
committerGitHub <noreply@github.com>2020-06-26 12:32:02 +0200
commit753bd5781cf57cb50e430aea8cffee995d45c314 (patch)
tree23022ca1a7005e3b5679a5c2c2f2aad9bada9bd4 /configserver
parent3810a7c81b90c806c1e64414f2519d47807c6170 (diff)
parent1c5d906292a3b4ec101fbcc591208aa09b6dd007 (diff)
Merge pull request #13714 from vespa-engine/hmusum/avoid-adding-local-session-twice
Avoid adding local session to session cache twice
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
index 8979176b66c..492c9432646 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java
@@ -325,13 +325,15 @@ public class SessionRepository {
loadSessionIfActive(remoteSession);
addRemoteSession(remoteSession);
Optional<LocalSession> localSession = Optional.empty();
- if (distributeApplicationPackage.value()) {
+ if (distributeApplicationPackage())
localSession = createLocalSessionUsingDistributedApplicationPackage(sessionId);
- localSession.ifPresent(this::addSession);
- }
addWatcher(sessionId, fileCache, remoteSession, localSession);
}
+ private boolean distributeApplicationPackage() {
+ return distributeApplicationPackage.value();
+ }
+
private void sessionRemoved(long sessionId) {
SessionStateWatcher watcher = sessionStateWatchers.remove(sessionId);
if (watcher != null) watcher.close();
@@ -464,7 +466,7 @@ public class SessionRepository {
LocalSession session = create(existingApp, existingApplicationId, activeSessionId, internalRedeploy, timeoutBudget);
// Note: Needs to be kept in sync with calls in SessionPreparer.writeStateToZooKeeper()
session.setApplicationId(existingApplicationId);
- if (distributeApplicationPackage.value() && existingSession.getApplicationPackageReference() != null) {
+ if (distributeApplicationPackage() && existingSession.getApplicationPackageReference() != null) {
session.setApplicationPackageReference(existingSession.getApplicationPackageReference());
}
session.setVespaVersion(existingSession.getVespaVersion());
@@ -542,7 +544,8 @@ public class SessionRepository {
}
/**
- * Returns a new session instance for the given session id.
+ * Returns a new local session for the given session id if it does not already exist.
+ * Will also add the session to the local session cache if necessary
*/
public Optional<LocalSession> createLocalSessionUsingDistributedApplicationPackage(long sessionId) {
if (applicationRepo.hasLocalSession(sessionId)) {