Java Code Examples for org.apache.hadoop.hdfs.server.namenode.FSNamesystem#getRequiredNamespaceEditsDirs()

The following examples show how to use org.apache.hadoop.hdfs.server.namenode.FSNamesystem#getRequiredNamespaceEditsDirs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestFailureOfSharedDir.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Test that the shared edits dir is automatically added to the list of edits
 * dirs that are marked required.
 */
@Test
public void testSharedDirIsAutomaticallyMarkedRequired()
    throws URISyntaxException {
  URI foo = new URI("file:/foo");
  URI bar = new URI("file:/bar");
  Configuration conf = new Configuration();
  conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, Joiner.on(",").join(foo, bar));
  conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_REQUIRED_KEY, foo.toString());
  assertFalse(FSNamesystem.getRequiredNamespaceEditsDirs(conf).contains(
      bar));
  conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY, bar.toString());
  Collection<URI> requiredEditsDirs = FSNamesystem
      .getRequiredNamespaceEditsDirs(conf); 
  assertTrue(Joiner.on(",").join(requiredEditsDirs) + " does not contain " + bar,
      requiredEditsDirs.contains(bar));
}
 
Example 2
Source File: TestFailureOfSharedDir.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Test that the shared edits dir is automatically added to the list of edits
 * dirs that are marked required.
 */
@Test
public void testSharedDirIsAutomaticallyMarkedRequired()
    throws URISyntaxException {
  URI foo = new URI("file:/foo");
  URI bar = new URI("file:/bar");
  Configuration conf = new Configuration();
  conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, Joiner.on(",").join(foo, bar));
  conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_REQUIRED_KEY, foo.toString());
  assertFalse(FSNamesystem.getRequiredNamespaceEditsDirs(conf).contains(
      bar));
  conf.set(DFSConfigKeys.DFS_NAMENODE_SHARED_EDITS_DIR_KEY, bar.toString());
  Collection<URI> requiredEditsDirs = FSNamesystem
      .getRequiredNamespaceEditsDirs(conf); 
  assertTrue(Joiner.on(",").join(requiredEditsDirs) + " does not contain " + bar,
      requiredEditsDirs.contains(bar));
}