{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1428","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1428/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1428/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1428/events","html_url":"https://github.com/cockroachdb/cockroach/pull/1428","id":89914808,"number":1428,"title":"Bug fix: A spanning-range scan may get dumplicate key-values","user":{"login":"yananzhi","id":11538969,"avatar_url":"https://avatars.githubusercontent.com/u/11538969?v=3","gravatar_id":"","url":"https://api.github.com/users/yananzhi","html_url":"https://github.com/yananzhi","followers_url":"https://api.github.com/users/yananzhi/followers","following_url":"https://api.github.com/users/yananzhi/following{/other_user}","gists_url":"https://api.github.com/users/yananzhi/gists{/gist_id}","starred_url":"https://api.github.com/users/yananzhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yananzhi/subscriptions","organizations_url":"https://api.github.com/users/yananzhi/orgs","repos_url":"https://api.github.com/users/yananzhi/repos","events_url":"https://api.github.com/users/yananzhi/events{/privacy}","received_events_url":"https://api.github.com/users/yananzhi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cockroachdb/cockroach/labels/PTAL","name":"PTAL","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-21T13:56:14Z","updated_at":"2015-06-21T14:21:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1428","html_url":"https://github.com/cockroachdb/cockroach/pull/1428","diff_url":"https://github.com/cockroachdb/cockroach/pull/1428.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/1428.patch"},"body":"A spanning-range scan may get dumplicate key-values when two ranges are mergeing. spanning-range scan should use current range's end key rather than next range's start key as the start key of sub scan\r\na range merge operation may happened beween get current rangedesc and get next range desc, the next range desc may be the merged range. use next range's start key as the start key of sub scan will get duplicate key-values."},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments/113907638","html_url":"https://github.com/cockroachdb/cockroach/pull/1428#issuecomment-113907638","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1428","id":113907638,"user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T14:21:18Z","updated_at":"2015-06-21T14:21:18Z","body":"If I get this right, it's mostly a caching problem by DistSender that goes beyond the fix you provided: The descriptors we get may be stale, and it's our responsibility to check that we've actually scanned the whole key range. Currently we rely on the descriptors returned being a consistent view of the ranges, which is not true by a long shot. We should verify that at each step, the next descriptor begins where the previous one left off, invalidating the descriptors that don't match up while we go along (so if the next descriptor actually begins before our last EndKey, we invalidate both of them. There may be additional locking issues on the store while merging, but those shouldn't concern the DistSender."}}