|
128 | 128 | import org.elasticsearch.snapshots.SnapshotInfo;
|
129 | 129 | import org.elasticsearch.snapshots.SnapshotMissingException;
|
130 | 130 | import org.elasticsearch.snapshots.SnapshotsService;
|
| 131 | +import org.elasticsearch.snapshots.SnapshotsServiceUtils; |
131 | 132 | import org.elasticsearch.tasks.TaskCancelledException;
|
132 | 133 | import org.elasticsearch.threadpool.ThreadPool;
|
133 | 134 | import org.elasticsearch.transport.LeakTracker;
|
@@ -974,7 +975,7 @@ private void createSnapshotsDeletion(
|
974 | 975 | return new SnapshotsDeletion(
|
975 | 976 | snapshotIds,
|
976 | 977 | repositoryDataGeneration,
|
977 |
| - SnapshotsService.minCompatibleVersion(minimumNodeVersion, originalRepositoryData, snapshotIds), |
| 978 | + SnapshotsServiceUtils.minCompatibleVersion(minimumNodeVersion, originalRepositoryData, snapshotIds), |
978 | 979 | originalRootBlobs,
|
979 | 980 | blobStore().blobContainer(indicesPath()).children(OperationPurpose.SNAPSHOT_DATA),
|
980 | 981 | originalRepositoryData
|
@@ -1080,7 +1081,7 @@ class SnapshotsDeletion {
|
1080 | 1081 | this.snapshotIds = snapshotIds;
|
1081 | 1082 | this.originalRepositoryDataGeneration = originalRepositoryDataGeneration;
|
1082 | 1083 | this.repositoryFormatIndexVersion = repositoryFormatIndexVersion;
|
1083 |
| - this.useShardGenerations = SnapshotsService.useShardGenerations(repositoryFormatIndexVersion); |
| 1084 | + this.useShardGenerations = SnapshotsServiceUtils.useShardGenerations(repositoryFormatIndexVersion); |
1084 | 1085 | this.originalRootBlobs = originalRootBlobs;
|
1085 | 1086 | this.originalIndexContainers = originalIndexContainers;
|
1086 | 1087 | this.originalRepositoryData = originalRepositoryData;
|
@@ -1750,11 +1751,11 @@ public void finalizeSnapshot(final FinalizeSnapshotContext finalizeSnapshotConte
|
1750 | 1751 | // If there are older version nodes in the cluster, we don't need to run this cleanup as it will have already happened
|
1751 | 1752 | // when writing the index-${N} to each shard directory.
|
1752 | 1753 | final IndexVersion repositoryMetaVersion = finalizeSnapshotContext.repositoryMetaVersion();
|
1753 |
| - final boolean writeShardGens = SnapshotsService.useShardGenerations(repositoryMetaVersion); |
| 1754 | + final boolean writeShardGens = SnapshotsServiceUtils.useShardGenerations(repositoryMetaVersion); |
1754 | 1755 |
|
1755 | 1756 | final Executor executor = threadPool.executor(ThreadPool.Names.SNAPSHOT);
|
1756 | 1757 |
|
1757 |
| - final boolean writeIndexGens = SnapshotsService.useIndexGenerations(repositoryMetaVersion); |
| 1758 | + final boolean writeIndexGens = SnapshotsServiceUtils.useIndexGenerations(repositoryMetaVersion); |
1758 | 1759 |
|
1759 | 1760 | record MetadataWriteResult(
|
1760 | 1761 | RepositoryData existingRepositoryData,
|
@@ -2522,7 +2523,7 @@ private void cacheRepositoryData(RepositoryData repositoryData, IndexVersion ver
|
2522 | 2523 | return;
|
2523 | 2524 | }
|
2524 | 2525 | final RepositoryData toCache;
|
2525 |
| - if (SnapshotsService.useShardGenerations(version)) { |
| 2526 | + if (SnapshotsServiceUtils.useShardGenerations(version)) { |
2526 | 2527 | toCache = repositoryData;
|
2527 | 2528 | } else {
|
2528 | 2529 | // don't cache shard generations here as they may be unreliable
|
@@ -2871,7 +2872,7 @@ public void onFailure(Exception e) {
|
2871 | 2872 | }, true);
|
2872 | 2873 | maybeWriteIndexLatest(newGen);
|
2873 | 2874 |
|
2874 |
| - if (filteredRepositoryData.getUuid().equals(RepositoryData.MISSING_UUID) && SnapshotsService.includesUUIDs(version)) { |
| 2875 | + if (filteredRepositoryData.getUuid().equals(RepositoryData.MISSING_UUID) && SnapshotsServiceUtils.includesUUIDs(version)) { |
2875 | 2876 | assert newRepositoryData.getUuid().equals(RepositoryData.MISSING_UUID) == false;
|
2876 | 2877 | logger.info(
|
2877 | 2878 | Strings.format(
|
@@ -2954,7 +2955,7 @@ public String toString() {
|
2954 | 2955 | }
|
2955 | 2956 |
|
2956 | 2957 | private RepositoryData updateRepositoryData(RepositoryData repositoryData, IndexVersion repositoryMetaversion, long newGen) {
|
2957 |
| - if (SnapshotsService.includesUUIDs(repositoryMetaversion)) { |
| 2958 | + if (SnapshotsServiceUtils.includesUUIDs(repositoryMetaversion)) { |
2958 | 2959 | final String clusterUUID = clusterService.state().metadata().clusterUUID();
|
2959 | 2960 | if (repositoryData.getClusterUUID().equals(clusterUUID) == false) {
|
2960 | 2961 | repositoryData = repositoryData.withClusterUuid(clusterUUID);
|
@@ -3089,7 +3090,7 @@ private ClusterState updateRepositoryGenerationsIfNecessary(ClusterState state,
|
3089 | 3090 | }
|
3090 | 3091 | }
|
3091 | 3092 | updatedDeletionsInProgress = changedDeletions ? SnapshotDeletionsInProgress.of(deletionEntries) : null;
|
3092 |
| - return SnapshotsService.updateWithSnapshots(state, updatedSnapshotsInProgress, updatedDeletionsInProgress); |
| 3093 | + return SnapshotsServiceUtils.updateWithSnapshots(state, updatedSnapshotsInProgress, updatedDeletionsInProgress); |
3093 | 3094 | }
|
3094 | 3095 |
|
3095 | 3096 | private RepositoryMetadata getRepoMetadata(ClusterState state) {
|
@@ -3328,8 +3329,8 @@ private void doSnapshotShard(SnapshotShardContext context) {
|
3328 | 3329 | );
|
3329 | 3330 |
|
3330 | 3331 | final ShardGeneration indexGeneration;
|
3331 |
| - final boolean writeShardGens = SnapshotsService.useShardGenerations(context.getRepositoryMetaVersion()); |
3332 |
| - final boolean writeFileInfoWriterUUID = SnapshotsService.includeFileInfoWriterUUID(context.getRepositoryMetaVersion()); |
| 3332 | + final boolean writeShardGens = SnapshotsServiceUtils.useShardGenerations(context.getRepositoryMetaVersion()); |
| 3333 | + final boolean writeFileInfoWriterUUID = SnapshotsServiceUtils.includeFileInfoWriterUUID(context.getRepositoryMetaVersion()); |
3333 | 3334 | // build a new BlobStoreIndexShardSnapshot, that includes this one and all the saved ones
|
3334 | 3335 | final BlobStoreIndexShardSnapshots updatedBlobStoreIndexShardSnapshots = snapshots.withAddedSnapshot(
|
3335 | 3336 | new SnapshotFiles(snapshotId.getName(), indexCommitPointFiles, context.stateIdentifier())
|
|
0 commit comments