Skip to content

Commit

Permalink
[Remote Store] Update version to 2.14 in path type check (#13436) (#1…
Browse files Browse the repository at this point in the history
…3438)

(cherry picked from commit a47e123)

Signed-off-by: Ashish Singh <ssashish@amazon.com>
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 29d7331 commit 751c41a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 751c41a

Please sign in to comment.