Class ControllerClient
java.lang.Object
com.linkedin.venice.controllerapi.ControllerClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
D2ControllerClient
-
Constructor Summary
ConstructorDescriptionControllerClient
(String clusterName, String discoveryUrls) ControllerClient
(String clusterName, String discoveryUrls, Optional<SSLFactory> sslFactory) -
Method Summary
Modifier and TypeMethodDescriptionabortMigration
(String storeName, String destClusterName) This command should be sent to src controller, not dest controlleraddDerivedSchema
(String storeName, int valueSchemaId, String derivedSchemaStr) addDerivedSchema
(String storeName, int valueSchemaId, String derivedSchemaStr, int derivedSchemaId) addNodeIntoAllowList
(String instanceId) addValueSchema
(String storeName, String valueSchemaStr) addValueSchema
(String storeName, String valueSchemaStr, int valueSchemaId) addValueSchema
(String storeName, String valueSchemaStr, int valueSchemaId, DirectionalSchemaCompatibilityType schemaCompatType) addVersionAndStartIngestion
(String storeName, String pushJobId, int version, int partitionCount, Version.PushType pushType, String remoteKafkaBootstrapServers, long rewindTimeInSecondsOverride, int replicationMetadataVersionId) Used for store migration to add version and start ingestion in destination cluster for new pushes in the source cluster during the ingestion.checkResourceCleanupForStoreCreation
(String storeName) void
close()
compareStore
(String storeName, String fabricA, String fabricB) completeMigration
(String storeName, String destClusterName) configureActiveActiveReplicationForCluster
(boolean enableActiveActiveReplication, String storeType, Optional<String> regionsFilter) static ControllerClient
constructClusterControllerClient
(String clusterName, String discoveryUrls) Deprecated.static ControllerClient
constructClusterControllerClient
(String clusterName, String discoveryUrls, Optional<SSLFactory> sslFactory) copyOverStoreMetadata
(String sourceFabric, String destFabric, String storeName) createNewStore
(String storeName, String owner, String keySchema, String valueSchema) createNewStore
(String storeName, String owner, String keySchema, String valueSchema, String accessPermissions) createNewStoreWithParameters
(String storeName, String owner, String keySchema, String valueSchema, UpdateStoreQueryParams updateStoreQueryParams) Simplified API that wraps together the store create and update functionalities with some clean up functionalitycreateNewSystemStore
(String storeName, String owner, String keySchema, String valueSchema) dataRecovery
(String sourceFabric, String destinationFabric, String storeName, int versionNumber, boolean sourceVersionIncluded, boolean copyAllVersionConfigs, Optional<Version> sourceVersion) deleteAclForStore
(String storeName) deleteAllVersions
(String storeName) deleteKafkaTopic
(String topicName) deleteOldVersion
(String storeName, int versionNum) deleteStoragePersona
(String name) deleteStore
(String storeName) deleteValueSchemas
(String storeName, List<String> schemaIds) disableAndDeleteStore
(String storeName) static ControllerClient
discoverAndConstructControllerClient
(String storeName, String discoveryUrls, Optional<SSLFactory> sslFactory, int retryAttempts) discoverCluster
(String storeName) static D2ServiceDiscoveryResponse
discoverCluster
(String discoveryUrls, String storeName, Optional<SSLFactory> sslFactory, int retryAttempts) protected String
enableMaxCapacityProtection
(boolean isMaxCapacityProtection) enableQuotaRebalanced
(boolean isQuotaRebalanced, int expectRouterCount) enableStoreReads
(String storeName, boolean enable) enableStoreReadWrites
(String storeName, boolean enable) enableStoreWrites
(String storeName, boolean enable) enableThrottling
(boolean isThrottlingEnabled) protected static String
encodeQueryParams
(QueryParams params) getAclForStore
(String storeName) getAdminCommandExecution
(long executionId) getAdminTopicMetadata
(Optional<String> storeName) getAggregatedHealthStatus
(String clusterName, List<String> instances, List<String> toBeStoppedInstances) getAllReplicationMetadataSchemas
(String storeName) getAllValueAndDerivedSchema
(String storeName) getAllValueSchema
(String storeName) getBackupVersions
(String clusterName, String storeName) getClusterStaleStores
(String clusterName, String parentControllerUrl) getClusterStores
(String clusterName) getFutureVersions
(String clusterName, String storeName) getHeartbeatFromSystemStore
(String storeName) getInUseSchemaIds
(String storeName) getKafkaTopicConfigs
(String kafkaTopicName) getKeySchema
(String storeName) protected static QueryParams
getQueryParamsToDiscoverCluster
(String storeName) getRegionPushDetails
(String storeName, boolean isPartitionDetailEnabled) getRepushInfo
(String storeName, Optional<String> fabricName) getStorageEngineOverheadRatio
(String storeName) getStoragePersona
(String name) static StoreResponse
Deprecated.getStoreLargestUsedVersion
(String clusterName, String storeName) getValueOrDerivedSchemaId
(String storeName, String derivedSchemaStr) getValueSchema
(String storeName, int valueSchemaId) getValueSchemaID
(String storeName, String valueSchemaStr) isNodeRemovable
(String instanceId) isNodeRemovable
(String instanceId, List<String> lockedNodeIds) isStoreVersionReadyForDataRecovery
(String sourceFabric, String destinationFabric, String storeName, int versionNumber, Optional<Integer> sourceAmplificationFactor) killOfflinePushJob
(String kafkaTopic) listChildControllers
(String clusterName) listInstancesStatuses
(boolean enableReplicas) listReplicas
(String storeName, int version) listStorageNodeReplicas
(String instanceId) listStorePushInfo
(String storeName, boolean isPartitionDetailEnabled) migrateStore
(String storeName, String destClusterName) protected QueryParams
Add all global parameters in this method.nodeReplicasReadiness
(String instanceId) overrideSetActiveVersion
(String storeName, int version) prepareDataRecovery
(String sourceFabric, String destinationFabric, String storeName, int versionNumber, Optional<Integer> sourceAmplificationFactor) queryDetailedJobStatus
(String kafkaTopic, String region) This method will retrieve detailed job status, including uncompleted partitions and replicas from a child region.queryJobStatus
(String kafkaTopic) queryJobStatus
(String kafkaTopic, Optional<String> incrementalPushVersion) This method is used to query the job status from a controller.queryJobStatus
(String kafkaTopic, Optional<String> incrementalPushVersion, int timeoutMs, String targetedRegions) queryJobStatus
(String kafkaTopic, Optional<String> incrementalPushVersion, String targetedRegions) queryOverallJobStatus
(String kafkaTopic, Optional<String> incrementalPushVersion) queryOverallJobStatus
(String kafkaTopic, Optional<String> incrementalPushVersion, String targetedRegions) This method has a longer timeout intended to be used to query the overall job status on a parent controller.queryStoreList
(boolean includeSystemStores) queryStoreList
(boolean includeSystemStores, Optional<String> configNameFilter, Optional<String> configValueFilter) removeDerivedSchema
(String storeName, int valueSchemaId, int derivedSchemaId) removeNodeFromAllowList
(String instanceId) removeNodeFromCluster
(String instanceId) removeStoreFromGraveyard
(String storeName) requestTopicForWrites
(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride) requestTopicForWrites
(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride, boolean deferVersionSwap) requestTopicForWrites
(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride, boolean deferVersionSwap, String targetedRegions, int repushSourceVersion, boolean pushToSeparateRealtimeTopic) Request a topic for the VeniceWriter to write into.<R extends ControllerResponse>
RretryableRequest
(int totalAttempts, Function<ControllerClient, R> request) <R extends ControllerResponse>
RretryableRequest
(int totalAttempts, Function<ControllerClient, R> request, Function<R, Boolean> abortRetryCondition) static <C extends ControllerClient,
R extends ControllerResponse>
RretryableRequest
(C client, int totalAttempts, Function<C, R> request) Useful for pieces of code which want to have a test mocking the result of the function that's passed in...static <C extends ControllerClient,
R extends ControllerResponse>
RretryableRequest
(C client, int totalAttempts, Function<C, R> request, Function<R, Boolean> abortRetryCondition) rollbackToBackupVersion
(String storeName) rollbackToBackupVersion
(String storeName, String regionFilter) rollForwardToFutureVersion
(String storeName) rollForwardToFutureVersion
(String storeName, String regionFilter) sendEmptyPushAndWait
(String storeName, String pushJobId, long storeSize, long timeOut) Sends and empty push to the venice controller, but verifies that the push has succeeded before returning to the caller.sendHeartbeatToSystemStore
(String storeName, long heartbeatTimestamp) sendPushJobDetails
(String storeName, int version, byte[] pushJobDetails) setMigrationPushStrategy
(String voldemortStoreName, String pushStrategy) setStoreOwner
(String storeName, String owner) setStorePartitionCount
(String storeName, String partitionNum) skipAdminMessage
(String offset, boolean skipDIV) updateAclForStore
(String storeName, String accessPermissions) updateAdminTopicMetadata
(long executionId, Optional<String> storeName, Optional<Long> offset, Optional<Long> upstreamOffset) updateClusterConfig
(UpdateClusterConfigQueryParams queryParams) updateKafkaTopicLogCompaction
(String kafkaTopicName, boolean logCompactionEnabled) updateKafkaTopicMinInSyncReplica
(String kafkaTopicName, int minISR) updateKafkaTopicRetention
(String kafkaTopicName, long retentionInMs) updateStoragePersona
(String name, UpdateStoragePersonaQueryParams queryParams) updateStore
(String storeName, UpdateStoreQueryParams queryParams) writeEndOfPush
(String storeName, int version)
-
Constructor Details
-
ControllerClient
-
ControllerClient
- Parameters:
discoveryUrls
- comma-delimited urls to find leader controller.
-
-
Method Details
-
discoverAndConstructControllerClient
@Deprecated public static ControllerClient discoverAndConstructControllerClient(String storeName, String discoveryUrls, Optional<SSLFactory> sslFactory, int retryAttempts) -
constructClusterControllerClient
@Deprecated public static ControllerClient constructClusterControllerClient(String clusterName, String discoveryUrls) -
constructClusterControllerClient
@Deprecated public static ControllerClient constructClusterControllerClient(String clusterName, String discoveryUrls, Optional<SSLFactory> sslFactory) -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
discoverLeaderController
-
getStore
-
getStore
-
getRepushInfo
-
getFutureVersions
-
getBackupVersions
-
getStore
@Deprecated public static StoreResponse getStore(String urlsToFindLeaderController, String clusterName, String storeName) Deprecated. -
getStorageEngineOverheadRatio
-
getInUseSchemaIds
-
deleteValueSchemas
-
requestTopicForWrites
public VersionCreationResponse requestTopicForWrites(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride) -
requestTopicForWrites
public VersionCreationResponse requestTopicForWrites(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride, boolean deferVersionSwap) -
requestTopicForWrites
public VersionCreationResponse requestTopicForWrites(String storeName, long storeSize, Version.PushType pushType, String pushJobId, boolean sendStartOfPush, boolean sorted, boolean wcEnabled, Optional<String> partitioners, Optional<String> compressionDictionary, Optional<String> sourceGridFabric, boolean batchJobHeartbeatEnabled, long rewindTimeInSecondsOverride, boolean deferVersionSwap, String targetedRegions, int repushSourceVersion, boolean pushToSeparateRealtimeTopic) Request a topic for the VeniceWriter to write into. A new VPJ push, or a Samza bulk processing job should both use this method. The push job ID needs to be unique for this push. Multiple requests with the same pushJobId are idempotent and will return the same topic.- Parameters:
storeName
- Name of the store being written to.storeSize
- Estimated size of push in bytes, used to determine partitioningpushJobId
- Unique identifier for this jobsendStartOfPush
- Whether controller should send START_OF_PUSH message to the newly created topic, while adding a new version. This is currently used in Samza batch load, a.k.a. grandfathersorted
- Whether the push is going to contain sorted data (in each partition) or notwcEnabled
- Whether write compute is enabled for this push job or notpartitioners
- partitioner class names in a string seperated by commacompressionDictionary
- Base64 encoded dictionary to be used to perform dictionary compressionsourceGridFabric
- An identifier of the data center which is used in native replication to determine the Kafka URLbatchJobHeartbeatEnabled
- whether batch push job enables the heartbeatrewindTimeInSecondsOverride
- if a valid value is specified (>=0) for hybrid store, this param will override the default store-level rewindTimeInSeconds config.deferVersionSwap
- whether to defer version swap after the push is donetargetedRegions
- the list of regions that is separated by comma for targeted region push.repushSourceVersion
-- Returns:
- VersionCreationResponse includes topic and partitioning
-
addVersionAndStartIngestion
public VersionResponse addVersionAndStartIngestion(String storeName, String pushJobId, int version, int partitionCount, Version.PushType pushType, String remoteKafkaBootstrapServers, long rewindTimeInSecondsOverride, int replicationMetadataVersionId) Used for store migration to add version and start ingestion in destination cluster for new pushes in the source cluster during the ingestion. The idea is like copying or create a version on an existing topic. Different use cases can be explored and expanded in the future. Applicable only to child controllers.- Parameters:
storeName
- of the original push.pushJobId
- of the original push.version
- of the original push.partitionCount
- of the original push.pushType
- of the producer.remoteKafkaBootstrapServers
- of the original push.rewindTimeInSecondsOverride
- of the original push.replicationMetadataVersionId
- of the original push.- Returns:
-
writeEndOfPush
-
sendEmptyPushAndWait
public ControllerResponse sendEmptyPushAndWait(String storeName, String pushJobId, long storeSize, long timeOut) Sends and empty push to the venice controller, but verifies that the push has succeeded before returning to the caller.- Parameters:
storeName
- the store name for which the empty push is forpushJobId
- the push job id for the pushstoreSize
- the size of the store (currently unused)timeOut
- max amount of time this function should take before returning in MILLISECONDS. Retries sent to the controller have 2-second sleeps between them. So a timeout should be chosen that is larger, and a multiple of 2 seconds preferably.- Returns:
- the response from the controller. Either a successful one, or a failed one with more information.
-
createNewStoreWithParameters
public ControllerResponse createNewStoreWithParameters(String storeName, String owner, String keySchema, String valueSchema, UpdateStoreQueryParams updateStoreQueryParams) Simplified API that wraps together the store create and update functionalities with some clean up functionality- Parameters:
storeName
- the store name to create and updateowner
- the owner of this store to be createdkeySchema
- Schema of the key for row retrieval for this storevalueSchema
- Schema of the value for rows in this new storeupdateStoreQueryParams
- What parameters should be applied to this store after it's creation- Returns:
- The response from the first failed operation of store creation or modification
-
emptyPush
-
createNewStore
public NewStoreResponse createNewStore(String storeName, String owner, String keySchema, String valueSchema) -
createNewStore
-
createNewSystemStore
public NewStoreResponse createNewSystemStore(String storeName, String owner, String keySchema, String valueSchema) -
isStoreMigrationAllowed
-
migrateStore
-
completeMigration
-
abortMigration
This command should be sent to src controller, not dest controller -
deleteStore
-
wipeCluster
-
compareStore
-
copyOverStoreMetadata
public StoreResponse copyOverStoreMetadata(String sourceFabric, String destFabric, String storeName) -
disableAndDeleteStore
-
overrideSetActiveVersion
-
rollbackToBackupVersion
-
rollbackToBackupVersion
-
rollForwardToFutureVersion
-
rollForwardToFutureVersion
-
killOfflinePushJob
-
skipAdminMessage
-
getKafkaTopicConfigs
-
updateKafkaTopicLogCompaction
public ControllerResponse updateKafkaTopicLogCompaction(String kafkaTopicName, boolean logCompactionEnabled) -
updateKafkaTopicRetention
-
updateKafkaTopicMinInSyncReplica
-
retryableRequest
public <R extends ControllerResponse> R retryableRequest(int totalAttempts, Function<ControllerClient, R> request) -
retryableRequest
public <R extends ControllerResponse> R retryableRequest(int totalAttempts, Function<ControllerClient, R> request, Function<R, Boolean> abortRetryCondition) -
retryableRequest
public static <C extends ControllerClient,R extends ControllerResponse> R retryableRequest(C client, int totalAttempts, Function<C, R> request) Useful for pieces of code which want to have a test mocking the result of the function that's passed in... -
retryableRequest
public static <C extends ControllerClient,R extends ControllerResponse> R retryableRequest(C client, int totalAttempts, Function<C, R> request, Function<R, Boolean> abortRetryCondition) -
queryOverallJobStatus
public JobStatusQueryResponse queryOverallJobStatus(String kafkaTopic, Optional<String> incrementalPushVersion, String targetedRegions) This method has a longer timeout intended to be used to query the overall job status on a parent controller. The extended timeout is meant for the parent controller to query each colo's child controller for the job status and aggregate the results. UsequeryJobStatus(String, Optional)
instead if the target is a child controller.- Parameters:
kafkaTopic
- , the version topic name of the push job.incrementalPushVersion
- , the optional incremental push version of the push job.targetedRegions
- , the list of regions that is separated by comma for targeted region push.- Returns:
-
queryOverallJobStatus
public JobStatusQueryResponse queryOverallJobStatus(String kafkaTopic, Optional<String> incrementalPushVersion) -
queryJobStatus
-
queryJobStatus
public JobStatusQueryResponse queryJobStatus(String kafkaTopic, Optional<String> incrementalPushVersion) This method is used to query the job status from a controller. It is expected to be a child controller thus a shorter timeout is enforced. UsequeryOverallJobStatus(String, Optional)
instead if the target is a parent controller. -
queryJobStatus
public JobStatusQueryResponse queryJobStatus(String kafkaTopic, Optional<String> incrementalPushVersion, String targetedRegions) -
queryJobStatus
public JobStatusQueryResponse queryJobStatus(String kafkaTopic, Optional<String> incrementalPushVersion, int timeoutMs, String targetedRegions) -
queryDetailedJobStatus
This method will retrieve detailed job status, including uncompleted partitions and replicas from a child region. If the request is sent to a parent controller, it will be forwarded to a child controller in the specified region. This method is used for data recovery progress monitoring. -
sendPushJobDetails
-
queryStoreList
-
queryStoreList
-
queryStoreList
public MultiStoreResponse queryStoreList(boolean includeSystemStores, Optional<String> configNameFilter, Optional<String> configValueFilter) -
listStoresStatuses
-
enableStoreWrites
-
enableStoreReads
-
enableStoreReadWrites
-
deleteAllVersions
-
deleteOldVersion
-
isNodeRemovable
-
isNodeRemovable
-
addNodeIntoAllowList
-
removeNodeFromAllowList
-
removeNodeFromCluster
-
listStorageNodes
-
getAggregatedHealthStatus
public StoppableNodeStatusResponse getAggregatedHealthStatus(String clusterName, List<String> instances, List<String> toBeStoppedInstances) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
listInstancesStatuses
-
listReplicas
-
listStorageNodeReplicas
-
nodeReplicasReadiness
-
listChildControllers
-
getKeySchema
-
addValueSchema
-
addValueSchema
-
addValueSchema
public SchemaResponse addValueSchema(String storeName, String valueSchemaStr, int valueSchemaId, DirectionalSchemaCompatibilityType schemaCompatType) -
addDerivedSchema
public SchemaResponse addDerivedSchema(String storeName, int valueSchemaId, String derivedSchemaStr) -
addDerivedSchema
public SchemaResponse addDerivedSchema(String storeName, int valueSchemaId, String derivedSchemaStr, int derivedSchemaId) -
removeDerivedSchema
-
setStorePartitionCount
-
setStoreOwner
-
updateStore
-
getValueSchema
-
getValueSchemaID
-
getValueOrDerivedSchemaId
-
getAllValueSchema
-
getAllReplicationMetadataSchemas
-
getAllValueAndDerivedSchema
-
getAdminCommandExecution
-
getLastSucceedExecutionId
-
enableThrottling
-
enableMaxCapacityProtection
-
enableQuotaRebalanced
-
getRoutersClusterConfig
-
getMigrationPushStrategies
-
setMigrationPushStrategy
-
listBootstrappingVersions
-
updateAclForStore
-
getAclForStore
-
deleteAclForStore
-
sendHeartbeatToSystemStore
-
getHeartbeatFromSystemStore
-
configureActiveActiveReplicationForCluster
public ControllerResponse configureActiveActiveReplicationForCluster(boolean enableActiveActiveReplication, String storeType, Optional<String> regionsFilter) -
checkResourceCleanupForStoreCreation
-
getQueryParamsToDiscoverCluster
-
getDeletableStoreTopics
-
getClusterStaleStores
public ClusterStaleDataAuditResponse getClusterStaleStores(String clusterName, String parentControllerUrl) -
getClusterStores
-
getStoreLargestUsedVersion
-
getRegionPushDetails
public RegionPushDetailsResponse getRegionPushDetails(String storeName, boolean isPartitionDetailEnabled) -
listStorePushInfo
public StoreHealthAuditResponse listStorePushInfo(String storeName, boolean isPartitionDetailEnabled) -
discoverCluster
public static D2ServiceDiscoveryResponse discoverCluster(String discoveryUrls, String storeName, Optional<SSLFactory> sslFactory, int retryAttempts) -
discoverCluster
-
updateClusterConfig
-
prepareDataRecovery
-
isStoreVersionReadyForDataRecovery
-
dataRecovery
-
getAdminTopicMetadata
-
updateAdminTopicMetadata
-
deleteKafkaTopic
-
createStoragePersona
-
getStoragePersona
-
deleteStoragePersona
-
updateStoragePersona
public ControllerResponse updateStoragePersona(String name, UpdateStoragePersonaQueryParams queryParams) -
getStoragePersonaAssociatedWithStore
-
getClusterStoragePersonas
-
cleanupInstanceCustomizedStates
-
removeStoreFromGraveyard
-
newParams
Add all global parameters in this method. Always use a form of this method to generate a new list of NameValuePair objects for making HTTP requests.- Returns:
-
encodeQueryParams
-
getClusterName
-
getLeaderControllerUrl
-
getControllerDiscoveryUrls
-
ControllerClientFactory.getControllerClient(java.lang.String, java.lang.String, java.util.Optional<com.linkedin.venice.security.SSLFactory>)