Skip to content

[SPARK-55561][SS] Add retries for all Kafka admin client methods#54339

Open
kavpreetgrewal wants to merge 2 commits intoapache:masterfrom
kavpreetgrewal:SPARK-55561-retries
Open

[SPARK-55561][SS] Add retries for all Kafka admin client methods#54339
kavpreetgrewal wants to merge 2 commits intoapache:masterfrom
kavpreetgrewal:SPARK-55561-retries

Conversation

@kavpreetgrewal
Copy link
Contributor

@kavpreetgrewal kavpreetgrewal commented Feb 16, 2026

What changes were proposed in this pull request?

  • Wraps the usage of the Kafka Admin client in KafkaOffsetReaderAdmin.fetchPartitionOffsets with withRetries
  • Updates withRetries to work with generic types rather than just Map[TopicPartition, Long]

Why are the changes needed?

In KafkaOffsetReaderAdmin.fetchPartitionOffsets, method calls using the admin client are not retried, unlike other calls with are wrapped with withRetries. These calls should also be retried so that we handle transient errors gracefully and do not immediately fail the stream.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added new unit tests and existing tests should continue to pass.

Ran tests locally: build/sbt "sql-kafka-0-10/testOnly org.apache.spark.sql.kafka010.KafkaOffsetReaderSuite"

Was this patch authored or co-authored using generative AI tooling?

Copy link
Contributor

@brkyvz brkyvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Can we add a unit test for this through mocking?

@kavpreetgrewal
Copy link
Contributor Author

@brkyvz added 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants