Package org.apache.hadoop.hdfs.tools

Examples of org.apache.hadoop.hdfs.tools.FastCopy.copy()


        Random r = new Random();
        FastCopy fcp = new FastCopy(conf);
        while (running) {
          int suffix = r.nextInt();
          String dstFile = "/dst" + suffix;
          fcp.copy(src, dstFile, (DistributedFileSystem) fs,
              (DistributedFileSystem) fs);
          pass = FastCopySetupUtil.compareFiles(src, fs, dstFile, fs);
        }
      } catch (Exception e) {
        pass = false;
View Full Code Here


    }

    // Now run FastCopy
    try {
      for (String fileName : util.getFileNames(topDir)) {
        fastCopy.copy(fileName, fileName + "dst", (DistributedFileSystem) fs,
            (DistributedFileSystem) fs);
      }
    } finally {
      fastCopy.shutdown();
    }
View Full Code Here

    DFSTestUtil.createFile(fs, new Path(filename), MAX_FILE_SIZE, (short) 3,
        System.currentTimeMillis());

    FastCopy fastCopy = new FastCopy(conf);
    try {
      fastCopy.copy(filename, filename + "dst", (DistributedFileSystem) fs,
          (DistributedFileSystem) fs);
    } finally {
      fastCopy.shutdown();
    }
  }
View Full Code Here

    // Now run FastCopy
    try {
      DistributedFileSystem dfs = (DistributedFileSystem) fs;
      for (String fileName : util.getFileNames(topDir)) {
        fastCopy.copy(fileName, fileName + "dst", dfs, dfs);
        assertTrue(fs.exists(new Path(fileName + "dst")));
        // assert the hard links.
        String[] hardlinks = dfs.getHardLinkedFiles(new Path(fileName));
        for (String hardLink : hardlinks) {
          assertEquals(hardLink, fileName + "dst");
View Full Code Here

    }

    // Now run FastCopy
    try {
      for (String fileName : util.getFileNames(topDir)) {
        fastCopy.copy(fileName, fileName + "dst", (DistributedFileSystem) fs1,
            (DistributedFileSystem) fs2);
      }

    } catch (ExecutionException e) {
      System.out.println("Expected exception : " + e);
View Full Code Here

    FastCopy fastCopy = new FastCopy(conf);
    cluster.shutdownDataNode(0, true);
    try {
      DistributedFileSystem dfs = (DistributedFileSystem) fs;
      for (String fileName : util.getFileNames(topDir)) {
        fastCopy.copy(fileName, fileName + "dst", dfs, dfs);
        assertTrue(fs.exists(new Path(fileName + "dst")));
        // assert the hard links.
        String[] hardlinks = dfs.getHardLinkedFiles(new Path(fileName));
        for (String hardLink : hardlinks) {
          assertEquals(hardLink, fileName + "dst");
View Full Code Here

    util.createFiles(fs1, topDir);
    FastCopy fastCopy = new FastCopy(conf);
    cluster.shutdownDataNode(0, true);
    try {
      for (String fileName : util.getFileNames(topDir)) {
        fastCopy.copy(fileName, fileName + "dst", (DistributedFileSystem) fs1,
            (DistributedFileSystem) fs2);
      }
      Map<DatanodeInfo, Integer> dnErrors = fastCopy.getDatanodeErrors();
      assertEquals(1, dnErrors.size());
      int errors = dnErrors.values().iterator().next();
View Full Code Here

    String destination = "/testFastCopyDestination" + hardlink;
    FastCopy fastCopy = new FastCopy(conf);
    NameNode namenode = cluster.getNameNode();
    try {
      for (int i = 0; i < COPIES; i++) {
        fastCopy.copy(src, destination + i, fs, fs);
        assertTrue(verifyCopiedFile(src, destination + i, namenode, namenode,
            fs, fs, hardlink));
        verifyFileStatus(destination + i, namenode, fastCopy);
      }
    } catch (Exception e) {
View Full Code Here

    String destination = "/testFastCopyDestination" + hardlink;
    FastCopy fastCopy = new FastCopy(conf, fs, fs);
    NameNode namenode = cluster.getNameNode();
    try {
      for (int i = 0; i < COPIES; i++) {
        fastCopy.copy(src, destination + i);
        assertTrue(verifyCopiedFile(src, destination + i, namenode, namenode,
            fs, fs, hardlink));
        verifyFileStatus(destination + i, namenode, fastCopy);
      }
    } catch (Exception e) {
View Full Code Here

    for (int i = 0; i < COPIES; i++) {
      requests.add(new FastFileCopyRequest(src, destination + i, fs, fs));
    }
    NameNode namenode = cluster.getNameNode();
    try {
      fastCopy.copy(requests);
      for (FastFileCopyRequest r : requests) {
        assertTrue(verifyCopiedFile(r.getSrc(), r.getDestination(), namenode,
            namenode, fs, fs, hardlink));
        verifyFileStatus(r.getDestination(), namenode, fastCopy);
      }
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.