Skip to content

KAFKA-13850: Show missing record type in MetadataShell#12103

Merged
showuon merged 4 commits intoapache:trunkfrom
dengziming:KAFKA-13850
Aug 25, 2022
Merged

KAFKA-13850: Show missing record type in MetadataShell#12103
showuon merged 4 commits intoapache:trunkfrom
dengziming:KAFKA-13850

Conversation

@dengziming
Copy link
Member

@dengziming dengziming commented Apr 28, 2022

More detailed description of your change
Currently, 8 record types are missing in MetadataShell:

  1. AccessControlEntryRecord and RemoveAccessControlEntryRecord are added in KIP-801, FeatureLevelRecord was added in KIP-778, and BrokerRegistrationChangeRecord was added in KIP-841, and NoOpRecord was added in KIP-835, I added these 5 record types in MetadataShell.
  2. AccessControlRecord will not be used since we use AccessControlEntryRecord.
  3. UserScramCredentialRecord, DelegationTokenRecord and will be used in the future, but we can't make sure whether their schema will be changed, just like AccessControlRecord which is outdated. so I didn't add them here.

Summary of testing strategy (including rationale)
Unit tests

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Member Author

@dengziming dengziming Apr 28, 2022

Choose a reason for hiding this comment

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

Just as KIP-778 described, each ACL is shown in /acl/id/ in its JSON form. however, I should mention here that their schema in ZkNode is more hierarchical:

get /kafka/kafka-acl/${resourceType}/${resourceName}
 
{
    "version":1,
    "acls":[
        {
            "principal":"User:kafka",
            "permissionType":"Allow",
            "operation":"Read",
            "host":"1.1.1.1"
        }
    ]
}

@dengziming dengziming force-pushed the KAFKA-13850 branch 2 times, most recently from e4867cb to 7c6f19e Compare August 3, 2022 02:39
@dengziming
Copy link
Member Author

ping @mumrah

@showuon
Copy link
Member

showuon commented Aug 24, 2022

@jsancio , I think we should make this fix into v3.3, otherwise, the metadata shell is basically broken. WDYT?
@dengziming , could you help confirm if this patch contain all record types we have now? Thanks.

Copy link
Member

@showuon showuon left a comment

Choose a reason for hiding this comment

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

@dengziming , thanks for the fix, left some comments.

Copy link
Member

Choose a reason for hiding this comment

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

nit: additional empty line

Copy link
Member

Choose a reason for hiding this comment

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

nit: since this is just for test, we can use Uuid.ZERO_UUID for testing, to avoid random strings here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a little overkill here, we are using random strings in a lot of test cases and it won't reduce the code quality, and Uuid.ZERO_UUID may have some special meaning in different cases.

Comment on lines +377 to +378
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, could you let me know where we mentioned featureLevel == 0 means delete it? I checked the record schema, it didn't mention this:

"apiKey": 12,
"type": "metadata",
"name": "FeatureLevelRecord",
"validVersions": "0",
"flexibleVersions": "0+",
"fields": [
{ "name": "Name", "type": "string", "versions": "0+",
"about": "The feature name." },
{ "name": "FeatureLevel", "type": "int16", "versions": "0+",
"about": "The current finalized feature level of this feature for the cluster." }

Copy link
Member Author

Choose a reason for hiding this comment

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

Firstly we have a RemoveFeatureLevelRecord.json but we removed it in #12207 and we use 0-0 to represent not supported:

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for sharing! What a magic 0, haha! Could we add a simple note into FeatureLevelRecord.json? Something like:

{ "name": "FeatureLevel", "type": "int16", "versions": "0+", 
     "about": "The current finalized feature level of this feature for the cluster. 0 means feature not enabled." } 

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion.

Copy link
Member Author

@dengziming dengziming left a comment

Choose a reason for hiding this comment

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

Thank you @showuon for reviewing, I will fix them soon, I have checked all the record types and their fields, except some records we don't support now, for example, USER_SCRAM_CREDENTIAL_RECORD

Comment on lines +377 to +378
Copy link
Member Author

Choose a reason for hiding this comment

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

Firstly we have a RemoveFeatureLevelRecord.json but we removed it in #12207 and we use 0-0 to represent not supported:

// limitations under the License.

{
"apiKey": 6,
Copy link
Member

Choose a reason for hiding this comment

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

Could we not delete this file in this PR? I think it'd be better we raise another JIRA or PR to delete it. I'm not 100% sure we will use it or not. Let's focus on missing record type in this PR. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this makes sense, it's reasonable to keep it.

Copy link
Member

@showuon showuon left a comment

Choose a reason for hiding this comment

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

LGTM! Please revert the AccessControlRecord.json change. Thanks.

@showuon
Copy link
Member

showuon commented Aug 24, 2022

Thank you! Let's wait for the jenkins build. @jsancio , I'm going to backport this patch to 3.3 tomorrow if you have no objection. Thanks.

@showuon
Copy link
Member

showuon commented Aug 25, 2022

Failed tests are un-related:

Build / JDK 11 and Scala 2.13 / kafka.server.KRaftClusterTest.testCreateClusterAndPerformReassignment()

@showuon showuon merged commit 19581ef into apache:trunk Aug 25, 2022
showuon pushed a commit that referenced this pull request Aug 25, 2022
AccessControlEntryRecord and RemoveAccessControlEntryRecord are added in KIP-801, FeatureLevelRecord was added in KIP-778, and BrokerRegistrationChangeRecord was added in KIP-841, and NoOpRecord was added in KIP-835, I added these 5 record types in MetadataShell.

 Reviewers: Luke Chen <showuon@gmail.com>
@showuon
Copy link
Member

showuon commented Aug 25, 2022

backport to 3.3

@mumrah
Copy link
Member

mumrah commented Aug 25, 2022

Sorry for the delay @dengziming, yes this is needed for 3.3. Thanks!

mumrah added a commit to confluentinc/kafka that referenced this pull request Nov 30, 2023
This is a partial backport of [KAFKA-13270](https://issues.apache.org/jira/browse/KAFKA-13270)
which sets the JUTE_MAXBUFFER configuration to 4MB unless otherwise specified.
mumrah added a commit to confluentinc/kafka that referenced this pull request Nov 30, 2023
This is a partial backport of [KAFKA-13270](https://issues.apache.org/jira/browse/KAFKA-13270)
which sets the JUTE_MAXBUFFER configuration to 4MB unless otherwise specified.
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.

3 participants