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

CELEBORN-1079: Fix use of GuardedBy in client-flink/common #2029

Closed
wants to merge 2 commits into from
Closed

CELEBORN-1079: Fix use of GuardedBy in client-flink/common #2029

wants to merge 2 commits into from

Conversation

mridulm
Copy link
Contributor

@mridulm mridulm commented Oct 23, 2023

What changes were proposed in this pull request?

  • Fix use of GuardedBy on nonexistant lock.
  • Annotate methods, which are expected to be called with lock held, with GuardedBy so that error prone can analyze all invocations

Why are the changes needed?

There is no functional change, but it helps errorprone analysis.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit tests

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #2029 (a5b0f37) into main (49ea881) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2029   +/-   ##
=======================================
  Coverage   46.90%   46.90%           
=======================================
  Files         165      165           
  Lines       10531    10531           
  Branches      959      959           
=======================================
  Hits         4938     4938           
  Misses       5271     5271           
  Partials      322      322           

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

@@ -92,7 +90,6 @@ public class PartitionSortedBuffer implements SortBuffer {
// For writing
// ---------------------------------------------------------------------------------------------
/** Whether this sort buffer is released. A released sort buffer can not be used. */
@GuardedBy("lock")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am assuming this GuardedBy is a holdover from some past migration ?
This class is marked as not thread safe, and there is no lock instance.

Given this, I removed the annotation

@@ -155,6 +155,7 @@ public void recycle(ByteBuffer buffer) {
}
}

@GuardedBy("lock")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a assert Thread.holdsLock(lock) - so the expectation is that these two methods have the lock held.
This annotation is is to help error prone understand that entire method is marked thread safe w.r.t lock

waitinfuture pushed a commit to waitinfuture/RemoteShuffleService that referenced this pull request Oct 24, 2023
* Fix use of `GuardedBy` on nonexistant lock.
* Annotate methods, which are expected to be called with lock held, with `GuardedBy` so that error prone can analyze all invocations

There is no functional change, but it helps errorprone analysis.

No

Unit tests

Closes apache#2029 from mridulm/fix-flink-guarded-by-annotation.

Authored-by: Mridul Muralidharan <mridulatgmail.com>
Signed-off-by: zky.zhoukeyong <[email protected]>
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.

1 participant