Consolidate auto.offset.reset config - #44
Merged
Merged
Conversation
vahidhashemian
left a comment
There was a problem hiding this comment.
Minor nit inside.
Since this is a breaking change, I'd suggest documenting how to switch from old version to the new and if different circumstances could affect how that switch should be done.
| offsetResetConfig.equals("none") ? OffsetReset.NONE : | ||
| OffsetReset.LATEST; | ||
| LOG.info("Offset reset policy: " + this.offsetReset); | ||
| String autoOffsetResetConfig = properties.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest").toUpperCase().trim(); |
There was a problem hiding this comment.
nit: If strings like "latest" or "none" are used in multiple places, I'd suggest using a global constant for them.
vahidhashemian
approved these changes
Nov 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the
offset.reset.strategyTieredStorageConsumer config and consolidates it with native KafkaConsumer'sauto.offset.resetconfig. The old model of having both configs makes it confusing and difficult to understand the consumer's offset reset behavior, especially with differentTieredStorageModes.Now, the TieredStorageConsumer will only accept the native KafkaConsumer's
auto.offset.resetconfig, and use it throughout the consumer logic. The previous TieredStorageConfigoffset.reset.strategy(if supplied) will be ignored.The way we use this config is as follows:
mode = KAFKA_ONLY
auto.offset.resetconfig will be passed directly into the nativeKafkaConsumer, resulting in the same behavior as regularKafkaConsumermode = KAFKA_PREFERRED
auto.offset.resetconfig provided by the user-suppliedPropertieswill be first extracted and stored as a fieldnonewhen passing it into theKafkaConsumer, to ensure thatKafkaConsumer.poll()will throwOffsetOutOfRangeExceptionif the offset is out of range, instead of automatically resetting offsets within theKafkaConsumerKafkaConsumer.poll()throws anOffsetOutOfRangeException, we fall back toS3Consumer.poll()as we did previouslyS3PartitionConsumer.poll()encounters aNoSuchKeyException(the S3 version ofOffsetOutOfRange), we will reset offsets based on theauto.offset.resetconfig supplied by the user, or throw the exception as anOffsetOutOfRangeExceptionif the user suppliedauto.offset.reset=nonemode = TIERED_STORAGE_ONLY