-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-13093: Log compaction should write new segments with record version v2 (KIP-724) #18321
base: trunk
Are you sure you want to change the base?
KAFKA-13093: Log compaction should write new segments with record version v2 (KIP-724) #18321
Conversation
f38e108
to
d41a6e2
Compare
@@ -2580,6 +2580,23 @@ class UnifiedLogTest { | |||
assertEquals(None, log.leaderEpochCache.flatMap(_.latestEpoch.toScala)) | |||
} | |||
|
|||
@Test | |||
def testLeaderEpochCacheCreatedAfterMessageFormatUpgrade(): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was originally removed via #18267 - added it back and modified it to take into account that the leader epoch cache always exists now (since the configured record version is always V2).
…sion v2 (KIP-724)
… longer supported
…e it always creates it now
…'s still a useful test
@@ -262,12 +261,6 @@ object LogTestUtils { | |||
def listProducerSnapshotOffsets(logDir: File): Seq[Long] = | |||
ProducerStateManager.listSnapshotFiles(logDir).asScala.map(_.offset).sorted.toSeq | |||
|
|||
def assertLeaderEpochCacheEmpty(log: UnifiedLog): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
@@ -134,6 +135,131 @@ class LogCleanerParameterizedIntegrationTest extends AbstractLogCleanerIntegrati | |||
assertEquals(toMap(messages), toMap(read), "Contents of the map shouldn't change") | |||
} | |||
|
|||
@ParameterizedTest | |||
@ArgumentsSource(classOf[LogCleanerParameterizedIntegrationTest.ExcludeZstd]) | |||
def testCleanerWithMessageFormatV0V1V2(compressionType: CompressionType): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests added in this class were originally removed via #18267 - added them back, modified them to fit the new reality and extended them to include more extensive verification of the log after compaction.
0ede54e
to
a50bd5d
Compare
@junrao Would you be able to review this PR? I would like to include it in Apache Kafka 4.0, if possible - it completes KIP-724. |
Convert v0/v1 record batches to v2 during compaction even if said record batches would be
written with no change otherwise. A few important details:
CreateTime
and thetimestamp is
-1
.KAFKA-4298
workaround is no longer needed since the conversion to V2 fixesthe issue too.
supported.
config is effectively always V2.
Add integration tests, these tests existed before #18267 - restored, modified and
extended them.
Committer Checklist (excluded from commit message)