Package org.apache.hadoop.util

Examples of org.apache.hadoop.util.InjectionHandler


    final AtomicBoolean startKeepThread = new AtomicBoolean(true);
    final AtomicInteger countAutoRolled = new AtomicInteger(0);
    final AtomicBoolean needFail = new AtomicBoolean(false);
    final AtomicLong currentThreadId = new AtomicLong(-1);
    final Object waitFor10Rolls = new Object();
    InjectionHandler.set(new InjectionHandler() {
      @Override
      protected void _processEvent(InjectionEventI event, Object... args) {
        if (event == InjectionEvent.FSEDIT_AFTER_AUTOMATIC_ROLL) {
          countAutoRolled.incrementAndGet();
          if (countAutoRolled.get() >= 10) {
View Full Code Here


      FSDataInputStream in = dfs.open(fpath);

      in.read(new byte[512]);

      // By closing the pipeline connection, force a block recovery
      InjectionHandler.set(new InjectionHandler() {
        int thrownCount = 0;

        @Override
        protected void _processEventIO(InjectionEventI event, Object... args)
            throws IOException {
          if (event == InjectionEvent.DFSCLIENT_DATASTREAM_AFTER_WAIT
              && thrownCount < 1) {
            thrownCount++;
            MultiDataOutputStream blockStream = (MultiDataOutputStream) args[0];
            blockStream.close();
          }
        }
      });

      out.write(new byte[512 * 2]);
      out.sync();

      InjectionHandler.set(new InjectionHandler() {
        int thrownCount = 0;

        @SuppressWarnings("unchecked")
        @Override
        protected void _processEventIO(InjectionEventI event, Object... args)
View Full Code Here

  @Test
  public void testRaidUI() throws Exception {
    Configuration localConf = new Configuration(conf);
    cnode = RaidNode.createRaidNode(null, localConf);
    InetSocketAddress infoSocAddr = dfsCluster.getNameNode().getHttpAddress();
    InjectionHandler h = new TestRaidHTTPInjectionHandler();
    InjectionHandler.set(h);
   
    LOG.info("First call will fail with timeout because RaidNode UI will "
        "hang for 10 seconds. Check TestRaidHTTPInjectionHandler when "  +
        "counter == 1");
View Full Code Here

    InetSocketAddress addr = NetUtils.getConnectAddress(server);
   
    final AtomicReference<Hashtable> hashtable = new AtomicReference<Hashtable>(
        null);
    try {
      InjectionHandler.set(new InjectionHandler() {
        @Override
        protected void _processEvent(InjectionEventI event, Object... args) {
          if (event == InjectionEventCore.RPC_CLIENT_SETUP_IO_STREAM_FAILURE) {
            hashtable.set((Hashtable) args[0]);
            throw new RuntimeException("testIOSetupFailure");
View Full Code Here

    conf.setInt(HdfsConstants.DFS_DFSCLIENT_QUORUM_READ_THREADPOOL_SIZE, numQuorumPoolThreads);
    conf.setLong(HdfsConstants.DFS_DFSCLIENT_QUORUM_READ_THRESHOLD_MILLIS, 100);
   
    // Set up the InjectionHandler
    // make preads sleep for 60ms
    InjectionHandler.set(new InjectionHandler() {
      public void _processEvent(InjectionEventI event, Object... args) {
        if(event == InjectionEvent.DFSCLIENT_START_FETCH_FROM_DATANODE) {
          try {
            Thread.sleep(60);
          } catch (InterruptedException e) {
View Full Code Here

          bufferSize, REPLICATION_NUM, BLOCK_SIZE);
      stm2.write(buffer, 0, size);
      stm2.sync();

      // For one of the datanodes, hang all the block recover requests.
      InjectionHandler.set(new InjectionHandler() {
        AtomicInteger hangDnPort = new AtomicInteger(-1);
       
        @Override
        protected void _processEvent(InjectionEventI event, Object... args) {
          if (event == InjectionEvent.DATANODE_BEFORE_RECOVERBLOCK) {
View Full Code Here

    String src = "/testNameNodeFingerprintSent1.txt";
    // Path f = new Path(src);

    // stop a second getAdditionalBlock() from happening too fast
    InjectionHandler.set(new InjectionHandler() {
      int thrownCount = 0;

      @Override
      protected void _processEventIO(InjectionEventI event, Object... args)
          throws IOException {
View Full Code Here

      localConf.set("raid.blockfix.classname",
                    "org.apache.hadoop.raid.LocalBlockIntegrityMonitor");
    } else {
      localConf.set("raid.blockfix.classname",
                    "org.apache.hadoop.raid.DistBlockIntegrityMonitor");
      InjectionHandler h = new TestSendRecoveryTimeInjectionHandler();
      InjectionHandler.set(h);
    }
    localConf.setLong("raid.blockfix.filespertask", 2L);
    if (hasChecksumStore) {
      TestBlockFixer.setChecksumStoreConfig(localConf);
View Full Code Here

    Configuration newConf = new Configuration(conf);
    USER1 = new UnixUserGroupInformation("foo", new String[] {"bar" });
    UnixUserGroupInformation.saveToConf(newConf,
        UnixUserGroupInformation.UGI_PROPERTY_NAME, USER1);
    userdfs = (DistributedFileSystem)FileSystem.get(newConf); // login as ugi
    InjectionHandler h = new FakeBlockGeneratorInjectionHandler();
    InjectionHandler.set(h);
    rand.nextBytes(bytes);
  }
View Full Code Here

    // Fail the test if any node is added to dead nodes.
    // Also verify number of read requests issued to data node is
    // under the correct level.
    final AtomicBoolean needFail = new AtomicBoolean(false);
    final AtomicInteger numReads = new AtomicInteger(0);
    InjectionHandler.set(new InjectionHandler() {
      @Override
      protected void _processEvent(InjectionEventI event, Object... args) {
        if (event == InjectionEvent.DFSCLIENT_BEFORE_ADD_DEADNODES) {
          needFail.set(true);
          try {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.util.InjectionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.