You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "rishi-rana (via GitHub)" <gi...@apache.org> on 2026/09/06 02:27:19 UTC

[PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

rishi-rana opened a new pull request, #23379:
URL: https://github.com/apache/kafka/pull/23379

   ## Summary
   
   `kafka-metadata-shell` does not show the default user-principal quota (or the default client-id/IP quotas), even though `kafka-configs.sh --describe` shows them correctly.
   
   `ClientQuotaEntity`'s javadoc states that a `null` entity name denotes the built-in default entity, and that's exactly how default quotas are represented in the metadata image (`ClientQuotaImage.dataToEntity`, sourced from the nullable `EntityName` field of `ClientQuotaRecord`).
   
   `ClientQuotasImageNode#clientQuotaEntityToString` only appended an entity segment (`user(...)`, `clientId(...)`, `ip(...)`) when that entity's value was non-null. For a default entity, the value is `null`, so the check silently skipped it — for a single-entry default entity (e.g. just `user=null`) this produced an empty child name, and `ls` effectively lost the entry. `decodeEntity` had the mirrored gap: it never produced a `null` value, so navigating back into a default entity by name (`user()`) could not match the corresponding key already present in the image.
   
   ## Fix
   
   - Track whether each entity type (`clientId`/`ip`/`user`) was present independently of its (possibly `null`) value, and render an empty name for a `null`/default value instead of omitting the segment.
   - Treat an empty parsed name in `decodeEntity` as the default (`null`) value, so it round-trips to the same key used in `ClientQuotasImage`.
   - Updated the existing default-entity round-trip tests to use `null` values (matching real production data) instead of empty strings, since `Map.of` can't hold `null` and the tests were previously exercising a case the shell doesn't actually hit.
   - Added a regression test at the `ClientQuotasImageNode` level reproducing the reported scenario: listing and navigating into a default user-principal quota entity.
   
   ## Test plan
   
   - `./gradlew :metadata:test --tests "org.apache.kafka.image.node.ClientQuotasImageNodeTest"` — all 16 tests pass, including the new regression test.
   - `./gradlew :metadata:checkstyleMain :metadata:checkstyleTest :metadata:spotlessCheck` — clean.
   
   ## AI assistance disclosure
   
   Per `AI_POLICY`/`CONTRIBUTING.md`: Claude Code (Sonnet 5) was used to investigate the root cause, implement the fix, and write the tests in `metadata/src/main/java/org/apache/kafka/image/node/ClientQuotasImageNode.java` and `metadata/src/test/java/org/apache/kafka/image/node/ClientQuotasImageNodeTest.java`. All changes were reviewed by me before submission.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01K4B9PPesZhXHiWr5Ak1PNz


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "rishi-rana (via GitHub)" <gi...@apache.org>.
rishi-rana commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-5684235290

   @AndrewJSchofield @apoorvmittal10 , would you guys be ok to review this PR as well, not sure whom should I reach out to.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-6331872504

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "rishi-rana (via GitHub) via jira" <ji...@kafka.apache.org>.
rishi-rana commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-6565573114

   can I please get this reviewed?


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "github-actions[bot] (via GitHub) via jira" <ji...@kafka.apache.org>.
github-actions[bot] commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-6701497774

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "rishi-rana (via GitHub)" <gi...@apache.org>.
rishi-rana commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-5576735139

   Can I please get a review?


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "rishi-rana (via GitHub)" <gi...@apache.org>.
rishi-rana commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-5628688699

   @chia7712 Requesting review for the changes


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-5738949853

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18141: Show default user/client-id/ip quotas in kafka-metadata-shell [kafka]

Posted by "AndrewJSchofield (via GitHub)" <gi...@apache.org>.
AndrewJSchofield commented on PR #23379:
URL: https://github.com/apache/kafka/pull/23379#issuecomment-6241413208

   @rishi-rana I am not at all familiar with kafka-metadata-shell so don't feel confident reviewing this PR.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org