{"action":"created","comment":{"url":"https://api.github.com/repos/confluentinc/ksql/pulls/comments/165759296","pull_request_review_id":93755816,"id":165759296,"diff_hunk":"@@ -463,15 +477,17 @@ public DDLCommandExec getDDLCommandExec() {\n \n   @Override\n   public boolean terminateQuery(final QueryId queryId, final boolean closeStreams) {\n-    QueryMetadata queryMetadata = persistentQueries.remove(queryId);\n-    if (queryMetadata == null) {\n+    PersistentQueryMetadata persistentQueryMetadata = persistentQueries.remove(queryId);\n+    if (persistentQueryMetadata == null) {\n       return false;\n     }\n-    livePersistentQueries.remove(queryMetadata);\n-    allLiveQueries.remove(queryMetadata);\n+    livePersistentQueries.remove(persistentQueryMetadata);\n+    allLiveQueries.remove(persistentQueryMetadata);\n     if (closeStreams) {\n-      queryMetadata.close();\n+      persistentQueryMetadata.close();\n     }\n+    metaStore.removeQueryFromReferentialIntegrityTable(","path":"ksql-engine/src/main/java/io/confluent/ksql/KsqlEngine.java","position":115,"original_position":115,"commit_id":"8bde59c6ba3ac4a55a0d7998d411b73c83e3bf4d","original_commit_id":"8bde59c6ba3ac4a55a0d7998d411b73c83e3bf4d","user":{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false},"body":"Yes, we still can remove the query. I moved the line above the stream close method.","created_at":"2018-02-02T21:04:00Z","updated_at":"2018-02-02T21:04:00Z","html_url":"https://github.com/confluentinc/ksql/pull/652#discussion_r165759296","pull_request_url":"https://api.github.com/repos/confluentinc/ksql/pulls/652","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/comments/165759296"},"html":{"href":"https://github.com/confluentinc/ksql/pull/652#discussion_r165759296"},"pull_request":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/652"}},"in_reply_to_id":165630124},"pull_request":{"url":"https://api.github.com/repos/confluentinc/ksql/pulls/652","id":164714308,"html_url":"https://github.com/confluentinc/ksql/pull/652","diff_url":"https://github.com/confluentinc/ksql/pull/652.diff","patch_url":"https://github.com/confluentinc/ksql/pull/652.patch","issue_url":"https://api.github.com/repos/confluentinc/ksql/issues/652","number":652,"state":"open","locked":false,"title":"Added referential integration enforcement for streams/tables and quer…","user":{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false},"body":"…ies.\r\nThis PR adds referential integrity for streams/tables and queries. A stream or table will not be dropped if at least one query reading from or writing into it. In order to drop a stream/table all the queries that read from or write into the stream/table should be terminated first.","created_at":"2018-01-23T23:04:08Z","updated_at":"2018-02-02T21:04:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"968c78d2afb90a973d0f9b8ae1c4db1ad6db748b","assignee":{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false},"assignees":[{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"apurvam","id":830220,"avatar_url":"https://avatars0.githubusercontent.com/u/830220?v=4","gravatar_id":"","url":"https://api.github.com/users/apurvam","html_url":"https://github.com/apurvam","followers_url":"https://api.github.com/users/apurvam/followers","following_url":"https://api.github.com/users/apurvam/following{/other_user}","gists_url":"https://api.github.com/users/apurvam/gists{/gist_id}","starred_url":"https://api.github.com/users/apurvam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apurvam/subscriptions","organizations_url":"https://api.github.com/users/apurvam/orgs","repos_url":"https://api.github.com/users/apurvam/repos","events_url":"https://api.github.com/users/apurvam/events{/privacy}","received_events_url":"https://api.github.com/users/apurvam/received_events","type":"User","site_admin":false},{"login":"bluemonk3y","id":10532006,"avatar_url":"https://avatars3.githubusercontent.com/u/10532006?v=4","gravatar_id":"","url":"https://api.github.com/users/bluemonk3y","html_url":"https://github.com/bluemonk3y","followers_url":"https://api.github.com/users/bluemonk3y/followers","following_url":"https://api.github.com/users/bluemonk3y/following{/other_user}","gists_url":"https://api.github.com/users/bluemonk3y/gists{/gist_id}","starred_url":"https://api.github.com/users/bluemonk3y/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluemonk3y/subscriptions","organizations_url":"https://api.github.com/users/bluemonk3y/orgs","repos_url":"https://api.github.com/users/bluemonk3y/repos","events_url":"https://api.github.com/users/bluemonk3y/events{/privacy}","received_events_url":"https://api.github.com/users/bluemonk3y/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/confluentinc/ksql/pulls/652/commits","review_comments_url":"https://api.github.com/repos/confluentinc/ksql/pulls/652/comments","review_comment_url":"https://api.github.com/repos/confluentinc/ksql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/confluentinc/ksql/issues/652/comments","statuses_url":"https://api.github.com/repos/confluentinc/ksql/statuses/8bde59c6ba3ac4a55a0d7998d411b73c83e3bf4d","head":{"label":"hjafarpour:KSQL-509-Ensure-Referential-Integrity-For-Queries-and-Sources","ref":"KSQL-509-Ensure-Referential-Integrity-For-Queries-and-Sources","sha":"8bde59c6ba3ac4a55a0d7998d411b73c83e3bf4d","user":{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false},"repo":{"id":102027996,"name":"ksql","full_name":"hjafarpour/ksql","owner":{"login":"hjafarpour","id":16784742,"avatar_url":"https://avatars3.githubusercontent.com/u/16784742?v=4","gravatar_id":"","url":"https://api.github.com/users/hjafarpour","html_url":"https://github.com/hjafarpour","followers_url":"https://api.github.com/users/hjafarpour/followers","following_url":"https://api.github.com/users/hjafarpour/following{/other_user}","gists_url":"https://api.github.com/users/hjafarpour/gists{/gist_id}","starred_url":"https://api.github.com/users/hjafarpour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjafarpour/subscriptions","organizations_url":"https://api.github.com/users/hjafarpour/orgs","repos_url":"https://api.github.com/users/hjafarpour/repos","events_url":"https://api.github.com/users/hjafarpour/events{/privacy}","received_events_url":"https://api.github.com/users/hjafarpour/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hjafarpour/ksql","description":"KSQL - a Streaming SQL Engine for Apache Kafka ","fork":true,"url":"https://api.github.com/repos/hjafarpour/ksql","forks_url":"https://api.github.com/repos/hjafarpour/ksql/forks","keys_url":"https://api.github.com/repos/hjafarpour/ksql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hjafarpour/ksql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hjafarpour/ksql/teams","hooks_url":"https://api.github.com/repos/hjafarpour/ksql/hooks","issue_events_url":"https://api.github.com/repos/hjafarpour/ksql/issues/events{/number}","events_url":"https://api.github.com/repos/hjafarpour/ksql/events","assignees_url":"https://api.github.com/repos/hjafarpour/ksql/assignees{/user}","branches_url":"https://api.github.com/repos/hjafarpour/ksql/branches{/branch}","tags_url":"https://api.github.com/repos/hjafarpour/ksql/tags","blobs_url":"https://api.github.com/repos/hjafarpour/ksql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hjafarpour/ksql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hjafarpour/ksql/git/refs{/sha}","trees_url":"https://api.github.com/repos/hjafarpour/ksql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hjafarpour/ksql/statuses/{sha}","languages_url":"https://api.github.com/repos/hjafarpour/ksql/languages","stargazers_url":"https://api.github.com/repos/hjafarpour/ksql/stargazers","contributors_url":"https://api.github.com/repos/hjafarpour/ksql/contributors","subscribers_url":"https://api.github.com/repos/hjafarpour/ksql/subscribers","subscription_url":"https://api.github.com/repos/hjafarpour/ksql/subscription","commits_url":"https://api.github.com/repos/hjafarpour/ksql/commits{/sha}","git_commits_url":"https://api.github.com/repos/hjafarpour/ksql/git/commits{/sha}","comments_url":"https://api.github.com/repos/hjafarpour/ksql/comments{/number}","issue_comment_url":"https://api.github.com/repos/hjafarpour/ksql/issues/comments{/number}","contents_url":"https://api.github.com/repos/hjafarpour/ksql/contents/{+path}","compare_url":"https://api.github.com/repos/hjafarpour/ksql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hjafarpour/ksql/merges","archive_url":"https://api.github.com/repos/hjafarpour/ksql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hjafarpour/ksql/downloads","issues_url":"https://api.github.com/repos/hjafarpour/ksql/issues{/number}","pulls_url":"https://api.github.com/repos/hjafarpour/ksql/pulls{/number}","milestones_url":"https://api.github.com/repos/hjafarpour/ksql/milestones{/number}","notifications_url":"https://api.github.com/repos/hjafarpour/ksql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hjafarpour/ksql/labels{/name}","releases_url":"https://api.github.com/repos/hjafarpour/ksql/releases{/id}","deployments_url":"https://api.github.com/repos/hjafarpour/ksql/deployments","created_at":"2017-08-31T17:43:25Z","updated_at":"2017-08-31T18:12:01Z","pushed_at":"2018-02-02T20:50:10Z","git_url":"git://github.com/hjafarpour/ksql.git","ssh_url":"git@github.com:hjafarpour/ksql.git","clone_url":"https://github.com/hjafarpour/ksql.git","svn_url":"https://github.com/hjafarpour/ksql","homepage":"","size":6289,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"0.1.x"}},"base":{"label":"confluentinc:master","ref":"master","sha":"0238cab2c839385017a056ce027e4997974de6ef","user":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"repo":{"id":69400326,"name":"ksql","full_name":"confluentinc/ksql","owner":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/confluentinc/ksql","description":"KSQL - the Streaming SQL Engine for Apache Kafka ","fork":false,"url":"https://api.github.com/repos/confluentinc/ksql","forks_url":"https://api.github.com/repos/confluentinc/ksql/forks","keys_url":"https://api.github.com/repos/confluentinc/ksql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/confluentinc/ksql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/confluentinc/ksql/teams","hooks_url":"https://api.github.com/repos/confluentinc/ksql/hooks","issue_events_url":"https://api.github.com/repos/confluentinc/ksql/issues/events{/number}","events_url":"https://api.github.com/repos/confluentinc/ksql/events","assignees_url":"https://api.github.com/repos/confluentinc/ksql/assignees{/user}","branches_url":"https://api.github.com/repos/confluentinc/ksql/branches{/branch}","tags_url":"https://api.github.com/repos/confluentinc/ksql/tags","blobs_url":"https://api.github.com/repos/confluentinc/ksql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/confluentinc/ksql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/confluentinc/ksql/git/refs{/sha}","trees_url":"https://api.github.com/repos/confluentinc/ksql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/confluentinc/ksql/statuses/{sha}","languages_url":"https://api.github.com/repos/confluentinc/ksql/languages","stargazers_url":"https://api.github.com/repos/confluentinc/ksql/stargazers","contributors_url":"https://api.github.com/repos/confluentinc/ksql/contributors","subscribers_url":"https://api.github.com/repos/confluentinc/ksql/subscribers","subscription_url":"https://api.github.com/repos/confluentinc/ksql/subscription","commits_url":"https://api.github.com/repos/confluentinc/ksql/commits{/sha}","git_commits_url":"https://api.github.com/repos/confluentinc/ksql/git/commits{/sha}","comments_url":"https://api.github.com/repos/confluentinc/ksql/comments{/number}","issue_comment_url":"https://api.github.com/repos/confluentinc/ksql/issues/comments{/number}","contents_url":"https://api.github.com/repos/confluentinc/ksql/contents/{+path}","compare_url":"https://api.github.com/repos/confluentinc/ksql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/confluentinc/ksql/merges","archive_url":"https://api.github.com/repos/confluentinc/ksql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/confluentinc/ksql/downloads","issues_url":"https://api.github.com/repos/confluentinc/ksql/issues{/number}","pulls_url":"https://api.github.com/repos/confluentinc/ksql/pulls{/number}","milestones_url":"https://api.github.com/repos/confluentinc/ksql/milestones{/number}","notifications_url":"https://api.github.com/repos/confluentinc/ksql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/confluentinc/ksql/labels{/name}","releases_url":"https://api.github.com/repos/confluentinc/ksql/releases{/id}","deployments_url":"https://api.github.com/repos/confluentinc/ksql/deployments","created_at":"2016-09-27T21:30:15Z","updated_at":"2018-02-02T18:07:57Z","pushed_at":"2018-02-02T20:50:12Z","git_url":"git://github.com/confluentinc/ksql.git","ssh_url":"git@github.com:confluentinc/ksql.git","clone_url":"https://github.com/confluentinc/ksql.git","svn_url":"https://github.com/confluentinc/ksql","homepage":"","size":5767,"stargazers_count":1314,"watchers_count":1314,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":238,"mirror_url":null,"archived":false,"open_issues_count":125,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":238,"open_issues":125,"watchers":1314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/652"},"html":{"href":"https://github.com/confluentinc/ksql/pull/652"},"issue":{"href":"https://api.github.com/repos/confluentinc/ksql/issues/652"},"comments":{"href":"https://api.github.com/repos/confluentinc/ksql/issues/652/comments"},"review_comments":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/652/comments"},"review_comment":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/652/commits"},"statuses":{"href":"https://api.github.com/repos/confluentinc/ksql/statuses/8bde59c6ba3ac4a55a0d7998d411b73c83e3bf4d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"hjafarpour"}}