Skip to content

[feature] Support alter database comment and custom properties - #1172

Merged
wuchong merged 2 commits into
apache:mainfrom
LiebingYu:alter_database
Mar 19, 2026
Merged

wuchong merged 2 commits into
apache:mainfrom
LiebingYu:alter_database

Conversation

@LiebingYu

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #1151

Brief change log

Tests

API and Format

Documentation

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 adds end-to-end support for ALTER DATABASE to update a database’s comment and custom properties across the RPC API, server coordinator, Java client admin, and Flink catalog integration (linked to #1151).

Changes:

  • Introduces a new RPC API (ALTER_DATABASE) with request/response messages and gateway wiring.
  • Implements server-side handling to apply database property changes and persist them in ZooKeeper.
  • Adds client- and Flink-side implementations plus new unit/integration tests for altering database properties/comments.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
fluss-server/src/test/java/org/apache/fluss/server/coordinator/TestCoordinatorGateway.java Extends test gateway interface with alterDatabase stub.
fluss-server/src/main/java/org/apache/fluss/server/zk/ZooKeeperClient.java Adds ZK helper to update an existing database znode payload.
fluss-server/src/main/java/org/apache/fluss/server/utils/ServerRpcMessageUtils.java Adds PbAlterConfig → DatabaseChange conversions (including comment special-casing).
fluss-server/src/main/java/org/apache/fluss/server/entity/DatabasePropertyChanges.java New internal representation of database property/comment changes.
fluss-server/src/main/java/org/apache/fluss/server/coordinator/MetadataManager.java Adds coordinator logic to apply and persist database changes.
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorService.java Adds alterDatabase RPC handler + conversion to DatabasePropertyChanges.
fluss-rpc/src/main/proto/FlussApi.proto Defines AlterDatabaseRequest/Response messages.
fluss-rpc/src/main/java/org/apache/fluss/rpc/protocol/ApiKeys.java Adds new ALTER_DATABASE API key.
fluss-rpc/src/main/java/org/apache/fluss/rpc/gateway/AdminGateway.java Exposes alterDatabase on the admin RPC gateway.
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/sink/testutils/TestAdminAdapter.java Updates test adapter interface surface with alterDatabase stub.
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogTest.java Adds catalog-level unit coverage for altering database props/comments.
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogITCase.java Adds SQL-based IT coverage for ALTER DATABASE ... SET (...).
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/catalog/FlinkCatalog.java Implements Flink Catalog#alterDatabase by diffing descriptors into DatabaseChanges.
fluss-common/src/main/java/org/apache/fluss/metadata/DatabaseChange.java New public change model for database alters (set/reset/updateComment).
fluss-common/src/main/java/org/apache/fluss/config/FlussConfigUtils.java Adds shared constant COMMENT_PROP_NAME = "comment".
fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java Adds IT coverage for admin-side alter database flows.
fluss-client/src/main/java/org/apache/fluss/client/utils/ClientRpcMessageUtils.java Adds DatabaseChange → PbAlterConfig conversion for database alters.
fluss-client/src/main/java/org/apache/fluss/client/admin/FlussAdmin.java Implements Admin#alterDatabase RPC call construction and dispatch.
fluss-client/src/main/java/org/apache/fluss/client/admin/Admin.java Adds new public alterDatabase API to the Admin interface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@loserwang1024 loserwang1024 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.

Thanks for your job, I have left some comment.

} catch (Exception e) {
Throwable t = ExceptionUtils.stripExecutionException(e);
if (CatalogExceptionUtils.isDatabaseNotExist(t)) {
if (!ignoreIfNotExists) {

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.

admin.alterDatabase(databaseName, databaseChanges, ignoreIfNotExists) already handle ignoreIfNotExists. Thus, just throw exception here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

admin.alterDatabase throws org.apache.fluss.exception.DatabaseNotExistException while FlinkCatalog.alterDatabase throws org.apache.flink.table.catalog.exceptions.DatabaseNotExistException. We need to wrap it here like dropDatabase does.

}

// alter database request and response
message AlterDatabaseRequest {

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.

where is comment? I think comment should be seperated from config_changes, @wuchong , WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we can treat comment as a specific config. Otherwise we should extract comment from List<DatabaseChange> databaseChanges which is a bit of a hassle.

@LiebingYu
LiebingYu force-pushed the alter_database branch 2 times, most recently from ac67a7e to eb5c406 Compare March 3, 2026 12:29
@LiebingYu

Copy link
Copy Markdown
Contributor Author

CC @loserwang1024. Could you have a look again? I've resolve the comment issue.

@loserwang1024 loserwang1024 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.

LGTM

@wuchong wuchong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@wuchong
wuchong merged commit 14f0f12 into apache:main Mar 19, 2026
6 checks passed
wxplovecc pushed a commit to tongcheng-elong/fluss that referenced this pull request Apr 17, 2026
wxplovecc pushed a commit to tongcheng-elong/fluss that referenced this pull request Apr 20, 2026
Ugbot pushed a commit to Ugbot/fluss that referenced this pull request Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support alter database to update comment and custom properties

4 participants