* fix(controller): fix the logic when deal with a write event with empty events
1. fix the logic when deal with a write event with empty events
* style(controller): remove unused import
1. remove unused import
* style(controller): fix the wrong typo about DLedger
1. fix the wrong typo about DLedger
* style(controller): fix the wrong typo about DLedger
1. fix the wrong typo about DLedger
* Support build with Bazel (#4865)
* Support build with Bazel, fixing tests to make them capable of running in concurrency and hermetic.
* Make test cases capable of running in parallel. (#4874)
* feat(controller): add elect policy
1. add epoch and maxOffset in heartbeat.
2. refactor elect logic, now we
elect a new master by elect policy(can expand).
3. add some unit tests
* refactor(controller): refactor some code and format some code
1. refactor some code and format some code
* fix typo in ReplicasInfoManager
1. fix typo in ReplicasInfoManager
* fix wrong method call in ReplicasManagerTest#before
1.fix wrong method call in ReplicasManagerTest#before
* fix wrong call in ReplicasManagerTest#before
1. fix wrong call in ReplicasManagerTest#before
* fix(controller): fix the bug about ReElectMaster
1. fix the bug about ReElectMaster
2. fix some typo
* style(controller): fix typo by checkstyle
1. fix typo by checkstyle
* test(broker): fix invalid usage of "any()" in DLedegerControllerTest#before
1. fix invalid usage of "any()" in DLedegerControllerTest#before
* fix(controller): fix some wrong usage in test
1. fix some wrong usage in test
2. refactor some field type to avoid NPE
* Update the logic of confirmOffset and recover topicQueueTable to prevent message loss
* Do not dispatch when reputFromOffset + size is greater than confirmOffset to prevent message loss
* Pass the UT
* Pass the UT
* add broker api --notifyBrokerRoleChanged --
* add broker api --notifyBrokerRoleChanged --
* let controller inform broker when role changed
* code reivew
* Fix bug that do not remove caughtUpTime in connectionCaughtUpTimeTable
* Polish the comment
* Remove replicas from syncStateSet if connection disconnect and ha service not shutdown
* modify pom for using dledger
* rename option
* 1.send heartbeat to haclient when get epochEntry failed to hold connection.
2.update lastCatchupTimeMs in time.
* fix some bugs