Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(java): add possibility to specify WriteConsistency parameter #329

Merged
merged 16 commits into from
Apr 13, 2022

Conversation

bednar
Copy link
Contributor

@bednar bednar commented Apr 8, 2022

Proposed Changes

  1. Added possibility to specify WriteConsistency parameter. For more info see:
  2. Added possibility to specify default precision and consistency via InfluxDBClientOptions3.
  3. Added an example: How to use consistency parameter for InfluxDB Enterprise

Configure consistency via Write API:

- writeApi.writeRecord(WritePrecision.NS, "cpu_load_short,host=server02 value=0.67");
+ WriteParameters parameters = new WriteParameters(WritePrecision.NS, WriteConsistency.ALL);
+ 
+ writeApi.writeRecord("cpu_load_short,host=server02 value=0.67", parameters);

Configure consistency via client options:

- InfluxDBClient client = InfluxDBClientFactory.createV1("http://influxdb_enterpriser:8086",
-    "my-username",
-    "my-password".toCharArray(),
-    "my-db",
-    "autogen");
+ InfluxDBClient client = InfluxDBClientFactory.createV1("http://influxdb_enterpriser:8086",
+    "my-username",
+    "my-password".toCharArray(),
+    "my-db",
+    "autogen", 
+    WriteConsistency.ALL);

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • mvn test completes successfully
  • Commit messages are in semantic format
  • Sign CLA (if not already signed)

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2022

Codecov Report

Merging #329 (69a5239) into master (854f21f) will increase coverage by 0.16%.
The diff coverage is 94.68%.

❗ Current head 69a5239 differs from pull request most recent head f9e3d29. Consider uploading reports for the commit f9e3d29 to get more accurate results

@@             Coverage Diff              @@
##             master     #329      +/-   ##
============================================
+ Coverage     88.74%   88.90%   +0.16%     
- Complexity      615      627      +12     
============================================
  Files           151      152       +1     
  Lines          6129     6266     +137     
  Branches        289      299      +10     
============================================
+ Hits           5439     5571     +132     
- Misses          607      610       +3     
- Partials         83       85       +2     
Impacted Files Coverage Δ
...otlin/com/influxdb/client/kotlin/WriteKotlinApi.kt 55.55% <ø> (ø)
...com/influxdb/client/reactive/WriteReactiveApi.java 100.00% <ø> (ø)
...src/main/java/com/influxdb/client/write/Point.java 90.66% <ø> (-0.07%) ⬇️
...ava/com/influxdb/client/write/WriteParameters.java 80.35% <80.35%> (ø)
...luxdb/client/kotlin/internal/WriteKotlinApiImpl.kt 95.00% <100.00%> (+0.88%) ⬆️
...client/reactive/internal/WriteReactiveApiImpl.java 97.54% <100.00%> (+0.34%) ⬆️
...ava/com/influxdb/client/InfluxDBClientFactory.java 100.00% <100.00%> (ø)
...ava/com/influxdb/client/InfluxDBClientOptions.java 96.75% <100.00%> (+0.37%) ⬆️
...b/client/internal/AbstractWriteBlockingClient.java 84.00% <100.00%> (+3.04%) ⬆️
.../influxdb/client/internal/AbstractWriteClient.java 94.73% <100.00%> (+2.54%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 854f21f...f9e3d29. Read the comment docs.

@bednar bednar requested a review from rhajek April 12, 2022 12:09
@bednar bednar marked this pull request as ready for review April 12, 2022 12:09
@bednar bednar added the enhancement New feature or request label Apr 12, 2022
@bednar bednar force-pushed the write_consistency branch from 69a5239 to f9e3d29 Compare April 13, 2022 12:38
@bednar bednar merged commit 7b26209 into master Apr 13, 2022
@bednar bednar deleted the write_consistency branch April 13, 2022 12:45
@bednar bednar added this to the 6.0.0 milestone Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants