Search in sources :

Example 46 with TopicIdPartition

use of org.apache.kafka.common.TopicIdPartition in project kafka by apache.

the class RemotePartitionMetadataStore method handleRemotePartitionDeleteMetadata.

@Override
public void handleRemotePartitionDeleteMetadata(RemotePartitionDeleteMetadata remotePartitionDeleteMetadata) {
    log.debug("Received partition delete state with: [{}]", remotePartitionDeleteMetadata);
    TopicIdPartition topicIdPartition = remotePartitionDeleteMetadata.topicIdPartition();
    idToPartitionDeleteMetadata.put(topicIdPartition, remotePartitionDeleteMetadata);
    if (remotePartitionDeleteMetadata.state() == RemotePartitionDeleteState.DELETE_PARTITION_FINISHED) {
        // remove the association for the partition.
        idToRemoteLogMetadataCache.remove(topicIdPartition);
        idToPartitionDeleteMetadata.remove(topicIdPartition);
    }
}
Also used : TopicIdPartition(org.apache.kafka.common.TopicIdPartition)

Example 47 with TopicIdPartition

use of org.apache.kafka.common.TopicIdPartition in project kafka by apache.

the class RemotePartitionDeleteMetadataTransform method fromApiMessageAndVersion.

public RemotePartitionDeleteMetadata fromApiMessageAndVersion(ApiMessageAndVersion apiMessageAndVersion) {
    RemotePartitionDeleteMetadataRecord record = (RemotePartitionDeleteMetadataRecord) apiMessageAndVersion.message();
    TopicIdPartition topicIdPartition = new TopicIdPartition(record.topicIdPartition().id(), new TopicPartition(record.topicIdPartition().name(), record.topicIdPartition().partition()));
    return new RemotePartitionDeleteMetadata(topicIdPartition, RemotePartitionDeleteState.forId(record.remotePartitionDeleteState()), record.eventTimestampMs(), record.brokerId());
}
Also used : TopicPartition(org.apache.kafka.common.TopicPartition) TopicIdPartition(org.apache.kafka.common.TopicIdPartition) RemotePartitionDeleteMetadata(org.apache.kafka.server.log.remote.storage.RemotePartitionDeleteMetadata) RemotePartitionDeleteMetadataRecord(org.apache.kafka.server.log.remote.metadata.storage.generated.RemotePartitionDeleteMetadataRecord)

Aggregations

TopicIdPartition (org.apache.kafka.common.TopicIdPartition)47 TopicPartition (org.apache.kafka.common.TopicPartition)32 Test (org.junit.jupiter.api.Test)25 LinkedHashMap (java.util.LinkedHashMap)22 Uuid (org.apache.kafka.common.Uuid)18 ArrayList (java.util.ArrayList)17 HashMap (java.util.HashMap)16 FetchResponseData (org.apache.kafka.common.message.FetchResponseData)15 ConsumerRecord (org.apache.kafka.clients.consumer.ConsumerRecord)13 MemoryRecords (org.apache.kafka.common.record.MemoryRecords)13 List (java.util.List)12 FetchRequest (org.apache.kafka.common.requests.FetchRequest)12 PartitionData (org.apache.kafka.common.requests.FetchRequest.PartitionData)12 Arrays.asList (java.util.Arrays.asList)10 Collections.emptyList (java.util.Collections.emptyList)10 Collections.singletonList (java.util.Collections.singletonList)10 SimpleRecord (org.apache.kafka.common.record.SimpleRecord)10 KafkaException (org.apache.kafka.common.KafkaException)9 MemoryRecordsBuilder (org.apache.kafka.common.record.MemoryRecordsBuilder)8 FetchResponse (org.apache.kafka.common.requests.FetchResponse)8