Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

feat: add support to a few more specific StorageErrors for the Write API - #1563

Merged
stephaniewang526 merged 11 commits into
googleapis:mainfrom
stephaniewang526:more-storageError
May 5, 2022
Merged

stephaniewang526 merged 11 commits into
googleapis:mainfrom
stephaniewang526:more-storageError

Conversation

@stephaniewang526

Copy link
Copy Markdown
Contributor

OFFSET_OUT_OF_RANGE
OFFSET_ALREADY_EXISTS
STREAM_NOT_FOUND

Towards b/220198094

OFFSET_OUT_OF_RANGE
OFFSET_ALREADY_EXISTS
STREAM_NOT_FOUND

Towards b/220198094
@stephaniewang526
stephaniewang526 requested review from a team and tswast March 4, 2022 16:15
@product-auto-label product-auto-label Bot added the api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. label Mar 4, 2022
@stephaniewang526 stephaniewang526 added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 4, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 4, 2022

@yirutang yirutang 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.

Add a e2e test for all these exceptions + to show the StatusRuntimeException still works?

@stephaniewang526
stephaniewang526 marked this pull request as draft March 4, 2022 20:59
@stephaniewang526

Copy link
Copy Markdown
Contributor Author

Converting this to draft as we realized that there are backend changes needed (https://b.corp.google.com/issues/220198094#comment7) before proceeding.

@yirutang

Copy link
Copy Markdown
Contributor

The exception backend change is fully rolled out.

@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Apr 25, 2022
@stephaniewang526
stephaniewang526 marked this pull request as ready for review April 25, 2022 19:09
@stephaniewang526
stephaniewang526 requested a review from a team April 25, 2022 20:30
@stephaniewang526 stephaniewang526 added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 25, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 25, 2022
return null;
}
String streamName = error.getEntity();
String errorMessage =

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.

Add a comment about this is to trim the entity sub message. Also narrow it further down by looking for "Entity: ".

@stephaniewang526 stephaniewang526 May 5, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"Entity:..." is present in the detailMessage of OFFSET_OUT_OF_RANGE error when it should not be there since we already provide streamName in the error. The full detailMessage I get looks like: "OUT_OF_RANGE: The offset is within stream, expected offset 1, received 0 Entity: projects/.../datasets/.../tables/testtable/streams/CiQ2NGY3OT...".

I created b/231499869 to track this.

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.

So why do you need to trim the next message?

@stephaniewang526 stephaniewang526 May 5, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What does "next message" mean? I added a comment here to clarify further. Basically, I need to trim the message of whitespaces either way (with or without Entity) in order to get the "expected offset [0-9]+, received [0-9]+" portion to parse out the offset numbers.

Long expectedOffet =
Long.parseLong(
errorMessage.substring(
errorMessage.lastIndexOf("offset") + 7, errorMessage.lastIndexOf(",")));

@yirutang yirutang Apr 29, 2022 •

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.

Have a stream match pattern for "expected offset $0, received $1". I am writing cl/445470232 to make sure the parsing will not break.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@stephaniewang526
stephaniewang526 requested a review from yirutang May 5, 2022 02:05
@stephaniewang526 stephaniewang526 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 5, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 5, 2022
@stephaniewang526 stephaniewang526 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 5, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 5, 2022
@stephaniewang526
stephaniewang526 merged commit c26091e into googleapis:main May 5, 2022
gcf-merge-on-green Bot pushed a commit that referenced this pull request May 5, 2022
🤖 I have created a release *beep* *boop*
---


## [2.13.0](v2.12.2...v2.13.0) (2022-05-05)


### Features

* add support to a few more specific StorageErrors for the Write API ([#1563](#1563)) ([c26091e](c26091e))
* next release from main branch is 2.12.2 ([#1624](#1624)) ([b2aa2a4](b2aa2a4))


### Bug Fixes

* A stuck when the client fail to get DoneCallback ([#1637](#1637)) ([3baa84e](3baa84e))
* Fix a possible NULL PTR after introduced timeout on waitForDone ([#1638](#1638)) ([e1c6ded](e1c6ded))


### Dependencies

* update dependency com.google.cloud:google-cloud-bigquery to v2.10.10 ([#1623](#1623)) ([54b74b8](54b74b8))
* update dependency org.apache.avro:avro to v1.11.0 ([#1632](#1632)) ([b47eea0](b47eea0))


### Documentation

* **samples:** update WriteComittedStream sample code to match best practices ([#1628](#1628)) ([5d4c7e1](5d4c7e1))
* **sample:** update WriteToDefaultStream sample to match best practices ([#1631](#1631)) ([73ddd7b](73ddd7b))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: m Pull request size is medium.

2 participants