yuqi1129 commented on code in PR #10288:
URL: https://github.com/apache/gravitino/pull/10288#discussion_r2895433215
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TopicOperations.java:
##########
@@ -143,10 +143,7 @@ public Response createTopic(
NameIdentifierUtil.ofTopic(metalake, catalog, schema,
request.getName());
// Make sure schema is imported, otherwise set owner for the topic
may fail.
- MetadataObjectUtil.checkMetadataObject(
- metalake,
- MetadataObjects.of(
- Lists.newArrayList(catalog, schema),
MetadataObject.Type.SCHEMA));
+ schemaDispatcher.loadSchema(NameIdentifierUtil.ofSchema(metalake,
catalog, schema));
Review Comment:
Same concern as TableOperations: `dispatcher.createTopic(...)` already
performs `schemaDispatcher.loadSchema(...)` in
`TopicOperationDispatcher#createTopic`. This adds an extra schema load
round-trip in REST before dispatcher execution.
Recommend removing this duplicate call (or documenting why the pre-load is
required here).
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TableOperations.java:
##########
@@ -142,10 +142,7 @@ public Response createTable(
NameIdentifierUtil.ofTable(metalake, catalog, schema,
request.getName());
// Make sure schema is imported, otherwise set owner for the table
may fail.
- MetadataObjectUtil.checkMetadataObject(
- metalake,
- MetadataObjects.of(
- Lists.newArrayList(catalog, schema),
MetadataObject.Type.SCHEMA));
+ schemaDispatcher.loadSchema(NameIdentifierUtil.ofSchema(metalake,
catalog, schema));
Review Comment:
`dispatcher.createTable(...)` already calls
`schemaDispatcher.loadSchema(...)` in `TableOperationDispatcher#createTable`
before entering write lock. Calling `schemaDispatcher.loadSchema(...)` here
adds another catalog lookup/import attempt on the hot path.
Could we avoid this duplicate load and keep the validation in one place
(dispatcher), unless there is a specific owner-assignment ordering requirement
that needs it here?
--
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]