summaryrefslogtreecommitdiffstats
path: root/node-maintainer
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@oath.com>2017-09-27 11:06:53 +0200
committerValerij Fredriksen <valerijf@oath.com>2017-09-27 11:06:53 +0200
commit2bcd994e4d827db17b5b7f68253419b4263fb845 (patch)
treef5e8bb29b1094e8e09ce154a6a1b3f6c46d1296a /node-maintainer
parent7316cc20b9ebe4fb491c80f6ab1359acba3b0a1c (diff)
Rename methods, no functional changes
Diffstat (limited to 'node-maintainer')
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java16
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java14
2 files changed, 15 insertions, 15 deletions
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java
index 53b3b8c7e77..99dfdb48334 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java
@@ -58,7 +58,7 @@ class CoredumpHandler {
public void processAll() throws IOException {
removeJavaCoredumps();
- processAndReportCoredumps();
+ handleNewCoredumps();
removeOldCoredumps();
}
@@ -72,9 +72,9 @@ class CoredumpHandler {
FileHelper.deleteDirectories(doneCoredumpsPath, Duration.ofDays(10), Optional.empty());
}
- private void processAndReportCoredumps() throws IOException {
- Path processingCoredumps = processCoredumps();
- reportCoredumps(processingCoredumps);
+ private void handleNewCoredumps() throws IOException {
+ Path processingCoredumps = enqueueCoredumps();
+ processAndReportCoredumps(processingCoredumps);
}
@@ -82,7 +82,7 @@ class CoredumpHandler {
* Moves a coredump to a new directory under the processing/ directory. Limit to only processing
* one coredump at the time, starting with the oldest.
*/
- Path processCoredumps() throws IOException {
+ Path enqueueCoredumps() throws IOException {
Path processingCoredumpsPath = coredumpsPath.resolve(PROCESSING_DIRECTORY_NAME);
processingCoredumpsPath.toFile().mkdirs();
if (Files.list(processingCoredumpsPath).count() > 0) return processingCoredumpsPath;
@@ -92,7 +92,7 @@ class CoredumpHandler {
.min((Comparator.comparingLong(o -> o.toFile().lastModified())))
.ifPresent(coredumpPath -> {
try {
- startProcessing(coredumpPath, processingCoredumpsPath);
+ enqueueCoredumpForProcessing(coredumpPath, processingCoredumpsPath);
} catch (Throwable e) {
logger.log(Level.WARNING, "Failed to process coredump " + coredumpPath, e);
}
@@ -101,7 +101,7 @@ class CoredumpHandler {
return processingCoredumpsPath;
}
- void reportCoredumps(Path processingCoredumpsPath) throws IOException {
+ void processAndReportCoredumps(Path processingCoredumpsPath) throws IOException {
doneCoredumpsPath.toFile().mkdirs();
Files.list(processingCoredumpsPath)
@@ -117,7 +117,7 @@ class CoredumpHandler {
});
}
- Path startProcessing(Path coredumpPath, Path processingCoredumpsPath) throws IOException {
+ Path enqueueCoredumpForProcessing(Path coredumpPath, Path processingCoredumpsPath) throws IOException {
// Make coredump readable
coredumpPath.toFile().setReadable(true, false);
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
index f1a28ac84bb..2cc96567e20 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
@@ -87,7 +87,7 @@ public class CoredumpHandlerTest {
@Test
public void ignoresIncompleteCoredumps() throws IOException {
Path coredumpPath = createCoredump(".core.dump", Instant.now());
- Path processingPath = coredumpHandler.processCoredumps();
+ Path processingPath = coredumpHandler.enqueueCoredumps();
// The 'processing' directory should be empty
assertFolderContents(processingPath);
@@ -100,7 +100,7 @@ public class CoredumpHandlerTest {
public void startProcessingTest() throws IOException {
Path coredumpPath = createCoredump("core.dump", Instant.now());
Path processingPath = crashPath.resolve("processing_dir");
- coredumpHandler.startProcessing(coredumpPath, processingPath);
+ coredumpHandler.enqueueCoredumpForProcessing(coredumpPath, processingPath);
// Contents of 'crash' should be only the 'processing' directory
assertFolderContents(crashPath, processingPath.getFileName().toString());
@@ -120,7 +120,7 @@ public class CoredumpHandlerTest {
createCoredump(oldestCoredump, startTime.minusSeconds(3600));
createCoredump("core.dump1", startTime.minusSeconds(1000));
createCoredump("core.dump2", startTime);
- Path processingPath = coredumpHandler.processCoredumps();
+ Path processingPath = coredumpHandler.enqueueCoredumps();
List<Path> processingCoredumps = Files.list(processingPath).collect(Collectors.toList());
assertEquals(1, processingCoredumps.size());
@@ -131,8 +131,8 @@ public class CoredumpHandlerTest {
.collect(Collectors.toSet());
assertEquals(Collections.singleton(oldestCoredump), filenamesInProcessingDirectory);
- // Running processCoredumps should not start processing any new coredumps as we already are processing one
- coredumpHandler.processCoredumps();
+ // Running enqueueCoredumps should not start processing any new coredumps as we already are processing one
+ coredumpHandler.enqueueCoredumps();
assertEquals(processingCoredumps, Files.list(processingPath).collect(Collectors.toList()));
filenamesInProcessingDirectory = Files.list(processingCoredumps.get(0))
.map(file -> file.getFileName().toString())
@@ -143,7 +143,7 @@ public class CoredumpHandlerTest {
@Test
public void coredumpMetadataCollectAndWriteTest() throws IOException, InterruptedException {
createCoredump("core.dump", Instant.now());
- Path processingPath = coredumpHandler.processCoredumps();
+ Path processingPath = coredumpHandler.enqueueCoredumps();
Path processingCoredumpPath = Files.list(processingPath).findFirst().orElseThrow(() ->
new RuntimeException("Expected to find directory with coredump in processing dir"));
when(coreCollector.collect(eq(processingCoredumpPath.resolve("core.dump")), any())).thenReturn(metadata);
@@ -182,7 +182,7 @@ public class CoredumpHandlerTest {
Path metadataPath = createProcessedCoredump(documentId);
setNextHttpResponse(500, Optional.of("Internal server error"));
- coredumpHandler.reportCoredumps(crashPath.resolve(CoredumpHandler.PROCESSING_DIRECTORY_NAME));
+ coredumpHandler.processAndReportCoredumps(crashPath.resolve(CoredumpHandler.PROCESSING_DIRECTORY_NAME));
validateNextHttpPost(documentId, expectedMetadataFileContents);
// The coredump should not have been moved out of 'processing' and into 'done' as the report failed