-
Notifications
You must be signed in to change notification settings - Fork 896
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 trigger GC not work #3998
Fix trigger GC not work #3998
Conversation
bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java
Outdated
Show resolved
Hide resolved
Boolean forceMajor = (Boolean) configMap.getOrDefault("forceMajor", null); | ||
Boolean forceMinor = (Boolean) configMap.getOrDefault("forceMinor", null); | ||
bookieServer.getBookie().getLedgerStorage().forceGC(forceMajor, forceMinor); | ||
response.setCode(HttpServer.StatusCode.NOT_FOUND); |
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.
The status should be NOT_ALLOWED, see here https://httpwg.org/specs/rfc9110.html#status.405
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.
+1
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.
Updated. It will change the current status code.
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.
+1
Boolean forceMajor = (Boolean) configMap.getOrDefault("forceMajor", null); | ||
Boolean forceMinor = (Boolean) configMap.getOrDefault("forceMinor", null); | ||
bookieServer.getBookie().getLedgerStorage().forceGC(forceMajor, forceMinor); | ||
response.setCode(HttpServer.StatusCode.NOT_FOUND); |
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.
+1
* Fix trigger gc not work (cherry picked from commit 147b5bf)
* Fix trigger gc not work (cherry picked from commit 147b5bf)
* Fix trigger gc not work
Motivation
When I use
curl -XPUT http://<ip>:<port>/api/v1/bookie/gc
command to trigger garbage compaction, the bookie server returnsInternal Server Error
. Then I checked the bookie server's log, and nothing was found.After a deep debugging of the server, I found the following exception.
This bug is introduced by #3205. When we use
curl -XPUT http://<ip>:<port>/api/v1/bookie/gc
command to trigger gc, the request body is empty string, but notnull
.bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java
Lines 67 to 75 in ffc8e8b
It will enter Line#68 but goes into Line#71. It uses
JsonUtil.fromJson
to parse an empty string will throw the above exception and will return500
to the client but no logs in the server side.Changes