{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/atlasdb/pulls/comments/236322759","pull_request_review_id":178374669,"id":236322759,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjMyMjc1OQ==","diff_hunk":"@@ -0,0 +1,174 @@\n+/*\n+ * (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.palantir.atlasdb.internalschema;\n+\n+import java.util.Map;\n+import java.util.Set;\n+import java.util.stream.Collectors;\n+\n+import org.immutables.value.Value;\n+\n+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;\n+import com.fasterxml.jackson.databind.annotation.JsonSerialize;\n+import com.google.common.collect.ImmutableRangeMap;\n+import com.google.common.collect.Range;\n+import com.google.common.collect.RangeMap;\n+import com.google.common.collect.RangeSet;\n+import com.google.common.collect.TreeRangeSet;\n+import com.palantir.common.annotation.Output;\n+import com.palantir.logsafe.SafeArg;\n+import com.palantir.logsafe.exceptions.SafeIllegalArgumentException;\n+\n+/**\n+ * A {@link TimestampToTransactionSchemaMap} keeps track of a mapping of timestamp ranges to transactions schema\n+ * versions. The reason for using such a mapping is that clients may switch between mappings over time for various\n+ * reasons.\n+ *\n+ * {@link TimestampToTransactionSchemaMap#timestampToTransactionsTableSchemaVersion()} is always expected to cover\n+ * all timestamps. That is, the ranges present should span the range [1, +∞) and be connected.","path":"atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/TimestampToTransactionSchemaMap.java","position":null,"original_position":42,"commit_id":"788ab18eb301aed998ccec8cf5f82a0983adb75a","original_commit_id":"839a4feaecf1d54b826a7f0b8697a707810661e4","user":{"login":"sandorw","id":8271534,"node_id":"MDQ6VXNlcjgyNzE1MzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/8271534?v=4","gravatar_id":"","url":"https://api.github.com/users/sandorw","html_url":"https://github.com/sandorw","followers_url":"https://api.github.com/users/sandorw/followers","following_url":"https://api.github.com/users/sandorw/following{/other_user}","gists_url":"https://api.github.com/users/sandorw/gists{/gist_id}","starred_url":"https://api.github.com/users/sandorw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandorw/subscriptions","organizations_url":"https://api.github.com/users/sandorw/orgs","repos_url":"https://api.github.com/users/sandorw/repos","events_url":"https://api.github.com/users/sandorw/events{/privacy}","received_events_url":"https://api.github.com/users/sandorw/received_events","type":"User","site_admin":false},"body":"Looks good - maybe remove the first often to make this firmer.","created_at":"2018-11-26T16:20:28Z","updated_at":"2018-11-26T16:20:28Z","html_url":"https://github.com/palantir/atlasdb/pull/3642#discussion_r236322759","pull_request_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3642","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/comments/236322759"},"html":{"href":"https://github.com/palantir/atlasdb/pull/3642#discussion_r236322759"},"pull_request":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3642"}},"in_reply_to_id":236207028},"pull_request":{"url":"https://api.github.com/repos/palantir/atlasdb/pulls/3642","id":231940302,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxOTQwMzAy","html_url":"https://github.com/palantir/atlasdb/pull/3642","diff_url":"https://github.com/palantir/atlasdb/pull/3642.diff","patch_url":"https://github.com/palantir/atlasdb/pull/3642.patch","issue_url":"https://api.github.com/repos/palantir/atlasdb/issues/3642","number":3642,"state":"open","locked":false,"title":"[_transactions2] Coordination, Part 3: Internal Schema Metadata & Timestamp->Schema RangeMap","user":{"login":"jeremyk-91","id":5955510,"node_id":"MDQ6VXNlcjU5NTU1MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5955510?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremyk-91","html_url":"https://github.com/jeremyk-91","followers_url":"https://api.github.com/users/jeremyk-91/followers","following_url":"https://api.github.com/users/jeremyk-91/following{/other_user}","gists_url":"https://api.github.com/users/jeremyk-91/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyk-91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyk-91/subscriptions","organizations_url":"https://api.github.com/users/jeremyk-91/orgs","repos_url":"https://api.github.com/users/jeremyk-91/repos","events_url":"https://api.github.com/users/jeremyk-91/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyk-91/received_events","type":"User","site_admin":false},"body":"**Goals (and why)**:\r\n- Have a data structure that can be persisted into the KVS representing the things Atlas needs to coordinate amongst its nodes.\r\n- Have a representation of the timestamp -> schema version rangemap that is persistable.\r\n\r\n**Implementation Description (bullets)**:\r\n- `InternalSchemaMetadata` is the object that'll be persisted in the `CoordinationService`, and it has a `timestampToTransactionsTableSchemaVersion` map. This is set to *ignore unknown properties* - is this what we want, or should we fail if we see unknown ones?\r\n- `TimestampToTransactionSchemaMap` is a map of long ranges to integer (the transaction schema version). Effectively, this is a `RangeMap<Long, Integer>` which satisfies some additional invariants; the ranges span `[1, +inf)` completely.\r\n\r\n**Testing (What was existing testing like?  What have you done to improve it?)**:\r\nPR is mainly new. There are tests for the new code.\r\n\r\n**Concerns (what feedback would you like?)**:\r\n- Should we fail on unknown properties as far as `InternalSchemaMetadata` is concerned? This can be useful for ensuring no one is on too old of a version, but might make blue-green deployments non-HA if the new node updates the internal schema metadata.\r\n- Is the way `TimestampToTransactionSchemaMap` evolves reasonable? The reason this was chosen was so that extensions of the current version as well as changes to other properties in `InternalSchemaMetadata` will not need to update the data structure. It is a little more complex.\r\n- Is there an easier way to manage the serialisation of the `TimestampToTransactionSchemaMap`?\r\n\r\n**Where should we start reviewing?**: `TimestampToTransactionSchemaMap`\r\n\r\n**Priority (whenever / two weeks / yesterday)**: this week, or maybe early next - I'm on support so iteration may be slightly slower than normal.","created_at":"2018-11-19T11:31:03Z","updated_at":"2018-11-26T16:20:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7490408eebd1cf7824bbce377f3ba87162803def","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gokcanozakdag","id":9950842,"node_id":"MDQ6VXNlcjk5NTA4NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/9950842?v=4","gravatar_id":"","url":"https://api.github.com/users/gokcanozakdag","html_url":"https://github.com/gokcanozakdag","followers_url":"https://api.github.com/users/gokcanozakdag/followers","following_url":"https://api.github.com/users/gokcanozakdag/following{/other_user}","gists_url":"https://api.github.com/users/gokcanozakdag/gists{/gist_id}","starred_url":"https://api.github.com/users/gokcanozakdag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gokcanozakdag/subscriptions","organizations_url":"https://api.github.com/users/gokcanozakdag/orgs","repos_url":"https://api.github.com/users/gokcanozakdag/repos","events_url":"https://api.github.com/users/gokcanozakdag/events{/privacy}","received_events_url":"https://api.github.com/users/gokcanozakdag/received_events","type":"User","site_admin":false},{"login":"gmaretic","id":23168027,"node_id":"MDQ6VXNlcjIzMTY4MDI3","avatar_url":"https://avatars0.githubusercontent.com/u/23168027?v=4","gravatar_id":"","url":"https://api.github.com/users/gmaretic","html_url":"https://github.com/gmaretic","followers_url":"https://api.github.com/users/gmaretic/followers","following_url":"https://api.github.com/users/gmaretic/following{/other_user}","gists_url":"https://api.github.com/users/gmaretic/gists{/gist_id}","starred_url":"https://api.github.com/users/gmaretic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmaretic/subscriptions","organizations_url":"https://api.github.com/users/gmaretic/orgs","repos_url":"https://api.github.com/users/gmaretic/repos","events_url":"https://api.github.com/users/gmaretic/events{/privacy}","received_events_url":"https://api.github.com/users/gmaretic/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3642/commits","review_comments_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3642/comments","review_comment_url":"https://api.github.com/repos/palantir/atlasdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/atlasdb/issues/3642/comments","statuses_url":"https://api.github.com/repos/palantir/atlasdb/statuses/788ab18eb301aed998ccec8cf5f82a0983adb75a","head":{"label":"palantir:jkong/coord-3","ref":"jkong/coord-3","sha":"788ab18eb301aed998ccec8cf5f82a0983adb75a","user":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":36960637,"node_id":"MDEwOlJlcG9zaXRvcnkzNjk2MDYzNw==","name":"atlasdb","full_name":"palantir/atlasdb","private":false,"owner":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/palantir/atlasdb","description":"Transactional Distributed Database Layer","fork":false,"url":"https://api.github.com/repos/palantir/atlasdb","forks_url":"https://api.github.com/repos/palantir/atlasdb/forks","keys_url":"https://api.github.com/repos/palantir/atlasdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/atlasdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/atlasdb/teams","hooks_url":"https://api.github.com/repos/palantir/atlasdb/hooks","issue_events_url":"https://api.github.com/repos/palantir/atlasdb/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/atlasdb/events","assignees_url":"https://api.github.com/repos/palantir/atlasdb/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/atlasdb/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/atlasdb/tags","blobs_url":"https://api.github.com/repos/palantir/atlasdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/atlasdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/atlasdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/atlasdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/atlasdb/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/atlasdb/languages","stargazers_url":"https://api.github.com/repos/palantir/atlasdb/stargazers","contributors_url":"https://api.github.com/repos/palantir/atlasdb/contributors","subscribers_url":"https://api.github.com/repos/palantir/atlasdb/subscribers","subscription_url":"https://api.github.com/repos/palantir/atlasdb/subscription","commits_url":"https://api.github.com/repos/palantir/atlasdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/atlasdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/atlasdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/atlasdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/atlasdb/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/atlasdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/atlasdb/merges","archive_url":"https://api.github.com/repos/palantir/atlasdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/atlasdb/downloads","issues_url":"https://api.github.com/repos/palantir/atlasdb/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/atlasdb/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/atlasdb/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/atlasdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/atlasdb/labels{/name}","releases_url":"https://api.github.com/repos/palantir/atlasdb/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/atlasdb/deployments","created_at":"2015-06-05T23:42:44Z","updated_at":"2018-11-26T13:13:41Z","pushed_at":"2018-11-26T16:19:18Z","git_url":"git://github.com/palantir/atlasdb.git","ssh_url":"git@github.com:palantir/atlasdb.git","clone_url":"https://github.com/palantir/atlasdb.git","svn_url":"https://github.com/palantir/atlasdb","homepage":"http://palantir.github.io/atlasdb/","size":76584,"stargazers_count":634,"watchers_count":634,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":115,"mirror_url":null,"archived":false,"open_issues_count":321,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":115,"open_issues":321,"watchers":634,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"8eb4ba845dd459e69994433021bb3bb25521dd60","user":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":36960637,"node_id":"MDEwOlJlcG9zaXRvcnkzNjk2MDYzNw==","name":"atlasdb","full_name":"palantir/atlasdb","private":false,"owner":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/palantir/atlasdb","description":"Transactional Distributed Database Layer","fork":false,"url":"https://api.github.com/repos/palantir/atlasdb","forks_url":"https://api.github.com/repos/palantir/atlasdb/forks","keys_url":"https://api.github.com/repos/palantir/atlasdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/atlasdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/atlasdb/teams","hooks_url":"https://api.github.com/repos/palantir/atlasdb/hooks","issue_events_url":"https://api.github.com/repos/palantir/atlasdb/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/atlasdb/events","assignees_url":"https://api.github.com/repos/palantir/atlasdb/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/atlasdb/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/atlasdb/tags","blobs_url":"https://api.github.com/repos/palantir/atlasdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/atlasdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/atlasdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/atlasdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/atlasdb/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/atlasdb/languages","stargazers_url":"https://api.github.com/repos/palantir/atlasdb/stargazers","contributors_url":"https://api.github.com/repos/palantir/atlasdb/contributors","subscribers_url":"https://api.github.com/repos/palantir/atlasdb/subscribers","subscription_url":"https://api.github.com/repos/palantir/atlasdb/subscription","commits_url":"https://api.github.com/repos/palantir/atlasdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/atlasdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/atlasdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/atlasdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/atlasdb/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/atlasdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/atlasdb/merges","archive_url":"https://api.github.com/repos/palantir/atlasdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/atlasdb/downloads","issues_url":"https://api.github.com/repos/palantir/atlasdb/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/atlasdb/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/atlasdb/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/atlasdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/atlasdb/labels{/name}","releases_url":"https://api.github.com/repos/palantir/atlasdb/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/atlasdb/deployments","created_at":"2015-06-05T23:42:44Z","updated_at":"2018-11-26T13:13:41Z","pushed_at":"2018-11-26T16:19:18Z","git_url":"git://github.com/palantir/atlasdb.git","ssh_url":"git@github.com:palantir/atlasdb.git","clone_url":"https://github.com/palantir/atlasdb.git","svn_url":"https://github.com/palantir/atlasdb","homepage":"http://palantir.github.io/atlasdb/","size":76584,"stargazers_count":634,"watchers_count":634,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":115,"mirror_url":null,"archived":false,"open_issues_count":321,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":115,"open_issues":321,"watchers":634,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3642"},"html":{"href":"https://github.com/palantir/atlasdb/pull/3642"},"issue":{"href":"https://api.github.com/repos/palantir/atlasdb/issues/3642"},"comments":{"href":"https://api.github.com/repos/palantir/atlasdb/issues/3642/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3642/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3642/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/atlasdb/statuses/788ab18eb301aed998ccec8cf5f82a0983adb75a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sandorw"}}