Skip to content

[client] Support specifying rack when adding/removing server tags in Admin API - #2890

Open
LiebingYu wants to merge 3 commits into
apache:mainfrom
LiebingYu:feature/admin-server-tag-by-rack
Open

[client] Support specifying rack when adding/removing server tags in Admin API#2890
LiebingYu wants to merge 3 commits into
apache:mainfrom
LiebingYu:feature/admin-server-tag-by-rack

Conversation

@LiebingYu

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #2889

Brief change log

Tests

API and Format

Documentation

@LiebingYu
LiebingYu requested a review from swuferhong March 17, 2026 08:22
@LiebingYu

Copy link
Copy Markdown
Contributor Author

Hi @swuferhong, PTAL!

@LiebingYu
LiebingYu force-pushed the feature/admin-server-tag-by-rack branch 2 times, most recently from 44db6f2 to 0aec572 Compare July 30, 2026 06:21

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

Hi, @LiebingYu, thanks for your contributions. I left some comments.

Comment thread fluss-client/src/main/java/org/apache/fluss/client/admin/Admin.java Outdated
Comment thread fluss-client/src/main/java/org/apache/fluss/client/admin/Admin.java Outdated
Comment thread fluss-client/src/main/java/org/apache/fluss/client/admin/Admin.java Outdated
r != null && !r.isEmpty(),
"rack element must not be null or empty"));
Set<String> rackSet = new HashSet<>(racks);
return getServerNodes()

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.

removeServerTagByRack() only resolves IDs from getServerNodes(), which returns the currently alive TabletServers. Once all servers in a rack have gone offline, this method resolves an empty ID list and returns success without removing their tags.

This is asymmetric with removeServerTag(List<Integer>, ServerTag): the Coordinator-side processRemoveServerTag() explicitly tolerates a missing server and still removes its tag. Therefore, a tag applied before decommissioning cannot later be cleaned up by rack after the physical host has gone offline; it remains in ZooKeeper and coordinatorContext until the caller removes it explicitly by server ID.

Please preserve enough rack-to-server information to resolve tagged offline servers. Moving rack resolution to the Coordinator is preferable, but it also requires persisting the rack association—for example, storing the rack together with the server tag or retaining historical server metadata—because the live registration is removed when the server goes offline. If this API is intentionally limited to alive servers, that limitation should at least be stated explicitly in its Javadoc and user documentation.

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.

Thanks, this is a valid point. I’m intentionally keeping removeServerTagByRack() as a one-shot convenience selector over the Coordinator’s currently registered TabletServers, rather than introducing persistent rack membership history.

Consequently, it does not remove tags from servers that are already offline or no longer belong to their former rack. Those tags remain persisted by server ID and should be cleared with removeServerTag(serverIds, tag), especially before a server ID is reused.

I have documented this limitation explicitly in the JavaDoc and user documentation. The external cordon prevents new servers from entering the rack during decommissioning, but does not change this removal limitation.

If removing offline servers by rack is required as part of the API contract, I think that should be handled by a separate rack-history/policy design rather than adding that state implicitly in this PR.

@LiebingYu
LiebingYu force-pushed the feature/admin-server-tag-by-rack branch from 0aec572 to dc4a752 Compare September 6, 2026 12:56

@platinumhamburg platinumhamburg 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 +1.

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.

[client] Support specifying rack when adding/removing server tags in Admin API

3 participants