From 88cb461c877a0e540c2defe58a875f3806e06755 Mon Sep 17 00:00:00 2001 From: Yiqun Lin Date: Tue, 17 Apr 2018 11:23:22 +0800 Subject: [PATCH] HDFS-13435. RBF: Improve the error loggings for printing the stack trace. (cherry picked from commit c4d3636c21acaeb2b7d56d19cd4996aa25151bd1) --- .../hdfs/server/federation/metrics/FederationMetrics.java | 2 +- .../server/federation/resolver/order/LocalResolver.java | 3 +-- .../server/federation/router/RouterHeartbeatService.java | 4 ++-- .../hdfs/server/federation/router/RouterRpcClient.java | 4 ++-- .../hdfs/server/federation/router/RouterRpcServer.java | 6 +++--- .../hdfs/server/federation/store/StateStoreService.java | 2 +- .../store/driver/impl/StateStoreFileBaseImpl.java | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/FederationMetrics.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/FederationMetrics.java index f59429ec532..39e060f984f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/FederationMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/FederationMetrics.java @@ -444,7 +444,7 @@ public class FederationMetrics implements FederationMBean { dev = (float) Math.sqrt(dev / usages.length); } } catch (IOException e) { - LOG.info("Cannot get the live nodes: {}", e.getMessage()); + LOG.error("Cannot get the live nodes: {}", e.getMessage()); } final Map innerInfo = new HashMap<>(); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java index b6bd4b3b8ea..afc49c76f09 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java @@ -210,8 +210,7 @@ public class LocalResolver extends RouterResolver { } } } catch (IOException ioe) { - LOG.error("Cannot get Namenodes from the State Store: {}", - ioe.getMessage()); + LOG.error("Cannot get Namenodes from the State Store", ioe); } return ret; } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHeartbeatService.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHeartbeatService.java index fe172c24ee5..a7f02d33bdf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHeartbeatService.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHeartbeatService.java @@ -100,7 +100,7 @@ public class RouterHeartbeatService extends PeriodicService { LOG.debug("Router heartbeat for router {}", routerId); } } catch (IOException e) { - LOG.error("Cannot heartbeat router {}: {}", routerId, e.getMessage()); + LOG.error("Cannot heartbeat router {}", routerId, e); } } else { LOG.warn("Cannot heartbeat router {}: State Store unavailable", routerId); @@ -132,7 +132,7 @@ public class RouterHeartbeatService extends PeriodicService { } } } catch (Exception e) { - LOG.error("Cannot get version for {}: {}", clazz, e.getMessage()); + LOG.error("Cannot get version for {}", clazz, e); } return version; } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java index 5fbbeed70ca..214e4384170 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java @@ -1059,8 +1059,8 @@ public class RouterRpcClient { results.put(location, clazz.cast(result)); } catch (CancellationException ce) { T loc = orderedLocations.get(i); - String msg = - "Invocation to \"" + loc + "\" for \"" + method + "\" timed out"; + String msg = "Invocation to \"" + loc + "\" for \"" + + method.getMethodName() + "\" timed out"; LOG.error(msg); IOException ioe = new SubClusterTimeoutException(msg); exceptions.put(location, ioe); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java index 9d964d91444..d626699f505 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java @@ -2161,7 +2161,7 @@ public class RouterRpcServer extends AbstractService return entry.isAll(); } } catch (IOException e) { - LOG.error("Cannot get mount point: {}", e.getMessage()); + LOG.error("Cannot get mount point", e); } } return false; @@ -2182,7 +2182,7 @@ public class RouterRpcServer extends AbstractService return true; } } catch (IOException e) { - LOG.error("Cannot get mount point: {}", e.getMessage()); + LOG.error("Cannot get mount point", e); } } return false; @@ -2211,7 +2211,7 @@ public class RouterRpcServer extends AbstractService ret.put(child, entry.getDateModified()); } } catch (IOException e) { - LOG.error("Cannot get mount point: {}", e.getMessage()); + LOG.error("Cannot get mount point", e); } } return ret; diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java index ccbde095a7d..a0744a652bb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java @@ -183,7 +183,7 @@ public class StateStoreService extends CompositeService { } catch (NotCompliantMBeanException e) { throw new RuntimeException("Bad StateStoreMBean setup", e); } catch (MetricsException e) { - LOG.info("Failed to register State Store bean {}", e.getMessage()); + LOG.error("Failed to register State Store bean {}", e.getMessage()); } super.serviceInit(this.conf); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java index 6638d1c7c2a..15fc9c1ae9f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java @@ -361,7 +361,7 @@ public abstract class StateStoreFileBaseImpl try { writer.close(); } catch (IOException e) { - LOG.error("Cannot close the writer for {}", recordPathTemp); + LOG.error("Cannot close the writer for {}", recordPathTemp, e); } } }