Skip to content

feat: use server-returned affected rows in BulkWriter#37

Merged
killme2008 merged 4 commits into
mainfrom
feature/improve-bulk-write
Mar 23, 2026
Merged

feat: use server-returned affected rows in BulkWriter#37
killme2008 merged 4 commits into
mainfrom
feature/improve-bulk-write

Conversation

@killme2008
Copy link
Copy Markdown
Member

BulkWriter now reads responses concurrently via a background async task, parses affected rows from FlightPutResult.ApplicationMetadata JSON, and supports fail-fast in WriteAsync when the server returns an error.

This aligns with the Go SDK fix for premature stream close that could cause write loss. GreptimeTeam/greptimedb-ingester-go#98

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Arrow Flight BulkWriter to consume server responses concurrently and return server-reported affected rows (parsed from FlightPutResult.ApplicationMetadata JSON), with fail-fast behavior when the server-side stream fails.

Changes:

  • Start a background receive task when the DoPut stream is initialized, and drain responses concurrently.
  • Parse and accumulate affected_rows from FlightPutResult.ApplicationMetadata JSON and return that from CompleteAsync.
  • Add unit tests for response draining (accumulation + RPC exception capture).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/GreptimeDB.Ingester/Client/BulkWriter.cs Adds background response draining, parses affected_rows from JSON metadata, and surfaces receive errors to WriteAsync/CompleteAsync.
tests/GreptimeDB.Ingester.Tests/BulkWriterTests.cs Adds tests for the new drain/accumulation behavior and error capture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs Outdated
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs
Comment thread tests/GreptimeDB.Ingester.Tests/BulkWriterTests.cs
Comment thread tests/GreptimeDB.Ingester.Tests/BulkWriterTests.cs Outdated
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs Outdated
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008 killme2008 force-pushed the feature/improve-bulk-write branch from 114d911 to 64de75b Compare March 23, 2026 11:47
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs Outdated
Comment thread tests/GreptimeDB.Ingester.Tests/BulkWriterTests.cs Outdated
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs Outdated
Comment thread src/GreptimeDB.Ingester/Client/BulkWriter.cs Outdated
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008 killme2008 merged commit 1f5a2bf into main Mar 23, 2026
7 checks passed
@killme2008 killme2008 deleted the feature/improve-bulk-write branch March 23, 2026 12:21
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.

2 participants