summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2018-09-20 12:24:04 +0200
committergjoranv <gv@oath.com>2019-01-21 15:09:22 +0100
commit7b58424ddd4cdf0c2e963cd89bac83dcf8566381 (patch)
treea0d1c4b7f8fecbc9d999ce8417e78b40bdc6f7bd
parentb940326231702e8a07dc7e2d3fb5da440bf171cf (diff)
Track removal of fileHandler.rotateSchema from access-log.def
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java23
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java5
-rw-r--r--config-model/src/test/derived/importedfields/imported-fields.cfg10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java2
-rw-r--r--container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogHandler.java8
-rw-r--r--container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java23
-rw-r--r--container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java23
7 files changed, 12 insertions, 82 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
index d9cb43c1850..009aa454ab3 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/AccessLogComponent.java
@@ -8,8 +8,6 @@ import com.yahoo.container.logging.JSONAccessLog;
import com.yahoo.osgi.provider.model.ComponentModel;
import edu.umd.cs.findbugs.annotations.Nullable;
-import static com.yahoo.container.core.AccessLogConfig.FileHandler.RotateScheme;
-
/**
* @author Tony Vaagenes
* @author gjoranv
@@ -20,7 +18,6 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
private final String fileNamePattern;
private final String rotationInterval;
- private final RotateScheme.Enum rotationScheme;
private final Boolean compression;
private final boolean isHostedVespa;
private final String symlinkName;
@@ -29,7 +26,7 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
{
this(logType,
String.format("logs/vespa/qrs/%s.%s.%s", capitalize(logType.name()), clusterName, "%Y%m%d%H%M%S"),
- null, null, null, isHostedVespa,
+ null, null, isHostedVespa,
capitalize(logType.name()) + "." + clusterName);
}
@@ -40,7 +37,6 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
public AccessLogComponent(AccessLogType logType,
String fileNamePattern,
String rotationInterval,
- RotateScheme.Enum rotationScheme,
Boolean compressOnRotation,
boolean isHostedVespa,
String symlinkName)
@@ -48,7 +44,6 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
super(new ComponentModel(accessLogClass(logType), null, "container-core", null));
this.fileNamePattern = fileNamePattern;
this.rotationInterval = rotationInterval;
- this.rotationScheme = rotationScheme;
this.compression = compressOnRotation;
this.isHostedVespa = isHostedVespa;
this.symlinkName = symlinkName;
@@ -81,8 +76,6 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
builder.pattern(fileNamePattern);
if (rotationInterval != null)
builder.rotation(rotationInterval);
- if (rotationScheme != null)
- builder.rotateScheme(rotationScheme);
if (symlinkName != null)
builder.symlink(symlinkName);
if (compression != null) {
@@ -97,18 +90,4 @@ public final class AccessLogComponent extends SimpleComponent implements AccessL
public String getFileNamePattern() {
return fileNamePattern;
}
-
- public static final RotateScheme.Enum rotateScheme(@Nullable String name) {
- if (name == null)
- return null;
-
- switch (name) {
- case "date":
- return RotateScheme.Enum.DATE;
- case "sequence":
- return RotateScheme.Enum.SEQUENCE;
- default:
- throw new IllegalArgumentException("Invalid rotation scheme " + name);
- }
- }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
index ddea1a189bc..ee70032724e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/AccessLogBuilder.java
@@ -59,7 +59,6 @@ public class AccessLogBuilder {
accessLogType,
fileNamePattern(spec),
rotationInterval(spec),
- rotationScheme(spec),
compressOnRotation(spec),
isHostedVespa,
symlinkName(spec));
@@ -74,10 +73,6 @@ public class AccessLogBuilder {
return (compress.isEmpty() ? null : Boolean.parseBoolean(compress));
}
- private AccessLogConfig.FileHandler.RotateScheme.Enum rotationScheme(Element spec) {
- return AccessLogComponent.rotateScheme(nullIfEmpty(spec.getAttribute("rotationScheme")));
- }
-
private String rotationInterval(Element spec) {
return nullIfEmpty(spec.getAttribute("rotationInterval"));
}
diff --git a/config-model/src/test/derived/importedfields/imported-fields.cfg b/config-model/src/test/derived/importedfields/imported-fields.cfg
index d1895d02290..c8de7d4fb7e 100644
--- a/config-model/src/test/derived/importedfields/imported-fields.cfg
+++ b/config-model/src/test/derived/importedfields/imported-fields.cfg
@@ -1,25 +1,15 @@
attribute[].name "my_int_field"
attribute[].referencefield "a_ref"
attribute[].targetfield "int_field"
-attribute[].datatype NONE
-attribute[].collectiontype SINGLE
attribute[].name "my_string_field"
attribute[].referencefield "b_ref"
attribute[].targetfield "string_field"
-attribute[].datatype NONE
-attribute[].collectiontype SINGLE
attribute[].name "my_int_array_field"
attribute[].referencefield "a_ref"
attribute[].targetfield "int_array_field"
-attribute[].datatype NONE
-attribute[].collectiontype SINGLE
attribute[].name "my_int_wset_field"
attribute[].referencefield "a_ref"
attribute[].targetfield "int_wset_field"
-attribute[].datatype NONE
-attribute[].collectiontype SINGLE
attribute[].name "my_ancient_int_field"
attribute[].referencefield "a_ref"
attribute[].targetfield "ancient_int_field"
-attribute[].datatype NONE
-attribute[].collectiontype SINGLE
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
index a4a8eef74dd..817d9a943e0 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
@@ -85,7 +85,6 @@ public class AccessLogTest extends ContainerModelBuilderTestBase {
AccessLogConfig.FileHandler fileHandlerConfig = config.fileHandler();
assertEquals("pattern", fileHandlerConfig.pattern());
assertEquals("interval", fileHandlerConfig.rotation());
- assertEquals(AccessLogConfig.FileHandler.RotateScheme.DATE, fileHandlerConfig.rotateScheme());
}
{ // json
@@ -96,7 +95,6 @@ public class AccessLogTest extends ContainerModelBuilderTestBase {
AccessLogConfig.FileHandler fileHandlerConfig = config.fileHandler();
assertEquals("pattern", fileHandlerConfig.pattern());
assertEquals("interval", fileHandlerConfig.rotation());
- assertEquals(AccessLogConfig.FileHandler.RotateScheme.DATE, fileHandlerConfig.rotateScheme());
}
}
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogHandler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogHandler.java
index a31e7b3b849..488a6137cc2 100644
--- a/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogHandler.java
+++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLogHandler.java
@@ -3,8 +3,6 @@ package com.yahoo.container.logging;
import com.yahoo.container.core.AccessLogConfig;
-import static com.yahoo.container.core.AccessLogConfig.FileHandler.RotateScheme.DATE;
-
import java.util.logging.Logger;
/**
@@ -18,14 +16,12 @@ class AccessLogHandler {
public AccessLogHandler(AccessLogConfig.FileHandler config) {
access.setUseParentHandlers(false);
- logFileHandler = new LogFileHandler(config.rotateScheme(), config.compressOnRotation());
+ logFileHandler = new LogFileHandler(config.compressOnRotation());
logFileHandler.setFilePattern(config.pattern());
logFileHandler.setRotationTimes(config.rotation());
- if (config.rotateScheme() == DATE)
- createSymlink(config, logFileHandler);
-
+ createSymlink(config, logFileHandler);
LogFormatter lf = new LogFormatter();
lf.messageOnly(true);
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
index 1f56523bce6..135c3cd7af0 100644
--- a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
+++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java
@@ -38,8 +38,6 @@ import java.util.zip.GZIPOutputStream;
public class LogFileHandler extends StreamHandler {
private final static Logger logger = Logger.getLogger(LogFileHandler.class.getName());
- /** True to use the sequence file name scheme, false (default) to use the date scheme */
- private final boolean useSequenceNameScheme;
private final boolean compressOnRotation;
private long[] rotationTimes = {0}; //default to one log per day, at midnight
private String filePattern = "./log.%T"; // default to current directory, ms time stamp
@@ -101,18 +99,17 @@ public class LogFileHandler extends StreamHandler {
private final LogThread logThread;
LogFileHandler() {
- this(AccessLogConfig.FileHandler.RotateScheme.Enum.DATE, false);
+ this(false);
}
- LogFileHandler(boolean compressOnRotation) {
- this(AccessLogConfig.FileHandler.RotateScheme.Enum.DATE, compressOnRotation);
- }
-
- LogFileHandler(AccessLogConfig.FileHandler.RotateScheme.Enum rotateScheme, boolean compressOnRotation)
+ LogFileHandler(boolean compressOnRotation)
{
super();
- this.useSequenceNameScheme = (rotateScheme == AccessLogConfig.FileHandler.RotateScheme.Enum.SEQUENCE);
this.compressOnRotation = compressOnRotation;
+ init();
+ }
+
+ private void init() {
logThread = new LogThread(this);
logThread.start();
}
@@ -237,22 +234,18 @@ public class LogFileHandler extends StreamHandler {
super.flush();
super.close();
- if (useSequenceNameScheme)
- moveCurrentFile();
-
try {
checkAndCreateDir(fileName);
FileOutputStream os = new FileOutputStream(fileName, true); // append mode, for safety
super.setOutputStream(os);
currentOutputStream = os;
- if (! useSequenceNameScheme) LogFileDb.nowLoggingTo(fileName);
+ LogFileDb.nowLoggingTo(fileName);
}
catch (IOException e) {
throw new RuntimeException("Couldn't open log file '" + fileName + "'", e);
}
- if ( ! useSequenceNameScheme)
- createSymlinkToCurrentFile();
+ createSymlinkToCurrentFile();
numberOfRecords = 0;
lastRotationTime = now;
diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java
index a643ba77703..30442089f18 100644
--- a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java
+++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java
@@ -187,26 +187,6 @@ public class YApacheLogTestCase {
return entry;
}
- /**
- * author someone-else. Please rewrite this.
- */
- @Test
- public void testYApacheAccessLogWithSequenceNamingScheme() throws IOException, InterruptedException {
- // try without existing files
- assertCorrectSequenceBehavior(1);
-
- // try with existing files
- try {
- new File("yapachetest2").mkdir();
- new File("yapachetest2/access.1").createNewFile();
- new File("yapachetest2/access.2").createNewFile();
- assertCorrectSequenceBehavior(3);
- }
- finally {
- deleteDirectory("yapachetest2");
- }
- }
-
// Prefixes that don't collide with any in the specified log format.
private static final char FIELD_KEY_REQUEST_EXTRA = '@';
private static final char FIELD_KEY_RESPONSE_EXTRA = '#';
@@ -232,8 +212,7 @@ public class YApacheLogTestCase {
AccessLogConfig.Builder builder = new AccessLogConfig.Builder().
fileHandler(new AccessLogConfig.FileHandler.Builder().
pattern("yapachetest2/access").
- compressOnRotation(false).
- rotateScheme(AccessLogConfig.FileHandler.RotateScheme.Enum.SEQUENCE));
+ compressOnRotation(false));
AccessLogConfig config = new AccessLogConfig(builder);
YApacheAccessLog accessLog = new YApacheAccessLog(config);