{"action":"created","comment":{"url":"https://api.github.com/repos/citusdata/citus/pulls/comments/126476092","pull_request_review_id":48956776,"id":126476092,"diff_hunk":"@@ -0,0 +1,52 @@\n+/*\n+ * distributed_transaction_management.h\n+ *\n+ * Copyright (c) 2016, Citus Data, Inc.\n+ *\n+ *-------------------------------------------------------------------------\n+ */\n+\n+#ifndef DISTRIBUTED_TRANSACTION_MANAGEMENT_H_\n+#define DISTRIBUTED_TRANSACTION_MANAGEMENT_H_\n+\n+\n+#include \"datatype/timestamp.h\"\n+#include \"nodes/pg_list.h\"\n+\n+\n+/*\n+ * Citus identifies a distributed transaction with a triplet consisting of\n+ *\n+ *  -  initiatorNodeIdentifier: A unique identifier of the node that initiated\n+ *     the distributed transaction\n+ *  -  transactionId: A locally unique identifier assigned for the distributed\n+ *     transaction on the node that initiated the distributed transaction\n+ *  -  timestamp: The current timestamp of distributed transaction initiation\n+ *\n+ */\n+typedef struct DistributedTransactionId\n+{\n+\tuint64 initiatorNodeIdentifier;\n+\tuint64 transactionId;\n+\tTimestampTz timestamp;\n+} DistributedTransactionId;\n+\n+\n+/*\n+ * Each backend's active distributed transaction information is tracked via\n+ * DistributedTransactionBackendData on the shared memory.\n+ */\n+typedef struct DistributedTransactionBackendData\n+{\n+\tOid databaseId;\n+\tDistributedTransactionId transactionId;\n+} DistributedTransactionBackendData;\n+\n+","path":"src/include/distributed/distributed_transaction_management.h","position":45,"original_position":45,"commit_id":"ce4377ddf0ef9ba935a9936401bc616a34869cd6","original_commit_id":"ce4377ddf0ef9ba935a9936401bc616a34869cd6","user":{"login":"anarazel","id":1598211,"avatar_url":"https://avatars2.githubusercontent.com/u/1598211?v=3","gravatar_id":"","url":"https://api.github.com/users/anarazel","html_url":"https://github.com/anarazel","followers_url":"https://api.github.com/users/anarazel/followers","following_url":"https://api.github.com/users/anarazel/following{/other_user}","gists_url":"https://api.github.com/users/anarazel/gists{/gist_id}","starred_url":"https://api.github.com/users/anarazel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anarazel/subscriptions","organizations_url":"https://api.github.com/users/anarazel/orgs","repos_url":"https://api.github.com/users/anarazel/repos","events_url":"https://api.github.com/users/anarazel/events{/privacy}","received_events_url":"https://api.github.com/users/anarazel/received_events","type":"User","site_admin":false},"body":"I think I'd rather move these structs to a field like 'DistBackendData' or such, and in a similarly named file. We'll have to extend the data stored here pretty soon (within the deadlock detection project, to emit useful error messages), and we shouldn't have parallel arrays for that.","created_at":"2017-07-10T16:45:50Z","updated_at":"2017-07-10T16:45:53Z","html_url":"https://github.com/citusdata/citus/pull/1489#discussion_r126476092","pull_request_url":"https://api.github.com/repos/citusdata/citus/pulls/1489","_links":{"self":{"href":"https://api.github.com/repos/citusdata/citus/pulls/comments/126476092"},"html":{"href":"https://github.com/citusdata/citus/pull/1489#discussion_r126476092"},"pull_request":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1489"}}},"pull_request":{"url":"https://api.github.com/repos/citusdata/citus/pulls/1489","id":129679040,"html_url":"https://github.com/citusdata/citus/pull/1489","diff_url":"https://github.com/citusdata/citus/pull/1489.diff","patch_url":"https://github.com/citusdata/citus/pull/1489.patch","issue_url":"https://api.github.com/repos/citusdata/citus/issues/1489","number":1489,"state":"open","locked":false,"title":"Introduce distributed transaction ids","user":{"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},"body":"This PR adds distributed transaction id infrastructure in the scope of #1394.\r\n\r\nIn general, the distributed transaction id consists of a tuple in the form of: `(databaseId, initiatorNodeIdentifier, transactionId, timestamp)`.\r\n\r\nBriefly, we add a shared memory block on each node, which holds distributed transaction ids per backend (i.e., an array `DistributedTransactionBackendData[MaxBackends]`). Later, on each coordinated transaction, Citus sends `SELECT assign_distributed_transaction_id()` right after `BEGIN`. For that backend on the worker, the distributed transaction id is set to the values assigned via the function call.\r\n\r\nSome open questions in mind:\r\n* Shall we call `UnSetDistributedTransactionId()` on `PREPARE TRANSACTION`? Probably not?\r\n    * I don't see any problems with `2PC` apart from the above question. Does anyone see?\r\n* How are we going to detect deadlocks that are formed without coordinated transactions? (given that we do not set transaction ids for those transactions.)\r\n\r\n","created_at":"2017-07-10T13:29:01Z","updated_at":"2017-07-10T16:45:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"131e4bf8b58816598c90daeab8e93688ea54ac99","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/citusdata/citus/pulls/1489/commits","review_comments_url":"https://api.github.com/repos/citusdata/citus/pulls/1489/comments","review_comment_url":"https://api.github.com/repos/citusdata/citus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/citusdata/citus/issues/1489/comments","statuses_url":"https://api.github.com/repos/citusdata/citus/statuses/ce4377ddf0ef9ba935a9936401bc616a34869cd6","head":{"label":"citusdata:add_distributed_transaction_id","ref":"add_distributed_transaction_id","sha":"ce4377ddf0ef9ba935a9936401bc616a34869cd6","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-09T14:51:04Z","pushed_at":"2017-07-10T16:27:15Z","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":7083,"stargazers_count":2114,"watchers_count":2114,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":456,"forks":149,"open_issues":456,"watchers":2114,"default_branch":"master"}},"base":{"label":"citusdata:master","ref":"master","sha":"d6d88efc2db2ea48ed2f46bdac2f04076acd45d2","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-09T14:51:04Z","pushed_at":"2017-07-10T16:27:15Z","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":7083,"stargazers_count":2114,"watchers_count":2114,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":456,"forks":149,"open_issues":456,"watchers":2114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1489"},"html":{"href":"https://github.com/citusdata/citus/pull/1489"},"issue":{"href":"https://api.github.com/repos/citusdata/citus/issues/1489"},"comments":{"href":"https://api.github.com/repos/citusdata/citus/issues/1489/comments"},"review_comments":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1489/comments"},"review_comment":{"href":"https://api.github.com/repos/citusdata/citus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/citusdata/citus/pulls/1489/commits"},"statuses":{"href":"https://api.github.com/repos/citusdata/citus/statuses/ce4377ddf0ef9ba935a9936401bc616a34869cd6"}}}}
{"actor":{"display_login":"anarazel"}}