mchades commented on code in PR #8707:
URL: https://github.com/apache/gravitino/pull/8707#discussion_r2390258349
##########
core/src/main/java/org/apache/gravitino/job/JobManager.java:
##########
@@ -300,6 +301,49 @@ public boolean deleteJobTemplate(String metalake, String
jobTemplateName) throws
});
}
+ @Override
+ public JobTemplateEntity alterJobTemplate(
+ String metalake, String jobTemplateName, JobTemplateChange... changes)
+ throws NoSuchJobTemplateException, IllegalArgumentException {
+ checkMetalake(NameIdentifierUtil.ofMetalake(metalake), entityStore);
+
+ Optional<String> newName =
+ Arrays.stream(changes)
+ .filter(c -> c instanceof JobTemplateChange.RenameJobTemplate)
+ .map(c -> ((JobTemplateChange.RenameJobTemplate) c).getNewName())
+ .reduce((first, second) -> second);
+
+ NameIdentifier jobTemplateIdent =
NameIdentifierUtil.ofJobTemplate(metalake, jobTemplateName);
+ return TreeLockUtils.doWithTreeLock(
+ jobTemplateIdent,
+ LockType.WRITE,
Review Comment:
Should we use a read lock only when there are no rename operations?
--
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]