Java 类org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotManager 实例源码

项目:hadoop    文件:FSDirSnapshotOp.java   
static void renameSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
    String path, String snapshotOldName, String snapshotNewName,
    boolean logRetryCache) throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(path);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }
  verifySnapshotName(fsd, snapshotNewName, path);
  fsd.writeLock();
  try {
    snapshotManager.renameSnapshot(iip, path, snapshotOldName,
        snapshotNewName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logRenameSnapshot(path, snapshotOldName,
      snapshotNewName, logRetryCache);
}
项目:hadoop    文件:FSDirSnapshotOp.java   
static SnapshotDiffReport getSnapshotDiffReport(FSDirectory fsd,
    SnapshotManager snapshotManager, String path,
    String fromSnapshot, String toSnapshot) throws IOException {
  SnapshotDiffReport diffs;
  final FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    if (fsd.isPermissionEnabled()) {
      checkSubtreeReadPermission(fsd, pc, path, fromSnapshot);
      checkSubtreeReadPermission(fsd, pc, path, toSnapshot);
    }
    INodesInPath iip = fsd.getINodesInPath(path, true);
    diffs = snapshotManager.diff(iip, path, fromSnapshot, toSnapshot);
  } finally {
    fsd.readUnlock();
  }
  return diffs;
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
static void renameSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
    String path, String snapshotOldName, String snapshotNewName,
    boolean logRetryCache) throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(path);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }
  verifySnapshotName(fsd, snapshotNewName, path);
  fsd.writeLock();
  try {
    snapshotManager.renameSnapshot(iip, path, snapshotOldName,
        snapshotNewName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logRenameSnapshot(path, snapshotOldName,
      snapshotNewName, logRetryCache);
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
static SnapshotDiffReport getSnapshotDiffReport(FSDirectory fsd,
    SnapshotManager snapshotManager, String path,
    String fromSnapshot, String toSnapshot) throws IOException {
  SnapshotDiffReport diffs;
  final FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    if (fsd.isPermissionEnabled()) {
      checkSubtreeReadPermission(fsd, pc, path, fromSnapshot);
      checkSubtreeReadPermission(fsd, pc, path, toSnapshot);
    }
    INodesInPath iip = fsd.getINodesInPath(path, true);
    diffs = snapshotManager.diff(iip, path, fromSnapshot, toSnapshot);
  } finally {
    fsd.readUnlock();
  }
  return diffs;
}
项目:big-c    文件:FSDirSnapshotOp.java   
static void renameSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
    String path, String snapshotOldName, String snapshotNewName,
    boolean logRetryCache) throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(path);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }
  verifySnapshotName(fsd, snapshotNewName, path);
  fsd.writeLock();
  try {
    snapshotManager.renameSnapshot(iip, path, snapshotOldName,
        snapshotNewName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logRenameSnapshot(path, snapshotOldName,
      snapshotNewName, logRetryCache);
}
项目:big-c    文件:FSDirSnapshotOp.java   
static SnapshotDiffReport getSnapshotDiffReport(FSDirectory fsd,
    SnapshotManager snapshotManager, String path,
    String fromSnapshot, String toSnapshot) throws IOException {
  SnapshotDiffReport diffs;
  final FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    if (fsd.isPermissionEnabled()) {
      checkSubtreeReadPermission(fsd, pc, path, fromSnapshot);
      checkSubtreeReadPermission(fsd, pc, path, toSnapshot);
    }
    INodesInPath iip = fsd.getINodesInPath(path, true);
    diffs = snapshotManager.diff(iip, path, fromSnapshot, toSnapshot);
  } finally {
    fsd.readUnlock();
  }
  return diffs;
}
项目:hadoop    文件:FSDirSnapshotOp.java   
/** Allow snapshot on a directory. */
static void allowSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
                          String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.setSnapshottable(path, true);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logAllowSnapshot(path);
}
项目:hadoop    文件:FSDirSnapshotOp.java   
static void disallowSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager,
    String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.resetSnapshottable(path);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logDisallowSnapshot(path);
}
项目:hadoop    文件:FSDirSnapshotOp.java   
/**
 * Create a snapshot
 * @param snapshotRoot The directory path where the snapshot is taken
 * @param snapshotName The name of the snapshot
 */
static String createSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  if (snapshotName == null || snapshotName.isEmpty()) {
    snapshotName = Snapshot.generateDefaultSnapshotName();
  } else if (!DFSUtil.isValidNameForComponent(snapshotName)) {
    throw new InvalidPathException("Invalid snapshot name: " + snapshotName);
  }

  String snapshotPath = null;
  verifySnapshotName(fsd, snapshotName, snapshotRoot);
  fsd.writeLock();
  try {
    snapshotPath = snapshotManager.createSnapshot(iip, snapshotRoot,
        snapshotName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logCreateSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return snapshotPath;
}
项目:hadoop    文件:FSDirSnapshotOp.java   
static SnapshottableDirectoryStatus[] getSnapshottableDirListing(
    FSDirectory fsd, SnapshotManager snapshotManager) throws IOException {
  FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    final String user = pc.isSuperUser()? null : pc.getUser();
    return snapshotManager.getSnapshottableDirListing(user);
  } finally {
    fsd.readUnlock();
  }
}
项目:hadoop    文件:FSDirSnapshotOp.java   
/**
 * Delete a snapshot of a snapshottable directory
 * @param snapshotRoot The snapshottable directory
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws IOException
 */
