HDFS-7124. Remove EncryptionZoneManager.NULL_EZ. (clamb via wang)
(cherry picked from commit 7f0efe96f8
)
This commit is contained in:
parent
d551a95fc4
commit
38f3b11c29
|
@ -265,6 +265,8 @@ Release 2.6.0 - UNRELEASED
|
||||||
|
|
||||||
HDFS-7104. Fix and clarify INodeInPath getter functions. (Zhe Zhang via wang)
|
HDFS-7104. Fix and clarify INodeInPath getter functions. (Zhe Zhang via wang)
|
||||||
|
|
||||||
|
HDFS-7124. Remove EncryptionZoneManager.NULL_EZ. (clamb via wang)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-6690. Deduplicate xattr names in memory. (wang)
|
HDFS-6690. Deduplicate xattr names in memory. (wang)
|
||||||
|
|
|
@ -2940,8 +2940,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
||||||
throws IOException {
|
throws IOException {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
final EncryptionZone ez = namenode.getEZForPath(src);
|
return namenode.getEZForPath(src);
|
||||||
return (ez.getId() < 0) ? null : ez;
|
|
||||||
} catch (RemoteException re) {
|
} catch (RemoteException re) {
|
||||||
throw re.unwrapRemoteException(AccessControlException.class,
|
throw re.unwrapRemoteException(AccessControlException.class,
|
||||||
UnresolvedPathException.class);
|
UnresolvedPathException.class);
|
||||||
|
|
|
@ -1340,7 +1340,9 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
||||||
GetEZForPathResponseProto.Builder builder =
|
GetEZForPathResponseProto.Builder builder =
|
||||||
GetEZForPathResponseProto.newBuilder();
|
GetEZForPathResponseProto.newBuilder();
|
||||||
final EncryptionZone ret = server.getEZForPath(req.getSrc());
|
final EncryptionZone ret = server.getEZForPath(req.getSrc());
|
||||||
|
if (ret != null) {
|
||||||
builder.setZone(PBHelper.convert(ret));
|
builder.setZone(PBHelper.convert(ret));
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
|
|
@ -1347,7 +1347,11 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
||||||
try {
|
try {
|
||||||
final EncryptionZonesProtos.GetEZForPathResponseProto response =
|
final EncryptionZonesProtos.GetEZForPathResponseProto response =
|
||||||
rpcProxy.getEZForPath(null, req);
|
rpcProxy.getEZForPath(null, req);
|
||||||
|
if (response.hasZone()) {
|
||||||
return PBHelper.convert(response.getZone());
|
return PBHelper.convert(response.getZone());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
throw ProtobufHelper.getRemoteException(e);
|
throw ProtobufHelper.getRemoteException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,6 @@ public class EncryptionZoneManager {
|
||||||
public static Logger LOG = LoggerFactory.getLogger(EncryptionZoneManager
|
public static Logger LOG = LoggerFactory.getLogger(EncryptionZoneManager
|
||||||
.class);
|
.class);
|
||||||
|
|
||||||
public static final EncryptionZone NULL_EZ =
|
|
||||||
new EncryptionZone(-1, "", CipherSuite.UNKNOWN,
|
|
||||||
CryptoProtocolVersion.UNKNOWN, "");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EncryptionZoneInt is the internal representation of an encryption zone. The
|
* EncryptionZoneInt is the internal representation of an encryption zone. The
|
||||||
* external representation of an EZ is embodied in an EncryptionZone and
|
* external representation of an EZ is embodied in an EncryptionZone and
|
||||||
|
@ -226,7 +222,7 @@ public class EncryptionZoneManager {
|
||||||
EncryptionZone getEZINodeForPath(INodesInPath iip) {
|
EncryptionZone getEZINodeForPath(INodesInPath iip) {
|
||||||
final EncryptionZoneInt ezi = getEncryptionZoneForPath(iip);
|
final EncryptionZoneInt ezi = getEncryptionZoneForPath(iip);
|
||||||
if (ezi == null) {
|
if (ezi == null) {
|
||||||
return NULL_EZ;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return new EncryptionZone(ezi.getINodeId(), getFullPathName(ezi),
|
return new EncryptionZone(ezi.getINodeId(), getFullPathName(ezi),
|
||||||
ezi.getSuite(), ezi.getVersion(), ezi.getKeyName());
|
ezi.getSuite(), ezi.getVersion(), ezi.getKeyName());
|
||||||
|
|
|
@ -2846,8 +2846,7 @@ public class FSDirectory implements Closeable {
|
||||||
iip = getINodesInPath(inode.getFullPathName(), true);
|
iip = getINodesInPath(inode.getFullPathName(), true);
|
||||||
}
|
}
|
||||||
EncryptionZone encryptionZone = getEZForPath(iip);
|
EncryptionZone encryptionZone = getEZForPath(iip);
|
||||||
if (encryptionZone == null ||
|
if (encryptionZone == null) {
|
||||||
encryptionZone.equals(EncryptionZoneManager.NULL_EZ)) {
|
|
||||||
// not an encrypted file
|
// not an encrypted file
|
||||||
return null;
|
return null;
|
||||||
} else if(encryptionZone.getPath() == null
|
} else if(encryptionZone.getPath() == null
|
||||||
|
|
|
@ -63,5 +63,5 @@ message GetEZForPathRequestProto {
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetEZForPathResponseProto {
|
message GetEZForPathResponseProto {
|
||||||
required EncryptionZoneProto zone = 1;
|
optional EncryptionZoneProto zone = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue