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

Fix incorrect test parallelWritesWithoutTransaction. #829

Merged
merged 4 commits into from
Oct 15, 2017

Conversation

artem-zinnatullin
Copy link
Member

Fixes #826.

TL;TR: test was incorrect, because default PutResolver uses short-term transaction thus StorIO has all rights to merge notifications, so sometimes we've seen flakiness due to notifications merge.

CI was freezing because we were awaiting for wrong amount of notifications without timeout, this PR adds timeout to all tests and RepeatRule to make sure our concurrent tests are good.

Thanks a lot @nikitin-da for his work in #827, those logs really helped to figure out what was wrong!

public void shouldReceiveOneNotificationWithAllAffectedTablesInTransactionWithMultipleThreads() throws InterruptedException {
final String table1 = "test_table1";
final String table2 = "test_table2";

final int numberOfThreads = 100;
final int numberOfThreads = 50;
Copy link
Member Author

Choose a reason for hiding this comment

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

100 might be a problem for Travis since it has limited amount of resources

@@ -239,14 +246,15 @@ public void run() {
// Steady!
startAllThreadsLock.countDown(); // Go!

assertThat(allThreadsFinishedLock.await(20, SECONDS)).isTrue();
assertThat(allThreadsFinishedLock.await(25, SECONDS)).isTrue();
Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't really matter, but since 30 seconds is now global limit for test duration, increasing this closer to 30 kinda makes sense :)

@@ -197,11 +203,12 @@ public void run() {
}

@Test
@Repeat(times = 20)
Copy link
Member Author

Choose a reason for hiding this comment

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

I've seen this test failed on #827 PR build, but I don't think I ever saw it fail before, so I just added @Repeat to make sure it's good, I've read it carefully and still think it's a good test as is :)

final int numberOfParallelWorkers = 50;
@Repeat(times = 20)
public void parallelPutWithoutGlobalTransaction() {
final int numberOfParallelPuts = 50;
Copy link
Member Author

Choose a reason for hiding this comment

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

Just rename :)

@artem-zinnatullin
Copy link
Member Author

Ah, didn't update take() properly

@codecov-io
Copy link

codecov-io commented Oct 15, 2017

Codecov Report

Merging #829 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #829      +/-   ##
==========================================
+ Coverage   97.39%   97.41%   +0.01%     
==========================================
  Files          89       91       +2     
  Lines        2692     2707      +15     
  Branches      302      305       +3     
==========================================
+ Hits         2622     2637      +15     
  Misses         38       38              
  Partials       32       32
Impacted Files Coverage Δ
...pushtorefresh/storio2/test/ConcurrencyTesting.java 100% <100%> (ø)
...ava/com/pushtorefresh/storio2/test/RepeatRule.java 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6af1d42...c4415ef. Read the comment docs.

Copy link
Collaborator

@geralt-encore geralt-encore left a comment

Choose a reason for hiding this comment

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

Good stuff!

@artem-zinnatullin
Copy link
Member Author

@nikitin-da I'm merging this to unblock other PRs, please feel free to comment, I'll open separate PR to fix your comments if needed!

@geralt-encore thanks for review!

@artem-zinnatullin artem-zinnatullin merged commit 9e53b45 into master Oct 15, 2017
@artem-zinnatullin artem-zinnatullin deleted the az/fix-parallelWritesWithoutTransaction branch October 15, 2017 09:28
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

public class RepeatRule implements TestRule {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@nikitin-da
Copy link
Collaborator

@artem-zinnatullin great work man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants