{"action":"created","comment":{"url":"https://api.github.com/repos/ravendb/ravendb/pulls/comments/91390245","pull_request_review_id":11898705,"id":91390245,"diff_hunk":"@@ -936,20 +936,26 @@ public bool DoIndexingWork(IndexingStatsScope stats, CancellationToken cancellat\n                         CommitStats commitStats;\n                         tx.InnerTransaction.LowLevelTransaction.RetrieveCommitStats(out commitStats);\n \n+                        tx.InnerTransaction.LowLevelTransaction.AfterCommitWhenNewReadTransactionsPrevented += () =>\n+                        {\n+                            if (writeOperation.IsValueCreated)\n+                            {\n+                                using (stats.For(IndexingOperation.Lucene.RecreateSearcher))\n+                                {\n+                                    // we need to recreate it after transaction commit to prevent it from seeing uncommitted changes\n+                                    // also we need this to be called when new read transaction are prevented in order to ensure\n+                                    // that queries won't get the searcher having 'old' state but see 'new' changes committed here\n+                                    // e.g. the old searcher could have a segment file in its in-memory state which has been removed in this tx\n+                                    IndexPersistence.RecreateSearcher(tx.InnerTransaction);","path":"src/Raven.Server/Documents/Indexes/Index.cs","position":14,"original_position":14,"commit_id":"2ad8b817a15c2a8f8b15d4ffd0237a6ae9b43f14","original_commit_id":"2ad8b817a15c2a8f8b15d4ffd0237a6ae9b43f14","user":{"login":"ayende","id":116915,"avatar_url":"https://avatars.githubusercontent.com/u/116915?v=3","gravatar_id":"","url":"https://api.github.com/users/ayende","html_url":"https://github.com/ayende","followers_url":"https://api.github.com/users/ayende/followers","following_url":"https://api.github.com/users/ayende/following{/other_user}","gists_url":"https://api.github.com/users/ayende/gists{/gist_id}","starred_url":"https://api.github.com/users/ayende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayende/subscriptions","organizations_url":"https://api.github.com/users/ayende/orgs","repos_url":"https://api.github.com/users/ayende/repos","events_url":"https://api.github.com/users/ayende/events{/privacy}","received_events_url":"https://api.github.com/users/ayende/received_events","type":"User","site_admin":false},"body":"Yes, that means that we'll have to stop all queries for the duration. And if we have a lot of queries, we'll have to wait for them to complete (and new queries are now waiting for _us_).","created_at":"2016-12-07T21:22:16Z","updated_at":"2016-12-07T21:22:16Z","html_url":"https://github.com/ravendb/ravendb/pull/1053#discussion_r91390245","pull_request_url":"https://api.github.com/repos/ravendb/ravendb/pulls/1053","_links":{"self":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/comments/91390245"},"html":{"href":"https://github.com/ravendb/ravendb/pull/1053#discussion_r91390245"},"pull_request":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/1053"}}},"pull_request":{"url":"https://api.github.com/repos/ravendb/ravendb/pulls/1053","id":96935290,"html_url":"https://github.com/ravendb/ravendb/pull/1053","diff_url":"https://github.com/ravendb/ravendb/pull/1053.diff","patch_url":"https://github.com/ravendb/ravendb/pull/1053.patch","issue_url":"https://api.github.com/repos/ravendb/ravendb/issues/1053","number":1053,"state":"open","locked":false,"title":"RavenDB-5733 Race condition fixes - indexing / querying","user":{"login":"arekpalinski","id":376551,"avatar_url":"https://avatars.githubusercontent.com/u/376551?v=3","gravatar_id":"","url":"https://api.github.com/users/arekpalinski","html_url":"https://github.com/arekpalinski","followers_url":"https://api.github.com/users/arekpalinski/followers","following_url":"https://api.github.com/users/arekpalinski/following{/other_user}","gists_url":"https://api.github.com/users/arekpalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/arekpalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekpalinski/subscriptions","organizations_url":"https://api.github.com/users/arekpalinski/orgs","repos_url":"https://api.github.com/users/arekpalinski/repos","events_url":"https://api.github.com/users/arekpalinski/events{/privacy}","received_events_url":"https://api.github.com/users/arekpalinski/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-07T14:39:08Z","updated_at":"2016-12-07T21:22:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f46770f632232fbb00b345c581a9022468e3c090","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ravendb/ravendb/pulls/1053/commits","review_comments_url":"https://api.github.com/repos/ravendb/ravendb/pulls/1053/comments","review_comment_url":"https://api.github.com/repos/ravendb/ravendb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ravendb/ravendb/issues/1053/comments","statuses_url":"https://api.github.com/repos/ravendb/ravendb/statuses/2ad8b817a15c2a8f8b15d4ffd0237a6ae9b43f14","head":{"label":"arekpalinski:RavenDB-5733","ref":"RavenDB-5733","sha":"2ad8b817a15c2a8f8b15d4ffd0237a6ae9b43f14","user":{"login":"arekpalinski","id":376551,"avatar_url":"https://avatars.githubusercontent.com/u/376551?v=3","gravatar_id":"","url":"https://api.github.com/users/arekpalinski","html_url":"https://github.com/arekpalinski","followers_url":"https://api.github.com/users/arekpalinski/followers","following_url":"https://api.github.com/users/arekpalinski/following{/other_user}","gists_url":"https://api.github.com/users/arekpalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/arekpalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekpalinski/subscriptions","organizations_url":"https://api.github.com/users/arekpalinski/orgs","repos_url":"https://api.github.com/users/arekpalinski/repos","events_url":"https://api.github.com/users/arekpalinski/events{/privacy}","received_events_url":"https://api.github.com/users/arekpalinski/received_events","type":"User","site_admin":false},"repo":{"id":6274017,"name":"ravendb","full_name":"arekpalinski/ravendb","owner":{"login":"arekpalinski","id":376551,"avatar_url":"https://avatars.githubusercontent.com/u/376551?v=3","gravatar_id":"","url":"https://api.github.com/users/arekpalinski","html_url":"https://github.com/arekpalinski","followers_url":"https://api.github.com/users/arekpalinski/followers","following_url":"https://api.github.com/users/arekpalinski/following{/other_user}","gists_url":"https://api.github.com/users/arekpalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/arekpalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekpalinski/subscriptions","organizations_url":"https://api.github.com/users/arekpalinski/orgs","repos_url":"https://api.github.com/users/arekpalinski/repos","events_url":"https://api.github.com/users/arekpalinski/events{/privacy}","received_events_url":"https://api.github.com/users/arekpalinski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arekpalinski/ravendb","description":"A linq enabled document database for .NET","fork":true,"url":"https://api.github.com/repos/arekpalinski/ravendb","forks_url":"https://api.github.com/repos/arekpalinski/ravendb/forks","keys_url":"https://api.github.com/repos/arekpalinski/ravendb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arekpalinski/ravendb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arekpalinski/ravendb/teams","hooks_url":"https://api.github.com/repos/arekpalinski/ravendb/hooks","issue_events_url":"https://api.github.com/repos/arekpalinski/ravendb/issues/events{/number}","events_url":"https://api.github.com/repos/arekpalinski/ravendb/events","assignees_url":"https://api.github.com/repos/arekpalinski/ravendb/assignees{/user}","branches_url":"https://api.github.com/repos/arekpalinski/ravendb/branches{/branch}","tags_url":"https://api.github.com/repos/arekpalinski/ravendb/tags","blobs_url":"https://api.github.com/repos/arekpalinski/ravendb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arekpalinski/ravendb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arekpalinski/ravendb/git/refs{/sha}","trees_url":"https://api.github.com/repos/arekpalinski/ravendb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arekpalinski/ravendb/statuses/{sha}","languages_url":"https://api.github.com/repos/arekpalinski/ravendb/languages","stargazers_url":"https://api.github.com/repos/arekpalinski/ravendb/stargazers","contributors_url":"https://api.github.com/repos/arekpalinski/ravendb/contributors","subscribers_url":"https://api.github.com/repos/arekpalinski/ravendb/subscribers","subscription_url":"https://api.github.com/repos/arekpalinski/ravendb/subscription","commits_url":"https://api.github.com/repos/arekpalinski/ravendb/commits{/sha}","git_commits_url":"https://api.github.com/repos/arekpalinski/ravendb/git/commits{/sha}","comments_url":"https://api.github.com/repos/arekpalinski/ravendb/comments{/number}","issue_comment_url":"https://api.github.com/repos/arekpalinski/ravendb/issues/comments{/number}","contents_url":"https://api.github.com/repos/arekpalinski/ravendb/contents/{+path}","compare_url":"https://api.github.com/repos/arekpalinski/ravendb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arekpalinski/ravendb/merges","archive_url":"https://api.github.com/repos/arekpalinski/ravendb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arekpalinski/ravendb/downloads","issues_url":"https://api.github.com/repos/arekpalinski/ravendb/issues{/number}","pulls_url":"https://api.github.com/repos/arekpalinski/ravendb/pulls{/number}","milestones_url":"https://api.github.com/repos/arekpalinski/ravendb/milestones{/number}","notifications_url":"https://api.github.com/repos/arekpalinski/ravendb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arekpalinski/ravendb/labels{/name}","releases_url":"https://api.github.com/repos/arekpalinski/ravendb/releases{/id}","deployments_url":"https://api.github.com/repos/arekpalinski/ravendb/deployments","created_at":"2012-10-18T06:22:25Z","updated_at":"2015-02-03T07:07:37Z","pushed_at":"2016-12-07T14:31:19Z","git_url":"git://github.com/arekpalinski/ravendb.git","ssh_url":"git@github.com:arekpalinski/ravendb.git","clone_url":"https://github.com/arekpalinski/ravendb.git","svn_url":"https://github.com/arekpalinski/ravendb","homepage":"http://ayende.com/Blog/","size":376739,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"v3.5"}},"base":{"label":"ravendb:v4.0","ref":"v4.0","sha":"298540cdd88b69ef0bb7b57d379e30b3e4927959","user":{"login":"ravendb","id":213792,"avatar_url":"https://avatars.githubusercontent.com/u/213792?v=3","gravatar_id":"","url":"https://api.github.com/users/ravendb","html_url":"https://github.com/ravendb","followers_url":"https://api.github.com/users/ravendb/followers","following_url":"https://api.github.com/users/ravendb/following{/other_user}","gists_url":"https://api.github.com/users/ravendb/gists{/gist_id}","starred_url":"https://api.github.com/users/ravendb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravendb/subscriptions","organizations_url":"https://api.github.com/users/ravendb/orgs","repos_url":"https://api.github.com/users/ravendb/repos","events_url":"https://api.github.com/users/ravendb/events{/privacy}","received_events_url":"https://api.github.com/users/ravendb/received_events","type":"Organization","site_admin":false},"repo":{"id":542714,"name":"ravendb","full_name":"ravendb/ravendb","owner":{"login":"ravendb","id":213792,"avatar_url":"https://avatars.githubusercontent.com/u/213792?v=3","gravatar_id":"","url":"https://api.github.com/users/ravendb","html_url":"https://github.com/ravendb","followers_url":"https://api.github.com/users/ravendb/followers","following_url":"https://api.github.com/users/ravendb/following{/other_user}","gists_url":"https://api.github.com/users/ravendb/gists{/gist_id}","starred_url":"https://api.github.com/users/ravendb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravendb/subscriptions","organizations_url":"https://api.github.com/users/ravendb/orgs","repos_url":"https://api.github.com/users/ravendb/repos","events_url":"https://api.github.com/users/ravendb/events{/privacy}","received_events_url":"https://api.github.com/users/ravendb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ravendb/ravendb","description":"A linq enabled document database for .NET","fork":false,"url":"https://api.github.com/repos/ravendb/ravendb","forks_url":"https://api.github.com/repos/ravendb/ravendb/forks","keys_url":"https://api.github.com/repos/ravendb/ravendb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ravendb/ravendb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ravendb/ravendb/teams","hooks_url":"https://api.github.com/repos/ravendb/ravendb/hooks","issue_events_url":"https://api.github.com/repos/ravendb/ravendb/issues/events{/number}","events_url":"https://api.github.com/repos/ravendb/ravendb/events","assignees_url":"https://api.github.com/repos/ravendb/ravendb/assignees{/user}","branches_url":"https://api.github.com/repos/ravendb/ravendb/branches{/branch}","tags_url":"https://api.github.com/repos/ravendb/ravendb/tags","blobs_url":"https://api.github.com/repos/ravendb/ravendb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ravendb/ravendb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ravendb/ravendb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ravendb/ravendb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ravendb/ravendb/statuses/{sha}","languages_url":"https://api.github.com/repos/ravendb/ravendb/languages","stargazers_url":"https://api.github.com/repos/ravendb/ravendb/stargazers","contributors_url":"https://api.github.com/repos/ravendb/ravendb/contributors","subscribers_url":"https://api.github.com/repos/ravendb/ravendb/subscribers","subscription_url":"https://api.github.com/repos/ravendb/ravendb/subscription","commits_url":"https://api.github.com/repos/ravendb/ravendb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ravendb/ravendb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ravendb/ravendb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ravendb/ravendb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ravendb/ravendb/contents/{+path}","compare_url":"https://api.github.com/repos/ravendb/ravendb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ravendb/ravendb/merges","archive_url":"https://api.github.com/repos/ravendb/ravendb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ravendb/ravendb/downloads","issues_url":"https://api.github.com/repos/ravendb/ravendb/issues{/number}","pulls_url":"https://api.github.com/repos/ravendb/ravendb/pulls{/number}","milestones_url":"https://api.github.com/repos/ravendb/ravendb/milestones{/number}","notifications_url":"https://api.github.com/repos/ravendb/ravendb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ravendb/ravendb/labels{/name}","releases_url":"https://api.github.com/repos/ravendb/ravendb/releases{/id}","deployments_url":"https://api.github.com/repos/ravendb/ravendb/deployments","created_at":"2010-03-02T11:05:30Z","updated_at":"2016-12-07T19:09:46Z","pushed_at":"2016-12-07T20:49:22Z","git_url":"git://github.com/ravendb/ravendb.git","ssh_url":"git@github.com:ravendb/ravendb.git","clone_url":"https://github.com/ravendb/ravendb.git","svn_url":"https://github.com/ravendb/ravendb","homepage":"http://ravendb.net","size":411720,"stargazers_count":1597,"watchers_count":1597,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":640,"mirror_url":null,"open_issues_count":5,"forks":640,"open_issues":5,"watchers":1597,"default_branch":"v3.5"}},"_links":{"self":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/1053"},"html":{"href":"https://github.com/ravendb/ravendb/pull/1053"},"issue":{"href":"https://api.github.com/repos/ravendb/ravendb/issues/1053"},"comments":{"href":"https://api.github.com/repos/ravendb/ravendb/issues/1053/comments"},"review_comments":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/1053/comments"},"review_comment":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ravendb/ravendb/pulls/1053/commits"},"statuses":{"href":"https://api.github.com/repos/ravendb/ravendb/statuses/2ad8b817a15c2a8f8b15d4ffd0237a6ae9b43f14"}}}}
{"actor":{"display_login":"ayende"}}