Description
We improved the state directory folder/file permission setting in KAFKA-10705. But we forgot to consider one situation: if user doesn't have PersistentStores, we won't need to create base dir and state dir. And if there's no such dir/file, and we tried to set permission to them, we'll have NoSuchFileException
ERROR Error changing permissions for the state or base directory /var/folders/4l/393lkmzx3zvftwynjngzdsfw0000gn/T/kafka-11254487964259813330/appId_AdjustStreamThreadCountTestshouldAddStreamThread (org.apache.kafka.streams.processor.internals.StateDirectory:117) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] java.nio.file.NoSuchFileException: /var/folders/4l/393lkmzx3zvftwynjngzdsfw0000gn/T/kafka-11254487964259813330/appId_AdjustStreamThreadCountTestshouldAddStreamThread 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:254) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:276) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2079) 2021-01-15T16:10:44.570+0800 [DEBUG] [TestEventLogger] at org.apache.kafka.streams.processor.internals.StateDirectory.<init>(StateDirectory.java:115)