Repository: accumulo
Updated Branches:
  refs/heads/1.6 09a4f0aa6 -> 5e0f6a426
  refs/heads/master a0ffb3df2 -> 64d1bbe9b


ACCUMULO-3280 Clean up Initialize

  Stop creating unneeded metadata table dirs on every volume.
  Limit the impact of warnings suppression when using deprecated items.
  Remove redundant call to configure metadata tables in ZooKeeper.
  Improve log message for fs.defaultFS being file:///
  Remove redundant check for directory existance when creating some dirs.
  Ensure root tablet dir is UTF-8 encoded in ZooKeeper.
  Simplify methods to write out initial root tablet content.


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

Branch: refs/heads/1.6
Commit: 5e0f6a42635471cefee1f5b88d07dfd6060b1cd2
Parents: 09a4f0a
Author: Christopher Tubbs <ctubb...@apache.org>
Authored: Fri Oct 31 18:11:28 2014 -0400
Committer: Christopher Tubbs <ctubb...@apache.org>
Committed: Fri Oct 31 18:54:52 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/server/ServerConstants.java |   5 -
 .../apache/accumulo/server/init/Initialize.java | 214 +++++++------------
 .../java/org/apache/accumulo/master/Master.java |  25 +--
 3 files changed, 93 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5e0f6a42/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
----------------------------------------------------------------------
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java 
b/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
index d4c0b32..51fa47e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerConstants.java
@@ -24,7 +24,6 @@ import java.util.HashSet;
 import java.util.List;
 
 import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.volume.Volume;
@@ -145,10 +144,6 @@ public class ServerConstants {
     return v.prefixChild(VERSION_DIR);
   }
 
-  public static String[] getMetadataTableDirs() {
-    return VolumeConfiguration.prefix(getTablesDirs(), MetadataTable.ID);
-  }
-
   public static synchronized List<Pair<Path,Path>> getVolumeReplacements() {
 
     if (replacementsList == null) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5e0f6a42/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
----------------------------------------------------------------------
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java 
b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index 14d5e98..24b5605 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -16,6 +16,10 @@
  */
 package org.apache.accumulo.server.init;
 
+import static 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN;
+import static 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily.TIME_COLUMN;
+import static 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Arrays;
@@ -45,12 +49,10 @@ import 
org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
-import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
-import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
 import org.apache.accumulo.core.security.SecurityUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.core.util.ColumnFQ;
 import org.apache.accumulo.core.volume.VolumeConfiguration;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
@@ -136,8 +138,8 @@ public class Initialize {
     initialMetadataConf.put(Property.TABLE_FAILURES_IGNORE.getKey(), "false");
     initialMetadataConf.put(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + 
"tablet",
         String.format("%s,%s", TabletsSection.TabletColumnFamily.NAME, 
TabletsSection.CurrentLocationColumnFamily.NAME));
-    initialMetadataConf.put(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + 
"server", String.format("%s,%s,%s,%s", DataFileColumnFamily.NAME,
-        LogColumnFamily.NAME, TabletsSection.ServerColumnFamily.NAME, 
TabletsSection.FutureLocationColumnFamily.NAME));
+    initialMetadataConf.put(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + 
"server", String.format("%s,%s,%s,%s", TabletsSection.DataFileColumnFamily.NAME,
+        TabletsSection.LogColumnFamily.NAME, 
TabletsSection.ServerColumnFamily.NAME, 
TabletsSection.FutureLocationColumnFamily.NAME));
     initialMetadataConf.put(Property.TABLE_LOCALITY_GROUPS.getKey(), 
"tablet,server");
     
initialMetadataConf.put(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey(), 
"");
     initialMetadataConf.put(Property.TABLE_INDEXCACHE_ENABLED.getKey(), 
"true");
@@ -181,24 +183,27 @@ public class Initialize {
     return true;
   }
 
-  @SuppressWarnings("deprecation")
   static void printInitializeFailureMessages(SiteConfiguration sconf) {
-    String instanceDfsDir = sconf.get(Property.INSTANCE_DFS_DIR);
+    @SuppressWarnings("deprecation")
+    Property INSTANCE_DFS_DIR = Property.INSTANCE_DFS_DIR;
+    @SuppressWarnings("deprecation")
+    Property INSTANCE_DFS_URI = Property.INSTANCE_DFS_URI;
+    String instanceDfsDir = sconf.get(INSTANCE_DFS_DIR);
     log.fatal("It appears the directories " + 
Arrays.asList(VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration()))
         + " were previously initialized.");
     String instanceVolumes = sconf.get(Property.INSTANCE_VOLUMES);
-    String instanceDfsUri = sconf.get(Property.INSTANCE_DFS_URI);
+    String instanceDfsUri = sconf.get(INSTANCE_DFS_URI);
 
     if (!instanceVolumes.isEmpty()) {
       log.fatal("Change the property " + Property.INSTANCE_VOLUMES + " to use 
different filesystems,");
     } else if (!instanceDfsDir.isEmpty()) {
-      log.fatal("Change the property " + Property.INSTANCE_DFS_URI + " to use 
a different filesystem,");
+      log.fatal("Change the property " + INSTANCE_DFS_URI + " to use a 
different filesystem,");
     } else {
       log.fatal("You are using the default URI for the filesystem. Set the 
property " + Property.INSTANCE_VOLUMES + " to use a different filesystem,");
     }
-    log.fatal("or change the property " + Property.INSTANCE_DFS_DIR + " to use 
a different directory.");
-    log.fatal("The current value of " + Property.INSTANCE_DFS_URI + " is |" + 
instanceDfsUri + "|");
-    log.fatal("The current value of " + Property.INSTANCE_DFS_DIR + " is |" + 
instanceDfsDir + "|");
+    log.fatal("or change the property " + INSTANCE_DFS_DIR + " to use a 
different directory.");
+    log.fatal("The current value of " + INSTANCE_DFS_URI + " is |" + 
instanceDfsUri + "|");
+    log.fatal("The current value of " + INSTANCE_DFS_DIR + " is |" + 
instanceDfsDir + "|");
     log.fatal("The current value of " + Property.INSTANCE_VOLUMES + " is |" + 
instanceVolumes + "|");
   }
 
@@ -225,18 +230,18 @@ public class Initialize {
     UUID uuid = UUID.randomUUID();
     // the actual disk locations of the root table and tablets
     String[] configuredVolumes = 
VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration());
-    final Path rootTablet = new Path(fs.choose(configuredVolumes) + 
Path.SEPARATOR + ServerConstants.TABLE_DIR + Path.SEPARATOR + RootTable.ID
-        + RootTable.ROOT_TABLET_LOCATION);
+    final String rootTabletDir = new Path(fs.choose(configuredVolumes) + 
Path.SEPARATOR + ServerConstants.TABLE_DIR + Path.SEPARATOR + RootTable.ID
+        + RootTable.ROOT_TABLET_LOCATION).toString();
 
     try {
-      initZooKeeper(opts, uuid.toString(), instanceNamePath, rootTablet);
+      initZooKeeper(opts, uuid.toString(), instanceNamePath, rootTabletDir);
     } catch (Exception e) {
       log.fatal("Failed to initialize zookeeper", e);
       return false;
     }
 
     try {
-      initFileSystem(opts, fs, uuid, rootTablet);
+      initFileSystem(opts, fs, uuid, rootTabletDir);
     } catch (Exception e) {
       log.fatal("Failed to initialize filesystem", e);
 
@@ -248,7 +253,7 @@ public class Initialize {
 
         // Try to determine when we couldn't find an appropriate core-site.xml 
on the classpath
         if (defaultFsUri.equals(fsDefaultName) && 
defaultFsUri.equals(fsDefaultFS)) {
-          log.fatal("Default filesystem value ('fs.defaultFS' or 
'fs.default.name') was found in the Hadoop configuration");
+          log.fatal("Default filesystem value ('fs.defaultFS' or 
'fs.default.name') of '" + defaultFsUri + "' was found in the Hadoop 
configuration");
           log.fatal("Please ensure that the Hadoop core-site.xml is on the 
classpath using 'general.classpaths' in accumulo-site.xml");
         }
       }
@@ -275,14 +280,6 @@ public class Initialize {
     }
   }
 
-  private static Path[] paths(String[] paths) {
-    Path[] result = new Path[paths.length];
-    for (int i = 0; i < paths.length; i++) {
-      result[i] = new Path(paths[i]);
-    }
-    return result;
-  }
-
   private static void initDirs(VolumeManager fs, UUID uuid, String[] baseDirs, 
boolean print) throws IOException {
     for (String baseDir : baseDirs) {
       fs.mkdirs(new Path(new Path(baseDir, ServerConstants.VERSION_DIR), "" + 
ServerConstants.DATA_VERSION));
@@ -296,133 +293,88 @@ public class Initialize {
     }
   }
 
-  // TODO Remove deprecation warning suppression when Hadoop1 support is 
dropped
-  @SuppressWarnings("deprecation")
-  private static void initFileSystem(Opts opts, VolumeManager fs, UUID uuid, 
Path rootTablet) throws IOException {
-    FileStatus fstat;
-
+  private static void initFileSystem(Opts opts, VolumeManager fs, UUID uuid, 
String rootTabletDir) throws IOException {
     initDirs(fs, uuid, 
VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration()), 
false);
 
-    // the actual disk locations of the metadata table and tablets
-    final Path[] metadataTableDirs = 
paths(ServerConstants.getMetadataTableDirs());
+    // initialize initial metadata config in zookeeper
+    initMetadataConfig();
 
     String tableMetadataTabletDir = fs.choose(ServerConstants.getBaseUris()) + 
Constants.HDFS_TABLES_DIR + Path.SEPARATOR + MetadataTable.ID
         + TABLE_TABLETS_TABLET_DIR;
     String defaultMetadataTabletDir = fs.choose(ServerConstants.getBaseUris()) 
+ Constants.HDFS_TABLES_DIR + Path.SEPARATOR + MetadataTable.ID
         + Constants.DEFAULT_TABLET_LOCATION;
 
-    // initialize initial metadata config in zookeeper
-    initMetadataConfig();
-
-    // create metadata table
-    for (Path mtd : metadataTableDirs) {
-      try {
-        fstat = fs.getFileStatus(mtd);
-        if (!fstat.isDir()) {
-          log.fatal("location " + mtd.toString() + " exists but is not a 
directory");
-          return;
-        }
-      } catch (FileNotFoundException fnfe) {
-        if (!fs.mkdirs(mtd)) {
-          log.fatal("unable to create directory " + mtd.toString());
-          return;
-        }
-      }
-    }
-
-    // create root table and tablet
-    try {
-      fstat = fs.getFileStatus(rootTablet);
-      if (!fstat.isDir()) {
-        log.fatal("location " + rootTablet.toString() + " exists but is not a 
directory");
-        return;
-      }
-    } catch (FileNotFoundException fnfe) {
-      if (!fs.mkdirs(rootTablet)) {
-        log.fatal("unable to create directory " + rootTablet.toString());
-        return;
-      }
-    }
-
-    // populate the root tablet with info about the default tablet
-    // the root tablet contains the key extent and locations of all the
-    // metadata tablets
-    String initRootTabFile = rootTablet + "/00000_00000." + 
FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
-    FileSystem ns = fs.getVolumeByPath(new 
Path(initRootTabFile)).getFileSystem();
-    FileSKVWriter mfw = 
FileOperations.getInstance().openWriter(initRootTabFile, ns, ns.getConf(), 
AccumuloConfiguration.getDefaultConfiguration());
-    mfw.startDefaultLocalityGroup();
-
-    Text tableExtent = new Text(KeyExtent.getMetadataEntry(new 
Text(MetadataTable.ID), 
MetadataSchema.TabletsSection.getRange().getEndKey().getRow()));
-
-    // table tablet's directory
-    Key tableDirKey = new Key(tableExtent, 
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily(),
-        
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), 0);
-    mfw.append(tableDirKey, new 
Value(tableMetadataTabletDir.getBytes(Constants.UTF8)));
-
-    // table tablet time
-    Key tableTimeKey = new Key(tableExtent, 
TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
-        TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnQualifier(), 0);
-    mfw.append(tableTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + 
"0").getBytes(Constants.UTF8)));
+    // create table and default tablets directories
+    createDirectories(fs, rootTabletDir, tableMetadataTabletDir, 
defaultMetadataTabletDir);
 
-    // table tablet's prevrow
-    Key tablePrevRowKey = new Key(tableExtent, 
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnFamily(),
-        
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnQualifier(), 0);
-    mfw.append(tablePrevRowKey, KeyExtent.encodePrevEndRow(null));
+    // populate the root tablet with info about the metadata tablets
+    String fileName = rootTabletDir + Path.SEPARATOR + "00000_00000." + 
FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
+    createMetadataFile(fs, fileName, MetadataTable.ID, tableMetadataTabletDir, 
defaultMetadataTabletDir);
+  }
 
-    // ----------] default tablet info
-    Text defaultExtent = new Text(KeyExtent.getMetadataEntry(new 
Text(MetadataTable.ID), null));
+  /**
+   * Create an rfile in the default tablet's directory for a new table. This 
method is used to create the initial root tablet contents, with information 
about
+   * the metadata table's tablets
+   *
+   * @param volmanager
+   *          The VolumeManager
+   * @param fileName
+   *          The location to create the file
+   * @param tableId
+   *          TableID that is being "created"
+   * @param tableTabletDir
+   *          The table_info directory for the new table
+   * @param defaultTabletDir
+   *          The default_tablet directory for the new table
+   */
+  private static void createMetadataFile(VolumeManager volmanager, String 
fileName, String tableId, String tableTabletDir, String defaultTabletDir)
+      throws IOException {
+    FileSystem fs = volmanager.getVolumeByPath(new 
Path(fileName)).getFileSystem();
+    FileSKVWriter tabletWriter = 
FileOperations.getInstance().openWriter(fileName, fs, fs.getConf(), 
AccumuloConfiguration.getDefaultConfiguration());
+    tabletWriter.startDefaultLocalityGroup();
 
-    // default's directory
-    Key defaultDirKey = new Key(defaultExtent, 
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily(),
-        
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), 0);
-    mfw.append(defaultDirKey, new 
Value(defaultMetadataTabletDir.getBytes(Constants.UTF8)));
+    Text splitPoint = TabletsSection.getRange().getEndKey().getRow();
+    createEntriesForTablet(tabletWriter, tableId, tableTabletDir, null, 
splitPoint);
+    createEntriesForTablet(tabletWriter, tableId, defaultTabletDir, 
splitPoint, null);
 
-    // default's time
-    Key defaultTimeKey = new Key(defaultExtent, 
TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
-        TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnQualifier(), 0);
-    mfw.append(defaultTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + 
"0").getBytes(Constants.UTF8)));
+    tabletWriter.close();
+  }
 
-    // default's prevrow
-    Key defaultPrevRowKey = new Key(defaultExtent, 
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnFamily(),
-        
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.getColumnQualifier(), 0);
-    mfw.append(defaultPrevRowKey, 
KeyExtent.encodePrevEndRow(MetadataSchema.TabletsSection.getRange().getEndKey().getRow()));
+  private static void createEntriesForTablet(FileSKVWriter writer, String 
tableId, String tabletDir, Text tabletPrevEndRow, Text tabletEndRow)
+      throws IOException {
+    Text extent = new Text(KeyExtent.getMetadataEntry(new Text(tableId), 
tabletEndRow));
+    addEntry(writer, extent, DIRECTORY_COLUMN, new 
Value(tabletDir.getBytes(Constants.UTF8)));
+    addEntry(writer, extent, TIME_COLUMN, new 
Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(Constants.UTF8)));
+    addEntry(writer, extent, PREV_ROW_COLUMN, 
KeyExtent.encodePrevEndRow(tabletPrevEndRow));
+  }
 
-    mfw.close();
+  private static void addEntry(FileSKVWriter writer, Text row, ColumnFQ col, 
Value value) throws IOException {
+    writer.append(new Key(row, col.getColumnFamily(), 
col.getColumnQualifier(), 0), value);
+  }
 
-    // create table and default tablets directories
-    for (String s : Arrays.asList(tableMetadataTabletDir, 
defaultMetadataTabletDir)) {
+  private static void createDirectories(VolumeManager fs, String... dirs) 
throws IOException {
+    for (String s : dirs) {
       Path dir = new Path(s);
       try {
-        fstat = fs.getFileStatus(dir);
-        if (!fstat.isDir()) {
-          log.fatal("location " + dir.toString() + " exists but is not a 
directory");
+        FileStatus fstat = fs.getFileStatus(dir);
+        // TODO Remove deprecation warning suppression when Hadoop1 support is 
dropped
+        @SuppressWarnings("deprecation")
+        boolean isDirectory = fstat.isDir();
+        if (!isDirectory) {
+          log.fatal("location " + dir + " exists but is not a directory");
           return;
         }
       } catch (FileNotFoundException fnfe) {
-        try {
-          fstat = fs.getFileStatus(dir);
-          if (!fstat.isDir()) {
-            log.fatal("location " + dir.toString() + " exists but is not a 
directory");
-            return;
-          }
-        } catch (FileNotFoundException fnfe2) {
-          // create table info dir
-          if (!fs.mkdirs(dir)) {
-            log.fatal("unable to create directory " + dir.toString());
-            return;
-          }
-        }
-
-        // create default dir
+        // attempt to create directory, since it doesn't exist
         if (!fs.mkdirs(dir)) {
-          log.fatal("unable to create directory " + dir.toString());
+          log.fatal("unable to create directory " + dir);
           return;
         }
       }
     }
   }
 
-  private static void initZooKeeper(Opts opts, String uuid, String 
instanceNamePath, Path rootTablet) throws KeeperException, InterruptedException 
{
+  private static void initZooKeeper(Opts opts, String uuid, String 
instanceNamePath, String rootTabletDir) throws KeeperException, 
InterruptedException {
     // setup basic data in zookeeper
     zoo.putPersistentData(Constants.ZROOT, new byte[0], -1, 
NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE);
     zoo.putPersistentData(Constants.ZROOT + Constants.ZINSTANCES, new byte[0], 
-1, NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE);
@@ -447,7 +399,7 @@ public class Initialize {
     zoo.putPersistentData(zkInstanceRoot + Constants.ZPROBLEMS, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET_WALOGS, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
-    zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET_PATH, 
rootTablet.toString().getBytes(), NodeExistsPolicy.FAIL);
+    zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET_PATH, 
rootTabletDir.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTRACERS, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTERS, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_LOCK, 
EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL);
@@ -520,7 +472,7 @@ public class Initialize {
         opts.rootpass);
   }
 
-  public static void initMetadataConfig(String tableId) throws IOException {
+  public static void initMetadataConfig() throws IOException {
     try {
       Configuration conf = CachedConfiguration.getInstance();
       int max = conf.getInt("dfs.replication.max", 512);
@@ -542,11 +494,6 @@ public class Initialize {
     }
   }
 
-  protected static void initMetadataConfig() throws IOException {
-    initMetadataConfig(RootTable.ID);
-    initMetadataConfig(MetadataTable.ID);
-  }
-
   private static void setMetadataReplication(int replication, String reason) 
throws IOException {
     String rep = getConsoleReader().readLine(
         "Your HDFS replication " + reason + " is not compatible with our 
default " + MetadataTable.NAME + " replication of 5. What do you want to set 
your "
@@ -570,8 +517,7 @@ public class Initialize {
 
   private static void addVolumes(VolumeManager fs) throws IOException {
     HashSet<String> initializedDirs = new HashSet<String>();
-    initializedDirs
-        
.addAll(Arrays.asList(ServerConstants.checkBaseUris(VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration()),
 true)));
+    
initializedDirs.addAll(Arrays.asList(ServerConstants.checkBaseUris(VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration()),
 true)));
 
     HashSet<String> uinitializedDirs = new HashSet<String>();
     
uinitializedDirs.addAll(Arrays.asList(VolumeConfiguration.getVolumeUris(ServerConfiguration.getSiteConfiguration())));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5e0f6a42/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java 
b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index d7a71da..9537f4e 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -279,7 +279,8 @@ public class Master implements LiveTServerSet.Listener, 
TableObserver, CurrentSt
       // This Master hasn't started Fate yet, so any outstanding transactions 
must be from before the upgrade.
       // Change to Guava's Verify once we use Guava 17.
       if (null != fate) {
-        throw new IllegalStateException("Access to Fate should not have been 
initialized prior to the Master transitioning to active. Please save all logs 
and file a bug.");
+        throw new IllegalStateException(
+            "Access to Fate should not have been initialized prior to the 
Master transitioning to active. Please save all logs and file a bug.");
       }
       Accumulo.abortIfFateTransactions();
       try {
@@ -322,9 +323,10 @@ public class Master implements LiveTServerSet.Listener, 
TableObserver, CurrentSt
         log.debug("Upgrade creating table " + RootTable.NAME + " (ID: " + 
RootTable.ID + ")");
         TableManager.prepareNewTableState(instance.getInstanceID(), 
RootTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, RootTable.NAME, 
TableState.ONLINE,
             NodeExistsPolicy.SKIP);
-        Initialize.initMetadataConfig(RootTable.ID);
+        Initialize.initMetadataConfig();
         // ensure root user can flush root table
-        
security.grantTablePermission(SystemCredentials.get().toThrift(instance), 
security.getRootUsername(), RootTable.ID, TablePermission.ALTER_TABLE, 
Namespaces.ACCUMULO_NAMESPACE_ID);
+        
security.grantTablePermission(SystemCredentials.get().toThrift(instance), 
security.getRootUsername(), RootTable.ID, TablePermission.ALTER_TABLE,
+            Namespaces.ACCUMULO_NAMESPACE_ID);
 
         // put existing tables in the correct namespaces
         String tables = ZooUtil.getRoot(instance) + Constants.ZTABLES;
@@ -373,10 +375,12 @@ public class Master implements LiveTServerSet.Listener, 
TableObserver, CurrentSt
         // sanity check that we passed the Fate verification prior to 
ZooKeeper upgrade, and that Fate still hasn't been started.
         // Change both to use Guava's Verify once we use Guava 17.
         if (!haveUpgradedZooKeeper) {
-          throw new IllegalStateException("We should only attempt to upgrade 
Accumulo's metadata table if we've already upgraded ZooKeeper. Please save all 
logs and file a bug.");
+          throw new IllegalStateException(
+              "We should only attempt to upgrade Accumulo's metadata table if 
we've already upgraded ZooKeeper. Please save all logs and file a bug.");
         }
         if (null != fate) {
-          throw new IllegalStateException("Access to Fate should not have been 
initialized prior to the Master finishing upgrades. Please save all logs and 
file a bug.");
+          throw new IllegalStateException(
+              "Access to Fate should not have been initialized prior to the 
Master finishing upgrades. Please save all logs and file a bug.");
         }
         Runnable upgradeTask = new Runnable() {
           @Override
@@ -726,10 +730,8 @@ public class Master implements LiveTServerSet.Listener, 
TableObserver, CurrentSt
     }
 
     /**
-     * If a migrating tablet splits, and the tablet dies before sending the
-     * master a message, the migration will refer to a non-existing tablet,
-     * so it can never complete. Periodically scan the metadata table and
-     * remove any migrating tablets that no longer exist.
+     * If a migrating tablet splits, and the tablet dies before sending the 
master a message, the migration will refer to a non-existing tablet, so it can 
never
+     * complete. Periodically scan the metadata table and remove any migrating 
tablets that no longer exist.
      */
     private void cleanupNonexistentMigrations(final Connector connector) 
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
       Scanner scanner = connector.createScanner(MetadataTable.NAME, 
Authorizations.EMPTY);
@@ -745,9 +747,8 @@ public class Master implements LiveTServerSet.Listener, 
TableObserver, CurrentSt
     }
 
     /**
-     * If migrating a tablet for a table that is offline, the migration
-     * can never succeed because no tablet server will load the tablet.
-     * check for offline tables and remove their migrations.
+     * If migrating a tablet for a table that is offline, the migration can 
never succeed because no tablet server will load the tablet. check for offline
+     * tables and remove their migrations.
      */
     private void cleanupOfflineMigrations() {
       TableManager manager = TableManager.getInstance();

Reply via email to