influxdata / influxdata/influxdb-java

Inconsistent handling of retention policies in single vs batch points

Open
#373 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

difficulty/low help wanted kind/bug
Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

There is no way to write single points to a default retention policy in case it is not named "autogen". The following code will fail:

InfluxDB influxDB = influxDB.setDatabase("mydb");
influxDB.write(Point.measurement("msmt").tag("tag", "x").addField("field", 42).build());

Expected behaviour is to omit retention policy in the queries to InfluxDB if user did not explicitly specified it.

On the other hand, BatchPoints do support default retention policy but if any other RP is to be used, it has to be set on BatchPoints separately and the value set upon the client initialization is ignored:

InfluxDB influxDB = influxDB.setDatabase("mydb").setRetentionPolicy("non_default_rp");
influxDB.write(BatchPoints.database("mydb").tag("tag", "x").addField("field", 42).build());
  • points from the batch get written to the default RP. Perhaps it makes sense to make a getter for BatchPoints.Builder in InfluxDB - this way database and retention policy would be automatically populated from the client instance.

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 with the InfluxDB.setDatabase, setRetentionPolicy, single-point write, and BatchPoints.Builder entry points shown in the examples. Trace how retention policies are selected for each write path, then verify that omitted policies use InfluxDB's default and that an explicitly configured client policy is honored for batch writes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.