Package com.linkedin.venice.controller
Class FabricControllerClientProvider
java.lang.Object
com.linkedin.venice.controller.FabricControllerClientProvider
- All Implemented Interfaces:
Closeable,AutoCloseable
Owns the controller-client maps used for cross-region / cross-fabric coordination and centralizes their lazy
construction and lifecycle. A single instance is created by
VeniceHelixAdmin (child) and shared with
VeniceParentHelixAdmin (parent), which previously each maintained their own copy of this plumbing.
Two maps are maintained:
clusterControllerClientPerFabricMap: cluster -> fabric -> client, built from the standard child data-center allowlist (URL and D2 maps) in the cluster config.newFabricControllerClientMap: cluster -> fabric -> client, built on demand for fabrics that are not in the standard allowlist (e.g. build-out / data-recovery destinations).
VeniceConcurrentHashMaps populated via computeIfAbsent; no external locking is needed.-
Constructor Summary
ConstructorsConstructorDescriptionFabricControllerClientProvider(VeniceControllerMultiClusterConfig multiClusterConfigs, Optional<SSLFactory> sslFactory, Map<String, com.linkedin.d2.balancer.D2Client> d2Clients) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getControllerClientMap(String clusterName) Returns the lazily-constructed map of controller clients (fabric -> client) for the standard child data-center allowlist of the given cluster.getFabricBuildoutControllerClient(String clusterName, String fabric) Returns a controller client for a specific fabric of the given cluster.<R extends ControllerResponse,V>
Map<String,V> queryAllRegions(Map<String, ControllerClient> controllerClients, String clusterName, int maxAttempts, Function<ControllerClient, R> request, Function<R, V> onSuccess, V errorSentinel) Issues the same query to every region's controller client and collects a per-region result.
-
Constructor Details
-
FabricControllerClientProvider
public FabricControllerClientProvider(VeniceControllerMultiClusterConfig multiClusterConfigs, Optional<SSLFactory> sslFactory, Map<String, com.linkedin.d2.balancer.D2Client> d2Clients)
-
-
Method Details
-
getControllerClientMap
Returns the lazily-constructed map of controller clients (fabric -> client) for the standard child data-center allowlist of the given cluster. -
getFabricBuildoutControllerClient
Returns a controller client for a specific fabric of the given cluster. Fabrics in the standard allowlist are served fromgetControllerClientMap(String); fabrics outside the allowlist (e.g. build-out / data-recovery destinations) are built on demand from child cluster configs and cached innewFabricControllerClientMap. -
queryAllRegions
public <R extends ControllerResponse,V> Map<String,V> queryAllRegions(Map<String, ControllerClient> controllerClients, String clusterName, int maxAttempts, Function<ControllerClient, R> request, Function<R, V> onSuccess, V errorSentinel) Issues the same query to every region's controller client and collects a per-region result. This captures the best-effort multi-fabric fan-out shape used by the parent controller's version queries: on a per-region error the failure is logged anderrorSentinelis stored for that region (the query is not aborted), while a successful response is mapped to a value viaonSuccess. WhenmaxAttempts > 1the request is retried viaControllerClient.retryableRequest(ControllerClient, int, Function).- Parameters:
controllerClients- region -> controller client (typicallygetControllerClientMap(String))clusterName- the cluster being queried; used only for log contextmaxAttempts- total attempts per region (1 means no retry)request- the controller RPC to issue against each region's clientonSuccess- maps a successful response to the per-region result valueerrorSentinel- the value stored for a region whose query returned an error
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-