Search in sources :

Example 11 with StartupOption

use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project SSM by Intel-bigdata.

the class SmartServer method parseArguments.

@VisibleForTesting
public static StartupOption parseArguments(String[] args) {
    int argsLen = (args == null) ? 0 : args.length;
    StartupOption startOpt = StartupOption.REGULAR;
    for (int i = 0; i < argsLen; i++) {
        String cmd = args[i];
        if (StartupOption.FORMAT.getName().equalsIgnoreCase(cmd)) {
            startOpt = StartupOption.FORMAT;
        } else if (StartupOption.CHECKPOINT.getName().equalsIgnoreCase(cmd)) {
            startOpt = StartupOption.CHECKPOINT;
        } else {
            return null;
        }
    }
    return startOpt;
}
Also used : StartupOption(org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 12 with StartupOption

use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project hadoop by apache.

the class TestDatanodeStartupOptions method checkExpected.

/**
   * Process the given arg list as command line arguments to the DataNode
   * to make sure we get the expected result. If the expected result is
   * success then further validate that the parsed startup option is the
   * same as what was expected.
   *
   * @param expectSuccess
   * @param expectedOption
   * @param conf
   * @param arg
   */
private static void checkExpected(boolean expectSuccess, StartupOption expectedOption, Configuration conf, String... arg) {
    String[] args = new String[arg.length];
    int i = 0;
    for (String currentArg : arg) {
        args[i++] = currentArg;
    }
    boolean returnValue = DataNode.parseArguments(args, conf);
    StartupOption option = DataNode.getStartupOption(conf);
    assertThat(returnValue, is(expectSuccess));
    if (expectSuccess) {
        assertThat(option, is(expectedOption));
    }
}
Also used : StartupOption(org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption)

Example 13 with StartupOption

use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project hadoop by apache.

the class TestHdfsServerConstants method verifyStartupOptionResult.

/**
   * Verify that parsing a StartupOption string gives the expected results.
   * If a RollingUpgradeStartupOption is specified than it is also checked.
   *
   * @param value
   * @param expectedOption
   * @param expectedRollupOption optional, may be null.
   */
private static void verifyStartupOptionResult(String value, StartupOption expectedOption, RollingUpgradeStartupOption expectedRollupOption) {
    StartupOption option = StartupOption.getEnum(value);
    assertEquals(expectedOption, option);
    if (expectedRollupOption != null) {
        assertEquals(expectedRollupOption, option.getRollingUpgradeStartupOption());
    }
}
Also used : RollingUpgradeStartupOption(org.apache.hadoop.hdfs.server.common.HdfsServerConstants.RollingUpgradeStartupOption) StartupOption(org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption)

Aggregations

StartupOption (org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption)13 RollingUpgradeStartupOption (org.apache.hadoop.hdfs.server.common.HdfsServerConstants.RollingUpgradeStartupOption)6 IOException (java.io.IOException)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)3 Configuration (org.apache.hadoop.conf.Configuration)2 Test (org.junit.Test)2 NamenodeRole (org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole)1 StorageInfo (org.apache.hadoop.hdfs.server.common.StorageInfo)1 FsDatasetSpi (org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi)1 NameNode (org.apache.hadoop.hdfs.server.namenode.NameNode)1 NameNodeMetrics (org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics)1 GenericOptionsParser (org.apache.hadoop.util.GenericOptionsParser)1 GenericOptionsParser (org.smartdata.server.utils.GenericOptionsParser)1