public class TierTopicManager
extends java.lang.Object
implements java.lang.Runnable
TierRecordType
.
The TierTopicManager is also responsible for making all the tiering related metadata available to all brokers in the
cluster. It does this by consuming from the tier topic and materializing relevant state into the TierPartitionState
files.Constructor and Description |
---|
TierTopicManager(TierMetadataManager tierMetadataManager,
TierTopicManagerConfig config,
java.util.function.Supplier<java.lang.String> bootstrapServersSupplier,
org.apache.kafka.common.metrics.Metrics metrics)
Primary public constructor for TierTopicManager.
|
TierTopicManager(TierTopicManagerConfig config,
TierTopicConsumerBuilder consumerBuilder,
TierTopicProducerBuilder producerBuilder,
java.util.function.Supplier<java.lang.String> bootstrapServersSupplier,
TierMetadataManager tierMetadataManager)
Instantiate TierTopicManager.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> |
addMetadata(AbstractTierMetadata entry)
Write an AbstractTierMetadata to the Tier Topic, returning a
CompletableFuture that tracks the result of the materialization after the
message has been read from the tier topic, allowing the sender to determine
whether the write was fenced, or the send failed.
|
java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> |
becomeArchiver(org.apache.kafka.common.TopicPartition topicPartition,
int tierEpoch)
Performs a write to the tier topic to attempt to become leader for the tiered topic partition.
|
void |
becomeReady(java.lang.String boostrapServers)
Ensure tier topic has been created and setup the backing consumer
and producer before signalling ready.
|
boolean |
catchingUp() |
boolean |
doWork()
Work cycle
public for testing purposes.
|
boolean |
isReady()
Return whether TierTopicManager is ready to accept writes.
|
TierPartitionState |
partitionState(org.apache.kafka.common.TopicPartition topicPartition)
Return the TierPartitionState for a given topic partition.
|
void |
run()
tier topic manager work loop
|
void |
shutdown()
Shutdown the tier topic manager.
|
void |
startup()
Startup the tier topic manager.
|
static java.lang.String |
topicName(java.lang.String tierNamespace)
Generate the tier topic name, namespaced if tierNamespace is non-empty.
|
public TierTopicManager(TierTopicManagerConfig config, TierTopicConsumerBuilder consumerBuilder, TierTopicProducerBuilder producerBuilder, java.util.function.Supplier<java.lang.String> bootstrapServersSupplier, TierMetadataManager tierMetadataManager) throws java.io.IOException
config
- TierTopicManagerConfig containing tiering configuration.consumerBuilder
- builder to create consumer instances.producerBuilder
- producer to create producer instances.tierMetadataManager
- Tier Metadata Manager instancejava.io.IOException
- on logdir write failurespublic TierTopicManager(TierMetadataManager tierMetadataManager, TierTopicManagerConfig config, java.util.function.Supplier<java.lang.String> bootstrapServersSupplier, org.apache.kafka.common.metrics.Metrics metrics) throws java.io.IOException
tierMetadataManager
- Tier Metadata Manager instanceconfig
- TierTopicManagerConfig containing tiering configuration.metrics
- kafka metrics to track TierTopicManager metricsjava.io.IOException
public void startup()
public void shutdown()
public static java.lang.String topicName(java.lang.String tierNamespace)
tierNamespace
- Tier Topic namespace for placing tier topic on external cluster.public java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> addMetadata(AbstractTierMetadata entry) throws java.lang.IllegalAccessException
entry
- the tier topic entry to be written to the tier topic.java.lang.IllegalAccessException
public TierPartitionState partitionState(org.apache.kafka.common.TopicPartition topicPartition)
topicPartition
- tiered topic partitionpublic java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> becomeArchiver(org.apache.kafka.common.TopicPartition topicPartition, int tierEpoch) throws java.lang.IllegalAccessException
topicPartition
- the topic partition for which the sender wishes to become the archive leader.tierEpoch
- the archiver epochjava.lang.IllegalAccessException
public boolean isReady()
public void run()
run
in interface java.lang.Runnable
public boolean catchingUp()
public boolean doWork() throws TierMetadataDeserializationException, java.io.IOException
TierMetadataDeserializationException
java.io.IOException
public void becomeReady(java.lang.String boostrapServers)
boostrapServers
- the brokers to bootstrap the tier topic consumer and producer