Browse Source

SONAR-12146 fix resilience of deletion of project/branch/view

tags/7.8
Sébastien Lesaint 5 years ago
parent
commit
2f48b31961

+ 4
- 4
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java View File

@@ -245,28 +245,28 @@ public class PurgeDao implements Dao {
deleteRootComponent(uuid, purgeMapper, purgeCommands);
}

private void deleteRootComponent(String rootUuid, PurgeMapper mapper, PurgeCommands commands) {
private static void deleteRootComponent(String rootUuid, PurgeMapper mapper, PurgeCommands commands) {
List<IdUuidPair> rootAndModulesOrSubviews = mapper.selectRootAndModulesOrSubviewsByProjectUuid(rootUuid);
long rootId = rootAndModulesOrSubviews.stream()
.filter(pair -> pair.getUuid().equals(rootUuid))
.map(IdUuidPair::getId)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Couldn't find root component with uuid " + rootUuid));
commands.deletePermissions(rootId);
commands.deleteLinks(rootUuid);
commands.deleteAnalyses(rootUuid);
commands.deleteByRootAndModulesOrSubviews(rootAndModulesOrSubviews);
commands.deleteComponents(rootUuid);
commands.deleteIssues(rootUuid);
commands.deleteFileSources(rootUuid);
commands.deleteCeActivity(rootUuid);
commands.deleteCeQueue(rootUuid);
commands.deleteWebhooks(rootUuid);
commands.deleteWebhookDeliveries(rootUuid);
commands.deleteLiveMeasures(rootUuid);
commands.deleteProjectMappings(rootUuid);
commands.deleteProjectAlmBindings(rootUuid);
commands.deletePermissions(rootId);
commands.deleteBranch(rootUuid);
commands.deleteLiveMeasures(rootUuid);
commands.deleteComponents(rootUuid);
}

/**

Loading…
Cancel
Save