-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9249: Yield control if too many timers due r=pihme a=pihme ## Description Adds a mechanism for the `DueDateTimeChecker` to yield control after some time. This is to stop it from iterating over an unknown number of due timer events and blocking execution while doing so. Overall, this change should work well in cases where there is a huge backlog of timers. This backlog would then be reduced bit by bit. The change is potentially bad for cases in which there is a constant and high load with many timers being created all the time. In this case, the change of this PR can lead to due timers continuously growing and the timers triggered will fall more and more behind real time. Overall, this tradeoff was deemed advantageous. At least it removes that dangers that the iteration blocks the execution for so long that the node is marked as unhealthy. When this situation is reached there is currently no practical recovery possible. Even before this point is reached, execution will be blocked for long stretches of time, and no progress can be made on that partition. So one faulty process can block all others from executing. Both issues are addressed by this PR. With this PR it should be always possible to make some progress, albeit small. This would allow users to cancel or change any faulty process, or to reduce the load if needed. Further work will be needed to figure out a way how to trigger timers without potentially falling further and further behind real time. ## Review Hints This PR has duplicate commits from #9237 ## Related issues <!-- Which issues are closed by this PR or are related --> closes #9238 Co-authored-by: pihme <pihme@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
445 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
broker/src/test/java/io/camunda/zeebe/broker/system/configuration/FeatureFlagsCfgTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.broker.system.configuration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.junit.Test; | ||
|
||
public class FeatureFlagsCfgTest { | ||
|
||
public final Map<String, String> environment = new HashMap<>(); | ||
|
||
@Test | ||
public void shouldSetEnableYieldingDueDateCheckerFromConfig() { | ||
// when | ||
final BrokerCfg cfg = TestConfigReader.readConfig("feature-flags-cfg", environment); | ||
final var featureFlagsCfg = cfg.getExperimental().getFeatures(); | ||
|
||
// then | ||
assertThat(featureFlagsCfg.isEnableYieldingDueDateChecker()).isTrue(); | ||
} | ||
|
||
@Test | ||
public void shouldSetEnableYieldingDueDateCheckerFromEnv() { | ||
// given | ||
environment.put("zeebe.broker.experimental.features.enableYieldingDueDateChecker", "false"); | ||
|
||
// when | ||
final BrokerCfg cfg = TestConfigReader.readConfig("feature-flags-cfg", environment); | ||
final var featureFlagsCfg = cfg.getExperimental().getFeatures(); | ||
|
||
// then | ||
assertThat(featureFlagsCfg.isEnableYieldingDueDateChecker()).isFalse(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
zeebe: | ||
broker: | ||
experimental: | ||
features: | ||
enableYieldingDueDateChecker: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.