dajac commented on code in PR #18468:
URL: https://github.com/apache/kafka/pull/18468#discussion_r1910349310
##########
core/src/main/scala/kafka/coordinator/group/GroupMetadataManager.scala:
##########
@@ -1085,17 +1084,14 @@ object GroupMetadataManager {
* Generates the payload for offset commit message from given offset and
metadata
*
* @param offsetAndMetadata consumer's current offset and metadata
- * @param metadataVersion the api version
+ * @param maxVersion the naxinu - // Serialize with the highest supported
non-flexible version
+ // until a tagged field is introduced or the version is bumped. FIXME
* @return payload for offset commit message
*/
- def offsetCommitValue(offsetAndMetadata: OffsetAndMetadata,
- metadataVersion: MetadataVersion): Array[Byte] = {
+ def offsetCommitValue(offsetAndMetadata: OffsetAndMetadata, maxVersion:
Short = 3): Array[Byte] = {
val version =
- if (metadataVersion.isLessThan(IBP_2_1_IV0) ||
offsetAndMetadata.expireTimestampMs.isPresent) 1.toShort
- else if (metadataVersion.isLessThan(IBP_2_1_IV1)) 2.toShort
- // Serialize with the highest supported non-flexible version
- // until a tagged field is introduced or the version is bumped.
- else 3.toShort
+ if (offsetAndMetadata.expireTimestampMs.isPresent) 1.toShort
+ else maxVersion
Review Comment:
Is there a need to pass it as an argument to the method or could we just
hardcode it?
##########
core/src/main/scala/kafka/coordinator/group/GroupMetadataManager.scala:
##########
@@ -1112,21 +1108,13 @@ object GroupMetadataManager {
*
* @param groupMetadata current group metadata
* @param assignment the assignment for the rebalancing generation
- * @param metadataVersion the api version
+ * @param version the version to serialize it with, the default is `3`, the
highest supported non-flexible version
+ * until a tagged version is bumped. The default should always be
used outside of tests
* @return payload for offset commit message
*/
def groupMetadataValue(groupMetadata: GroupMetadata,
assignment: Map[String, Array[Byte]],
- metadataVersion: MetadataVersion): Array[Byte] = {
-
- val version =
- if (metadataVersion.isLessThan(IBP_0_10_1_IV0)) 0.toShort
- else if (metadataVersion.isLessThan(IBP_2_1_IV0)) 1.toShort
- else if (metadataVersion.isLessThan(IBP_2_3_IV0)) 2.toShort
- // Serialize with the highest supported non-flexible version
- // until a tagged field is introduced or the version is bumped.
- else 3.toShort
-
+ version: Short = 3): Array[Byte] = {
Review Comment:
ditto.
--
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]