accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1363430 - /accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
Date Thu, 19 Jul 2012 17:18:44 GMT
Author: vines
Date: Thu Jul 19 17:18:43 2012
New Revision: 1363430

URL: http://svn.apache.org/viewvc?rev=1363430&view=rev
Log:
ACCUMULO-683 - Will now check the max and mins and prompt user for appropriate values. Includes
support for the changed configuration value in hadoop-0.23


Modified:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java

Modified: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1363430&r1=1363429&r2=1363430&view=diff
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
(original)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
Thu Jul 19 17:18:43 2012
@@ -413,6 +413,14 @@ public class Initialize {
   
   protected static void initMetadataConfig() throws IOException {
     try {
+      Configuration conf = CachedConfiguration.getInstance();
+      int max = conf.getInt("dfs.replication.max", 512);
+      // Hadoop 0.23 switched the min value configuration name
+      int min = Math.max(conf.getInt("dfs.replication.min", 1), conf.getInt("dfs.namenode.replication.min",
1));
+      if (max < 5)
+        setMetadataReplication(max, "max");
+      if (min > 5)
+        setMetadataReplication(min, "min");
       for (Entry<String,String> entry : initialMetadataConf.entrySet())
         if (!TablePropUtil.setTableProperty(Constants.METADATA_TABLE_ID, entry.getKey(),
entry.getValue()))
           throw new IOException("Cannot create per-table property " + entry.getKey());
@@ -422,6 +430,18 @@ public class Initialize {
     }
   }
   
+  private static void setMetadataReplication(int replication, String reason) throws IOException
{
+    String rep = getConsoleReader().readLine(
+        "Your HDFS replication " + reason
+            + " is not compatible with our default !METADATA replication of 5. What do you
want to set your !METADATA replication to? (" + replication + ") ");
+    if (rep == null || rep.length() == 0)
+      rep = Integer.toString(replication);
+    else
+      // Lets make sure it's a number
+      Integer.parseInt(rep);
+    initialMetadataConf.put(Property.TABLE_FILE_REPLICATION.getKey(), rep);
+  }
+
   public static boolean isInitialized(FileSystem fs) throws IOException {
     return (fs.exists(ServerConstants.getInstanceIdLocation()) || fs.exists(ServerConstants.getDataVersionLocation()));
   }



Mime
View raw message