Skip to content

HIVE-29453: Separate create/drop catalog from HMSHandler - #6672

Merged
dengzhhu653 merged 2 commits into
apache:masterfrom
rtrivedi12:HIVE-29453
Aug 5, 2026
Merged

HIVE-29453: Separate create/drop catalog from HMSHandler#6672
dengzhhu653 merged 2 commits into
apache:masterfrom
rtrivedi12:HIVE-29453

Conversation

@rtrivedi12

@rtrivedi12 rtrivedi12 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and drop_catalog in HMSHandler to delegate work to AbstractRequestHandler implementations.
  • Introduces CreateCatalogHandler, AlterCatalogHandler, and DropCatalogHandler to encapsulate catalog-specific logic and listener/event handling.
  • Removes the inlined dropCatalogCore implementation from HMSHandler.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 when ifExists=true and the catalog did not exist (so cat remains null). In that path this emits a successful DropCatalogEvent with a null catalog, which can break listeners that assume a non-null catalog for successful DROP events. Consider skipping the non-transactional listener notification when cat is 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),

@dengzhhu653
dengzhhu653 merged commit d98bfed into apache:master Aug 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants