[
https://issues.apache.org/jira/browse/CAMEL-27713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27713:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-influxdb: retentionPolicy default, checkDatabaseExistence checks first
> db, no effect alone
> ------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27713
> URL: https://issues.apache.org/jira/browse/CAMEL-27713
> Project: Camel
> Issue Type: Bug
> Components: camel-influxdb
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-influxdb for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/cb40f24f287655774d422125a5e704444c3c1764).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. The default retentionPolicy {{default}} does not exist on InfluxDB 1.0
> and later
> {{InfluxDbEndpoint}} sets {{retentionPolicy = "default"}}, and
> {{InfluxDbProducer.doInsert()}} passes it to {{InfluxDB.write(database,
> retentionPolicy, point)}}, which sends it as the {{rp}} parameter of the
> write request. InfluxDB takes the value as the name of a policy. Since
> InfluxDB 1.0 the policy that a new database gets is named {{autogen}}, so
> with the default configuration, writing a single Point to a database without
> a policy named {{default}} fails with "retention policy not found: default".
> The value also overrides the policy set on the client with
> {{InfluxDB.setRetentionPolicy()}}. influxdb-java itself uses {{autogen}} as
> its default.
> Proposed change: make the option empty by default. InfluxDB then writes to
> the default policy of the database. This changes a default, so it needs an
> entry in the upgrade guide.
> h4. 2. checkDatabaseExistence reads only the first database of SHOW DATABASES
> {{InfluxDbEndpoint.ensureDatabaseExists()}} checks
> {{result.getResults().get(0).getSeries().get(0).getValues().get(0).contains(databaseName)}}.
> {{getValues()}} has one row per database, so {{get(0)}} is the first
> database only. A database that exists but is not listed first counts as
> missing. With {{autoCreateDatabase=true}} the endpoint then logs that the
> database does not exist and sends {{CREATE DATABASE}} again.
> Proposed change: check the name against every row of the series.
> h4. 3. checkDatabaseExistence without autoCreateDatabase has no effect
> In {{InfluxDbEndpoint.ensureDatabaseExists()}} a missing database leads to an
> action only when {{autoCreateDatabase}} is true. With
> {{checkDatabaseExistence=true}} alone, the endpoint runs SHOW DATABASES and
> starts without an error or a log message if the database is missing.
> {{autoCreateDatabase=true}} without {{checkDatabaseExistence}} does nothing
> either. When {{databaseName}} is not set, the check sends {{CREATE DATABASE
> null}}.
> Proposed change: fail the start of the endpoint when the database is missing
> and autoCreateDatabase is false, and require databaseName when
> checkDatabaseExistence is true.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)