avijayanhwx commented on a change in pull request #2265:
URL: https://github.com/apache/ozone/pull/2265#discussion_r639226917



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/upgrade/OMLayoutFeatureAspect.java
##########
@@ -63,16 +68,47 @@ public void checkLayoutFeature(JoinPoint joinPoint) throws 
Throwable {
         lvm = new OMLayoutVersionManager();
       }
     }
+    checkIsAllowed(joinPoint.getSignature().toShortString(), lvm, featureName);
+  }
+
+  private void checkIsAllowed(String operationName,
+                              LayoutVersionManager lvm,
+                              String featureName) throws OMException {
     if (!lvm.isAllowed(featureName)) {
       LayoutFeature layoutFeature = lvm.getFeature(featureName);
       throw new OMException(String.format("Operation %s cannot be invoked " +
               "before finalization. It belongs to the layout feature %s, " +
               "whose layout version is %d. Current Layout version is %d",
-          joinPoint.getSignature().toShortString(),
+          operationName,
           layoutFeature.name(),
           layoutFeature.layoutVersion(),
           lvm.getMetadataLayoutVersion()),
           NOT_SUPPORTED_OPERATION);
     }
   }
+
+  @Pointcut("execution(* " +
+      "org.apache.hadoop.ozone.om.request.OMClientRequest+.preExecute(..)) " +
+      "&& @this(org.apache.hadoop.ozone.om.upgrade.BelongsToLayoutVersion)")
+  public void omRequestPointCut() {
+  }
+
+  @Before("omRequestPointCut()")
+  public void beforeRequestApplyTxn(final JoinPoint joinPoint)

Review comment:
       Yes, that is correct. The hierarchy is simple now, where the layout 
versions are a single line of increasing numbers. In the future, we may support 
more complex use cases like dependent layout features.




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

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