Skip to content
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

Use legacy intake pipeline by default #10120

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public record EventConfig(
@ConfigProperty(defaultValue = "/opt/hgcapp/eventsStreams") String eventsLogDir,
@ConfigProperty(defaultValue = "true") boolean enableEventStreaming,
@ConfigProperty(defaultValue = "8") int prehandlePoolSize,
@ConfigProperty(defaultValue = "false") boolean useLegacyIntake) {}
@ConfigProperty(defaultValue = "true") boolean useLegacyIntake) {}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.swirlds.base.state.Startable;
import com.swirlds.base.state.Stoppable;
import com.swirlds.base.time.Time;
import com.swirlds.common.config.EventConfig;
import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.threading.interrupt.InterruptableConsumer;
import com.swirlds.common.utility.Clearable;
Expand All @@ -35,12 +36,14 @@
import com.swirlds.platform.event.validation.EventSignatureValidator;
import com.swirlds.platform.event.validation.InternalEventValidator;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.Objects;
import java.util.function.Consumer;

/**
* Encapsulates wiring for {@link com.swirlds.platform.SwirldsPlatform}.
*/
public class PlatformWiring implements Startable, Stoppable, Clearable {
private final PlatformContext platformContext;
private final WiringModel model;

private final InternalEventValidatorWiring internalEventValidatorWiring;
Expand All @@ -57,6 +60,7 @@
* @param time provides wall clock time
*/
public PlatformWiring(@NonNull final PlatformContext platformContext, @NonNull final Time time) {
this.platformContext = Objects.requireNonNull(platformContext);
model = WiringModel.create(platformContext, time);

final PlatformSchedulers schedulers = PlatformSchedulers.create(platformContext, model);
Expand Down Expand Up @@ -214,14 +218,16 @@
*/
@Override
public void clear() {
// pause the orphan buffer to break the cycle, and flush the pause through
orphanBufferWiring.pauseInput().inject(true);
orphanBufferWiring.flushRunnable().run();
if (!platformContext.getConfiguration().getConfigData(EventConfig.class).useLegacyIntake()) {
// pause the orphan buffer to break the cycle, and flush the pause through
orphanBufferWiring.pauseInput().inject(true);
orphanBufferWiring.flushRunnable().run();

Check warning on line 224 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java#L223-L224

Added lines #L223 - L224 were not covered by tests

// now that no cycles exist, flush all the wiring objects
flushAll();
// now that no cycles exist, flush all the wiring objects
flushAll();

Check warning on line 227 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java#L227

Added line #L227 was not covered by tests

// once everything has been flushed through the system, it's safe to unpause the orphan buffer
orphanBufferWiring.pauseInput().inject(false);
// once everything has been flushed through the system, it's safe to unpause the orphan buffer
orphanBufferWiring.pauseInput().inject(false);

Check warning on line 230 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java#L230

Added line #L230 was not covered by tests
}
}
}