Skip to content

bigquery: try getting job if create fails - #2887

Merged
pongad merged 3 commits into
googleapis:masterfrom
pongad:create-retry
Feb 12, 2018
Merged

pongad merged 3 commits into
googleapis:masterfrom
pongad:create-retry

Conversation

@pongad

@pongad pongad commented Feb 9, 2018

Copy link
Copy Markdown
Contributor

If we create a job with randomly generated ID, it's highly unlikely
that it will with another job created by someone else.
When create fails, it is possible that the job was created successfully
anyway.
Thus, we can be more failure-tolerant by trying to retrieve the job,
if create throws.

Fixes #2867.

If we create a job with randomly generated ID, it's highly unlikely
that it will with another job created by someone else.
When create fails, it is possible that the job was created successfully
anyway.
Thus, we can be more failure-tolerant by trying to retrieve the job,
if create throws.

Fixes #2867.
@pongad
pongad requested review from tswast and vam-google February 9, 2018 06:51
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 9, 2018
}

@Test
public void testCreateQueryJob() {

This comment was marked as spam.

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looking great. A few nits / questions.

public TableResult query(QueryJobConfiguration configuration, JobOption... options)
throws InterruptedException, JobException {
return query(configuration, JobId.of(), options);
Job.checkNotDryRun(configuration, "query");

This comment was marked as spam.

This comment was marked as spam.

try {
return getJob(jobInfo.getJobId());
} catch (BigQueryException e) {
System.err.println("rethrow");

This comment was marked as spam.

bigqueryRpcMock.create(
JobInfo.of(LOAD_JOB_CONFIGURATION_WITH_PROJECT).toPb(), EMPTY_RPC_OPTIONS))
.andReturn(COMPLETE_LOAD_JOB.toPb());
bigqueryRpcMock.create(EasyMock.capture(jobCapture), EasyMock.eq(EMPTY_RPC_OPTIONS)))

This comment was marked as spam.

bigquery = options.getService();
Job job = bigquery.create(COPY_JOB);
assertEquals(new Job(bigquery, new JobInfo.BuilderImpl(COMPLETE_COPY_JOB)), job);
Job job = bigquery.create(QUERY_JOB, JOB_OPTION_FIELDS);

This comment was marked as spam.

String selector = (String) capturedOptions.getValue().get(JOB_OPTION_FIELDS.getRpcOption());
assertThat(selector.split(","))
.asList()
.containsExactly("jobReference", "configuration", "user_email");

This comment was marked as spam.

This comment was marked as spam.

new Supplier<JobId>() {
@Override
public JobId get() {
return JobId.of();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@pongad

pongad commented Feb 12, 2018

Copy link
Copy Markdown
Contributor Author

@tswast PTAL

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once Circle is happy

@pongad
pongad merged commit e2f0d20 into googleapis:master Feb 12, 2018
@pongad
pongad deleted the create-retry branch February 12, 2018 19:30
suztomo pushed a commit that referenced this pull request Mar 9, 2026
…-plugin to v3.6.0 (#2887)

* build(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
rahul2393 pushed a commit to akash329d/google-cloud-java that referenced this pull request May 21, 2026
…oogleapis#2887)

* refactor: decouple ConsistencyRequest from TableAdminRequestContext

This commit updates the internal plumbing for `ConsistencyRequest` and
`AwaitConsistencyCallable` to support fully qualified table names without
breaking the existing public API for the legacy `BigtableTableAdminClient`.

b/502616786

* chore: generate libraries at Wed Apr 15 18:37:03 UTC 2026

* PR feedback

* chore: generate libraries at Tue Apr 21 19:06:09 UTC 2026

* chore: generate libraries at Tue Apr 21 19:11:56 UTC 2026

* PR feedback

* chore: generate libraries at Wed Apr 22 18:08:03 UTC 2026

---------

Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants