Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
.put(super.nodeSettings(nodeOrdinal, otherSettings))
.put(SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
if (DiscoveryNode.hasRole(otherSettings, DiscoveryNodeRole.DATA_FROZEN_NODE_ROLE)) {
builder.put(FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(10, ByteSizeUnit.MB));
builder.put(FrozenCacheService.SHARED_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(10, ByteSizeUnit.MB));
}
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings));
if (DiscoveryNode.canContainData(otherSettings)) {
builder.put(
FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(),
FrozenCacheService.SHARED_CACHE_SIZE_SETTING.getKey(),
rarely()
? randomBoolean()
? new ByteSizeValue(randomIntBetween(1, 10), ByteSizeUnit.KB).getStringRep()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
);
}
if (DiscoveryNode.canContainData(otherSettings) && randomBoolean()) {
builder.put(FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ZERO.getStringRep());
builder.put(FrozenCacheService.SHARED_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ZERO.getStringRep());
}
builder.put(
FrozenCacheService.SNAPSHOT_CACHE_REGION_SIZE_SETTING.getKey(),
FrozenCacheService.SHARED_CACHE_REGION_SIZE_SETTING.getKey(),
rarely()
? pageAligned(new ByteSizeValue(randomIntBetween(4, 1024), ByteSizeUnit.KB))
: pageAligned(new ByteSizeValue(randomIntBetween(1, 10), ByteSizeUnit.MB))
Expand All @@ -117,7 +117,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
}
if (randomBoolean()) {
builder.put(
FrozenCacheService.FROZEN_CACHE_RECOVERY_RANGE_SIZE_SETTING.getKey(),
FrozenCacheService.SHARED_CACHE_RECOVERY_RANGE_SIZE_SETTING.getKey(),
rarely()
? pageAligned(new ByteSizeValue(randomIntBetween(4, 1024), ByteSizeUnit.KB))
: pageAligned(new ByteSizeValue(randomIntBetween(1, 10), ByteSizeUnit.MB))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
return Settings.builder()
.put(initialSettings)
// Have a shared cache of reasonable size available on each node because tests randomize over frozen and cold allocation
.put(FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ofMb(randomLongBetween(1, 10)))
.put(FrozenCacheService.SHARED_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ofMb(randomLongBetween(1, 10)))
.build();
} else {
return initialSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public static void setUpCacheSettings() {
builder.put(CacheService.SNAPSHOT_CACHE_RECOVERY_RANGE_SIZE_SETTING.getKey(), blobCacheMaxLength);

// Frozen (shared cache) cache should be large enough to not cause direct reads
builder.put(FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ofMb(128));
builder.put(FrozenCacheService.SHARED_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ofMb(128));
// Align ranges to match the blob cache max length
builder.put(FrozenCacheService.SNAPSHOT_CACHE_REGION_SIZE_SETTING.getKey(), blobCacheMaxLength);
builder.put(FrozenCacheService.SHARED_CACHE_REGION_SIZE_SETTING.getKey(), blobCacheMaxLength);
builder.put(FrozenCacheService.SHARED_CACHE_RANGE_SIZE_SETTING.getKey(), blobCacheMaxLength);
builder.put(FrozenCacheService.FROZEN_CACHE_RECOVERY_RANGE_SIZE_SETTING.getKey(), blobCacheMaxLength);
builder.put(FrozenCacheService.SHARED_CACHE_RECOVERY_RANGE_SIZE_SETTING.getKey(), blobCacheMaxLength);
cacheSettings = builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testNodesCachesStats() throws Exception {
final long cacheSize = FrozenCacheService.calculateCacheSize(clusterService.getSettings(), totalFsSize);
assertThat(nodeCachesStats.getSize(), equalTo(cacheSize));

final long regionSize = FrozenCacheService.SNAPSHOT_CACHE_REGION_SIZE_SETTING.get(clusterService.getSettings()).getBytes();
final long regionSize = FrozenCacheService.SHARED_CACHE_REGION_SIZE_SETTING.get(clusterService.getSettings()).getBytes();
assertThat(nodeCachesStats.getRegionSize(), equalTo(regionSize));

assertThat(nodeCachesStats.getNumRegions(), equalTo(Math.toIntExact(cacheSize / regionSize)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import static org.elasticsearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING;
import static org.elasticsearch.test.NodeRoles.onlyRole;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING;
import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SHARED_CACHE_SIZE_SETTING;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;

Expand All @@ -65,7 +65,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal, otherSettings))
// default to no cache: the tests create nodes with a cache configured as needed
.put(SNAPSHOT_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ZERO)
.put(SHARED_CACHE_SIZE_SETTING.getKey(), ByteSizeValue.ZERO)
.build();
}

Expand Down Expand Up @@ -123,7 +123,7 @@ public void testPartialSearchableSnapshotNotAllocatedToNodesWithoutCache() throw
.getDecisions()
.stream()
.anyMatch(
d -> d.getExplanation().contains(SNAPSHOT_CACHE_SIZE_SETTING.getKey())
d -> d.getExplanation().contains(SHARED_CACHE_SIZE_SETTING.getKey())
&& d.getExplanation().contains("frozen searchable snapshot shards cannot be allocated to this node")
)
);
Expand All @@ -136,7 +136,7 @@ public void testPartialSearchableSnapshotAllocatedToNodesWithCache() throws Exce
final List<String> newNodeNames = internalCluster().startDataOnlyNodes(
between(1, 3),
Settings.builder()
.put(SNAPSHOT_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.put(SHARED_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.build()
);

Expand All @@ -158,7 +158,7 @@ public void testOnlyPartialSearchableSnapshotAllocatedToDedicatedFrozenNodes() t
final List<String> newNodeNames = internalCluster().startNodes(
between(1, 3),
Settings.builder()
.put(SNAPSHOT_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.put(SHARED_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.put(onlyRole(DiscoveryNodeRole.DATA_FROZEN_NODE_ROLE))
.build()
);
Expand Down Expand Up @@ -244,7 +244,7 @@ public void onFailure(Exception e) {
final List<String> newNodes = internalCluster().startDataOnlyNodes(
2,
Settings.builder()
.put(SNAPSHOT_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.put(SHARED_CACHE_SIZE_SETTING.getKey(), new ByteSizeValue(randomLongBetween(1, ByteSizeValue.ofMb(10).getBytes())))
.build()
);
final ActionFuture<RestoreSnapshotResponse> responseFuture = client().execute(MountSearchableSnapshotAction.INSTANCE, req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ public List<Setting<?>> getSettings() {
CacheService.SNAPSHOT_CACHE_MAX_FILES_TO_SYNC_AT_ONCE_SETTING,
CacheService.SNAPSHOT_CACHE_SYNC_SHUTDOWN_TIMEOUT,
SearchableSnapshotEnableAllocationDecider.SEARCHABLE_SNAPSHOTS_ALLOCATE_ON_ROLLING_RESTART,
FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING,
FrozenCacheService.SNAPSHOT_CACHE_SIZE_MAX_HEADROOM_SETTING,
FrozenCacheService.SNAPSHOT_CACHE_REGION_SIZE_SETTING,
FrozenCacheService.SHARED_CACHE_SIZE_SETTING,
FrozenCacheService.SHARED_CACHE_SIZE_MAX_HEADROOM_SETTING,
FrozenCacheService.SHARED_CACHE_REGION_SIZE_SETTING,
FrozenCacheService.SHARED_CACHE_RANGE_SIZE_SETTING,
FrozenCacheService.FROZEN_CACHE_RECOVERY_RANGE_SIZE_SETTING,
FrozenCacheService.SNAPSHOT_CACHE_MAX_FREQ_SETTING,
FrozenCacheService.SNAPSHOT_CACHE_DECAY_INTERVAL_SETTING,
FrozenCacheService.SNAPSHOT_CACHE_MIN_TIME_DELTA_SETTING,
FrozenCacheService.SHARED_CACHE_RECOVERY_RANGE_SIZE_SETTING,
FrozenCacheService.SHARED_CACHE_MAX_FREQ_SETTING,
FrozenCacheService.SHARED_CACHE_DECAY_INTERVAL_SETTING,
FrozenCacheService.SHARED_CACHE_MIN_TIME_DELTA_SETTING,
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_INTERVAL_SETTING,
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_KEEP_ALIVE_SETTING,
BlobStoreCacheMaintenanceService.SNAPSHOT_SNAPSHOT_CLEANUP_BATCH_SIZE_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.io.IOException;

import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING;
import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SHARED_CACHE_SIZE_SETTING;

public class FrozenCacheInfoNodeAction extends ActionType<FrozenCacheInfoResponse> {

Expand Down Expand Up @@ -53,7 +53,7 @@ public static class TransportAction extends HandledTransportAction<Request, Froz
@Inject
public TransportAction(Settings settings, TransportService transportService, ActionFilters actionFilters) {
super(NAME, transportService, actionFilters, Request::new);
response = new FrozenCacheInfoResponse(SNAPSHOT_CACHE_SIZE_SETTING.get(settings).isNonZeroSize());
response = new FrozenCacheInfoResponse(SHARED_CACHE_SIZE_SETTING.get(settings).isNonZeroSize());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.elasticsearch.snapshots.SearchableSnapshotsSettings;
import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheInfoService;

import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING;
import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SHARED_CACHE_SIZE_SETTING;

public class HasFrozenCacheAllocationDecider extends AllocationDecider {

Expand All @@ -27,7 +27,7 @@ public class HasFrozenCacheAllocationDecider extends AllocationDecider {
private static final Decision STILL_FETCHING = Decision.single(
Decision.Type.THROTTLE,
NAME,
"value of [" + SNAPSHOT_CACHE_SIZE_SETTING.getKey() + "] on this node is not known yet"
"value of [" + SHARED_CACHE_SIZE_SETTING.getKey() + "] on this node is not known yet"
);

private static final Decision HAS_FROZEN_CACHE = Decision.single(
Expand All @@ -40,7 +40,7 @@ public class HasFrozenCacheAllocationDecider extends AllocationDecider {
Decision.Type.NO,
NAME,
"node setting ["
+ SNAPSHOT_CACHE_SIZE_SETTING.getKey()
+ SHARED_CACHE_SIZE_SETTING.getKey()
+ "] is set to zero, so frozen searchable snapshot shards cannot be allocated to this node"
);

Expand Down
Loading