MINOR: Clean up comments and remove unused code in RecordVersion and CreateTopicsRequestTest (#19342)

## Summary

This PR updates the `RecordVersion` javadoc for clarity. It removes
outdated references to `message.format.version` mentioned in the [Kafka
4.0 upgrade
documentation](48f06981ee/40/upgrade.html (L135))
and aligns with feedback from a previous discussion in [#19325
](https://github.com/apache/kafka/pull/19325).

## Changes
- Cleaned up javadoc in `RecordVersion`
- Removed outdated or deprecated references

Reviewers: PoAn Yang <payang@apache.org>, Ken Huang
<s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Hong-Yi Chen 2025-04-07 07:47:06 +08:00 committed by GitHub
parent 6d68f8a82c
commit 6dd2cc70c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 14 deletions

View File

@ -20,8 +20,7 @@ package org.apache.kafka.common.record;
* Defines the record format versions supported by Kafka. * Defines the record format versions supported by Kafka.
* *
* For historical reasons, the record format version is also known as `magic` and `message format version`. Note that * For historical reasons, the record format version is also known as `magic` and `message format version`. Note that
* the version actually applies to the {@link RecordBatch} (instead of the {@link Record}). Finally, the * the version actually applies to the {@link RecordBatch} (instead of the {@link Record}).
* `message.format.version` topic config confusingly expects an ApiVersion instead of a RecordVersion.
*/ */
public enum RecordVersion { public enum RecordVersion {
V0(0), V1(1), V2(2); V0(0), V1(1), V2(2);
@ -34,15 +33,6 @@ public enum RecordVersion {
this.value = (byte) value; this.value = (byte) value;
} }
/**
* Check whether this version precedes another version.
*
* @return true only if the magic value is less than the other's
*/
public boolean precedes(RecordVersion other) {
return this.value < other.value;
}
public static RecordVersion lookup(byte value) { public static RecordVersion lookup(byte value) {
if (value < 0 || value >= VALUES.length) if (value < 0 || value >= VALUES.length)
throw new IllegalArgumentException("Unknown record version: " + value); throw new IllegalArgumentException("Unknown record version: " + value);

View File

@ -77,9 +77,6 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest {
validateErrorCreateTopicsRequests(topicsReq(Seq(topicReq("error-config", validateErrorCreateTopicsRequests(topicsReq(Seq(topicReq("error-config",
config=Map("not.a.property" -> "error")))), config=Map("not.a.property" -> "error")))),
Map("error-config" -> error(Errors.INVALID_CONFIG)), checkErrorMessage = false) Map("error-config" -> error(Errors.INVALID_CONFIG)), checkErrorMessage = false)
validateErrorCreateTopicsRequests(topicsReq(Seq(topicReq("error-config-value",
config=Map("message.format.version" -> "invalid-value")))),
Map("error-config-value" -> error(Errors.INVALID_CONFIG)), checkErrorMessage = false)
validateErrorCreateTopicsRequests(topicsReq(Seq(topicReq("error-assignment", validateErrorCreateTopicsRequests(topicsReq(Seq(topicReq("error-assignment",
assignment=Map(0 -> List(0, 1), 1 -> List(0))))), assignment=Map(0 -> List(0, 1), 1 -> List(0))))),
Map("error-assignment" -> error(Errors.INVALID_REPLICA_ASSIGNMENT)), checkErrorMessage = false) Map("error-assignment" -> error(Errors.INVALID_REPLICA_ASSIGNMENT)), checkErrorMessage = false)