Skip to content

Commit

Permalink
Update IndicesRequestCacheIT.java (opensearch-project#13678) (opensea…
Browse files Browse the repository at this point in the history
…rch-project#13759)

(cherry picked from commit 538cd9f)

Signed-off-by: Kiran Prakash <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent cf20a61 commit e018125
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1076,24 +1076,6 @@ public void testDynamicStalenessThresholdUpdate() throws Exception {

// staleness threshold dynamic updates should throw exceptions on invalid input
public void testInvalidStalenessThresholdUpdateThrowsException() throws Exception {
int cacheCleanIntervalInMillis = 1;
String node = internalCluster().startNode(
Settings.builder()
.put(IndicesRequestCache.INDICES_REQUEST_CACHE_CLEANUP_STALENESS_THRESHOLD_SETTING_KEY, 0.90)
.put(
IndicesRequestCache.INDICES_REQUEST_CACHE_CLEANUP_INTERVAL_SETTING_KEY,
TimeValue.timeValueMillis(cacheCleanIntervalInMillis)
)
);
Client client = client(node);
String index1 = "index1";
setupIndex(client, index1);

// create first cache entry in index1
createCacheEntry(client, index1, "hello");
assertCacheState(client, index1, 0, 1);
assertTrue(getRequestCacheStats(client, index1).getMemorySizeInBytes() > 0);

// Update indices.requests.cache.cleanup.staleness_threshold to "10%" with illegal argument
assertThrows("Ratio should be in [0-1.0]", IllegalArgumentException.class, () -> {
ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
Expand All @@ -1102,15 +1084,6 @@ public void testInvalidStalenessThresholdUpdateThrowsException() throws Exceptio
);
client().admin().cluster().updateSettings(updateSettingsRequest).actionGet();
});

// everything else should continue to work fine later on.
// force refresh so that it creates 1 stale key
flushAndRefresh(index1);
// sleep until cache cleaner would have cleaned up the stale key from index 2
assertBusy(() -> {
// cache cleaner should NOT have cleaned from index 1
assertEquals(0, getRequestCacheStats(client, index1).getMemorySizeInBytes());
}, cacheCleanIntervalInMillis * 2, TimeUnit.MILLISECONDS);
}

// closing the Index after caching will clean up from Indices Request Cache
Expand Down

0 comments on commit e018125

Please sign in to comment.