Skip to content

feat: support partial writes#365

Open
alespour wants to merge 11 commits intomainfrom
feat/partial-writes
Open

feat: support partial writes#365
alespour wants to merge 11 commits intomainfrom
feat/partial-writes

Conversation

@alespour
Copy link
Contributor

@alespour alespour commented Mar 10, 2026

Proposed Changes

Adds partial-write support with acceptPartial write option and corresponding config/env keys (writeAcceptPartial, INFLUX_WRITE_ACCEPT_PARTIAL). The client now exposes structured partial-write details via
InfluxDBPartialWriteException, so callers can inspect which lines failed and why, then decide whether to drop/retry/fix specific lines in a batch.

See Partial writes in InfluxDB documentation.

  WriteOptions options = new WriteOptions.Builder()
          .acceptPartial(true)
          .build();

  try {
      client.writeRecord(lp, options);
  } catch (InfluxDBPartialWriteException e) {
      for (InfluxDBPartialWriteException.LineError lineErr : e.lineErrors()) {
          System.out.printf(
                  "line %s failed: %s (%s)%n",
                  lineErr.lineNumber(),
                  lineErr.errorMessage(),
                  lineErr.originalLine()
          );
      }
  } catch (InfluxDBApiHttpException e) {
      System.out.println(e.getMessage());
  }

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional

@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 94.40000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.16%. Comparing base (0283c9f) to head (8bc0938).

Files with missing lines Patch % Lines
...va/com/influxdb/v3/client/internal/RestClient.java 90.54% 0 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #365      +/-   ##
==========================================
+ Coverage   87.90%   88.16%   +0.25%     
==========================================
  Files          20       21       +1     
  Lines        1397     1495      +98     
  Branches      241      269      +28     
==========================================
+ Hits         1228     1318      +90     
  Misses         81       81              
- Partials       88       96       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alespour alespour marked this pull request as ready for review March 10, 2026 09:55
@alespour alespour requested a review from Copilot March 10, 2026 09:56
Copy link

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

Adds support for InfluxDB 3 “partial writes” by introducing an acceptPartial write option (and corresponding config/env keys) and surfacing parsed, line-level write errors through a dedicated exception type.

Changes:

  • Add acceptPartial to WriteOptions and ClientConfig (incl. connection string, env, and system properties support).
  • Parse v3 write error responses to expose line-level error details via InfluxDBPartialWriteException.
  • Add/extend unit + integration tests and update README/CHANGELOG documentation.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/java/com/influxdb/v3/client/write/WriteOptions.java Adds acceptPartial option, builder support, safe accessor, and equality/hash updates.
src/main/java/com/influxdb/v3/client/config/ClientConfig.java Adds writeAcceptPartial config with parsing from connection string/env/system properties.
src/main/java/com/influxdb/v3/client/internal/InfluxDBClientImpl.java Uses v3 write endpoint when noSync or acceptPartial is enabled; adds accept_partial query param.
src/main/java/com/influxdb/v3/client/internal/RestClient.java Parses response bodies for line-level write errors and throws a structured partial-write exception.
src/main/java/com/influxdb/v3/client/InfluxDBPartialWriteException.java New exception type to expose line-level write failures to callers.
src/main/java/com/influxdb/v3/client/InfluxDBClient.java Documents the new config/env/system property key in client factory docs.
src/test/java/com/influxdb/v3/client/write/WriteOptionsTest.java Extends WriteOptions tests for equality/hash and config override behavior of acceptPartial.
src/test/java/com/influxdb/v3/client/config/ClientConfigTest.java Extends config parsing/toString/equality tests for writeAcceptPartial.
src/test/java/com/influxdb/v3/client/internal/RestClientTest.java Adds assertions around structured partial-write parsing and fallback behavior.
src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java Adds request-shape tests for accept_partial and v3/v2 behavior.
src/test/java/com/influxdb/v3/client/integration/E2ETest.java Adds E2E validation for accept-partial error handling and exception typing.
README.md Documents how to use acceptPartial and inspect InfluxDBPartialWriteException details.
CHANGELOG.md Adds changelog entry for partial write support.

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

Copy link

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 13 out of 13 changed files in this pull request and generated 3 comments.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants