Skip to content

fix: Error handling in StreamingBatchWriter #1921

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

Merged
merged 16 commits into from
Jun 9, 2025

Conversation

disq
Copy link
Member

@disq disq commented Oct 3, 2024

original PR: #1913

Reverts the revertion, plus more improvements:

  • Client's handlers are now allowed to return an immediate error without draining the channel. The channel will be automatically drained for the error condition, and subsequent writes for that table won't get sent to the client.
  • Some potential race conditions are fixed (ensureOpened() inline-func now got refactored into s.send() and handles the sending as well). The spawned goroutine doesn't refer to inputCh directly so that it can be replaced in closeFlush().
  • Shutdown logic is handled better: even if client.Write() returns an error after msgs is closed, it's still logged and returned.

@disq disq requested a review from a team as a code owner October 3, 2024 15:38
@disq disq requested a review from erezrokah October 3, 2024 15:38
@github-actions github-actions bot added the fix label Oct 3, 2024
}
defer func() {
err := w.Close(ctx)
retErr = errors.Join(retErr, err)
Copy link
Member Author

Choose a reason for hiding this comment

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

New improvement: always do w.Close even we returned an error, and join errors.

@disq disq removed the no automerge label Oct 4, 2024
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Oct 7, 2024
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Oct 7, 2024
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Oct 7, 2024
Getting the azblob plugin ready for the [StreamingBatchWriter update](cloudquery/plugin-sdk#1921). ~Incorporates cloudquery/filetypes#579 and cloudquery/plugin-sdk#1921
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Oct 7, 2024
@murarustefaan murarustefaan requested a review from a team as a code owner May 28, 2025 19:20
@murarustefaan murarustefaan requested a review from savme May 28, 2025 19:20
@disq disq marked this pull request as draft June 6, 2025 11:36
@disq disq marked this pull request as ready for review June 9, 2025 12:17
@github-actions github-actions bot added fix and removed fix labels Jun 9, 2025
}
}

return w.Close(ctx)
return errors.Join(errs...)
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we collate the errors from errCh, as well as logging them as they are encountered

@murarustefaan murarustefaan requested a review from przste-go June 9, 2025 12:30
@github-actions github-actions bot added fix and removed fix labels Jun 9, 2025
@github-actions github-actions bot added fix and removed fix labels Jun 9, 2025
Copy link
Contributor

@przste-go przste-go left a comment

Choose a reason for hiding this comment

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

LGTM and fixes stuck syncs issues for stuck syncs in s3 plugin 🚀

@disq disq added the automerge label Jun 9, 2025
@kodiakhq kodiakhq bot merged commit 6d71fb1 into main Jun 9, 2025
10 checks passed
@kodiakhq kodiakhq bot deleted the fix/reintroduce-streamingbatchwriterfix branch June 9, 2025 14:30
@github-actions github-actions bot added fix and removed fix labels Jun 9, 2025
kodiakhq bot pushed a commit that referenced this pull request Jun 18, 2025
🤖 I have created a release *beep* *boop*
---


## [4.84.2](v4.84.1...v4.84.2) (2025-06-18)


### Bug Fixes

* Add time delay in DeleteStaleAll test for destinations ([#2191](#2191)) ([d98a293](d98a293))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/config to v1.29.15 ([#2189](#2189)) ([9860e20](9860e20))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/service/licensemanager to v1.31.1 ([#2186](#2186)) ([7647d77](7647d77))
* **deps:** Update module google.golang.org/grpc to v1.72.2 ([#2187](#2187)) ([a999c81](a999c81))
* **deps:** Update module google.golang.org/grpc to v1.73.0 ([#2190](#2190)) ([2e3c192](2e3c192))
* Error handling in StreamingBatchWriter ([#1921](#1921)) ([6d71fb1](6d71fb1))

---
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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy