fix: Make write_lp work for both multitenant and singletenant #24422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(cherry pick of https://github.com/influxdata/influxdb_iox/pull/9027)
Users of the rust influxdb client library should be able to write to InfluxDB serverless multi-tenant and InfluxDB clustered single-tenant databases.
However, the
write_lp
function was assuming that the caller encoded<org>_<bucket>
in the namespace/database name. This encoding is an internal hack of the InfluxDB serverless iox engine. No real clients are sending requests with that encoding over the wire. This encoding is only used internally in serverless to create org scoped databases in an otherwise flat namespace of database names.This PR makes a source-compatible changes to the
write_lp
signature that allows users to keep passing database names towrite_lp
when targeting single-tenant databases, while also allowing the user to explicitly pass an "org" + "database" combo when targeting a multi-tenant database.This change assumes that most current users of this crate are users of the single-tenant flavour of influxdb
This change does NOT change the behaviour of the
influxdb_iox write
CLI command, which interprets the namespace parameter as "org_namespace". This is because:Noise
This PR added a function the returns
Result<Foo, Error>
and clippy complained with:I'm not sure why it accepted such a large Error enum before, wince
write_lp
also returns the Error, but anyway, I boxed a few of the nested errors