ChenSammi commented on code in PR #10982:
URL: https://github.com/apache/ozone/pull/10982#discussion_r3764120303
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/lifecycle/OMLifecycleConfigurationSetRequest.java:
##########
@@ -203,6 +209,46 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, Execut
}
}
+ /**
+ * Rejects lifecycle configurations where an AbortIncompleteMultipartUpload
rule's
+ * daysAfterInitiation is greater than or equal to the cluster-wide MPU
expire threshold
+ * (ozone.om.open.mpu.expire.threshold). When that happens,
MultipartUploadCleanupService
+ * will reap the upload before the lifecycle rule ever fires, silently
making the rule
+ * ineffective. Failing fast here surfaces the misconfiguration to the
operator.
+ */
+ private static void validateAbortMpuDaysAgainstCleanupThreshold(
+ OzoneManager ozoneManager, LifecycleConfiguration config) throws
OMException {
+ long expireThresholdMillis =
ozoneManager.getConfiguration().getTimeDuration(
+ OMConfigKeys.OZONE_OM_MPU_EXPIRE_THRESHOLD,
+ OMConfigKeys.OZONE_OM_MPU_EXPIRE_THRESHOLD_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ long expireThresholdDays =
TimeUnit.MILLISECONDS.toDays(expireThresholdMillis);
+
+ for (LifecycleRule rule : config.getRulesList()) {
+ for (LifecycleAction action : rule.getActionList()) {
+ if (action.hasAbortIncompleteMultipartUpload()) {
+ int daysAfterInitiation =
action.getAbortIncompleteMultipartUpload().getDaysAfterInitiation();
+ if (daysAfterInitiation >= expireThresholdDays) {
+ throw new OMException(
+ "Invalid lifecycle configuration: rule '" + rule.getId() + "'
has an " +
+ "AbortIncompleteMultipartUpload action with
daysAfterInitiation=" + daysAfterInitiation +
+ " day(s), which is greater than or equal to the cluster MPU
expire threshold " +
+ expireThresholdDays + " day(s) (" +
+ OMConfigKeys.OZONE_OM_MPU_EXPIRE_THRESHOLD + "=" +
+ ozoneManager.getConfiguration().get(
+ OMConfigKeys.OZONE_OM_MPU_EXPIRE_THRESHOLD,
+ OMConfigKeys.OZONE_OM_MPU_EXPIRE_THRESHOLD_DEFAULT) +
+ "). The MultipartUploadCleanupService will abort the upload
before the " +
Review Comment:
abort -> cleanup
--
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]