Skip to content

Commit

Permalink
Cleanup commit
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Alfonsi <[email protected]>
  • Loading branch information
Peter Alfonsi committed Jan 4, 2024
1 parent b2c95f8 commit b562278
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.Client;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.cache.tier.DiskTierTookTimePolicy;
import org.opensearch.common.cache.tier.TierType;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.index.cache.request.RequestCacheStats;
import org.opensearch.index.cache.request.ShardRequestCache;
Expand All @@ -54,7 +56,9 @@ public class IndicesRequestCacheDiskTierIT extends OpenSearchIntegTestCase {
public void testDiskTierStats() throws Exception {
int heapSizeBytes = 4729;
String node = internalCluster().startNode(
Settings.builder().put(IndicesRequestCache.INDICES_CACHE_QUERY_SIZE.getKey(), new ByteSizeValue(heapSizeBytes))
Settings.builder()
.put(IndicesRequestCache.INDICES_CACHE_QUERY_SIZE.getKey(), new ByteSizeValue(heapSizeBytes))
.put(DiskTierTookTimePolicy.DISK_TOOKTIME_THRESHOLD_SETTING.getKey(), TimeValue.ZERO) // allow into disk cache regardless of took time
);
Client client = client(node);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.indices;

import org.opensearch.core.common.bytes.BytesReference;

import java.io.IOException;
package org.opensearch.common.cache.tier;

public interface CacheTierPolicy<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.indices.CacheTierPolicy;
import org.opensearch.common.cache.tier.CacheTierPolicy;
import org.opensearch.search.query.QuerySearchResult;

import java.io.IOException;
Expand All @@ -32,7 +32,7 @@
*/
public class DiskTierTookTimePolicy implements CacheTierPolicy<BytesReference> {
public static final Setting<TimeValue> DISK_TOOKTIME_THRESHOLD_SETTING = Setting.positiveTimeSetting(
"index.requests.cache.disk.tooktime.threshold",
"indices.requests.cache.disk.tooktime.threshold",
new TimeValue(10),
Setting.Property.Dynamic,
Setting.Property.NodeScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.opensearch.cluster.service.ClusterManagerTaskThrottler;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.cache.tier.DiskTierTookTimePolicy;
import org.opensearch.common.logging.Loggers;
import org.opensearch.common.network.NetworkModule;
import org.opensearch.common.network.NetworkService;
Expand Down Expand Up @@ -112,7 +113,6 @@
import org.opensearch.indices.IndexingMemoryController;
import org.opensearch.indices.IndicesQueryCache;
import org.opensearch.indices.IndicesRequestCache;
import org.opensearch.indices.IndicesRequestCacheTookTimePolicy;
import org.opensearch.indices.IndicesService;
import org.opensearch.indices.ShardLimitValidator;
import org.opensearch.indices.analysis.HunspellService;
Expand Down Expand Up @@ -676,7 +676,10 @@ public void apply(Settings value, Settings current, Settings previous) {
RemoteClusterStateService.REMOTE_CLUSTER_STATE_ENABLED_SETTING,
RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING,
IndicesService.CLUSTER_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING,
IndicesService.CLUSTER_REMOTE_INDEX_RESTRICT_ASYNC_DURABILITY_SETTING
IndicesService.CLUSTER_REMOTE_INDEX_RESTRICT_ASYNC_DURABILITY_SETTING,

// Tiered caching
DiskTierTookTimePolicy.DISK_TOOKTIME_THRESHOLD_SETTING
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public Long getTookTimeNanos() {
return tookTimeNanos;
}

void setTookTimeNanos(long tookTime) {
public void setTookTimeNanos(long tookTime) {
tookTimeNanos = tookTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
public class IRCKeyWriteableSerializerTests extends OpenSearchSingleNodeTestCase {

public void testSerializer() throws Exception {
ClusterSettings dummyClusterSettings = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
IndicesRequestCache irc = new IndicesRequestCache(Settings.EMPTY, indicesService);
IndicesRequestCache irc = new IndicesRequestCache(Settings.EMPTY, indicesService, dummyClusterSettings);
IndexService indexService = createIndex("test");
IndexShard indexShard = indexService.getShardOrNull(0);
IndicesService.IndexShardCacheEntity entity = indicesService.new IndexShardCacheEntity(indexShard);
Expand Down

0 comments on commit b562278

Please sign in to comment.