From 4986b78747a6347270af237b6516f930620d1525 Mon Sep 17 00:00:00 2001 From: Austin Littley Date: Tue, 16 Jul 2024 10:35:03 -0400 Subject: [PATCH] Remove changed unrelated to health monitor Signed-off-by: Austin Littley --- .../app/config/ServicesConfigExtension.java | 4 +-- .../prehandle/PreHandleWorkflowImpl.java | 17 +++--------- .../config/data/PreHandleWorkflowConfig.java | 26 ------------------- .../testfixtures/HederaTestConfigBuilder.java | 2 -- 4 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/PreHandleWorkflowConfig.java diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/config/ServicesConfigExtension.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/config/ServicesConfigExtension.java index 9aa224f8d45d..15022206e6d5 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/config/ServicesConfigExtension.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/config/ServicesConfigExtension.java @@ -60,7 +60,6 @@ import com.hedera.node.config.data.NettyConfig; import com.hedera.node.config.data.NetworkAdminConfig; import com.hedera.node.config.data.NodesConfig; -import com.hedera.node.config.data.PreHandleWorkflowConfig; import com.hedera.node.config.data.RatesConfig; import com.hedera.node.config.data.SchedulingConfig; import com.hedera.node.config.data.SigsConfig; @@ -129,8 +128,7 @@ public Set> getConfigDataTypes() { TraceabilityConfig.class, UpgradeConfig.class, UtilPrngConfig.class, - VersionConfig.class, - PreHandleWorkflowConfig.class); + VersionConfig.class); } @NonNull diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/prehandle/PreHandleWorkflowImpl.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/prehandle/PreHandleWorkflowImpl.java index 4e345be8e48f..997e7da9a7d0 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/prehandle/PreHandleWorkflowImpl.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/prehandle/PreHandleWorkflowImpl.java @@ -47,7 +47,6 @@ import com.hedera.node.app.workflows.dispatcher.TransactionDispatcher; import com.hedera.node.config.ConfigProvider; import com.hedera.node.config.VersionedConfiguration; -import com.hedera.node.config.data.PreHandleWorkflowConfig; import com.swirlds.platform.system.events.Event; import com.swirlds.platform.system.transaction.Transaction; import edu.umd.cs.findbugs.annotations.NonNull; @@ -55,7 +54,6 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import java.util.concurrent.ForkJoinPool; import java.util.stream.Stream; import javax.inject.Inject; import javax.inject.Singleton; @@ -97,10 +95,6 @@ public class PreHandleWorkflowImpl implements PreHandleWorkflow { * Used for registering notice of transactionIDs seen by this node */ private final DeduplicationCache deduplicationCache; - /** - * Used to pre-handle transactions in parallel. - */ - private final ForkJoinPool preHandlePool; /** * Creates a new instance of {@code PreHandleWorkflowImpl}. @@ -109,6 +103,7 @@ public class PreHandleWorkflowImpl implements PreHandleWorkflow { * transaction. * @param transactionChecker the {@link TransactionChecker} for parsing and verifying the transaction * @param signatureVerifier the {@link SignatureVerifier} to verify signatures + * @throws NullPointerException if any of the parameters is {@code null} */ @Inject public PreHandleWorkflowImpl( @@ -124,12 +119,6 @@ public PreHandleWorkflowImpl( this.signatureExpander = requireNonNull(signatureExpander); this.configProvider = requireNonNull(configProvider); this.deduplicationCache = requireNonNull(deduplicationCache); - final var config = configProvider.getConfiguration().getConfigData(PreHandleWorkflowConfig.class); - if (config.isCustomPoolEnabled()) { - preHandlePool = new ForkJoinPool(config.preHandleThreadCount()); - } else { - preHandlePool = ForkJoinPool.commonPool(); - } } /** @@ -149,7 +138,7 @@ public void preHandle( final var accountStore = readableStoreFactory.getStore(ReadableAccountStore.class); // In parallel, we will pre-handle each transaction. - transactions.forEach(tx -> preHandlePool.execute(() -> { + transactions.parallel().forEach(tx -> { if (tx.isSystem()) return; try { tx.setMetadata(preHandleTransaction(creator, readableStoreFactory, accountStore, tx)); @@ -161,7 +150,7 @@ public void preHandle( "Possibly CATASTROPHIC failure while running the pre-handle workflow", unexpectedException); tx.setMetadata(unknownFailure()); } - })); + }); } // For each transaction, we will use a background thread to parse the transaction, validate it, lookup the diff --git a/hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/PreHandleWorkflowConfig.java b/hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/PreHandleWorkflowConfig.java deleted file mode 100644 index 6b8ace0863ff..000000000000 --- a/hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/PreHandleWorkflowConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed 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 com.hedera.node.config.data; - -import com.hedera.node.config.NetworkProperty; -import com.swirlds.config.api.ConfigData; -import com.swirlds.config.api.ConfigProperty; - -@ConfigData("preHandleWorkflow") -public record PreHandleWorkflowConfig( - @ConfigProperty(defaultValue = "true") @NetworkProperty boolean isCustomPoolEnabled, - @ConfigProperty(defaultValue = "8") @NetworkProperty int preHandleThreadCount) {} diff --git a/hedera-node/hedera-config/src/testFixtures/java/com/hedera/node/config/testfixtures/HederaTestConfigBuilder.java b/hedera-node/hedera-config/src/testFixtures/java/com/hedera/node/config/testfixtures/HederaTestConfigBuilder.java index de5f9631d146..fb878ffebc57 100644 --- a/hedera-node/hedera-config/src/testFixtures/java/com/hedera/node/config/testfixtures/HederaTestConfigBuilder.java +++ b/hedera-node/hedera-config/src/testFixtures/java/com/hedera/node/config/testfixtures/HederaTestConfigBuilder.java @@ -61,7 +61,6 @@ import com.hedera.node.config.data.NettyConfig; import com.hedera.node.config.data.NetworkAdminConfig; import com.hedera.node.config.data.NodesConfig; -import com.hedera.node.config.data.PreHandleWorkflowConfig; import com.hedera.node.config.data.RatesConfig; import com.hedera.node.config.data.SchedulingConfig; import com.hedera.node.config.data.SigsConfig; @@ -190,7 +189,6 @@ public static TestConfigBuilder create() { .withConfigDataType(UtilPrngConfig.class) .withConfigDataType(VersionConfig.class) .withConfigDataType(NodesConfig.class) - .withConfigDataType(PreHandleWorkflowConfig.class) .withConverter(CongestionMultipliers.class, new CongestionMultipliersConverter()) .withConverter(EntityScaleFactors.class, new EntityScaleFactorsConverter()) .withConverter(KnownBlockValues.class, new KnownBlockValuesConverter())