Visitar URL original
feat(gateways): Kafka Gateway add DeleteTopics API Key that deletes the Iggy topic only by ryerraguntla · Pull Request #4400 · apache/iggy · GitHub
Skip to content

feat(gateways): Kafka Gateway add DeleteTopics API Key that deletes the Iggy topic only - #4400

Merged
hubcio merged 2 commits into
masterfrom
feat/gateways-3546-delete-topics-only
Oct 12, 2026
Merged

hubcio merged 2 commits into
masterfrom
feat/gateways-3546-delete-topics-only

Conversation

@ryerraguntla

@ryerraguntla ryerraguntla commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Partially closes #3546 (Part 1)
Relates to #3560

Rationale

Kafka clients remove a topic with DeleteTopics (API key 20). Issue #3546 asks the gateway to delete the Iggy stream and the Iggy topic. Unmapped Kafka topics share one default stream, and a mapping override can put two Kafka topics in the same stream, so deleting that stream would remove topics the caller did not name. This change deletes only the Iggy topic the Kafka name resolves to, and leaves the stream in place even when the delete leaves it empty. DescribeConfigs and AlterConfigs are not part of this change.

What changed?

DeleteTopics was outside the scoped API set, so the gateway closed the connection. A reading of #3546 that also deletes the Iggy stream would drop other Kafka topics that still share that stream.

Versions 1 through 5 are now advertised (version 6, the topic-id shape, is not). With the bridge on, each name deletes only the mapped Iggy topic. Success is error code 0. A missing topic returns UNKNOWN_TOPIC_OR_PARTITION (3); on version 5, where error_message is encoded, that result's text is the fixed string "internal error deleting this topic". A name that is empty, has leading or trailing whitespace, is longer than 249 bytes, is "." or "..", or contains a character outside letters, digits, ".", "_", and "-" returns INVALID_TOPIC_EXCEPTION and is not sent to Iggy. The validation reason is included as error_message on version 5. Versions 1 through 4 encode the error code only.

With the bridge off, the request is still validated and every named topic is answered NOT_CONTROLLER (41), so the client does not treat the delete as done. More than 100 topic names in one request, duplicates included, returns POLICY_VIOLATION (44) for every name and deletes nothing. One missing or invalid name does not stop another name in the same request from being deleted. A name repeated in one request is removed on the first occurrence, and the later occurrence returns UNKNOWN_TOPIC_OR_PARTITION because the topic is already gone.

Local Execution

  • Passed : Yes
  • Pre-commit hooks ran : The following prehooks ran

Ran the following tests and are passed :

  • clamp_request_timeout_rejects_a_zero_or_negative_value_up_to_the_floor
  • clamp_request_timeout_caps_an_oversized_value_at_the_ceiling
  • clamp_request_timeout_passes_through_a_reasonable_value_unchanged
  • delete_topics_v5_huge_topic_names_count_rejected
  • delete_topics_v5_desync_varint_poc_rejected
  • delete_topics_v1_truncated_legacy_topic_name_rejected
  • delete_topics_deletes_a_real_iggy_topic
  • delete_topics_never_deletes_the_backing_stream_even_when_it_becomes_empty
  • delete_topics_on_a_nonexistent_topic_returns_unknown_topic_or_partition
  • delete_topics_second_occurrence_of_a_duplicate_name_is_unknown_topic_or_partition
  • delete_topics_deletes_existing_topics_alongside_a_missing_one
  • delete_topics_rejects_more_than_the_topic_cap
  • delete_topics_over_cap_error_message_names_the_limit
  • given_kafka_topics_sh_when_creating_then_deleting_a_topic_should_round_trip_through_the_bridge (kafka-topics.sh create, list, delete, list)
  • supported_ranges_table_has_thirteen_entries
  • golden_apiversions_v3_flexible_response_fixture
  • golden_apiversions_v1_response_fixture
