-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified enabled/enforced flags with search backpressure mode
Signed-off-by: Ketan Verma <ketan9495@gmail.com>
- Loading branch information
Showing
7 changed files
with
88 additions
and
59 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
52 changes: 52 additions & 0 deletions
52
server/src/main/java/org/opensearch/search/backpressure/settings/SearchBackpressureMode.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,52 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.search.backpressure.settings; | ||
|
||
/** | ||
* Defines the search backpressure mode. | ||
*/ | ||
public enum SearchBackpressureMode { | ||
/** | ||
* SearchBackpressureService is completely disabled. | ||
*/ | ||
DISABLED("disabled"), | ||
|
||
/** | ||
* SearchBackpressureService only monitors the resource usage of running tasks. | ||
*/ | ||
MONITOR_ONLY("monitor_only"), | ||
|
||
/** | ||
* SearchBackpressureService monitors and rejects tasks that exceed resource usage thresholds. | ||
*/ | ||
ENFORCED("enforced"); | ||
|
||
private final String name; | ||
|
||
SearchBackpressureMode(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public static SearchBackpressureMode fromName(String name) { | ||
switch (name) { | ||
case "disabled": | ||
return DISABLED; | ||
case "monitor_only": | ||
return MONITOR_ONLY; | ||
case "enforced": | ||
return ENFORCED; | ||
} | ||
|
||
throw new IllegalArgumentException("invalid TaskResourceUsageTrackerType: " + name); | ||
} | ||
} |
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