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

Fix panic when scale down partitions #601

Merged
merged 4 commits into from
Aug 26, 2021

Conversation

wolfstudy
Copy link
Member

@wolfstudy wolfstudy commented Aug 26, 2021

Signed-off-by: xiaolongran [email protected]

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

@wolfstudy wolfstudy added this to the 0.7.0 milestone Aug 26, 2021
@wolfstudy wolfstudy self-assigned this Aug 26, 2021
@wolfstudy
Copy link
Member Author

@merlimat @cckellogg @zymap PTAL thanks

Signed-off-by: xiaolongran <[email protected]>
Signed-off-by: xiaolongran <[email protected]>
Signed-off-by: xiaolongran <[email protected]>
@wolfstudy wolfstudy merged commit b684151 into apache:master Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants