Skip to content

Commit

Permalink
Log Presto version during server start
Browse files Browse the repository at this point in the history
By defaulting `ServerConfig.prestoVersion` to introspected Presto
version, Presto version gets logged along with all other configuration
properties.
findepi committed Jun 27, 2018
1 parent 761e913 commit a920752
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -16,12 +16,14 @@
import io.airlift.configuration.Config;
import io.airlift.units.Duration;

import javax.validation.constraints.NotNull;

import static java.util.concurrent.TimeUnit.MINUTES;

public class ServerConfig
{
private boolean coordinator = true;
private String prestoVersion;
private String prestoVersion = getClass().getPackage().getImplementationVersion();
private String dataSources;
private boolean includeExceptionInResponse = true;
private Duration gracePeriod = new Duration(2, MINUTES);
@@ -39,6 +41,7 @@ public ServerConfig setCoordinator(boolean coordinator)
return this;
}

@NotNull(message = "presto.version must be provided when it cannot be automatically determined")
public String getPrestoVersion()
{
return prestoVersion;
Original file line number Diff line number Diff line change
@@ -186,7 +186,6 @@

import static com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.FLAT;
import static com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.LEGACY;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.nullToEmpty;
import static com.google.common.reflect.Reflection.newProxy;
import static com.google.inject.multibindings.Multibinder.newSetBinder;
@@ -451,13 +450,7 @@ protected void setup(Binder binder)
binder.bind(QueryMonitor.class).in(Scopes.SINGLETON);

// Determine the NodeVersion
String prestoVersion = serverConfig.getPrestoVersion();
if (prestoVersion == null) {
prestoVersion = getClass().getPackage().getImplementationVersion();
}
checkState(prestoVersion != null, "presto.version must be provided when it cannot be automatically determined");

NodeVersion nodeVersion = new NodeVersion(prestoVersion);
NodeVersion nodeVersion = new NodeVersion(serverConfig.getPrestoVersion());
binder.bind(NodeVersion.class).toInstance(nodeVersion);

// presto announcement

0 comments on commit a920752

Please sign in to comment.