accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/4] git commit: ACCUMULO-1947 Use DfsConfigKeys.DFS_DATANODE_SYNCONCLOSE_KEY instead of the CreateFlag class as a better way to check whether or not to we warn if the configuration doesn't contain dfs.datanode.synconclose=true
Date Mon, 02 Dec 2013 22:54:26 GMT
ACCUMULO-1947 Use DfsConfigKeys.DFS_DATANODE_SYNCONCLOSE_KEY instead of the CreateFlag class
as a better way to check
whether or not to we warn if the configuration doesn't contain dfs.datanode.synconclose=true


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cd96f85e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cd96f85e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cd96f85e

Branch: refs/heads/master
Commit: cd96f85e0ec24be01d38c3a3dc78380f3b945d0b
Parents: c7fc776
Author: Josh Elser <elserj@apache.org>
Authored: Mon Dec 2 17:13:44 2013 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Dec 2 17:13:44 2013 -0500

----------------------------------------------------------------------
 .../accumulo/server/tabletserver/TabletServer.java  | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/cd96f85e/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
index b4d4780..aa52834 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
@@ -3285,14 +3285,20 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
       }
       
       try {
-        // if this class exists
-        Class.forName("org.apache.hadoop.fs.CreateFlag");
-        // we're running hadoop 2.0, 1.1
+        // Check DFSConfigKeys to see if DFS_DATANODE_SYNCONCLOSE_KEY exists (should be everything
>=1.1.1 and the 0.23 line)
+        Class<?> dfsConfigKeysClz = Class.forName("org.apache.hadoop.hdfs.DFSConfigKeys");
+        dfsConfigKeysClz.getDeclaredField("DFS_DATANODE_SYNCONCLOSE_KEY");
+        
+        // Everything else
         if (!fs.getConf().getBoolean("dfs.datanode.synconclose", false)) {
-          log.warn("dfs.datanode.synconclose set to false: data loss is possible on system
reset or power loss");
+          log.warn("dfs.datanode.synconclose set to false in hdfs-site.xml: data loss is
possible on system reset or power loss");
         }
       } catch (ClassNotFoundException ex) {
-        // hadoop 1.0
+        // hadoop 1.0.X or hadoop 1.1.0
+      } catch (SecurityException e) {
+        // hadoop 1.0.X or hadoop 1.1.0
+      } catch (NoSuchFieldException e) {
+        // hadoop 1.0.X or hadoop 1.1.0
       }
     }
     


Mime
View raw message