{"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/38409715","id":38409715,"diff_hunk":"@@ -19,32 +19,77 @@\n  */\n package org.neo4j.consistency.checking;\n \n+import org.neo4j.consistency.checking.cache.CacheAccess;\n+import org.neo4j.consistency.checking.cache.CacheAccess.Client;\n+import org.neo4j.consistency.checking.full.MultiPassStore;\n import org.neo4j.consistency.report.ConsistencyReport;\n+import org.neo4j.consistency.report.ConsistencyReport.RelationshipConsistencyReport;\n+import org.neo4j.consistency.statistics.Counts;\n import org.neo4j.consistency.store.DiffRecordAccess;\n+import org.neo4j.consistency.store.DirectRecordReference;\n import org.neo4j.consistency.store.RecordAccess;\n+import org.neo4j.consistency.store.RecordReference;\n import org.neo4j.kernel.impl.store.record.Record;\n import org.neo4j.kernel.impl.store.record.RelationshipRecord;\n import org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord;\n \n-class RelationshipRecordCheck\n-        extends PrimitiveRecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport>\n+public class RelationshipRecordCheck extends\n+        PrimitiveRecordCheck<RelationshipRecord,ConsistencyReport.RelationshipConsistencyReport>\n {\n-    RelationshipRecordCheck()\n+    public static final int CACHE_SLOT_SOURCE_OR_TARGET = 0;\n+    public static final int CACHE_SLOT_PREV_OR_NEXT = 1;\n+    public static final int CACHE_SLOT_RELATIONSHIP_ID = 2;\n+    public static final int CACHE_SLOT_REFERENCE = 3;\n+    public static final long SOURCE = 0;\n+    public static final long TARGET = -1;\n+    public static final long PREV = 0;\n+    public static final long NEXT = -1;\n+\n+    public RelationshipRecordCheck()\n     {\n-        super( RelationshipTypeField.RELATIONSHIP_TYPE,\n-               NodeField.SOURCE, RelationshipField.SOURCE_PREV, RelationshipField.SOURCE_NEXT,\n-               NodeField.TARGET, RelationshipField.TARGET_PREV, RelationshipField.TARGET_NEXT );\n+        super( true, RelationshipTypeField.RELATIONSHIP_TYPE, NodeField.SOURCE, RelationshipField.SOURCE_PREV,\n+                RelationshipField.SOURCE_NEXT, NodeField.TARGET, RelationshipField.TARGET_PREV,\n+                RelationshipField.TARGET_NEXT );\n     }\n \n-    private enum RelationshipTypeField implements\n-            RecordField<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport>,\n-            ComparativeRecordChecker<RelationshipRecord, RelationshipTypeTokenRecord, ConsistencyReport.RelationshipConsistencyReport>\n+    @SafeVarargs\n+    private RelationshipRecordCheck( boolean firstProperty,\n+            RecordField<RelationshipRecord,ConsistencyReport.RelationshipConsistencyReport>... fields )\n     {\n-        RELATIONSHIP_TYPE;\n+        super( firstProperty, fields );\n+    }\n+\n+    public static RelationshipRecordCheck RelationshipRecordCheckPass1( boolean firstProperty )\n+    {\n+        return new RelationshipRecordCheck( firstProperty, RelationshipTypeField.RELATIONSHIP_TYPE );\n+    }\n \n+    public static RelationshipRecordCheck RelationshipRecordCheckPass2( boolean firstProperty )\n+    {\n+        return new RelationshipRecordCheck( firstProperty, NodeField.SOURCE, NodeField.TARGET );\n+    }\n+\n+    public static RelationshipRecordCheck RelationshipRecordCheckSourceChain( boolean firstProperty )\n+    {\n+        return new RelationshipRecordCheck( firstProperty, RelationshipField.SOURCE_NEXT,\n+                RelationshipField.SOURCE_PREV, RelationshipField.TARGET_NEXT, RelationshipField.TARGET_PREV,\n+                RelationshipField.CACHE_VALUES );\n+    }\n+\n+    public static RelationshipRecordCheck RelationshipRecordCheckTargetChain( boolean firstProperty )\n+    {\n+        return new RelationshipRecordCheck( firstProperty, RelationshipField.TARGET_NEXT, RelationshipField.TARGET_PREV );\n+    }\n+\n+    private enum RelationshipTypeField","path":"community/consistency-check/src/main/java/org/neo4j/consistency/checking/RelationshipRecordCheck.java","position":76,"original_position":76,"commit_id":"c4d6bccb1ec6367a0b6ac8af058069671c06bb11","original_commit_id":"c4d6bccb1ec6367a0b6ac8af058069671c06bb11","user":{"login":"tinwelint","id":187292,"avatar_url":"https://avatars.githubusercontent.com/u/187292?v=3","gravatar_id":"","url":"https://api.github.com/users/tinwelint","html_url":"https://github.com/tinwelint","followers_url":"https://api.github.com/users/tinwelint/followers","following_url":"https://api.github.com/users/tinwelint/following{/other_user}","gists_url":"https://api.github.com/users/tinwelint/gists{/gist_id}","starred_url":"https://api.github.com/users/tinwelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinwelint/subscriptions","organizations_url":"https://api.github.com/users/tinwelint/orgs","repos_url":"https://api.github.com/users/tinwelint/repos","events_url":"https://api.github.com/users/tinwelint/events{/privacy}","received_events_url":"https://api.github.com/users/tinwelint/received_events","type":"User","site_admin":false},"body":"It seems to be a common pattern here that *RecordCheck classes have their enum fields as internal classes... all except NodeField which is an enum for RelationshipRecordCheck. It's not strictly necessary, is it? We unit test on RecordCheck level anyway.","created_at":"2015-09-01T11:43:42Z","updated_at":"2015-09-01T11:43:42Z","html_url":"https://github.com/neo4j/neo4j/pull/5260#discussion_r38409715","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/5260","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/38409715"},"html":{"href":"https://github.com/neo4j/neo4j/pull/5260#discussion_r38409715"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/5260"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/5260","id":43847167,"html_url":"https://github.com/neo4j/neo4j/pull/5260","diff_url":"https://github.com/neo4j/neo4j/pull/5260.diff","patch_url":"https://github.com/neo4j/neo4j/pull/5260.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/5260","number":5260,"state":"closed","locked":false,"title":"Faster consistency checker","user":{"login":"tinwelint","id":187292,"avatar_url":"https://avatars.githubusercontent.com/u/187292?v=3","gravatar_id":"","url":"https://api.github.com/users/tinwelint","html_url":"https://github.com/tinwelint","followers_url":"https://api.github.com/users/tinwelint/followers","following_url":"https://api.github.com/users/tinwelint/following{/other_user}","gists_url":"https://api.github.com/users/tinwelint/gists{/gist_id}","starred_url":"https://api.github.com/users/tinwelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinwelint/subscriptions","organizations_url":"https://api.github.com/users/tinwelint/orgs","repos_url":"https://api.github.com/users/tinwelint/repos","events_url":"https://api.github.com/users/tinwelint/events{/privacy}","received_events_url":"https://api.github.com/users/tinwelint/received_events","type":"User","site_admin":false},"body":"Basically by reducing random access using an effient cache, checking only\r\nparts of records through multiple passes. Also parallelizes some store\r\nchecks, like indexes.","created_at":"2015-09-01T07:58:14Z","updated_at":"2015-09-01T11:43:42Z","closed_at":"2015-09-01T10:56:53Z","merged_at":null,"merge_commit_sha":"829b6e64dadba29a8a7baf847fbe5c722e7cb3d6","assignee":{"login":"lutovich","id":1638145,"avatar_url":"https://avatars.githubusercontent.com/u/1638145?v=3","gravatar_id":"","url":"https://api.github.com/users/lutovich","html_url":"https://github.com/lutovich","followers_url":"https://api.github.com/users/lutovich/followers","following_url":"https://api.github.com/users/lutovich/following{/other_user}","gists_url":"https://api.github.com/users/lutovich/gists{/gist_id}","starred_url":"https://api.github.com/users/lutovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lutovich/subscriptions","organizations_url":"https://api.github.com/users/lutovich/orgs","repos_url":"https://api.github.com/users/lutovich/repos","events_url":"https://api.github.com/users/lutovich/events{/privacy}","received_events_url":"https://api.github.com/users/lutovich/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/5260/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/5260/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/5260/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/c4d6bccb1ec6367a0b6ac8af058069671c06bb11","head":{"label":"tinwelint:2.2-cc-new","ref":"2.2-cc-new","sha":"c4d6bccb1ec6367a0b6ac8af058069671c06bb11","user":{"login":"tinwelint","id":187292,"avatar_url":"https://avatars.githubusercontent.com/u/187292?v=3","gravatar_id":"","url":"https://api.github.com/users/tinwelint","html_url":"https://github.com/tinwelint","followers_url":"https://api.github.com/users/tinwelint/followers","following_url":"https://api.github.com/users/tinwelint/following{/other_user}","gists_url":"https://api.github.com/users/tinwelint/gists{/gist_id}","starred_url":"https://api.github.com/users/tinwelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinwelint/subscriptions","organizations_url":"https://api.github.com/users/tinwelint/orgs","repos_url":"https://api.github.com/users/tinwelint/repos","events_url":"https://api.github.com/users/tinwelint/events{/privacy}","received_events_url":"https://api.github.com/users/tinwelint/received_events","type":"User","site_admin":false},"repo":{"id":6666980,"name":"neo4j","full_name":"tinwelint/neo4j","owner":{"login":"tinwelint","id":187292,"avatar_url":"https://avatars.githubusercontent.com/u/187292?v=3","gravatar_id":"","url":"https://api.github.com/users/tinwelint","html_url":"https://github.com/tinwelint","followers_url":"https://api.github.com/users/tinwelint/followers","following_url":"https://api.github.com/users/tinwelint/following{/other_user}","gists_url":"https://api.github.com/users/tinwelint/gists{/gist_id}","starred_url":"https://api.github.com/users/tinwelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinwelint/subscriptions","organizations_url":"https://api.github.com/users/tinwelint/orgs","repos_url":"https://api.github.com/users/tinwelint/repos","events_url":"https://api.github.com/users/tinwelint/events{/privacy}","received_events_url":"https://api.github.com/users/tinwelint/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tinwelint/neo4j","description":"","fork":true,"url":"https://api.github.com/repos/tinwelint/neo4j","forks_url":"https://api.github.com/repos/tinwelint/neo4j/forks","keys_url":"https://api.github.com/repos/tinwelint/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tinwelint/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tinwelint/neo4j/teams","hooks_url":"https://api.github.com/repos/tinwelint/neo4j/hooks","issue_events_url":"https://api.github.com/repos/tinwelint/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/tinwelint/neo4j/events","assignees_url":"https://api.github.com/repos/tinwelint/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/tinwelint/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/tinwelint/neo4j/tags","blobs_url":"https://api.github.com/repos/tinwelint/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tinwelint/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tinwelint/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/tinwelint/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tinwelint/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/tinwelint/neo4j/languages","stargazers_url":"https://api.github.com/repos/tinwelint/neo4j/stargazers","contributors_url":"https://api.github.com/repos/tinwelint/neo4j/contributors","subscribers_url":"https://api.github.com/repos/tinwelint/neo4j/subscribers","subscription_url":"https://api.github.com/repos/tinwelint/neo4j/subscription","commits_url":"https://api.github.com/repos/tinwelint/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/tinwelint/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/tinwelint/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/tinwelint/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/tinwelint/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/tinwelint/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tinwelint/neo4j/merges","archive_url":"https://api.github.com/repos/tinwelint/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tinwelint/neo4j/downloads","issues_url":"https://api.github.com/repos/tinwelint/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/tinwelint/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/tinwelint/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/tinwelint/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tinwelint/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/tinwelint/neo4j/releases{/id}","created_at":"2012-11-13T07:24:49Z","updated_at":"2014-12-16T07:20:14Z","pushed_at":"2015-09-01T07:57:19Z","git_url":"git://github.com/tinwelint/neo4j.git","ssh_url":"git@github.com:tinwelint/neo4j.git","clone_url":"https://github.com/tinwelint/neo4j.git","svn_url":"https://github.com/tinwelint/neo4j","homepage":null,"size":207786,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neo4j:2.2","ref":"2.2","sha":"059f8c86dca3dc9d0fa7a70794dc943ab438d137","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","created_at":"2012-11-12T08:46:15Z","updated_at":"2015-09-01T09:25:28Z","pushed_at":"2015-09-01T11:42:57Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.com","size":515301,"stargazers_count":1917,"watchers_count":1917,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":739,"mirror_url":null,"open_issues_count":466,"forks":739,"open_issues":466,"watchers":1917,"default_branch":"2.3"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/5260"},"html":{"href":"https://github.com/neo4j/neo4j/pull/5260"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/5260"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/5260/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/5260/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/5260/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/c4d6bccb1ec6367a0b6ac8af058069671c06bb11"}}}}