{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/633","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/633/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/633/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/633/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/633","id":82541989,"number":633,"title":"Inaccessible `transaction.rollback`","user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/datastore","name":"datastore","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-29T18:49:42Z","updated_at":"2015-11-30T17:13:53Z","closed_at":null,"body":"From https://github.com/GoogleCloudPlatform/gcloud-node/pull/627/files#r31352472\r\n\r\n##### Question 1\r\n\r\nA rollback can only be done on a transaction that has been committed (I think?), but that's a problem:\r\n\r\n```js\r\ndataset.runInTransaction(function(transaction, commit) {\r\n  commit();\r\n}, function(err) {\r\n  // no `transaction` here to call `rollback` on.\r\n});\r\n```\r\n\r\nAn option would be to remove the last callback.\r\n\r\n```js\r\ndataset.runInTransaction(function(transaction, commit) {\r\n  commit(function(err) {\r\n    if (err) {\r\n      transaction.rollback();\r\n    }\r\n  });\r\n});\r\n```\r\n\r\n##### Question 2\r\nIs there a use case for rolling back a transaction that wasn't just created? We currently don't support this.\r\n"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/160693252","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/633#issuecomment-160693252","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/633","id":160693252,"user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T17:13:52Z","updated_at":"2015-11-30T17:13:52Z","body":"@callmehiphop any thoughts on this idea?"}}