Search in sources :

Example 1 with AddOp

use of org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.AddOp in project hadoop by apache.

the class FSEditLog method logOpenFile.

/** 
   * Add open lease record to edit log. 
   * Records the block locations of the last block.
   */
public void logOpenFile(String path, INodeFile newNode, boolean overwrite, boolean toLogRpcIds) {
    Preconditions.checkArgument(newNode.isUnderConstruction());
    PermissionStatus permissions = newNode.getPermissionStatus();
    AddOp op = AddOp.getInstance(cache.get()).setInodeId(newNode.getId()).setPath(path).setReplication(newNode.getFileReplication()).setModificationTime(newNode.getModificationTime()).setAccessTime(newNode.getAccessTime()).setBlockSize(newNode.getPreferredBlockSize()).setBlocks(newNode.getBlocks()).setPermissionStatus(permissions).setClientName(newNode.getFileUnderConstructionFeature().getClientName()).setClientMachine(newNode.getFileUnderConstructionFeature().getClientMachine()).setOverwrite(overwrite).setStoragePolicyId(newNode.getLocalStoragePolicyID());
    AclFeature f = newNode.getAclFeature();
    if (f != null) {
        op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode));
    }
    XAttrFeature x = newNode.getXAttrFeature();
    if (x != null) {
        op.setXAttrs(x.getXAttrs());
    }
    logRpcIds(op, toLogRpcIds);
    logEdit(op);
}
Also used : AddOp(org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.AddOp) PermissionStatus(org.apache.hadoop.fs.permission.PermissionStatus)

Aggregations

PermissionStatus (org.apache.hadoop.fs.permission.PermissionStatus)1 AddOp (org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.AddOp)1