static INode.BlocksMapUpdateInfo deleteSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo();
  ChunkedArrayList<INode> removedINodes = new ChunkedArrayList<INode>();
  fsd.writeLock();
  try {
    snapshotManager.deleteSnapshot(iip, snapshotName, collectedBlocks,
        removedINodes);
    fsd.removeFromInodeMap(removedINodes);
  } finally {
    fsd.writeUnlock();
  }
  removedINodes.clear();
  fsd.getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return collectedBlocks;
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
/** Allow snapshot on a directory. */
static void allowSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
                          String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.setSnapshottable(path, true);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logAllowSnapshot(path);
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
static void disallowSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager,
    String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.resetSnapshottable(path);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logDisallowSnapshot(path);
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
/**
 * Create a snapshot
 * @param snapshotRoot The directory path where the snapshot is taken
 * @param snapshotName The name of the snapshot
 */
static String createSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  if (snapshotName == null || snapshotName.isEmpty()) {
    snapshotName = Snapshot.generateDefaultSnapshotName();
  } else if (!DFSUtil.isValidNameForComponent(snapshotName)) {
    throw new InvalidPathException("Invalid snapshot name: " + snapshotName);
  }

  String snapshotPath = null;
  verifySnapshotName(fsd, snapshotName, snapshotRoot);
  fsd.writeLock();
  try {
    snapshotPath = snapshotManager.createSnapshot(iip, snapshotRoot,
        snapshotName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logCreateSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return snapshotPath;
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
static SnapshottableDirectoryStatus[] getSnapshottableDirListing(
    FSDirectory fsd, SnapshotManager snapshotManager) throws IOException {
  FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    final String user = pc.isSuperUser()? null : pc.getUser();
    return snapshotManager.getSnapshottableDirListing(user);
  } finally {
    fsd.readUnlock();
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
/**
 * Delete a snapshot of a snapshottable directory
 * @param snapshotRoot The snapshottable directory
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws IOException
 */
static INode.BlocksMapUpdateInfo deleteSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo();
  ChunkedArrayList<INode> removedINodes = new ChunkedArrayList<>();
  INode.ReclaimContext context = new INode.ReclaimContext(
      fsd.getBlockStoragePolicySuite(), collectedBlocks, removedINodes, null);
  fsd.writeLock();
  try {
    snapshotManager.deleteSnapshot(iip, snapshotName, context);
    fsd.updateCount(iip, context.quotaDelta(), false);
    fsd.removeFromInodeMap(removedINodes);
    fsd.updateReplicationFactor(context.collectedBlocks()
                                    .toUpdateReplicationInfo());
  } finally {
    fsd.writeUnlock();
  }
  removedINodes.clear();
  fsd.getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return collectedBlocks;
}
项目:big-c    文件:FSDirSnapshotOp.java   
/** Allow snapshot on a directory. */
static void allowSnapshot(FSDirectory fsd, SnapshotManager snapshotManager,
                          String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.setSnapshottable(path, true);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logAllowSnapshot(path);
}
项目:big-c    文件:FSDirSnapshotOp.java   
static void disallowSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager,
    String path) throws IOException {
  fsd.writeLock();
  try {
    snapshotManager.resetSnapshottable(path);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logDisallowSnapshot(path);
}
项目:big-c    文件:FSDirSnapshotOp.java   
/**
 * Create a snapshot
 * @param snapshotRoot The directory path where the snapshot is taken
 * @param snapshotName The name of the snapshot
 */
static String createSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  if (snapshotName == null || snapshotName.isEmpty()) {
    snapshotName = Snapshot.generateDefaultSnapshotName();
  } else if (!DFSUtil.isValidNameForComponent(snapshotName)) {
    throw new InvalidPathException("Invalid snapshot name: " + snapshotName);
  }

  String snapshotPath = null;
  verifySnapshotName(fsd, snapshotName, snapshotRoot);
  fsd.writeLock();
  try {
    snapshotPath = snapshotManager.createSnapshot(iip, snapshotRoot,
        snapshotName);
  } finally {
    fsd.writeUnlock();
  }
  fsd.getEditLog().logCreateSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return snapshotPath;
}
项目:big-c    文件:FSDirSnapshotOp.java   
static SnapshottableDirectoryStatus[] getSnapshottableDirListing(
    FSDirectory fsd, SnapshotManager snapshotManager) throws IOException {
  FSPermissionChecker pc = fsd.getPermissionChecker();
  fsd.readLock();
  try {
    final String user = pc.isSuperUser()? null : pc.getUser();
    return snapshotManager.getSnapshottableDirListing(user);
  } finally {
    fsd.readUnlock();
  }
}
项目:big-c    文件:FSDirSnapshotOp.java   
/**
 * Delete a snapshot of a snapshottable directory
 * @param snapshotRoot The snapshottable directory
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws IOException
 */
static INode.BlocksMapUpdateInfo deleteSnapshot(
    FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot,
    String snapshotName, boolean logRetryCache)
    throws IOException {
  final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot);
  if (fsd.isPermissionEnabled()) {
    FSPermissionChecker pc = fsd.getPermissionChecker();
    fsd.checkOwner(pc, iip);
  }

  INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo();
  ChunkedArrayList<INode> removedINodes = new ChunkedArrayList<INode>();
  fsd.writeLock();
  try {
    snapshotManager.deleteSnapshot(iip, snapshotName, collectedBlocks,
        removedINodes);
    fsd.removeFromInodeMap(removedINodes);
  } finally {
    fsd.writeUnlock();
  }
  removedINodes.clear();
  fsd.getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName,
      logRetryCache);

  return collectedBlocks;
}
项目:hadoop    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:aliyun-oss-hadoop-fs    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:big-c    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:hadoop-plus    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:FlexMap    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:hadoop-TCP    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:hardfs    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}
项目:hadoop-on-lustre2    文件:FSNamesystem.java   
public SnapshotManager getSnapshotManager() {
  return snapshotManager;
}