Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileSystem.rename()


    if(fs.exists(realtimefinal))
    {
      fs.delete(realtimefinal, true);
    }
   
    fs.rename(tmpDir, realtimefinal);
   
    if(txid>0)
    {
      synchronized (editlog) {
        editlog.purgeLogsOlderThan(txid-1);
View Full Code Here


    if(fs.exists(realtimefinal))
    {
      fs.delete(realtimefinal, true);
    }
   
    fs.rename(tmpDir, realtimefinal);
   
    if(txid>0)
    {
      synchronized (editlog) {
        editlog.purgeLogsOlderThan(txid-1);
View Full Code Here

        String taskAttemptName = getTaskAttemptName(name);
        TaskAttemptID taskAttemptID = TaskAttemptID.forName(taskAttemptName);
        if (taskAttemptID.getJobID().equals(jobContext.getJobID())) {
          if (commit) {
            if (taskComplete) {
              fileSystem.rename(path, new Path(shardPath, taskAttemptName + ".commit"));
              LOG.info("Committing [{0}] in path [{1}]", taskAttemptID, path);
            } else {
              fileSystem.delete(path, true);
              LOG.info("Deleteing tmp dir [{0}] in path [{1}]", taskAttemptID, path);
            }
View Full Code Here

            indexWriter.rollback();
            LOG.info("Finished rollback on [{0}/{1}]", shard, table);
            String name = dirPath.getName();
            int lastIndexOf = name.lastIndexOf('.');
            String badRowIdsName = name.substring(0, lastIndexOf) + ".bad_rowids";
            fileSystem.rename(dirPath, new Path(dirPath.getParent(), badRowIdsName));
          }
        }
      } finally {
        _lock.writeLock().unlock();
      }
View Full Code Here

      // FileSystem.rename is inconsistent with directories -- if the
      // dst (foo/a) exists and is a dir, and the src (foo/b) is a dir,
      // it moves the src into the dst dir resulting in (foo/a/b).  If
      // the dst does not exist, and the src a dir, src becomes dst. (foo/b)
      for (FileStatus hfile : fs.listStatus(src)) {
        boolean success = fs.rename(hfile.getPath(), dst);
        if (success) {
          fileMoves++;
        }
      }
      LOG.debug("Sideline directory contents:");
View Full Code Here

     
      fs.setReplication(file, (short)2);
      checkStatistics(fs, readOps, ++writeOps, largeReadOps);
     
      Path file1 = new Path(dir, "file1");
      fs.rename(file, file1);
      checkStatistics(fs, readOps, ++writeOps, largeReadOps);
     
      fs.getContentSummary(file1);
      checkStatistics(fs, ++readOps, writeOps, largeReadOps);
     
View Full Code Here

      }

      // Step 3 - Rename fs2:/.snapshot/.tmp/<snapshot> fs2:/.snapshot/<snapshot>
      if (!skipTmp) {
        // Step 3 - Rename fs2:/.snapshot/.tmp/<snapshot> fs2:/.snapshot/<snapshot>
        if (!outputFs.rename(snapshotTmpDir, outputSnapshotDir)) {
          throw new ExportSnapshotException("Unable to rename snapshot directory from=" +
            snapshotTmpDir + " to=" + outputSnapshotDir);
        }
      }
View Full Code Here

      Path hbaseTableDir = FSUtils.getTableDir(
          FSUtils.getRootDir(conf), table);
      fs = hbaseTableDir.getFileSystem(conf);
      FileStatus status = FSTableDescriptors.getTableInfoPath(fs, hbaseTableDir);
      tableinfo = status.getPath();
      fs.rename(tableinfo, new Path("/.tableinfo"));

      //to report error if .tableinfo is missing.
      HBaseFsck hbck = doFsck(conf, false);
      assertErrors(hbck, new ERROR_CODE[] { ERROR_CODE.NO_TABLEINFO_FILE });
View Full Code Here

      status = FSTableDescriptors.getTableInfoPath(fs, hbaseTableDir);
      assertNotNull(status);
      htd = admin.getTableDescriptor(table);
      assertEquals(htd.getValue("NOT_DEFAULT"), "true");
    } finally {
      fs.rename(new Path("/.tableinfo"), tableinfo);
      deleteTable(table);
    }
  }

  /**
 
View Full Code Here

              Path hfileStagingPath = null;
              Path hfileOrigPath = new Path(el.getSecond());
              try {
                hfileStagingPath= new Path(secureClient.getStagingPath(bulkToken, el.getFirst()),
                    hfileOrigPath.getName());
                if(fs.rename(hfileStagingPath, hfileOrigPath)) {
                  LOG.debug("Moved back file " + hfileOrigPath + " from " +
                      hfileStagingPath);
                } else if(fs.exists(hfileStagingPath)){
                  LOG.debug("Unable to move back file " + hfileOrigPath + " from " +
                      hfileStagingPath);
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.