ivandika3 commented on code in PR #10946:
URL: https://github.com/apache/ozone/pull/10946#discussion_r3771945651


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java:
##########
@@ -171,28 +172,48 @@ public AllocatedBlock allocateBlock(final long size,
     // configured, it will be of type StorageType.DISK and therefore belong
     // to a StorageTier.DISK tier, so for old clients the write process is
     // unchanged if the Datanode Volume configuration is not changed.
-    StorageTier storageTier = StorageTier.getDefaultTier();
-    ContainerInfo containerInfo = writableContainerFactory.getContainer(
-        size, replicationConfig, owner, excludeList, storageTier);
+    boolean isFallBack = false;
+    ContainerInfo containerInfo = null;
+    try {
+      containerInfo = writableContainerFactory.getContainer(
+          size, replicationConfig, owner, excludeList, 
storagePolicy.getCreationTier());
+    } catch (IOException e) {
+      if (allowFallbackStoragePolicy && 
storagePolicy.getCreationFallbackTier() != StorageTier.EMPTY) {
+        // TODO StoragePolicy should It should be distinguished in detail 
which exceptions can try to fallback
+        isFallBack = true;
+        containerInfo = writableContainerFactory.getContainer(size, 
replicationConfig, owner,
+            excludeList, storagePolicy.getCreationFallbackTier());
+      } else {
+        throw e;
+      }

Review Comment:
   Should we throw the exception here? Internally, we don't throw exception 
here.
   
   I just reviewed BlockManagerImpl#allocateBlock logic. It seems currently we 
will allow letting the `allocateBlock` to return null, but we simply skip this 
block. Meaning if client asks for 2 blocks, but only 1 is provided, then we 
will return only 1 block instead of failing the whole request. Is this expected 
behavior? We should clarify this logic, this is important.



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