Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Improve git operations performance #9809

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bb4e6c8
refactored query usage, SSH works nicely, for HTTPS state keeping is …
SimonEntholzer Nov 17, 2024
cc8d497
fixed access log again
SimonEntholzer Nov 18, 2024
f945d1e
more fixes of access log
SimonEntholzer Nov 18, 2024
483d9fd
cleanup 1
SimonEntholzer Nov 18, 2024
5e5705e
handle aux repos correctly
SimonEntholzer Nov 18, 2024
ce69c49
fix retrieval of test repository solution participation
SimonEntholzer Nov 18, 2024
c8e3bcc
cleanup 2
SimonEntholzer Nov 18, 2024
19e4d8c
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 19, 2024
10f2260
cleanup 3
SimonEntholzer Nov 19, 2024
7812d47
cleanup 4
SimonEntholzer Nov 19, 2024
ed27a1b
cleanup 5
SimonEntholzer Nov 19, 2024
48f3255
fix tests
SimonEntholzer Nov 19, 2024
59d437f
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 19, 2024
5bdfea2
fix server style
SimonEntholzer Nov 19, 2024
fe504dd
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 23, 2024
3c9a2a9
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 26, 2024
fb6e69d
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 26, 2024
2994293
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 28, 2024
ba93fa7
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 29, 2024
e3ecc78
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Nov 30, 2024
51a4514
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 6, 2024
24109d4
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 7, 2024
9a41a29
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 8, 2024
06c290d
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 10, 2024
fb4c947
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 10, 2024
ff15cf3
merge develop
SimonEntholzer Dec 21, 2024
72fb576
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 22, 2024
40be7f9
add suggestions
SimonEntholzer Dec 22, 2024
b3099da
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 22, 2024
c42ad29
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 23, 2024
7d954a6
Merge branch 'develop' into chore/programming-exercises/improve-perfo…
SimonEntholzer Dec 23, 2024
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 @@ -78,8 +78,11 @@ Optional<ProgrammingExerciseStudentParticipation> findByIdWithAllResultsAndRelat

List<ProgrammingExerciseStudentParticipation> findAllByExerciseIdAndStudentLogin(long exerciseId, String username);

default ProgrammingExerciseStudentParticipation findByExerciseIdAndStudentLoginOrThrow(long exerciseId, String username) {
return getValueElseThrow(findByExerciseIdAndStudentLogin(exerciseId, username));
@EntityGraph(type = LOAD, attributePaths = { "submissions" })
Optional<ProgrammingExerciseStudentParticipation> findWithSubmissionsByRepositoryUri(String repositoryUri);

default ProgrammingExerciseStudentParticipation findWithSubmissionsByRepositoryUriElseThrow(String repositoryUri) {
return getValueElseThrow(findWithSubmissionsByRepositoryUri(repositoryUri));
}

Optional<ProgrammingExerciseStudentParticipation> findByRepositoryUri(String repositoryUri);
Expand All @@ -88,41 +91,9 @@ default ProgrammingExerciseStudentParticipation findByRepositoryUriElseThrow(Str
return getValueElseThrow(findByRepositoryUri(repositoryUri));
}

@EntityGraph(type = LOAD, attributePaths = { "submissions" })
Optional<ProgrammingExerciseStudentParticipation> findWithSubmissionsByExerciseIdAndStudentLogin(long exerciseId, String username);

default ProgrammingExerciseStudentParticipation findWithSubmissionsByExerciseIdAndStudentLoginOrThrow(long exerciseId, String username) {
return getValueElseThrow(findWithSubmissionsByExerciseIdAndStudentLogin(exerciseId, username));
}

Optional<ProgrammingExerciseStudentParticipation> findByExerciseIdAndStudentLoginAndTestRun(long exerciseId, String username, boolean testRun);

@EntityGraph(type = LOAD, attributePaths = { "team.students" })
Optional<ProgrammingExerciseStudentParticipation> findByExerciseIdAndTeamId(long exerciseId, long teamId);

@Query("""
SELECT DISTINCT participation
FROM ProgrammingExerciseStudentParticipation participation
LEFT JOIN FETCH participation.team team
LEFT JOIN FETCH team.students
WHERE participation.exercise.id = :exerciseId
AND participation.team.shortName = :teamShortName
""")
Optional<ProgrammingExerciseStudentParticipation> findWithEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") long exerciseId,
@Param("teamShortName") String teamShortName);

@Query("""
SELECT DISTINCT participation
FROM ProgrammingExerciseStudentParticipation participation
LEFT JOIN FETCH participation.submissions
LEFT JOIN FETCH participation.team team
LEFT JOIN FETCH team.students
WHERE participation.exercise.id = :exerciseId
AND participation.team.shortName = :teamShortName
""")
Optional<ProgrammingExerciseStudentParticipation> findWithSubmissionsAndEagerStudentsByExerciseIdAndTeamShortName(@Param("exerciseId") long exerciseId,
@Param("teamShortName") String teamShortName);

