Improve coordinator election logging in Iceberg Kafka Connect Sink
Feature Request / Improvement
Improve coordinator election logging in Iceberg Kafka Connect Sink
Problem Description
The Iceberg Kafka Connect Sink connector fails silently when there's a mismatch between:
- The Kafka Connect consumer group ID (
consumer.group.id) - The Iceberg connector control topic group ID (
iceberg.connect.group-id)
When this mismatch occurs, no coordinator is elected and no commits happen, but there are no clear error messages to help users identify the issue.
Impact
When group IDs don't match:
- No coordinator is elected
- No START_COMMIT events are sent
- Data is consumed but not committed to Iceberg tables
- Users have limited visibility into why coordination isn't working
Steps to Reproduce
The issue can be observed in these scenarios:
Scenario 1: Explicit Different Group IDs
Configure Kafka Connect sink connector with:
consumer.group.id=connect-sink-group
iceberg.connect.group-id=different-group-name
Scenario 2: Using Default Group ID (More Common)
Configure Kafka Connect sink connector with only:
consumer.group.id=connect-sink-group
# iceberg.connect.group-id not set, will use default value 'connect-iceberg-sink'
Key code references:
// In CommitterImpl.java - Coordinator election process
private boolean hasLeaderPartition(Collection<TopicPartition> currentAssignedPartitions) {
ConsumerGroupDescription groupDesc;
try (Admin admin = clientFactory.createAdmin()) {
groupDesc = KafkaUtils.consumerGroupDescription(config.connectGroupId(), admin);
}
...
// In IcebergSinkConfig.java - Default group ID configuration
public static final String CONNECT_GROUP_ID = "iceberg.connect.group-id";
public static final String CONNECT_GROUP_ID_DEFAULT = "connect-iceberg-sink";
In both scenarios:
- Start the connector
- Observe that:
- Data is being consumed
- No commits are happening
- No clear error messages about group ID mismatch
Root Cause
The hasLeaderPartition method in CommitterImpl checks for the control topic's consumer group existence but doesn't validate if it matches the actual Kafka Connect consumer group ID. This leads to a situation where:
- The connector looks for members in the wrong consumer group (either explicitly configured or default
connect-iceberg-sink) - No coordinator is elected because the group appears empty
- The actual consumer group (where data is being consumed) is different
Proposed Solution
- Add appropriate logging when consumer group is not found
- Provide clear messages to help users identify potential group ID mismatches
Compatibility
This change is backwards compatible as it only improves logging without changing any behavior.
Query engine
None
Willingness to contribute
- [x] I can contribute this improvement/feature independently
- [x] I would be willing to contribute this improvement/feature with guidance from the Iceberg community
- [ ] I cannot contribute this improvement/feature at this time
+1
+1 Or at least mention that feature in the docs, that both groups ids should match
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
+1
+1
+1
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'