Class HelixReadWriteStoreRepository
- All Implemented Interfaces:
ReadOnlyStoreRepository,ReadWriteStoreRepository,VeniceResource
This repository does NOT listen the change of store from ZK. Because in Venice, this is the only once place to modify stores.
Persistence layout (only when perVersionZnodeEnabled is true):
/<cluster>/Stores/<name>holds theStoreJSON. Its embedded versions list is the legacy set inherited from stores that pre-date the per-version-znode layout. The list is never appended to; it can only shrink (when the caller removes a legacy version) or have its entries mutated in place (e.g. viaupdateVersionStatus, which mutates the shared Avro record)./<cluster>/Stores/<name>/versions/<n>holds each non-legacyVersionas its own JSON znode. Every newly added version lands here; mutations to existing znode-versions are propagated by re-writing the znode on the nextupdateStorecall.
When the flag is false, the entire Store (including its versions list) is persisted to the single store
znode — the layout every Venice cluster used before this work. The read path is unconditionally smart and supports
both layouts so readers can roll out ahead of writers.
Invariant (split layout only): a given version number lives in exactly one of the two layers. The write path
enforces this by upserting target versions to /versions/<n> iff their number is NOT in the prior embedded
list, and by deleting any stale per-version znode whose number remains embedded. There is no migration step that
moves a legacy embedded version into a per-version znode.
-
Field Summary
Fields inherited from class com.linkedin.venice.helix.CachedReadOnlyStoreRepository
clusterLockManager, clusterStoreRepositoryPath, STORE_REPOSITORY_PATH, storeMap, versionAccessor, zkClient, zkDataAccessor -
Constructor Summary
ConstructorsConstructorDescriptionHelixReadWriteStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, String clusterName, Optional<MetaStoreWriter> metaStoreWriter, ClusterLockManager storeLock) HelixReadWriteStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, String clusterName, Optional<MetaStoreWriter> metaStoreWriter, ClusterLockManager storeLock, boolean perVersionZnodeEnabled) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd store into repository.voiddeleteStore(String storeName) Delete store from repository.Get all stores in the current repositoryGet one store by given name from repository.getStoreOrThrow(String storeName) refreshOneStore(String storeName) Selective refresh operation which fetches one store from ZKvoidupdateStore(Store store) Update store in repository.Methods inherited from class com.linkedin.venice.helix.CachedReadOnlyStoreRepository
clear, getBatchGetLimit, getStoreFromZk, getStoresFromZk, getStoresFromZk, getStoreZkPath, getTotalStoreReadQuota, hasStore, hydrateVersionsFromZk, isReadComputationEnabled, notifyStoreChanged, notifyStoreCreated, notifyStoreDeleted, putStore, refresh, registerStoreDataChangedListener, removeStore, unregisterStoreDataChangedListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.meta.ReadOnlyStoreRepository
getBatchGetLimit, getTotalStoreReadQuota, hasStore, isReadComputationEnabled, registerStoreDataChangedListener, unregisterStoreDataChangedListener, waitVersion, waitVersionMethods inherited from interface com.linkedin.venice.VeniceResource
clear, refresh
-
Constructor Details
-
HelixReadWriteStoreRepository
public HelixReadWriteStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, String clusterName, Optional<MetaStoreWriter> metaStoreWriter, ClusterLockManager storeLock) -
HelixReadWriteStoreRepository
public HelixReadWriteStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer compositeSerializer, String clusterName, Optional<MetaStoreWriter> metaStoreWriter, ClusterLockManager storeLock, boolean perVersionZnodeEnabled)
-
-
Method Details
-
addStore
Description copied from interface:ReadWriteStoreRepositoryAdd store into repository.- Specified by:
addStorein interfaceReadWriteStoreRepository- Parameters:
store- store need to be added.
-
updateStore
Description copied from interface:ReadWriteStoreRepositoryUpdate store in repository.- Specified by:
updateStorein interfaceReadWriteStoreRepository- Parameters:
store- store need to be udpated.
-
deleteStore
Description copied from interface:ReadWriteStoreRepositoryDelete store from repository.- Specified by:
deleteStorein interfaceReadWriteStoreRepository- Parameters:
storeName- name of wantted store.
-
getStore
Description copied from interface:ReadOnlyStoreRepositoryGet one store by given name from repository.- Specified by:
getStorein interfaceReadOnlyStoreRepository- Overrides:
getStorein classCachedReadOnlyStoreRepository- Parameters:
storeName- name of wanted store.- Returns:
- Store for given name.
-
getStoreOrThrow
- Specified by:
getStoreOrThrowin interfaceReadOnlyStoreRepository- Overrides:
getStoreOrThrowin classCachedReadOnlyStoreRepository- Throws:
VeniceNoStoreException
-
getAllStores
Description copied from interface:ReadOnlyStoreRepositoryGet all stores in the current repository- Specified by:
getAllStoresin interfaceReadOnlyStoreRepository- Overrides:
getAllStoresin classCachedReadOnlyStoreRepository- Returns:
-
refreshOneStore
Description copied from interface:ReadOnlyStoreRepositorySelective refresh operation which fetches one store from ZK- Specified by:
refreshOneStorein interfaceReadOnlyStoreRepository- Overrides:
refreshOneStorein classCachedReadOnlyStoreRepository- Parameters:
storeName- store name- Returns:
- the newly refreshed store
-