-
Notifications
You must be signed in to change notification settings - Fork 901
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
Add a REST API to get or update bookie readOnly state #2799
Conversation
@ivankelly PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if you restart the bookie ?
@eolivelli It depends on the value of the config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me
the only thing to add here now is a bunch of test cases that cover this new code
well done
It seems there is no test on HTTP services yet, so I plan to add one in the integration test module. I tried to run some existing tests like
I checked the log of the action that ran the integration tests, it seems those tests were not run actually: https://github.com/apache/bookkeeper/pull/2799/checks?check_run_id=3650019520 @eolivelli Could you confirm those integration tests are all still valid? Or do you have any suggestions on how to test these HTTP services? Thanks! |
I cannot check now. In theory integration tests run for every pr validation |
I just found those tests and will work on a new test case soon, thanks! |
@eolivelli I added a unit test for the new API, please take another look, thanks! |
@sijie Can you review this as well? |
@fantapsody @sijie @eolivelli can we get this merged? |
thank you for you great work,lgtm, any updates ? |
@fantapsody thanks a lot for your great work, I am also looking for the solution to gracefully remove a bookie from cluster by marking it as read only mode, and do not handle write request any longer. But my question is how pulsar broker does realize that a read-only bookie is not a candidate of ensemble, and does not send write request to? Thanks in advance! |
@lujiwen The selection of bookies for the quorum is determined by the bookkeeper client which watches the changes of bookies and selects active bookies based on configurations and predefined policies. You may find a detailed description in https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/EnsemblePlacementPolicy.java. This PR is just a start, and there would be follow-ups as you may see in the TODOs in the issue description and the discussion in the mail list. @eolivelli @sijie Could you take a look at the PR again? |
@fantapsody Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
### Motivation This PR is a part of the work to improve the process of removing bookies from the cluster. Specifically, it implements the `readOnly` API described in the [mail](http://mail-archives.apache.org/mod_mbox/bookkeeper-dev/202109.mbox/raw/%3CCAJdLeK03g8K0h6swn%3D9yVP1Ze2zHxe8TDobK6a-zpTdABkeQEA%40mail.gmail.com%3E). ### Changes - Add an REST API at `/api/v1/bookie/state/readonly` - The `GET` method returns the current `readOnly` status - The `PUT` method updates the `readOnly` status if needed. ### TODOs - Update the document once the PR is accepted. - Update the `BookieStateManager` & `BookieImpl` to persist the information that the state change is triggered by the external API request and do not change the state based on the notification from the dirs monitoring service. Reviewers: Yong Zhang <zhangyong1025.zy@gmail.com>, Enrico Olivelli <eolivelli@gmail.com>, Andrey Yegorov <None> This closes #2799 from fantapsody/readonly-api (cherry picked from commit 9ee04b3) Signed-off-by: Andrey Yegorov <andrey.yegorov@datastax.com>
### Motivation This PR is a part of the work to improve the process of removing bookies from the cluster. Specifically, it implements the `readOnly` API described in the [mail](http://mail-archives.apache.org/mod_mbox/bookkeeper-dev/202109.mbox/raw/%3CCAJdLeK03g8K0h6swn%3D9yVP1Ze2zHxe8TDobK6a-zpTdABkeQEA%40mail.gmail.com%3E). ### Changes - Add an REST API at `/api/v1/bookie/state/readonly` - The `GET` method returns the current `readOnly` status - The `PUT` method updates the `readOnly` status if needed. ### TODOs - Update the document once the PR is accepted. - Update the `BookieStateManager` & `BookieImpl` to persist the information that the state change is triggered by the external API request and do not change the state based on the notification from the dirs monitoring service. Reviewers: Yong Zhang <zhangyong1025.zy@gmail.com>, Enrico Olivelli <eolivelli@gmail.com>, Andrey Yegorov <None> This closes apache#2799 from fantapsody/readonly-api
Motivation
This PR is a part of the work to improve the process of removing bookies from the cluster. Specifically, it implements the
readOnly
API described in the mail.Changes
/api/v1/bookie/state/readonly
GET
method returns the currentreadOnly
statusPUT
method updates thereadOnly
status if needed.TODOs
BookieStateManager
&BookieImpl
to persist the information that the state change is triggered by the external API request and do not change the state based on the notification from the dirs monitoring service.