You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "dajac (via GitHub)" <gi...@apache.org> on 2023/04/06 14:58:30 UTC

[GitHub] [kafka] dajac opened a new pull request, #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

dajac opened a new pull request, #13520:
URL: https://github.com/apache/kafka/pull/13520

   This PR extracts a few classes from https://github.com/apache/kafka/pull/13476.
   
   ### 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.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

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


[GitHub] [kafka] dajac commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1162418338


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *

Review Comment:
   Rephrases the comment a bit. I don't want to mention `__consumer_offsets` here because this Record is not attached to it at all.



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


[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160046597


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *

Review Comment:
   can we add some more description on where this Record object is used? i.e. for the __consumer_offsets topic and that since it's a compacted topic it will always have a key & null value would be a tombstone. 



##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/ResultTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class ResultTest {
+    @Test
+    public void testAttributes() {
+        Result<String> result = new Result<>(Collections.emptyList(), "response");
+        assertEquals(Collections.emptyList(), result.records());
+        assertEquals("response", result.response());
+    }
+
+    @Test
+    public void testAttributesCanNotBeNull() {

Review Comment:
   nit: Cannot



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


[GitHub] [kafka] dajac commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1162418837


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *
+ * This class is immutable.
+ */
+public class Record {
+    /**
+     * The key of the record.
+     */
+    private final ApiMessageAndVersion key;
+
+    /**
+     * The value of the record or null if the record is
+     * a tombstone.
+     */
+    private final ApiMessageAndVersion value;
+
+    /**
+     * Constructs a Record.
+     *
+     * @param key   A non-null key.
+     * @param value A key or null.
+     */
+    public Record(
+        ApiMessageAndVersion key,
+        ApiMessageAndVersion value
+    ) {
+        this.key = Objects.requireNonNull(key);
+        this.value = value;
+    }
+
+    /**
+     * Returns the key.

Review Comment:
   I never know what to put for getters. I have simplified them.



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *
+ * This class is immutable.
+ */
+public class Record {
+    /**
+     * The key of the record.
+     */
+    private final ApiMessageAndVersion key;
+
+    /**
+     * The value of the record or null if the record is
+     * a tombstone.
+     */
+    private final ApiMessageAndVersion value;
+
+    /**
+     * Constructs a Record.
+     *
+     * @param key   A non-null key.
+     * @param value A key or null.
+     */
+    public Record(
+        ApiMessageAndVersion key,
+        ApiMessageAndVersion value
+    ) {
+        this.key = Objects.requireNonNull(key);
+        this.value = value;
+    }
+
+    /**
+     * Returns the key.
+     *
+     * @return The key.
+     */
+    public ApiMessageAndVersion key() {
+        return this.key;
+    }
+
+    /**
+     * Returns the value.
+     *
+     * @return The value or null.
+     */
+    public ApiMessageAndVersion value() {
+        return this.value;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Record record = (Record) o;
+
+        if (!Objects.equals(key, record.key)) return false;
+        return Objects.equals(value, record.value);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = key != null ? key.hashCode() : 0;

Review Comment:
   Nope. Removed it.



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


[GitHub] [kafka] jolshan commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160332413


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *

Review Comment:
   Yeah I realized I didn't understand why both are ApiMessageAndVersion and how one maps to the other.



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


[GitHub] [kafka] jolshan commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160330985


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *
+ * This class is immutable.
+ */
+public class Record {
+    /**
+     * The key of the record.
+     */
+    private final ApiMessageAndVersion key;
+
+    /**
+     * The value of the record or null if the record is
+     * a tombstone.
+     */
+    private final ApiMessageAndVersion value;
+
+    /**
+     * Constructs a Record.
+     *
+     * @param key   A non-null key.
+     * @param value A key or null.
+     */
+    public Record(
+        ApiMessageAndVersion key,
+        ApiMessageAndVersion value
+    ) {
+        this.key = Objects.requireNonNull(key);
+        this.value = value;
+    }
+
+    /**
+     * Returns the key.
+     *
+     * @return The key.
+     */
+    public ApiMessageAndVersion key() {
+        return this.key;
+    }
+
+    /**
+     * Returns the value.
+     *
+     * @return The value or null.
+     */
+    public ApiMessageAndVersion value() {
+        return this.value;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Record record = (Record) o;
+
+        if (!Objects.equals(key, record.key)) return false;
+        return Objects.equals(value, record.value);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = key != null ? key.hashCode() : 0;

Review Comment:
   Can we have a null key?



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


[GitHub] [kafka] jolshan commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160333755


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *

Review Comment:
   Is the general vagueness intentional so we can adapt and use in the transaction coordinator too?



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


[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13520: KAFKA-14462; [4/N] Add Group, Record and Result

Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1162909701


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/RecordTest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMetadataKey;
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class RecordTest {
+    @Test
+    public void testAttributes() {
+        ApiMessageAndVersion key = new ApiMessageAndVersion(new ConsumerGroupMetadataKey(), (short) 0);

Review Comment:
   (also in L53) nit: can we unify the record type, i.e. use ConsumerGroupMemberMetadataKey



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


[GitHub] [kafka] jolshan commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160333623


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Result.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * The result of an operation applied to a state machine. The result
+ * contains a list of {{@link Record}} and a response.

Review Comment:
   So the idea is that an operation will apply records to the log and send a response about the result?



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


[GitHub] [kafka] dajac commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1162419906


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Result.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * The result of an operation applied to a state machine. The result
+ * contains a list of {{@link Record}} and a response.

Review Comment:
   This is correct. Every operation generates records and a response. The records are applied to the log and the response is returned when they are committed.



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


[GitHub] [kafka] jolshan commented on a diff in pull request #13520: KAFKA-14462; [4.1/N] Add Group, Record and Result

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13520:
URL: https://github.com/apache/kafka/pull/13520#discussion_r1160330425


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Record.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group;
+
+import org.apache.kafka.server.common.ApiMessageAndVersion;
+
+import java.util.Objects;
+
+/**
+ * A Record which contains an {{@link ApiMessageAndVersion}} as key and
+ * an {{@link ApiMessageAndVersion}} as value. The value could be null.
+ *
+ * This class is immutable.
+ */
+public class Record {
+    /**
+     * The key of the record.
+     */
+    private final ApiMessageAndVersion key;
+
+    /**
+     * The value of the record or null if the record is
+     * a tombstone.
+     */
+    private final ApiMessageAndVersion value;
+
+    /**
+     * Constructs a Record.
+     *
+     * @param key   A non-null key.
+     * @param value A key or null.
+     */
+    public Record(
+        ApiMessageAndVersion key,
+        ApiMessageAndVersion value
+    ) {
+        this.key = Objects.requireNonNull(key);
+        this.value = value;
+    }
+
+    /**
+     * Returns the key.

Review Comment:
   nit: Do we need both of these?



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


[GitHub] [kafka] dajac merged pull request #13520: KAFKA-14462; [4/N] Add Group, Record and Result

Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac merged PR #13520:
URL: https://github.com/apache/kafka/pull/13520


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