kerneltime commented on code in PR #7185: URL: https://github.com/apache/ozone/pull/7185#discussion_r1811102345
########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/execution/LeaderRequestExecutor.java: ########## @@ -0,0 +1,441 @@ +/** + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.ratis.execution; + +import com.google.protobuf.ByteString; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import org.apache.hadoop.hdds.conf.StorageUnit; +import org.apache.hadoop.hdds.utils.db.BatchOperation; +import org.apache.hadoop.hdds.utils.db.RDBBatchOperation; +import org.apache.hadoop.ozone.om.OMConfigKeys; +import org.apache.hadoop.ozone.om.OMMetadataManager; +import org.apache.hadoop.ozone.om.OzoneManager; +import org.apache.hadoop.ozone.om.exceptions.OMException; +import org.apache.hadoop.ozone.om.exceptions.OMLeaderNotReadyException; +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.om.response.OMClientResponse; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse; +import org.apache.hadoop.ozone.protocolPB.OzoneManagerRequestHandler; +import org.apache.ratis.protocol.ClientId; +import org.apache.ratis.server.protocol.TermIndex; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * om executor. + */ +public class LeaderRequestExecutor { + private static final Logger LOG = LoggerFactory.getLogger(LeaderRequestExecutor.class); + private static final int REQUEST_EXECUTOR_POOL_SIZE = 1; + private static final int REQUEST_EXECUTOR_QUEUE_SIZE = 1000; + private static final int MERGE_TASK_POOL_SIZE = 1; + private static final int MERGE_TASK_QUEUE_SIZE = 1000; + private static final int RATIS_TASK_POOL_SIZE = 10; + private static final int RATIS_TASK_QUEUE_SIZE = 1000; + private static final long DUMMY_TERM = -1; + private final AtomicLong uniqueIndex; + private final int ratisByteLimit; + private final OzoneManager ozoneManager; + private final PoolExecutor<RatisContext, Void> ratisSubmitter; + private final PoolExecutor<RequestContext, RatisContext> requestMerger; + private final PoolExecutor<RequestContext, RequestContext> leaderExecutor; + private final OzoneManagerRequestHandler handler; + private final AtomicBoolean isEnabled = new AtomicBoolean(true); + private final AtomicInteger ratisCurrentPool = new AtomicInteger(0); + + public LeaderRequestExecutor(OzoneManager om, AtomicLong uniqueIndex) { Review Comment: The term Leader Executor does not really explain the main difference, the change is not just limited to pre processing of request before ratis but changes the entire flow, I would recommend renameing this to something like.. ```suggestion public RequestProcessingV2(OzoneManager om, AtomicLong uniqueIndex) { ``` -- 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]
