diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-10-06 15:15:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 15:15:38 +0200 |
commit | bf9ffb40400a718c37de35f1f9f6ba7e900fac8a (patch) | |
tree | 6a01b03c0f76d652ea40f7058379de46d97e2a28 | |
parent | c75fc27d408d8d70ea0cfe9938edc81359853dd8 (diff) | |
parent | e6daf1e9e7663ab7f4afab61e3dcdd167810a470 (diff) |
Merge pull request #14736 from vespa-engine/hmusum/remove-stale-code
Session locks are not used anymore
3 files changed, 0 insertions, 32 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index 510569355f5..4fba0204f55 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -821,14 +821,6 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye sessionsPerTenant.keySet().forEach(tenant -> tenant.getSessionRepository().deleteExpiredSessions(activeSessions)); } - public int deleteExpiredSessionLocks(Duration expiryTime) { - return tenantRepository.getAllTenants() - .stream() - .map(tenant -> tenant.getSessionRepository().deleteExpiredLocks(clock, expiryTime)) - .mapToInt(i -> i) - .sum(); - } - public int deleteExpiredRemoteSessions(Duration expiryTime) { return deleteExpiredRemoteSessions(clock, expiryTime); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/SessionsMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/SessionsMaintainer.java index 0be81e41d30..19534bba810 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/SessionsMaintainer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/SessionsMaintainer.java @@ -33,10 +33,6 @@ public class SessionsMaintainer extends ConfigServerMaintainer { log.log(LogLevel.FINE, () -> "Deleted " + deleted + " expired remote sessions older than " + expiryTime); } - Duration lockExpiryTime = Duration.ofMinutes(90); - int deleted = applicationRepository.deleteExpiredSessionLocks(lockExpiryTime); - log.log(LogLevel.FINE, () -> "Deleted " + deleted + " locks older than " + lockExpiryTime); - return true; } 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 518294a13b8..2b4d60d5281 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 @@ -89,7 +89,6 @@ public class SessionRepository { private final Path sessionsPath; private final TenantName tenantName; private final GlobalComponentRegistry componentRegistry; - private final Path locksPath; public SessionRepository(TenantName tenantName, GlobalComponentRegistry componentRegistry, @@ -107,7 +106,6 @@ public class SessionRepository { this.applicationRepo = applicationRepo; this.sessionPreparer = sessionPreparer; this.metrics = componentRegistry.getMetrics().getOrCreateMetricUpdater(Metrics.createDimensions(tenantName)); - this.locksPath = TenantRepository.getLocksPath(tenantName); loadSessions(); // Needs to be done before creating cache below this.directoryCache = curator.createDirectoryCache(sessionsPath.getAbsolute(), false, false, componentRegistry.getZkCacheExecutor()); this.directoryCache.addListener(this::childEvent); @@ -279,24 +277,6 @@ public class SessionRepository { transaction.close(); } - // TODO: Delete after 7.294 has been rolled out everywhere - public int deleteExpiredLocks(Clock clock, Duration expiryTime) { - int deleted = 0; - for (var lock : curator.getChildren(locksPath)) { - Path path = locksPath.append(lock); - if (zooKeeperNodeCreated(path).orElse(clock.instant()).isBefore(clock.instant().minus(expiryTime))) { - log.log(Level.FINE, () -> "Lock " + path + " has expired, deleting it"); - curator.delete(path); - deleted++; - } - } - return deleted; - } - - private Optional<Instant> zooKeeperNodeCreated(Path path) { - return curator.getStat(path).map(s -> Instant.ofEpochMilli(s.getCtime())); - } - private boolean sessionHasExpired(Instant created, Duration expiryTime, Clock clock) { return (created.plus(expiryTime).isBefore(clock.instant())); } |