This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new b2e13c8 Fix No Instance Level Throttling (#1908)
b2e13c8 is described below
commit b2e13c86d2169f7d9e4738f25a6d355516fd7971
Author: Junkai Xue <[email protected]>
AuthorDate: Mon Nov 22 11:48:09 2021 -0800
Fix No Instance Level Throttling (#1908)
Instance level throttling quota never charged. Add the charging logic and
tests.
---
.../stages/IntermediateStateCalcStage.java | 1 +
.../TestReplicaLevelThrottling.SingleTopState.json | 72 ++++++++++++++++++++++
2 files changed, 73 insertions(+)
diff --git
a/helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java
b/helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java
index 558a61f..5399098 100644
---
a/helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java
+++
b/helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java
@@ -578,6 +578,7 @@ public class IntermediateStateCalcStage extends
AbstractBaseStage {
if (!hasReachedThrottlingLimit) {
throttleController.chargeCluster(rebalanceType);
throttleController.chargeResource(rebalanceType, resourceName);
+ throttleController.chargeInstance(rebalanceType,
messageToThrottle.getTgtName());
} else {
// Intermediate Map is based on current state
// Remove the message from MessageSelection result if it has been
throttled since the message will be dispatched
diff --git
a/helix-core/src/test/resources/TestReplicaLevelThrottling.SingleTopState.json
b/helix-core/src/test/resources/TestReplicaLevelThrottling.SingleTopState.json
index 5d4cdaf..fe74257 100644
---
a/helix-core/src/test/resources/TestReplicaLevelThrottling.SingleTopState.json
+++
b/helix-core/src/test/resources/TestReplicaLevelThrottling.SingleTopState.json
@@ -72,6 +72,78 @@
}
},
{
+ "description": "No pending message, instance level throttling will only
allow 1 ST happening",
+ "clusterThrottleLoad": "-1",
+ "resourceThrottleLoad": "-1",
+ "instanceThrottleLoad": "1",
+ "instanceThrottleRecovery": "-1",
+ "partitionNames": ["partition_0", "partition_1"],
+ "messageOutput": {
+ "partition_0": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "STANDBY"
+ },
+ "partition_1": {
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "STANDBY",
+ "localhost_12916": "OFFLINE"
+ }
+ },
+ "preferenceList": {
+ "partition_0": [
+ "localhost_12913",
+ "localhost_12914",
+ "localhost_12915"
+ ],
+ "partition_1": [
+ "localhost_12913",
+ "localhost_12914",
+ "localhost_12915"
+ ]
+ },
+ "currentStates": {
+ "partition_0": {
+ "localhost_12913": "STANDBY",
+ "localhost_12914": "OFFLINE",
+ "localhost_12915": "OFFLINE"
+ },
+ "partition_1": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "OFFLINE",
+ "localhost_12915": "OFFLINE",
+ "localhost_12916": "STANDBY"
+ }
+ },
+ "bestPossible": {
+ "partition_0": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "STANDBY"
+ },
+ "partition_1": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "STANDBY"
+ }
+ },
+ "pendingMessages": {
+ },
+ "expectedOutput": {
+ "partition_0": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "STANDBY"
+ },
+ "partition_1": {
+ "localhost_12913": "LEADER",
+ "localhost_12914": "STANDBY",
+ "localhost_12915": "OFFLINE",
+ "localhost_12916": "OFFLINE"
+ }
+ }
+ },
+ {
"description": "With pending message, only on message allow per
instance. Messages to 12915 should be throttled",
"clusterThrottleLoad": "-1",
"resourceThrottleLoad": "-1",