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

[#864] feat(server): Introduce Jersey to strengthen REST API #939

Merged
merged 40 commits into from
Jul 7, 2023

Conversation

xianjingfeng
Copy link
Member

@xianjingfeng xianjingfeng commented Jun 8, 2023

What changes were proposed in this pull request?

Introduce Jersey to strengthen REST API.
To use a new version of Jersey and being compatible with Hadoop 2.x, we have to use a shaded version of Jersery.
However Uniffle doesn't do binary release currently, we choose to introduce hbase's one as a temporary solution.

todo: release a shaded Jersey package for Uniffle's internal use or migrate to Graddle.

Why are the changes needed?

Fix: #864

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added UT.

@xianjingfeng
Copy link
Member Author

  1. Jersey1 is used in this PR. I have try to use jersey2, but i found it is not compatible with hadoop.
  2. We can't use lambda expression in jersey resources with jersey 1.9. https://stackoverflow.com/questions/24232784/jersey-and-java-8-lambda-expression

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2023

Codecov Report

Merging #939 (1bf8ec2) into master (66c752f) will decrease coverage by 4.26%.
The diff coverage is 52.26%.

@@             Coverage Diff              @@
##             master     #939      +/-   ##
============================================
- Coverage     58.54%   54.28%   -4.26%     
- Complexity     1611     2500     +889     
============================================
  Files           195      357     +162     
  Lines         11035    18153    +7118     
  Branches        966     1758     +792     
============================================
+ Hits           6460     9855    +3395     
- Misses         4195     7683    +3488     
- Partials        380      615     +235     
Impacted Files Coverage Δ
...a/org/apache/uniffle/client/HttpClientFactory.java 0.00% <0.00%> (ø)
...java/org/apache/uniffle/client/RestClientConf.java 0.00% <0.00%> (ø)
...java/org/apache/uniffle/client/RestClientImpl.java 0.00% <0.00%> (ø)
...a/org/apache/uniffle/client/UniffleRestClient.java 0.00% <0.00%> (ø)
...uniffle/client/exception/UniffleRestException.java 0.00% <0.00%> (ø)
...rg/apache/hadoop/mapred/RssMapOutputCollector.java 0.00% <0.00%> (ø)
...java/org/apache/hadoop/mapred/SortWriteBuffer.java 90.90% <ø> (ø)
...n/java/org/apache/hadoop/mapreduce/MRIdHelper.java 0.00% <ø> (ø)
.../java/org/apache/hadoop/mapreduce/RssMRConfig.java 23.07% <ø> (ø)
...n/java/org/apache/hadoop/mapreduce/RssMRUtils.java 47.82% <0.00%> (ø)
... and 147 more

... and 164 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jerqi
Copy link
Contributor

jerqi commented Jun 10, 2023

SGTM, Let's merge this after #768 #937.

@advancedxy
Copy link
Contributor

I'm kind of busy these days. Let me review this tomorrow.

Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

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

Generally lgtm.

@advancedxy
Copy link
Contributor

We can't use lambda expression in jersey resources with jersey 1.9. https://stackoverflow.com/questions/24232784/jersey-and-java-8-lambda-expression

Is it possible to upgrade Jersey to at least 1.9+? Otherwise, new code may introduce lambda, and that would be crushed in runtime...

@xianjingfeng
Copy link
Member Author

We can't use lambda expression in jersey resources with jersey 1.9. https://stackoverflow.com/questions/24232784/jersey-and-java-8-lambda-expression

Is it possible to upgrade Jersey to at least 1.9+? Otherwise, new code may introduce lambda, and that would be crushed in runtime...

I will try it.

jerqi and others added 5 commits June 20, 2023 14:33
…apache#773)

1. To avoid memory leak by caching of proxy user UGI.

Fix: apache#772

The Hadoop filesystem instance will be created too many time in cache,
which will cause the shuffle server memory leak.

As we know, the filesystem cache's key is built by the scheme、authority and UGI.
The scheme and authority are not changed every time. But for UGI, if we invoke the
createProxyUser, it will always create a new one, that means the every invoking `Filesystem.get()`,
it will be cached due to different key.

No.

1. Existing UTs
2. Added tests
… leak (apache#773) (apache#824)

1. To avoid memory leak by caching of proxy user UGI.

Fix: apache#772

The Hadoop filesystem instance will be created too many time in cache, which will cause the shuffle server memory leak.

As we know, the filesystem cache's key is built by the scheme、authority and UGI. The scheme and authority are not changed every time. But for UGI, if we invoke the createProxyUser, it will always create a new one, that means the every invoking `Filesystem.get()`, it will be cached due to different key.

No.

1. Existing UTs
2. Added tests
…ion when rss.storage.type without MEMORY. (apache#887)"

This reverts commit 4423b43.
@xianjingfeng
Copy link
Member Author

Already changed to use hbase-thirdparty. PTAL @jerqi @advancedxy @yl09099

@yl09099
Copy link
Contributor

yl09099 commented Jun 30, 2023

Already changed to use hbase-thirdparty. PTAL @jerqi @advancedxy @yl09099

Already changed to use hbase-thirdparty. PTAL @jerqi @advancedxy @yl09099

I also tried to solve it, but I introduced the hbase-shaded-jackson-jaxrs-json-provider package, you can not write the JsonConverter conversion class, I have resolved the conflict in #960, you see my way is okay?

@xianjingfeng
Copy link
Member Author

Already changed to use hbase-thirdparty. PTAL @jerqi @advancedxy @yl09099

Already changed to use hbase-thirdparty. PTAL @jerqi @advancedxy @yl09099

I also tried to solve it, but I introduced the hbase-shaded-jackson-jaxrs-json-provider package, you can not write the JsonConverter conversion class, I have resolved the conflict in #960, you see my way is okay?

I tried to register resource in the same way as you before, but I found that I couldn’t get HttpServletRequest or HttpServletRequest, have you tested it and it’s ok?

@advancedxy
Copy link
Contributor

Hi @xianjingfeng and @slfan1989 this and #963 which one should be merged first? And by the way, seems like these two PRs both have PR failrures.

@xianjingfeng
Copy link
Member Author

Hi @xianjingfeng and @slfan1989 this and #963 which one should be merged first?

It doesn't matter which one is merged first. But #963 should not contain the content that introduces jersey.

And by the way, seems like these two PRs both have PR failrures.

The failrure of this pr because of flaky test.

@slfan1989
Copy link
Collaborator

Hi @xianjingfeng and @slfan1989 this and #963 which one should be merged first? And by the way, seems like these two PRs both have PR failrures.

@advancedxy @xianjingfeng From my personal point of view, this pr should be merged first. #963 is still under discussion, and yl09099 is currently working on the documentation. It might take some time before we can merge it.

@yl09099
Copy link
Contributor

yl09099 commented Jul 3, 2023

The failrure of this pr because of flaky test.

This PR should be merged first

@advancedxy advancedxy self-assigned this Jul 4, 2023
@jerqi jerqi requested a review from advancedxy July 4, 2023 11:01
Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

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

Generally lgtm, left two minor comments

@advancedxy
Copy link
Contributor

@xianjingfeng This looks good to me now. I modified some content of the PR summary. Please amend/update accordingly if there are anything missing or left. Then I think we can squash and merge this PR.

@xianjingfeng
Copy link
Member Author

@xianjingfeng This looks good to me now. I modified some content of the PR summary. Please amend/update accordingly if there are anything missing or left. Then I think we can squash and merge this PR.

SGTM. Thanks for your work

@xianjingfeng
Copy link
Member Author

Do you have any other suggestions? @jerqi @yl09099

@slfan1989
Copy link
Collaborator

Do you have any other suggestions? @jerqi @yl09099

LGTM +1.

@yl09099
Copy link
Contributor

yl09099 commented Jul 7, 2023

Do you have any other suggestions? @jerqi @yl09099

LGTM +1.

@xianjingfeng xianjingfeng merged commit b8038cb into apache:master Jul 7, 2023
@xianjingfeng
Copy link
Member Author

Merged. Thanks all.

@xianjingfeng xianjingfeng deleted the issue_864_jersey1 branch August 9, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Introduce Jersey to strengthen REST API
9 participants