From 1d776f22f98977175e44626589ae5d2cca165c6b 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 a99a26a309d..970bd4fdfee 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 @@ -456,7 +456,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 6c657b2d6b0..513e867f069 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 @@ -1067,8 +1067,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 0dc2a69762a..f4c010c0f4f 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 @@ -2293,7 +2293,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; @@ -2314,7 +2314,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; @@ -2343,7 +2343,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); } } }