influxdata / influxdata/influxdb-java

The error data blocks the write of normal data

Open
#1,012 0 comments 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

In the case of enableBatch, errors (for example, no database is specified or an RP is specified incorrectly) will block subsequent normal-point writes, which has a significant impact in low-traffic scenarios.

code like:

        final InfluxDB influxDB = InfluxDBFactory.connect(serverURL, username, password, client, InfluxDB.ResponseFormat.JSON);
        influxDB.setDatabase("db99");
        influxDB.enableBatch(BatchOptions.DEFAULTS.actions(2000).flushDuration(2000).bufferLimit(50000).exceptionHandler(new BiConsumer<Iterable<Point>, Throwable>() {
            @Override
            public void accept(Iterable<Point> points, Throwable throwable) {
                System.out.println(throwable.toString());
            }
        }));
        // error point
        influxDB.write("db99", "rp_not_exist", Point.measurement("testmst").tag("tagk", "abcdd").addField("value", 666).time(Instant.now().toEpochMilli(), TimeUnit.MILLISECONDS).build());
        Thread.sleep(3000);

        // normal point
        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                for (int i = 0; i < 20; i++) {
                    influxDB.write("db99", "autogen", Point.measurement("testmst").tag("tagk", "abcdd").addField("value", 666).time(Instant.now().toEpochMilli(), TimeUnit.MILLISECONDS).build());
                }
            }
        };
        timer.schedule(task, 0, 1000);

influxdb-java keeps trying to write to the wrong point

2025-04-09T07:45:47.786051Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:49 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" a7db9961-1516-11f0-9175-fa1641b344d0 81
2025-04-09T07:45:49.813697Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:51 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" a910c54d-1516-11f0-9176-fa1641b344d0 108
2025-04-09T07:45:51.839925Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:53 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" aa45caee-1516-11f0-9177-fa1641b344d0 83
2025-04-09T07:45:53.865090Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:55 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" ab7b1b14-1516-11f0-9178-fa1641b344d0 97
2025-04-09T07:45:55.892218Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:57 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" acb039f0-1516-11f0-9179-fa1641b344d0 87
2025-04-09T07:45:57.918067Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:45:59 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" ade5854c-1516-11f0-917a-fa1641b344d0 94
2025-04-09T07:45:59.945061Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:01 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" af1ad2ff-1516-11f0-917b-fa1641b344d0 103
2025-04-09T07:46:01.972132Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:03 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b05003dc-1516-11f0-917c-fa1641b344d0 137
2025-04-09T07:46:03.998481Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:06 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b1852e2e-1516-11f0-917d-fa1641b344d0 92
2025-04-09T07:46:06.024571Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:08 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b2ba5529-1516-11f0-917e-fa1641b344d0 103
2025-04-09T07:46:08.050642Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:10 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b3ef88fb-1516-11f0-917f-fa1641b344d0 80
2025-04-09T07:46:10.077006Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:12 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b524c574-1516-11f0-9180-fa1641b344d0 91
2025-04-09T07:46:12.103630Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}
[httpd] 29.5.135.237 - rwuser [09/Apr/2025:15:46:14 +0800] "POST /write?db=db99&rp=rp_not_exist&precision=n&consistency=one HTTP/1.1 " 500 53 "-" "okhttp/4.9.1" b659c320-1516-11f0-9181-fa1641b344d0 111
2025-04-09T07:46:14.128666Z     error   [500] - "retention policy not found: rp_not_exist"      {"log_id": "0vnBIL4l000", "service": "httpd"}

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 by tracing enableBatch, BatchOptions, and the InfluxDB.write calls in the provided reproduction. Inspect how a failed point is retained or retried after the exceptionHandler runs. Done means a failed write such as rp_not_exist no longer prevents subsequent valid points from being written, while the error is still reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.