rakeshadr commented on a change in pull request #2265:
URL: https://github.com/apache/ozone/pull/2265#discussion_r638511923
##########
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:
Thanks @avijayanhwx for the example case. IIUC the layout version
concept, this allows to build a hierarchy of features or develop new feature on
top of an existing layout feature safely.
For example, this is the hierarchy of feature list :
@BelongsToLayoutVersion("INITIAL_VERSION") -> @BelongsToLayoutVersion("FSO") ->
@BelongsToLayoutVersion("NFS") -> @BelongsToLayoutVersion("POSIX")
```
OMLayoutFeature{
INITIAL_VERSION(0, ""),
FSO(1, ""),
NFS(2, ""),
POSIX(3, "");
}
```
This way, two new feature also can co-exists, which should be greater than
the existing layout version number. Today, there is no such case, but just
would like to understand the function.
```
AbstractLayoutVersionManager.java
public boolean isAllowed(LayoutFeature layoutFeature) {
return layoutFeature.layoutVersion() <= metadataLayoutVersion;
}
```
--
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]