Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remote Store] Update version to 2.14 in path type min node version check #13436

Merged
merged 1 commit into from
Apr 29, 2024
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 @@ -36,7 +36,7 @@ public RemoteStorePathStrategy get() {
PathType pathType;
PathHashAlgorithm pathHashAlgorithm;
// Min node version check ensures that we are enabling the new prefix type only when all the nodes understand it.
pathType = Version.CURRENT.compareTo(minNodeVersionSupplier.get()) <= 0 ? remoteStoreSettings.getPathType() : PathType.FIXED;
pathType = Version.V_2_14_0.compareTo(minNodeVersionSupplier.get()) <= 0 ? remoteStoreSettings.getPathType() : PathType.FIXED;
// If the path type is fixed, hash algorithm is not applicable.
pathHashAlgorithm = pathType == PathType.FIXED ? null : remoteStoreSettings.getPathHashAlgorithm();
return new RemoteStorePathStrategy(pathType, pathHashAlgorithm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testGetMinVersionNewer() {
Settings settings = Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), pathType).build();
ClusterSettings clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
RemoteStoreSettings remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(pathType, resolver.get().getType());
if (pathType.requiresHashAlgorithm()) {
assertNotNull(resolver.get().getHashAlgorithm());
Expand All @@ -49,7 +49,7 @@ public void testGetStrategy() {
Settings settings = Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), PathType.FIXED).build();
ClusterSettings clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
RemoteStoreSettings remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.FIXED, resolver.get().getType());

// FIXED type with hash algorithm
Expand All @@ -59,22 +59,22 @@ public void testGetStrategy() {
.build();
clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.FIXED, resolver.get().getType());

// HASHED_PREFIX type with FNV_1A_COMPOSITE
settings = Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), PathType.HASHED_PREFIX).build();
clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.HASHED_PREFIX, resolver.get().getType());
assertEquals(PathHashAlgorithm.FNV_1A_COMPOSITE_1, resolver.get().getHashAlgorithm());

// HASHED_PREFIX type with FNV_1A_COMPOSITE
settings = Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), PathType.HASHED_PREFIX).build();
clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.HASHED_PREFIX, resolver.get().getType());
assertEquals(PathHashAlgorithm.FNV_1A_COMPOSITE_1, resolver.get().getHashAlgorithm());

Expand All @@ -85,7 +85,7 @@ public void testGetStrategy() {
.build();
clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.HASHED_PREFIX, resolver.get().getType());
assertEquals(PathHashAlgorithm.FNV_1A_BASE64, resolver.get().getHashAlgorithm());

Expand All @@ -96,7 +96,7 @@ public void testGetStrategy() {
.build();
clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.HASHED_PREFIX, resolver.get().getType());
assertEquals(PathHashAlgorithm.FNV_1A_BASE64, resolver.get().getHashAlgorithm());
}
Expand All @@ -107,7 +107,7 @@ public void testGetStrategyWithDynamicUpdate() {
Settings settings = Settings.builder().build();
ClusterSettings clusterSettings = new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
RemoteStoreSettings remoteStoreSettings = new RemoteStoreSettings(settings, clusterSettings);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.CURRENT);
RemoteStorePathStrategyResolver resolver = new RemoteStorePathStrategyResolver(remoteStoreSettings, () -> Version.V_2_14_0);
assertEquals(PathType.FIXED, resolver.get().getType());
assertNull(resolver.get().getHashAlgorithm());

Expand Down
Loading