yuqi1129 commented on code in PR #13558:
URL: https://github.com/apache/gravitino/pull/13558#discussion_r4217144196


##########
core/src/test/java/org/apache/gravitino/storage/relational/service/TestJobTemplateMetaService.java:
##########
@@ -284,11 +294,86 @@ public void testUpdateJobTemplate() throws IOException {
             .withAuditInfo(updatedJobTemplateEntity.auditInfo())
             .build();
 
+    long lastChangeId = maxEntityChangeId();
     Assertions.assertThrows(
         EntityAlreadyExistsException.class,
         () ->
             jobTemplateMetaService.updateJobTemplate(
                 updatedJobTemplateEntity.nameIdentifier(), e -> 
duplicateNameJobTemplateEntity));
+    // The rejected rename rolls back with its change-log record.
+    Assertions.assertTrue(jobTemplateChangesAfter(lastChangeId).isEmpty());
+  }
+
+  @TestTemplate
+  public void testRenameAndDeleteJobTemplateLogChanges() throws IOException {

Review Comment:
   `TestJobTemplateMetaService` extends `TestJDBCBackend`, which registers the 
template invocation provider via `@ExtendWith`, so each `@TestTemplate` runs 
once per backend (H2/MySQL/PostgreSQL). The test executes as intended; no 
change needed.



##########
core/src/main/java/org/apache/gravitino/hook/TagHookDispatcher.java:
##########
@@ -90,12 +92,23 @@ public Tag createTag(
   @Override
   public Tag alterTag(String metalake, String name, TagChange... changes)
       throws IllegalArgumentException, TagAlreadyExistsException {
-    return dispatcher.alterTag(metalake, name, changes);
+    Tag alteredTag = dispatcher.alterTag(metalake, name, changes);
+    if (Arrays.stream(changes).anyMatch(change -> change instanceof 
TagChange.RenameTag)) {
+      AuthorizationUtils.notifyEntityNameIdMappingChange(
+          NameIdentifierUtil.ofTag(metalake, name), Entity.EntityType.TAG);
+    }
+    return alteredTag;
   }

Review Comment:
   This keeps the existing pattern used by the Table, View, Fileset and 
Metalake hook dispatchers. Each rename change is a distinct type per entity, so 
a shared helper would still need a per-type class argument and wouldn't remove 
much. Keeping it inline for consistency with the other hooks.



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

Reply via email to