cargo test -p iggy-gateway-kafka --lib delete_topics::tests
cargo test -p iggy-gateway-kafka --lib delete_topics_v5_
cargo test -p iggy-gateway-kafka --lib delete_topics_v1_truncated_legacy_topic_name_rejected
cargo test -p iggy-gateway-kafka --test delete_topics_real_bridge_tests
cargo test -p iggy-gateway-kafka --test kafka_client_e2e_tests given_kafka_topics_sh_when_creating_then_deleting_a_topic_should_round_trip_through_the_bridge
cargo test -p iggy-gateway-kafka --test version_firewall_tests supported_ranges_table_has_thirteen_entries
cargo test -p iggy-gateway-kafka --test golden_wire_fixtures_tests golden_apiversions_

AI Usage

  1. Which tools? Claude
  2. Scope of usage? Implementation, Review
  3. How did you verify the generated code works correctly? Code walkthrough and manual testing
  4. Can you explain every line of the code if asked? Yes

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 4, 2026
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.18%. Comparing base (0b82cd6) to head (0c1f135).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4400      +/-   ##
============================================
+ Coverage     88.16%   88.18%   +0.01%     
+ Complexity     1727     1726       -1     
============================================
  Files          1314     1314              
  Lines        264085   264085              
  Branches     222739   223013     +274     
============================================
+ Hits         232840   232877      +37     
+ Misses        25760    25689      -71     
- Partials       5485     5519      +34     
Components Coverage Δ
Rust Core 89.86% <ø> (-0.02%) ⬇️
Java SDK 70.18% <ø> (-0.05%) ⬇️
C# SDK 66.72% <ø> (+0.81%) ⬆️
Python SDK 90.38% <ø> (ø)
PHP SDK 85.84% <ø> (ø)
Node SDK 95.13% <ø> (-0.01%) ⬇️
Go SDK 70.39% <ø> (+0.02%) ⬆️
C++ SDK 84.43% <ø> (ø)
see 52 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/skill team-review-slim

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: Two warnings and five nits: a stale OUT_OF_SCOPE_API_KEYS entry that makes the firewall test pass for the wrong reason, an internal-error answer for a missing or unauthorized topic, and docs that still omit DeleteTopics. One simplification: delete_topics.rs copies the timeout helper, its constants, and three tests from create_topics.rs.

Counts: critical 0, warning 2, nit 5, simplification 1

Findings without an anchor on a changed line:

  • gateways/kafka/README.md nit: gateways/kafka/README.md still lists five bridged APIs and five stubs, so it does not mention DeleteTopics. The stub warning tells operators that any client can create topics, but not that a client can now delete topics and their data. Add DeleteTopics to both lists and to that warning.
  • gateways/kafka/docs/MANUAL_TESTING.md nit: gateways/kafka/docs/MANUAL_TESTING.md still treats key 20 as unsupported: C4 expects a close, B1 says 12 API keys, and B4 omits the key. send --api-key 20 now sends v1-v6 and the gateway answers v1-v5, so update those rows and the key count.

This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.

Comment thread gateways/kafka/tests/common/scope.rs
Comment thread gateways/kafka/src/protocol/handlers/delete_topics.rs
Comment thread gateways/kafka/docs/SCOPE.md Outdated
Comment thread gateways/kafka/src/bridge/iggy_bridge/topics.rs Outdated
Comment thread gateways/kafka/tests/version_firewall_tests.rs Outdated
Comment thread gateways/kafka/src/protocol/handlers/delete_topics.rs Outdated
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Oct 4, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 4, 2026
Comment thread gateways/kafka/src/protocol/handlers/delete_topics.rs
Comment thread gateways/kafka/src/bridge/iggy_bridge/topics.rs
Comment thread gateways/kafka/src/protocol/handlers/delete_topics.rs Outdated
Comment thread gateways/kafka/src/protocol/bounds_guard.rs
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/author

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Oct 7, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 8, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

…he Iggy topic only

Squashed from 8 commits on feat/gateways-3546-delete-topics-only for a
clean rebase onto current master.
@ryerraguntla
ryerraguntla force-pushed the feat/gateways-3546-delete-topics-only branch from 6e1ffcf to 2661b5e Compare October 11, 2026 00:58
@hubcio
hubcio merged commit 4dec2a9 into master Oct 12, 2026
109 checks passed
@hubcio
hubcio deleted the feat/gateways-3546-delete-topics-only branch October 12, 2026 11:46
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kafka gateway: Kafka DeleteTopics, DescribeConfigs, and AlterConfigs admin APIs

4 participants