You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "YutaLin (via GitHub)" <gi...@apache.org> on 2026/05/12 20:58:46 UTC

[PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

YutaLin opened a new pull request, #10252:
URL: https://github.com/apache/ozone/pull/10252

   ## What changes were proposed in this pull request?
   
   The remaining SCMHandler(s) are:
   * FinalizationStateManager
   * SecretKeyState
   * SequenceIdGenerator$StateManager
   * StatefulServiceStateManager
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-15191
   
   ## How was this patch tested?
   CI(https://github.com/YutaLin/ozone/actions/runs/25711803021)


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10252:
URL: https://github.com/apache/ozone/pull/10252#issuecomment-4486039282

   @Russole would you like to take a look?


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #10252:
URL: https://github.com/apache/ozone/pull/10252#discussion_r3255456394


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/SequenceIdStateManagerInvoker.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.ha.invoker;
+
+import java.io.IOException;
+import org.apache.hadoop.hdds.scm.exceptions.SCMException;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisResponse;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisServer;
+import org.apache.hadoop.hdds.scm.ha.SequenceIdGenerator.StateManager;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.ratis.protocol.Message;
+
+/** Code generated for {@link StateManager}.  Do not modify. */
+public class SequenceIdStateManagerInvoker extends ScmInvoker<StateManager> {

Review Comment:
   Let's use the full outer class name `SequenceIdGeneratorStateManagerInvoker`.
   
   We should also fix ScmInvokerCodeGenerator.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/SequenceIdStateManagerInvoker.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.ha.invoker;
+
+import java.io.IOException;
+import org.apache.hadoop.hdds.scm.exceptions.SCMException;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisResponse;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisServer;
+import org.apache.hadoop.hdds.scm.ha.SequenceIdGenerator.StateManager;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.ratis.protocol.Message;
+
+/** Code generated for {@link StateManager}.  Do not modify. */
+public class SequenceIdStateManagerInvoker extends ScmInvoker<StateManager> {
+  enum ReplicateMethod implements NameAndParameterTypes {
+    allocateBatch(new Class<?>[][] {
+        null,
+        null,
+        null,
+        new Class<?>[] {String.class, Long.class, Long.class}
+    });
+
+    private final Class<?>[][] parameterTypes;
+
+    ReplicateMethod(Class<?>[][] parameterTypes) {
+      this.parameterTypes = parameterTypes;
+    }
+
+    @Override
+    public Class<?>[] getParameterTypes(int numArgs) {
+      return parameterTypes[numArgs];
+    }
+  }
+
+  public SequenceIdStateManagerInvoker(StateManager impl, SCMRatisServer ratis) {
+    super(impl, SequenceIdStateManagerInvoker::newProxy, ratis);
+  }
+
+  @Override
+  public Class<StateManager> getApi() {
+    return StateManager.class;
+  }
+
+  static StateManager newProxy(ScmInvoker<StateManager> invoker) {
+    return new StateManager() {
+
+      @Override
+      public Boolean allocateBatch(String arg0, Long arg1, Long arg2) throws SCMException {
+        final Object[] args = {arg0, arg1, arg2};
+        return (Boolean) invoker.invokeReplicateDirect(ReplicateMethod.allocateBatch, args);
+      }
+
+      @Override
+      public Long getLastId(String arg0) {
+        return invoker.getImpl().getLastId(arg0);
+      }
+
+      @Override
+      public void reinitialize(Table<String, Long> arg0) throws IOException {

Review Comment:
   Please don't manually add the generic types for the generated code.  It is hard to maintain.
   
   It is unfortunate that we cannot get generic types from reflection since they are compile time information but not runtime information.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/SequenceIdStateManagerInvoker.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.ha.invoker;
+
+import java.io.IOException;
+import org.apache.hadoop.hdds.scm.exceptions.SCMException;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisResponse;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisServer;
+import org.apache.hadoop.hdds.scm.ha.SequenceIdGenerator.StateManager;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.ratis.protocol.Message;
+
+/** Code generated for {@link StateManager}.  Do not modify. */
+public class SequenceIdStateManagerInvoker extends ScmInvoker<StateManager> {
+  enum ReplicateMethod implements NameAndParameterTypes {
+    allocateBatch(new Class<?>[][] {
+        null,
+        null,
+        null,
+        new Class<?>[] {String.class, Long.class, Long.class}
+    });
+
+    private final Class<?>[][] parameterTypes;
+
+    ReplicateMethod(Class<?>[][] parameterTypes) {
+      this.parameterTypes = parameterTypes;
+    }
+
+    @Override
+    public Class<?>[] getParameterTypes(int numArgs) {
+      return parameterTypes[numArgs];
+    }
+  }
+
+  public SequenceIdStateManagerInvoker(StateManager impl, SCMRatisServer ratis) {
+    super(impl, SequenceIdStateManagerInvoker::newProxy, ratis);
+  }
+
+  @Override
+  public Class<StateManager> getApi() {
+    return StateManager.class;
+  }
+
+  static StateManager newProxy(ScmInvoker<StateManager> invoker) {
+    return new StateManager() {
+
+      @Override
+      public Boolean allocateBatch(String arg0, Long arg1, Long arg2) throws SCMException {
+        final Object[] args = {arg0, arg1, arg2};
+        return (Boolean) invoker.invokeReplicateDirect(ReplicateMethod.allocateBatch, args);

Review Comment:
   We should fix ScmInvokerCodeGenerator for the casting.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "YutaLin (via GitHub)" <gi...@apache.org>.
YutaLin commented on code in PR #10252:
URL: https://github.com/apache/ozone/pull/10252#discussion_r3263519882


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/SequenceIdStateManagerInvoker.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.ha.invoker;
+
+import java.io.IOException;
+import org.apache.hadoop.hdds.scm.exceptions.SCMException;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisResponse;
+import org.apache.hadoop.hdds.scm.ha.SCMRatisServer;
+import org.apache.hadoop.hdds.scm.ha.SequenceIdGenerator.StateManager;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.ratis.protocol.Message;
+
+/** Code generated for {@link StateManager}.  Do not modify. */
+public class SequenceIdStateManagerInvoker extends ScmInvoker<StateManager> {
+  enum ReplicateMethod implements NameAndParameterTypes {
+    allocateBatch(new Class<?>[][] {
+        null,
+        null,
+        null,
+        new Class<?>[] {String.class, Long.class, Long.class}
+    });
+
+    private final Class<?>[][] parameterTypes;
+
+    ReplicateMethod(Class<?>[][] parameterTypes) {
+      this.parameterTypes = parameterTypes;
+    }
+
+    @Override
+    public Class<?>[] getParameterTypes(int numArgs) {
+      return parameterTypes[numArgs];
+    }
+  }
+
+  public SequenceIdStateManagerInvoker(StateManager impl, SCMRatisServer ratis) {
+    super(impl, SequenceIdStateManagerInvoker::newProxy, ratis);
+  }
+
+  @Override
+  public Class<StateManager> getApi() {
+    return StateManager.class;
+  }
+
+  static StateManager newProxy(ScmInvoker<StateManager> invoker) {
+    return new StateManager() {
+
+      @Override
+      public Boolean allocateBatch(String arg0, Long arg1, Long arg2) throws SCMException {
+        final Object[] args = {arg0, arg1, arg2};
+        return (Boolean) invoker.invokeReplicateDirect(ReplicateMethod.allocateBatch, args);
+      }
+
+      @Override
+      public Long getLastId(String arg0) {
+        return invoker.getImpl().getLastId(arg0);
+      }
+
+      @Override
+      public void reinitialize(Table<String, Long> arg0) throws IOException {

Review Comment:
   appreciate this feedback!



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "YutaLin (via GitHub)" <gi...@apache.org>.
YutaLin commented on PR #10252:
URL: https://github.com/apache/ozone/pull/10252#issuecomment-4434840491

   Hi @Russole, can you help me review this? 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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #10252:
URL: https://github.com/apache/ozone/pull/10252


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "Russole (via GitHub)" <gi...@apache.org>.
Russole commented on PR #10252:
URL: https://github.com/apache/ozone/pull/10252#issuecomment-4492511001

   Sounds good, thanks. @szetszwo I’ll leave any comments here if I have them.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "YutaLin (via GitHub)" <gi...@apache.org>.
YutaLin commented on PR #10252:
URL: https://github.com/apache/ozone/pull/10252#issuecomment-4484024460

   Hi @szetszwo 
   Thanks for review, I've made some change!


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] HDDS-15191. Add ScmInvoker subclasses for the remaining SCMHandler(s) [ozone]

Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on PR #10252:
URL: https://github.com/apache/ozone/pull/10252#issuecomment-4490034533

   @Russole , in case you have any comments, please feel free post here.  We could address them in the follow-up PRs.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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