AndrewJSchofield commented on code in PR #18261:
URL: https://github.com/apache/kafka/pull/18261#discussion_r1890836228


##########
group-coordinator/src/main/resources/common/message/OffsetCommitValue.json:
##########
@@ -14,7 +14,8 @@
 // limitations under the License.
 
 {
-  "type": "data",
+  "apiKey": 1,
+  "type": "coordinator-value",

Review Comment:
   This is clearly a slightly compromised area because of the way that 
OffsetCommit has already used two key version numbers. I would say that 
OffsetCommitValueV0 would have valid version 0, and OffsetCommitValue would 
have valid versions 1-4. In practice, you'll never find an instance of v0 for 
OffsetCommitValue because it would actually be OffsetCommitValueV0.



##########
generator/src/main/java/org/apache/kafka/message/MessageSpec.java:
##########
@@ -81,6 +82,24 @@ public MessageSpec(@JsonProperty("name") String name,
                 "messages with type `request`");
         }
         this.latestVersionUnstable = latestVersionUnstable;
+
+        if (type == MessageSpecType.COORDINATOR_KEY) {
+            if (this.apiKey.isEmpty()) {
+                throw new RuntimeException("The ApiKey must be set for 
messages " + name + " with type `record-key`");
+            }
+            if (!this.validVersions().equals(new Versions((short) 0, ((short) 
0)))) {
+                throw new RuntimeException("The Versions must be set to `0` 
for messages " + name + " with type `record-key`");

Review Comment:
   ditto



##########
generator/src/main/java/org/apache/kafka/message/MessageSpec.java:
##########
@@ -81,6 +82,24 @@ public MessageSpec(@JsonProperty("name") String name,
                 "messages with type `request`");
         }
         this.latestVersionUnstable = latestVersionUnstable;
+
+        if (type == MessageSpecType.COORDINATOR_KEY) {
+            if (this.apiKey.isEmpty()) {
+                throw new RuntimeException("The ApiKey must be set for 
messages " + name + " with type `record-key`");
+            }
+            if (!this.validVersions().equals(new Versions((short) 0, ((short) 
0)))) {
+                throw new RuntimeException("The Versions must be set to `0` 
for messages " + name + " with type `record-key`");
+            }
+            if (!this.flexibleVersions.empty()) {
+                throw new RuntimeException("The FlexibleVersions are not 
supported for messages " + name + "  with type `record-key`");

Review Comment:
   ditto



##########
generator/src/main/java/org/apache/kafka/message/MessageSpec.java:
##########
@@ -81,6 +82,24 @@ public MessageSpec(@JsonProperty("name") String name,
                 "messages with type `request`");
         }
         this.latestVersionUnstable = latestVersionUnstable;
+
+        if (type == MessageSpecType.COORDINATOR_KEY) {
+            if (this.apiKey.isEmpty()) {
+                throw new RuntimeException("The ApiKey must be set for 
messages " + name + " with type `record-key`");

Review Comment:
   `record-key` should be `coordinator-key`.



##########
generator/src/main/java/org/apache/kafka/message/MessageSpec.java:
##########
@@ -81,6 +82,24 @@ public MessageSpec(@JsonProperty("name") String name,
                 "messages with type `request`");
         }
         this.latestVersionUnstable = latestVersionUnstable;
+
+        if (type == MessageSpecType.COORDINATOR_KEY) {
+            if (this.apiKey.isEmpty()) {
+                throw new RuntimeException("The ApiKey must be set for 
messages " + name + " with type `record-key`");
+            }
+            if (!this.validVersions().equals(new Versions((short) 0, ((short) 
0)))) {
+                throw new RuntimeException("The Versions must be set to `0` 
for messages " + name + " with type `record-key`");
+            }
+            if (!this.flexibleVersions.empty()) {
+                throw new RuntimeException("The FlexibleVersions are not 
supported for messages " + name + "  with type `record-key`");
+            }
+        }
+
+        if (type == MessageSpecType.COORDINATOR_VALUE) {
+            if (this.apiKey.isEmpty()) {
+                throw new RuntimeException("The ApiKey must be set for 
messages with type `record-key`");

Review Comment:
   `record-key` should be `coordinator-value`.



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

Reply via email to