You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/07/06 21:11:06 UTC

[GitHub] [kafka] abbccdda opened a new pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

abbccdda opened a new pull request #8989:
URL: https://github.com/apache/kafka/pull/8989


   This is a bug fix for older admin clients using static membership and call DescribeGroups. By making `groupInstanceId` ignorable, it would not crash upon handling the response.
   
   Added test coverages for DescribeGroups, and some side cleanups.
   
   Verified that the test `testGroupInstanceIdIgnorableInDescribeGroupsResponse` would fail without the `ignorable` flag:
   ```
   org.apache.kafka.common.errors.UnsupportedVersionException: Attempted to write a non-default groupInstanceId at version 0
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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.

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



[GitHub] [kafka] abbccdda merged pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
abbccdda merged pull request #8989:
URL: https://github.com/apache/kafka/pull/8989


   


----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji commented on pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
hachikuji commented on pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#issuecomment-654473290


   @abbccdda Thanks for the quick fix. I am wondering if we have a similar problem with authorized operations:
   ```
         { "name": "AuthorizedOperations", "type": "int32", "versions": "3+",  "default": "-2147483648",
           "about": "32-bit bitfield to represent authorized operations for this group." }
   ```
   The code for setting this field is here:
   ```
           if (request.header.apiVersion >= 3) {
             if (error == Errors.NONE && describeRequest.data().includeAuthorizedOperations()) {
               describedGroup.setAuthorizedOperations(authorizedOperations(request, new Resource(ResourceType.GROUP, groupId)))
             } else {
               describedGroup.setAuthorizedOperations(0)
             }
           }
   ```
   The field is not ignorable and 0 is not the default. Can you check whether this is a problem?


----------------------------------------------------------------
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.

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



[GitHub] [kafka] abbccdda commented on pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
abbccdda commented on pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#issuecomment-654578798


   Cherry-picked to 2.4, 2.5, 2.6, with slight test modification. (DescribeGroupsResponse#duplicate was not available in 2.4 & 2.5)


----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji commented on a change in pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
hachikuji commented on a change in pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#discussion_r450514285



##########
File path: clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
##########
@@ -218,6 +220,59 @@ public void testOffsetCommitDefaultGroupInstanceId() throws Exception {
         testAllMessageRoundTripsFromVersion((short) 7, request.get().setGroupInstanceId(instanceId));
     }
 
+    @Test
+    public void testDescribeGroupsRequestVersions() throws Exception {
+        testAllMessageRoundTrips(new DescribeGroupsRequestData()
+                .setGroups(Collections.singletonList("group"))
+                .setIncludeAuthorizedOperations(false));
+    }
+
+    @Test
+    public void testDescribeGroupsResponseVersions() throws Exception {
+        DescribedGroupMember baseMember = new DescribedGroupMember()
+            .setMemberId(memberId);
+
+        DescribedGroup baseGroup = new DescribedGroup()
+                                       .setGroupId("group")
+                                       .setGroupState("Stable").setErrorCode(Errors.NONE.code())
+                                       .setMembers(Collections.singletonList(baseMember))
+                                       .setProtocolType("consumer");
+        DescribeGroupsResponseData baseResponse = new DescribeGroupsResponseData()
+                                                  .setGroups(Collections.singletonList(baseGroup));
+        testAllMessageRoundTrips(baseResponse);
+
+        testAllMessageRoundTripsFromVersion((short) 1, baseResponse.setThrottleTimeMs(10));

Review comment:
       Then we wouldn't have caught this bug 😉 . The most dangerous aspect of the generated protocols is the down-conversion to older formats since it gets poor test coverage.




----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji commented on pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
hachikuji commented on pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#issuecomment-654473843


   Oh, sorry, I missed the version check. So above looks fine.


----------------------------------------------------------------
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.

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



[GitHub] [kafka] hachikuji commented on a change in pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
hachikuji commented on a change in pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#discussion_r450490649



##########
File path: clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
##########
@@ -218,6 +220,59 @@ public void testOffsetCommitDefaultGroupInstanceId() throws Exception {
         testAllMessageRoundTripsFromVersion((short) 7, request.get().setGroupInstanceId(instanceId));
     }
 
+    @Test
+    public void testDescribeGroupsRequestVersions() throws Exception {
+        testAllMessageRoundTrips(new DescribeGroupsRequestData()
+                .setGroups(Collections.singletonList("group"))
+                .setIncludeAuthorizedOperations(false));
+    }
+
+    @Test
+    public void testDescribeGroupsResponseVersions() throws Exception {
+        DescribedGroupMember baseMember = new DescribedGroupMember()
+            .setMemberId(memberId);
+
+        DescribedGroup baseGroup = new DescribedGroup()
+                                       .setGroupId("group")
+                                       .setGroupState("Stable").setErrorCode(Errors.NONE.code())
+                                       .setMembers(Collections.singletonList(baseMember))
+                                       .setProtocolType("consumer");
+        DescribeGroupsResponseData baseResponse = new DescribeGroupsResponseData()
+                                                  .setGroups(Collections.singletonList(baseGroup));
+        testAllMessageRoundTrips(baseResponse);
+
+        testAllMessageRoundTripsFromVersion((short) 1, baseResponse.setThrottleTimeMs(10));

Review comment:
       Should we test the expected behavior for all versions?

##########
File path: clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
##########
@@ -933,7 +983,7 @@ private void verifyWriteRaisesNpe(short version, Message message) throws Excepti
 
     private void verifyWriteRaisesUve(short version,
                                       String problemText,
-                                     Message message) throws Exception {
+                                     Message message) {

Review comment:
       nit: may as well fix alignment as well




----------------------------------------------------------------
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.

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



[GitHub] [kafka] abbccdda commented on a change in pull request #8989: KAFKA-10239: Make GroupInstanceId ignorable in DescribeGroups

Posted by GitBox <gi...@apache.org>.
abbccdda commented on a change in pull request #8989:
URL: https://github.com/apache/kafka/pull/8989#discussion_r450510257



##########
File path: clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
##########
@@ -218,6 +220,59 @@ public void testOffsetCommitDefaultGroupInstanceId() throws Exception {
         testAllMessageRoundTripsFromVersion((short) 7, request.get().setGroupInstanceId(instanceId));
     }
 
+    @Test
+    public void testDescribeGroupsRequestVersions() throws Exception {
+        testAllMessageRoundTrips(new DescribeGroupsRequestData()
+                .setGroups(Collections.singletonList("group"))
+                .setIncludeAuthorizedOperations(false));
+    }
+
+    @Test
+    public void testDescribeGroupsResponseVersions() throws Exception {
+        DescribedGroupMember baseMember = new DescribedGroupMember()
+            .setMemberId(memberId);
+
+        DescribedGroup baseGroup = new DescribedGroup()
+                                       .setGroupId("group")
+                                       .setGroupState("Stable").setErrorCode(Errors.NONE.code())
+                                       .setMembers(Collections.singletonList(baseMember))
+                                       .setProtocolType("consumer");
+        DescribeGroupsResponseData baseResponse = new DescribeGroupsResponseData()
+                                                  .setGroups(Collections.singletonList(baseGroup));
+        testAllMessageRoundTrips(baseResponse);
+
+        testAllMessageRoundTripsFromVersion((short) 1, baseResponse.setThrottleTimeMs(10));

Review comment:
       We would check for equality only with versions that already introduced the new fields IMHO?




----------------------------------------------------------------
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.

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