HDFS-12274. Ozone: Corona: move corona from test to tools package. Contributed by Nandakumar.
This commit is contained in:
parent
bb9a4793d3
commit
285d61cd8d
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.hadoop.ozone;
|
package org.apache.hadoop.ozone.tools;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
@ -26,9 +26,11 @@ import org.apache.commons.cli.Options;
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.conf.Configured;
|
import org.apache.hadoop.conf.Configured;
|
||||||
|
import org.apache.hadoop.hdfs.DFSUtil;
|
||||||
import org.apache.hadoop.ozone.client.OzoneClient;
|
import org.apache.hadoop.ozone.client.OzoneClient;
|
||||||
import org.apache.hadoop.ozone.client.OzoneClientFactory;
|
import org.apache.hadoop.ozone.client.OzoneClientFactory;
|
||||||
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
|
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
|
||||||
|
import org.apache.hadoop.ozone.OzoneConfiguration;
|
||||||
import org.apache.hadoop.util.GenericOptionsParser;
|
import org.apache.hadoop.util.GenericOptionsParser;
|
||||||
import org.apache.hadoop.util.Tool;
|
import org.apache.hadoop.util.Tool;
|
||||||
import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
|
@ -144,7 +146,7 @@ public final class Corona extends Configured implements Tool {
|
||||||
parseOzonePetaGenOptions(parser.getCommandLine());
|
parseOzonePetaGenOptions(parser.getCommandLine());
|
||||||
if(printUsage) {
|
if(printUsage) {
|
||||||
usage();
|
usage();
|
||||||
System.exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
LOG.info("Number of Threads: " + numOfThreads);
|
LOG.info("Number of Threads: " + numOfThreads);
|
||||||
processor = Executors.newFixedThreadPool(Integer.parseInt(numOfThreads));
|
processor = Executors.newFixedThreadPool(Integer.parseInt(numOfThreads));
|
||||||
|
@ -300,7 +302,8 @@ public final class Corona extends Configured implements Tool {
|
||||||
for (int k = 0; k < totalKeys; k++) {
|
for (int k = 0; k < totalKeys; k++) {
|
||||||
String key = "key-" + k + "-" +
|
String key = "key-" + k + "-" +
|
||||||
RandomStringUtils.randomNumeric(5);
|
RandomStringUtils.randomNumeric(5);
|
||||||
byte[] value = RandomStringUtils.randomAscii(10240).getBytes();
|
byte[] value = DFSUtil.string2Bytes(
|
||||||
|
RandomStringUtils.randomAscii(10240));
|
||||||
try {
|
try {
|
||||||
LOG.trace("Adding key: {} in bucket: {} of volume: {}",
|
LOG.trace("Adding key: {} in bucket: {} of volume: {}",
|
||||||
key, bucket, volume);
|
key, bucket, volume);
|
||||||
|
@ -349,7 +352,7 @@ public final class Corona extends Configured implements Tool {
|
||||||
|
|
||||||
private class ProgressBar implements Runnable {
|
private class ProgressBar implements Runnable {
|
||||||
|
|
||||||
private final long refreshInterval = 1000L;
|
private static final long REFRESH_INTERVAL = 1000L;
|
||||||
|
|
||||||
private PrintStream stream;
|
private PrintStream stream;
|
||||||
private long maxValue;
|
private long maxValue;
|
||||||
|
@ -369,7 +372,7 @@ public final class Corona extends Configured implements Tool {
|
||||||
if(completed) {
|
if(completed) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Thread.sleep(refreshInterval);
|
Thread.sleep(REFRESH_INTERVAL);
|
||||||
}
|
}
|
||||||
if(exception) {
|
if(exception) {
|
||||||
stream.println();
|
stream.println();
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* 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.tools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
This package contains class used for testing and benchmarking ozone cluster.
|
||||||
|
*/
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.test;
|
package org.apache.hadoop.test;
|
||||||
|
|
||||||
import org.apache.hadoop.ozone.Corona;
|
import org.apache.hadoop.ozone.tools.Corona;
|
||||||
import org.apache.hadoop.util.ProgramDriver;
|
import org.apache.hadoop.util.ProgramDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue