Skip to content

Commit

Permalink
Log node host name resolution exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Apr 26, 2019
1 parent 05a812b commit f6a3651
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@

import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.ListenableFuture;
import io.airlift.log.Logger;
import io.airlift.stats.CounterStat;
import io.prestosql.connector.CatalogName;
import io.prestosql.execution.NodeTaskMap;
Expand Down Expand Up @@ -58,6 +61,12 @@

public class NodeScheduler
{
private static final Logger LOG = Logger.get(NodeScheduler.class);

private final Cache<InternalNode, Boolean> inaccessibleNodeLogCache = CacheBuilder.newBuilder()
.expireAfterWrite(30, TimeUnit.SECONDS)
.build();

private final NetworkLocationCache networkLocationCache;
private final List<CounterStat> topologicalSplitCounters;
private final List<String> networkLocationSegmentNames;
Expand Down Expand Up @@ -155,7 +164,10 @@ public NodeSelector createNodeSelector(CatalogName catalogName)
byHost.put(host, node);
}
catch (UnknownHostException e) {
// ignore
if (inaccessibleNodeLogCache.getIfPresent(node) == null) {
inaccessibleNodeLogCache.put(node, true);
LOG.warn(e, "Unable to resolve host name for node: %s", node);
}
}
}

Expand Down

0 comments on commit f6a3651

Please sign in to comment.