jojochuang commented on code in PR #3614:
URL: https://github.com/apache/ozone/pull/3614#discussion_r930440374
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Arrays;
Review Comment:
the changes in this file are not needed.
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OzoneManagerProtocol.java:
##########
@@ -837,6 +837,7 @@ DBUpdates getDBUpdates(
OzoneManagerProtocolProtos.DBUpdatesRequest dbUpdatesRequest)
throws IOException;
+
Review Comment:
remove extra lines.
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.freon;
+
+import com.codahale.metrics.Timer;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.client.rpc.RpcClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Callable;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Utility to generate RPC request to OM with or without payload.
+ */
+@Command(name = "om-rpc-load",
+ aliases = "rpcl",
+ description =
+ "Generate random RPC request to the OM " +
+ "with or without layload.",
+ versionProvider = HddsVersionProvider.class,
+ mixinStandardHelpOptions = true,
+ showDefaultValues = true)
+public class OmRPCLoadGenerator extends BaseFreonGenerator
+ implements Callable<Void> {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(OmRPCLoadGenerator.class);
+
+ private static final int MULTIPLICATION_FACTOR = 1000;
+
+ private Timer timer;
+
+ @Option(names = {"-p", "--payload"},
+ description =
+ "Specifies the size of payload in KB in each RPC request.",
Review Comment:
"OM responds with the same string.
If zero, OM responds with a 1000 byte random string"
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1969,6 +1971,18 @@ public String getCanonicalServiceName() {
return (dtService != null) ? dtService.toString() : null;
}
+ @Override
+ public byte[] postRPCReq(byte[] payload, boolean emptyResp) {
+ if (emptyResp) {
+ return null;
+ }
+ if (payload == null || payload.length == 0) {
+ return RandomUtils.nextBytes(respBytesSize);
+ }
+ return Arrays.copyOf(payload, payload.length);
Review Comment:
I am puzzled here. Shouldn't the RpcClient send a message to OM?
--
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]