org.apache.hadoop.hdfs.server.namenode.LeaseManager Java Examples

The following examples show how to use org.apache.hadoop.hdfs.server.namenode.LeaseManager. 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: DFSTestUtil.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static void setNameNodeLogLevel(Level level) {
  GenericTestUtils.setLogLevel(FSNamesystem.LOG, level);
  GenericTestUtils.setLogLevel(BlockManager.LOG, level);
  GenericTestUtils.setLogLevel(LeaseManager.LOG, level);
  GenericTestUtils.setLogLevel(NameNode.LOG, level);
  GenericTestUtils.setLogLevel(NameNode.stateChangeLog, level);
  GenericTestUtils.setLogLevel(NameNode.blockStateChangeLog, level);
}
 
Example #2
Source File: SnapshotTestHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }
  
  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));
  
  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
 
Example #3
Source File: DFSTestUtil.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static void setNameNodeLogLevel(Level level) {
  GenericTestUtils.setLogLevel(FSNamesystem.LOG, level);
  GenericTestUtils.setLogLevel(BlockManager.LOG, level);
  GenericTestUtils.setLogLevel(LeaseManager.LOG, level);
  GenericTestUtils.setLogLevel(NameNode.LOG, level);
  GenericTestUtils.setLogLevel(NameNode.stateChangeLog, level);
  GenericTestUtils.setLogLevel(NameNode.blockStateChangeLog, level);
}
 
Example #4
Source File: SnapshotTestHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }
  
  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));
  
  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
 
Example #5
Source File: NNThroughputBenchmark.java    From RDFS with Apache License 2.0 5 votes vote down vote up
static void turnOffNameNodeLogging() {
	// change log level to ERROR: NameNode.LOG & NameNode.stateChangeLog
	((Log4JLogger) NameNode.LOG).getLogger().setLevel(Level.ERROR);
	((Log4JLogger) NameNode.stateChangeLog).getLogger().setLevel(
			Level.ERROR);
	((Log4JLogger) NetworkTopology.LOG).getLogger().setLevel(Level.ERROR);
	((Log4JLogger) FSNamesystem.LOG).getLogger().setLevel(Level.ERROR);
	((Log4JLogger) FSNamesystem.auditLog).getLogger().setLevel(Level.ERROR);
	((Log4JLogger) LeaseManager.LOG).getLogger().setLevel(Level.ERROR);
}
 
Example #6
Source File: TestStandbySafeMode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Test
public void testLeaseExpiry() throws Exception {
  setUp(true);
  h.setIgnoreDatanodes(false);
  LeaseManager leaseManager = cluster.getStandbyAvatar(0).avatar.namesystem.leaseManager;
  // Set low lease periods.
  leaseManager.setLeasePeriod(LEASE_PERIOD, LEASE_PERIOD);
  String src = "/testLeaseExpiry";

  // Create some data.
  FSDataOutputStream out = fs.create(new Path(src));
  byte[] buffer = new byte[BLOCK_SIZE * 2];
  random.nextBytes(buffer);
  out.write(buffer);
  out.sync();

  // Wait for the hard lease time to expire.
  Thread.sleep(LEASE_PERIOD * 2);

  cluster.failOver();
  LOG.info("Failover done");

  // Renew lease.
  ((DistributedFileSystem)fs).getClient().leasechecker.renew();
  LOG.info("Lease renewal done");

  // Wait to see whether lease expires.
  long start = System.currentTimeMillis();
  while (System.currentTimeMillis() - start < MAX_WAIT_TIME
      && leaseManager.getLeaseByPath(src) != null) {
    Thread.sleep(1000);
  }
  LOG.info("Wait for lease done");

  // Now try to write to the file.
  out.write(buffer);
  out.sync();
}