-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic when scale down partitions (#601)
Signed-off-by: xiaolongran <xiaolongran@tencent.com> ### Motivation When the program is running, if the business is forced to delete certain sub partitions, the following error message will be caused, that is, old_partitions is greater than new_partitions, it looks like it is doing scale down partitions, and the current code logic only deals with the scenario of scale up partitions , So if the user is forced to delete some sub partitions, the following error will be encountered: ``` level=info msg="[Changed number of partitions in topic]" new_partitions=1 old_partitions=20 topic="persistent://pulsar-xxxxxxx/xxxx/gxxxxxxxx" ``` ``` panic: runtime error: index out of range [1] with length 1 goroutine 166288 [running]: github.com/apache/pulsar-client-go/pulsar.(*producer).internalCreatePartitionsProducers(0xc0070aa6e0, 0x0, 0x0) github.com/apache/pulsar-client-go/pulsar/producer_impl.go:194 +0x785 github.com/apache/pulsar-client-go/pulsar.(*producer).runBackgroundPartitionDiscovery.func1(0xc004167cd0, 0xc00559f5c0, 0xc006af6dc0, 0xc0070aa6e0) github.com/apache/pulsar-client-go/pulsar/producer_impl.go:152 +0xce created by github.com/apache/pulsar-client-go/pulsar.(*producer).runBackgroundPartitionDiscovery github.com/apache/pulsar-client-go/pulsar/producer_impl.go:144 +0xcd ``` ### Modifications Increase the processing logic of scale down partition
- Loading branch information
Showing
2 changed files
with
33 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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