Skip to content

feat: Automate scheduler construction for the event deduplicator #12527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.swirlds.platform.components.ConsensusEngine;
import com.swirlds.platform.event.GossipEvent;
import com.swirlds.platform.event.creation.EventCreationManager;
import com.swirlds.platform.event.deduplication.EventDeduplicator;
import com.swirlds.platform.event.hashing.EventHasher;
import com.swirlds.platform.event.linking.InOrderLinker;
import com.swirlds.platform.event.orphan.OrphanBuffer;
Expand Down Expand Up @@ -61,10 +60,11 @@

/**
* The {@link TaskScheduler}s used by the platform.
* <p>
* This class is being phased out. Do not add additional schedulers to this class!
*
* @param eventHasherScheduler the scheduler for the event hasher
* @param postHashCollectorScheduler the scheduler for the post hash collector
* @param eventDeduplicatorScheduler the scheduler for the event deduplicator
* @param eventSignatureValidatorScheduler the scheduler for the event signature validator
* @param orphanBufferScheduler the scheduler for the orphan buffer
* @param inOrderLinkerScheduler the scheduler for the in-order linker
Expand All @@ -90,7 +90,6 @@
public record PlatformSchedulers(
@NonNull TaskScheduler<GossipEvent> eventHasherScheduler,
@NonNull TaskScheduler<GossipEvent> postHashCollectorScheduler,
@NonNull TaskScheduler<GossipEvent> eventDeduplicatorScheduler,
@NonNull TaskScheduler<GossipEvent> eventSignatureValidatorScheduler,
@NonNull TaskScheduler<List<GossipEvent>> orphanBufferScheduler,
@NonNull TaskScheduler<EventImpl> inOrderLinkerScheduler,
Expand Down Expand Up @@ -148,14 +147,6 @@ public static PlatformSchedulers create(
.withUnhandledTaskCapacity(UNLIMITED_CAPACITY)
.build()
.cast(),
model.schedulerBuilder("eventDeduplicator")
.withType(config.eventDeduplicatorSchedulerType())
.withUnhandledTaskCapacity(config.eventDeduplicatorUnhandledCapacity())
.withFlushingEnabled(true)
.withUnhandledTaskMetricEnabled(true)
.withHyperlink(platformCoreHyperlink(EventDeduplicator.class))
.build()
.cast(),
model.schedulerBuilder("eventSignatureValidator")
.withType(config.eventSignatureValidatorSchedulerType())
.withUnhandledTaskCapacity(config.eventSignatureValidatorUnhandledCapacity())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@
* negative number.
* @param eventHasherUnhandledCapacity number of unhandled tasks allowed in the event hasher
* scheduler
* @param internalEventValidator configuration for the internal event validator
* scheduler
* @param eventDeduplicatorSchedulerType the event deduplicator scheduler type
* @param eventDeduplicatorUnhandledCapacity number of unhandled tasks allowed in the event deduplicator
* scheduler
* @param internalEventValidator configuration for the internal event validator scheduler
* @param eventDeduplicator configuration for the event deduplicator scheduler
* @param eventSignatureValidatorSchedulerType the event signature validator scheduler type
* @param eventSignatureValidatorUnhandledCapacity number of unhandled tasks allowed in the event signature
* validator scheduler
Expand Down Expand Up @@ -98,8 +95,8 @@ public record PlatformSchedulersConfig(
@ConfigProperty(defaultValue = "500") int eventHasherUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL CAPACITY(500) FLUSHABLE UNHANDLED_TASK_METRIC")
TaskSchedulerConfiguration internalEventValidator,
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType eventDeduplicatorSchedulerType,
@ConfigProperty(defaultValue = "500") int eventDeduplicatorUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL CAPACITY(500) FLUSHABLE UNHANDLED_TASK_METRIC")
TaskSchedulerConfiguration eventDeduplicator,
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType eventSignatureValidatorSchedulerType,
@ConfigProperty(defaultValue = "500") int eventSignatureValidatorUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType orphanBufferSchedulerType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ public PlatformWiring(
new PassThroughWiring<>(model, "GossipEvent", schedulers.postHashCollectorScheduler());
internalEventValidatorWiring =
new ComponentWiring<>(model, InternalEventValidator.class, config.internalEventValidator());
eventDeduplicatorWiring =
new ComponentWiring<>(model, EventDeduplicator.class, schedulers.eventDeduplicatorScheduler());
eventDeduplicatorWiring = new ComponentWiring<>(model, EventDeduplicator.class, config.eventDeduplicator());
eventSignatureValidatorWiring = new ComponentWiring<>(
model, EventSignatureValidator.class, schedulers.eventSignatureValidatorScheduler());
orphanBufferWiring = OrphanBufferWiring.create(schedulers.orphanBufferScheduler());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pcli diagram \
-s 'toNotification:StateWriteToDiskCompleteNotification:📦' \
-s 'latestCompleteStateNotifier:CompleteStateNotificationWithCleanup:💢' \
-s 'orphanBufferSplitter:preconsensus signatures:🔰' \
-g 'Event Validation:InternalEventValidator,eventDeduplicator,eventSignatureValidator' \
-g 'Event Validation:InternalEventValidator,EventDeduplicator,eventSignatureValidator' \
-g 'Event Hashing:eventHasher,postHashCollector' \
-g 'Orphan Buffer:orphanBuffer,orphanBufferSplitter' \
-g 'Consensus Engine:consensusEngine,consensusEngineSplitter,eventWindowManager,getKeystoneEventSequenceNumber' \
Expand Down