Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bigquery/storage/managedwriter): wire in flow controller #4501

Merged

Conversation

shollyman
Copy link
Contributor

This adds a flow controller to the managed stream, guarding AppendRows.

This change puts the release responsibility for the flow controller in
the markDone() method of the pendingWrite. Flow controller code is
already well tested via unit tests, so this doesn't add any additional
tests.

Towards: #4366

This adds a flow controller to the managed stream, guarding AppendRows.

This change puts the release responsibility for the flow controller in
the markDone() method of the pendingWrite.  Flow controller code is
already well tested via unit tests, so this doesn't add any additional
tests.
@shollyman shollyman requested a review from a team as a code owner July 26, 2021 20:40
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the BigQuery API. label Jul 26, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 26, 2021
@shollyman shollyman requested a review from codyoss July 26, 2021 20:40
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

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

LGTM

@shollyman shollyman merged commit 40571fa into googleapis:master Jul 26, 2021
@shollyman shollyman deleted the fr-managedwriter-addflowcontrol branch July 26, 2021 21:13
if err := ms.fc.acquire(ctx, pw.reqSize); err != nil {
// in this case, we didn't acquire, so don't pass the flow controller reference to avoid a release.
pw.markDone(NoStreamOffset, err, nil)
}
Copy link

Choose a reason for hiding this comment

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

@shollyman Is there a missing return here? We've observed the following panic, which seems like it could be related to markDone resetting pw.request above before the append call proceeds below.

runtime error: invalid memory address or nil pointer dereference
at cloud.google.com/go/bigquery/storage/managedwriter.(*ManagedStream).append ( /go/src/github.com/ScriptRock/webscan-golang/vendor/cloud.google.com/go/bigquery/storage/managedwriter/managed_stream.go:284 )
at cloud.google.com/go/bigquery/storage/managedwriter.(*ManagedStream).AppendRows ( /go/src/github.com/ScriptRock/webscan-golang/vendor/cloud.google.com/go/bigquery/storage/managedwriter/managed_stream.go:363 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #5428 to follow up on this. Sheer luck I saw this comment, but looks likely.

Copy link

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants