Skip to content
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 @@ -81,6 +81,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -729,7 +730,7 @@ public static void validateRepositoryMetadataSettings(
+ " in the name as this delimiter is used to create pinning entity"
);
}
if (repositoryWithShallowV2Exists(repositories)) {
if (repositoryWithShallowV2Exists(repositories, repositoryName)) {
throw new RepositoryException(
repositoryName,
"setting "
Expand Down Expand Up @@ -763,8 +764,13 @@ public static void validateRepositoryMetadataSettings(
}
}

private static boolean repositoryWithShallowV2Exists(Map<String, Repository> repositories) {
return repositories.values().stream().anyMatch(repo -> SHALLOW_SNAPSHOT_V2.get(repo.getMetadata().settings()));
private static boolean repositoryWithShallowV2Exists(Map<String, Repository> repositories, String repositoryName) {
return repositories.values()
.stream()
.anyMatch(
repository -> SHALLOW_SNAPSHOT_V2.get(repository.getMetadata().settings())
&& !Objects.equals(repository.getMetadata().name(), repositoryName)
);
}

private static boolean pinnedTimestampExistsWithDifferentRepository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,13 @@ public void testRepositoryCreationShallowV2() throws Exception {
);
}

// Modify repo-1 settings. This should go through
updateRepository(
client,
"test-repo-1",
Settings.builder().put(snapshotRepoSettings1).put("max_snapshot_bytes_per_sec", "10k").build()
);

// Disable shallow snapshot V2 setting on test-repo-1
updateRepository(
client,
Expand Down
Loading