{"action":"created","comment":{"url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/comments/91842605","pull_request_review_id":12354183,"id":91842605,"diff_hunk":"@@ -437,67 +437,77 @@ public Table getTable(TableReference tableRef) throws InterruptedException, IOEx\n         (int) TimeUnit.MINUTES.toMillis(5);\n \n     /**\n+     * {@inheritDoc}\n+     *\n      * Tries to create the BigQuery table.\n      * If a table with the same name already exists in the dataset, the table\n      * creation fails.  In such a case,\n      * the existing table doesn't necessarily have the same schema as specified\n      * by the parameter.\n      *\n-     * @param schema Schema of the new BigQuery table.\n      * @throws IOException if other error than already existing table occurs.\n      */\n-    @Nullable\n     @Override\n-    public void createTable(TableReference ref, TableSchema schema) throws IOException {\n-      LOG.info(\"Trying to create BigQuery table: {}\", BigQueryIO.toTableSpec(ref));\n+    public void createTable(Table table) throws IOException, InterruptedException {\n+      LOG.info(\"Trying to create BigQuery table: {}\",\n+          BigQueryIO.toTableSpec(table.getTableReference()));\n       BackOff backoff =\n               new ExponentialBackOff.Builder()\n                       .setMaxElapsedTimeMillis(RETRY_CREATE_TABLE_DURATION_MILLIS)\n                       .build();\n \n-      Table table = new Table().setTableReference(ref).setSchema(schema);\n-      tryCreateTable(table, ref.getProjectId(), ref.getDatasetId(), backoff,\n-          Sleeper.DEFAULT);\n+      tryCreateTable(table, backoff, Sleeper.DEFAULT);\n     }\n \n     @VisibleForTesting\n-    @Nullable\n-    Table tryCreateTable(\n-            Table table, String projectId, String datasetId, BackOff backoff, Sleeper sleeper)\n-            throws IOException {\n-      boolean retry = false;\n-      while (true) {\n+    void tryCreateTable(Table table, BackOff backoff, Sleeper sleeper)\n+        throws IOException, InterruptedException {\n+      Exception lastException;\n+      int retryCount = 0;\n+      boolean logRetryMessage = true;\n+      do {\n         try {\n-          return client.tables().insert(projectId, datasetId, table).execute();\n+          client.tables().insert(\n+              table.getTableReference().getProjectId(),\n+              table.getTableReference().getDatasetId(),\n+              table).execute();\n+          return; // SUCCEEDED\n         } catch (IOException e) {\n-          ApiErrorExtractor extractor = new ApiErrorExtractor();\n-          if (extractor.itemAlreadyExists(e)) {\n-            // The table already exists, nothing to return.\n-            return null;\n-          } else if (extractor.rateLimited(e)) {","path":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java","position":118,"original_position":118,"commit_id":"880abf363686f6fb72f238baac54da2bd0d8efd5","original_commit_id":"880abf363686f6fb72f238baac54da2bd0d8efd5","user":{"login":"peihe","id":10201797,"avatar_url":"https://avatars.githubusercontent.com/u/10201797?v=3","gravatar_id":"","url":"https://api.github.com/users/peihe","html_url":"https://github.com/peihe","followers_url":"https://api.github.com/users/peihe/followers","following_url":"https://api.github.com/users/peihe/following{/other_user}","gists_url":"https://api.github.com/users/peihe/gists{/gist_id}","starred_url":"https://api.github.com/users/peihe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peihe/subscriptions","organizations_url":"https://api.github.com/users/peihe/orgs","repos_url":"https://api.github.com/users/peihe/repos","events_url":"https://api.github.com/users/peihe/events{/privacy}","received_events_url":"https://api.github.com/users/peihe/received_events","type":"User","site_admin":false},"body":"I think it should retry more cases, for example: socket/request time out. So, I would list exceptions that we don't want to retry.","created_at":"2016-12-10T21:16:38Z","updated_at":"2016-12-10T21:22:26Z","html_url":"https://github.com/reuvenlax/incubator-beam/pull/3#discussion_r91842605","pull_request_url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/comments/91842605"},"html":{"href":"https://github.com/reuvenlax/incubator-beam/pull/3#discussion_r91842605"},"pull_request":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3","id":97412467,"html_url":"https://github.com/reuvenlax/incubator-beam/pull/3","diff_url":"https://github.com/reuvenlax/incubator-beam/pull/3.diff","patch_url":"https://github.com/reuvenlax/incubator-beam/pull/3.patch","issue_url":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/3","number":3,"state":"open","locked":false,"title":"Suggested patch for BigQueryServices getTable() and createTable().","user":{"login":"peihe","id":10201797,"avatar_url":"https://avatars.githubusercontent.com/u/10201797?v=3","gravatar_id":"","url":"https://api.github.com/users/peihe","html_url":"https://github.com/peihe","followers_url":"https://api.github.com/users/peihe/followers","following_url":"https://api.github.com/users/peihe/following{/other_user}","gists_url":"https://api.github.com/users/peihe/gists{/gist_id}","starred_url":"https://api.github.com/users/peihe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peihe/subscriptions","organizations_url":"https://api.github.com/users/peihe/orgs","repos_url":"https://api.github.com/users/peihe/repos","events_url":"https://api.github.com/users/peihe/events{/privacy}","received_events_url":"https://api.github.com/users/peihe/received_events","type":"User","site_admin":false},"body":"Removed the duplicated Table getTable(TableReference table).\r\nValidated in createTable() that existing table's schema is same.\r\nFollowing existing pattern for retrying.","created_at":"2016-12-10T04:06:02Z","updated_at":"2016-12-10T21:22:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3/commits","review_comments_url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3/comments","review_comment_url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/3/comments","statuses_url":"https://api.github.com/repos/reuvenlax/incubator-beam/statuses/880abf363686f6fb72f238baac54da2bd0d8efd5","head":{"label":"peihe:bigquery-streaming-tests-patch","ref":"bigquery-streaming-tests-patch","sha":"880abf363686f6fb72f238baac54da2bd0d8efd5","user":{"login":"peihe","id":10201797,"avatar_url":"https://avatars.githubusercontent.com/u/10201797?v=3","gravatar_id":"","url":"https://api.github.com/users/peihe","html_url":"https://github.com/peihe","followers_url":"https://api.github.com/users/peihe/followers","following_url":"https://api.github.com/users/peihe/following{/other_user}","gists_url":"https://api.github.com/users/peihe/gists{/gist_id}","starred_url":"https://api.github.com/users/peihe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peihe/subscriptions","organizations_url":"https://api.github.com/users/peihe/orgs","repos_url":"https://api.github.com/users/peihe/repos","events_url":"https://api.github.com/users/peihe/events{/privacy}","received_events_url":"https://api.github.com/users/peihe/received_events","type":"User","site_admin":false},"repo":{"id":52831526,"name":"incubator-beam","full_name":"peihe/incubator-beam","owner":{"login":"peihe","id":10201797,"avatar_url":"https://avatars.githubusercontent.com/u/10201797?v=3","gravatar_id":"","url":"https://api.github.com/users/peihe","html_url":"https://github.com/peihe","followers_url":"https://api.github.com/users/peihe/followers","following_url":"https://api.github.com/users/peihe/following{/other_user}","gists_url":"https://api.github.com/users/peihe/gists{/gist_id}","starred_url":"https://api.github.com/users/peihe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peihe/subscriptions","organizations_url":"https://api.github.com/users/peihe/orgs","repos_url":"https://api.github.com/users/peihe/repos","events_url":"https://api.github.com/users/peihe/events{/privacy}","received_events_url":"https://api.github.com/users/peihe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peihe/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/peihe/incubator-beam","forks_url":"https://api.github.com/repos/peihe/incubator-beam/forks","keys_url":"https://api.github.com/repos/peihe/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peihe/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peihe/incubator-beam/teams","hooks_url":"https://api.github.com/repos/peihe/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/peihe/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/peihe/incubator-beam/events","assignees_url":"https://api.github.com/repos/peihe/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/peihe/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/peihe/incubator-beam/tags","blobs_url":"https://api.github.com/repos/peihe/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peihe/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peihe/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/peihe/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peihe/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/peihe/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/peihe/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/peihe/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/peihe/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/peihe/incubator-beam/subscription","commits_url":"https://api.github.com/repos/peihe/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/peihe/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/peihe/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/peihe/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/peihe/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/peihe/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peihe/incubator-beam/merges","archive_url":"https://api.github.com/repos/peihe/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peihe/incubator-beam/downloads","issues_url":"https://api.github.com/repos/peihe/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/peihe/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/peihe/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/peihe/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peihe/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/peihe/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/peihe/incubator-beam/deployments","created_at":"2016-02-29T23:06:11Z","updated_at":"2016-02-29T23:06:15Z","pushed_at":"2016-12-10T20:24:33Z","git_url":"git://github.com/peihe/incubator-beam.git","ssh_url":"git@github.com:peihe/incubator-beam.git","clone_url":"https://github.com/peihe/incubator-beam.git","svn_url":"https://github.com/peihe/incubator-beam","homepage":null,"size":22846,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reuvenlax:bigquery_testing","ref":"bigquery_testing","sha":"9db51fdad77a4a8a945e2e611d6796db1ab9a1c1","user":{"login":"reuvenlax","id":21071061,"avatar_url":"https://avatars.githubusercontent.com/u/21071061?v=3","gravatar_id":"","url":"https://api.github.com/users/reuvenlax","html_url":"https://github.com/reuvenlax","followers_url":"https://api.github.com/users/reuvenlax/followers","following_url":"https://api.github.com/users/reuvenlax/following{/other_user}","gists_url":"https://api.github.com/users/reuvenlax/gists{/gist_id}","starred_url":"https://api.github.com/users/reuvenlax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reuvenlax/subscriptions","organizations_url":"https://api.github.com/users/reuvenlax/orgs","repos_url":"https://api.github.com/users/reuvenlax/repos","events_url":"https://api.github.com/users/reuvenlax/events{/privacy}","received_events_url":"https://api.github.com/users/reuvenlax/received_events","type":"User","site_admin":false},"repo":{"id":72963016,"name":"incubator-beam","full_name":"reuvenlax/incubator-beam","owner":{"login":"reuvenlax","id":21071061,"avatar_url":"https://avatars.githubusercontent.com/u/21071061?v=3","gravatar_id":"","url":"https://api.github.com/users/reuvenlax","html_url":"https://github.com/reuvenlax","followers_url":"https://api.github.com/users/reuvenlax/followers","following_url":"https://api.github.com/users/reuvenlax/following{/other_user}","gists_url":"https://api.github.com/users/reuvenlax/gists{/gist_id}","starred_url":"https://api.github.com/users/reuvenlax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reuvenlax/subscriptions","organizations_url":"https://api.github.com/users/reuvenlax/orgs","repos_url":"https://api.github.com/users/reuvenlax/repos","events_url":"https://api.github.com/users/reuvenlax/events{/privacy}","received_events_url":"https://api.github.com/users/reuvenlax/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reuvenlax/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/reuvenlax/incubator-beam","forks_url":"https://api.github.com/repos/reuvenlax/incubator-beam/forks","keys_url":"https://api.github.com/repos/reuvenlax/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reuvenlax/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reuvenlax/incubator-beam/teams","hooks_url":"https://api.github.com/repos/reuvenlax/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/reuvenlax/incubator-beam/events","assignees_url":"https://api.github.com/repos/reuvenlax/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/reuvenlax/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/reuvenlax/incubator-beam/tags","blobs_url":"https://api.github.com/repos/reuvenlax/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reuvenlax/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reuvenlax/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/reuvenlax/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reuvenlax/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/reuvenlax/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/reuvenlax/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/reuvenlax/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/reuvenlax/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/reuvenlax/incubator-beam/subscription","commits_url":"https://api.github.com/repos/reuvenlax/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/reuvenlax/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/reuvenlax/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/reuvenlax/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/reuvenlax/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reuvenlax/incubator-beam/merges","archive_url":"https://api.github.com/repos/reuvenlax/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reuvenlax/incubator-beam/downloads","issues_url":"https://api.github.com/repos/reuvenlax/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/reuvenlax/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/reuvenlax/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reuvenlax/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/reuvenlax/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/reuvenlax/incubator-beam/deployments","created_at":"2016-11-06T01:16:14Z","updated_at":"2016-11-06T01:16:20Z","pushed_at":"2016-12-10T19:13:01Z","git_url":"git://github.com/reuvenlax/incubator-beam.git","ssh_url":"git@github.com:reuvenlax/incubator-beam.git","clone_url":"https://github.com/reuvenlax/incubator-beam.git","svn_url":"https://github.com/reuvenlax/incubator-beam","homepage":null,"size":24773,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3"},"html":{"href":"https://github.com/reuvenlax/incubator-beam/pull/3"},"issue":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/3"},"comments":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/reuvenlax/incubator-beam/statuses/880abf363686f6fb72f238baac54da2bd0d8efd5"}}}}
{"actor":{"display_login":"peihe"}}