[Hotfix][Connector-V2][kafka]Kafka consumer group automatically commits offset logic error fix #6961
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.
Purpose of this pull request
Kafka consumer group automatically commits offset logic error fix.
When Kafka Source Options sets
commit_on_checkpoint
totrue
, Checkpoint is enabled, and Kafka Offset is manually committed in KafkaSourceReader. At this time, the Kafka consumer group should be set to manually commit Offset, but now theinitConsumer
method in theKafkaConsumerThread
class is automatically committedprops.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, String.valueOf(autoCommit));
Similarly, when
commit_on_checkpoint
is set to false,props.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, String.valueOf(autoCommit));
will also be set to false. At this time, Offset is neither manually committed nor automatically committed, This will cause the consumer group offset to never be committed.I think this is a Bug. I have fixed it.
KafkaSourceReader.java
KafkaConsumerThread.java
Check list
New License Guide
release-note
.