Claus Ibsen created CAMEL-26230:
-----------------------------------

             Summary: camel-influxdb2 - a Point with no fields is dropped 
without an error, and a route cannot start while InfluxDB is down even with 
autoCreateOrg=false
                 Key: CAMEL-26230
                 URL: https://issues.apache.org/jira/browse/CAMEL-26230
             Project: Camel
          Issue Type: Bug
          Components: camel-influxdb
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of influxdb2 (CAMEL-24961, PR 
#28398). There is no JIRA component for camel-influxdb2, so this uses 
camel-influxdb.

h4. 1. A Point with no fields is dropped without an error

{{InfluxDb2Producer.insertPoint}} (main 2a465aa4814c, line 106) passes the 
Point to {{writeApi.writePoint}}; the client skips a Point that has no fields, 
so the exchange succeeds and nothing is written. Checked on 4.24.0-SNAPSHOT 
with InfluxDB 1.8 and 2.7 (docker).

Proposed: fail the exchange when the Point (or a Point of Points/Records) has 
no fields.

h4. 2. The endpoint calls the server at startup even with autoCreateOrg=false

{{InfluxDb2Endpoint.doInit}} (line 177) always calls {{ensureOrgExists}} and 
{{ensureBucketExists}} (which calls {{ensureOrgExists}} again, line 206); 
{{findOrganizations}} (line 187) needs the server, so the route cannot start 
while InfluxDB is down, whatever {{autoCreateOrg}} is. Checked on 
4.24.0-SNAPSHOT with InfluxDB 1.8 and 2.7 (docker).

Proposed: look the organization and bucket up only when {{autoCreateOrg}} / 
{{autoCreateBucket}} is true (or lazily on the first write).

h4. 3. The Map converter mutates the caller's Map

{{CamelInfluxDb2Converters}} (line 45-47) removes 
{{CamelInfluxDB2MeasurementName}} from the body Map and puts it back, so an 
immutable Map ({{Map.of}}) fails with {{UnsupportedOperationException}}, and a 
Map shared with other code is changed while the point is built. Checked on 
4.24.0-SNAPSHOT with InfluxDB 1.8 and 2.7 (docker).

Proposed: copy the Map without the measurement key instead of removing and 
re-adding it.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to