Class FabricControllerClientProvider

java.lang.Object
com.linkedin.venice.controller.FabricControllerClientProvider
All Implemented Interfaces:
Closeable, AutoCloseable

public class FabricControllerClientProvider extends Object implements Closeable
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).
Both maps are VeniceConcurrentHashMaps populated via computeIfAbsent; no external locking is needed.
  • Constructor Details

  • Method Details

    • getControllerClientMap

      public Map<String,ControllerClient> 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

      public ControllerClient getFabricBuildoutControllerClient(String clusterName, String fabric)
      Returns a controller client for a specific fabric of the given cluster. Fabrics in the standard allowlist are served from getControllerClientMap(String); fabrics outside the allowlist (e.g. build-out / data-recovery destinations) are built on demand from child cluster configs and cached in newFabricControllerClientMap.
    • 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 and errorSentinel is stored for that region (the query is not aborted), while a successful response is mapped to a value via onSuccess. When maxAttempts > 1 the request is retried via ControllerClient.retryableRequest(ControllerClient, int, Function).
      Parameters:
      controllerClients - region -> controller client (typically getControllerClientMap(String))
      clusterName - the cluster being queried; used only for log context
      maxAttempts - total attempts per region (1 means no retry)
      request - the controller RPC to issue against each region's client
      onSuccess - maps a successful response to the per-region result value
      errorSentinel - the value stored for a region whose query returned an error
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable