sijie commented on a change in pull request #1582: Enhancing 
DecommissionBookieCmd
URL: https://github.com/apache/bookkeeper/pull/1582#discussion_r207694542
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
 ##########
 @@ -2521,8 +2524,26 @@ public int runCmd(CommandLine cmdLine) throws Exception 
{
             ClientConfiguration adminConf = new ClientConfiguration(bkConf);
             BookKeeperAdmin admin = new BookKeeperAdmin(adminConf);
             try {
-                BookieSocketAddress thisBookieAddress = 
Bookie.getBookieAddress(bkConf);
-                admin.decommissionBookie(thisBookieAddress);
+                final String remoteBookieidToDecommission = 
cmdLine.getOptionValue("bookieid");
+                final BookieSocketAddress bookieAddressToDecommission = 
(StringUtils
+                        .isBlank(remoteBookieidToDecommission) ? 
Bookie.getBookieAddress(bkConf)
+                                : new 
BookieSocketAddress(remoteBookieidToDecommission));
+                admin.decommissionBookie(bookieAddressToDecommission);
+                LOG.info("The ledgers stored in the given decommissioning 
bookie are properly replicated");
+                runFunctionWithRegistrationManager(bkConf, rm -> {
+                    try {
+                        Versioned<Cookie> cookie = 
Cookie.readFromRegistrationManager(rm, bookieAddressToDecommission);
+                        cookie.getValue().deleteFromRegistrationManager(rm, 
bookieAddressToDecommission,
+                                cookie.getVersion());
+                    } catch (CookieNotFoundException nne) {
+                        LOG.warn("No cookie to remove, it could be deleted 
already : ", nne);
 
 Review comment:
   add the bookieAddressToDecommission to the logging statement.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to