{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/atlasdb/pulls/comments/184243037","pull_request_review_id":115398580,"id":184243037,"diff_hunk":"@@ -0,0 +1,116 @@\n+/*\n+ * Copyright 2018 Palantir Technologies, Inc. All rights reserved.\n+ *\n+ * Licensed under the BSD-3 License (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://opensource.org/licenses/BSD-3-Clause\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.sweep.queue;\n+\n+import java.util.Map;\n+\n+import com.google.common.base.Preconditions;\n+import com.google.common.collect.ImmutableMap;\n+import com.google.common.collect.Iterables;\n+import com.palantir.atlasdb.keyvalue.api.Cell;\n+import com.palantir.atlasdb.keyvalue.api.CheckAndSetException;\n+import com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest;\n+import com.palantir.atlasdb.keyvalue.api.KeyValueService;\n+import com.palantir.atlasdb.keyvalue.api.TableReference;\n+import com.palantir.atlasdb.keyvalue.api.Value;\n+import com.palantir.atlasdb.schema.generated.SweepShardProgressTable;\n+import com.palantir.atlasdb.schema.generated.TargetedSweepTableFactory;\n+import com.palantir.util.PersistableBoolean;\n+\n+public class KvsSweepQueueProgress {\n+    private static final TableReference TABLE_REF = TargetedSweepTableFactory.of()\n+            .getSweepShardProgressTable(null).getTableRef();\n+    private static final int NUMBER_OF_SHARDS_INDEX = 1024;\n+    private static final long CAS_TIMESTAMP = 1L;\n+\n+    private final KeyValueService kvs;\n+\n+    public KvsSweepQueueProgress(KeyValueService kvs) {\n+        this.kvs = kvs;\n+    }\n+\n+    public long numberOfShards() {\n+        return getOrInitializeTo(NUMBER_OF_SHARDS_INDEX, true, 1L);\n+    }\n+\n+    public void updateNumberOfShards(int newNumber) {\n+        Preconditions.checkArgument(newNumber <= 128);\n+        increaseValue(NUMBER_OF_SHARDS_INDEX, true, newNumber);\n+    }\n+\n+    public long lastSweptTimestamp(int shard, boolean conservative) {","path":"atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/sweep/queue/KvsSweepQueueProgress.java","position":55,"original_position":55,"commit_id":"bcfdfc19b34189de57e7395c98724149a8950c23","original_commit_id":"8c531bfb2bdf932043fb01db3867fed51b99d1b3","user":{"login":"gmaretic","id":23168027,"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},"body":"Done in future PR","created_at":"2018-04-26T00:29:45Z","updated_at":"2018-04-26T00:29:45Z","html_url":"https://github.com/palantir/atlasdb/pull/3108#discussion_r184243037","pull_request_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3108","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/comments/184243037"},"html":{"href":"https://github.com/palantir/atlasdb/pull/3108#discussion_r184243037"},"pull_request":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3108"}},"in_reply_to_id":183667050},"pull_request":{"url":"https://api.github.com/repos/palantir/atlasdb/pulls/3108","id":183496917,"html_url":"https://github.com/palantir/atlasdb/pull/3108","diff_url":"https://github.com/palantir/atlasdb/pull/3108.diff","patch_url":"https://github.com/palantir/atlasdb/pull/3108.patch","issue_url":"https://api.github.com/repos/palantir/atlasdb/issues/3108","number":3108,"state":"open","locked":false,"title":"[TS] Part 3: Targeted Sweep Queue Progress Table + Class","user":{"login":"gmaretic","id":23168027,"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},"body":"**Goals (and why)**:\r\nImplement the progress table for sweep queue.\r\n\r\n**Implementation Description (bullets)**:\r\nThe table stores the last swept timestamp for each shard. It also stores the information about the number of shards we are using.\r\n\r\n**Concerns (what feedback would you like?)**:\r\nJust using a row of this table to store the number of shard information is hacky, but does not seem worth it to have a separate table just for that. Alternatively, we could create the new rows eagerly, but that is potentially a lot of CAS operations at once.\r\n\r\nAlso, the treatment of edge cases with CAS failing etc is open to discussion.\r\n\r\n**Where should we start reviewing?**:\r\n`KvsSweepProgressQueueTest`\r\n\r\n**Priority (whenever / two weeks / yesterday)**:\r\nNot urgent, but small (ignoring generated code)\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/palantir/atlasdb/3108)\n<!-- Reviewable:end -->\n","created_at":"2018-04-23T16:56:29Z","updated_at":"2018-04-26T00:29:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b18b357c67909043465d55a03b0a15aaec7a49c6","assignee":null,"assignees":[],"requested_reviewers":[{"login":"sandorw","id":8271534,"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}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3108/commits","review_comments_url":"https://api.github.com/repos/palantir/atlasdb/pulls/3108/comments","review_comment_url":"https://api.github.com/repos/palantir/atlasdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/atlasdb/issues/3108/comments","statuses_url":"https://api.github.com/repos/palantir/atlasdb/statuses/bcfdfc19b34189de57e7395c98724149a8950c23","head":{"label":"palantir:targeted-sweep/sweep-queue-progress","ref":"targeted-sweep/sweep-queue-progress","sha":"bcfdfc19b34189de57e7395c98724149a8950c23","user":{"login":"palantir","id":303157,"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,"name":"atlasdb","full_name":"palantir/atlasdb","owner":{"login":"palantir","id":303157,"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},"private":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-04-25T16:25:32Z","pushed_at":"2018-04-25T22:00:25Z","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":61121,"stargazers_count":582,"watchers_count":582,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":108,"mirror_url":null,"archived":false,"open_issues_count":290,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":108,"open_issues":290,"watchers":582,"default_branch":"develop"}},"base":{"label":"palantir:targeted-sweep/schema","ref":"targeted-sweep/schema","sha":"3e5f5ea14b7562714e4dd29b5241e3d26e23f0a9","user":{"login":"palantir","id":303157,"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,"name":"atlasdb","full_name":"palantir/atlasdb","owner":{"login":"palantir","id":303157,"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},"private":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-04-25T16:25:32Z","pushed_at":"2018-04-25T22:00:25Z","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":61121,"stargazers_count":582,"watchers_count":582,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":108,"mirror_url":null,"archived":false,"open_issues_count":290,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":108,"open_issues":290,"watchers":582,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3108"},"html":{"href":"https://github.com/palantir/atlasdb/pull/3108"},"issue":{"href":"https://api.github.com/repos/palantir/atlasdb/issues/3108"},"comments":{"href":"https://api.github.com/repos/palantir/atlasdb/issues/3108/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3108/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/atlasdb/pulls/3108/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/atlasdb/statuses/bcfdfc19b34189de57e7395c98724149a8950c23"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gmaretic"}}