hfutatzhanghb commented on code in PR #6368:
URL: https://github.com/apache/hadoop/pull/6368#discussion_r1458465700


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSOutputStream.java:
##########
@@ -184,6 +186,40 @@ public void testPreventOverflow() throws IOException, 
NoSuchFieldException,
     runAdjustChunkBoundary(configuredWritePacketSize, finalWritePacketSize);
   }
 
+  @Test(timeout=60000)
+  public void testFirstPacketSizeInNewBlocks() throws IOException {
+    final long blockSize = 1L * 1024 * 1024;
+    final int numDataNodes = 3;
+    final Configuration dfsConf = new Configuration();
+    dfsConf.setLong(DFS_BLOCK_SIZE_KEY, blockSize);
+    MiniDFSCluster dfsCluster = null;
+    dfsCluster = new 
MiniDFSCluster.Builder(dfsConf).numDataNodes(numDataNodes).build();
+    dfsCluster.waitActive();
+
+    DistributedFileSystem fs = dfsCluster.getFileSystem();
+    Path fileName = new Path("/testfile.dat");
+    FSDataOutputStream fos = fs.create(fileName);
+    DataChecksum crc32c = 
DataChecksum.newDataChecksum(DataChecksum.Type.CRC32C, 512);
+
+    long loop = 0;
+    Random r = new Random();
+    byte[] buf = new byte[1 * 1024 * 1024];
+    r.nextBytes(buf);
+    fos.write(buf);
+    fos.hflush();
+
+    while (loop < 20) {
+      r.nextBytes(buf);
+      fos.write(buf);
+      fos.hflush();
+      loop++;
+      Assert.assertNotEquals(crc32c.getBytesPerChecksum() + 
crc32c.getChecksumSize(),

Review Comment:
   Sir, thanks for this valuable suggestion. Will fix it soon.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to