You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "platinumhamburg (via GitHub)" <gi...@apache.org> on 2026/01/07 04:09:57 UTC
Re: [PR] [server] Servers with PERMANENT_OFFLINE tag are no longer assigned replicas [fluss]
platinumhamburg commented on code in PR #1538:
URL: https://github.com/apache/fluss/pull/1538#discussion_r2667000204
##########
fluss-server/src/main/java/org/apache/fluss/server/metadata/CoordinatorMetadataCache.java:
##########
@@ -91,7 +94,34 @@ public Set<TabletServerInfo> getAliveTabletServerInfos() {
return Collections.unmodifiableSet(tabletServerInfos);
}
- public void updateMetadata(ServerInfo coordinatorServer, Set<ServerInfo> serverInfoSet) {
+ /**
+ * Servers with {@code PERMANENT_OFFLINE} tags are no longer returned here. So that no new
+ * replicas will be assigned to these servers.
+ */
+ @Override
+ public TabletServerInfo[] getLiveServers() {
+ Set<TabletServerInfo> aliveTabletServerInfosWithoutOfflineServerTag =
+ getAliveTabletServerInfos().stream()
+ .filter(
+ info ->
+ !metadataSnapshot.serverTags.containsKey(info.getId())
+ || metadataSnapshot.serverTags.get(info.getId())
+ != ServerTag.PERMANENT_OFFLINE)
+ .collect(Collectors.toSet());
+ TabletServerInfo[] server =
+ new TabletServerInfo[aliveTabletServerInfosWithoutOfflineServerTag.size()];
+ Iterator<TabletServerInfo> iterator =
+ aliveTabletServerInfosWithoutOfflineServerTag.iterator();
+ for (int i = 0; i < aliveTabletServerInfosWithoutOfflineServerTag.size(); i++) {
+ server[i] = iterator.next();
+ }
+ return server;
+ }
Review Comment:
It can be simplified to :
```
public TabletServerInfo[] getLiveServers() {
return getAliveTabletServerInfos().stream()
.filter(info -> {
ServerTag tag = metadataSnapshot.serverTags.get(info.getId());
return tag != ServerTag.PERMANENT_OFFLINE;
})
.toArray(TabletServerInfo[]::new);
}
```
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org