THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
/** * This interface provides storing and fetching remote log segment metadata with strongly consistent semantics. * <p> * When "cluster.id", "broker.id" and all the properties prefixed with "remote.log.metadata." are passed when * {@link #configure(Map)} is invoked on this instance,. {@link #BROKER_ID}, {@link #CLUSTER_ID} properties are* <p> * passed which can be used by this instance if needed. These propertiess"cluster.id", "broker.id" properties can be used if there is a single storage used * for different clusters. * For ex: MySQL storage can be used as metadata store for all the clusters across the org. * <p> * * todo-tier cleanup the abstractions in this interface. */ @InterfaceStability.Unstable public interface RemoteLogMetadataManager extends Configurable, Closeable { /** * PropertyStores nameRemoteLogSegmentMetadata forwith broker id. */ String BROKER_ID = "broker.id"; /** * Property name for cluster id. */ String CLUSTER_ID = "cluster.id"; /** * Stores RemoteLogSegmentMetadata with the containing RemoteLogSegmentId into RemoteLogMetadataManager. * * RemoteLogSegmentMetadata is identified by RemoteLogSegmentId. * * @param remoteLogSegmentMetadata * @throws RemoteStorageException */ void putRemoteLogSegmentData(RemoteLogSegmentMetadata remoteLogSegmentMetadata) throws RemoteStorageException; /** * Fetches RemoteLogSegmentId for the given topic partition which contains the given offset. *the containing RemoteLogSegmentId into RemoteLogMetadataManager. * This<p> will evolve to refactor TopicPartition* toRemoteLogSegmentMetadata TopicPartitionIdis whichidentified contains a unique identifier and TopicPartitionby RemoteLogSegmentId. * * @param topicPartition * @param offset remoteLogSegmentMetadata metadata about the remote log segment to be deleted. * @return * @throws RemoteStorageException @throws RemoteStorageException if there are any storage related errors occurred. */ RemoteLogSegmentIdvoid remoteLogSegmentIdputRemoteLogSegmentData(TopicPartition topicPartition, long offsetRemoteLogSegmentMetadata remoteLogSegmentMetadata) throws RemoteStorageException; /** * Fetches RemoteLogSegmentMetadata for the given topic partition, offset and leader-epoch for the offset. * <p> * This will evolve to refactor TopicPartition to TopicPartitionId which contains a unique identifier and TopicPartition. * * @param topicPartition topic partition * @param offset offset * @param epochForOffset leader epoch for the given offset * @return * @return * @throws RemoteStorageException @throws RemoteStorageException if there are any storage related errors occurred. */ RemoteLogSegmentMetadata remoteLogSegmentMetadata(TopicPartition topicPartition, long offset, int epochForOffset) throws RemoteStorageException; /** * Returns earliest log offset if there are segments in the remote storage for the given topic partition, elseand * leader epoch else returns {@link Optional#empty()}. * * This is treated as the effective log-start-offset of the @param topicPartition topic partition's log. * @param * todo check whether we need to pass leader-epoch. * * @param tpleaderEpoch leader epoch * @return */ Optional<Long> earliestLogOffset(TopicPartition tp topicPartition, int leaderEpoch) throws RemoteStorageException; /** * Returns highest log offset of topic partition for the given leader epoch in remote storage. * * @param topicPartition * @param tpleaderEpoch * @return * @throws RemoteStorageException */ Optional<Long> highestLogOffset(TopicPartition tptopicPartition, int leaderEpoch) throws RemoteStorageException; /** * Deletes the log segment metadata for the given remoteLogSegmentId. * * @param remoteLogSegmentId * @throws RemoteStorageException */ void deleteRemoteLogSegmentMetadata(RemoteLogSegmentId remoteLogSegmentId) throws RemoteStorageException; /** * List the remote log segment files of the given topicPartition. * The RemoteLogManager of a follower uses this method to find out the remote data for the given topic partition. * <p> * This is used in while deleting a given topic partition to fetch all the remote log segments for the given topic * partition and set a tombstone marker for them to be deleted. * * @return ListIterator of remote segments, sorted by baseOffset in ascending order. */ default List<RemoteLogSegmentMetadata>Iterator<RemoteLogSegmentMetadata> listRemoteLogSegments(TopicPartition topicPartition) { return listRemoteLogSegments(topicPartition, 0); } /** * Returns listiterator of remote segments, sorted by {@link RemoteLogSegmentMetadata#startOffset()} in ascending order * which are >= the given min Offset. * * @param topicPartition * @param minOffset * @return ListIterator of remote segments, sorted by baseOffset in ascending order. */ List<RemoteLogSegmentMetadata>Iterator<RemoteLogSegmentMetadata> listRemoteLogSegments(TopicPartition topicPartition, long minOffset); /** * This method is invoked only when there are changes in leadership of the topic partitions that this broker is * responsible for. * * @param leaderPartitions partitions that have become leaders on this broker. * @param followerPartitions partitions that have become followers on this broker. */ void onPartitionLeadershipChanges(Set<TopicPartition> leaderPartitions, Set<TopicPartition> followerPartitions); /** * This method is invoked only when the given topic partitions are stopped on this broker. This can happen when a * partition is emigrated to other broker or a partition is deleted. * * @param partitions */ void onStopPartitions(Set<TopicPartition> partitions); /** * Callback to receive once server is started so that this class can run tasks which should be run only when the * server is started. */ void onServerStarted(); } |
...