ryerraguntla opened a new pull request, #4398:
URL: https://github.com/apache/iggy/pull/4398
## Which issue does this PR address?
Relates to #3546
## Rationale
Kafka admin clients read and change topic retention with DescribeConfigs
(32) and the deprecated AlterConfigs (33). Iggy already stores that lifetime as
`message_expiry`, and retention applies to sealed segments only. The active
segment does not expire. CreateTopics rejects a per-topic config list and tells
the client to set `retention.ms` with AlterConfigs, so these two APIs are how a
client reads and writes that expiry after the topic exists.
This PR covers the topic-config half only. Unknown keys are `INVALID_CONFIG`
(40). Kafka has no `NOT_CONFIGURABLE` code, which is the code the issue text
suggested.
## What changed?
With the bridge on, DescribeConfigs (versions 1-4) answers topic resources
only. It returns `retention.ms` from Iggy `message_expiry` (`-1` when sealed
segments never expire) and a read-only `cleanup.policy=delete`. AlterConfigs
(versions 0-2) persists only `retention.ms`, through `update_topic`. A value
whose seconds exceed `u32::MAX` is rejected and is not stored. `validate_only`
runs the same checks, including the topic lookup, and does not write.
One bad key fails that resource only. Other resources in the same request
are still processed. With the bridge off, each resource gets `NOT_CONTROLLER`
(41) and nothing is read or written. A missing topic is
`UNKNOWN_TOPIC_OR_PARTITION` (3), checked before the config keys. More than 100
distinct topics returns `POLICY_VIOLATION` (44) on every resource in the
request.
IncrementalAlterConfigs (44) is not implemented and is not advertised. A
client that sends it gets the connection closed. Only the deprecated
`Admin.alterConfigs` (33) writes `retention.ms`. CreateTopics still rejects
per-topic configs and tells the client to use AlterConfigs. DeleteTopics is not
in this PR and is covered in a separate PR. IncrementalAlterConfigs (44) will
be implemented in another succeding PRs.
## Local Execution
Passed:
- `cargo build -p iggy-gateway-kafka --tests`
- `cargo clippy -p iggy-gateway-kafka --all-features --all-targets -- -D
warnings`
- Unit tests for topic config, bounds, config handlers, version firewall,
CreateTopics, and kafka-message-gen
- Kafka 3.9 Java AdminClient probe on the host JDK: `retention.ms=-1`, then
alter to `8000`, unknown key rejected, `validate_only` did not write,
`describe_batch_50_elapsed_ms=22`. The probe prints that elapsed time and does
not assert a latency threshold.
## AI Usage
Fill this in before opening.
1. Which tools? Claude
2. Scope of usage? Implementation and review
3. How did you verify the generated code works correctly? Walk through and
manual testing.
4. Can you explain every line of the code if asked? Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]