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-16552: Create an internal config to control InitialTaskDelayMs in LogManager to speed up tests #15719
KAFKA-16552: Create an internal config to control InitialTaskDelayMs in LogManager to speed up tests #15719
Changes from 5 commits
37987bf
de7eecb
b41ab1a
97768f3
cdf4e06
0cd7dcd
70c99bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,12 +69,14 @@ class LogManagerTest { | |
var logManager: LogManager = _ | ||
val name = "kafka" | ||
val veryLargeLogFlushInterval = 10000000L | ||
val initialTaskDelayMs: Long = 10 * 1000 | ||
|
||
@BeforeEach | ||
def setUp(): Unit = { | ||
logDir = TestUtils.tempDir() | ||
logManager = createLogManager() | ||
logManager.startup(Set.empty) | ||
assertEquals(initialTaskDelayMs, logManager.initialTaskDelayMs) | ||
} | ||
|
||
@AfterEach | ||
|
@@ -413,7 +415,7 @@ class LogManagerTest { | |
assertEquals(numMessages * setSize / segmentBytes, log.numberOfSegments, "Check we have the expected number of segments.") | ||
|
||
// this cleanup shouldn't find any expired segments but should delete some to reduce size | ||
time.sleep(logManager.InitialTaskDelayMs) | ||
time.sleep(logManager.initialTaskDelayMs) | ||
assertEquals(6, log.numberOfSegments, "Now there should be exactly 6 segments") | ||
time.sleep(log.config.fileDeleteDelayMs + 1) | ||
Comment on lines
-416
to
420
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we create a test in LogManagerTest to verify the logManager will start these tasks after customized There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Huge thanks ! I'm a little confused about the comment above, the test in LogManagerTest itself verify that tasks like log cleanup, flush logs are triggered after sleeping initialTaskDelayMs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, and currently, all of them are setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation !
I decided to follow the comment as you mentioned earlier, and updated the initialTaskDelayMs to 10s in LogManagerTests. Please take another look 😃 |
||
|
||
|
@@ -482,7 +484,7 @@ class LogManagerTest { | |
val set = TestUtils.singletonRecords("test".getBytes()) | ||
log.appendAsLeader(set, leaderEpoch = 0) | ||
} | ||
time.sleep(logManager.InitialTaskDelayMs) | ||
time.sleep(logManager.initialTaskDelayMs) | ||
assertTrue(lastFlush != log.lastFlushTime, "Time based flush should have been triggered") | ||
} | ||
|
||
|
@@ -604,7 +606,8 @@ class LogManagerTest { | |
configRepository = configRepository, | ||
logDirs = logDirs, | ||
time = this.time, | ||
recoveryThreadsPerDataDir = recoveryThreadsPerDataDir) | ||
recoveryThreadsPerDataDir = recoveryThreadsPerDataDir, | ||
initialTaskDelayMs = initialTaskDelayMs) | ||
} | ||
|
||
@Test | ||
|
@@ -637,9 +640,9 @@ class LogManagerTest { | |
fileInIndex.get.getAbsolutePath) | ||
} | ||
|
||
time.sleep(logManager.InitialTaskDelayMs) | ||
time.sleep(logManager.initialTaskDelayMs) | ||
assertTrue(logManager.hasLogsToBeDeleted, "Logs deleted too early") | ||
time.sleep(logManager.currentDefaultConfig.fileDeleteDelayMs - logManager.InitialTaskDelayMs) | ||
time.sleep(logManager.currentDefaultConfig.fileDeleteDelayMs - logManager.initialTaskDelayMs) | ||
assertFalse(logManager.hasLogsToBeDeleted, "Logs not deleted") | ||
} | ||
|
||
|
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.
please add setter for it