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

[SPARK-30406] OneForOneStreamManager ensure that compound operations on shared variables are atomic #27071

Closed
wants to merge 2 commits into from

Conversation

ajithme
Copy link
Contributor

@ajithme ajithme commented Jan 2, 2020

Using compound operations as well as increments and decrements on primitive fields are not atomic operations. Here when volatile primitive field is incremented or decremented, we run into data loss if threads interleave in steps of update.

Refer: https://wiki.sei.cmu.edu/confluence/display/java/VNA02-J.+Ensure+that+compound+operations+on+shared+variables+are+atomic

What changes were proposed in this pull request?

Using AtomicLong instead of long

Why are the changes needed?

volatile primitive field is incremented or decremented, we run into data loss if threads interleave in steps of update.

Does this PR introduce any user-facing change?

No

How was this patch tested?

All Existing UT can pass with the Change

…mitive fields are not atomic operations. Here when volatile primitive field is incremented or decremented,  we run into data loss if threads interleave in steps of update. 
@ajithme
Copy link
Contributor Author

ajithme commented Jan 2, 2020

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

LGTM

@SparkQA
Copy link

SparkQA commented Jan 2, 2020

Test build #4982 has finished for PR 27071 at commit 48c9058.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Jan 2, 2020

Jenkins retest this please

@SparkQA
Copy link

SparkQA commented Jan 2, 2020

Test build #116045 has finished for PR 27071 at commit 48c9058.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Jan 3, 2020

Merged to master

@srowen srowen closed this in 7002932 Jan 3, 2020
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.

4 participants