Skip to content

Commit 021eb08

Browse files
Add cluster setting for searchable snapshot local cache block size
1 parent afa479b commit 021eb08

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

server/src/main/java/org/opensearch/common/settings/ClusterSettings.java

+1
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ public void apply(Settings value, Settings current, Settings previous) {
697697

698698
// Settings related to Searchable Snapshots
699699
Node.NODE_SEARCH_CACHE_SIZE_SETTING,
700+
Node.NODE_SEARCH_CACHE_BLOCK_SHIFT_SETTING,
700701
FileCacheSettings.DATA_TO_FILE_CACHE_SIZE_RATIO_SETTING,
701702

702703
// Settings related to Remote Refresh Segment Pressure

server/src/main/java/org/opensearch/node/Node.java

+22
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ public class Node implements Closeable {
383383
Property.NodeScope
384384
);
385385

386+
public static final Setting<String> NODE_SEARCH_CACHE_BLOCK_SHIFT_SETTING = new Setting<>(
387+
"node.search.cache.block_size",
388+
s -> (DiscoveryNode.isDedicatedSearchNode(s)) ? "23" : ZERO,
389+
Node::validateFileCacheBlockSizeShift,
390+
Property.NodeScope
391+
);
392+
386393
private static final String CLIENT_TYPE = "node";
387394

388395
/**
@@ -2061,6 +2068,21 @@ private static String validateFileCacheSize(String capacityRaw) {
20612068
return capacityRaw;
20622069
}
20632070

2071+
private static String validateFileCacheBlockSizeShift(String blockSizeShiftRaw) {
2072+
int shift = Integer.parseInt(blockSizeShiftRaw);
2073+
if (shift >= 31 || shift <= 10) {
2074+
throw new SettingsException(
2075+
"Unable to initialize the "
2076+
+ DiscoveryNodeRole.SEARCH_ROLE.roleName()
2077+
+ " node: "
2078+
+ NODE_SEARCH_CACHE_BLOCK_SHIFT_SETTING.getKey()
2079+
+ " must be between 10 and 30"
2080+
);
2081+
}
2082+
2083+
return blockSizeShiftRaw;
2084+
}
2085+
20642086
/**
20652087
* Returns the {@link FileCache} instance for remote search node
20662088
* Note: Visible for testing

0 commit comments

Comments
 (0)