HDFS-7243. HDFS concat operation should not be allowed in Encryption Zone. (clamb via yliu)
This commit is contained in:
parent
e1baa3a503
commit
82ac5c901e
|
@ -579,6 +579,9 @@ Release 2.6.0 - UNRELEASED
|
|||
|
||||
HDFS-7180. NFSv3 gateway frequently gets stuck due to GC (brandonli)
|
||||
|
||||
HDFS-7243. HDFS concat operation should not be allowed in Encryption Zone.
|
||||
(clamb via yliu)
|
||||
|
||||
BREAKDOWN OF HDFS-6581 SUBTASKS AND RELATED JIRAS
|
||||
|
||||
HDFS-6921. Add LazyPersist flag to FileStatus. (Arpit Agarwal)
|
||||
|
|
|
@ -2040,7 +2040,12 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|||
// replication and blocks sizes should be the same for ALL the blocks
|
||||
|
||||
// check the target
|
||||
final INodeFile trgInode = INodeFile.valueOf(dir.getINode4Write(target),
|
||||
final INodesInPath trgIip = dir.getINodesInPath4Write(target);
|
||||
if (dir.getEZForPath(trgIip) != null) {
|
||||
throw new HadoopIllegalArgumentException(
|
||||
"concat can not be called for files in an encryption zone.");
|
||||
}
|
||||
final INodeFile trgInode = INodeFile.valueOf(trgIip.getLastINode(),
|
||||
target);
|
||||
if(trgInode.isUnderConstruction()) {
|
||||
throw new HadoopIllegalArgumentException("concat: target file "
|
||||
|
|
|
@ -1221,6 +1221,28 @@ public class TestEncryptionZones {
|
|||
fs.delete(target, true);
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
public void testConcatFailsInEncryptionZones() throws Exception {
|
||||
final int len = 8192;
|
||||
final Path ez = new Path("/ez");
|
||||
fs.mkdirs(ez);
|
||||
dfsAdmin.createEncryptionZone(ez, TEST_KEY);
|
||||
final Path src1 = new Path(ez, "src1");
|
||||
final Path src2 = new Path(ez, "src2");
|
||||
final Path target = new Path(ez, "target");
|
||||
DFSTestUtil.createFile(fs, src1, len, (short)1, 0xFEED);
|
||||
DFSTestUtil.createFile(fs, src2, len, (short)1, 0xFEED);
|
||||
DFSTestUtil.createFile(fs, target, len, (short)1, 0xFEED);
|
||||
try {
|
||||
fs.concat(target, new Path[] { src1, src2 });
|
||||
fail("expected concat to throw en exception for files in an ez");
|
||||
} catch (IOException e) {
|
||||
assertExceptionContains(
|
||||
"concat can not be called for files in an encryption zone", e);
|
||||
}
|
||||
fs.delete(ez, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test running the OfflineImageViewer on a system with encryption zones.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue