@@ -619,10 +619,8 @@ public void onResponse(RepositoryData repositoryData) {
619
619
}
620
620
cleanOrphanTimestamp (repositoryName , repositoryData );
621
621
logger .info ("created snapshot-v2 [{}] in repository [{}]" , repositoryName , snapshotName );
622
+ leaveRepoLoop (repositoryName );
622
623
listener .onResponse (snapshotInfo );
623
- // For snapshot-v2, we don't allow concurrent snapshots . But meanwhile non-v2 snapshot operations
624
- // can get queued . This is triggering them.
625
- runNextQueuedOperation (repositoryData , repositoryName , true );
626
624
}
627
625
628
626
@ Override
@@ -1021,10 +1019,8 @@ public void onResponse(RepositoryData repositoryData) {
1021
1019
return ;
1022
1020
}
1023
1021
logger .info ("snapshot-v2 clone [{}] completed successfully" , snapshot );
1022
+ leaveRepoLoop (repositoryName );
1024
1023
listener .onResponse (null );
1025
- // For snapshot-v2, we don't allow concurrent snapshots . But meanwhile non-v2 snapshot operations
1026
- // can get queued . This is triggering them.
1027
- runNextQueuedOperation (repositoryData , repositoryName , true );
1028
1024
}
1029
1025
1030
1026
@ Override
@@ -2564,6 +2560,19 @@ public void deleteSnapshots(final DeleteSnapshotRequest request, final ActionLis
2564
2560
public ClusterState execute (ClusterState currentState ) throws Exception {
2565
2561
final SnapshotsInProgress snapshots = currentState .custom (SnapshotsInProgress .TYPE , SnapshotsInProgress .EMPTY );
2566
2562
final List <SnapshotsInProgress .Entry > snapshotEntries = findInProgressSnapshots (snapshots , snapshotNames , repoName );
2563
+ boolean isSnapshotV2 = SHALLOW_SNAPSHOT_V2 .get (repository .getMetadata ().settings ());
2564
+ boolean remoteStoreIndexShallowCopy = remoteStoreShallowCopyEnabled (repository );
2565
+ List <SnapshotsInProgress .Entry > entriesForThisRepo = snapshots .entries ()
2566
+ .stream ()
2567
+ .filter (entry -> Objects .equals (entry .repository (), repoName ))
2568
+ .collect (Collectors .toList ());
2569
+ if (isSnapshotV2 && remoteStoreIndexShallowCopy && entriesForThisRepo .isEmpty () == false ) {
2570
+ throw new ConcurrentSnapshotExecutionException (
2571
+ repoName ,
2572
+ String .join ("," , snapshotNames ),
2573
+ "cannot delete snapshots in v2 repo while a snapshot is in progress"
2574
+ );
2575
+ }
2567
2576
final List <SnapshotId > snapshotIds = matchingSnapshotIds (
2568
2577
snapshotEntries .stream ().map (e -> e .snapshot ().getSnapshotId ()).collect (Collectors .toList ()),
2569
2578
repositoryData ,
0 commit comments