influxdata / influxdata/influxdb-java

influxdb-java drops data when using OneShotBatchWriter if any error is encountered

Open
#583 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

I understand that OneShotBatchWriter gets one shot to write its points to influxdb, but I found when importing historical data through influxdb-java, that the OneShotBatchWriter stops processing its list of BatchPoints as soon as an error happens.

Example:

  @Test
  public void test()
  {
    // Use OneShotBatchWriter
    db.enableBatch(5_000, 1, TimeUnit.SECONDS);

    // CPU might make it to influx, or might not depending on the order that OneShotBatchWriter writes them in
    db.write(databaseName,
             "one_day",
             Point.measurement("cpu")
                 .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
                 .addField("cpu", 1)
                 .build());

    // Memory dropped by influxdb
    db.write(databaseName,
             "one_week",
             Point.measurement("memory")
                 .time(0, TimeUnit.MILLISECONDS)
                 .addField("memory", 1)
                 .build());

    db.disableBatch();
  }

The memory point is dropped by influxdb which results in an error back to influxdb-java, which promptly gives up on the cpu point. I like how simple OneShotBatchWriter is and don't need to retry points like RetryCapableBatchWriter, but could OneShotBatchWriter at least try all points?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the OneShotBatchWriter entry point and reproduce the provided test scenario with the two BatchPoints, including one point that InfluxDB rejects. Trace how the error affects subsequent points and add coverage showing that all points are attempted; done means the valid CPU point is not dropped when the memory point fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.