ryerraguntla opened a new pull request, #4258:
URL: https://github.com/apache/iggy/pull/4258
## Summary
Wires the Kafka gateway's CreateTopics (#3538) and Metadata (#3534)
handlers to the real Iggy bridge, instead of stub responses. Combined into one
PR/branch because both touch IggyBridge::get_kafka_topic —
merging up front eliminates the duplicate-implementation risk a sequential
rebase would have carried, rather than just deferring it.
With IGGY_KAFKA_BRIDGE_ENABLED=true:
- CreateTopics creates a real Iggy stream/topic, atomically reporting
AlreadyExists instead of racing a check-then-create.
- Metadata reports real topics and partition counts pulled from the bridge.
With the bridge off (default), both remain stubs as before (CreateTopics →
NOT_CONTROLLER, Metadata → every topic unknown).
Closes #3534, closes #3538.
Related to #3560
## What's included
- IggyBridge::get_kafka_topic — single canonical existence/detail lookup,
shared by both handlers (previously would have been two separate,
differently-typed implementations).
- IggyBridge::create_kafka_topic → TopicCreationOutcome::{Created,
AlreadyExists} — atomic create-or-report-exists
- IggyBridge::list_kafka_topics — enumerates override targets and
default-stream topics for "list all," deduplicated.
- Kafka wire error codes tightened: ERROR_INVALID_REQUEST(42),
ERROR_TOPIC_ALREADY_EXISTS(36), ERROR_INVALID_CONFIG(40),
ERROR_REQUEST_TIMED_OUT(7). Removed the incorrect
ERROR_INVALID_REPLICA_ASSIGNMENT(39).
- Bridge fan-out hardening, applied identically to both handlers: dedup
requested topic names before any bridge call, MAX_BRIDGE_BACKED_TOPICS = 100
cap (rejected wholesale as INVALID_REQUEST, no bridge call at
all above the cap), one wall-clock deadline over the request's aggregate
bridge work (CreateTopics uses the wire timeout_ms, clamped [1s, 30s]; Metadata
uses a fixed 20s, no timeout_ms field in its supported
versions).
- Metadata: fixed v0 isAllTopics() semantics (topics == null ||
(topics.isEmpty() && version == 0)); added a post-bridge-call, pre-encode
frame-size check (response_would_exceed_frame_size) since partition-count
expansion (up to 1000/topic) isn't priced by the pre-decode element-count
bound in bounds_guard.rs.
## Test plan
- cargo build -p iggy-gateway-kafka --all-targets — clean.
- cargo fmt --all, cargo sort --no-format --workspace — clean.
- cargo clippy -p iggy-gateway-kafka --all-features --all-targets -- -D
warnings — no issues.
- cargo test -p iggy-gateway-kafka — 332 passed, 16 suites (includes new
create_topics_real_bridge_tests.rs, metadata_real_bridge_tests.rs, and 4 new
list_kafka_topics_* cases appended to
bridge_iggy_integration_tests.rs).
-
./scripts/ci/{trailing-whitespace,trailing-newline,license-headers,markdownlint}.sh
— clean.
- git diff --check — no stray whitespace.
## AI Usage
If AI tools were used, please answer:
1. Which tools? Claude code for implementation , Cursor for review and
validation
2. Scope of usage? Implementation , review and validation
3. How did you verify the generated code works correctly? Test Suite and
Code walkthrough
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]