|
96 | 96 | import org.opensearch.cluster.service.applicationtemplates.TestSystemTemplatesRepositoryPlugin;
|
97 | 97 | import org.opensearch.common.Nullable;
|
98 | 98 | import org.opensearch.common.Priority;
|
| 99 | +import org.opensearch.common.blobstore.BlobPath; |
99 | 100 | import org.opensearch.common.collect.Tuple;
|
100 | 101 | import org.opensearch.common.concurrent.GatedCloseable;
|
101 | 102 | import org.opensearch.common.network.NetworkModule;
|
|
140 | 141 | import org.opensearch.index.engine.Segment;
|
141 | 142 | import org.opensearch.index.mapper.CompletionFieldMapper;
|
142 | 143 | import org.opensearch.index.mapper.MockFieldFilterPlugin;
|
| 144 | +import org.opensearch.index.remote.RemoteStoreEnums; |
143 | 145 | import org.opensearch.index.remote.RemoteStoreEnums.PathType;
|
| 146 | +import org.opensearch.index.remote.RemoteStorePathStrategy; |
144 | 147 | import org.opensearch.index.shard.IndexShard;
|
145 | 148 | import org.opensearch.index.store.Store;
|
146 | 149 | import org.opensearch.index.translog.Translog;
|
|
155 | 158 | import org.opensearch.node.remotestore.RemoteStoreNodeService;
|
156 | 159 | import org.opensearch.plugins.NetworkPlugin;
|
157 | 160 | import org.opensearch.plugins.Plugin;
|
| 161 | +import org.opensearch.repositories.IndexId; |
158 | 162 | import org.opensearch.repositories.blobstore.BlobStoreRepository;
|
159 | 163 | import org.opensearch.repositories.fs.FsRepository;
|
160 | 164 | import org.opensearch.repositories.fs.ReloadableFsRepository;
|
|
220 | 224 | import static org.opensearch.index.IndexSettings.INDEX_DOC_ID_FUZZY_SET_FALSE_POSITIVE_PROBABILITY_SETTING;
|
221 | 225 | import static org.opensearch.index.IndexSettings.INDEX_SOFT_DELETES_RETENTION_LEASE_PERIOD_SETTING;
|
222 | 226 | import static org.opensearch.index.query.QueryBuilders.matchAllQuery;
|
| 227 | +import static org.opensearch.index.remote.RemoteStoreEnums.PathHashAlgorithm.FNV_1A_COMPOSITE_1; |
223 | 228 | import static org.opensearch.indices.IndicesService.CLUSTER_REPLICATION_TYPE_SETTING;
|
224 | 229 | import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY;
|
225 | 230 | import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX;
|
@@ -2884,4 +2889,16 @@ private static Settings buildRemoteStoreNodeAttributes(
|
2884 | 2889 | settings.put(RemoteStoreSettings.CLUSTER_REMOTE_STORE_PINNED_TIMESTAMP_ENABLED.getKey(), randomBoolean());
|
2885 | 2890 | return settings.build();
|
2886 | 2891 | }
|
| 2892 | + |
| 2893 | + public static String resolvePath(IndexId indexId, String shardId) { |
| 2894 | + PathType pathType = PathType.fromCode(indexId.getShardPathType()); |
| 2895 | + RemoteStorePathStrategy.SnapshotShardPathInput shardPathInput = new RemoteStorePathStrategy.SnapshotShardPathInput.Builder() |
| 2896 | + .basePath(BlobPath.cleanPath()) |
| 2897 | + .indexUUID(indexId.getId()) |
| 2898 | + .shardId(shardId) |
| 2899 | + .build(); |
| 2900 | + RemoteStoreEnums.PathHashAlgorithm pathHashAlgorithm = pathType != PathType.FIXED ? FNV_1A_COMPOSITE_1 : null; |
| 2901 | + BlobPath blobPath = pathType.path(shardPathInput, pathHashAlgorithm); |
| 2902 | + return blobPath.buildAsString(); |
| 2903 | + } |
2887 | 2904 | }
|
0 commit comments