anuragp010 commented on code in PR #11926:
URL: https://github.com/apache/ozone/pull/11926#discussion_r4466348379


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ContainerImporter.java:
##########
@@ -152,13 +160,26 @@ private static void deleteFileQuietely(Path tarFilePath) {
   }
 
   HddsVolume chooseNextVolume(long spaceToReserve) throws IOException {

Review Comment:
   nit: Is this method required? The only caller for the single arg 
`chooseNextVolume` is `testChooseNextVolumeStorageType` which is verifying if 
passing a `null` storage type results in `null` being passed through to 
`volumeChoosingPolicy.chooseVolume`. There exists no other production flow 
caller for this method.



##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestReplicationManager.java:
##########
@@ -1219,26 +1221,46 @@ public void testSendDatanodeReconstructCommand() throws 
NotLeaderException {
    * target has the correct deadline and that ContainerReplicaOp for
    * replica ADD is created correctly.
    */
-  @Test
-  public void testReplicateContainerCommandToTarget()
-      throws NotLeaderException {
-    // create a closed EC container
-    ECReplicationConfig ecRepConfig = new ECReplicationConfig(3, 2);
+  @ParameterizedTest
+  @CsvSource({
+      "0, SSD, ARCHIVE, ARCHIVE",
+      "1, SSD, ARCHIVE, ARCHIVE",
+      "0, ARCHIVE, SSD, SSD",
+      "1, ARCHIVE, SSD, SSD",
+      "0, SSD, DISK, DISK",
+      "1, SSD, DISK, DISK",
+      "0, SSD, , SSD",
+      "1, SSD, , SSD",
+      "0, , ARCHIVE, ARCHIVE",
+      "1, , ARCHIVE, ARCHIVE",
+      "0, EMPTY, SSD, SSD",
+      "1, EMPTY, SSD, SSD",
+      "0, , , ",
+      "1, , , ",
+      "0, EMPTY, , ",
+      "1, EMPTY, , "
+  })
+  public void testReplicateContainerCommandToTarget(int replicaIndex, 
StorageTier storageTier,
+      StorageType commandStorageType, StorageType expectedStorageType) throws 
NotLeaderException {

Review Comment:
   If we prefer `storageType` over `volumeStorageType` for a 
`ContainerReplica`, could we then derive the `commandStorageType` from the 
`storageTier` on this test?



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ContainerImporter.java:
##########
@@ -121,6 +125,10 @@ public void importContainer(long containerID, Path 
tarFilePath,
       }
       ContainerUtils.verifyContainerFileChecksum(containerData, conf);
       containerData.setVolume(targetVolume);
+      // The descriptor carries the source volume's storage type. Record the

Review Comment:
   As discussed, should we prioritise the `ContainerReplica`'s `storageType` 
over the volume's storage type? This way we would be staying true to SCM's 
metadata. (`ContainerInfo` contains a `storageTier` field which is mapped to 
the `ContainerReplica`'s `storageType` field. `volumeStorageType` could change 
as a result of relabelling, diverging from the replica's intended storage type).



-- 
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