Bug onClusterChange() for bookie deletion
- Dominant language
- Java
- Stars
- 2k
- Forks
- 976
- Avg merge
- 6d 15h
- Merged PRs (30d)
- 7
Description
**BUG REPORT**
***Describe the bug***
When a topology change occurs and it's communicated to the policy by `onClusterChange()`, if slave is not null and the change correspond to the deletion of a bookie, the list returned from `onClusterChange()` is empty.
***To Reproduce***
Get my [branch](https://github.com/GentiliEmanuele/bookkeeper/tree/OnClusterChange_Failure) and execute the command:
```
mvn -Dtest=OnClusterChangeREPPTest test -pl bookkeeper-server
```
This command execute the [test](https://github.com/GentiliEmanuele/bookkeeper/blob/3553efd41d3b2da02040a3e66c95dbad9d3fab23/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/OnClusterChangeREPPTest.java#L65) that follows this steps:
1. Initialize the policy with `stabilizePeriodSecond > 0`.
2. Call `onClusterChange()` a first time specifying at least one writableBookies.
3. Call `onClusterChange()` a second time specifying a set of writableBookies where lacks at least one bookie specified in the previous step.
***Expected behavior***
The method should return the remove bookie (but return an empty list).
***Screenshots***
In this first screenshot note the deadBookies size (equals to 1):
After the execution of `onClusterChange()` to the slave the size becomes 0 and the information about dead bookies is missed:
***Additional context***
At this [link](https://github.com/GentiliEmanuele/bookkeeper/blob/a0deeefeb96f3981f0dfc72b7cefdd0068f107d7/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java#L113) is available possible fix for the method `onClusterChange()`. The original implementation can be seen at this [link](https://github.com/GentiliEmanuele/bookkeeper/blob/3553efd41d3b2da02040a3e66c95dbad9d3fab23/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java#L109).
(Ticket was opened with the support of @gulyx)
Contributor guide
Assessment
This issue has not been assessed yet.