From f2e6d38ad7160095984bedd774c3d3c22d30e7ce Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" <6454655+adoroszlai@users.noreply.github.com> Date: Wed, 1 Jan 2025 11:17:07 +0100 Subject: [PATCH] HDDS-11994. Convert Freon to pluggable model (#7620) --- .../hdds/cli/ExtensibleParentCommand.java | 6 ++- .../ozone/freon/BaseFreonGenerator.java | 3 +- .../ozone/freon/ChunkManagerDiskWrite.java | 2 + .../freon/ClosedContainerReplicator.java | 2 + .../ozone/freon/DNRPCLoadGenerator.java | 4 +- .../ozone/freon/DatanodeBlockPutter.java | 2 + .../ozone/freon/DatanodeChunkGenerator.java | 2 + .../ozone/freon/DatanodeChunkValidator.java | 2 + .../hadoop/ozone/freon/DatanodeSimulator.java | 4 +- .../FollowerAppendLogEntryGenerator.java | 2 + .../org/apache/hadoop/ozone/freon/Freon.java | 49 +++---------------- .../hadoop/ozone/freon/FreonSubcommand.java | 23 +++++++++ .../ozone/freon/HadoopDirTreeGenerator.java | 2 + .../hadoop/ozone/freon/HadoopFsGenerator.java | 2 + .../hadoop/ozone/freon/HadoopFsValidator.java | 2 + .../ozone/freon/HadoopNestedDirGenerator.java | 2 + .../hadoop/ozone/freon/HsyncGenerator.java | 2 + .../freon/LeaderAppendLogEntryGenerator.java | 2 + .../hadoop/ozone/freon/OmBucketGenerator.java | 2 + .../ozone/freon/OmBucketReadWriteFileOps.java | 3 +- .../ozone/freon/OmBucketReadWriteKeyOps.java | 3 +- .../hadoop/ozone/freon/OmBucketRemover.java | 2 + .../hadoop/ozone/freon/OmKeyGenerator.java | 2 + .../ozone/freon/OmMetadataGenerator.java | 2 + .../ozone/freon/OmRPCLoadGenerator.java | 2 + .../ozone/freon/OzoneClientCreator.java | 2 + .../ozone/freon/OzoneClientKeyGenerator.java | 2 + .../freon/OzoneClientKeyReadWriteListOps.java | 2 + .../ozone/freon/OzoneClientKeyRemover.java | 2 + .../ozone/freon/OzoneClientKeyValidator.java | 2 + .../ozone/freon/RandomKeyGenerator.java | 6 ++- .../ozone/freon/RangeKeysGenerator.java | 2 + .../hadoop/ozone/freon/S3BucketGenerator.java | 2 + .../hadoop/ozone/freon/S3KeyGenerator.java | 2 + .../ozone/freon/SCMThroughputBenchmark.java | 7 ++- .../hadoop/ozone/freon/SameKeyReader.java | 2 + .../ozone/freon/StreamingGenerator.java | 2 + .../containergenerator/GeneratorDatanode.java | 3 ++ .../freon/containergenerator/GeneratorOm.java | 4 ++ .../containergenerator/GeneratorScm.java | 4 ++ 40 files changed, 119 insertions(+), 54 deletions(-) create mode 100644 hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FreonSubcommand.java diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/ExtensibleParentCommand.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/ExtensibleParentCommand.java index d4fde1b75cb..8f73787e82a 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/ExtensibleParentCommand.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/ExtensibleParentCommand.java @@ -20,6 +20,8 @@ import picocli.CommandLine; import java.util.ServiceLoader; +import java.util.SortedMap; +import java.util.TreeMap; /** * Interface for parent commands that accept subcommands to be dynamically registered. @@ -40,11 +42,13 @@ static void addSubcommands(CommandLine cli) { if (command instanceof ExtensibleParentCommand) { ExtensibleParentCommand parentCommand = (ExtensibleParentCommand) command; ServiceLoader subcommands = ServiceLoader.load(parentCommand.subcommandType()); + SortedMap sorted = new TreeMap<>(); for (Object subcommand : subcommands) { final CommandLine.Command commandAnnotation = subcommand.getClass().getAnnotation(CommandLine.Command.class); CommandLine subcommandCommandLine = new CommandLine(subcommand, cli.getFactory()); - cli.addSubcommand(commandAnnotation.name(), subcommandCommandLine); + sorted.put(commandAnnotation.name(), subcommandCommandLine); } + sorted.forEach(cli::addSubcommand); } // process subcommands recursively diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java index 651166740d8..1a931b85534 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java @@ -73,8 +73,9 @@ /** * Base class for simplified performance tests. */ +@CommandLine.Command @SuppressWarnings("java:S2245") // no need for secure random -public class BaseFreonGenerator { +public class BaseFreonGenerator implements FreonSubcommand { private static final Logger LOG = LoggerFactory.getLogger(BaseFreonGenerator.class); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ChunkManagerDiskWrite.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ChunkManagerDiskWrite.java index e42d660392b..e8b9fa4124d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ChunkManagerDiskWrite.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ChunkManagerDiskWrite.java @@ -43,6 +43,7 @@ import org.apache.hadoop.ozone.container.keyvalue.interfaces.ChunkManager; import com.codahale.metrics.Timer; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -60,6 +61,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class ChunkManagerDiskWrite extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java index 656251424b2..1c4f3601b3c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java @@ -45,6 +45,7 @@ import org.apache.hadoop.ozone.container.replication.ReplicationTask; import org.apache.hadoop.ozone.container.replication.SimpleContainerDownloader; import org.apache.hadoop.ozone.protocol.commands.ReplicateContainerCommand; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -71,6 +72,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class ClosedContainerReplicator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java index 926f3f4630a..d1f894a335c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java @@ -37,6 +37,7 @@ import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB; import org.apache.hadoop.ozone.util.PayloadUtils; import org.apache.ratis.thirdparty.com.google.protobuf.ByteString; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -59,6 +60,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class DNRPCLoadGenerator extends BaseFreonGenerator implements Callable { private static final Logger LOG = @@ -111,7 +113,7 @@ public class DNRPCLoadGenerator extends BaseFreonGenerator private Freon freon; // empy constructor for picocli - DNRPCLoadGenerator() { + public DNRPCLoadGenerator() { } @VisibleForTesting diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java index 3e613d2d2c5..0189224e627 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java @@ -39,6 +39,7 @@ import com.codahale.metrics.Timer; import org.apache.commons.lang3.RandomStringUtils; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -55,6 +56,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class DatanodeBlockPutter extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java index 7f0f5bb9e57..b47d81aad46 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java @@ -48,6 +48,7 @@ import com.codahale.metrics.Timer; import org.apache.commons.lang3.RandomStringUtils; import org.apache.ratis.thirdparty.com.google.protobuf.ByteString; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -62,6 +63,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class DatanodeChunkGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java index 0b1e34efe78..d0ee83af04f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java @@ -35,6 +35,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.ozone.common.OzoneChecksumException; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -49,6 +50,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class DatanodeChunkValidator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeSimulator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeSimulator.java index 353bc447939..03fd6301d52 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeSimulator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeSimulator.java @@ -57,6 +57,7 @@ import org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.Time; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -119,7 +120,8 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) -public class DatanodeSimulator implements Callable { +@MetaInfServices(FreonSubcommand.class) +public class DatanodeSimulator implements Callable, FreonSubcommand { private static final Logger LOGGER = LoggerFactory.getLogger( DatanodeSimulator.class); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FollowerAppendLogEntryGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FollowerAppendLogEntryGenerator.java index 76ef7888d0a..706bd667b39 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FollowerAppendLogEntryGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FollowerAppendLogEntryGenerator.java @@ -68,6 +68,7 @@ import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder; import org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver; import org.apache.ratis.util.Preconditions; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -88,6 +89,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class FollowerAppendLogEntryGenerator extends BaseAppendLogGenerator implements Callable, StreamObserver { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/Freon.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/Freon.java index 435d54079fe..b34f9704dd3 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/Freon.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/Freon.java @@ -18,14 +18,12 @@ import java.io.IOException; +import org.apache.hadoop.hdds.cli.ExtensibleParentCommand; import org.apache.hadoop.hdds.cli.GenericCli; import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.hdds.tracing.TracingUtil; import org.apache.hadoop.hdds.utils.HddsServerUtil; -import org.apache.hadoop.ozone.freon.containergenerator.GeneratorDatanode; -import org.apache.hadoop.ozone.freon.containergenerator.GeneratorOm; -import org.apache.hadoop.ozone.freon.containergenerator.GeneratorScm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,47 +38,9 @@ @Command( name = "ozone freon", description = "Load generator and tester tool for ozone", - subcommands = { - RandomKeyGenerator.class, - OzoneClientKeyGenerator.class, - OzoneClientKeyValidator.class, - OzoneClientKeyRemover.class, - OmKeyGenerator.class, - OmBucketGenerator.class, - OmBucketRemover.class, - HadoopFsGenerator.class, - HadoopNestedDirGenerator.class, - HadoopDirTreeGenerator.class, - HadoopFsValidator.class, - SameKeyReader.class, - S3KeyGenerator.class, - S3BucketGenerator.class, - DatanodeChunkGenerator.class, - DatanodeChunkValidator.class, - DatanodeBlockPutter.class, - FollowerAppendLogEntryGenerator.class, - ChunkManagerDiskWrite.class, - LeaderAppendLogEntryGenerator.class, - GeneratorOm.class, - GeneratorScm.class, - GeneratorDatanode.class, - ClosedContainerReplicator.class, - StreamingGenerator.class, - SCMThroughputBenchmark.class, - OmBucketReadWriteFileOps.class, - OmBucketReadWriteKeyOps.class, - OmRPCLoadGenerator.class, - OzoneClientKeyReadWriteListOps.class, - RangeKeysGenerator.class, - DatanodeSimulator.class, - OmMetadataGenerator.class, - DNRPCLoadGenerator.class, - HsyncGenerator.class, - OzoneClientCreator.class, - }, versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true) -public class Freon extends GenericCli { +public class Freon extends GenericCli implements ExtensibleParentCommand { public static final Logger LOG = LoggerFactory.getLogger(Freon.class); @@ -102,6 +62,11 @@ public int execute(String[] argv) { return super.execute(argv); } + @Override + public Class subcommandType() { + return FreonSubcommand.class; + } + public void stopHttpServer() { if (freonHttpServer != null) { try { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FreonSubcommand.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FreonSubcommand.java new file mode 100644 index 00000000000..36cb5400ef6 --- /dev/null +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/FreonSubcommand.java @@ -0,0 +1,23 @@ +/* + * 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.freon; + +/** Marker interface for subcommands to be registered for {@code ozone freon}. */ +public interface FreonSubcommand { + // marker +} diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopDirTreeGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopDirTreeGenerator.java index 5bc2c409318..b1480548802 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopDirTreeGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopDirTreeGenerator.java @@ -22,6 +22,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.StorageSize; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -41,6 +42,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class HadoopDirTreeGenerator extends HadoopBaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java index 1f910c9398a..9497a78b629 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java @@ -25,6 +25,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.hdds.conf.StorageSize; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -37,6 +38,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class HadoopFsGenerator extends HadoopBaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsValidator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsValidator.java index 1566eaed8ae..81be83078dd 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsValidator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsValidator.java @@ -25,6 +25,7 @@ import com.codahale.metrics.Timer; import org.apache.commons.io.IOUtils; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -38,6 +39,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class HadoopFsValidator extends HadoopBaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java index ff74a54fbc6..8b76426b69d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java @@ -22,6 +22,7 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.commons.lang3.RandomStringUtils; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -37,6 +38,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class HadoopNestedDirGenerator extends HadoopBaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HsyncGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HsyncGenerator.java index 2cfcbc9be97..7aa45c857ff 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HsyncGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HsyncGenerator.java @@ -24,6 +24,7 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.util.PayloadUtils; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -57,6 +58,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class HsyncGenerator extends BaseFreonGenerator implements Callable { private static final Logger LOG = LoggerFactory.getLogger(HsyncGenerator.class); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/LeaderAppendLogEntryGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/LeaderAppendLogEntryGenerator.java index 9038f379186..523c2c6f0da 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/LeaderAppendLogEntryGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/LeaderAppendLogEntryGenerator.java @@ -63,6 +63,7 @@ import org.apache.ratis.thirdparty.io.grpc.ManagedChannel; import org.apache.ratis.thirdparty.io.grpc.netty.NegotiationType; import org.apache.ratis.thirdparty.io.grpc.netty.NettyChannelBuilder; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -81,6 +82,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class LeaderAppendLogEntryGenerator extends BaseAppendLogGenerator implements diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java index 27ebc877633..6a95549b6e7 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java @@ -26,6 +26,7 @@ import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import com.codahale.metrics.Timer; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -38,6 +39,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OmBucketGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteFileOps.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteFileOps.java index 80207a8860d..eb732cea101 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteFileOps.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteFileOps.java @@ -22,6 +22,7 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConsts; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -39,7 +40,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) - +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class OmBucketReadWriteFileOps extends AbstractOmBucketReadWriteOps { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteKeyOps.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteKeyOps.java index abc7ad5002f..14c9812d585 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteKeyOps.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketReadWriteKeyOps.java @@ -23,6 +23,7 @@ import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus; +import org.kohsuke.MetaInfServices; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -43,7 +44,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) - +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class OmBucketReadWriteKeyOps extends AbstractOmBucketReadWriteOps { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketRemover.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketRemover.java index f8ab5482d42..d696ab24df5 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketRemover.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketRemover.java @@ -20,6 +20,7 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -34,6 +35,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OmBucketRemover extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmKeyGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmKeyGenerator.java index d5fbdc75f19..2d6ac882c43 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmKeyGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmKeyGenerator.java @@ -31,6 +31,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.security.UserGroupInformation; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; import picocli.CommandLine.Option; @@ -46,6 +47,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OmKeyGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java index 4c277f07422..0c95a0c3686 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java @@ -53,6 +53,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.security.UserGroupInformation; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; import picocli.CommandLine.Option; @@ -70,6 +71,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OmMetadataGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java index 19121852970..78e3e9571ec 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java @@ -25,6 +25,7 @@ import java.util.concurrent.Callable; import org.apache.hadoop.ozone.util.PayloadUtils; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -40,6 +41,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OmRPCLoadGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientCreator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientCreator.java index 2fc4cb48eac..907db9962fb 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientCreator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientCreator.java @@ -19,6 +19,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.kohsuke.MetaInfServices; import picocli.CommandLine; import java.util.concurrent.Callable; @@ -32,6 +33,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OzoneClientCreator extends BaseFreonGenerator implements Callable { @CommandLine.Option(names = "--om-service-id", diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyGenerator.java index 4a1958247ad..cfc8ed85246 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyGenerator.java @@ -32,6 +32,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.ozone.client.io.OzoneDataStreamOutput; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Mixin; import picocli.CommandLine.Option; @@ -45,6 +46,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OzoneClientKeyGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyReadWriteListOps.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyReadWriteListOps.java index ba7456ef64b..9160888e52a 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyReadWriteListOps.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyReadWriteListOps.java @@ -24,6 +24,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.client.OzoneClient; import org.apache.hadoop.ozone.client.OzoneKeyDetails; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -49,6 +50,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OzoneClientKeyReadWriteListOps extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyRemover.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyRemover.java index d834a634d07..d5d76e4a46f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyRemover.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyRemover.java @@ -21,6 +21,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -35,6 +36,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OzoneClientKeyRemover extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyValidator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyValidator.java index 220a8c7f1b7..8e9d256ee8e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyValidator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyValidator.java @@ -28,6 +28,7 @@ import com.codahale.metrics.Timer; import org.apache.commons.io.IOUtils; import org.apache.ratis.util.function.CheckedFunction; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -42,6 +43,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class OzoneClientKeyValidator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java index f7b51fedced..53359a03ebe 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RandomKeyGenerator.java @@ -68,6 +68,7 @@ import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.time.DurationFormatUtils; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -86,8 +87,9 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random -public final class RandomKeyGenerator implements Callable { +public final class RandomKeyGenerator implements Callable, FreonSubcommand { @ParentCommand private Freon freon; @@ -240,7 +242,7 @@ enum FreonOps { private OzoneConfiguration ozoneConfiguration; private ProgressBar progressbar; - RandomKeyGenerator() { + public RandomKeyGenerator() { // for picocli } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RangeKeysGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RangeKeysGenerator.java index b826651a6fb..cf1fa29bb5c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RangeKeysGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/RangeKeysGenerator.java @@ -25,6 +25,7 @@ import org.apache.hadoop.hdds.conf.StorageSize; import org.apache.hadoop.ozone.client.OzoneClient; import org.apache.hadoop.ozone.client.io.OzoneOutputStream; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -45,6 +46,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class RangeKeysGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3BucketGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3BucketGenerator.java index 0233c14470a..8d6c94a71de 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3BucketGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3BucketGenerator.java @@ -18,6 +18,7 @@ import com.codahale.metrics.Timer; import org.apache.hadoop.hdds.cli.HddsVersionProvider; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -44,6 +45,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class S3BucketGenerator extends S3EntityGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3KeyGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3KeyGenerator.java index 3a3537d8e4b..77049a15a15 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3KeyGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/S3KeyGenerator.java @@ -36,6 +36,7 @@ import static org.apache.hadoop.ozone.OzoneConsts.OM_MULTIPART_MIN_SIZE; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine.Command; @@ -53,6 +54,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class S3KeyGenerator extends S3EntityGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SCMThroughputBenchmark.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SCMThroughputBenchmark.java index f6e08ee9e4f..623a74080ed 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SCMThroughputBenchmark.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SCMThroughputBenchmark.java @@ -59,6 +59,7 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -108,8 +109,9 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random -public final class SCMThroughputBenchmark implements Callable { +public final class SCMThroughputBenchmark implements Callable, FreonSubcommand { public static final Logger LOG = LoggerFactory.getLogger(SCMThroughputBenchmark.class); @@ -185,9 +187,6 @@ public enum BenchmarkType { private ScmBlockLocationProtocol scmBlockClient; - private SCMThroughputBenchmark() { - } - @Override public Void call() throws Exception { conf = freon.getOzoneConf(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SameKeyReader.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SameKeyReader.java index bbd83d64dec..9f685237e61 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SameKeyReader.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/SameKeyReader.java @@ -20,6 +20,7 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -32,6 +33,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class SameKeyReader extends OzoneClientKeyValidator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/StreamingGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/StreamingGenerator.java index dd6e3e99c26..903eb6d6995 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/StreamingGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/StreamingGenerator.java @@ -24,6 +24,7 @@ import org.apache.hadoop.ozone.container.stream.DirectoryServerSource; import org.apache.hadoop.ozone.container.stream.StreamingClient; import org.apache.hadoop.ozone.container.stream.StreamingServer; +import org.kohsuke.MetaInfServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -44,6 +45,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class StreamingGenerator extends BaseFreonGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorDatanode.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorDatanode.java index dbca12c8b26..0300b4832c3 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorDatanode.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorDatanode.java @@ -63,6 +63,8 @@ import org.apache.hadoop.ozone.container.keyvalue.interfaces.ChunkManager; import com.codahale.metrics.Timer; +import org.apache.hadoop.ozone.freon.FreonSubcommand; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -80,6 +82,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) @SuppressWarnings("java:S2245") // no need for secure random public class GeneratorDatanode extends BaseGenerator { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorOm.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorOm.java index 7390488c815..921b0cd6875 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorOm.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorOm.java @@ -35,6 +35,7 @@ import org.apache.hadoop.hdds.utils.db.RocksDBConfiguration; import org.apache.hadoop.hdds.utils.db.Table; import org.apache.hadoop.ozone.OzoneAcl; +import org.apache.hadoop.ozone.freon.FreonSubcommand; import org.apache.hadoop.ozone.om.OMStorage; import org.apache.hadoop.ozone.om.OmMetadataManagerImpl; import org.apache.hadoop.ozone.om.helpers.OmBucketInfo; @@ -50,6 +51,8 @@ import com.codahale.metrics.Timer; import static org.apache.hadoop.ozone.OzoneAcl.AclScope.ACCESS; import static org.apache.hadoop.ozone.OzoneConsts.OM_DB_NAME; + +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -61,6 +64,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class GeneratorOm extends BaseGenerator implements Callable { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorScm.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorScm.java index a15caab7d6b..6df740a1f27 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorScm.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/containergenerator/GeneratorScm.java @@ -33,6 +33,9 @@ import com.codahale.metrics.Timer; import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.CONTAINERS; + +import org.apache.hadoop.ozone.freon.FreonSubcommand; +import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; @@ -45,6 +48,7 @@ versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true, showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) public class GeneratorScm extends BaseGenerator { private DBStore scmDb;