forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'opensearch-project:main' into support_random_remote-sto…
…re_for_IntegTests
- Loading branch information
Showing
145 changed files
with
6,710 additions
and
1,534 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 was deleted.
Oops, something went wrong.
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 @@ | ||
a6e5058ef9720623c517252d17162f845306ff3a |
1 change: 0 additions & 1 deletion
1
distribution/tools/upgrade-cli/licenses/jackson-annotations-2.16.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
distribution/tools/upgrade-cli/licenses/jackson-annotations-2.17.0.jar.sha1
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 @@ | ||
880a742337010da4c851f843d8cac150e22dff9f |
1 change: 0 additions & 1 deletion
1
distribution/tools/upgrade-cli/licenses/jackson-databind-2.16.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
distribution/tools/upgrade-cli/licenses/jackson-databind-2.17.0.jar.sha1
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 @@ | ||
7173e9e1d4bc6d7ca03bc4eeedcd548b8b580b34 |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
a6e5058ef9720623c517252d17162f845306ff3a |
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
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 was deleted.
Oops, something went wrong.
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 @@ | ||
a6e5058ef9720623c517252d17162f845306ff3a |
1 change: 0 additions & 1 deletion
1
libs/x-content/licenses/jackson-dataformat-cbor-2.16.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
libs/x-content/licenses/jackson-dataformat-cbor-2.17.0.jar.sha1
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 @@ | ||
6833c8573452d583e4af650a7424d547606b2501 |
1 change: 0 additions & 1 deletion
1
libs/x-content/licenses/jackson-dataformat-smile-2.16.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
libs/x-content/licenses/jackson-dataformat-smile-2.17.0.jar.sha1
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 @@ | ||
f10183857607fde789490d33ea46372a2d2b0c72 |
1 change: 0 additions & 1 deletion
1
libs/x-content/licenses/jackson-dataformat-yaml-2.16.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
libs/x-content/licenses/jackson-dataformat-yaml-2.17.0.jar.sha1
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 @@ | ||
57a963c6258c49febc11390082d8503f71bb15a9 |
70 changes: 70 additions & 0 deletions
70
modules/cache-common/src/main/java/org/opensearch/cache/common/policy/TookTimePolicy.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,70 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.cache.common.policy; | ||
|
||
import org.opensearch.common.cache.policy.CachedQueryResult; | ||
import org.opensearch.common.unit.TimeValue; | ||
|
||
import java.util.function.Function; | ||
import java.util.function.Predicate; | ||
|
||
/** | ||
* A cache tier policy which accepts queries whose took time is greater than some threshold. | ||
* The threshold should be set to approximately the time it takes to get a result from the cache tier. | ||
* The policy accepts values of type V and decodes them into CachedQueryResult.PolicyValues, which has the data needed | ||
* to decide whether to admit the value. | ||
* @param <V> The type of data consumed by test(). | ||
*/ | ||
public class TookTimePolicy<V> implements Predicate<V> { | ||
/** | ||
* The minimum took time to allow a query. Set to TimeValue.ZERO to let all data through. | ||
*/ | ||
private final TimeValue threshold; | ||
|
||
/** | ||
* Function which extracts the relevant PolicyValues from a serialized CachedQueryResult | ||
*/ | ||
private final Function<V, CachedQueryResult.PolicyValues> cachedResultParser; | ||
|
||
/** | ||
* Constructs a took time policy. | ||
* @param threshold the threshold | ||
* @param cachedResultParser the function providing policy values | ||
*/ | ||
public TookTimePolicy(TimeValue threshold, Function<V, CachedQueryResult.PolicyValues> cachedResultParser) { | ||
if (threshold.compareTo(TimeValue.ZERO) < 0) { | ||
throw new IllegalArgumentException("Threshold for TookTimePolicy must be >= 0ms but was " + threshold.getStringRep()); | ||
} | ||
this.threshold = threshold; | ||
this.cachedResultParser = cachedResultParser; | ||
} | ||
|
||
/** | ||
* Check whether to admit data. | ||
* @param data the input argument | ||
* @return whether to admit the data | ||
*/ | ||
public boolean test(V data) { | ||
long tookTimeNanos; | ||
try { | ||
tookTimeNanos = cachedResultParser.apply(data).getTookTimeNanos(); | ||
} catch (Exception e) { | ||
// If we can't read a CachedQueryResult.PolicyValues from the BytesReference, reject the data | ||
return false; | ||
} | ||
|
||
TimeValue tookTime = TimeValue.timeValueNanos(tookTimeNanos); | ||
return tookTime.compareTo(threshold) >= 0; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
modules/cache-common/src/main/java/org/opensearch/cache/common/policy/package-info.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,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** A package for policies controlling what can enter caches. */ | ||
package org.opensearch.cache.common.policy; |
Oops, something went wrong.