HDFS-4707. Add snapshot methods to FilterFileSystem and fix findbugs warnings.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1469119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2186912ff9
commit
0ad27ad3e3
@ -462,4 +462,22 @@ protected boolean primitiveMkdir(Path f, FsPermission abdolutePermission)
|
||||
public FileSystem[] getChildFileSystems() {
|
||||
return new FileSystem[]{fs};
|
||||
}
|
||||
|
||||
@Override // FileSystem
|
||||
public Path createSnapshot(Path path, String snapshotName)
|
||||
throws IOException {
|
||||
return fs.createSnapshot(path, snapshotName);
|
||||
}
|
||||
|
||||
@Override // FileSystem
|
||||
public void renameSnapshot(Path path, String snapshotOldName,
|
||||
String snapshotNewName) throws IOException {
|
||||
fs.renameSnapshot(path, snapshotOldName, snapshotNewName);
|
||||
}
|
||||
|
||||
@Override // FileSystem
|
||||
public void deleteSnapshot(Path path, String snapshotName)
|
||||
throws IOException {
|
||||
fs.deleteSnapshot(path, snapshotName);
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,8 @@ public void testFilterFileSystem() throws Exception {
|
||||
continue;
|
||||
if (Modifier.isPrivate(m.getModifiers()))
|
||||
continue;
|
||||
if (Modifier.isFinal(m.getModifiers()))
|
||||
continue;
|
||||
|
||||
try {
|
||||
DontCheck.class.getMethod(m.getName(), m.getParameterTypes());
|
||||
|
@ -250,3 +250,6 @@ Branch-2802 Snapshot (Unreleased)
|
||||
|
||||
HDFS-4550. Refactor INodeDirectory.INodesInPath to a standalone class.
|
||||
(szetszwo)
|
||||
|
||||
HDFS-4707. Add snapshot methods to FilterFileSystem and fix findbugs warnings.
|
||||
(szetszwo)
|
||||
|
@ -35,6 +35,7 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
@ -1001,14 +1002,13 @@ private void saveImage(ByteBuffer currentDirName, INodeDirectory current,
|
||||
currentDirName.position(prefixLen);
|
||||
}
|
||||
if (snapshotDirMap != null) {
|
||||
for (Snapshot ss : snapshotDirMap.keySet()) {
|
||||
List<INodeDirectory> snapshotSubDirs = snapshotDirMap.get(ss);
|
||||
for (INodeDirectory subDir : snapshotSubDirs) {
|
||||
for (Entry<Snapshot, List<INodeDirectory>> e : snapshotDirMap.entrySet()) {
|
||||
for (INodeDirectory subDir : e.getValue()) {
|
||||
// make sure we only save the subtree under a reference node once
|
||||
boolean toSave = subDir.getParentReference() != null ?
|
||||
referenceMap.toProcessSubtree(subDir.getId()) : true;
|
||||
currentDirName.put(PATH_SEPARATOR).put(subDir.getLocalNameBytes());
|
||||
saveImage(currentDirName, subDir, out, ss, toSave);
|
||||
saveImage(currentDirName, subDir, out, e.getKey(), toSave);
|
||||
currentDirName.position(prefixLen);
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public static void writeINodeFile(INodeFile file, DataOutput out,
|
||||
SnapshotFSImageFormat.saveFileDiffList(file, out);
|
||||
|
||||
if (writeUnderConstruction) {
|
||||
if (file.isUnderConstruction()) {
|
||||
if (file instanceof INodeFileUnderConstruction) {
|
||||
out.writeBoolean(true);
|
||||
final INodeFileUnderConstruction uc = (INodeFileUnderConstruction)file;
|
||||
writeString(uc.getClientName(), out);
|
||||
|
@ -113,7 +113,7 @@ public static Snapshot findLatestSnapshot(INode inode, Snapshot anchor) {
|
||||
}
|
||||
|
||||
/** The root directory of the snapshot. */
|
||||
public class Root extends INodeDirectory {
|
||||
static public class Root extends INodeDirectory {
|
||||
Root(INodeDirectory other) {
|
||||
super(other, false);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public static void loadSnapshotList(
|
||||
public static void loadDirectoryDiffList(INodeDirectory dir,
|
||||
DataInput in, FSImageFormat.Loader loader) throws IOException {
|
||||
final int size = in.readInt();
|
||||
if (size != -1) {
|
||||
if (dir instanceof INodeDirectoryWithSnapshot) {
|
||||
INodeDirectoryWithSnapshot withSnapshot = (INodeDirectoryWithSnapshot)dir;
|
||||
DirectoryDiffList diffs = withSnapshot.getDiffs();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user