You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/07/14 07:36:45 UTC

[GitHub] [hadoop-ozone] GlenGeng commented on a change in pull request #1191: HDDS-3837 Add isLeader check in SCMHAManager.

GlenGeng commented on a change in pull request #1191:
URL: https://github.com/apache/hadoop-ozone/pull/1191#discussion_r454161936



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerV2Impl.java
##########
@@ -327,6 +349,9 @@ public void openPipeline(PipelineID pipelineId) throws IOException {
    * @throws IOException
    */
   protected void removePipeline(Pipeline pipeline) throws IOException {
+    if (!scmhaManager.isLeader()) {

Review comment:
       Would it be cleaner by using `InvocationHander` to inject these `isLeader()` check ?
   
   ```
   StateManager pipelineStateManager = (StateManager) Proxy.newProxyInstance(
       null,
       new Class<?>[] {StateManager.class}, 
       (proxy, method, args) -> {
         if (method.getName().equals("xxx")) {
           // do is leader check;
           // throw exception if needed;
         }
         return method.invoke(args);
       });
   ```
   
   You may use `hashmap` or `annotation` to speed up the method name check.
   Just a recommendation. 




----------------------------------------------------------------
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



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