manika137 commented on code in PR #7777:
URL: https://github.com/apache/hadoop/pull/7777#discussion_r2204544838


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAppend.java:
##########
@@ -1041,16 +1041,14 @@ public void testWriteAsyncOpFailedAfterCloseCalled() 
throws Exception {
 
   /**
    * Helper method that generates blockId.
-   * @param position The offset needed to generate blockId.
    * @return String representing the block ID generated.
    */
-  private String generateBlockId(AbfsOutputStream os, long position) {
+  private String generateBlockId(AbfsOutputStream os) {
     String streamId = os.getStreamID();
-    String streamIdHash = Integer.toString(streamId.hashCode());
-    String blockId = String.format("%d_%s", position, streamIdHash);
-    byte[] blockIdByteArray = new byte[BLOCK_ID_LENGTH];
-    System.arraycopy(blockId.getBytes(), 0, blockIdByteArray, 0, 
Math.min(BLOCK_ID_LENGTH, blockId.length()));
-    return new String(Base64.encodeBase64(blockIdByteArray), 
StandardCharsets.UTF_8);
+    UUID streamIdGuid = 
UUID.nameUUIDFromBytes(streamId.getBytes(StandardCharsets.UTF_8));
+    long blockIndex = os.getBlockManager().getBlockCount();
+    String rawBlockId = String.format("%s-%06d", streamIdGuid, blockIndex);

Review Comment:
   we can use the constant BLOCK_ID_FORMAT



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to