Package com.linkedin.venice.system.store
Class MetaStoreWriter
- java.lang.Object
-
- com.linkedin.venice.system.store.MetaStoreWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class MetaStoreWriter extends java.lang.Object implements java.io.Closeable
This class is to write metadata: store properties/key schema/value schemas/replica statuses to meta system store. So far, only child fabric should write to it and in the future, we may want to support the write from parent fabric, which can be used for the fabric buildup. TODO: we may need to consider to close the corresponding VeniceWriter when the store is deleted.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_STRING_CLUSTER_NAME
static java.lang.String
KEY_STRING_PARTITION_ID
static java.lang.String
KEY_STRING_SCHEMA_ID
static java.lang.String
KEY_STRING_STORE_NAME
static java.lang.String
KEY_STRING_VERSION_NUMBER
-
Constructor Summary
Constructors Constructor Description MetaStoreWriter(TopicManager topicManager, VeniceWriterFactory writerFactory, HelixReadOnlyZKSharedSchemaRepository schemaRepo, PubSubTopicRepository pubSubTopicRepository, long closeTimeoutMs, int numOfConcurrentVwCloseOps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
If numOfConcurrentVwCloseOps is set to -1, then all the VeniceWriters will be closed asynchronously and concurrently.void
deleteStoreReplicaStatus(java.lang.String clusterName, java.lang.String storeName, int version, int partitionId)
Clean up deprecated replica statuses.VeniceWriter
getMetaStoreWriter(java.lang.String metaStoreName)
void
removeMetaStoreWriter(java.lang.String metaStoreName)
This function should be used only for store deletion scenario.void
writeHeartbeat(java.lang.String storeName, long heartbeatTimestamp)
void
writeInUseValueSchema(java.lang.String storeName, int versionNumber, int valueSchemaId)
void
writeReadyToServerStoreReplicas(java.lang.String clusterName, java.lang.String storeName, int version, int partitionId, java.util.Collection<Instance> readyToServeInstances)
This function is used to produce a snapshot for replica statuses.void
writeStoreClusterConfig(StoreConfig storeConfig)
WriteStoreConfig
equivalent to the meta system store.void
writeStoreKeySchemas(java.lang.String storeName, java.util.Collection<SchemaEntry> keySchemas)
void
writeStoreProperties(java.lang.String clusterName, Store store)
This function should be invoked for any store metadata change.void
writeStoreValueSchemas(java.lang.String storeName, java.util.Collection<SchemaEntry> valueSchemas)
This function should be invoked for any value schema changes, and the {@param valueSchemas} should contain all the value schemas since this operation will be a full PUT.
-
-
-
Field Detail
-
KEY_STRING_STORE_NAME
public static final java.lang.String KEY_STRING_STORE_NAME
- See Also:
- Constant Field Values
-
KEY_STRING_CLUSTER_NAME
public static final java.lang.String KEY_STRING_CLUSTER_NAME
- See Also:
- Constant Field Values
-
KEY_STRING_VERSION_NUMBER
public static final java.lang.String KEY_STRING_VERSION_NUMBER
- See Also:
- Constant Field Values
-
KEY_STRING_PARTITION_ID
public static final java.lang.String KEY_STRING_PARTITION_ID
- See Also:
- Constant Field Values
-
KEY_STRING_SCHEMA_ID
public static final java.lang.String KEY_STRING_SCHEMA_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetaStoreWriter
public MetaStoreWriter(TopicManager topicManager, VeniceWriterFactory writerFactory, HelixReadOnlyZKSharedSchemaRepository schemaRepo, PubSubTopicRepository pubSubTopicRepository, long closeTimeoutMs, int numOfConcurrentVwCloseOps)
-
-
Method Detail
-
writeStoreProperties
public void writeStoreProperties(java.lang.String clusterName, Store store)
This function should be invoked for any store metadata change.
-
writeStoreKeySchemas
public void writeStoreKeySchemas(java.lang.String storeName, java.util.Collection<SchemaEntry> keySchemas)
-
writeStoreValueSchemas
public void writeStoreValueSchemas(java.lang.String storeName, java.util.Collection<SchemaEntry> valueSchemas)
This function should be invoked for any value schema changes, and the {@param valueSchemas} should contain all the value schemas since this operation will be a full PUT.
-
writeHeartbeat
public void writeHeartbeat(java.lang.String storeName, long heartbeatTimestamp)
-
writeInUseValueSchema
public void writeInUseValueSchema(java.lang.String storeName, int versionNumber, int valueSchemaId)
-
writeReadyToServerStoreReplicas
public void writeReadyToServerStoreReplicas(java.lang.String clusterName, java.lang.String storeName, int version, int partitionId, java.util.Collection<Instance> readyToServeInstances)
This function is used to produce a snapshot for replica statuses.
-
writeStoreClusterConfig
public void writeStoreClusterConfig(StoreConfig storeConfig)
WriteStoreConfig
equivalent to the meta system store. This is still only invoked by child controllers only.
-
deleteStoreReplicaStatus
public void deleteStoreReplicaStatus(java.lang.String clusterName, java.lang.String storeName, int version, int partitionId)
Clean up deprecated replica statuses. Currently, it is being used when cleaning up a deprecated version topic, where it guarantees all the partition replicas have been removed from Venice Cluster in TopicCleanupService.
-
removeMetaStoreWriter
public void removeMetaStoreWriter(java.lang.String metaStoreName)
This function should be used only for store deletion scenario.- Parameters:
metaStoreName
-
-
getMetaStoreWriter
public VeniceWriter getMetaStoreWriter(java.lang.String metaStoreName)
-
close
public void close() throws java.io.IOException
If numOfConcurrentVwCloseOps is set to -1, then all the VeniceWriters will be closed asynchronously and concurrently. If numOfConcurrentVwCloseOps is set to a positive number, then the VeniceWriters will be closed with a bounded concurrency until timeout. Once timeout is reached, the remaining VeniceWriters will be closed asynchronously and concurrently.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-