{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/pandora/pulls/comments/36548576","id":36548576,"diff_hunk":"@@ -524,6 +529,93 @@ public void createThreadOnTestForumTestRollback() throws Exception {\n     assertThat(afterPostCount, equalTo(beforePostCount));\n   }\n \n+  @Test\n+  public void createPostsInParallelTestCounts() throws Exception {\n+    final int threadCount = 10;\n+    final int postsPerThread = 3;\n+    final String postBody = \"Adding new post for createPostsInParallelTestCounts\";\n+\n+    Forum forumBefore = getForum(SITE_ID_GLEE, FORUM_ID_GLEE);\n+    ForumThread threadBefore = getThreadById(SITE_ID_GLEE, THREAD_ID_GLEE, ResponseGroup.SMALL);\n+\n+    Thread[] threads = new Thread[threadCount];\n+    for (int i = 0 ; i < threadCount ; i++) {\n+      threads[i] = new Thread(() -> {\n+        for (int j = 0 ; j < postsPerThread ; j++) {\n+          try {\n+            PostHelper.performCreatePost(\n+                RULE, client, SITE_ID_GLEE, THREAD_ID_GLEE,\n+                TEST_USER_ID, postBody,\n+                new Integer[]{Response.Status.CREATED.getStatusCode()});\n+          } catch (Exception e) {\n+            System.err.println(\n+                String.format(\"createPostsInParallelTestCounts: perform create post throws \"\n+                    + \"%s: %s\", e.getClass().getSimpleName(), e.getMessage()));\n+          }\n+        }\n+      });\n+    }\n+    Arrays.stream(threads).forEach(Thread::start);\n+    Arrays.stream(threads).forEach(t -> {\n+      try {\n+        t.join();\n+      } catch (InterruptedException ie) {\n+        System.err.println(\"createPostsInParallelTestCounts: join throws InterruptedException\");\n+      }\n+    });\n+\n+    // The next calls may be to a replicated DB, so delay a bit to ensure the content was copied\n+    Thread.sleep(2000);\n+\n+    Forum forumAfter = getForum(SITE_ID_GLEE, FORUM_ID_GLEE);\n+    ForumThread threadAfter = getThreadById(SITE_ID_GLEE, THREAD_ID_GLEE, ResponseGroup.SMALL);\n+\n+    assertThat(forumAfter.getPostCount(),\n+        equalTo(forumBefore.getPostCount() + postsPerThread * threadCount));\n+    assertThat(threadAfter.getPostCount(),\n+        equalTo(threadBefore.getPostCount() + postsPerThread * threadCount));\n+  }\n+\n+  @Test\n+  public void createThreadsInParallelTestCounts() throws Exception {","path":"service/discussion/src/test/java/com/wikia/discussionservice/resources/ThreadResourceIntegrationTest.java","position":126,"original_position":126,"commit_id":"fe442e7db1e1168c29775988f6e4d26f22a53fc0","original_commit_id":"fe442e7db1e1168c29775988f6e4d26f22a53fc0","user":{"login":"WikiaTech","id":13279985,"avatar_url":"https://avatars.githubusercontent.com/u/13279985?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiaTech","html_url":"https://github.com/WikiaTech","followers_url":"https://api.github.com/users/WikiaTech/followers","following_url":"https://api.github.com/users/WikiaTech/following{/other_user}","gists_url":"https://api.github.com/users/WikiaTech/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiaTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiaTech/subscriptions","organizations_url":"https://api.github.com/users/WikiaTech/orgs","repos_url":"https://api.github.com/users/WikiaTech/repos","events_url":"https://api.github.com/users/WikiaTech/events{/privacy}","received_events_url":"https://api.github.com/users/WikiaTech/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Define and throw a dedicated exception instead of using a generic one. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://nemo.sonarqube.org/coding_rules#rule_key=squid%3AS00112)\n","created_at":"2015-08-07T18:43:21Z","updated_at":"2015-08-07T18:43:21Z","html_url":"https://github.com/Wikia/pandora/pull/383#discussion_r36548576","pull_request_url":"https://api.github.com/repos/Wikia/pandora/pulls/383","_links":{"self":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/comments/36548576"},"html":{"href":"https://github.com/Wikia/pandora/pull/383#discussion_r36548576"},"pull_request":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/pandora/pulls/383","id":41921128,"html_url":"https://github.com/Wikia/pandora/pull/383","diff_url":"https://github.com/Wikia/pandora/pull/383.diff","patch_url":"https://github.com/Wikia/pandora/pull/383.patch","issue_url":"https://api.github.com/repos/Wikia/pandora/issues/383","number":383,"state":"open","locked":false,"title":"[DIS] DIS-116 Add concurrency tests to ensure concurrent transactions behave as expected","user":{"login":"jimmordino","id":824016,"avatar_url":"https://avatars.githubusercontent.com/u/824016?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmordino","html_url":"https://github.com/jimmordino","followers_url":"https://api.github.com/users/jimmordino/followers","following_url":"https://api.github.com/users/jimmordino/following{/other_user}","gists_url":"https://api.github.com/users/jimmordino/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmordino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmordino/subscriptions","organizations_url":"https://api.github.com/users/jimmordino/orgs","repos_url":"https://api.github.com/users/jimmordino/repos","events_url":"https://api.github.com/users/jimmordino/events{/privacy}","received_events_url":"https://api.github.com/users/jimmordino/received_events","type":"User","site_admin":false},"body":"Added tests for concurrent transactions for our 3 main \"write\" operations for MVP, create thread, create post, and upvote.\r\n- [x] schema changes to support shared sequence without deadlocking\r\n- [x] updated test db dump with schema changes\r\n- [x] updated all shared dbs with schema changes\r\n- [x] added concurrency tests (with Armon's help)\r\n- [x] modified helpers and existing tests to facilitate and peacefully coexist with new tests\r\n\r\n@armonr, @jogura","created_at":"2015-08-07T18:42:49Z","updated_at":"2015-08-07T18:43:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ddf13a9ecb8c2b690f8463720847fe706cf6542","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/pandora/pulls/383/commits","review_comments_url":"https://api.github.com/repos/Wikia/pandora/pulls/383/comments","review_comment_url":"https://api.github.com/repos/Wikia/pandora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/pandora/issues/383/comments","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/fe442e7db1e1168c29775988f6e4d26f22a53fc0","head":{"label":"Wikia:DIS-116","ref":"DIS-116","sha":"fe442e7db1e1168c29775988f6e4d26f22a53fc0","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":26663749,"name":"pandora","full_name":"Wikia/pandora","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/pandora","description":"API Service","fork":false,"url":"https://api.github.com/repos/Wikia/pandora","forks_url":"https://api.github.com/repos/Wikia/pandora/forks","keys_url":"https://api.github.com/repos/Wikia/pandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/pandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/pandora/teams","hooks_url":"https://api.github.com/repos/Wikia/pandora/hooks","issue_events_url":"https://api.github.com/repos/Wikia/pandora/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/pandora/events","assignees_url":"https://api.github.com/repos/Wikia/pandora/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/pandora/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/pandora/tags","blobs_url":"https://api.github.com/repos/Wikia/pandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/pandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/pandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/pandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/pandora/languages","stargazers_url":"https://api.github.com/repos/Wikia/pandora/stargazers","contributors_url":"https://api.github.com/repos/Wikia/pandora/contributors","subscribers_url":"https://api.github.com/repos/Wikia/pandora/subscribers","subscription_url":"https://api.github.com/repos/Wikia/pandora/subscription","commits_url":"https://api.github.com/repos/Wikia/pandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/pandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/pandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/pandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/pandora/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/pandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/pandora/merges","archive_url":"https://api.github.com/repos/Wikia/pandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/pandora/downloads","issues_url":"https://api.github.com/repos/Wikia/pandora/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/pandora/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/pandora/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/pandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/pandora/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/pandora/releases{/id}","created_at":"2014-11-15T00:29:06Z","updated_at":"2015-06-16T15:38:56Z","pushed_at":"2015-08-07T18:42:49Z","git_url":"git://github.com/Wikia/pandora.git","ssh_url":"git@github.com:Wikia/pandora.git","clone_url":"https://github.com/Wikia/pandora.git","svn_url":"https://github.com/Wikia/pandora","homepage":null,"size":18437,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":3,"default_branch":"master"}},"base":{"label":"Wikia:dis-master","ref":"dis-master","sha":"235fca6b9ee1c5ea5cf96195d0e1e7e32bda86ab","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":26663749,"name":"pandora","full_name":"Wikia/pandora","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/pandora","description":"API Service","fork":false,"url":"https://api.github.com/repos/Wikia/pandora","forks_url":"https://api.github.com/repos/Wikia/pandora/forks","keys_url":"https://api.github.com/repos/Wikia/pandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/pandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/pandora/teams","hooks_url":"https://api.github.com/repos/Wikia/pandora/hooks","issue_events_url":"https://api.github.com/repos/Wikia/pandora/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/pandora/events","assignees_url":"https://api.github.com/repos/Wikia/pandora/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/pandora/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/pandora/tags","blobs_url":"https://api.github.com/repos/Wikia/pandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/pandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/pandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/pandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/pandora/languages","stargazers_url":"https://api.github.com/repos/Wikia/pandora/stargazers","contributors_url":"https://api.github.com/repos/Wikia/pandora/contributors","subscribers_url":"https://api.github.com/repos/Wikia/pandora/subscribers","subscription_url":"https://api.github.com/repos/Wikia/pandora/subscription","commits_url":"https://api.github.com/repos/Wikia/pandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/pandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/pandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/pandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/pandora/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/pandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/pandora/merges","archive_url":"https://api.github.com/repos/Wikia/pandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/pandora/downloads","issues_url":"https://api.github.com/repos/Wikia/pandora/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/pandora/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/pandora/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/pandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/pandora/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/pandora/releases{/id}","created_at":"2014-11-15T00:29:06Z","updated_at":"2015-06-16T15:38:56Z","pushed_at":"2015-08-07T18:42:49Z","git_url":"git://github.com/Wikia/pandora.git","ssh_url":"git@github.com:Wikia/pandora.git","clone_url":"https://github.com/Wikia/pandora.git","svn_url":"https://github.com/Wikia/pandora","homepage":null,"size":18437,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/383"},"html":{"href":"https://github.com/Wikia/pandora/pull/383"},"issue":{"href":"https://api.github.com/repos/Wikia/pandora/issues/383"},"comments":{"href":"https://api.github.com/repos/Wikia/pandora/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/pandora/statuses/fe442e7db1e1168c29775988f6e4d26f22a53fc0"}}}}