{"action":"created","comment":{"url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/comments/82856669","pull_request_review_id":3734424,"id":82856669,"diff_hunk":"@@ -0,0 +1,275 @@\n+/*\n+ * Copyright 2014-2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\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+package org.hawkular.metrics.core.util;\n+\n+import java.util.Map;\n+import java.util.Optional;\n+import java.util.concurrent.TimeUnit;\n+\n+import org.hawkular.metrics.sysconfig.ConfigurationService;\n+import org.hawkular.rx.cassandra.driver.RxSession;\n+import org.jboss.logging.Logger;\n+\n+import com.datastax.driver.core.AggregateMetadata;\n+import com.datastax.driver.core.Cluster;\n+import com.datastax.driver.core.FunctionMetadata;\n+import com.datastax.driver.core.KeyspaceMetadata;\n+import com.datastax.driver.core.MaterializedViewMetadata;\n+import com.datastax.driver.core.PreparedStatement;\n+import com.datastax.driver.core.SchemaChangeListener;\n+import com.datastax.driver.core.TableMetadata;\n+import com.datastax.driver.core.UserType;\n+import com.google.common.base.Stopwatch;\n+\n+import rx.Completable;\n+import rx.Observable;\n+import rx.subjects.PublishSubject;\n+\n+/**\n+ * <p>\n+ * A listener that manages gc_grace_seconds for each table. For a single node cluster gc_grace_seconds can safely be\n+ * set to zero for all tables. It can also be set to zero for a multi-node cluster when replication_factor = 1. We can\n+ * always keep gc_grace_seconds = 0 for the data_compressed table since we do append-only writes and use TTL for\n+ * deletes.\n+ * </p>\n+ * <p>\n+ * Checks are performed only on keyspace change events such as changes to replication_factor since we do not do any\n+ * schema changes like adding/altering tables at runtime after server initialization.\n+ * </p>\n+ *\n+ * @author jsanda\n+ */\n+public class GCGraceSecondsManager implements SchemaChangeListener {\n+\n+    public static int DEFAULT_GC_GRACE_SECONDS = 604800;\n+\n+    private static Logger logger = Logger.getLogger(GCGraceSecondsManager.class);\n+\n+    private RxSession session;\n+\n+    private PreparedStatement resetGCGraceSeconds;\n+\n+    private PreparedStatement getGCGraceSeconds;","path":"core/metrics-core-service/src/main/java/org/hawkular/metrics/core/util/GCGraceSecondsManager.java","position":66,"original_position":66,"commit_id":"49d292fab5a688d2a0a2b74a25fee6577a154fe4","original_commit_id":"49d292fab5a688d2a0a2b74a25fee6577a154fe4","user":{"login":"stefannegrea","id":3912943,"avatar_url":"https://avatars.githubusercontent.com/u/3912943?v=3","gravatar_id":"","url":"https://api.github.com/users/stefannegrea","html_url":"https://github.com/stefannegrea","followers_url":"https://api.github.com/users/stefannegrea/followers","following_url":"https://api.github.com/users/stefannegrea/following{/other_user}","gists_url":"https://api.github.com/users/stefannegrea/gists{/gist_id}","starred_url":"https://api.github.com/users/stefannegrea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefannegrea/subscriptions","organizations_url":"https://api.github.com/users/stefannegrea/orgs","repos_url":"https://api.github.com/users/stefannegrea/repos","events_url":"https://api.github.com/users/stefannegrea/events{/privacy}","received_events_url":"https://api.github.com/users/stefannegrea/received_events","type":"User","site_admin":false},"body":"Should this be final?","created_at":"2016-10-11T18:21:04Z","updated_at":"2016-10-11T18:21:04Z","html_url":"https://github.com/hawkular/hawkular-metrics/pull/633#discussion_r82856669","pull_request_url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633","_links":{"self":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/comments/82856669"},"html":{"href":"https://github.com/hawkular/hawkular-metrics/pull/633#discussion_r82856669"},"pull_request":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633"}}},"pull_request":{"url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633","id":88696577,"html_url":"https://github.com/hawkular/hawkular-metrics/pull/633","diff_url":"https://github.com/hawkular/hawkular-metrics/pull/633.diff","patch_url":"https://github.com/hawkular/hawkular-metrics/pull/633.patch","issue_url":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/633","number":633,"state":"open","locked":false,"title":"[HWKMETRICS-381] dynamically manage gc_grace_seconds for all tables","user":{"login":"jsanda","id":168121,"avatar_url":"https://avatars.githubusercontent.com/u/168121?v=3","gravatar_id":"","url":"https://api.github.com/users/jsanda","html_url":"https://github.com/jsanda","followers_url":"https://api.github.com/users/jsanda/followers","following_url":"https://api.github.com/users/jsanda/following{/other_user}","gists_url":"https://api.github.com/users/jsanda/gists{/gist_id}","starred_url":"https://api.github.com/users/jsanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsanda/subscriptions","organizations_url":"https://api.github.com/users/jsanda/orgs","repos_url":"https://api.github.com/users/jsanda/repos","events_url":"https://api.github.com/users/jsanda/events{/privacy}","received_events_url":"https://api.github.com/users/jsanda/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-10T16:53:56Z","updated_at":"2016-10-11T18:21:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55ecaf5d76705051aa66801772558c7c2ae60cdb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633/commits","review_comments_url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633/comments","review_comment_url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/633/comments","statuses_url":"https://api.github.com/repos/hawkular/hawkular-metrics/statuses/49d292fab5a688d2a0a2b74a25fee6577a154fe4","head":{"label":"jsanda:hwkmetrics-381","ref":"hwkmetrics-381","sha":"49d292fab5a688d2a0a2b74a25fee6577a154fe4","user":{"login":"jsanda","id":168121,"avatar_url":"https://avatars.githubusercontent.com/u/168121?v=3","gravatar_id":"","url":"https://api.github.com/users/jsanda","html_url":"https://github.com/jsanda","followers_url":"https://api.github.com/users/jsanda/followers","following_url":"https://api.github.com/users/jsanda/following{/other_user}","gists_url":"https://api.github.com/users/jsanda/gists{/gist_id}","starred_url":"https://api.github.com/users/jsanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsanda/subscriptions","organizations_url":"https://api.github.com/users/jsanda/orgs","repos_url":"https://api.github.com/users/jsanda/repos","events_url":"https://api.github.com/users/jsanda/events{/privacy}","received_events_url":"https://api.github.com/users/jsanda/received_events","type":"User","site_admin":false},"repo":{"id":32349316,"name":"hawkular-metrics","full_name":"jsanda/hawkular-metrics","owner":{"login":"jsanda","id":168121,"avatar_url":"https://avatars.githubusercontent.com/u/168121?v=3","gravatar_id":"","url":"https://api.github.com/users/jsanda","html_url":"https://github.com/jsanda","followers_url":"https://api.github.com/users/jsanda/followers","following_url":"https://api.github.com/users/jsanda/following{/other_user}","gists_url":"https://api.github.com/users/jsanda/gists{/gist_id}","starred_url":"https://api.github.com/users/jsanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsanda/subscriptions","organizations_url":"https://api.github.com/users/jsanda/orgs","repos_url":"https://api.github.com/users/jsanda/repos","events_url":"https://api.github.com/users/jsanda/events{/privacy}","received_events_url":"https://api.github.com/users/jsanda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsanda/hawkular-metrics","description":"Time Series Metrics Engine based on Cassandra","fork":true,"url":"https://api.github.com/repos/jsanda/hawkular-metrics","forks_url":"https://api.github.com/repos/jsanda/hawkular-metrics/forks","keys_url":"https://api.github.com/repos/jsanda/hawkular-metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsanda/hawkular-metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsanda/hawkular-metrics/teams","hooks_url":"https://api.github.com/repos/jsanda/hawkular-metrics/hooks","issue_events_url":"https://api.github.com/repos/jsanda/hawkular-metrics/issues/events{/number}","events_url":"https://api.github.com/repos/jsanda/hawkular-metrics/events","assignees_url":"https://api.github.com/repos/jsanda/hawkular-metrics/assignees{/user}","branches_url":"https://api.github.com/repos/jsanda/hawkular-metrics/branches{/branch}","tags_url":"https://api.github.com/repos/jsanda/hawkular-metrics/tags","blobs_url":"https://api.github.com/repos/jsanda/hawkular-metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsanda/hawkular-metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsanda/hawkular-metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsanda/hawkular-metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsanda/hawkular-metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/jsanda/hawkular-metrics/languages","stargazers_url":"https://api.github.com/repos/jsanda/hawkular-metrics/stargazers","contributors_url":"https://api.github.com/repos/jsanda/hawkular-metrics/contributors","subscribers_url":"https://api.github.com/repos/jsanda/hawkular-metrics/subscribers","subscription_url":"https://api.github.com/repos/jsanda/hawkular-metrics/subscription","commits_url":"https://api.github.com/repos/jsanda/hawkular-metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsanda/hawkular-metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsanda/hawkular-metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsanda/hawkular-metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsanda/hawkular-metrics/contents/{+path}","compare_url":"https://api.github.com/repos/jsanda/hawkular-metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsanda/hawkular-metrics/merges","archive_url":"https://api.github.com/repos/jsanda/hawkular-metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsanda/hawkular-metrics/downloads","issues_url":"https://api.github.com/repos/jsanda/hawkular-metrics/issues{/number}","pulls_url":"https://api.github.com/repos/jsanda/hawkular-metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/jsanda/hawkular-metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/jsanda/hawkular-metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsanda/hawkular-metrics/labels{/name}","releases_url":"https://api.github.com/repos/jsanda/hawkular-metrics/releases{/id}","deployments_url":"https://api.github.com/repos/jsanda/hawkular-metrics/deployments","created_at":"2015-03-16T19:55:25Z","updated_at":"2015-03-16T19:55:26Z","pushed_at":"2016-10-10T20:29:24Z","git_url":"git://github.com/jsanda/hawkular-metrics.git","ssh_url":"git@github.com:jsanda/hawkular-metrics.git","clone_url":"https://github.com/jsanda/hawkular-metrics.git","svn_url":"https://github.com/jsanda/hawkular-metrics","homepage":"","size":15502,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"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":"hawkular:master","ref":"master","sha":"f8b2f1cef77f23c6048069d3660f4c75d4e2282e","user":{"login":"hawkular","id":10179627,"avatar_url":"https://avatars.githubusercontent.com/u/10179627?v=3","gravatar_id":"","url":"https://api.github.com/users/hawkular","html_url":"https://github.com/hawkular","followers_url":"https://api.github.com/users/hawkular/followers","following_url":"https://api.github.com/users/hawkular/following{/other_user}","gists_url":"https://api.github.com/users/hawkular/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkular/subscriptions","organizations_url":"https://api.github.com/users/hawkular/orgs","repos_url":"https://api.github.com/users/hawkular/repos","events_url":"https://api.github.com/users/hawkular/events{/privacy}","received_events_url":"https://api.github.com/users/hawkular/received_events","type":"Organization","site_admin":false},"repo":{"id":17705626,"name":"hawkular-metrics","full_name":"hawkular/hawkular-metrics","owner":{"login":"hawkular","id":10179627,"avatar_url":"https://avatars.githubusercontent.com/u/10179627?v=3","gravatar_id":"","url":"https://api.github.com/users/hawkular","html_url":"https://github.com/hawkular","followers_url":"https://api.github.com/users/hawkular/followers","following_url":"https://api.github.com/users/hawkular/following{/other_user}","gists_url":"https://api.github.com/users/hawkular/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkular/subscriptions","organizations_url":"https://api.github.com/users/hawkular/orgs","repos_url":"https://api.github.com/users/hawkular/repos","events_url":"https://api.github.com/users/hawkular/events{/privacy}","received_events_url":"https://api.github.com/users/hawkular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hawkular/hawkular-metrics","description":"Time Series Metrics Engine based on Cassandra","fork":false,"url":"https://api.github.com/repos/hawkular/hawkular-metrics","forks_url":"https://api.github.com/repos/hawkular/hawkular-metrics/forks","keys_url":"https://api.github.com/repos/hawkular/hawkular-metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hawkular/hawkular-metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hawkular/hawkular-metrics/teams","hooks_url":"https://api.github.com/repos/hawkular/hawkular-metrics/hooks","issue_events_url":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/events{/number}","events_url":"https://api.github.com/repos/hawkular/hawkular-metrics/events","assignees_url":"https://api.github.com/repos/hawkular/hawkular-metrics/assignees{/user}","branches_url":"https://api.github.com/repos/hawkular/hawkular-metrics/branches{/branch}","tags_url":"https://api.github.com/repos/hawkular/hawkular-metrics/tags","blobs_url":"https://api.github.com/repos/hawkular/hawkular-metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hawkular/hawkular-metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hawkular/hawkular-metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/hawkular/hawkular-metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hawkular/hawkular-metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/hawkular/hawkular-metrics/languages","stargazers_url":"https://api.github.com/repos/hawkular/hawkular-metrics/stargazers","contributors_url":"https://api.github.com/repos/hawkular/hawkular-metrics/contributors","subscribers_url":"https://api.github.com/repos/hawkular/hawkular-metrics/subscribers","subscription_url":"https://api.github.com/repos/hawkular/hawkular-metrics/subscription","commits_url":"https://api.github.com/repos/hawkular/hawkular-metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/hawkular/hawkular-metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/hawkular/hawkular-metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/hawkular/hawkular-metrics/contents/{+path}","compare_url":"https://api.github.com/repos/hawkular/hawkular-metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hawkular/hawkular-metrics/merges","archive_url":"https://api.github.com/repos/hawkular/hawkular-metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hawkular/hawkular-metrics/downloads","issues_url":"https://api.github.com/repos/hawkular/hawkular-metrics/issues{/number}","pulls_url":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/hawkular/hawkular-metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/hawkular/hawkular-metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hawkular/hawkular-metrics/labels{/name}","releases_url":"https://api.github.com/repos/hawkular/hawkular-metrics/releases{/id}","deployments_url":"https://api.github.com/repos/hawkular/hawkular-metrics/deployments","created_at":"2014-03-13T10:07:30Z","updated_at":"2016-10-08T10:22:42Z","pushed_at":"2016-10-11T18:16:27Z","git_url":"git://github.com/hawkular/hawkular-metrics.git","ssh_url":"git@github.com:hawkular/hawkular-metrics.git","clone_url":"https://github.com/hawkular/hawkular-metrics.git","svn_url":"https://github.com/hawkular/hawkular-metrics","homepage":"","size":18507,"stargazers_count":116,"watchers_count":116,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":18,"forks":56,"open_issues":18,"watchers":116,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633"},"html":{"href":"https://github.com/hawkular/hawkular-metrics/pull/633"},"issue":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/633"},"comments":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/issues/633/comments"},"review_comments":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633/comments"},"review_comment":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/pulls/633/commits"},"statuses":{"href":"https://api.github.com/repos/hawkular/hawkular-metrics/statuses/49d292fab5a688d2a0a2b74a25fee6577a154fe4"}}}}
{"actor":{"display_login":"stefannegrea"}}