szetszwo commented on code in PR #8059: URL: https://github.com/apache/ozone/pull/8059#discussion_r1992055927
########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/execution/OMGateway.java: ########## @@ -0,0 +1,106 @@ +/* + * 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.ozone.om.execution; + +import static org.apache.hadoop.ozone.util.MetricUtil.captureLatencyNs; + +import com.google.protobuf.ServiceException; +import java.io.IOException; +import org.apache.hadoop.ozone.om.OMPerformanceMetrics; +import org.apache.hadoop.ozone.om.OzoneManager; +import org.apache.hadoop.ozone.om.helpers.OMAuditLogger; +import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerRatisUtils; +import org.apache.hadoop.ozone.om.request.OMClientRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse; +import org.apache.ratis.protocol.ClientId; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * entry for execution flow for write request. + */ +public class OMGateway { + private static final Logger LOG = LoggerFactory.getLogger(OMGateway.class); + + private final OzoneManager ozoneManager; + private final OMPerformanceMetrics perfMetrics; + + public OMGateway(OzoneManager om) throws IOException { Review Comment: Why throwing `IOException`? ########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/execution/OMGateway.java: ########## @@ -0,0 +1,106 @@ +/* + * 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.ozone.om.execution; + +import static org.apache.hadoop.ozone.util.MetricUtil.captureLatencyNs; + +import com.google.protobuf.ServiceException; +import java.io.IOException; +import org.apache.hadoop.ozone.om.OMPerformanceMetrics; +import org.apache.hadoop.ozone.om.OzoneManager; +import org.apache.hadoop.ozone.om.helpers.OMAuditLogger; +import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerRatisUtils; +import org.apache.hadoop.ozone.om.request.OMClientRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse; +import org.apache.ratis.protocol.ClientId; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * entry for execution flow for write request. + */ +public class OMGateway { + private static final Logger LOG = LoggerFactory.getLogger(OMGateway.class); + + private final OzoneManager ozoneManager; + private final OMPerformanceMetrics perfMetrics; + + public OMGateway(OzoneManager om) throws IOException { + this.ozoneManager = om; + this.perfMetrics = ozoneManager.getPerfMetrics(); + } + + public void start() { + // TODO: with pre-ratis execution flow, this is required to manage flow Review Comment: Could you give some example services that need to be started? ########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/utils/OzoneManagerRatisUtils.java: ########## @@ -515,6 +515,22 @@ public static GrpcTlsConfig createServerTlsConfig(SecurityConfig conf, public static OzoneManagerProtocolProtos.OMResponse submitRequest( OzoneManager om, OMRequest omRequest, ClientId clientId, long callId) throws ServiceException { - return om.getOmRatisServer().submitRequest(omRequest, clientId, callId); + return om.getOmGateway().submitInternal(omRequest, clientId, callId); Review Comment: We have `om.getOmGateway()` here and `ozoneManager.getOmRatisServer()` in `submitInternal(..)`, i.e. om -> gateway -> om, why? ########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java: ########## @@ -173,43 +171,13 @@ private OMResponse internalProcessRequest(OMRequest request) throws ServiceExcep return cached; } - // process new request - OMClientRequest omClientRequest = null; - final OMRequest requestToSubmit; - try { - omClientRequest = createClientRequest(request, ozoneManager); - // TODO: Note: Due to HDDS-6055, createClientRequest() could now - // return null, which triggered the findbugs warning. - // Added the assertion. - assert (omClientRequest != null); - OMClientRequest finalOmClientRequest = omClientRequest; - - requestToSubmit = preExecute(finalOmClientRequest); - this.lastRequestToSubmit = requestToSubmit; - } catch (IOException ex) { - if (omClientRequest != null) { - OMAuditLogger.log(omClientRequest.getAuditBuilder()); - omClientRequest.handleRequestFailure(ozoneManager); - } - return createErrorResponse(request, ex); - } - - final OMResponse response = omRatisServer.submitRequest(requestToSubmit); - if (!response.getSuccess()) { - omClientRequest.handleRequestFailure(ozoneManager); - } - return response; + this.lastRequestToSubmit = request; + return ozoneManager.getOmGateway().submit(request); Review Comment: We cannot change the order here since testParallelDeleteBucketAndCreateKey() depends on it. ########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/execution/OMGateway.java: ########## @@ -0,0 +1,106 @@ +/* + * 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.ozone.om.execution; + +import static org.apache.hadoop.ozone.util.MetricUtil.captureLatencyNs; + +import com.google.protobuf.ServiceException; +import java.io.IOException; +import org.apache.hadoop.ozone.om.OMPerformanceMetrics; +import org.apache.hadoop.ozone.om.OzoneManager; +import org.apache.hadoop.ozone.om.helpers.OMAuditLogger; +import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerRatisUtils; +import org.apache.hadoop.ozone.om.request.OMClientRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse; +import org.apache.ratis.protocol.ClientId; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * entry for execution flow for write request. + */ +public class OMGateway { Review Comment: `OMGateway` sounds like `S3Gateway` but they are very different. How about calling it `OMExecutionFlow`? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
