apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.13k stars 11.65k forks source link

[Enhancement] PopReviveService exit is slow while stopping the broker #8246

Open absolute8511 opened 4 months ago

absolute8511 commented 4 months ago

Before Creating the Enhancement Request

Summary

Currently, the PopReviveService did not check the stopping flag in some method which will slow down the exit progress while stopping the broker.

Motivation

Stopping broker quickly will make the ha more faster to reduce the unavailable time while restarting the broker.

Describe the Solution You'd Like

check stopping flag in PopReviveService, see pull request:

Describe Alternatives You've Considered

None

Additional Context

No response

drpmma commented 4 months ago

The shouldRunPopRevive field is responsible for shutting down the service, see https://github.com/apache/rocketmq/blob/7145964b4a8db5d29a0af51b352efa2c342122aa/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java#L2025-L2029

But the stopService method is not invoked in shutting down.

Maybe it's worthing considering to use stopService method to stop the PopReviveService.

absolute8511 commented 4 months ago

It is called by https://github.com/apache/rocketmq/blob/7145964b4a8db5d29a0af51b352efa2c342122aa/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java#L1397

I saw the shouldRunPopRevive only be changed while leader role changed