diff options
author | Harald Musum <musum@oath.com> | 2017-10-20 09:05:41 +0200 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2017-10-20 09:05:41 +0200 |
commit | 4c49b39ae9f0af5aded97b24bcca6ab6e7fe75cd (patch) | |
tree | 7163626f7e6f095fcbcc3deab254a5fe91472e3a /configserver | |
parent | 70109980a8c3aebdd317d76e203c028e69365660 (diff) |
Remove rewrite of legacy application ids
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/application/ZKTenantApplications.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ZKTenantApplications.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ZKTenantApplications.java index 574bac792dd..defe496ca00 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ZKTenantApplications.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ZKTenantApplications.java @@ -50,7 +50,6 @@ public class ZKTenantApplications implements TenantApplications, PathChildrenCac this.applicationsPath = applicationsPath; this.reloadHandler = reloadHandler; this.tenant = tenant; - rewriteApplicationIds(); this.directoryCache = curator.createDirectoryCache(applicationsPath.getAbsolute(), false, false, pathChildrenExecutor); this.directoryCache.start(); this.directoryCache.addListener(this); @@ -64,20 +63,6 @@ public class ZKTenantApplications implements TenantApplications, PathChildrenCac } } - // TODO: October 2017: Evaluate and remove if possible, seems to be compatibility code that is not needed anymore - private void rewriteApplicationIds() { - try { - List<String> appNodes = curator.framework().getChildren().forPath(applicationsPath.getAbsolute()); - for (String appNode : appNodes) { - Optional<ApplicationId> appId = parseApplication(appNode); - appId.filter(id -> shouldBeRewritten(appNode, id)) - .ifPresent(id -> rewriteApplicationId(id, appNode, readSessionId(id, appNode))); - } - } catch (Exception e) { - log.log(LogLevel.WARNING, "Error rewriting application ids on upgrade", e); - } - } - private long readSessionId(ApplicationId appId, String appNode) { String path = applicationsPath.append(appNode).getAbsolute(); try { @@ -87,24 +72,6 @@ public class ZKTenantApplications implements TenantApplications, PathChildrenCac } } - private boolean shouldBeRewritten(String appNode, ApplicationId appId) { - return !appNode.equals(appId.serializedForm()); - } - - private void rewriteApplicationId(ApplicationId appId, String origNode, long sessionId) { - String newPath = applicationsPath.append(appId.serializedForm()).getAbsolute(); - String oldPath = applicationsPath.append(origNode).getAbsolute(); - try (CuratorTransaction transaction = new CuratorTransaction(curator)) { - if (curator.framework().checkExists().forPath(newPath) == null) { - transaction.add(CuratorOperations.create(newPath, Utf8.toAsciiBytes(sessionId))); - } - transaction.add(CuratorOperations.delete(oldPath)); - transaction.commit(); - } catch (Exception e) { - log.log(LogLevel.WARNING, "Error rewriting application id from " + origNode + " to " + appId.serializedForm()); - } - } - @Override public List<ApplicationId> listApplications() { try { |