chia7712 commented on code in PR #17211:
URL: https://github.com/apache/kafka/pull/17211#discussion_r1763956943


##########
core/src/test/scala/unit/kafka/log/LogManagerTest.scala:
##########
@@ -1393,6 +1394,32 @@ class LogManagerTest {
     assertTimeoutPreemptively(Duration.ofMillis(5000), stopLogManager)
     assertTimeoutPreemptively(Duration.ofMillis(5000), stopScheduler)
   }
+
+  /**
+   * This test simulates an offline log directory by removing write 
permissions from the directory.
+   * It verifies that the LogManager continues to operate without failure in 
this scenario.
+   * For more details, refer to KAFKA-17356.
+   */
+  @Test
+  def testInvalidLogDirNotFailLogManager(): Unit = {
+    logManager.shutdown()
+    val permissions = Files.getPosixFilePermissions(logDir.toPath)
+    // Remove write permissions for user, group, and others
+    permissions.remove(PosixFilePermission.OWNER_WRITE)
+    permissions.remove(PosixFilePermission.GROUP_WRITE)
+    permissions.remove(PosixFilePermission.OTHERS_WRITE)
+    Files.setPosixFilePermissions(logDir.toPath, permissions)
+
+    try {
+      logManager = assertDoesNotThrow(() => createLogManager())

Review Comment:
   Could you please check the size of `dirLocks`? it should be `0`



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

Reply via email to