summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-04-16 21:49:30 +0200
committerGitHub <noreply@github.com>2020-04-16 21:49:30 +0200
commitdc94ab3081ba413ed7ae4791b2bb2dd908e06788 (patch)
treedde175098a0029e1a61dcb1330c72fdaa5fe2b4b /configserver
parent72bafe27fc8920db4a6f6b728f552530aafe16e8 (diff)
parent32f6527ea16a95bff5431de97a575efbf32b9b0c (diff)
Merge pull request #12937 from vespa-engine/hmusum/do-more-work-in-executor
Do all redeployment work in executor
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java15
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java3
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java3
3 files changed, 8 insertions, 13 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
index 63b1df3d634..2a426e4cccc 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
@@ -231,20 +231,17 @@ public class ConfigServerBootstrap extends AbstractComponent implements Runnable
new DaemonThreadFactory("redeploy apps"));
// Keep track of deployment per application
Map<ApplicationId, Future<?>> futures = new HashMap<>();
- Set<ApplicationId> failedDeployments = new HashSet<>();
-
- for (ApplicationId appId : applicationIds) {
- Optional<Deployment> deploymentOptional = applicationRepository.deployFromLocalActive(appId, true /* bootstrap */);
- if (deploymentOptional.isEmpty()) continue;
-
- futures.put(appId, executor.submit(deploymentOptional.get()::activate));
- }
+ applicationIds.forEach(applicationId -> futures.put(applicationId, executor.submit(() -> {
+ applicationRepository.deployFromLocalActive(applicationId, true /* bootstrap */)
+ .ifPresent(Deployment::activate);
+ })));
+ Set<ApplicationId> failedDeployments = new HashSet<>();
for (Map.Entry<ApplicationId, Future<?>> f : futures.entrySet()) {
- ApplicationId app = f.getKey();
try {
f.getValue().get();
} catch (ExecutionException e) {
+ ApplicationId app = f.getKey();
if (e.getCause() instanceof TransientException) {
log.log(LogLevel.INFO, "Redeploying " + app +
" failed with transient error, will retry after bootstrap: " + Exceptions.toMessageString(e));
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java
index 82dc17c3678..4bd5cf30cc6 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java
@@ -171,14 +171,13 @@ public class Deployment implements com.yahoo.config.provision.Deployment {
/** Exposes the session of this for testing only */
public LocalSession session() { return session; }
- private long validateSessionStatus(LocalSession localSession) {
+ private void validateSessionStatus(LocalSession localSession) {
long sessionId = localSession.getSessionId();
if (Session.Status.NEW.equals(localSession.getStatus())) {
throw new IllegalStateException(localSession.logPre() + "Session " + sessionId + " is not prepared");
} else if (Session.Status.ACTIVATE.equals(localSession.getStatus())) {
throw new IllegalStateException(localSession.logPre() + "Session " + sessionId + " is already active");
}
- return sessionId;
}
private Transaction deactivateCurrentActivateNew(LocalSession active, LocalSession prepared, boolean ignoreStaleSessionFailure) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java
index 06a3dfa8777..5ae1289033d 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java
@@ -127,7 +127,7 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader {
ApplicationId existingApplicationId = existingSession.getApplicationId();
long activeSessionId = getActiveSessionId(existingApplicationId);
- logger.log(LogLevel.DEBUG, "Create from existing application id " + existingApplicationId + ", active session id is " + activeSessionId);
+ logger.log(LogLevel.DEBUG, "Create new session for application id '" + existingApplicationId + "' from existing active session " + activeSessionId);
LocalSession session = create(existingApp, existingApplicationId, activeSessionId, internalRedeploy, timeoutBudget);
// Note: Needs to be kept in sync with calls in SessionPreparer.writeStateToZooKeeper()
session.setApplicationId(existingApplicationId);
@@ -141,7 +141,6 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader {
boolean internalRedeploy, TimeoutBudget timeoutBudget) {
long sessionId = sessionCounter.nextSessionId();
Path sessionIdPath = sessionsPath.append(String.valueOf(sessionId));
- log.log(LogLevel.DEBUG, TenantRepository.logPre(tenant) + "Next session id is " + sessionId + " , sessionIdPath=" + sessionIdPath.getAbsolute());
try {
ensureZKPathDoesNotExist(sessionIdPath);
SessionZooKeeperClient sessionZooKeeperClient = new SessionZooKeeperClient(curator,