This is an automated email from the ASF dual-hosted git repository.

fanng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 3cd372f10 [#5547] feat(core): support schema pre event for Gravitino 
server (#5559)
3cd372f10 is described below

commit 3cd372f10a7021ded88eaa55672edfe921411c8b
Author: JUN <[email protected]>
AuthorDate: Wed Nov 13 15:54:26 2024 +0800

    [#5547] feat(core): support schema pre event for Gravitino server (#5559)
    
    ### What changes were proposed in this pull request?
    
    add schema pre event to event listener
    
    ### Why are the changes needed?
    
    Close: #5547
    
    ### Does this PR introduce _any_ user-facing change?
    
    no
    
    ### How was this patch tested?
    
    add Unit Test
---
 .../gravitino/listener/SchemaEventDispatcher.java  | 14 +++++-
 .../listener/api/event/AlterSchemaPreEvent.java    | 45 +++++++++++++++++++
 .../listener/api/event/CreateSchemaPreEvent.java   | 46 +++++++++++++++++++
 .../listener/api/event/DropSchemaPreEvent.java     | 31 +++++++++++++
 .../listener/api/event/ListSchemaPreEvent.java     | 44 +++++++++++++++++++
 .../listener/api/event/LoadSchemaPreEvent.java     | 31 +++++++++++++
 .../listener/api/event/SchemaPreEvent.java         | 31 +++++++++++++
 .../listener/api/event/TestSchemaEvent.java        | 51 +++++++++++++++++-----
 .../listener/api/event/TestTableEvent.java         |  2 +-
 docs/gravitino-server-config.md                    |  3 +-
 10 files changed, 284 insertions(+), 14 deletions(-)

diff --git 
a/core/src/main/java/org/apache/gravitino/listener/SchemaEventDispatcher.java 
b/core/src/main/java/org/apache/gravitino/listener/SchemaEventDispatcher.java
index 69e0e49b6..ffbdf28c1 100644
--- 
a/core/src/main/java/org/apache/gravitino/listener/SchemaEventDispatcher.java
+++ 
b/core/src/main/java/org/apache/gravitino/listener/SchemaEventDispatcher.java
@@ -32,14 +32,19 @@ import 
org.apache.gravitino.exceptions.NonEmptySchemaException;
 import org.apache.gravitino.exceptions.SchemaAlreadyExistsException;
 import org.apache.gravitino.listener.api.event.AlterSchemaEvent;
 import org.apache.gravitino.listener.api.event.AlterSchemaFailureEvent;
+import org.apache.gravitino.listener.api.event.AlterSchemaPreEvent;
 import org.apache.gravitino.listener.api.event.CreateSchemaEvent;
 import org.apache.gravitino.listener.api.event.CreateSchemaFailureEvent;
+import org.apache.gravitino.listener.api.event.CreateSchemaPreEvent;
 import org.apache.gravitino.listener.api.event.DropSchemaEvent;
 import org.apache.gravitino.listener.api.event.DropSchemaFailureEvent;
+import org.apache.gravitino.listener.api.event.DropSchemaPreEvent;
 import org.apache.gravitino.listener.api.event.ListSchemaEvent;
 import org.apache.gravitino.listener.api.event.ListSchemaFailureEvent;
+import org.apache.gravitino.listener.api.event.ListSchemaPreEvent;
 import org.apache.gravitino.listener.api.event.LoadSchemaEvent;
 import org.apache.gravitino.listener.api.event.LoadSchemaFailureEvent;
+import org.apache.gravitino.listener.api.event.LoadSchemaPreEvent;
 import org.apache.gravitino.listener.api.info.SchemaInfo;
 import org.apache.gravitino.utils.PrincipalUtils;
 
@@ -67,6 +72,7 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
 
   @Override
   public NameIdentifier[] listSchemas(Namespace namespace) throws 
NoSuchCatalogException {
+    eventBus.dispatchEvent(new 
ListSchemaPreEvent(PrincipalUtils.getCurrentUserName(), namespace));
     try {
       NameIdentifier[] nameIdentifiers = dispatcher.listSchemas(namespace);
       eventBus.dispatchEvent(new 
ListSchemaEvent(PrincipalUtils.getCurrentUserName(), namespace));
@@ -86,6 +92,9 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
   @Override
   public Schema createSchema(NameIdentifier ident, String comment, Map<String, 
String> properties)
       throws NoSuchCatalogException, SchemaAlreadyExistsException {
+    SchemaInfo createSchemaRequest = new SchemaInfo(ident.name(), comment, 
properties, null);
+    eventBus.dispatchEvent(
+        new CreateSchemaPreEvent(PrincipalUtils.getCurrentUserName(), ident, 
createSchemaRequest));
     try {
       Schema schema = dispatcher.createSchema(ident, comment, properties);
       eventBus.dispatchEvent(
@@ -93,7 +102,6 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
               PrincipalUtils.getCurrentUserName(), ident, new 
SchemaInfo(schema)));
       return schema;
     } catch (Exception e) {
-      SchemaInfo createSchemaRequest = new SchemaInfo(ident.name(), comment, 
properties, null);
       eventBus.dispatchEvent(
           new CreateSchemaFailureEvent(
               PrincipalUtils.getCurrentUserName(), ident, e, 
createSchemaRequest));
@@ -103,6 +111,7 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
 
   @Override
   public Schema loadSchema(NameIdentifier ident) throws NoSuchSchemaException {
+    eventBus.dispatchEvent(new 
LoadSchemaPreEvent(PrincipalUtils.getCurrentUserName(), ident));
     try {
       Schema schema = dispatcher.loadSchema(ident);
       eventBus.dispatchEvent(
@@ -118,6 +127,8 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
   @Override
   public Schema alterSchema(NameIdentifier ident, SchemaChange... changes)
       throws NoSuchSchemaException {
+    eventBus.dispatchEvent(
+        new AlterSchemaPreEvent(PrincipalUtils.getCurrentUserName(), ident, 
changes));
     try {
       Schema schema = dispatcher.alterSchema(ident, changes);
       eventBus.dispatchEvent(
@@ -133,6 +144,7 @@ public class SchemaEventDispatcher implements 
SchemaDispatcher {
 
   @Override
   public boolean dropSchema(NameIdentifier ident, boolean cascade) throws 
NonEmptySchemaException {
+    eventBus.dispatchEvent(new 
DropSchemaPreEvent(PrincipalUtils.getCurrentUserName(), ident));
     try {
       boolean isExists = dispatcher.dropSchema(ident, cascade);
       eventBus.dispatchEvent(
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/AlterSchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/AlterSchemaPreEvent.java
new file mode 100644
index 000000000..ac2a03f00
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/AlterSchemaPreEvent.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.SchemaChange;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represents an event triggered before altering a schema. */
+@DeveloperApi
+public final class AlterSchemaPreEvent extends SchemaPreEvent {
+  private final SchemaChange[] schemaChanges;
+
+  public AlterSchemaPreEvent(String user, NameIdentifier identifier, 
SchemaChange[] schemaChanges) {
+    super(user, identifier);
+    this.schemaChanges = schemaChanges;
+  }
+
+  /**
+   * Retrieves the specific changes that were made to the schema during the 
alteration process.
+   *
+   * @return An array of {@link SchemaChange} objects detailing each 
modification applied to the
+   *     schema.
+   */
+  public SchemaChange[] schemaChanges() {
+    return schemaChanges;
+  }
+}
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/CreateSchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/CreateSchemaPreEvent.java
new file mode 100644
index 000000000..1bf69154a
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/CreateSchemaPreEvent.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.listener.api.info.SchemaInfo;
+
+/** Represents an event triggered before creating a schema. */
+@DeveloperApi
+public final class CreateSchemaPreEvent extends SchemaPreEvent {
+  private final SchemaInfo createSchemaRequest;
+
+  public CreateSchemaPreEvent(
+      String user, NameIdentifier identifier, SchemaInfo createSchemaRequest) {
+    super(user, identifier);
+    this.createSchemaRequest = createSchemaRequest;
+  }
+
+  /**
+   * Retrieves the create schema request.
+   *
+   * @return A {@link SchemaInfo} instance encapsulating the comprehensive 
details of create schema
+   *     request.
+   */
+  public SchemaInfo createSchemaRequest() {
+    return createSchemaRequest;
+  }
+}
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/DropSchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/DropSchemaPreEvent.java
new file mode 100644
index 000000000..88e74a026
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/DropSchemaPreEvent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represents an event that is generated before dropping a schema. */
+@DeveloperApi
+public final class DropSchemaPreEvent extends SchemaPreEvent {
+  public DropSchemaPreEvent(String user, NameIdentifier identifier) {
+    super(user, identifier);
+  }
+}
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/ListSchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/ListSchemaPreEvent.java
new file mode 100644
index 000000000..ff8848214
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/ListSchemaPreEvent.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represents an event that is triggered before listing of schemas within a 
namespace. */
+@DeveloperApi
+public final class ListSchemaPreEvent extends SchemaPreEvent {
+  private final Namespace namespace;
+
+  public ListSchemaPreEvent(String user, Namespace namespace) {
+    super(user, NameIdentifier.of(namespace.levels()));
+    this.namespace = namespace;
+  }
+
+  /**
+   * Provides the namespace associated with this event.
+   *
+   * @return A {@link Namespace} instance from which schema were listed.
+   */
+  public Namespace namespace() {
+    return namespace;
+  }
+}
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/LoadSchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/LoadSchemaPreEvent.java
new file mode 100644
index 000000000..d9348a451
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/LoadSchemaPreEvent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represents an event triggered before loading a schema. */
+@DeveloperApi
+public final class LoadSchemaPreEvent extends SchemaPreEvent {
+  public LoadSchemaPreEvent(String user, NameIdentifier identifier) {
+    super(user, identifier);
+  }
+}
diff --git 
a/core/src/main/java/org/apache/gravitino/listener/api/event/SchemaPreEvent.java
 
b/core/src/main/java/org/apache/gravitino/listener/api/event/SchemaPreEvent.java
new file mode 100644
index 000000000..dbbc35d49
--- /dev/null
+++ 
b/core/src/main/java/org/apache/gravitino/listener/api/event/SchemaPreEvent.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represents a pre-event for schema operations. */
+@DeveloperApi
+public abstract class SchemaPreEvent extends PreEvent {
+  protected SchemaPreEvent(String user, NameIdentifier identifier) {
+    super(user, identifier);
+  }
+}
diff --git 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestSchemaEvent.java
 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestSchemaEvent.java
index c2c0d7e44..5b1b39d96 100644
--- 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestSchemaEvent.java
+++ 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestSchemaEvent.java
@@ -64,65 +64,94 @@ public class TestSchemaEvent {
 
   @Test
   void testCreateSchemaEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
-    dispatcher.createSchema(identifier, "", ImmutableMap.of());
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
+    dispatcher.createSchema(identifier, schema.comment(), schema.properties());
+
     Event event = dummyEventListener.popPostEvent();
     Assertions.assertEquals(identifier, event.identifier());
     Assertions.assertEquals(CreateSchemaEvent.class, event.getClass());
     SchemaInfo schemaInfo = ((CreateSchemaEvent) event).createdSchemaInfo();
     checkSchemaInfo(schemaInfo, schema);
+
+    PreEvent preEvent = dummyEventListener.popPreEvent();
+    Assertions.assertEquals(identifier, preEvent.identifier());
+    Assertions.assertEquals(CreateSchemaPreEvent.class, preEvent.getClass());
+    SchemaInfo preSchemaInfo = ((CreateSchemaPreEvent) 
preEvent).createSchemaRequest();
+    checkSchemaInfo(preSchemaInfo, schema);
   }
 
   @Test
   void testLoadSchemaEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     dispatcher.loadSchema(identifier);
+
     Event event = dummyEventListener.popPostEvent();
     Assertions.assertEquals(identifier, event.identifier());
     Assertions.assertEquals(LoadSchemaEvent.class, event.getClass());
     SchemaInfo schemaInfo = ((LoadSchemaEvent) event).loadedSchemaInfo();
     checkSchemaInfo(schemaInfo, schema);
+
+    PreEvent preEvent = dummyEventListener.popPreEvent();
+    Assertions.assertEquals(identifier, preEvent.identifier());
+    Assertions.assertEquals(LoadSchemaPreEvent.class, preEvent.getClass());
   }
 
   @Test
   void testListSchemaEvent() {
     Namespace namespace = Namespace.of("metalake", "catalog");
     dispatcher.listSchemas(namespace);
+
     Event event = dummyEventListener.popPostEvent();
+    Assertions.assertEquals(namespace.toString(), 
event.identifier().toString());
     Assertions.assertEquals(ListSchemaEvent.class, event.getClass());
     Assertions.assertEquals(namespace, ((ListSchemaEvent) event).namespace());
+
+    PreEvent preEvent = dummyEventListener.popPreEvent();
+    Assertions.assertEquals(namespace.toString(), 
preEvent.identifier().toString());
+    Assertions.assertEquals(ListSchemaPreEvent.class, preEvent.getClass());
+    Assertions.assertEquals(namespace, ((ListSchemaPreEvent) 
preEvent).namespace());
   }
 
   @Test
   void testAlterSchemaEvent() {
     SchemaChange schemaChange = SchemaChange.setProperty("a", "b");
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     dispatcher.alterSchema(identifier, schemaChange);
-    Event event = dummyEventListener.popPostEvent();
 
+    Event event = dummyEventListener.popPostEvent();
     Assertions.assertEquals(identifier, event.identifier());
     Assertions.assertEquals(AlterSchemaEvent.class, event.getClass());
     SchemaInfo schemaInfo = ((AlterSchemaEvent) event).updatedSchemaInfo();
     checkSchemaInfo(schemaInfo, schema);
-
     Assertions.assertEquals(1, ((AlterSchemaEvent) 
event).schemaChanges().length);
     Assertions.assertEquals(schemaChange, ((AlterSchemaEvent) 
event).schemaChanges()[0]);
+
+    PreEvent preEvent = dummyEventListener.popPreEvent();
+    Assertions.assertEquals(identifier, preEvent.identifier());
+    Assertions.assertEquals(AlterSchemaPreEvent.class, preEvent.getClass());
+    Assertions.assertEquals(1, ((AlterSchemaPreEvent) 
preEvent).schemaChanges().length);
+    Assertions.assertEquals(schemaChange, ((AlterSchemaPreEvent) 
preEvent).schemaChanges()[0]);
   }
 
   @Test
   void testDropSchemaEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     dispatcher.dropSchema(identifier, true);
+
     Event event = dummyEventListener.popPostEvent();
     Assertions.assertEquals(identifier, event.identifier());
     Assertions.assertEquals(DropSchemaEvent.class, event.getClass());
     Assertions.assertEquals(true, ((DropSchemaEvent) event).cascade());
     Assertions.assertEquals(false, ((DropSchemaEvent) event).isExists());
+
+    PreEvent preEvent = dummyEventListener.popPreEvent();
+    Assertions.assertEquals(identifier, preEvent.identifier());
+    Assertions.assertEquals(DropSchemaPreEvent.class, preEvent.getClass());
   }
 
   @Test
   void testCreateSchemaFailureEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     Assertions.assertThrowsExactly(
         GravitinoRuntimeException.class,
         () -> failureDispatcher.createSchema(identifier, schema.comment(), 
schema.properties()));
@@ -136,7 +165,7 @@ public class TestSchemaEvent {
 
   @Test
   void testLoadSchemaFailureEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     Assertions.assertThrowsExactly(
         GravitinoRuntimeException.class, () -> 
failureDispatcher.loadSchema(identifier));
     Event event = dummyEventListener.popPostEvent();
@@ -150,7 +179,7 @@ public class TestSchemaEvent {
   void testAlterSchemaFailureEvent() {
     // alter schema
     SchemaChange schemaChange = SchemaChange.setProperty("a", "b");
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     Assertions.assertThrowsExactly(
         GravitinoRuntimeException.class,
         () -> failureDispatcher.alterSchema(identifier, schemaChange));
@@ -165,7 +194,7 @@ public class TestSchemaEvent {
 
   @Test
   void testDropSchemaFailureEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
"schema");
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
schema.name());
     Assertions.assertThrowsExactly(
         GravitinoRuntimeException.class, () -> 
failureDispatcher.dropSchema(identifier, true));
     Event event = dummyEventListener.popPostEvent();
diff --git 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestTableEvent.java
 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestTableEvent.java
index 2ea2d3a1e..48b2557c7 100644
--- 
a/core/src/test/java/org/apache/gravitino/listener/api/event/TestTableEvent.java
+++ 
b/core/src/test/java/org/apache/gravitino/listener/api/event/TestTableEvent.java
@@ -183,7 +183,7 @@ public class TestTableEvent {
 
   @Test
   void testCreateTableFailureEvent() {
-    NameIdentifier identifier = NameIdentifier.of("metalake", "table", 
table.name());
+    NameIdentifier identifier = NameIdentifier.of("metalake", "catalog", 
table.name());
     Assertions.assertThrowsExactly(
         GravitinoRuntimeException.class,
         () ->
diff --git a/docs/gravitino-server-config.md b/docs/gravitino-server-config.md
index b3b555885..55bb49bf3 100644
--- a/docs/gravitino-server-config.md
+++ b/docs/gravitino-server-config.md
@@ -132,7 +132,8 @@ Gravitino triggers a pre-event before the operation, a 
post-event after the comp
 | Operation type                      | Pre-event                              
                                                                                
                                                                                
    | Since Version    |
 
|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|
 | Iceberg REST server table operation | `IcebergCreateTablePreEvent`, 
`IcebergUpdateTablePreEvent`, `IcebergDropTablePreEvent`, 
`IcebergLoadTablePreEvent`, `IcebergListTablePreEvent`, 
`IcebergTableExistsPreEvent`, `IcebergRenameTablePreEvent` | 0.7.0-incubating |
-| Gravitino server table operation    | `CreateTablePreEvent`, 
`UpdateTablePreEvent`, `DropTablePreEvent`, `PurgeTablePreEvent`, 
`LoadTablePreEvent`, `ListTablePreEvent`                                        
                                  | 0.8.0-incubating |
+| Gravitino server table operation    | `CreateTablePreEvent`, 
`AlterTablePreEvent`, `DropTablePreEvent`, `PurgeTablePreEvent`, 
`LoadTablePreEvent`, `ListTablePreEvent`                                        
                                   | 0.8.0-incubating |
+| Gravitino server schema operation   | `CreareSchemaPreEvent`, 
`AlterSchemaPreEvent`, `DropSchemaPreEvent`, `LoadSchemaPreEvent`, 
`ListSchemaPreEvent`                                                            
                                | 0.8.0-incubating |
 
 #### Event listener plugin
 

Reply via email to