Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
mqliang committed Nov 26, 2024
1 parent 7ef229c commit eec01cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import org.apache.pinot.controller.helix.core.periodictask.ControllerPeriodicTask;
import org.apache.pinot.controller.helix.core.realtime.MissingConsumingSegmentFinder;
import org.apache.pinot.controller.helix.core.realtime.PinotLLCRealtimeSegmentManager;
import org.apache.pinot.controller.util.ServerInfoCache;
import org.apache.pinot.controller.util.ServerInfoCache.ServerInfo;
import org.apache.pinot.controller.util.ServerInfoFetcher;
import org.apache.pinot.controller.util.ServerInfoFetcher.ServerInfo;
import org.apache.pinot.controller.util.TableSizeReader;
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.config.table.TableType;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class SegmentStatusChecker extends ControllerPeriodicTask<SegmentStatusCh

private long _lastDisabledTableLogTimestamp = 0;

private ServerInfoCache _serverInfoCache;
private ServerInfoFetcher _serverInfoFetcher;

/**
* Constructs the segment status checker.
Expand All @@ -96,7 +96,7 @@ public SegmentStatusChecker(PinotHelixResourceManager pinotHelixResourceManager,
config.getStatusCheckerInitialDelayInSeconds(), pinotHelixResourceManager, leadControllerManager,
controllerMetrics);

_serverInfoCache = new ServerInfoCache(pinotHelixResourceManager);
_serverInfoFetcher = new ServerInfoFetcher(pinotHelixResourceManager);
_waitForPushTimeSeconds = config.getStatusCheckerWaitForPushTimeInSeconds();
_tableSizeReader = tableSizeReader;
}
Expand Down Expand Up @@ -435,7 +435,7 @@ private void updateSegmentMetrics(String tableNameWithType, TableConfig tableCon
}

private boolean isServerQueryable(String serverInstanceId) {
ServerInfo serverInfo = _serverInfoCache.getServerInfo(serverInstanceId);
ServerInfo serverInfo = _serverInfoFetcher.getServerInfo(serverInstanceId);
return serverInfo != null
&& serverInfo.isHelixEnabled()
&& !serverInfo.isQueriesDisabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@


/**
* This is a helper class maintaining a cache of server information. It is used to avoid repeated calls to Helix to
* get server information. This class is not thread safe.
* This is a helper class that fetch server information from Helix/ZK. It caches the server information to avoid
* repeated ZK access. This class is NOT thread-safe.
*/
public class ServerInfoCache {
public class ServerInfoFetcher {
private PinotHelixResourceManager _pinotHelixResourceManager;
private Map<String, ServerInfo> _serverInfoMap;
private Map<String, ServerInfo> _serverInfoCache;

public ServerInfoCache(PinotHelixResourceManager pinotHelixResourceManager) {
public ServerInfoFetcher(PinotHelixResourceManager pinotHelixResourceManager) {
_pinotHelixResourceManager = pinotHelixResourceManager;
_serverInfoMap = new HashMap<>();
_serverInfoCache = new HashMap<>();
}

public ServerInfo getServerInfo(String instanceId) {
return _serverInfoMap.computeIfAbsent(instanceId, this::getServerInfoOndemand);
return _serverInfoCache.computeIfAbsent(instanceId, this::getServerInfoOndemand);
}

private ServerInfo getServerInfoOndemand(String instanceId) {
Expand Down

0 comments on commit eec01cc

Please sign in to comment.