Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D5F910896 for ; Mon, 2 Dec 2013 22:54:26 +0000 (UTC) Received: (qmail 16825 invoked by uid 500); 2 Dec 2013 22:54:26 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 16784 invoked by uid 500); 2 Dec 2013 22:54:26 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 16776 invoked by uid 99); 2 Dec 2013 22:54:26 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Dec 2013 22:54:26 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B235491AAE2; Mon, 2 Dec 2013 22:54:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Mon, 02 Dec 2013 22:54:26 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer 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 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 Authored: Mon Dec 2 17:13:44 2013 -0500 Committer: Josh Elser 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 } }