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

STORM-2516: Fix timing issues with testPrepareLateTupleStreamWithoutB… #2118

Merged
merged 1 commit into from
May 30, 2017

Conversation

srdo
Copy link
Contributor

@srdo srdo commented May 16, 2017

…uilder

The test was sleeping a bit and hoping that WaterMarkEventGenerator.run() had been run by the executor in that class before the test woke up. Sometimes that wasn't happening. Instead we're calling the method manually now, like the rest of the tests involving that class.

I also fixed the checkstyle violations in WaterMarkEventGenerator.

As far as I can tell, the lastWatermarkTs variable in WaterMarkEventGenerator should be volatile or an AtomicLong, since it is being written to in run() with the expectation that it can be seen by the thread calling track().

@@ -45,17 +46,25 @@
private final Map<GlobalStreamId, Long> streamToTs;
private final ScheduledExecutorService executorService;
private final int interval;
private final AtomicLong lastWaterMarkTs;
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be a volatile instead of AtomicLong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Why do you prefer volatile? (I'll be happy to change it, I'm just wondering if there's a drawback to using AtomicX)

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't make much difference except the extra overhead of the AtomicLong object and we don't require the additional atomic operations from AtomicLong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with volatile

@arunmahadevan
Copy link
Contributor

+1

@asfgit asfgit merged commit 7b7a8b3 into apache:master May 30, 2017
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.

3 participants