HIVE-29453: Separate create/drop catalog from HMSHandler - #6672
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR continues the HMSHandler refactoring (HIVE-29402 lineage) by moving catalog CRUD logic out of HMSHandler into dedicated @RequestHandler-based classes, aligning catalog operations with the existing AbstractRequestHandler pattern used across the standalone metastore server.
Changes:
- Refactors
create_catalog,alter_catalog, anddrop_cataloginHMSHandlerto delegate work toAbstractRequestHandlerimplementations. - Introduces
CreateCatalogHandler,AlterCatalogHandler, andDropCatalogHandlerto encapsulate catalog-specific logic and listener/event handling. - Removes the inlined
dropCatalogCoreimplementation fromHMSHandler.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java | Delegates catalog CRUD RPCs to the request-handler framework and removes inlined drop core logic. |
| standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/CreateCatalogHandler.java | New request handler encapsulating catalog creation, directory setup, and event/listener notifications. |
| standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/AlterCatalogHandler.java | New request handler encapsulating catalog alteration and event/listener notifications. |
| standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/DropCatalogHandler.java | New request handler encapsulating catalog drop behavior (including default DB handling) and notifications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/DropCatalogHandler.java:127
afterExecute()always notifies listeners, even whenifExists=trueand the catalog did not exist (socatremains null). In that path this emits a successfulDropCatalogEventwith a null catalog, which can break listeners that assume a non-null catalog for successful DROP events. Consider skipping the non-transactional listener notification whencatis null (no drop actually happened).
protected void afterExecute(DropCatalogResult result) throws TException, IOException {
if (!handler.getListeners().isEmpty()) {
MetaStoreListenerNotifier.notifyEvent(handler.getListeners(),
EventType.DROP_CATALOG,
new DropCatalogEvent(result != null && result.success(), handler, cat),



What changes were proposed in this pull request?
Extract catalog CRUD operations from HMSHandler into three dedicated handler classes ( CreateCatalogHandler, DropCatalogHandler, AlterCatalogHandler) following the existing @RequestHandler / AbstractRequestHandler pattern used across HIVE-29402.
Why are the changes needed?
HMSHandler Refactoring work - HIVE-29402
Does this PR introduce any user-facing change?
No
How was this patch tested?
mvn test -pl standalone-metastore/metastore-server
-Dtest=org.apache.hadoop.hive.metastore.client.TestCatalogs
-Dtest.groups=org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest