Package org.apache.hadoop.hdfs

Examples of org.apache.hadoop.hdfs.DFSTestUtil.checkFiles()


    nsInfo = cluster.getNameNode().versionRequest();

    for (DataNode dn : cluster.getDataNodes()) {
      assertEquals(nsInfo.getCTime(), dn.getCTime(nsInfo.getNamespaceID()));
    }
    assertTrue(util.checkFiles(cluster.getFileSystem(), "/"));
  }

  // Create a file with RBWs
  private void createFile(FileSystem fs, FSDataOutputStream out,
      String fileName, int fileLen) throws IOException {
View Full Code Here


      // test finalized replicas
      final String TopDir = "/test";
      DFSTestUtil util = new DFSTestUtil("TestCrcCorruption", 2, 3, 8 * 1024);
      util.createFiles(fs, TopDir, (short) 3);
      util.waitReplication(fs, TopDir, (short) 3);
      util.checkFiles(fs, TopDir);
     
      FSDataset data = getFSDS(cluster);
      // save all the block CRC info;
      NamespaceMap nm = data.volumeMap.getNamespaceMap(data.volumeMap.getNamespaceList()[0]);
      Map<Block, Integer> bim = new HashMap<Block, Integer>();
View Full Code Here

          TestCase.assertEquals(bim.get(entry.getKey()).intValue(), entry
              .getValue().getBlockCrc());
        }
      }
     
      util.checkFiles(fs, TopDir);
    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here

    conf.set(FSConstants.DFS_HOSTS, "hosts");
    cluster = new MiniDFSCluster(conf, 3,
        new String[] { "/r1", "/r2", NetworkTopology.DEFAULT_RACK }, null, true, false);
    DFSTestUtil util = new DFSTestUtil("/testStartup", 10, 10, 1024);
    util.createFiles(cluster.getFileSystem(), "/");
    util.checkFiles(cluster.getFileSystem(), "/");
    assertEquals(2, cluster.getNameNode().getDatanodeReport(DatanodeReportType.LIVE).length);
    cluster.shutdown();
  }
}
View Full Code Here

          LOG.info("Deliberately corrupting file " + blocks[idx].getName() +
              " at offset " + position + " length " + length);

          // read all files to trigger detection of corrupted replica
          try {
            util.checkFiles(fs, "/srcdat10");
            // we should get a ChecksumException or a BlockMissingException
          } catch (BlockMissingException e) {
            System.out.println("Received BlockMissingException as expected.");
          } catch (ChecksumException e) {
            System.out.println("Received ChecksumException as expected.");
View Full Code Here

          LOG.info("Deliberately corrupting file " + blocks[idx].getName() +
              " at offset " + position + " length " + length);

          // read all files to trigger detection of corrupted replica
          try {
            util.checkFiles(fs, "/srcdat10");
          } catch (BlockMissingException e) {
            System.out.println("Received BlockMissingException as expected.");
          } catch (ChecksumException e) {
            System.out.println("Received ChecksumException as expected.");
          } catch (IOException e) {
View Full Code Here

      }

     
      // read all files to trigger detection of corrupted replica
      try {
        util.checkFiles(fs, "/srcdat10");
      } catch (BlockMissingException e) {
        System.out.println("Received BlockMissingException as expected.");
      } catch (ChecksumException e) {
        System.out.println("Received ChecksumException as expected.");
      } catch (IOException e) {
View Full Code Here

          LOG.info("Deliberately corrupting file " + blocks[idx].getName() +
              " at offset " + position + " length " + length);

          // read all files to trigger detection of corrupted replica
          try {
            util.checkFiles(fs, "/srcdat10");
          } catch (BlockMissingException e) {
            System.out.println("Received BlockMissingException as expected.");
          } catch (ChecksumException e) {
            System.out.println("Received ChecksumException as expected.");
          } catch (IOException e) {
View Full Code Here

      } catch (InterruptedException ignore) {
      }

      // read all files to trigger detection of corrupted replica
      try {
        util.checkFiles(fs, "/srcdat10");
      } catch (BlockMissingException e) {
        System.out.println("Received BlockMissingException as expected.");
      } catch (ChecksumException e) {
        System.out.println("Received ChecksumException as expected.");
      } catch (IOException e) {
View Full Code Here

  public void testWriteWithRemoteFadvise() throws Exception {
    InjectionHandler.set(new FadviseHandler(NativeIO.POSIX_FADV_DONTNEED));
    setUp(3, new Configuration());
    DFSTestUtil util = new DFSTestUtil("/testWrite", 1, 3, BLOCK_SIZE * BLOCKS);
    util.createFiles(cluster.getFileSystem(), "/ABC");
    util.checkFiles(cluster.getFileSystem(), "/ABC");

    String[] fileNames = util.getFileNames("/ABC");
    assertEquals(1, fileNames.length);

    long start = System.currentTimeMillis();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.