You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "SongOf (via GitHub)" <gi...@apache.org> on 2025/04/20 15:24:44 UTC
[PR] Delete cookie as part of decommission API [bookkeeper]
SongOf opened a new pull request, #4592:
URL: https://github.com/apache/bookkeeper/pull/4592
Implement the logic in [BP-68:](https://github.com/apache/bookkeeper/pull/4500) Delete cookie as part of decommission API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "zymap (via GitHub)" <gi...@apache.org>.
zymap commented on code in PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#discussion_r2324571802
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -765,15 +770,59 @@ public void testDecommissionService() throws Exception {
assertEquals(HttpServer.StatusCode.NOT_FOUND.getValue(), response2.getStatusCode());
//3, PUT, with body, should success.
- String putBody3 = "{\"bookie_src\": \"" + getBookie(1).toString() + "\"}";
+ BookieId bookieId = getBookie(1);
+ String putBody3 = "{\"bookie_src\": \"" + bookieId.toString() + "\"}";
HttpServiceRequest request3 = new HttpServiceRequest(putBody3, HttpServer.Method.PUT, null);
// after bookie kill, request should success
killBookie(1);
HttpServiceResponse response3 = decommissionService.handle(request3);
assertEquals(HttpServer.StatusCode.OK.getValue(), response3.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
+ runFunctionWithRegistrationManager(baseConf, registrationManager -> {
+ Versioned<Cookie> cookieFromZk = null;
+ try {
+ cookieFromZk = Cookie.readFromRegistrationManager(registrationManager,
+ bookieId);
+ } catch (BookieException e) {
+ } finally {
+ assertTrue(cookieFromZk != null);
+ }
+ return true;
+ });
stopAuditorElector();
}
+ @Test
+ public void testDecommissionServiceWithDeleteCookie() throws Exception {
+ baseConf.setMetadataServiceUri(zkUtil.getMetadataServiceUri());
+ startReplicationService();
+
+ HttpEndpointService decommissionService = bkHttpServiceProvider
+ .provideHttpEndpointService(HttpServer.ApiType.DECOMMISSION);
+ BookieId bookieId = getBookie(1);
+ String putBody1 = "{\"bookie_src\": \"" + bookieId.toString() + "\", \"delete_cookie\": \"true\"}";
+ HttpServiceRequest request1 = new HttpServiceRequest(putBody1, HttpServer.Method.PUT, null);
+ // after bookie kill, request should success
+ killBookie(1);
+ HttpServiceResponse response1 = decommissionService.handle(request1);
+ assertEquals(HttpServer.StatusCode.OK.getValue(), response1.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
Review Comment:
Same above.
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -765,15 +770,59 @@ public void testDecommissionService() throws Exception {
assertEquals(HttpServer.StatusCode.NOT_FOUND.getValue(), response2.getStatusCode());
//3, PUT, with body, should success.
- String putBody3 = "{\"bookie_src\": \"" + getBookie(1).toString() + "\"}";
+ BookieId bookieId = getBookie(1);
+ String putBody3 = "{\"bookie_src\": \"" + bookieId.toString() + "\"}";
HttpServiceRequest request3 = new HttpServiceRequest(putBody3, HttpServer.Method.PUT, null);
// after bookie kill, request should success
killBookie(1);
HttpServiceResponse response3 = decommissionService.handle(request3);
assertEquals(HttpServer.StatusCode.OK.getValue(), response3.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
+ runFunctionWithRegistrationManager(baseConf, registrationManager -> {
+ Versioned<Cookie> cookieFromZk = null;
+ try {
+ cookieFromZk = Cookie.readFromRegistrationManager(registrationManager,
+ bookieId);
+ } catch (BookieException e) {
+ } finally {
+ assertTrue(cookieFromZk != null);
+ }
+ return true;
+ });
Review Comment:
You can use Awaitility to verify the condition periodically instead of sleeping.
```
Awaitility.await().untilAsserted(() -> {
assertTrue("Bookie should be running and converted to readonly mode",
bookie.isRunning() && bookie.isReadOnly());
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "SongOf (via GitHub)" <gi...@apache.org>.
SongOf commented on code in PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#discussion_r2327648497
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -765,15 +770,59 @@ public void testDecommissionService() throws Exception {
assertEquals(HttpServer.StatusCode.NOT_FOUND.getValue(), response2.getStatusCode());
//3, PUT, with body, should success.
- String putBody3 = "{\"bookie_src\": \"" + getBookie(1).toString() + "\"}";
+ BookieId bookieId = getBookie(1);
+ String putBody3 = "{\"bookie_src\": \"" + bookieId.toString() + "\"}";
HttpServiceRequest request3 = new HttpServiceRequest(putBody3, HttpServer.Method.PUT, null);
// after bookie kill, request should success
killBookie(1);
HttpServiceResponse response3 = decommissionService.handle(request3);
assertEquals(HttpServer.StatusCode.OK.getValue(), response3.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
+ runFunctionWithRegistrationManager(baseConf, registrationManager -> {
+ Versioned<Cookie> cookieFromZk = null;
+ try {
+ cookieFromZk = Cookie.readFromRegistrationManager(registrationManager,
+ bookieId);
+ } catch (BookieException e) {
+ } finally {
+ assertTrue(cookieFromZk != null);
+ }
+ return true;
+ });
stopAuditorElector();
}
+ @Test
+ public void testDecommissionServiceWithDeleteCookie() throws Exception {
+ baseConf.setMetadataServiceUri(zkUtil.getMetadataServiceUri());
+ startReplicationService();
+
+ HttpEndpointService decommissionService = bkHttpServiceProvider
+ .provideHttpEndpointService(HttpServer.ApiType.DECOMMISSION);
+ BookieId bookieId = getBookie(1);
+ String putBody1 = "{\"bookie_src\": \"" + bookieId.toString() + "\", \"delete_cookie\": \"true\"}";
+ HttpServiceRequest request1 = new HttpServiceRequest(putBody1, HttpServer.Method.PUT, null);
+ // after bookie kill, request should success
+ killBookie(1);
+ HttpServiceResponse response1 = decommissionService.handle(request1);
+ assertEquals(HttpServer.StatusCode.OK.getValue(), response1.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
Review Comment:
> Same above.
fixed, Thanks for your suggestion.
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -765,15 +770,59 @@ public void testDecommissionService() throws Exception {
assertEquals(HttpServer.StatusCode.NOT_FOUND.getValue(), response2.getStatusCode());
//3, PUT, with body, should success.
- String putBody3 = "{\"bookie_src\": \"" + getBookie(1).toString() + "\"}";
+ BookieId bookieId = getBookie(1);
+ String putBody3 = "{\"bookie_src\": \"" + bookieId.toString() + "\"}";
HttpServiceRequest request3 = new HttpServiceRequest(putBody3, HttpServer.Method.PUT, null);
// after bookie kill, request should success
killBookie(1);
HttpServiceResponse response3 = decommissionService.handle(request3);
assertEquals(HttpServer.StatusCode.OK.getValue(), response3.getStatusCode());
+ // wait decommission finish
+ Thread.sleep(60 * 1000);
+ runFunctionWithRegistrationManager(baseConf, registrationManager -> {
+ Versioned<Cookie> cookieFromZk = null;
+ try {
+ cookieFromZk = Cookie.readFromRegistrationManager(registrationManager,
+ bookieId);
+ } catch (BookieException e) {
+ } finally {
+ assertTrue(cookieFromZk != null);
+ }
+ return true;
+ });
Review Comment:
> You can use Awaitility to verify the condition periodically instead of sleeping.
>
> ```
> Awaitility.await().untilAsserted(() -> {
> assertTrue("Bookie should be running and converted to readonly mode",
> bookie.isRunning() && bookie.isReadOnly());
> });
> ```
fixed, Thanks for your suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "StevenLuMT (via GitHub)" <gi...@apache.org>.
StevenLuMT closed pull request #4592: Delete cookie as part of decommission API
URL: https://github.com/apache/bookkeeper/pull/4592
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "StevenLuMT (via GitHub)" <gi...@apache.org>.
StevenLuMT commented on PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#issuecomment-2896233570
@hezhangjian @zymap help review this pr, thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "StevenLuMT (via GitHub)" <gi...@apache.org>.
StevenLuMT commented on PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#issuecomment-2889536142
The command line decommission will delete cookies by default, but the http api does not have the alignment function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "StevenLuMT (via GitHub)" <gi...@apache.org>.
StevenLuMT commented on PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#issuecomment-2889272045
I think it's the same as this historical PR #4541 . I think it's quite high risk and there's no need to add this function.
@SongOf
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "StevenLuMT (via GitHub)" <gi...@apache.org>.
StevenLuMT commented on PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592#issuecomment-2889272470
I suggest temporarily closing this PR and reopening it later if necessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "zymap (via GitHub)" <gi...@apache.org>.
zymap merged PR #4592:
URL: https://github.com/apache/bookkeeper/pull/4592
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Delete cookie as part of decommission API [bookkeeper]
Posted by "zymap (via GitHub)" <gi...@apache.org>.
zymap closed pull request #4592: Delete cookie as part of decommission API
URL: https://github.com/apache/bookkeeper/pull/4592
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org