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

Maven remote index migration and refactoring #7976

Merged
merged 2 commits into from
Jan 5, 2025

Conversation

mbien
Copy link
Member

@mbien mbien commented Nov 21, 2024

refactoring: split NexusRepositoryIndexerImpl to make it more maintainable

  • moves about half of the code into a dedicated class
  • queries moved to NexusRepositoryQueries
  • index management remains in NexusRepositoryIndexManager

automatically move remote maven index from old into current cache, if:

  • both cache folders share the same parent
  • the cache folder is from an older release
  • the index itself is still somewhat up to date
  • current NB instance is not a dev build

note:

-J-Dmaven.indexing.diag.release=25 can be used to simulate a release version. This would move the index from <25 into the cache for current if above conditions apply (dev builds should not move anything). The index can be simply moved back by hand after testing.

@mbien mbien added Code cleanup Maven [ci] enable "build tools" tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Nov 21, 2024
@mbien mbien added this to the NB25 milestone Nov 21, 2024
@mbien mbien force-pushed the remote-index-migration branch from d848634 to ac8c041 Compare November 21, 2024 14:32
@mbien mbien force-pushed the remote-index-migration branch from ac8c041 to 4a7b601 Compare January 3, 2025 05:47
@mbien mbien marked this pull request as ready for review January 3, 2025 05:48
@mbien mbien requested a review from matthiasblaesing January 5, 2025 05:53
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only eyeballed this, but looks good to me. Please consider to cleanup whitespace before merge. If you run "Search and Replace" with Regexp enabled and using the search pattern [ \t]+$ you see what I mean (I noticed that when diffing the two new files with the original implementation)

mbien added 2 commits January 5, 2025 16:58
 - moves about half of the code into a dedicated class
 - queries moved to NexusRepositoryQueries
 - index management remains in NexusRepositoryIndexManager
conditions:

 - both cache folders share the same parent
 - the cache folder is from an older release
 - the index itself is still somewhat up to date
 - current NB instance is not a dev build
@mbien mbien force-pushed the remote-index-migration branch from 4a7b601 to f263bc1 Compare January 5, 2025 16:10
@mbien
Copy link
Member Author

mbien commented Jan 5, 2025

good catch, not sure where this was from. I cleaned up NexusRepositoryQueries completely (since its a new file) and some spots in NexusRepositoryIndexManager.

@matthiasblaesing
Copy link
Contributor

Thank you.

@mbien
Copy link
Member Author

mbien commented Jan 5, 2025

btw I forgot to mention that the main reason I extracted the queries is because this would make it a little bit easier to drop the remote index code if sonatype decides to discontinue their index - the local bits could be kept and selective queries reimplemented which call a service or use maven plugins which fetches metadata directly to the local repo.

In any case the one class did too much at once. Thanks for reviewing!

@mbien mbien merged commit b9ac871 into apache:master Jan 5, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Code cleanup Maven [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants