summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-11-13 12:16:18 +0100
committerGitHub <noreply@github.com>2017-11-13 12:16:18 +0100
commite006cf7cb1dfa3dc7f5a3a21923ed41e77c6c30b (patch)
treea521f3d3229149646c0634608d4c8c0a28ecd4d8 /configserver
parent3bc5d531bc8ad1984cc550f81110cf772e10d6ae (diff)
parent0477084b81811a66992f5a33bec8fe6c02f195ea (diff)
Merge pull request #4098 from vespa-engine/balder/rewire-in-filecopy-on-deploy-the-new-way-rebased-1
Balder/rewire in filecopy on deploy the new way rebased 1
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java9
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java27
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java30
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java32
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java24
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java113
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java26
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java52
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java6
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenants.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java28
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java3
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java2
15 files changed, 290 insertions, 72 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java
new file mode 100644
index 00000000000..61c376a7256
--- /dev/null
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java
@@ -0,0 +1,9 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.config.server.filedistribution;
+
+import com.yahoo.config.FileReference;
+
+public interface AddFileInterface {
+ FileReference addFile(String relativePath);
+ FileReference addFile(String relativePath, FileReference reference);
+}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java
new file mode 100644
index 00000000000..79c541d7b1a
--- /dev/null
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java
@@ -0,0 +1,27 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.config.server.filedistribution;
+
+import com.yahoo.config.FileReference;
+import java.io.File;
+
+public class ApplicationFileManager implements AddFileInterface {
+ private final File applicationDir;
+ private final FileDirectory master;
+
+ ApplicationFileManager(File applicationDir, FileDirectory master) {
+ this.applicationDir = applicationDir;
+ this.master = master;
+ }
+
+ @Override
+ public FileReference addFile(String relativePath, FileReference reference) {
+ // TODO Wire in when verified in system test
+ // return master.addFile(new File(applicationDir, relativePath), reference);
+ return reference;
+ }
+
+ @Override
+ public FileReference addFile(String relativePath) {
+ return master.addFile(new File(applicationDir, relativePath));
+ }
+}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java
new file mode 100644
index 00000000000..588f2d1d63f
--- /dev/null
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java
@@ -0,0 +1,30 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.config.server.filedistribution;
+
+import com.yahoo.config.FileReference;
+import com.yahoo.config.model.api.FileDistribution;
+
+import java.util.Collection;
+import java.util.Set;
+
+public class CombinedLegacyDistribution implements FileDistribution {
+ private final FileDistribution legacy;
+
+ CombinedLegacyDistribution(FileDBHandler legacy) {
+ this.legacy = legacy;
+ }
+ @Override
+ public void sendDeployedFiles(String hostName, Set<FileReference> fileReferences) {
+ legacy.sendDeployedFiles(hostName, fileReferences);
+ }
+
+ @Override
+ public void reloadDeployFileDistributor() {
+ legacy.reloadDeployFileDistributor();
+ }
+
+ @Override
+ public void removeDeploymentsThatHaveDifferentApplicationId(Collection<String> targetHostnames) {
+ legacy.removeDeploymentsThatHaveDifferentApplicationId(targetHostnames);
+ }
+}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java
new file mode 100644
index 00000000000..8f2cb194bbd
--- /dev/null
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java
@@ -0,0 +1,32 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.config.server.filedistribution;
+
+import com.yahoo.config.FileReference;
+import com.yahoo.config.application.api.FileRegistry;
+
+import java.util.List;
+
+public class CombinedLegacyRegistry implements FileRegistry {
+ private final FileDBRegistry legacy;
+ private final FileDBRegistry future;
+
+ CombinedLegacyRegistry(FileDBRegistry legacy, FileDBRegistry future) {
+ this.legacy = legacy;
+ this.future = future;
+ }
+ @Override
+ public FileReference addFile(String relativePath) {
+ FileReference reference = legacy.addFile(relativePath);
+ return future.addFile(relativePath, reference);
+ }
+
+ @Override
+ public String fileSourceHost() {
+ return future.fileSourceHost();
+ }
+
+ @Override
+ public List<Entry> export() {
+ return future.export();
+ }
+}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
index d921d8d4f8d..1a76454fbed 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
@@ -4,29 +4,41 @@ package com.yahoo.vespa.config.server.filedistribution;
import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.net.HostName;
-import com.yahoo.vespa.filedistribution.FileDistributionManager;
-import com.yahoo.config.model.application.provider.FileReferenceCreator;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
/**
* @author tonytv
*/
public class FileDBRegistry implements FileRegistry {
- private final FileDistributionManager manager;
+ private final AddFileInterface manager;
private List<Entry> entries = new ArrayList<>();
private final Map<String, FileReference> fileReferenceCache = new HashMap<>();
- public FileDBRegistry(FileDistributionManager manager) {
+ public FileDBRegistry(AddFileInterface manager) {
this.manager = manager;
}
+ public synchronized FileReference addFile(String relativePath, FileReference reference) {
+ Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(relativePath));
+ return cachedReference.orElseGet(() -> {
+ FileReference newRef = manager.addFile(relativePath, reference);
+ entries.add(new Entry(relativePath, newRef));
+ fileReferenceCache.put(relativePath, newRef);
+ return newRef;
+ });
+ }
+
@Override
public synchronized FileReference addFile(String relativePath) {
Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(relativePath));
return cachedReference.orElseGet(() -> {
- FileReference newRef = FileReferenceCreator.create(manager.addFile(relativePath));
+ FileReference newRef = manager.addFile(relativePath);
entries.add(new Entry(relativePath, newRef));
fileReferenceCache.put(relativePath, newRef);
return newRef;
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java
new file mode 100644
index 00000000000..5a7bc4e7e82
--- /dev/null
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java
@@ -0,0 +1,113 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+package com.yahoo.vespa.config.server.filedistribution;
+
+import com.yahoo.config.FileReference;
+import com.yahoo.config.model.api.FileDistribution;
+import com.yahoo.io.IOUtils;
+import com.yahoo.text.Utf8;
+import net.jpountz.xxhash.XXHash64;
+import net.jpountz.xxhash.XXHashFactory;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.logging.Logger;
+
+public class FileDirectory {
+ private static final Logger log = Logger.getLogger(FileDirectory.class.getName());
+ private final File root;
+
+ public FileDirectory() {
+ this(FileDistribution.getDefaultFileDBPath());
+ }
+
+ public FileDirectory(File rootDir) {
+ root = rootDir;
+ try {
+ ensureRootExist();
+ } catch (IllegalArgumentException e) {
+ log.warning("Failed creating directory in constructor, will retry on demand : " + e.toString());
+ }
+ }
+
+ private void ensureRootExist() {
+ if (! root.exists()) {
+ if ( ! root.mkdir()) {
+ throw new IllegalArgumentException("Failed creating root dir '" + root.getAbsolutePath() + "'.");
+ }
+ } else if (!root.isDirectory()) {
+ throw new IllegalArgumentException("'" + root.getAbsolutePath() + "' is not a directory");
+ }
+ }
+
+ static private class Filter implements FilenameFilter {
+ @Override
+ public boolean accept(File dir, String name) {
+ return !".".equals(name) && !"..".equals(name) ;
+ }
+ }
+
+ String getPath(FileReference ref) {
+ return root.getAbsolutePath() + "/" + ref.value();
+ }
+
+ File getFile(FileReference reference) {
+ ensureRootExist();
+ File dir = new File(getPath(reference));
+ if (!dir.exists()) {
+ throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' does not exist.");
+ }
+ if (!dir.isDirectory()) {
+ throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' is not a directory.");
+ }
+ File [] files = dir.listFiles(new Filter());
+ if (files.length != 1) {
+ StringBuilder msg = new StringBuilder();
+ for (File f: files) {
+ msg.append(f.getName()).append("\n");
+ }
+ throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + " does not contain exactly one file, but [" + msg.toString() + "]");
+ }
+ return files[0];
+ }
+
+ private Long computeReference(File file) throws IOException {
+ byte [] wholeFile = IOUtils.readFileBytes(file);
+ XXHash64 hasher = XXHashFactory.fastestInstance().hash64();
+ return hasher.hash(ByteBuffer.wrap(wholeFile), hasher.hash(ByteBuffer.wrap(Utf8.toBytes(file.getName())), 0));
+ }
+
+ public FileReference addFile(File source) {
+ try {
+ Long hash = computeReference(source);
+ FileReference reference = new FileReference(Long.toHexString(hash));
+ return addFile(source, reference);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ public FileReference addFile(File source, FileReference reference) {
+ ensureRootExist();
+ try {
+ File destinationDir = new File(root, reference.value());
+ if (!destinationDir.exists()) {
+ destinationDir.mkdir();
+ File tempDestinationDir = File.createTempFile("writing", null, root);
+ tempDestinationDir.mkdir();
+ File destination = new File(tempDestinationDir, source.getName());
+ IOUtils.copy(source, destination);
+ if (!destinationDir.exists()) {
+ if ( ! tempDestinationDir.renameTo(destinationDir)) {
+ log.warning("Failed moving '" + tempDestinationDir.getAbsolutePath() + "' to '" + destination.getAbsolutePath() + "'.");
+ }
+ }
+ IOUtils.recursiveDeleteDir(tempDestinationDir);
+ }
+ return reference;
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java
index 36b0138ad36..59c3a54897d 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.filedistribution;
+import com.yahoo.config.FileReference;
import com.yahoo.config.model.api.FileDistribution;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.vespa.filedistribution.FileDistributionManager;
@@ -19,13 +20,32 @@ public class FileDistributionProvider {
private final FileRegistry fileRegistry;
private final FileDistribution fileDistribution;
- public FileDistributionProvider(File applicationDir, String zooKeepersSpec, String applicationId, Lock fileDistributionLock) {
+ static private class ManagerWrapper implements AddFileInterface {
+ private final FileDistributionManager manager;
+ ManagerWrapper(FileDistributionManager manager) {
+ this.manager = manager;
+ }
+ @Override
+ public FileReference addFile(String relativePath) {
+ return new FileReference(manager.addFile(relativePath));
+ }
+
+ @Override
+ public FileReference addFile(String relativePath, FileReference reference) {
+ throw new IllegalStateException("addFile with external reference is not possible with legacy filedistribution.");
+ }
+ }
+
+ public FileDistributionProvider(File applicationDir, String zooKeepersSpec,
+ String applicationId, Lock fileDistributionLock)
+ {
ensureDirExists(FileDistribution.getDefaultFileDBPath());
final FileDistributionManager manager = new FileDistributionManager(
FileDistribution.getDefaultFileDBPath(), applicationDir,
zooKeepersSpec, applicationId, fileDistributionLock);
- this.fileDistribution = new FileDBHandler(manager);
- this.fileRegistry = new FileDBRegistry(manager);
+ this.fileDistribution = new CombinedLegacyDistribution(new FileDBHandler(manager));
+ this.fileRegistry = new CombinedLegacyRegistry(new FileDBRegistry(new ManagerWrapper(manager)),
+ new FileDBRegistry(new ApplicationFileManager(applicationDir, new FileDirectory())));
}
public FileDistributionProvider(FileRegistry fileRegistry, FileDistribution fileDistribution) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
index 1c77ee66d0c..2ee74689ea9 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
@@ -1,3 +1,4 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.filedistribution;
import com.google.inject.Inject;
@@ -6,7 +7,6 @@ import com.yahoo.config.model.api.FileDistribution;
import com.yahoo.io.IOUtils;
import java.io.File;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -14,7 +14,7 @@ import java.util.logging.Logger;
public class FileServer {
private static final Logger log = Logger.getLogger(FileServer.class.getName());
- private final String rootDir;
+ private final FileDirectory root;
private final ExecutorService executor;
public static class ReplayStatus {
@@ -33,46 +33,17 @@ public class FileServer {
void receive(FileReference reference, String filename, byte [] content, ReplayStatus status);
}
- private String getPath(FileReference ref) {
- return rootDir + "/" + ref.value();
- }
-
- static private class Filter implements FilenameFilter {
- @Override
- public boolean accept(File dir, String name) {
- return !".".equals(name) && !"..".equals(name) ;
- }
- }
- private File getFile(FileReference reference) {
- File dir = new File(getPath(reference));
- if (!dir.exists()) {
- throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' does not exist.");
- }
- if (!dir.isDirectory()) {
- throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' is not a directory.");
- }
- File [] files = dir.listFiles(new Filter());
- if (files.length != 1) {
- StringBuilder msg = new StringBuilder();
- for (File f: files) {
- msg.append(f.getName()).append("\n");
- }
- throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + " does not contain exactly one file, but [" + msg.toString() + "]");
- }
- return files[0];
- }
-
@Inject
public FileServer() {
- this(FileDistribution.getDefaultFileDBRoot());
+ this(FileDistribution.getDefaultFileDBPath());
}
- public FileServer(String rootDir) {
+ public FileServer(File rootDir) {
this(rootDir, Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
}
- public FileServer(String rootDir, ExecutorService executor) {
- this.rootDir = rootDir;
+ public FileServer(File rootDir, ExecutorService executor) {
+ this.root = new FileDirectory(rootDir);
this.executor = executor;
}
public boolean hasFile(String fileName) {
@@ -80,7 +51,7 @@ public class FileServer {
}
public boolean hasFile(FileReference reference) {
try {
- return getFile(reference).exists();
+ return root.getFile(reference).exists();
} catch (IllegalArgumentException e) {
log.warning("Failed locating file reference '" + reference + "' with error " + e.toString());
}
@@ -88,7 +59,7 @@ public class FileServer {
}
public boolean startFileServing(String fileName, Receiver target) {
FileReference reference = new FileReference(fileName);
- File file = getFile(reference);
+ File file = root.getFile(reference);
if (file.exists()) {
executor.execute(() -> serveFile(reference, target));
@@ -97,8 +68,9 @@ public class FileServer {
}
private void serveFile(FileReference reference, Receiver target) {
-
- File file = getFile(reference);
+ File file = root.getFile(reference);
+ // TODO remove once verified in system tests.
+ log.info("Start serving reference '" + reference.toString() + "' with file '" + file.getAbsolutePath() + "'");
byte [] blob = new byte [0];
boolean success = false;
String errorDescription = "OK";
@@ -111,5 +83,7 @@ public class FileServer {
}
target.receive(reference, file.getName(), blob,
new ReplayStatus(success ? 0 : 1, success ? "OK" : errorDescription));
+ // TODO remove once verified in system tests.
+ log.info("Done serving reference '" + reference.toString() + "' with file '" + file.getAbsolutePath() + "'");
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
index 662da63d198..617a054d0c7 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
@@ -450,6 +450,10 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
fileBlob.parameters().add(new Int32Value(status.getCode()));
fileBlob.parameters().add(new StringValue(status.getDescription()));
target.invokeSync(fileBlob, 600);
+ if (fileBlob.isError()) {
+ log.warning("Failed delivering reference '" + reference + "' with file '" + filename + "' to " +
+ target.toString() + " with error : '" + fileBlob.errorMessage() + "'.");
+ }
}
}
@@ -458,6 +462,8 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
String fileReference = request.parameters().get(0).asString();
FileApiErrorCodes result;
try {
+ // TODO remove once verified in system tests.
+ log.info("Received request for reference '" + fileReference + "'");
result = fileServer.hasFile(fileReference)
? FileApiErrorCodes.OK
: FileApiErrorCodes.NOT_FOUND;
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenants.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenants.java
index c67ad0675b2..528a30e0191 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenants.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenants.java
@@ -159,7 +159,7 @@ public class Tenants implements ConnectionStateListener, PathChildrenCacheListen
Map<TenantName, Tenant> current = new LinkedHashMap<>(tenants);
for (Map.Entry<TenantName, Tenant> entry : current.entrySet()) {
TenantName tenant = entry.getKey();
- if (!newTenants.contains(tenant)) {
+ if (!newTenants.contains(tenant) && !DEFAULT_TENANT.equals(tenant)) {
notifyRemovedTenant(tenant);
entry.getValue().close();
tenants.remove(tenant);
@@ -257,7 +257,7 @@ public class Tenants implements ConnectionStateListener, PathChildrenCacheListen
* @return this Tenants instance
*/
public synchronized Tenants deleteTenant(TenantName name) {
- if (name.equals(TenantName.defaultName()))
+ if (name.equals(DEFAULT_TENANT))
throw new IllegalArgumentException("Deleting 'default' tenant is not allowed");
Tenant tenant = tenants.get(name);
tenant.delete();
@@ -275,7 +275,7 @@ public class Tenants implements ConnectionStateListener, PathChildrenCacheListen
* @return the log string
*/
public static String logPre(ApplicationId app) {
- if (TenantName.defaultName().equals(app.tenant())) return "";
+ if (DEFAULT_TENANT.equals(app.tenant())) return "";
StringBuilder ret = new StringBuilder()
.append(logPre(app.tenant()))
.append("app:"+app.application().value())
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
index acda60049ab..dec9dd991de 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
@@ -63,7 +63,7 @@ public class InjectedGlobalComponentRegistryTest {
serverDB = new ConfigServerDB(configserverConfig);
sessionPreparer = new SessionTest.MockSessionPreparer();
rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(),
- new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBRoot()));
+ new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath()));
generationCounter = new SuperModelGenerationCounter(curator);
defRepo = new StaticConfigDefinitionRepo();
permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig);
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java
index dea468eb0be..d9a0db7e811 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/DeployTester.java
@@ -69,26 +69,19 @@ public class DeployTester {
}
public DeployTester(String appPath, List<ModelFactory> modelFactories) {
- this(appPath, modelFactories, new ConfigserverConfig(new ConfigserverConfig.Builder()
- .configServerDBDir(Files.createTempDir()
- .getAbsolutePath())
- .configDefinitionsDir(Files.createTempDir()
- .getAbsolutePath())),
+ this(appPath, modelFactories,
+ new ConfigserverConfig(new ConfigserverConfig.Builder()
+ .configServerDBDir(Files.createTempDir().getAbsolutePath())
+ .configDefinitionsDir(Files.createTempDir().getAbsolutePath())),
Clock.systemUTC());
}
public DeployTester(String appPath, ConfigserverConfig configserverConfig) {
- this(appPath,
- Collections.singletonList(createModelFactory(Clock.systemUTC())),
- configserverConfig,
- Clock.systemUTC());
+ this(appPath, Collections.singletonList(createModelFactory(Clock.systemUTC())), configserverConfig, Clock.systemUTC());
}
public DeployTester(String appPath, ConfigserverConfig configserverConfig, Clock clock) {
- this(appPath,
- Collections.singletonList(createModelFactory(clock)),
- configserverConfig,
- clock);
+ this(appPath, Collections.singletonList(createModelFactory(clock)), configserverConfig, clock);
}
public DeployTester(String appPath, List<ModelFactory> modelFactories, ConfigserverConfig configserverConfig) {
@@ -106,12 +99,12 @@ public class DeployTester {
catch (Exception e) {
throw new IllegalArgumentException(e);
}
- applicationRepository = new ApplicationRepository(tenants,
- createHostProvisioner(),
- clock);
+ applicationRepository = new ApplicationRepository(tenants, createHostProvisioner(), clock);
}
- public Tenant tenant() { return tenants.defaultTenant(); }
+ public Tenant tenant() {
+ return tenants.defaultTenant();
+ }
/** Create a model factory for the version of this source*/
public static ModelFactory createModelFactory(Clock clock) {
@@ -137,6 +130,7 @@ public class DeployTester {
* Do the initial "deploy" with the existing API-less code as the deploy API doesn't support first deploys yet.
*/
public ApplicationId deployApp(String appName, String vespaVersion, Instant now) {
+
Tenant tenant = tenant();
LocalSession session = tenant.getSessionFactory().createSession(testApp, appName, new TimeoutBudget(clock, Duration.ofSeconds(60)));
ApplicationId id = ApplicationId.from(tenant.getName(), ApplicationName.from(appName), InstanceName.defaultName());
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
index 0c2ace38389..4913798e5ad 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
@@ -1,3 +1,4 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.filedistribution;
import com.yahoo.config.FileReference;
@@ -17,7 +18,7 @@ import static org.junit.Assert.assertFalse;
public class FileServerTest {
- FileServer fs = new FileServer(".");
+ FileServer fs = new FileServer(new File("."));
List<File> created = new LinkedList<>();
private void createCleanDir(String name) throws IOException{
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java
index b094a741f34..4c2a4b56751 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java
@@ -39,7 +39,7 @@ public class MockRpc extends RpcServer {
public MockRpc(int port, boolean createDefaultTenant, boolean pretendToHaveLoadedAnyApplication) {
super(createConfig(port), null, Metrics.createTestMetrics(),
- new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBRoot()));
+ new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath()));
if (createDefaultTenant) {
onTenantCreate(TenantName.from("default"), new MockTenantProvider(pretendToHaveLoadedAnyApplication));
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java
index 933cb770dd1..12dc584f055 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java
@@ -90,7 +90,7 @@ public class TestWithRpc {
emptyNodeFlavors(),
generationCounter)),
Metrics.createTestMetrics(), new HostRegistries(),
- hostLivenessTracker, new FileServer(FileDistribution.getDefaultFileDBRoot()));
+ hostLivenessTracker, new FileServer(FileDistribution.getDefaultFileDBPath()));
rpcServer.onTenantCreate(TenantName.from("default"), tenantProvider);
t = new Thread(rpcServer);
t.start();