{"action":"created","comment":{"url":"https://api.github.com/repos/citusdata/citus/pulls/comments/126173389","pull_request_review_id":48636496,"id":126173389,"diff_hunk":"@@ -383,16 +381,29 @@ ORDER BY nodeport;\n  localhost |    57638 | t       | DROP FUNCTION\n (2 rows)\n \n--- ALTER TABLE and COPY are compatible if ALTER TABLE precedes COPY\n+-- ALTER and copy are compatible\n BEGIN;\n ALTER TABLE labs ADD COLUMN motto text;\n \\copy labs from stdin delimiter ','\n ROLLBACK;\n--- but not if COPY precedes ALTER TABLE\n BEGIN;\n \\copy labs from stdin delimiter ','\n ALTER TABLE labs ADD COLUMN motto text;\n-ERROR:  distributed DDL commands must not appear within transaction blocks containing single-shard data modifications\n+ABORT;\n+-- cannot perform DDL once a connection is used for multiple shards\n+BEGIN;","path":"src/test/regress/expected/multi_modifying_xacts.out","position":48,"original_position":39,"commit_id":"17fc29d861e005ecefb4c455bfb20337ee41cc6c","original_commit_id":"e85c3bfcb5d0921dac87091c0be46f8214e6f2eb","user":{"login":"marcocitus","id":7127240,"avatar_url":"https://avatars1.githubusercontent.com/u/7127240?v=3","gravatar_id":"","url":"https://api.github.com/users/marcocitus","html_url":"https://github.com/marcocitus","followers_url":"https://api.github.com/users/marcocitus/followers","following_url":"https://api.github.com/users/marcocitus/following{/other_user}","gists_url":"https://api.github.com/users/marcocitus/gists{/gist_id}","starred_url":"https://api.github.com/users/marcocitus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcocitus/subscriptions","organizations_url":"https://api.github.com/users/marcocitus/orgs","repos_url":"https://api.github.com/users/marcocitus/repos","events_url":"https://api.github.com/users/marcocitus/events{/privacy}","received_events_url":"https://api.github.com/users/marcocitus/received_events","type":"User","site_admin":false},"body":"True, I'm increasingly convinced we need to fix #1482 soon.","created_at":"2017-07-07T15:19:44Z","updated_at":"2017-07-07T15:19:44Z","html_url":"https://github.com/citusdata/citus/pull/1455#discussion_r126173389","pull_request_url":"https://api.github.com/repos/citusdata/citus/pulls/1455","_links":{"self":{"href":"https://api.github.com/repos/citusdata/citus/pulls/comments/126173389"},"html":{"href":"https://github.com/citusdata/citus/pull/1455#discussion_r126173389"},"pull_request":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1455"}}},"pull_request":{"url":"https://api.github.com/repos/citusdata/citus/pulls/1455","id":126015077,"html_url":"https://github.com/citusdata/citus/pull/1455","diff_url":"https://github.com/citusdata/citus/pull/1455.diff","patch_url":"https://github.com/citusdata/citus/pull/1455.patch","issue_url":"https://api.github.com/repos/citusdata/citus/issues/1455","number":1455,"state":"open","locked":false,"title":"Rework connection API to remove transaction restrictions","user":{"login":"marcocitus","id":7127240,"avatar_url":"https://avatars1.githubusercontent.com/u/7127240?v=3","gravatar_id":"","url":"https://api.github.com/users/marcocitus","html_url":"https://github.com/marcocitus","followers_url":"https://api.github.com/users/marcocitus/followers","following_url":"https://api.github.com/users/marcocitus/following{/other_user}","gists_url":"https://api.github.com/users/marcocitus/gists{/gist_id}","starred_url":"https://api.github.com/users/marcocitus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcocitus/subscriptions","organizations_url":"https://api.github.com/users/marcocitus/orgs","repos_url":"https://api.github.com/users/marcocitus/repos","events_url":"https://api.github.com/users/marcocitus/events{/privacy}","received_events_url":"https://api.github.com/users/marcocitus/received_events","type":"User","site_admin":false},"body":"This PR introduces a `GetPlacementListConnection` function that can be used to reliably get a connection for a query that accesses more than one placement. `GetPlacementListConnection` takes a `ShardPlacementAccess` list which contains the placement and the operation to perform (SELECT, DML, DDL).\r\n\r\n`GetPlacementListConnection` will error out if: \r\n- A placement (or one of its co-located placements) was modified over a connection that cannot be used. This is typically due to DML+DDL because the DDL executor might open a connection for the first shard, claim it exclusively, and then it turns out it actually needs it for the second shard.\r\n- A placement (or one of its co-located placements) was read over a connection that cannot be used and we are about to perform DDL on it. This is typically due to performing DDL on a reference table after a join with a distributed table.\r\n- Placements (or co-located placements) in the access list were modified over more than one connection. This is typically due to joining a distributed table with a reference  table after modifying both.\r\n\r\nOtherwise, `GetPlacementListConnection` returns:\r\n- A connection that previously modified one or more of the placements in the access list, or one of their co-located placements.\r\n- or, an (arbitrary) connection that previously read from one of the placements\r\n- or, the cached connection to the node\r\n- or, a new connection to the node\r\n\r\nThe router executor uses `GetPlacementListConnection` for both single-shard (mainly relevant for SELECT), and multi-shard (mainly relevant for INSERT ... SELECT) queries. It should be trivial to extend this to UPDATE/DELETE with SELECT. \r\n\r\nThe PR also removes the distinction between `XACT_MODIFICATION_DATA` and `XACT_MODIFICATION_MULTI_SHARD`, which was still necessary due to issues that arise when using reference tables and distributed tables in the same transaction.\r\n\r\nTo simplify the code, I removed the notion of `connectionReferences` and replaced it with a `hasSecondaryConnections` flag that indicates whether any additional connections read from a placement.\r\n\r\nThis still needs a few more regression tests to test new capabilities.\r\n\r\nFixes #1442\r\nFixes #1107 \r\nFixes #965 ","created_at":"2017-06-16T11:38:32Z","updated_at":"2017-07-07T15:19:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"633f038233d7ba198f79593061f809b89f8945d7","assignee":{"login":"onderkalaci","id":7829470,"avatar_url":"https://avatars1.githubusercontent.com/u/7829470?v=3","gravatar_id":"","url":"https://api.github.com/users/onderkalaci","html_url":"https://github.com/onderkalaci","followers_url":"https://api.github.com/users/onderkalaci/followers","following_url":"https://api.github.com/users/onderkalaci/following{/other_user}","gists_url":"https://api.github.com/users/onderkalaci/gists{/gist_id}","starred_url":"https://api.github.com/users/onderkalaci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onderkalaci/subscriptions","organizations_url":"https://api.github.com/users/onderkalaci/orgs","repos_url":"https://api.github.com/users/onderkalaci/repos","events_url":"https://api.github.com/users/onderkalaci/events{/privacy}","received_events_url":"https://api.github.com/users/onderkalaci/received_events","type":"User","site_admin":false},"assignees":[{"login":"onderkalaci","id":7829470,"avatar_url":"https://avatars1.githubusercontent.com/u/7829470?v=3","gravatar_id":"","url":"https://api.github.com/users/onderkalaci","html_url":"https://github.com/onderkalaci","followers_url":"https://api.github.com/users/onderkalaci/followers","following_url":"https://api.github.com/users/onderkalaci/following{/other_user}","gists_url":"https://api.github.com/users/onderkalaci/gists{/gist_id}","starred_url":"https://api.github.com/users/onderkalaci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onderkalaci/subscriptions","organizations_url":"https://api.github.com/users/onderkalaci/orgs","repos_url":"https://api.github.com/users/onderkalaci/repos","events_url":"https://api.github.com/users/onderkalaci/events{/privacy}","received_events_url":"https://api.github.com/users/onderkalaci/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/citusdata/citus/pulls/1455/commits","review_comments_url":"https://api.github.com/repos/citusdata/citus/pulls/1455/comments","review_comment_url":"https://api.github.com/repos/citusdata/citus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/citusdata/citus/issues/1455/comments","statuses_url":"https://api.github.com/repos/citusdata/citus/statuses/17fc29d861e005ecefb4c455bfb20337ee41cc6c","head":{"label":"citusdata:join_xact_modification_levels","ref":"join_xact_modification_levels","sha":"17fc29d861e005ecefb4c455bfb20337ee41cc6c","user":{"login":"citusdata","id":2545424,"avatar_url":"https://avatars1.githubusercontent.com/u/2545424?v=3","gravatar_id":"","url":"https://api.github.com/users/citusdata","html_url":"https://github.com/citusdata","followers_url":"https://api.github.com/users/citusdata/followers","following_url":"https://api.github.com/users/citusdata/following{/other_user}","gists_url":"https://api.github.com/users/citusdata/gists{/gist_id}","starred_url":"https://api.github.com/users/citusdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citusdata/subscriptions","organizations_url":"https://api.github.com/users/citusdata/orgs","repos_url":"https://api.github.com/users/citusdata/repos","events_url":"https://api.github.com/users/citusdata/events{/privacy}","received_events_url":"https://api.github.com/users/citusdata/received_events","type":"Organization","site_admin":false},"repo":{"id":50874442,"name":"citus","full_name":"citusdata/citus","owner":{"login":"citusdata","id":2545424,"avatar_url":"https://avatars1.githubusercontent.com/u/2545424?v=3","gravatar_id":"","url":"https://api.github.com/users/citusdata","html_url":"https://github.com/citusdata","followers_url":"https://api.github.com/users/citusdata/followers","following_url":"https://api.github.com/users/citusdata/following{/other_user}","gists_url":"https://api.github.com/users/citusdata/gists{/gist_id}","starred_url":"https://api.github.com/users/citusdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citusdata/subscriptions","organizations_url":"https://api.github.com/users/citusdata/orgs","repos_url":"https://api.github.com/users/citusdata/repos","events_url":"https://api.github.com/users/citusdata/events{/privacy}","received_events_url":"https://api.github.com/users/citusdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/citusdata/citus","description":"Scalable PostgreSQL for multi-tenant and real-time workloads","fork":false,"url":"https://api.github.com/repos/citusdata/citus","forks_url":"https://api.github.com/repos/citusdata/citus/forks","keys_url":"https://api.github.com/repos/citusdata/citus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/citusdata/citus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/citusdata/citus/teams","hooks_url":"https://api.github.com/repos/citusdata/citus/hooks","issue_events_url":"https://api.github.com/repos/citusdata/citus/issues/events{/number}","events_url":"https://api.github.com/repos/citusdata/citus/events","assignees_url":"https://api.github.com/repos/citusdata/citus/assignees{/user}","branches_url":"https://api.github.com/repos/citusdata/citus/branches{/branch}","tags_url":"https://api.github.com/repos/citusdata/citus/tags","blobs_url":"https://api.github.com/repos/citusdata/citus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/citusdata/citus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/citusdata/citus/git/refs{/sha}","trees_url":"https://api.github.com/repos/citusdata/citus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/citusdata/citus/statuses/{sha}","languages_url":"https://api.github.com/repos/citusdata/citus/languages","stargazers_url":"https://api.github.com/repos/citusdata/citus/stargazers","contributors_url":"https://api.github.com/repos/citusdata/citus/contributors","subscribers_url":"https://api.github.com/repos/citusdata/citus/subscribers","subscription_url":"https://api.github.com/repos/citusdata/citus/subscription","commits_url":"https://api.github.com/repos/citusdata/citus/commits{/sha}","git_commits_url":"https://api.github.com/repos/citusdata/citus/git/commits{/sha}","comments_url":"https://api.github.com/repos/citusdata/citus/comments{/number}","issue_comment_url":"https://api.github.com/repos/citusdata/citus/issues/comments{/number}","contents_url":"https://api.github.com/repos/citusdata/citus/contents/{+path}","compare_url":"https://api.github.com/repos/citusdata/citus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/citusdata/citus/merges","archive_url":"https://api.github.com/repos/citusdata/citus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/citusdata/citus/downloads","issues_url":"https://api.github.com/repos/citusdata/citus/issues{/number}","pulls_url":"https://api.github.com/repos/citusdata/citus/pulls{/number}","milestones_url":"https://api.github.com/repos/citusdata/citus/milestones{/number}","notifications_url":"https://api.github.com/repos/citusdata/citus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/citusdata/citus/labels{/name}","releases_url":"https://api.github.com/repos/citusdata/citus/releases{/id}","deployments_url":"https://api.github.com/repos/citusdata/citus/deployments","created_at":"2016-02-01T21:58:39Z","updated_at":"2017-07-07T12:09:41Z","pushed_at":"2017-07-07T15:12:42Z","git_url":"git://github.com/citusdata/citus.git","ssh_url":"git@github.com:citusdata/citus.git","clone_url":"https://github.com/citusdata/citus.git","svn_url":"https://github.com/citusdata/citus","homepage":"https://www.citusdata.com","size":7063,"stargazers_count":2111,"watchers_count":2111,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":455,"forks":148,"open_issues":455,"watchers":2111,"default_branch":"master"}},"base":{"label":"citusdata:master","ref":"master","sha":"2a4eada150417065c80e9e0665b6316baa843039","user":{"login":"citusdata","id":2545424,"avatar_url":"https://avatars1.githubusercontent.com/u/2545424?v=3","gravatar_id":"","url":"https://api.github.com/users/citusdata","html_url":"https://github.com/citusdata","followers_url":"https://api.github.com/users/citusdata/followers","following_url":"https://api.github.com/users/citusdata/following{/other_user}","gists_url":"https://api.github.com/users/citusdata/gists{/gist_id}","starred_url":"https://api.github.com/users/citusdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citusdata/subscriptions","organizations_url":"https://api.github.com/users/citusdata/orgs","repos_url":"https://api.github.com/users/citusdata/repos","events_url":"https://api.github.com/users/citusdata/events{/privacy}","received_events_url":"https://api.github.com/users/citusdata/received_events","type":"Organization","site_admin":false},"repo":{"id":50874442,"name":"citus","full_name":"citusdata/citus","owner":{"login":"citusdata","id":2545424,"avatar_url":"https://avatars1.githubusercontent.com/u/2545424?v=3","gravatar_id":"","url":"https://api.github.com/users/citusdata","html_url":"https://github.com/citusdata","followers_url":"https://api.github.com/users/citusdata/followers","following_url":"https://api.github.com/users/citusdata/following{/other_user}","gists_url":"https://api.github.com/users/citusdata/gists{/gist_id}","starred_url":"https://api.github.com/users/citusdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citusdata/subscriptions","organizations_url":"https://api.github.com/users/citusdata/orgs","repos_url":"https://api.github.com/users/citusdata/repos","events_url":"https://api.github.com/users/citusdata/events{/privacy}","received_events_url":"https://api.github.com/users/citusdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/citusdata/citus","description":"Scalable PostgreSQL for multi-tenant and real-time workloads","fork":false,"url":"https://api.github.com/repos/citusdata/citus","forks_url":"https://api.github.com/repos/citusdata/citus/forks","keys_url":"https://api.github.com/repos/citusdata/citus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/citusdata/citus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/citusdata/citus/teams","hooks_url":"https://api.github.com/repos/citusdata/citus/hooks","issue_events_url":"https://api.github.com/repos/citusdata/citus/issues/events{/number}","events_url":"https://api.github.com/repos/citusdata/citus/events","assignees_url":"https://api.github.com/repos/citusdata/citus/assignees{/user}","branches_url":"https://api.github.com/repos/citusdata/citus/branches{/branch}","tags_url":"https://api.github.com/repos/citusdata/citus/tags","blobs_url":"https://api.github.com/repos/citusdata/citus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/citusdata/citus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/citusdata/citus/git/refs{/sha}","trees_url":"https://api.github.com/repos/citusdata/citus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/citusdata/citus/statuses/{sha}","languages_url":"https://api.github.com/repos/citusdata/citus/languages","stargazers_url":"https://api.github.com/repos/citusdata/citus/stargazers","contributors_url":"https://api.github.com/repos/citusdata/citus/contributors","subscribers_url":"https://api.github.com/repos/citusdata/citus/subscribers","subscription_url":"https://api.github.com/repos/citusdata/citus/subscription","commits_url":"https://api.github.com/repos/citusdata/citus/commits{/sha}","git_commits_url":"https://api.github.com/repos/citusdata/citus/git/commits{/sha}","comments_url":"https://api.github.com/repos/citusdata/citus/comments{/number}","issue_comment_url":"https://api.github.com/repos/citusdata/citus/issues/comments{/number}","contents_url":"https://api.github.com/repos/citusdata/citus/contents/{+path}","compare_url":"https://api.github.com/repos/citusdata/citus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/citusdata/citus/merges","archive_url":"https://api.github.com/repos/citusdata/citus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/citusdata/citus/downloads","issues_url":"https://api.github.com/repos/citusdata/citus/issues{/number}","pulls_url":"https://api.github.com/repos/citusdata/citus/pulls{/number}","milestones_url":"https://api.github.com/repos/citusdata/citus/milestones{/number}","notifications_url":"https://api.github.com/repos/citusdata/citus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/citusdata/citus/labels{/name}","releases_url":"https://api.github.com/repos/citusdata/citus/releases{/id}","deployments_url":"https://api.github.com/repos/citusdata/citus/deployments","created_at":"2016-02-01T21:58:39Z","updated_at":"2017-07-07T12:09:41Z","pushed_at":"2017-07-07T15:12:42Z","git_url":"git://github.com/citusdata/citus.git","ssh_url":"git@github.com:citusdata/citus.git","clone_url":"https://github.com/citusdata/citus.git","svn_url":"https://github.com/citusdata/citus","homepage":"https://www.citusdata.com","size":7063,"stargazers_count":2111,"watchers_count":2111,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":455,"forks":148,"open_issues":455,"watchers":2111,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1455"},"html":{"href":"https://github.com/citusdata/citus/pull/1455"},"issue":{"href":"https://api.github.com/repos/citusdata/citus/issues/1455"},"comments":{"href":"https://api.github.com/repos/citusdata/citus/issues/1455/comments"},"review_comments":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1455/comments"},"review_comment":{"href":"https://api.github.com/repos/citusdata/citus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1455/commits"},"statuses":{"href":"https://api.github.com/repos/citusdata/citus/statuses/17fc29d861e005ecefb4c455bfb20337ee41cc6c"}}}}
{"actor":{"display_login":"marcocitus"}}