{"action":"created","comment":{"url":"https://api.github.com/repos/apache/phoenix/pulls/comments/225701877","pull_request_review_id":165360434,"id":225701877,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTcwMTg3Nw==","diff_hunk":"@@ -0,0 +1,261 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  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.apache.phoenix.coprocessor;\n+\n+import java.io.IOException;\n+import java.sql.PreparedStatement;\n+import java.sql.ResultSet;\n+import java.sql.SQLException;\n+import java.sql.Timestamp;\n+import java.sql.Types;\n+\n+import java.util.Optional;\n+import java.util.Properties;\n+import java.util.TimerTask;\n+import java.util.concurrent.ScheduledThreadPoolExecutor;\n+import java.util.concurrent.TimeUnit;\n+\n+import javax.annotation.concurrent.GuardedBy;\n+\n+import org.apache.commons.logging.Log;\n+import org.apache.commons.logging.LogFactory;\n+import org.apache.hadoop.conf.Configuration;\n+import org.apache.hadoop.hbase.CoprocessorEnvironment;\n+import org.apache.hadoop.hbase.coprocessor.ObserverContext;\n+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;\n+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;\n+import org.apache.hadoop.hbase.coprocessor.RegionObserver;\n+import org.apache.log4j.Level;\n+import org.apache.log4j.Logger;\n+import org.apache.phoenix.jdbc.PhoenixConnection;\n+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;\n+import org.apache.phoenix.jdbc.PhoenixDriver;\n+import org.apache.phoenix.query.QueryServices;\n+import org.apache.phoenix.query.QueryServicesOptions;\n+import org.apache.phoenix.schema.MetaDataClient;\n+import org.apache.phoenix.schema.PTable;\n+import org.apache.phoenix.schema.PTable.TaskType;\n+\n+import org.apache.phoenix.util.PhoenixRuntime;\n+import org.apache.phoenix.util.QueryUtil;\n+\n+\n+/**\n+ * Coprocessor for task related operations. This coprocessor would only be registered\n+ * to SYSTEM.TASK table\n+ */\n+@SuppressWarnings(\"deprecation\")\n+public class TaskRegionObserver implements RegionObserver, RegionCoprocessor {\n+    public static final Log LOG = LogFactory.getLog(TaskRegionObserver.class);\n+    protected ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(TaskType.values().length);\n+    private long timeInterval = QueryServicesOptions.DEFAULT_TASK_HANDLING_INTERVAL;\n+    private long timeMaxInterval = QueryServicesOptions.DEFAULT_TASK_HANDLING_MAX_INTERVAL;\n+    @GuardedBy(\"TaskRegionObserver.class\")\n+    // Added for test purposes\n+    private long initialDelay = 0;\n+\n+    @Override\n+    public void preClose(final ObserverContext<RegionCoprocessorEnvironment> c,\n+            boolean abortRequested) {\n+        executor.shutdownNow();\n+    }\n+\n+    @Override\n+    public Optional<RegionObserver> getRegionObserver() {\n+        return Optional.of(this);\n+    }\n+\n+    @Override\n+    public void start(CoprocessorEnvironment env) throws IOException {\n+        Configuration config = env.getConfiguration();\n+        timeInterval =","path":"phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TaskRegionObserver.java","position":89,"original_position":86,"commit_id":"3971e961a07206be7408fd76184122810d7eb3b4","original_commit_id":"39de97d331701bc425af16e467b2ad9d54ad119f","user":{"login":"karanmehta93","id":6191256,"node_id":"MDQ6VXNlcjYxOTEyNTY=","avatar_url":"https://avatars1.githubusercontent.com/u/6191256?v=4","gravatar_id":"","url":"https://api.github.com/users/karanmehta93","html_url":"https://github.com/karanmehta93","followers_url":"https://api.github.com/users/karanmehta93/followers","following_url":"https://api.github.com/users/karanmehta93/following{/other_user}","gists_url":"https://api.github.com/users/karanmehta93/gists{/gist_id}","starred_url":"https://api.github.com/users/karanmehta93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karanmehta93/subscriptions","organizations_url":"https://api.github.com/users/karanmehta93/orgs","repos_url":"https://api.github.com/users/karanmehta93/repos","events_url":"https://api.github.com/users/karanmehta93/events{/privacy}","received_events_url":"https://api.github.com/users/karanmehta93/received_events","type":"User","site_admin":false},"body":"> I am not sure how you conclude that initialDelay is/will be only used for only test purposes.\r\n\r\nThis is something that's only applicable for once during the lifetime of a region server, since phoenix lies inside HBase process. I am not sure if this will help. This is not the delay that will be applied before every task, is that correct? Also, I see that initialDelay is commented as \"for test purposes\" on Line 72 in TaskRegionObserver.java. ","created_at":"2018-10-16T20:46:58Z","updated_at":"2018-10-16T20:46:59Z","html_url":"https://github.com/apache/phoenix/pull/359#discussion_r225701877","pull_request_url":"https://api.github.com/repos/apache/phoenix/pulls/359","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/apache/phoenix/pulls/comments/225701877"},"html":{"href":"https://github.com/apache/phoenix/pull/359#discussion_r225701877"},"pull_request":{"href":"https://api.github.com/repos/apache/phoenix/pulls/359"}},"in_reply_to_id":222442511},"pull_request":{"url":"https://api.github.com/repos/apache/phoenix/pulls/359","id":218690089,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NjkwMDg5","html_url":"https://github.com/apache/phoenix/pull/359","diff_url":"https://github.com/apache/phoenix/pull/359.diff","patch_url":"https://github.com/apache/phoenix/pull/359.patch","issue_url":"https://api.github.com/repos/apache/phoenix/issues/359","number":359,"state":"open","locked":false,"title":"PHOENIX-4764 - Cleanup metadata of child views for a base table that has been dropped","user":{"login":"kadirozde","id":37155482,"node_id":"MDQ6VXNlcjM3MTU1NDgy","avatar_url":"https://avatars0.githubusercontent.com/u/37155482?v=4","gravatar_id":"","url":"https://api.github.com/users/kadirozde","html_url":"https://github.com/kadirozde","followers_url":"https://api.github.com/users/kadirozde/followers","following_url":"https://api.github.com/users/kadirozde/following{/other_user}","gists_url":"https://api.github.com/users/kadirozde/gists{/gist_id}","starred_url":"https://api.github.com/users/kadirozde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadirozde/subscriptions","organizations_url":"https://api.github.com/users/kadirozde/orgs","repos_url":"https://api.github.com/users/kadirozde/repos","events_url":"https://api.github.com/users/kadirozde/events{/privacy}","received_events_url":"https://api.github.com/users/kadirozde/received_events","type":"User","site_admin":false},"body":"A given Phoenix table may have one or (child) views and these views may have their own views. So, a given table or view may have a tree of views rooted at this given table or view. When a table or view is deleted, its views are also required to be deleted. Given that there is no transaction mechanism to atomically delete a given table and its view, failures during deleting a table or view will lead to orphaned views. This patch is to make sure that all the child views will be dropped and will not stay around as orphan views after their parent is deleted.","created_at":"2018-09-27T15:11:59Z","updated_at":"2018-10-16T20:46:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5d933bfca1b76c5cee4c8afe50549c5cb5bd3f9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/phoenix/pulls/359/commits","review_comments_url":"https://api.github.com/repos/apache/phoenix/pulls/359/comments","review_comment_url":"https://api.github.com/repos/apache/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/phoenix/issues/359/comments","statuses_url":"https://api.github.com/repos/apache/phoenix/statuses/3971e961a07206be7408fd76184122810d7eb3b4","head":{"label":"kadirozde:PHOENIX-4764","ref":"PHOENIX-4764","sha":"3971e961a07206be7408fd76184122810d7eb3b4","user":{"login":"kadirozde","id":37155482,"node_id":"MDQ6VXNlcjM3MTU1NDgy","avatar_url":"https://avatars0.githubusercontent.com/u/37155482?v=4","gravatar_id":"","url":"https://api.github.com/users/kadirozde","html_url":"https://github.com/kadirozde","followers_url":"https://api.github.com/users/kadirozde/followers","following_url":"https://api.github.com/users/kadirozde/following{/other_user}","gists_url":"https://api.github.com/users/kadirozde/gists{/gist_id}","starred_url":"https://api.github.com/users/kadirozde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadirozde/subscriptions","organizations_url":"https://api.github.com/users/kadirozde/orgs","repos_url":"https://api.github.com/users/kadirozde/repos","events_url":"https://api.github.com/users/kadirozde/events{/privacy}","received_events_url":"https://api.github.com/users/kadirozde/received_events","type":"User","site_admin":false},"repo":{"id":149506356,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1MDYzNTY=","name":"phoenix","full_name":"kadirozde/phoenix","private":false,"owner":{"login":"kadirozde","id":37155482,"node_id":"MDQ6VXNlcjM3MTU1NDgy","avatar_url":"https://avatars0.githubusercontent.com/u/37155482?v=4","gravatar_id":"","url":"https://api.github.com/users/kadirozde","html_url":"https://github.com/kadirozde","followers_url":"https://api.github.com/users/kadirozde/followers","following_url":"https://api.github.com/users/kadirozde/following{/other_user}","gists_url":"https://api.github.com/users/kadirozde/gists{/gist_id}","starred_url":"https://api.github.com/users/kadirozde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadirozde/subscriptions","organizations_url":"https://api.github.com/users/kadirozde/orgs","repos_url":"https://api.github.com/users/kadirozde/repos","events_url":"https://api.github.com/users/kadirozde/events{/privacy}","received_events_url":"https://api.github.com/users/kadirozde/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kadirozde/phoenix","description":"Mirror of Apache Phoenix","fork":true,"url":"https://api.github.com/repos/kadirozde/phoenix","forks_url":"https://api.github.com/repos/kadirozde/phoenix/forks","keys_url":"https://api.github.com/repos/kadirozde/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kadirozde/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kadirozde/phoenix/teams","hooks_url":"https://api.github.com/repos/kadirozde/phoenix/hooks","issue_events_url":"https://api.github.com/repos/kadirozde/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/kadirozde/phoenix/events","assignees_url":"https://api.github.com/repos/kadirozde/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/kadirozde/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/kadirozde/phoenix/tags","blobs_url":"https://api.github.com/repos/kadirozde/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kadirozde/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kadirozde/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/kadirozde/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kadirozde/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/kadirozde/phoenix/languages","stargazers_url":"https://api.github.com/repos/kadirozde/phoenix/stargazers","contributors_url":"https://api.github.com/repos/kadirozde/phoenix/contributors","subscribers_url":"https://api.github.com/repos/kadirozde/phoenix/subscribers","subscription_url":"https://api.github.com/repos/kadirozde/phoenix/subscription","commits_url":"https://api.github.com/repos/kadirozde/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/kadirozde/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/kadirozde/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/kadirozde/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/kadirozde/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/kadirozde/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kadirozde/phoenix/merges","archive_url":"https://api.github.com/repos/kadirozde/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kadirozde/phoenix/downloads","issues_url":"https://api.github.com/repos/kadirozde/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/kadirozde/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/kadirozde/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/kadirozde/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kadirozde/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/kadirozde/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/kadirozde/phoenix/deployments","created_at":"2018-09-19T20:09:14Z","updated_at":"2018-09-19T20:09:23Z","pushed_at":"2018-10-16T19:21:28Z","git_url":"git://github.com/kadirozde/phoenix.git","ssh_url":"git@github.com:kadirozde/phoenix.git","clone_url":"https://github.com/kadirozde/phoenix.git","svn_url":"https://github.com/kadirozde/phoenix","homepage":null,"size":46943,"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,"archived":false,"open_issues_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"c3c51180bf6c5913fcfb4b1e8dca2ebd60187d6e","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20473418,"node_id":"MDEwOlJlcG9zaXRvcnkyMDQ3MzQxOA==","name":"phoenix","full_name":"apache/phoenix","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/phoenix","description":"Mirror of Apache Phoenix","fork":false,"url":"https://api.github.com/repos/apache/phoenix","forks_url":"https://api.github.com/repos/apache/phoenix/forks","keys_url":"https://api.github.com/repos/apache/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/phoenix/teams","hooks_url":"https://api.github.com/repos/apache/phoenix/hooks","issue_events_url":"https://api.github.com/repos/apache/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/apache/phoenix/events","assignees_url":"https://api.github.com/repos/apache/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/apache/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/apache/phoenix/tags","blobs_url":"https://api.github.com/repos/apache/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/phoenix/languages","stargazers_url":"https://api.github.com/repos/apache/phoenix/stargazers","contributors_url":"https://api.github.com/repos/apache/phoenix/contributors","subscribers_url":"https://api.github.com/repos/apache/phoenix/subscribers","subscription_url":"https://api.github.com/repos/apache/phoenix/subscription","commits_url":"https://api.github.com/repos/apache/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/apache/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/phoenix/merges","archive_url":"https://api.github.com/repos/apache/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/phoenix/downloads","issues_url":"https://api.github.com/repos/apache/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/apache/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/apache/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/apache/phoenix/deployments","created_at":"2014-06-04T07:00:08Z","updated_at":"2018-10-16T15:54:16Z","pushed_at":"2018-10-16T19:21:31Z","git_url":"git://github.com/apache/phoenix.git","ssh_url":"git@github.com:apache/phoenix.git","clone_url":"https://github.com/apache/phoenix.git","svn_url":"https://github.com/apache/phoenix","homepage":null,"size":47325,"stargazers_count":533,"watchers_count":533,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":647,"mirror_url":null,"archived":false,"open_issues_count":174,"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":647,"open_issues":174,"watchers":533,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/phoenix/pulls/359"},"html":{"href":"https://github.com/apache/phoenix/pull/359"},"issue":{"href":"https://api.github.com/repos/apache/phoenix/issues/359"},"comments":{"href":"https://api.github.com/repos/apache/phoenix/issues/359/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/phoenix/pulls/359/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/phoenix/pulls/359/commits"},"statuses":{"href":"https://api.github.com/repos/apache/phoenix/statuses/3971e961a07206be7408fd76184122810d7eb3b4"}},"author_association":"NONE"}}
{"actor":{"display_login":"karanmehta93"}}