public class TierTopicManager extends java.lang.Object implements java.lang.Runnable, TierTopicAppender
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(TierTopicManagerConfig config,
TierTopicConsumer tierTopicConsumer,
java.util.function.Supplier<kafka.zk.AdminZkClient> adminZkClientSupplier,
org.apache.kafka.common.metrics.Metrics metrics)
Primary public constructor for TierTopicManager.
|
TierTopicManager(TierTopicManagerConfig config,
TierTopicConsumer tierTopicConsumer,
java.util.function.Supplier<org.apache.kafka.clients.producer.Producer<byte[],byte[]>> producerSupplier,
java.util.function.Supplier<kafka.zk.AdminZkClient> adminZkClientSupplier)
Instantiate TierTopicManager.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> |
addMetadata(AbstractTierMetadata metadata)
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(TopicIdPartition topicIdPartition,
int tierEpoch)
Performs a write to the tier topic to attempt to become leader for the tiered topic partition.
|
boolean |
isReady()
Return whether TierTopicManager is ready to accept writes.
|
static java.util.Set<org.apache.kafka.common.TopicPartition> |
partitions(java.lang.String topicName,
int numPartitions) |
void |
run() |
void |
shutdown()
Shutdown the tier topic manager.
|
void |
startup() |
boolean |
tryBecomeReady(boolean startConsumerThread)
Try to move the TierTopicManager to ready state.
|
public TierTopicManager(TierTopicManagerConfig config, TierTopicConsumer tierTopicConsumer, java.util.function.Supplier<org.apache.kafka.clients.producer.Producer<byte[],byte[]>> producerSupplier, java.util.function.Supplier<kafka.zk.AdminZkClient> adminZkClientSupplier)
config
- tier topic manager configurationstierTopicConsumer
- tier topic consumer instanceproducerSupplier
- supplier for producer instancespublic TierTopicManager(TierTopicManagerConfig config, TierTopicConsumer tierTopicConsumer, java.util.function.Supplier<kafka.zk.AdminZkClient> adminZkClientSupplier, org.apache.kafka.common.metrics.Metrics metrics)
config
- TierTopicManagerConfig containing tiering configuration.tierTopicConsumer
- tier topic consumer instancemetrics
- Kafka metrics to track TierTopicManager metricspublic void startup()
public void run()
run
in interface java.lang.Runnable
public java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> addMetadata(AbstractTierMetadata metadata)
addMetadata
in interface TierTopicAppender
metadata
- metadata to be written to the tier topicpublic java.util.concurrent.CompletableFuture<TierPartitionState.AppendResult> becomeArchiver(TopicIdPartition topicIdPartition, int tierEpoch)
becomeArchiver
in interface TierTopicAppender
topicIdPartition
- the topic partition for which the sender wishes to become the archive leader.tierEpoch
- the archiver epochpublic boolean isReady()
isReady
in interface TierTopicAppender
public static java.util.Set<org.apache.kafka.common.TopicPartition> partitions(java.lang.String topicName, int numPartitions)
public boolean tryBecomeReady(boolean startConsumerThread)
public void shutdown()