0
0
Kafkadevops~10 mins

In-sync replicas (ISR) in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to list the in-sync replicas (ISR) for a Kafka topic partition.

Kafka
isr = admin_client.describe_topics(['[1]'])
Drag options to blanks, or click blank then click option'
Amy_topic
Breplica
Cpartition
Dbroker
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'partition' or 'replica' instead of the topic name.
2fill in blank
medium

Complete the code to fetch the ISR list from the partition metadata.

Kafka
isr_list = partition_metadata.[1]
Drag options to blanks, or click blank then click option'
Aisr
Breplicas
Cleader
Doffline_replicas
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replicas' which lists all replicas, not just in-sync ones.
3fill in blank
hard

Fix the error in the code to correctly check if a replica is in the ISR set.

Kafka
if replica_id [1] partition_metadata.isr:
    print('Replica is in ISR')
Drag options to blanks, or click blank then click option'
A==
B!=
Cnot in
Din
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which compares equality, not membership.
4fill in blank
hard

Fill both blanks to create a dictionary of partitions with their ISR counts.

Kafka
isr_counts = {partition.partition: len(partition.[1]) for partition in topic_metadata.[2]
Drag options to blanks, or click blank then click option'
Aisr
Bpartitions
Creplicas
Dleaders
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replicas' instead of 'isr' for ISR count.
5fill in blank
hard

Fill all three blanks to filter partitions with ISR count less than 3.

Kafka
low_isr_partitions = {p.partition: len(p.[1]) for p in topic_metadata.[2] if len(p.[3]) < 3}
Drag options to blanks, or click blank then click option'
Aisr
Bpartitions
Dreplicas
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replicas' instead of 'isr' for ISR length.