Package com.linkedin.venice.controller
Class ProtocolVersionAutoDetectionService
java.lang.Object
com.linkedin.venice.service.AbstractVeniceService
com.linkedin.venice.controller.ProtocolVersionAutoDetectionService
- All Implemented Interfaces:
Closeable
,AutoCloseable
This service is responsible for auto-detecting the admin operation protocol version for one cluster periodically.
ProtocolVersionAutoDetectionService is a background scheduled executor, each attempt it will:
1. Get the current admin operation protocol versions from all controllers (parent + child) in the current cluster
and find the smallest version - good version to use.
2. Get the admin operation protocol version from ZK.
3. If the version in ZK is different from the current version, update the version in ZK.
To disable step 3, set the admin version for the cluster in ZK as -1.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
Constructor Summary
ConstructorsConstructorDescriptionProtocolVersionAutoDetectionService
(String clusterName, VeniceHelixAdmin admin, ProtocolVersionAutoDetectionStats stats, long sleepIntervalInMs) -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the smallest local admin operation protocol version for all consumers in the given cluster.boolean
void
-
Constructor Details
-
ProtocolVersionAutoDetectionService
public ProtocolVersionAutoDetectionService(String clusterName, VeniceHelixAdmin admin, ProtocolVersionAutoDetectionStats stats, long sleepIntervalInMs)
-
-
Method Details
-
startInner
- Specified by:
startInner
in classAbstractVeniceService
- Returns:
- true if the service is completely started,
false if it is still starting asynchronously (in this case, it is the implementer's
responsibility to set
AbstractVeniceService.serviceState
toAbstractVeniceService.ServiceState.STARTED
upon completion of the async work). - Throws:
Exception
-
stopInner
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
Exception
-
getSmallestLocalAdminOperationProtocolVersionForAllConsumers
Get the smallest local admin operation protocol version for all consumers in the given cluster. This will help to ensure that, during re-balancing process, the version we use is still a good version, and we won't send in bad admin message that consumers cannot deserialize.- Parameters:
clusterName
- The name of the cluster to check.- Returns:
- The smallest local admin operation protocol version for all consumers (parent + child controllers) in the cluster.
-