jojochuang commented on code in PR #3489:
URL: https://github.com/apache/ozone/pull/3489#discussion_r891662348
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientUtils.java:
##########
@@ -205,8 +207,19 @@ public static FileChecksum
getFileChecksumWithCombineMode(OzoneVolume volume,
if (keyName.length() == 0) {
return null;
}
- BaseFileChecksumHelper helper = new ReplicatedFileChecksumHelper(
- volume, bucket, keyName, length, combineMode, rpcClient);
+ OmKeyArgs keyArgs = new OmKeyArgs.Builder().setVolumeName(volume.getName())
+ .setBucketName(bucket.getName()).setKeyName(keyName)
+ .setRefreshPipeline(true).setSortDatanodesInPipeline(true)
+ .setLatestVersionLocation(true).build();
+ OmKeyInfo keyInfo = rpcClient.getOzoneManagerClient().lookupKey(keyArgs);
+
+ if (keyInfo.getReplicationConfig()
Review Comment:
can you add a TODO comment here? Like:
```suggestion
// TODO: return null util ECFileChecksum is implemented
if (keyInfo.getReplicationConfig()
```
##########
hadoop-ozone/ozonefs-common/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneClientUtils.java:
##########
@@ -72,6 +76,34 @@ public void testEmptyKeyName() throws IOException {
assertNull(checksum);
}
+ @Test
+ public void testGetFileChecksumForECFileShouldReturnNull()
+ throws IOException {
+ OzoneVolume volume = mock(OzoneVolume.class);
+ OzoneBucket bucket = mock(OzoneBucket.class);
+ ClientProtocol clientProtocol = mock(ClientProtocol.class);
+ OzoneManagerProtocol ozoneManagerProtocol =
+ mock(OzoneManagerProtocol.class);
+ try {
+ OmKeyInfo omKeyInfo = new OmKeyInfo.Builder()
+ .setReplicationConfig(new ECReplicationConfig("rs-3-2-1024K"))
+ .setVolumeName("vol").setBucketName("bucket").setKeyName("mykey")
+ .setDataSize(10).setCreationTime(1).setModificationTime(1).build();
+ Mockito.when(clientProtocol.getOzoneManagerClient())
+ .thenReturn(ozoneManagerProtocol);
+
Mockito.when(ozoneManagerProtocol.lookupKey(any())).thenReturn(omKeyInfo);
+ FileChecksum checksum = OzoneClientUtils
+ .getFileChecksumWithCombineMode(volume, bucket, "test", 1,
+ OzoneClientConfig.ChecksumCombineMode.MD5MD5CRC, clientProtocol);
+ assertNull(checksum);
+ } finally {
+ Mockito.reset(volume);
+ Mockito.reset(bucket);
+ Mockito.reset(volume);
+ Mockito.reset(volume);
Review Comment:
i'm not familiar with this. Is it required to reset volume multiple times?
--
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]