hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brando...@apache.org
Subject svn commit: r1525771 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project: hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java hadoop-hdfs/CHANGES.txt
Date Tue, 24 Sep 2013 04:19:22 GMT
Author: brandonli
Date: Tue Sep 24 04:19:22 2013
New Revision: 1525771

URL: http://svn.apache.org/r1525771
Log:
HDFS-5249. Merging change r1525770 from trunk

Modified:
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java?rev=1525771&r1=1525770&r2=1525771&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java
Tue Sep 24 04:19:22 2013
@@ -201,9 +201,9 @@ class OpenFileCtx {
         try {
           synchronized (this) {
             // check if alive again
-          Preconditions.checkState(dumpFile.createNewFile(),
-              "The dump file should not exist: %s", dumpFilePath);
-          dumpOut = new FileOutputStream(dumpFile);
+            Preconditions.checkState(dumpFile.createNewFile(),
+                "The dump file should not exist: %s", dumpFilePath);
+            dumpOut = new FileOutputStream(dumpFile);
           }
         } catch (IOException e) {
           LOG.error("Got failure when creating dump stream " + dumpFilePath, e);
@@ -241,6 +241,10 @@ class OpenFileCtx {
           && nonSequentialWriteInMemory.get() > 0) {
         OffsetRange key = it.next();
         WriteCtx writeCtx = pendingWrites.get(key);
+        if (writeCtx == null) {
+          // This write was just deleted
+          continue;
+        }
         try {
           long dumpedDataSize = writeCtx.dumpData(dumpOut, raf);
           if (dumpedDataSize > 0) {
@@ -264,16 +268,30 @@ class OpenFileCtx {
     @Override
     public void run() {
       while (activeState && enabledDump) {
-        if (nonSequentialWriteInMemory.get() >= DUMP_WRITE_WATER_MARK) {
-          dump();
-        }
-        synchronized (OpenFileCtx.this) {
-          if (nonSequentialWriteInMemory.get() < DUMP_WRITE_WATER_MARK) {
-            try {
-              OpenFileCtx.this.wait();
-            } catch (InterruptedException e) {
+        try {
+          if (nonSequentialWriteInMemory.get() >= DUMP_WRITE_WATER_MARK) {
+            dump();
+          }
+          synchronized (OpenFileCtx.this) {
+            if (nonSequentialWriteInMemory.get() < DUMP_WRITE_WATER_MARK) {
+              try {
+                OpenFileCtx.this.wait();
+                if (LOG.isDebugEnabled()) {
+                  LOG.debug("Dumper woke up");
+                }
+              } catch (InterruptedException e) {
+                LOG.info("Dumper is interrupted, dumpFilePath= "
+                    + OpenFileCtx.this.dumpFilePath);
+              }
             }
           }
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Dumper checking OpenFileCtx activeState: " + activeState
+                + " enabledDump: " + enabledDump);
+          }
+        } catch (Throwable t) {
+          LOG.info("Dumper get Throwable: " + t + ". dumpFilePath: "
+              + OpenFileCtx.this.dumpFilePath);
         }
       }
     }

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1525771&r1=1525770&r2=1525771&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue Sep 24
04:19:22 2013
@@ -256,6 +256,8 @@ Release 2.1.1-beta - 2013-09-23
     HDFS-5231. Fix broken links in the document of HDFS Federation. (Haohui Mai
     via jing9)
 
+    HDFS-5249. Fix dumper thread which may die silently. (brandonli)
+
 Release 2.1.0-beta - 2013-08-22
 
   INCOMPATIBLE CHANGES



Mime
View raw message