Class 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 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
    • 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)
        Write StoreConfig 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 interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException