Kafka Streams无法删除状态目录-DirectoryNotEmptyException

时间:2019-05-23 20:50:34

标签: apache-kafka-streams

我注意到异常流线程[x-CleanupThread]无法通过我们的kafka流应用程序删除状态目录。应用程序使用窗口状态存储,并定义为:

Stores.windowStoreBuilder(
    Stores.persistentWindowStore(
        storeName,
        retentionPeriod,
        retentionWindowSize,
        false),
    Serdes.String(),
    Serdes.String()).withCachingEnabled();  

堆栈跟踪:

 java.nio.file.DirectoryNotEmptyException: /data/consumer/0_17
        at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
        at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
        at java.nio.file.Files.delete(Files.java:1126)
        at org.apache.kafka.common.utils.Utils$2.postVisitDirectory(Utils.java:763)
        at org.apache.kafka.common.utils.Utils$2.postVisitDirectory(Utils.java:746)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at org.apache.kafka.common.utils.Utils.delete(Utils.java:746)
        at org.apache.kafka.streams.processor.internals.StateDirectory.cleanRemovedTasks(StateDirectory.java:290)
        at org.apache.kafka.streams.processor.internals.StateDirectory.cleanRemovedTasks(StateDirectory.java:253)
        at org.apache.kafka.streams.KafkaStreams$2.run(KafkaStreams.java:794)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

0 个答案:

没有答案