@Query("""
SELECT DISTINCT participation
FROM ProgrammingExerciseStudentParticipation participation
Expand Down Expand Up @@ -159,17 +130,6 @@ Optional<ProgrammingExerciseStudentParticipation> findWithSubmissionsAndEagerStu
List<ProgrammingExerciseStudentParticipation> findWithSubmissionsByExerciseIdAndParticipationIds(@Param("exerciseId") long exerciseId,
@Param("participationIds") Collection<Long> participationIds);

@Query("""
SELECT participation
FROM ProgrammingExerciseStudentParticipation participation
LEFT JOIN FETCH participation.submissions
WHERE participation.exercise.id = :exerciseId
AND participation.student.login = :username
AND participation.testRun = :testRun
""")
Optional<ProgrammingExerciseStudentParticipation> findWithSubmissionsByExerciseIdAndStudentLoginAndTestRun(@Param("exerciseId") long exerciseId,
@Param("username") String username, @Param("testRun") boolean testRun);

@Query("""
SELECT participation.repositoryUri
FROM ProgrammingExerciseStudentParticipation participation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ public interface SolutionProgrammingExerciseParticipationRepository
""")
Optional<SolutionProgrammingExerciseParticipation> findByBuildPlanIdWithResults(@Param("buildPlanId") String buildPlanId);

Optional<SolutionProgrammingExerciseParticipation> findByRepositoryUri(String repositoryUri);

default SolutionProgrammingExerciseParticipation findByRepositoryUriElseThrow(String repositoryUri) {
return getValueElseThrow(findByRepositoryUri(repositoryUri));
}

@EntityGraph(type = LOAD, attributePaths = { "results", "submissions", "submissions.results" })
Optional<SolutionProgrammingExerciseParticipation> findWithEagerResultsAndSubmissionsByProgrammingExerciseId(long exerciseId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public interface TemplateProgrammingExerciseParticipationRepository
""")
Optional<TemplateProgrammingExerciseParticipation> findByBuildPlanIdWithResults(@Param("buildPlanId") String buildPlanId);

@EntityGraph(type = LOAD, attributePaths = { "results", "submissions" })
Optional<TemplateProgrammingExerciseParticipation> findWithEagerResultsAndSubmissionsByProgrammingExerciseId(long exerciseId);
@EntityGraph(type = LOAD, attributePaths = { "submissions" })
Optional<TemplateProgrammingExerciseParticipation> findWithSubmissionsByRepositoryUri(String repositoryUri);

default TemplateProgrammingExerciseParticipation findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(long exerciseId) {
return getValueElseThrow(findWithEagerResultsAndSubmissionsByProgrammingExerciseId(exerciseId));
default TemplateProgrammingExerciseParticipation findWithSubmissionsByRepositoryUriElseThrow(String repositoryUri) {
return getValueElseThrow(findWithSubmissionsByRepositoryUri(repositoryUri));
}

Optional<TemplateProgrammingExerciseParticipation> findByRepositoryUri(String repositoryUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,36 @@
public interface VcsAccessLogRepository extends ArtemisJpaRepository<VcsAccessLog, Long> {

/**
* Find the access log entry which does not have any commit hash yet
* Retrieves the most recent {@link VcsAccessLog} for a given participation ID.
*
* @param participationId The id of the participation the repository belongs to
* @return a log entry belonging to the participationId, which has no commit hash
* @param participationId the ID of the participation to filter by.
* @return an {@link Optional} containing the newest {@link VcsAccessLog}, or empty if none exists.
*/
@Query("""

SELECT vcsAccessLog
SELECT vcsAccessLog
FROM VcsAccessLog vcsAccessLog
WHERE vcsAccessLog.participation.id = :participationId
ORDER BY vcsAccessLog.timestamp DESC
ORDER BY vcsAccessLog.id DESC
LIMIT 1
""")
Optional<VcsAccessLog> findNewestByParticipationId(@Param("participationId") long participationId);

/**
* Retrieves the most recent {@link VcsAccessLog} for a specific repository URI of a participation.
*
* @param repositoryUri the URI of the participation to filter by.
* @return an Optional containing the newest {@link VcsAccessLog} of the participation, or empty if none exists.
*/
@Query("""
SELECT vcsAccessLog
FROM VcsAccessLog vcsAccessLog
LEFT JOIN TREAT (vcsAccessLog.participation AS ProgrammingExerciseStudentParticipation) participation
WHERE participation.repositoryUri = :repositoryUri
ORDER BY vcsAccessLog.id DESC
LIMIT 1
""")
Optional<VcsAccessLog> findNewestByRepositoryUri(@Param("repositoryUri") String repositoryUri);

/**
* Retrieves a list of {@link VcsAccessLog} entities associated with the specified participation ID.
* The results are ordered by the log ID in ascending order.
Expand Down
Loading
Loading