Search code examples
apache-kafkaapache-kafka-streamslinktable

How to truncate a KTable


I have a kafka stream app that utilize a KTable. My app has ran a while so the KTable is already built up.

How do I truncate the KTable (assuming my app can handle rebuilding the table)?

Is stopping my app and also delete data from the changelog topic the correct way? It seems a little complicate I feel there should be a simpler way.

Thank you


Solution

  • If you want to re-create the KTable from scratch, you can use application reset tool. That could be one option for you.

    Application reset tool will delete all the changelog and repartition topics created for an application ID and hence for new run, you will get the new KTable and state store.

    https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Application+Reset+Tool