RFR: 2340: CommitCommentsWorkItem executing in GitLab takes a lot of time [v4]

Zhao Song zsong at openjdk.org
Tue Aug 13 16:25:42 UTC 2024


> Currently, if a user comments under a commit named "Merge" in GitLab, the CommitCommentsWorkItem will take about 8 hours to complete.
> After investigation, I think there is a bug in GitLabRepository#getCommitTitleToCommitsMap
> 
> For GitLab repos, we need to build a hash map for mapping commit title to commits. The implementation of the map is Map<String, LinkedHashSet<Hash>>. We use LinkedHashSet here because we want the bot to check latest commits first.
> 
> If the map has already been built, then the bot will query new commits in the repo and adds the commits into the map. However, when adding the new commit hash to the map, the bot add it to the end of the LinkedHashSet. So new commits will be checked very late.
> 
> For commit titles like "Merge", sometimes, there can be around 50K commits in a repo. If the latest "Merge" commit is added to the tail of the LinkedHashSet, the bot must check all previous commits first, which takes a lot of time.

Zhao Song has updated the pull request incrementally with one additional commit since the last revision:

  Use SequencedSet

-------------

Changes:
  - all: https://git.openjdk.org/skara/pull/1682/files
  - new: https://git.openjdk.org/skara/pull/1682/files/44be25cd..db3c7597

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=skara&pr=1682&range=03
 - incr: https://webrevs.openjdk.org/?repo=skara&pr=1682&range=02-03

  Stats: 6 lines in 1 file changed: 1 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/skara/pull/1682.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1682/head:pull/1682

PR: https://git.openjdk.org/skara/pull/1682


More information about the skara-dev mailing list