|
71 | 71 | import org.opensearch.index.IndexSettings;
|
72 | 72 | import org.opensearch.index.mapper.MapperService;
|
73 | 73 | import org.opensearch.index.query.QueryShardContext;
|
74 |
| -import org.opensearch.index.remote.RemoteStoreBlobPathType; |
| 74 | +import org.opensearch.index.remote.RemoteStorePathType; |
75 | 75 | import org.opensearch.index.translog.Translog;
|
76 | 76 | import org.opensearch.indices.IndexCreationException;
|
77 | 77 | import org.opensearch.indices.IndicesService;
|
@@ -1587,34 +1587,32 @@ public void testBuildIndexMetadata() {
|
1587 | 1587 | */
|
1588 | 1588 | public void testRemoteCustomData() {
|
1589 | 1589 | // Case 1 - Remote store is not enabled
|
1590 |
| - IndexMetadata indexMetadata = testRemoteCustomData(false, randomBoolean()); |
| 1590 | + IndexMetadata indexMetadata = testRemoteCustomData(false, randomFrom(RemoteStorePathType.values())); |
1591 | 1591 | assertNull(indexMetadata.getCustomData(IndexMetadata.REMOTE_STORE_CUSTOM_KEY));
|
1592 | 1592 |
|
1593 |
| - // Case 2 - cluster.remote_store.index.path.prefix.optimised=false (default value) |
1594 |
| - indexMetadata = testRemoteCustomData(true, false); |
| 1593 | + // Case 2 - cluster.remote_store.index.path.prefix.optimised=fixed (default value) |
| 1594 | + indexMetadata = testRemoteCustomData(true, RemoteStorePathType.FIXED); |
1595 | 1595 | validateRemoteCustomData(
|
1596 | 1596 | indexMetadata.getCustomData(IndexMetadata.REMOTE_STORE_CUSTOM_KEY),
|
1597 |
| - RemoteStoreBlobPathType.NAME, |
1598 |
| - RemoteStoreBlobPathType.FIXED.toString() |
| 1597 | + RemoteStorePathType.NAME, |
| 1598 | + RemoteStorePathType.FIXED.toString() |
1599 | 1599 | );
|
1600 | 1600 |
|
1601 |
| - // Case 3 - cluster.remote_store.index.path.prefix.optimised=true |
1602 |
| - indexMetadata = testRemoteCustomData(true, true); |
| 1601 | + // Case 3 - cluster.remote_store.index.path.prefix.optimised=hashed_prefix |
| 1602 | + indexMetadata = testRemoteCustomData(true, RemoteStorePathType.HASHED_PREFIX); |
1603 | 1603 | validateRemoteCustomData(
|
1604 | 1604 | indexMetadata.getCustomData(IndexMetadata.REMOTE_STORE_CUSTOM_KEY),
|
1605 |
| - RemoteStoreBlobPathType.NAME, |
1606 |
| - RemoteStoreBlobPathType.HASHED_PREFIX.toString() |
| 1605 | + RemoteStorePathType.NAME, |
| 1606 | + RemoteStorePathType.HASHED_PREFIX.toString() |
1607 | 1607 | );
|
1608 | 1608 | }
|
1609 | 1609 |
|
1610 |
| - private IndexMetadata testRemoteCustomData(boolean remoteStoreEnabled, boolean optimisedPrefix) { |
| 1610 | + private IndexMetadata testRemoteCustomData(boolean remoteStoreEnabled, RemoteStorePathType remoteStorePathType) { |
1611 | 1611 | Settings.Builder settingsBuilder = Settings.builder();
|
1612 | 1612 | if (remoteStoreEnabled) {
|
1613 | 1613 | settingsBuilder.put(NODE_ATTRIBUTES.getKey() + REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, "test");
|
1614 | 1614 | }
|
1615 |
| - if (optimisedPrefix) { |
1616 |
| - settingsBuilder.put(IndicesService.CLUSTER_REMOTE_STORE_PATH_PREFIX_OPTIMISED_SETTING.getKey(), true); |
1617 |
| - } |
| 1615 | + settingsBuilder.put(IndicesService.CLUSTER_REMOTE_STORE_PATH_PREFIX_TYPE_SETTING.getKey(), remoteStorePathType.toString()); |
1618 | 1616 | Settings settings = settingsBuilder.build();
|
1619 | 1617 |
|
1620 | 1618 | ClusterService clusterService = mock(ClusterService.class);
|
|
0 commit comments