use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode in project hadoop by apache.
the class PBImageTextWriter method outputINodes.
private void outputINodes(InputStream in) throws IOException {
INodeSection s = INodeSection.parseDelimitedFrom(in);
LOG.info("Found {} INodes in the INode section", s.getNumInodes());
long ignored = 0;
long ignoredSnapshots = 0;
for (int i = 0; i < s.getNumInodes(); ++i) {
INode p = INode.parseDelimitedFrom(in);
try {
String parentPath = metadataMap.getParentPath(p.getId());
out.println(getEntry(parentPath, p));
} catch (IOException ioe) {
ignored++;
if (!(ioe instanceof IgnoreSnapshotException)) {
LOG.warn("Exception caught, ignoring node:{}", p.getId(), ioe);
} else {
ignoredSnapshots++;
if (LOG.isDebugEnabled()) {
LOG.debug("Exception caught, ignoring node:{}.", p.getId(), ioe);
}
}
}
if (LOG.isDebugEnabled() && i % 100000 == 0) {
LOG.debug("Outputted {} INodes.", i);
}
}
if (ignored > 0) {
LOG.warn("Ignored {} nodes, including {} in snapshots. Please turn on" + " debug log for details", ignored, ignoredSnapshots);
}
LOG.info("Outputted {} INodes.", s.getNumInodes());
}
use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode in project hadoop by apache.
the class FSImageLoader method getContentSummaryMap.
private Map<String, Object> getContentSummaryMap(String path) throws IOException {
long id = lookup(path);
INode inode = fromINodeId(id);
long spaceQuota = 0;
long nsQuota = 0;
long[] data = new long[4];
FsImageProto.INodeSection.INodeFile f = inode.getFile();
switch(inode.getType()) {
case FILE:
data[0] = 0;
data[1] = 1;
data[2] = getFileSize(f);
nsQuota = -1;
data[3] = data[2] * f.getReplication();
spaceQuota = -1;
return fillSummaryMap(spaceQuota, nsQuota, data);
case DIRECTORY:
fillDirSummary(id, data);
nsQuota = inode.getDirectory().getNsQuota();
spaceQuota = inode.getDirectory().getDsQuota();
return fillSummaryMap(spaceQuota, nsQuota, data);
case SYMLINK:
data[0] = 0;
data[1] = 1;
data[2] = 0;
nsQuota = -1;
data[3] = 0;
spaceQuota = -1;
return fillSummaryMap(spaceQuota, nsQuota, data);
default:
return null;
}
}
use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode in project hadoop by apache.
the class FSImageLoader method getXAttrList.
private List<XAttr> getXAttrList(String path) throws IOException {
long id = lookup(path);
FsImageProto.INodeSection.INode inode = fromINodeId(id);
switch(inode.getType()) {
case FILE:
return FSImageFormatPBINode.Loader.loadXAttrs(inode.getFile().getXAttrs(), stringTable);
case DIRECTORY:
return FSImageFormatPBINode.Loader.loadXAttrs(inode.getDirectory().getXAttrs(), stringTable);
default:
return null;
}
}
use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode in project hadoop by apache.
the class FSImageLoader method getAclEntryList.
private List<AclEntry> getAclEntryList(String path) throws IOException {
long id = lookup(path);
FsImageProto.INodeSection.INode inode = fromINodeId(id);
switch(inode.getType()) {
case FILE:
{
FsImageProto.INodeSection.INodeFile f = inode.getFile();
return FSImageFormatPBINode.Loader.loadAclEntries(f.getAcl(), stringTable);
}
case DIRECTORY:
{
FsImageProto.INodeSection.INodeDirectory d = inode.getDirectory();
return FSImageFormatPBINode.Loader.loadAclEntries(d.getAcl(), stringTable);
}
default:
{
return new ArrayList<AclEntry>();
}
}
}
use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode in project hadoop by apache.
the class FSImageLoader method getPermissionStatus.
private PermissionStatus getPermissionStatus(String path) throws IOException {
long id = lookup(path);
FsImageProto.INodeSection.INode inode = fromINodeId(id);
switch(inode.getType()) {
case FILE:
{
FsImageProto.INodeSection.INodeFile f = inode.getFile();
return FSImageFormatPBINode.Loader.loadPermission(f.getPermission(), stringTable);
}
case DIRECTORY:
{
FsImageProto.INodeSection.INodeDirectory d = inode.getDirectory();
return FSImageFormatPBINode.Loader.loadPermission(d.getPermission(), stringTable);
}
case SYMLINK:
{
FsImageProto.INodeSection.INodeSymlink s = inode.getSymlink();
return FSImageFormatPBINode.Loader.loadPermission(s.getPermission(), stringTable);
}
default:
{
return null;
}
}
}
Aggregations