You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/03/19 16:41:11 UTC

svn commit: r1458344 - in /accumulo/branches/1.5: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/ core/src/main/java/org/apache/accumulo/core/util/shell/commands/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/ma...

Author: ecn
Date: Tue Mar 19 15:41:10 2013
New Revision: 1458344

URL: http://svn.apache.org/r1458344
Log:
ACCUMULO-804 defend against FileNotFoundExceptions for hadoop-2.0

Modified:
    accumulo/branches/1.5/   (props changed)
    accumulo/branches/1.5/assemble/   (props changed)
    accumulo/branches/1.5/core/   (props changed)
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ImportDirectoryCommand.java
    accumulo/branches/1.5/examples/   (props changed)
    accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java   (props changed)
    accumulo/branches/1.5/server/   (props changed)
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
    accumulo/branches/1.5/src/   (props changed)

Propchange: accumulo/branches/1.5/
------------------------------------------------------------------------------
  Merged /accumulo/trunk:r1457910

Propchange: accumulo/branches/1.5/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/assemble:r1457910

Propchange: accumulo/branches/1.5/core/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/core:r1457910

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Tue Mar 19 15:41:10 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.client;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Collections;
@@ -291,7 +292,12 @@ public class ZooKeeperInstance implement
   public static String getInstanceIDFromHdfs(Path instanceDirectory) {
     try {
       FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), AccumuloConfiguration.getSiteConfiguration());
-      FileStatus[] files = fs.listStatus(instanceDirectory);
+      FileStatus[] files = null;
+      try {
+        files = fs.listStatus(instanceDirectory);
+      } catch (FileNotFoundException ex) {
+        // ignored
+      }
       log.debug("Trying to read instance id from " + instanceDirectory);
       if (files == null || files.length == 0) {
         log.error("unable obtain instance id at " + instanceDirectory);

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ImportDirectoryCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ImportDirectoryCommand.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ImportDirectoryCommand.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ImportDirectoryCommand.java Tue Mar 19 15:41:10 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.util.shell.commands;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 
 import org.apache.accumulo.core.client.AccumuloException;
@@ -46,7 +47,12 @@ public class ImportDirectoryCommand exte
     final boolean setTime = Boolean.parseBoolean(cl.getArgs()[2]);
     
     final FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
-    final FileStatus failStatus = fs.getFileStatus(new Path(failureDir));
+    FileStatus failStatus = null;
+    try {
+      failStatus = fs.getFileStatus(new Path(failureDir));
+    } catch (FileNotFoundException ex) {
+      // ignored
+    }
     if (failStatus == null || !failStatus.isDir() || fs.listStatus(new Path(failureDir)).length != 0) {
       throw new AccumuloException(failureDir + " is not an empty directory");
     }

Propchange: accumulo/branches/1.5/examples/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/examples:r1457910

Propchange: accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1457910

Propchange: accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1457910

Propchange: accumulo/branches/1.5/server/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/server:r1457910

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java Tue Mar 19 15:41:10 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.gc;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
@@ -142,6 +143,8 @@ public class GarbageCollectWriteAheadLog
             Path path = new Path(Constants.getWalDirectory(conf), filename);
             if (trash == null || !trash.moveToTrash(path))
               fs.delete(path, true);
+          } catch (FileNotFoundException ex) {
+            // ignored
           } catch (IOException ex) {
             log.error("Unable to delete wal " + filename + ": " + ex);
           }
@@ -156,6 +159,8 @@ public class GarbageCollectWriteAheadLog
               Path path = new Path(serverPath, filename);
               if (trash == null || !trash.moveToTrash(path))
                 fs.delete(path, true);
+            } catch (FileNotFoundException ex) {
+              // ignored
             } catch (IOException ex) {
               log.error("Unable to delete wal " + filename + ": " + ex);
             }
@@ -187,6 +192,8 @@ public class GarbageCollectWriteAheadLog
         if (trash == null || !trash.moveToTrash(swalog)) {
           fs.delete(swalog, true);
         }
+      } catch (FileNotFoundException ex) {
+        // ignored
       } catch (IOException ioe) {
         log.error("Unable to delete sorted walog " + sortedWALogs + ": " + ioe);
       }

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java Tue Mar 19 15:41:10 2013
@@ -351,9 +351,15 @@ public class SimpleGarbageCollector impl
     // tableIdsWithDeletes should now contain the set of deleted tables that had dirs deleted
     
     for (String delTableId : tableIdsWithDeletes) {
-      // if dir exist and is empty, then empty list is returned... if dir does not exist
-      // then null is returned
-      FileStatus[] tabletDirs = fs.listStatus(new Path(ServerConstants.getTablesDir() + "/" + delTableId));
+      // if dir exist and is empty, then empty list is returned...
+      // hadoop 1.0 will return null if the file doesn't exist
+      // hadoop 2.0 will throw an exception if the file does not exist
+      FileStatus[] tabletDirs = null;
+      try {
+        tabletDirs = fs.listStatus(new Path(ServerConstants.getTablesDir() + "/" + delTableId));
+      } catch (FileNotFoundException ex) {
+        // ignored 
+      }
       
       if (tabletDirs == null)
         continue;

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java Tue Mar 19 15:41:10 2013
@@ -149,7 +149,12 @@ public class BulkImport extends MasterRe
     FileSystem fs = master.getFileSystem();
 
     Path errorPath = new Path(errorDir);
-    FileStatus errorStatus = fs.getFileStatus(errorPath);
+    FileStatus errorStatus = null;
+    try {
+      errorStatus = fs.getFileStatus(errorPath);
+    } catch (FileNotFoundException ex) {
+      // ignored
+    }
     if (errorStatus == null)
       throw new ThriftTableOperationException(tableId, null, TableOperation.BULK_IMPORT, TableOperationExceptionType.BULK_BAD_ERROR_DIRECTORY, errorDir
           + " does not exist");

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1458344&r1=1458343&r2=1458344&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java Tue Mar 19 15:41:10 2013
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.table
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -488,7 +489,12 @@ public class Tablet {
   
   private void checkTabletDir(Path tabletDir) throws IOException {
     
-    FileStatus[] files = fs.listStatus(tabletDir);
+    FileStatus[] files = null;
+    try {
+      files = fs.listStatus(tabletDir);
+    } catch (FileNotFoundException ex) {
+      // ignored
+    }
     
     if (files == null) {
       if (tabletDir.getName().startsWith("c-"))

Propchange: accumulo/branches/1.5/src/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/src:r1457910