From bf4d10ac30a3440be7defb87e23e3fe9909c5b40 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Thu, 19 Jan 2012 16:34:44 +0000 Subject: [PATCH] HDFS-2803. Add logging to LeaseRenewer for better lease expiration debugging. Contributed by Jimmy Xiang. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1233452 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/LeaseRenewer.java | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index fd2ed0b06a6..2a67ebeba21 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -89,6 +89,9 @@ Release 0.23.1 - UNRELEASED not use ArrayWritable for writing non-array items. (Uma Maheswara Rao G via szetszwo) + HDFS-2803. Add logging to LeaseRenewer for better lease expiration debugging. + (Jimmy Xiang via todd) + OPTIMIZATIONS HDFS-2130. Switch default checksum to CRC32C. (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java index 35d45bac322..14b9c9a3b72 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java @@ -292,6 +292,10 @@ class LeaseRenewer { @Override public void run() { try { + if (LOG.isDebugEnabled()) { + LOG.debug("Lease renewer daemon for " + clientsString() + + " with renew id " + id + " started"); + } LeaseRenewer.this.run(id); } catch(InterruptedException e) { if (LOG.isDebugEnabled()) { @@ -302,6 +306,10 @@ class LeaseRenewer { synchronized(LeaseRenewer.this) { Factory.INSTANCE.remove(LeaseRenewer.this); } + if (LOG.isDebugEnabled()) { + LOG.debug("Lease renewer daemon for " + clientsString() + + " with renew id " + id + " exited"); + } } } @@ -401,6 +409,9 @@ class LeaseRenewer { if (!c.getClientName().equals(previousName)) { c.renewLease(); previousName = c.getClientName(); + if (LOG.isDebugEnabled()) { + LOG.debug("Lease renewed for client " + previousName); + } } } } @@ -416,6 +427,10 @@ class LeaseRenewer { if (System.currentTimeMillis() - lastRenewed >= getRenewalTime()) { try { renew(); + if (LOG.isDebugEnabled()) { + LOG.debug("Lease renewer daemon for " + clientsString() + + " with renew id " + id + " executed"); + } lastRenewed = System.currentTimeMillis(); } catch (SocketTimeoutException ie) { LOG.warn("Failed to renew lease for " + clientsString() + " for " @@ -435,6 +450,15 @@ class LeaseRenewer { synchronized(this) { if (id != currentId || isRenewerExpired()) { + if (LOG.isDebugEnabled()) { + if (id != currentId) { + LOG.debug("Lease renewer daemon for " + clientsString() + + " with renew id " + id + " is not current"); + } else { + LOG.debug("Lease renewer daemon for " + clientsString() + + " with renew id " + id + " expired"); + } + } //no longer the current daemon or expired return; }