From b8d53aa8d0344a761f2e7d63ef7a651b1665bbcd Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Sun, 10 Mar 2024 11:44:52 +0800 Subject: [PATCH] [improve][cli] Remove cli unnecessary code (#22161) --- .../java/org/apache/pulsar/testclient/PerformanceConsumer.java | 2 -- .../java/org/apache/pulsar/testclient/PerformanceProducer.java | 2 -- .../java/org/apache/pulsar/testclient/PerformanceReader.java | 2 -- .../org/apache/pulsar/testclient/PerformanceTransaction.java | 2 -- .../java/org/apache/pulsar/testclient/PerfClientUtilsTest.java | 2 ++ 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java index bcdb981e1ebe5..7863bc49a15f9 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java @@ -47,7 +47,6 @@ import org.apache.pulsar.client.api.MessageListener; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.Schema; -import org.apache.pulsar.client.api.SizeUnit; import org.apache.pulsar.client.api.SubscriptionInitialPosition; import org.apache.pulsar.client.api.SubscriptionType; import org.apache.pulsar.client.api.transaction.Transaction; @@ -230,7 +229,6 @@ public static void main(String[] args) throws Exception { long testEndTime = startTime + (long) (arguments.testTime * 1e9); ClientBuilder clientBuilder = PerfClientUtils.createClientBuilderFromArguments(arguments) - .memoryLimit(arguments.memoryLimit, SizeUnit.BYTES) .enableTransaction(arguments.isEnableTransaction); PulsarClient pulsarClient = clientBuilder.build(); diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java index a5adb508a18b8..ac34bbd9f7a87 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java @@ -69,7 +69,6 @@ import org.apache.pulsar.client.api.ProducerBuilder; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; -import org.apache.pulsar.client.api.SizeUnit; import org.apache.pulsar.client.api.TypedMessageBuilder; import org.apache.pulsar.client.api.transaction.Transaction; import org.apache.pulsar.common.partition.PartitionedTopicMetadata; @@ -513,7 +512,6 @@ private static void runProducer(int producerId, ClientBuilder clientBuilder = PerfClientUtils.createClientBuilderFromArguments(arguments) - .memoryLimit(arguments.memoryLimit, SizeUnit.BYTES) .enableTransaction(arguments.isEnableTransaction); client = clientBuilder.build(); diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java index 6174caad1f938..ed5cc37644a31 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceReader.java @@ -40,7 +40,6 @@ import org.apache.pulsar.client.api.Reader; import org.apache.pulsar.client.api.ReaderBuilder; import org.apache.pulsar.client.api.ReaderListener; -import org.apache.pulsar.client.api.SizeUnit; import org.apache.pulsar.client.impl.MessageIdImpl; import org.apache.pulsar.common.naming.TopicName; import org.apache.pulsar.common.util.FutureUtil; @@ -141,7 +140,6 @@ public static void main(String[] args) throws Exception { }; ClientBuilder clientBuilder = PerfClientUtils.createClientBuilderFromArguments(arguments) - .memoryLimit(arguments.memoryLimit, SizeUnit.BYTES) .enableTls(arguments.useTls); PulsarClient pulsarClient = clientBuilder.build(); diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java index 84aaba5fab623..0bfa216c45919 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java @@ -58,7 +58,6 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; -import org.apache.pulsar.client.api.SizeUnit; import org.apache.pulsar.client.api.SubscriptionInitialPosition; import org.apache.pulsar.client.api.SubscriptionType; import org.apache.pulsar.client.api.transaction.Transaction; @@ -224,7 +223,6 @@ public static void main(String[] args) } ClientBuilder clientBuilder = PerfClientUtils.createClientBuilderFromArguments(arguments) - .memoryLimit(arguments.memoryLimit, SizeUnit.BYTES) .enableTransaction(!arguments.isDisableTransaction); try (PulsarClient client = clientBuilder.build()) { diff --git a/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java b/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java index 3d734b1f910ea..a7aa3b5a976e3 100644 --- a/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java +++ b/pulsar-testclient/src/test/java/org/apache/pulsar/testclient/PerfClientUtilsTest.java @@ -70,6 +70,7 @@ public void testClientCreation() throws Exception { args.tlsTrustCertsFilePath = "path"; args.tlsAllowInsecureConnection = true; args.maxLookupRequest = 100000; + args.memoryLimit = 10240; final ClientBuilderImpl builder = (ClientBuilderImpl)PerfClientUtils.createClientBuilderFromArguments(args); final ClientConfigurationData conf = builder.getClientConfigurationData(); @@ -89,6 +90,7 @@ public void testClientCreation() throws Exception { Assert.assertEquals(conf.getMaxLookupRequest(), 100000); Assert.assertNull(conf.getProxyServiceUrl()); Assert.assertNull(conf.getProxyProtocol()); + Assert.assertEquals(conf.getMemoryLimitBytes(), 10240L); }