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

[ISSUE-388][ISSUE-244][Bug] Fix incorrect usage of GRPCMetrics#setGauge #404

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

xianjingfeng
Copy link
Member

What changes were proposed in this pull request?

Fix incorrect usage of GRPCMetrics#setGauge

Why are the changes needed?

It is a bug #244 #388

Does this PR introduce any user-facing change?

No

How was this patch tested?

No need

@xianjingfeng
Copy link
Member Author

PTAL @jerqi @zuston

@jerqi
Copy link
Contributor

jerqi commented Dec 13, 2022

Could you explain why it will cause these problems?

@xianjingfeng
Copy link
Member Author

Could you explain why it will cause these problems?

Thread1: activeThreadSize.incrementAndGet()
Thread2: activeThreadSize.incrementAndGet()
Thread2: setGauge(2)
Thread1: setGauge(1)
final result: 1
expected result: 2

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2022

Codecov Report

Merging #404 (47eacdd) into master (45e600c) will decrease coverage by 0.63%.
The diff coverage is 66.66%.

@@             Coverage Diff              @@
##             master     #404      +/-   ##
============================================
- Coverage     59.20%   58.57%   -0.64%     
- Complexity     1471     1608     +137     
============================================
  Files           181      194      +13     
  Lines          9705    10996    +1291     
  Branches        839      963     +124     
============================================
+ Hits           5746     6441     +695     
- Misses         3612     4174     +562     
- Partials        347      381      +34     
Impacted Files Coverage Δ
...le/common/rpc/MonitoringServerTransportFilter.java 0.00% <0.00%> (ø)
...org/apache/uniffle/common/metrics/GRPCMetrics.java 46.37% <71.42%> (+6.37%) ⬆️
...java/org/apache/uniffle/common/rpc/GrpcServer.java 25.45% <100.00%> (-2.62%) ⬇️
.../hadoop/mapreduce/task/reduce/RssEventFetcher.java 88.57% <0.00%> (ø)
.../hadoop/mapreduce/task/reduce/RssBypassWriter.java 61.90% <0.00%> (ø)
...n/java/org/apache/hadoop/mapreduce/MRIdHelper.java 0.00% <0.00%> (ø)
...java/org/apache/hadoop/mapred/SortWriteBuffer.java 90.90% <0.00%> (ø)
...pache/hadoop/mapreduce/task/reduce/RssFetcher.java 90.90% <0.00%> (ø)
...preduce/task/reduce/RssRemoteMergeManagerImpl.java 82.43% <0.00%> (ø)
...g/apache/hadoop/mapred/SortWriteBufferManager.java 80.10% <0.00%> (ø)
... and 6 more

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

@jerqi
Copy link
Contributor

jerqi commented Dec 13, 2022

Could you explain why it will cause these problems?

Thread1: activeThreadSize.incrementAndGet() Thread2: activeThreadSize.incrementAndGet() Thread2: setGauge(2) Thread1: setGauge(1) final result: 1 expected result: 2

Got it.

@jerqi jerqi linked an issue Dec 13, 2022 that may be closed by this pull request
3 tasks
@jerqi jerqi changed the title [Bug] Fix incorrect usage of GRPCMetrics#setGauge [ISSUE-388][ISSUE-244][Bug] Fix incorrect usage of GRPCMetrics#setGauge Dec 13, 2022
Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @xianjingfeng

@zuston
Copy link
Member

zuston commented Dec 13, 2022

Make sense. A problem: Gauge is thread safe?

@xianjingfeng
Copy link
Member Author

Make sense. A problem: Gauge is thread safe?

Yes, it use DoubleAdder which is same as java.util.concurrent.atomic.DoubleAdder

Copy link
Member

@zuston zuston left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Flaky Test: GrpcServerTest#testGrpcExecutorPool
4 participants