GitHub PullRequestReviewCommentEvent at 2014-10-17 23:51:28
Repository: hibernate-search
Actor: Sanne
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/comments/19049488","id":19049488,"diff_hunk":"@@ -0,0 +1,117 @@\n+/*\n+ * Hibernate Search, full-text search for your domain model\n+ *\n+ * License: GNU Lesser General Public License (LGPL), version 2.1 or later\n+ * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.\n+ */\n+package org.hibernate.search.test.backend.lucene;\n+\n+import org.hibernate.search.annotations.DocumentId;\n+import org.hibernate.search.annotations.Field;\n+import org.hibernate.search.annotations.Indexed;\n+import org.hibernate.search.backend.impl.CommitPolicy;\n+import org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl;\n+import org.hibernate.search.backend.impl.lucene.SharedIndexCommitPolicy;\n+import org.hibernate.search.backend.impl.lucene.PerChangeSetCommitPolicy;\n+import org.hibernate.search.backend.impl.lucene.ScheduledCommitPolicy;\n+import org.hibernate.search.backend.spi.Work;\n+import org.hibernate.search.backend.spi.WorkType;\n+import org.hibernate.search.testsupport.junit.SearchFactoryHolder;\n+import org.hibernate.search.testsupport.setup.TransactionContextForTest;\n+import org.junit.Rule;\n+import org.junit.Test;\n+\n+import java.util.concurrent.ScheduledThreadPoolExecutor;\n+\n+import static org.junit.Assert.assertTrue;\n+\n+/**\n+ * Tests for commit policies\n+ *\n+ * @author gustavonalle\n+ */\n+public class ScheduledCommitPolicyTest {\n+\n+\tprivate static final int NUMBER_ENTITIES = 200000;\n+\n+\t@Rule\n+\tpublic SearchFactoryHolder sfSyncExclusiveIndex = new SearchFactoryHolder( Quote.class )\n+\t\t\t.withProperty( \"hibernate.search.default.refresh_interval\", \"100\" )\n+\t\t\t.withProperty( \"hibernate.search.default.exclusive_index_use\", \"true\" );\n+\n+\t@Rule\n+\tpublic SearchFactoryHolder sfSyncSharedIndex = new SearchFactoryHolder( Quote.class )\n+\t\t\t.withProperty( \"hibernate.search.default.refresh_interval\", \"100\" )\n+\t\t\t.withProperty( \"hibernate.search.default.exclusive_index_use\", \"false\" );\n+\n+\t@Rule\n+\tpublic SearchFactoryHolder sfAsyncSharedIndex = new SearchFactoryHolder( Quote.class )\n+\t\t\t.withProperty( \"hibernate.search.default.refresh_interval\", \"100\" )\n+\t\t\t.withProperty( \"hibernate.search.default.default.worker.execution\", \"async\" )\n+\t\t\t.withProperty( \"hibernate.search.default.exclusive_index_use\", \"false\" );\n+\n+\t@Rule\n+\tpublic SearchFactoryHolder sfAsyncExclusiveIndex = new SearchFactoryHolder( Quote.class )\n+\t\t\t.withProperty( \"hibernate.search.default.refresh_interval\", \"100\" )\n+\t\t\t.withProperty( \"hibernate.search.default.worker.execution\", \"async\" )\n+\t\t\t.withProperty( \"hibernate.search.default.exclusive_index_use\", \"true\" );\n+\n+\n+\t@Test\n+\tpublic void testConfiguredCommitPolicy() throws Exception {\n+\t\tassertCommitPolicyUsed( sfSyncExclusiveIndex, PerChangeSetCommitPolicy.class );\n+\t\tassertCommitPolicyUsed( sfSyncSharedIndex, SharedIndexCommitPolicy.class );\n+\t\tassertCommitPolicyUsed( sfAsyncSharedIndex, SharedIndexCommitPolicy.class );\n+\t\tassertCommitPolicyUsed( sfAsyncExclusiveIndex, ScheduledCommitPolicy.class );","path":"engine/src/test/java/org/hibernate/search/test/backend/lucene/ScheduledCommitPolicyTest.java","position":65,"original_position":65,"commit_id":"fe779003c146df2fae4be2f781422e9ab0cf0cc5","original_commit_id":"fe779003c146df2fae4be2f781422e9ab0cf0cc5","user":{"login":"Sanne","id":42573,"avatar_url":"https://avatars.githubusercontent.com/u/42573?v=2","gravatar_id":"","url":"https://api.github.com/users/Sanne","html_url":"https://github.com/Sanne","followers_url":"https://api.github.com/users/Sanne/followers","following_url":"https://api.github.com/users/Sanne/following{/other_user}","gists_url":"https://api.github.com/users/Sanne/gists{/gist_id}","starred_url":"https://api.github.com/users/Sanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sanne/subscriptions","organizations_url":"https://api.github.com/users/Sanne/orgs","repos_url":"https://api.github.com/users/Sanne/repos","events_url":"https://api.github.com/users/Sanne/events{/privacy}","received_events_url":"https://api.github.com/users/Sanne/received_events","type":"User","site_admin":false},"body":"Good choices. I wish we could warn about properties which will get ignored, but we can't with the current property structure: something to keep in mind for future improvements.","created_at":"2014-10-17T23:51:28Z","updated_at":"2014-10-17T23:51:28Z","html_url":"https://github.com/hibernate/hibernate-search/pull/681#discussion_r19049488","pull_request_url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681","_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/comments/19049488"},"html":{"href":"https://github.com/hibernate/hibernate-search/pull/681#discussion_r19049488"},"pull_request":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681"}}},"pull_request":{"url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681","id":22894344,"html_url":"https://github.com/hibernate/hibernate-search/pull/681","diff_url":"https://github.com/hibernate/hibernate-search/pull/681.diff","patch_url":"https://github.com/hibernate/hibernate-search/pull/681.patch","issue_url":"https://api.github.com/repos/hibernate/hibernate-search/issues/681","number":681,"state":"open","locked":false,"title":"HSEARCH-1693 Time based commit for async indexing","user":{"login":"gustavonalle","id":440989,"avatar_url":"https://avatars.githubusercontent.com/u/440989?v=2","gravatar_id":"","url":"https://api.github.com/users/gustavonalle","html_url":"https://github.com/gustavonalle","followers_url":"https://api.github.com/users/gustavonalle/followers","following_url":"https://api.github.com/users/gustavonalle/following{/other_user}","gists_url":"https://api.github.com/users/gustavonalle/gists{/gist_id}","starred_url":"https://api.github.com/users/gustavonalle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gustavonalle/subscriptions","organizations_url":"https://api.github.com/users/gustavonalle/orgs","repos_url":"https://api.github.com/users/gustavonalle/repos","events_url":"https://api.github.com/users/gustavonalle/events{/privacy}","received_events_url":"https://api.github.com/users/gustavonalle/received_events","type":"User","site_admin":false},"body":"https://hibernate.atlassian.net/browse/HSEARCH-1693\r\n\r\nIntroduced a new abstraction called ```CommitPolicy``` which is responsible for commit handling for the async index scenario (and potentially for the sync case). One of the implementations is ```ScheduledCommitPolicy``` that commits at configured intervals, governed by the property ```\"hibernate.search.default.refresh_interval\"```\r\n\r\nSome perf results for infinispan [1]\r\n\r\n10 Threads each putting 100k entities into a cache (total 1M entities)\r\n\r\nFirst three scenarios are what we have currently, when no indexing is enabled (thus no hibernate search involved) and for the current async indexing (worker.execution = async). Last couple of scenarios are with time based commits proposed by this PR.\r\nTests don't wait until the background indexing finishes, but rather counts the number of indexed entities after the cache.put ends\r\n\r\nScenario  |  load time T (seconds) | docs indexed after T \r\n----- | ----- | -----\r\nIndexing disabled | 50 | 0\r\nAsync Indexing  | 12092 | 549485\r\nAsync Indexing (queueSize = 10000) | 11576 | 542795\r\n__Async Commit Interval 500ms__ |  81 | 999699\r\n__Async Commit Interval 1000ms__ |  75 | 999991\r\n\r\n[1] https://github.com/infinispan/infinispan/blob/master/query/src/test/java/org/infinispan/query/backend/MergeTest.java\r\n\r\n@Sanne please check if the idea of reducing commits for the sync case is compatible with this abstraction\r\n\r\nIs property name ```\"hibernate.search.default.refresh_interval\"``` adequate?  ","created_at":"2014-10-16T23:24:18Z","updated_at":"2014-10-17T23:51:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffbe87455f82acd924839ea15d7015b19dee547d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681/commits","review_comments_url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681/comments","review_comment_url":"https://api.github.com/repos/hibernate/hibernate-search/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hibernate/hibernate-search/issues/681/comments","statuses_url":"https://api.github.com/repos/hibernate/hibernate-search/statuses/fe779003c146df2fae4be2f781422e9ab0cf0cc5","head":{"label":"gustavonalle:HSEARCH-1693","ref":"HSEARCH-1693","sha":"fe779003c146df2fae4be2f781422e9ab0cf0cc5","user":{"login":"gustavonalle","id":440989,"avatar_url":"https://avatars.githubusercontent.com/u/440989?v=2","gravatar_id":"","url":"https://api.github.com/users/gustavonalle","html_url":"https://github.com/gustavonalle","followers_url":"https://api.github.com/users/gustavonalle/followers","following_url":"https://api.github.com/users/gustavonalle/following{/other_user}","gists_url":"https://api.github.com/users/gustavonalle/gists{/gist_id}","starred_url":"https://api.github.com/users/gustavonalle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gustavonalle/subscriptions","organizations_url":"https://api.github.com/users/gustavonalle/orgs","repos_url":"https://api.github.com/users/gustavonalle/repos","events_url":"https://api.github.com/users/gustavonalle/events{/privacy}","received_events_url":"https://api.github.com/users/gustavonalle/received_events","type":"User","site_admin":false},"repo":{"id":990384,"name":"hibernate-search","full_name":"gustavonalle/hibernate-search","owner":{"login":"gustavonalle","id":440989,"avatar_url":"https://avatars.githubusercontent.com/u/440989?v=2","gravatar_id":"","url":"https://api.github.com/users/gustavonalle","html_url":"https://github.com/gustavonalle","followers_url":"https://api.github.com/users/gustavonalle/followers","following_url":"https://api.github.com/users/gustavonalle/following{/other_user}","gists_url":"https://api.github.com/users/gustavonalle/gists{/gist_id}","starred_url":"https://api.github.com/users/gustavonalle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gustavonalle/subscriptions","organizations_url":"https://api.github.com/users/gustavonalle/orgs","repos_url":"https://api.github.com/users/gustavonalle/repos","events_url":"https://api.github.com/users/gustavonalle/events{/privacy}","received_events_url":"https://api.github.com/users/gustavonalle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gustavonalle/hibernate-search","description":"Hibernate Search: full-text search for domain model","fork":true,"url":"https://api.github.com/repos/gustavonalle/hibernate-search","forks_url":"https://api.github.com/repos/gustavonalle/hibernate-search/forks","keys_url":"https://api.github.com/repos/gustavonalle/hibernate-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gustavonalle/hibernate-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gustavonalle/hibernate-search/teams","hooks_url":"https://api.github.com/repos/gustavonalle/hibernate-search/hooks","issue_events_url":"https://api.github.com/repos/gustavonalle/hibernate-search/issues/events{/number}","events_url":"https://api.github.com/repos/gustavonalle/hibernate-search/events","assignees_url":"https://api.github.com/repos/gustavonalle/hibernate-search/assignees{/user}","branches_url":"https://api.github.com/repos/gustavonalle/hibernate-search/branches{/branch}","tags_url":"https://api.github.com/repos/gustavonalle/hibernate-search/tags","blobs_url":"https://api.github.com/repos/gustavonalle/hibernate-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gustavonalle/hibernate-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gustavonalle/hibernate-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/gustavonalle/hibernate-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gustavonalle/hibernate-search/statuses/{sha}","languages_url":"https://api.github.com/repos/gustavonalle/hibernate-search/languages","stargazers_url":"https://api.github.com/repos/gustavonalle/hibernate-search/stargazers","contributors_url":"https://api.github.com/repos/gustavonalle/hibernate-search/contributors","subscribers_url":"https://api.github.com/repos/gustavonalle/hibernate-search/subscribers","subscription_url":"https://api.github.com/repos/gustavonalle/hibernate-search/subscription","commits_url":"https://api.github.com/repos/gustavonalle/hibernate-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/gustavonalle/hibernate-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/gustavonalle/hibernate-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/gustavonalle/hibernate-search/issues/comments/{number}","contents_url":"https://api.github.com/repos/gustavonalle/hibernate-search/contents/{+path}","compare_url":"https://api.github.com/repos/gustavonalle/hibernate-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gustavonalle/hibernate-search/merges","archive_url":"https://api.github.com/repos/gustavonalle/hibernate-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gustavonalle/hibernate-search/downloads","issues_url":"https://api.github.com/repos/gustavonalle/hibernate-search/issues{/number}","pulls_url":"https://api.github.com/repos/gustavonalle/hibernate-search/pulls{/number}","milestones_url":"https://api.github.com/repos/gustavonalle/hibernate-search/milestones{/number}","notifications_url":"https://api.github.com/repos/gustavonalle/hibernate-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gustavonalle/hibernate-search/labels{/name}","releases_url":"https://api.github.com/repos/gustavonalle/hibernate-search/releases{/id}","created_at":"2010-10-15T16:35:41Z","updated_at":"2014-09-05T09:27:53Z","pushed_at":"2014-10-16T23:16:29Z","git_url":"git://github.com/gustavonalle/hibernate-search.git","ssh_url":"git@github.com:gustavonalle/hibernate-search.git","clone_url":"https://github.com/gustavonalle/hibernate-search.git","svn_url":"https://github.com/gustavonalle/hibernate-search","homepage":"http://search.hibernate.org","size":39417,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hibernate:master","ref":"master","sha":"d0f980312f0afae9ce017649f9bc0108b3a652b2","user":{"login":"hibernate","id":348262,"avatar_url":"https://avatars.githubusercontent.com/u/348262?v=2","gravatar_id":"","url":"https://api.github.com/users/hibernate","html_url":"https://github.com/hibernate","followers_url":"https://api.github.com/users/hibernate/followers","following_url":"https://api.github.com/users/hibernate/following{/other_user}","gists_url":"https://api.github.com/users/hibernate/gists{/gist_id}","starred_url":"https://api.github.com/users/hibernate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hibernate/subscriptions","organizations_url":"https://api.github.com/users/hibernate/orgs","repos_url":"https://api.github.com/users/hibernate/repos","events_url":"https://api.github.com/users/hibernate/events{/privacy}","received_events_url":"https://api.github.com/users/hibernate/received_events","type":"Organization","site_admin":false},"repo":{"id":990281,"name":"hibernate-search","full_name":"hibernate/hibernate-search","owner":{"login":"hibernate","id":348262,"avatar_url":"https://avatars.githubusercontent.com/u/348262?v=2","gravatar_id":"","url":"https://api.github.com/users/hibernate","html_url":"https://github.com/hibernate","followers_url":"https://api.github.com/users/hibernate/followers","following_url":"https://api.github.com/users/hibernate/following{/other_user}","gists_url":"https://api.github.com/users/hibernate/gists{/gist_id}","starred_url":"https://api.github.com/users/hibernate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hibernate/subscriptions","organizations_url":"https://api.github.com/users/hibernate/orgs","repos_url":"https://api.github.com/users/hibernate/repos","events_url":"https://api.github.com/users/hibernate/events{/privacy}","received_events_url":"https://api.github.com/users/hibernate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hibernate/hibernate-search","description":"Hibernate Search: full-text search for domain model","fork":false,"url":"https://api.github.com/repos/hibernate/hibernate-search","forks_url":"https://api.github.com/repos/hibernate/hibernate-search/forks","keys_url":"https://api.github.com/repos/hibernate/hibernate-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hibernate/hibernate-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hibernate/hibernate-search/teams","hooks_url":"https://api.github.com/repos/hibernate/hibernate-search/hooks","issue_events_url":"https://api.github.com/repos/hibernate/hibernate-search/issues/events{/number}","events_url":"https://api.github.com/repos/hibernate/hibernate-search/events","assignees_url":"https://api.github.com/repos/hibernate/hibernate-search/assignees{/user}","branches_url":"https://api.github.com/repos/hibernate/hibernate-search/branches{/branch}","tags_url":"https://api.github.com/repos/hibernate/hibernate-search/tags","blobs_url":"https://api.github.com/repos/hibernate/hibernate-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hibernate/hibernate-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hibernate/hibernate-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/hibernate/hibernate-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hibernate/hibernate-search/statuses/{sha}","languages_url":"https://api.github.com/repos/hibernate/hibernate-search/languages","stargazers_url":"https://api.github.com/repos/hibernate/hibernate-search/stargazers","contributors_url":"https://api.github.com/repos/hibernate/hibernate-search/contributors","subscribers_url":"https://api.github.com/repos/hibernate/hibernate-search/subscribers","subscription_url":"https://api.github.com/repos/hibernate/hibernate-search/subscription","commits_url":"https://api.github.com/repos/hibernate/hibernate-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/hibernate/hibernate-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/hibernate/hibernate-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/hibernate/hibernate-search/issues/comments/{number}","contents_url":"https://api.github.com/repos/hibernate/hibernate-search/contents/{+path}","compare_url":"https://api.github.com/repos/hibernate/hibernate-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hibernate/hibernate-search/merges","archive_url":"https://api.github.com/repos/hibernate/hibernate-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hibernate/hibernate-search/downloads","issues_url":"https://api.github.com/repos/hibernate/hibernate-search/issues{/number}","pulls_url":"https://api.github.com/repos/hibernate/hibernate-search/pulls{/number}","milestones_url":"https://api.github.com/repos/hibernate/hibernate-search/milestones{/number}","notifications_url":"https://api.github.com/repos/hibernate/hibernate-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hibernate/hibernate-search/labels{/name}","releases_url":"https://api.github.com/repos/hibernate/hibernate-search/releases{/id}","created_at":"2010-10-15T15:55:09Z","updated_at":"2014-10-13T05:20:09Z","pushed_at":"2014-10-16T17:52:00Z","git_url":"git://github.com/hibernate/hibernate-search.git","ssh_url":"git@github.com:hibernate/hibernate-search.git","clone_url":"https://github.com/hibernate/hibernate-search.git","svn_url":"https://github.com/hibernate/hibernate-search","homepage":"http://search.hibernate.org","size":61153,"stargazers_count":130,"watchers_count":130,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":3,"forks":92,"open_issues":3,"watchers":130,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681"},"html":{"href":"https://github.com/hibernate/hibernate-search/pull/681"},"issue":{"href":"https://api.github.com/repos/hibernate/hibernate-search/issues/681"},"comments":{"href":"https://api.github.com/repos/hibernate/hibernate-search/issues/681/comments"},"review_comments":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681/comments"},"review_comment":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hibernate/hibernate-search/pulls/681/commits"},"statuses":{"href":"https://api.github.com/repos/hibernate/hibernate-search/statuses/fe779003c146df2fae4be2f781422e9ab0cf0cc5"}}}}