You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/02/04 18:49:13 UTC

[GitHub] [lucene-solr] andyvuong opened a new pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked

andyvuong opened a new pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked
URL: https://github.com/apache/lucene-solr/pull/1238
 
 
   # Description
   
   Delete left over znodes on zookeeper that aren't removed after a delete shard command is issued.
   
   # Solution
   
   In DeleteShardCmd, use the zk client to issue a recursive delete from the specified root and its children (including that root).
   
   # Tests
   
   Added assertions to DeleteShardTest to verify the znodes no longer exist. Ran the full test suite via `ant test` and finally did a manual test via the same steps described in the jira description.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `master` branch.
   - [x] I have run `ant precommit` and the appropriate test suite.
   - [x] I have added tests for my changes.
   - [ ] I have added documentation for the [Ref Guide](https://github.com/apache/lucene-solr/tree/master/solr/solr-ref-guide) (for Solr changes only).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] andyvuong commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked

Posted by GitBox <gi...@apache.org>.
andyvuong commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked
URL: https://github.com/apache/lucene-solr/pull/1238#discussion_r374929604
 
 

 ##########
 File path: solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
 ##########
 @@ -79,14 +80,19 @@ public void test() throws Exception {
     waitForState("Expected 'shard1' to be removed", collection, (n, c) -> {
       return c.getSlice("shard1") == null;
     });
+    
+    // verify shard1 znodes are deleted
+    assertShardZnodesDeleted(collection, "shard1");
 
     // Can delete a shard under construction
     setSliceState(collection, "shard2", Slice.State.CONSTRUCTION);
     CollectionAdminRequest.deleteShard(collection, "shard2").process(cluster.getSolrClient());
     waitForState("Expected 'shard2' to be removed", collection, (n, c) -> {
       return c.getSlice("shard2") == null;
     });
-
+    
+    // verify shard2 znodes are deleted
+    assertShardZnodesDeleted(collection, "shard");
 
 Review comment:
   Good catch, 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] HoustonPutman commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked
URL: https://github.com/apache/lucene-solr/pull/1238#discussion_r374912149
 
 

 ##########
 File path: solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
 ##########
 @@ -79,14 +80,19 @@ public void test() throws Exception {
     waitForState("Expected 'shard1' to be removed", collection, (n, c) -> {
       return c.getSlice("shard1") == null;
     });
+    
+    // verify shard1 znodes are deleted
+    assertShardZnodesDeleted(collection, "shard1");
 
     // Can delete a shard under construction
     setSliceState(collection, "shard2", Slice.State.CONSTRUCTION);
     CollectionAdminRequest.deleteShard(collection, "shard2").process(cluster.getSolrClient());
     waitForState("Expected 'shard2' to be removed", collection, (n, c) -> {
       return c.getSlice("shard2") == null;
     });
-
+    
+    // verify shard2 znodes are deleted
+    assertShardZnodesDeleted(collection, "shard");
 
 Review comment:
   Shouldn't this be:
   
   `assertShardZnodesDeleted(collection, "shard2");`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] HoustonPutman commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on a change in pull request #1238: SOLR-14240: Clean up znodes after shard deletion is invoked
URL: https://github.com/apache/lucene-solr/pull/1238#discussion_r377325559
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteShardCmd.java
 ##########
 @@ -151,6 +154,21 @@ public void call(ClusterState clusterState, ZkNodeProps message, NamedList resul
           "Error executing delete operation for collection: " + collectionName + " shard: " + sliceId, e);
     }
   }
+  
+  private void cleanupZooKeeperShardMetadata(SolrZkClient client, String collection, String sliceId) throws InterruptedException {
+    String leaderElectPath = ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection + "/leader_elect/" + sliceId;
+    String shardLeaderPath = ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection + "/leaders/" + sliceId;
+    String shardTermsPath = ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection + "/terms/" + sliceId;
+    
+    try {
+      client.clean(leaderElectPath);
+      client.clean(shardLeaderPath);
+      client.clean(shardTermsPath);
+    } catch (KeeperException ex) {
+      log.warn("Non-fatal error occured attempting to delete shard metadata on zooker for collection " + 
 
 Review comment:
   If you are just logging a warning on failure, you might want to loop through each one, with the try-catch inside the loop. Therefore if one path fails, the others have a chance of succeeding. You can also log the path that failed which will help in debugging.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org