-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-6245] Improve Repository class stability and validation #4977
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
Conversation
- Add comprehensive input validation for Repository ID, URL, credentials, and proxy settings - Introduce RepositoryException for better error handling and clear error messages - Enhance JSON deserialization with proper exception handling and validation - Add extensive test coverage with 21 test cases covering all validation scenarios - Improve JavaDoc documentation with usage examples and exception conditions - Maintain backward compatibility while strengthening internal validation
Looked at the changes. Looks pretty good. I have not yet lighted all the corners. Can you make it so that the repository class variables are final? btw. the changes are definitely not ‘minor’. Please create a JIRA ticket. |
…itory class - Made all Repository class variables final for immutability - Implemented Builder pattern as requested by reviewer - Deprecated existing fluent API methods in favor of Builder - Updated factory methods to use Builder pattern - Maintained backward compatibility with @deprecated annotations - Updated javadoc examples to demonstrate Builder usage The Builder pattern provides better control over object construction and ensures immutability of Repository instances once created.
@Reamer Thank you for the review! I've created a JIRA ticket as suggested: https://issues.apache.org/jira/browse/ZEPPELIN-6245 Regarding your suggestions:
|
It looks much better with the builder pattern. 👍 I'm not entirely satisfied with the changes yet, but it's a good first attempt. In my opinion, we should not use classes from the I don't know if this is even feasible, which is why I would merge these changes first and then look into this issue. |
Hi @renechoi First of all thank you for the changes you made. Recently I raised a ticket ZEPPELIN-6231 for highlighting a bug that I found while testing Zeppelin on Kubernetes. After reviewing the code changes you made it appears that the bug will be fixed. Thanks |
@Reamer Thank you for the feedback! I've removed all the deprecated methods as requested. Regarding the org.eclipse.aether package usage, I investigated the codebase and found that:
The current design allows Zeppelin to maintain a clean separation where:
I agree that reducing the exposure of org.eclipse.aether classes would improve the architecture. As you suggested, this could be a good follow-up improvement after this PR is merged. @ankursaini2006 Thank you for confirming that these changes should fix the issue you reported in ZEPPELIN-6231! It's great to hear that this PR will help resolve the Kubernetes deployment issue. |
@renechoi since you are refactoring the dependencies management, I have one question. if we request an artifact from maven repository, currently whole dependency tree is downloaded and eventually the requested dependency is downloaded. It takes a lot of time. During my test for downloading trino jdbc jar, it took 20mins. Why don’t we just download the requested artifact itself ? Instead of doing collect dependencies why don’t we perform resolve artifact ? source: resolveDependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your current code does not compile. Please use the builder in your tests as well.
- Updated all Repository instantiation in tests to use the new builder pattern - Fixed compilation errors in RepositoryTest.java and InterpreterInfoSavingTest.java - Replaced direct constructor calls with Repository.Builder pattern - All tests now use .build() method to create Repository instances - Maintained test logic and coverage while adopting the new pattern
@ankursaini2006 Thank you for your insights! Regarding ZEPPELIN-6231: Great to hear that these Repository improvements should fix the Kubernetes deployment issue you reported. About the dependency resolution performance issue you raised - this is indeed a critical performance problem. I investigated the code and confirmed that Your suggestion to use @Reamer What do you think about creating a follow-up JIRA ticket for this dependency resolution optimization? We could:
This would be a significant performance improvement while maintaining backward compatibility. Should we track this as a separate enhancement after this PR is merged? Ready for your review! |
I don't think that's a good idea. If you don't need the transitive dependencies, you can exclude them just like you would in Maven. |
Currently CI fails because of your changes.
|
I've fixed the CI failure. The issue was in |
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will merge this into the master on Monday if no further comments are received.
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I will merge the pull request on Wednesday if no further comments are received. |
@Reamer Hi, just wanted to gently check in on this PR. Please let me know if there is anything else needed from my side for the merge. Thanks again for your time and reviews! |
@renechoi |
Improve Repository Class Stability and Validation
Summary
This PR enhances the
Repository
class with comprehensive input validation, error handling, and stability improvements to ensure robust Maven repository configuration management.Changes Made
1. Enhanced Input Validation
2. Improved Error Handling
RepositoryException
class for Repository-specific errors3. Builder Pattern Enhancements
4. JSON Serialization Improvements
fromJson()
method with comprehensive validation5. Documentation and Code Quality
Benefits
Testing
Example Usage