Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "SNOW-811265 Do not close channel on rebalance (#651)" #678

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,14 @@ public void closeAll() {
/**
* This function is called during rebalance.
*
* <p>We don't close the channels. Upon rebalance, (inside {@link
* com.snowflake.kafka.connector.SnowflakeSinkTask#open(Collection)} we will reopen the channel
* anyways. [Check c'tor of {@link TopicPartitionChannel}]
* <p>All the channels are closed. The client is still active. Upon rebalance, (inside {@link
* com.snowflake.kafka.connector.SnowflakeSinkTask#open(Collection)} we will reopen the channel.
*
* <p>We will wipe the cache partitionsToChannel so that in {@link
* com.snowflake.kafka.connector.SnowflakeSinkTask#open(Collection)} we reinstantiate and fetch
* offsetToken
*
* @param partitions a list of topic partitions to close/shutdown
* @param partitions a list of topic partition
*/
@Override
public void close(Collection<TopicPartition> partitions) {
Expand All @@ -324,16 +323,15 @@ public void close(Collection<TopicPartition> partitions) {
partitionsToChannel.get(partitionChannelKey);
// Check for null since it's possible that the something goes wrong even before the
// channels are created
if (topicPartitionChannel != null) {
topicPartitionChannel.closeChannel();
}
LOGGER.info(
"Removing partitionChannel:{}, partition:{}, topic:{} from map(partitionsToChannel)",
"Closing partitionChannel:{}, partition:{}, topic:{}",
topicPartitionChannel == null ? null : topicPartitionChannel.getChannelName(),
topicPartition.topic(),
topicPartition.partition());
});
LOGGER.info(
"Closing {} partitions and Clearing partitionsToChannel Map of size:{}",
partitions.size(),
partitionsToChannel.size());
partitionsToChannel.clear();
}

Expand Down
Loading