Package com.linkedin.venice.helix
Class HelixReadOnlyZKSharedSystemStoreRepository
- java.lang.Object
-
- com.linkedin.venice.helix.CachedReadOnlyStoreRepository
-
- com.linkedin.venice.helix.HelixReadOnlyStoreRepository
-
- com.linkedin.venice.helix.HelixReadOnlyZKSharedSystemStoreRepository
-
- All Implemented Interfaces:
ReadOnlyStoreRepository
,VeniceResource
- Direct Known Subclasses:
SharedHelixReadOnlyZKSharedSystemStoreRepository
public class HelixReadOnlyZKSharedSystemStoreRepository extends HelixReadOnlyStoreRepository
This repository provides an interface to access zk shared system stores only. With this implementation, we will minimize the zwatches required to the system store cluster. But there is a shortcoming with current implementation, since all the system store related operations will be constrained by the healthiness of system store cluster.
-
-
Field Summary
-
Fields inherited from class com.linkedin.venice.helix.CachedReadOnlyStoreRepository
clusterLockManager, clusterName, clusterStoreRepositoryPath, STORE_REPOSITORY_PATH, storeMap, zkClient, zkDataAccessor
-
-
Constructor Summary
Constructors Constructor Description HelixReadOnlyZKSharedSystemStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, java.lang.String systemStoreClusterName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
int
getBatchGetLimit(java.lang.String storeName)
Only return zk shared system store related info, otherwiseVeniceException
will be thrown.Store
getStore(java.lang.String storeName)
Only the zk shared system store can be returned, otherwise this function will return null.Store
getStoreOrThrow(java.lang.String storeName)
Only the zk shared system store can be returned, otherwise this function will throwVeniceNoStoreException
.protected java.util.List<Store>
getStoresFromZk()
This function is used to filter out non system stores from the system store cluster, and this is very important sinceCachedReadOnlyStoreRepository.refresh()
is relying on this function to retrieve all the stores in this cluster and put a watch against each znode, and we need to filter out non-system stores to avoid unnecessary zk watches.long
getTotalStoreReadQuota()
Get total read quota of all stores.boolean
hasStore(java.lang.String storeName)
Only return true for the existing zk shared system store.boolean
isReadComputationEnabled(java.lang.String storeName)
Only return zk shared system store related info, otherwiseVeniceException
will be thrown.protected void
onRepositoryChanged(java.util.Collection<java.lang.String> newZkStoreNames)
This function is used to filter out non system stores to avoid unnecessary zk watches against the newly added regular stores.void
refresh()
Store
refreshOneStore(java.lang.String storeName)
Only zk shared system store can be refreshed here, otherwiseVeniceException
will be thrown.-
Methods inherited from class com.linkedin.venice.helix.HelixReadOnlyStoreRepository
onStoreChanged, putStore, removeStore
-
Methods inherited from class com.linkedin.venice.helix.CachedReadOnlyStoreRepository
getAllStores, getStoreFromZk, getStoresFromZk, getStoreZkPath, notifyStoreChanged, notifyStoreCreated, notifyStoreDeleted, registerStoreDataChangedListener, unregisterStoreDataChangedListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.linkedin.venice.meta.ReadOnlyStoreRepository
waitVersion, waitVersion
-
-
-
-
Constructor Detail
-
HelixReadOnlyZKSharedSystemStoreRepository
public HelixReadOnlyZKSharedSystemStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, java.lang.String systemStoreClusterName)
-
-
Method Detail
-
getStore
public Store getStore(java.lang.String storeName)
Only the zk shared system store can be returned, otherwise this function will return null.- Specified by:
getStore
in interfaceReadOnlyStoreRepository
- Overrides:
getStore
in classCachedReadOnlyStoreRepository
- Parameters:
storeName
- name of wanted store.- Returns:
- Store for given name.
-
getStoreOrThrow
public Store getStoreOrThrow(java.lang.String storeName) throws VeniceNoStoreException
Only the zk shared system store can be returned, otherwise this function will throwVeniceNoStoreException
.- Specified by:
getStoreOrThrow
in interfaceReadOnlyStoreRepository
- Overrides:
getStoreOrThrow
in classCachedReadOnlyStoreRepository
- Throws:
VeniceNoStoreException
-
hasStore
public boolean hasStore(java.lang.String storeName)
Only return true for the existing zk shared system store.- Specified by:
hasStore
in interfaceReadOnlyStoreRepository
- Overrides:
hasStore
in classCachedReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
refreshOneStore
public Store refreshOneStore(java.lang.String storeName)
Only zk shared system store can be refreshed here, otherwiseVeniceException
will be thrown.- Specified by:
refreshOneStore
in interfaceReadOnlyStoreRepository
- Overrides:
refreshOneStore
in classCachedReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
- the newly refreshed store
-
getStoresFromZk
protected java.util.List<Store> getStoresFromZk()
This function is used to filter out non system stores from the system store cluster, and this is very important sinceCachedReadOnlyStoreRepository.refresh()
is relying on this function to retrieve all the stores in this cluster and put a watch against each znode, and we need to filter out non-system stores to avoid unnecessary zk watches.- Overrides:
getStoresFromZk
in classCachedReadOnlyStoreRepository
- Returns:
-
onRepositoryChanged
protected void onRepositoryChanged(java.util.Collection<java.lang.String> newZkStoreNames)
This function is used to filter out non system stores to avoid unnecessary zk watches against the newly added regular stores.- Overrides:
onRepositoryChanged
in classHelixReadOnlyStoreRepository
- Parameters:
newZkStoreNames
-
-
getTotalStoreReadQuota
public long getTotalStoreReadQuota()
Description copied from interface:ReadOnlyStoreRepository
Get total read quota of all stores.- Specified by:
getTotalStoreReadQuota
in interfaceReadOnlyStoreRepository
- Overrides:
getTotalStoreReadQuota
in classCachedReadOnlyStoreRepository
-
getBatchGetLimit
public int getBatchGetLimit(java.lang.String storeName)
Only return zk shared system store related info, otherwiseVeniceException
will be thrown.- Specified by:
getBatchGetLimit
in interfaceReadOnlyStoreRepository
- Overrides:
getBatchGetLimit
in classCachedReadOnlyStoreRepository
- Returns:
-
isReadComputationEnabled
public boolean isReadComputationEnabled(java.lang.String storeName)
Only return zk shared system store related info, otherwiseVeniceException
will be thrown.- Specified by:
isReadComputationEnabled
in interfaceReadOnlyStoreRepository
- Overrides:
isReadComputationEnabled
in classCachedReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
refresh
public void refresh()
- Specified by:
refresh
in interfaceVeniceResource
- Overrides:
refresh
in classHelixReadOnlyStoreRepository
-
clear
public void clear()
- Specified by:
clear
in interfaceVeniceResource
- Overrides:
clear
in classHelixReadOnlyStoreRepository
-
-