{"action":"created","comment":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/131397255","pull_request_review_id":54376010,"id":131397255,"diff_hunk":"@@ -207,68 +214,96 @@ private Object prefetchKeysIfNeededAndInvokeNext(InvocationContext ctx, Visitabl\n                nil -> makeStage(prefetchKeysIfNeededAndInvokeNext(ctx, command, keys, true)).toCompletableFuture()));\n       }\n       if (transferedKeys != null) {\n-         return asyncInvokeNext(ctx, command, retrieveRemoteValues(ctx, transferedKeys).toCompletableFuture());\n+         return asyncInvokeNext(ctx, command, retrieveRemoteValues(ctx, transferedKeys, command.getTopologyId()).toCompletableFuture());\n       } else {\n          return invokeNext(ctx, command);\n       }\n    }\n \n-   private InvocationStage retrieveSingleRemoteValue(InvocationContext ctx, Object key) {\n+   private InvocationStage lookupLocalAndRetrieveRemote(InvocationContext ctx, Object key, int topologyId) {\n+      if (trace) {\n+         log.tracef(\"Locally prefetching entry for key %s\", key);\n+      }\n       GetCacheEntryCommand getCacheEntryCommand = commandsFactory.buildGetCacheEntryCommand(key, EnumUtil.bitSetOf(Flag.CACHE_MODE_LOCAL));\n-      return makeStage(invokeNextThenApply(ctx, getCacheEntryCommand, (ctx1, command1, rv) -> {\n-         CacheEntry entry = (CacheEntry) rv;\n-         Metadata metadata = entry != null ? entry.getMetadata() : null;\n-         CompletableFuture<InternalCacheValue> future;\n-         if (metadata != null && metadata.version() != null && svm.isVersionActual(keyPartitioner.getSegment(key), metadata.version())){\n-            return null;\n-         } else if ((metadata instanceof RemoteMetadata)) {\n-            Address backup = ((RemoteMetadata) metadata).getAddress();\n-            future = retrieveRemoteValue(Collections.singleton(backup), key);\n-         } else {\n-            future = retrieveRemoteValue(null, key);\n+      getCacheEntryCommand.setTopologyId(topologyId);\n+      return makeStage(invokeNextThenApply(ctx, getCacheEntryCommand, handleLocallyLookedUpEntry));\n+   }\n+\n+   private Object handleLocallyLookedUpEntry(InvocationContext ctx1, VisitableCommand command1, Object rv) {\n+      GetCacheEntryCommand cmd = (GetCacheEntryCommand) command1;\n+      if (trace) {\n+         log.tracef(\"Locally prefetched entry %s\", rv);\n+      }\n+      CacheEntry entry = (CacheEntry) rv;\n+      Metadata metadata = entry != null ? entry.getMetadata() : null;\n+      CompletableFuture<InternalCacheValue> future;\n+      int segment = keyPartitioner.getSegment(cmd.getKey());\n+      if (metadata != null && metadata.version() != null && svm.isVersionActual(segment, metadata.version())){\n+         return null;\n+      } else if ((metadata instanceof RemoteMetadata) && svm.getSegmentState(segment) == ScatteredVersionManager.SegmentState.VALUE_TRANSFER) {\n+         // The RemoteMetadata is valid only during value transfer - in blocked state there shouldn't be any such\n+         // entry and during key transfer we could see metadata pointing to a node with outdated information.","path":"core/src/main/java/org/infinispan/interceptors/impl/PrefetchInterceptor.java","position":114,"original_position":114,"commit_id":"c52be1570ac1979e3d1b237e5de27a8f122e8997","original_commit_id":"c52be1570ac1979e3d1b237e5de27a8f122e8997","user":{"login":"danberindei","id":504907,"avatar_url":"https://avatars2.githubusercontent.com/u/504907?v=4","gravatar_id":"","url":"https://api.github.com/users/danberindei","html_url":"https://github.com/danberindei","followers_url":"https://api.github.com/users/danberindei/followers","following_url":"https://api.github.com/users/danberindei/following{/other_user}","gists_url":"https://api.github.com/users/danberindei/gists{/gist_id}","starred_url":"https://api.github.com/users/danberindei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danberindei/subscriptions","organizations_url":"https://api.github.com/users/danberindei/orgs","repos_url":"https://api.github.com/users/danberindei/repos","events_url":"https://api.github.com/users/danberindei/events{/privacy}","received_events_url":"https://api.github.com/users/danberindei/received_events","type":"User","site_admin":false},"body":"Maybe you could add some javadoc to `RemoteMetadata` to explain what `getAddress()` means during each phase? ","created_at":"2017-08-04T14:07:01Z","updated_at":"2017-08-04T14:07:01Z","html_url":"https://github.com/infinispan/infinispan/pull/5317#discussion_r131397255","pull_request_url":"https://api.github.com/repos/infinispan/infinispan/pulls/5317","_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/131397255"},"html":{"href":"https://github.com/infinispan/infinispan/pull/5317#discussion_r131397255"},"pull_request":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/5317"}}},"pull_request":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/5317","id":132266394,"html_url":"https://github.com/infinispan/infinispan/pull/5317","diff_url":"https://github.com/infinispan/infinispan/pull/5317.diff","patch_url":"https://github.com/infinispan/infinispan/pull/5317.patch","issue_url":"https://api.github.com/repos/infinispan/infinispan/issues/5317","number":5317,"state":"open","locked":false,"title":"ISPN-8097 ScatteredCrashInSequenceTest.testSplit failures","user":{"login":"rvansa","id":2167869,"avatar_url":"https://avatars0.githubusercontent.com/u/2167869?v=4","gravatar_id":"","url":"https://api.github.com/users/rvansa","html_url":"https://github.com/rvansa","followers_url":"https://api.github.com/users/rvansa/followers","following_url":"https://api.github.com/users/rvansa/following{/other_user}","gists_url":"https://api.github.com/users/rvansa/gists{/gist_id}","starred_url":"https://api.github.com/users/rvansa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvansa/subscriptions","organizations_url":"https://api.github.com/users/rvansa/orgs","repos_url":"https://api.github.com/users/rvansa/repos","events_url":"https://api.github.com/users/rvansa/events{/privacy}","received_events_url":"https://api.github.com/users/rvansa/received_events","type":"User","site_admin":false},"body":"https://issues.jboss.org/browse/ISPN-8097","created_at":"2017-07-25T12:14:06Z","updated_at":"2017-08-04T14:07:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8351507a8eb950e76240c9c35dc9e7995527bd4d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/infinispan/infinispan/pulls/5317/commits","review_comments_url":"https://api.github.com/repos/infinispan/infinispan/pulls/5317/comments","review_comment_url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/infinispan/infinispan/issues/5317/comments","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/c52be1570ac1979e3d1b237e5de27a8f122e8997","head":{"label":"rvansa:ISPN-8097","ref":"ISPN-8097","sha":"c52be1570ac1979e3d1b237e5de27a8f122e8997","user":{"login":"rvansa","id":2167869,"avatar_url":"https://avatars0.githubusercontent.com/u/2167869?v=4","gravatar_id":"","url":"https://api.github.com/users/rvansa","html_url":"https://github.com/rvansa","followers_url":"https://api.github.com/users/rvansa/followers","following_url":"https://api.github.com/users/rvansa/following{/other_user}","gists_url":"https://api.github.com/users/rvansa/gists{/gist_id}","starred_url":"https://api.github.com/users/rvansa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvansa/subscriptions","organizations_url":"https://api.github.com/users/rvansa/orgs","repos_url":"https://api.github.com/users/rvansa/repos","events_url":"https://api.github.com/users/rvansa/events{/privacy}","received_events_url":"https://api.github.com/users/rvansa/received_events","type":"User","site_admin":false},"repo":{"id":8481591,"name":"infinispan","full_name":"rvansa/infinispan","owner":{"login":"rvansa","id":2167869,"avatar_url":"https://avatars0.githubusercontent.com/u/2167869?v=4","gravatar_id":"","url":"https://api.github.com/users/rvansa","html_url":"https://github.com/rvansa","followers_url":"https://api.github.com/users/rvansa/followers","following_url":"https://api.github.com/users/rvansa/following{/other_user}","gists_url":"https://api.github.com/users/rvansa/gists{/gist_id}","starred_url":"https://api.github.com/users/rvansa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvansa/subscriptions","organizations_url":"https://api.github.com/users/rvansa/orgs","repos_url":"https://api.github.com/users/rvansa/repos","events_url":"https://api.github.com/users/rvansa/events{/privacy}","received_events_url":"https://api.github.com/users/rvansa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rvansa/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":true,"url":"https://api.github.com/repos/rvansa/infinispan","forks_url":"https://api.github.com/repos/rvansa/infinispan/forks","keys_url":"https://api.github.com/repos/rvansa/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rvansa/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rvansa/infinispan/teams","hooks_url":"https://api.github.com/repos/rvansa/infinispan/hooks","issue_events_url":"https://api.github.com/repos/rvansa/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/rvansa/infinispan/events","assignees_url":"https://api.github.com/repos/rvansa/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/rvansa/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/rvansa/infinispan/tags","blobs_url":"https://api.github.com/repos/rvansa/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rvansa/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rvansa/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/rvansa/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rvansa/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/rvansa/infinispan/languages","stargazers_url":"https://api.github.com/repos/rvansa/infinispan/stargazers","contributors_url":"https://api.github.com/repos/rvansa/infinispan/contributors","subscribers_url":"https://api.github.com/repos/rvansa/infinispan/subscribers","subscription_url":"https://api.github.com/repos/rvansa/infinispan/subscription","commits_url":"https://api.github.com/repos/rvansa/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/rvansa/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/rvansa/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/rvansa/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/rvansa/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/rvansa/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rvansa/infinispan/merges","archive_url":"https://api.github.com/repos/rvansa/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rvansa/infinispan/downloads","issues_url":"https://api.github.com/repos/rvansa/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/rvansa/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/rvansa/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/rvansa/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rvansa/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/rvansa/infinispan/releases{/id}","deployments_url":"https://api.github.com/repos/rvansa/infinispan/deployments","created_at":"2013-02-28T15:13:16Z","updated_at":"2015-05-05T17:20:40Z","pushed_at":"2017-08-04T11:06:01Z","git_url":"git://github.com/rvansa/infinispan.git","ssh_url":"git@github.com:rvansa/infinispan.git","clone_url":"https://github.com/rvansa/infinispan.git","svn_url":"https://github.com/rvansa/infinispan","homepage":"http://www.infinispan.org","size":93860,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"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":"infinispan:master","ref":"master","sha":"34acdf4460be0e7606ca3ae919dc992de27217c4","user":{"login":"infinispan","id":458093,"avatar_url":"https://avatars3.githubusercontent.com/u/458093?v=4","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"repo":{"id":1050944,"name":"infinispan","full_name":"infinispan/infinispan","owner":{"login":"infinispan","id":458093,"avatar_url":"https://avatars3.githubusercontent.com/u/458093?v=4","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/infinispan/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":false,"url":"https://api.github.com/repos/infinispan/infinispan","forks_url":"https://api.github.com/repos/infinispan/infinispan/forks","keys_url":"https://api.github.com/repos/infinispan/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/infinispan/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/infinispan/infinispan/teams","hooks_url":"https://api.github.com/repos/infinispan/infinispan/hooks","issue_events_url":"https://api.github.com/repos/infinispan/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/infinispan/infinispan/events","assignees_url":"https://api.github.com/repos/infinispan/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/infinispan/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/infinispan/infinispan/tags","blobs_url":"https://api.github.com/repos/infinispan/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/infinispan/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/infinispan/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/infinispan/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/infinispan/infinispan/languages","stargazers_url":"https://api.github.com/repos/infinispan/infinispan/stargazers","contributors_url":"https://api.github.com/repos/infinispan/infinispan/contributors","subscribers_url":"https://api.github.com/repos/infinispan/infinispan/subscribers","subscription_url":"https://api.github.com/repos/infinispan/infinispan/subscription","commits_url":"https://api.github.com/repos/infinispan/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/infinispan/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/infinispan/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/infinispan/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/infinispan/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/infinispan/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/infinispan/infinispan/merges","archive_url":"https://api.github.com/repos/infinispan/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/infinispan/infinispan/downloads","issues_url":"https://api.github.com/repos/infinispan/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/infinispan/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/infinispan/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/infinispan/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/infinispan/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/infinispan/infinispan/releases{/id}","deployments_url":"https://api.github.com/repos/infinispan/infinispan/deployments","created_at":"2010-11-04T12:33:19Z","updated_at":"2017-08-01T15:54:02Z","pushed_at":"2017-08-04T13:24:51Z","git_url":"git://github.com/infinispan/infinispan.git","ssh_url":"git@github.com:infinispan/infinispan.git","clone_url":"https://github.com/infinispan/infinispan.git","svn_url":"https://github.com/infinispan/infinispan","homepage":"http://www.infinispan.org","size":99492,"stargazers_count":581,"watchers_count":581,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":401,"mirror_url":null,"open_issues_count":10,"forks":401,"open_issues":10,"watchers":581,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/5317"},"html":{"href":"https://github.com/infinispan/infinispan/pull/5317"},"issue":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/5317"},"comments":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/5317/comments"},"review_comments":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/5317/comments"},"review_comment":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/5317/commits"},"statuses":{"href":"https://api.github.com/repos/infinispan/infinispan/statuses/c52be1570ac1979e3d1b237e5de27a8f122e8997"}}}}
{"actor":{"display_login":"danberindei"}}