Repository: kafka Updated Branches: refs/heads/0.11.0 70d7d180b -> 4b5c82a8e
MINOR: improve StateStore JavaDocs Clarify that state directory must use `storeName` Author: Matthias J. Sax <[email protected]> Reviewers: Bill Bejeck <[email protected]>, Guozhang Wang <[email protected]> Closes #4228 from mjsax/minor-state-store-javadoc (cherry picked from commit b604540fbde818025afac85c3e96be76f212503e) Signed-off-by: Guozhang Wang <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4b5c82a8 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4b5c82a8 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4b5c82a8 Branch: refs/heads/0.11.0 Commit: 4b5c82a8ee351a57260ec05dd1cf1979e5afa7cd Parents: 70d7d18 Author: Matthias J. Sax <[email protected]> Authored: Fri Nov 17 11:49:09 2017 -0800 Committer: Guozhang Wang <[email protected]> Committed: Fri Nov 17 11:49:28 2017 -0800 ---------------------------------------------------------------------- .../org/apache/kafka/streams/processor/StateStore.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/4b5c82a8/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java ---------------------------------------------------------------------- diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java index 3925951..0c0e3dc 100644 --- a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java +++ b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java @@ -18,13 +18,22 @@ package org.apache.kafka.streams.processor; /** * A storage engine for managing state maintained by a stream processor. - * + * <p> + * If the store is implemented as a persistent store, it <em>must</em> use the store name as directory name and write + * all data into this store directory. + * The store directory must be created with the state directory. + * The state directory can be obtained via {@link ProcessorContext#stateDir() #stateDir()} using the + * {@link ProcessorContext} provided via {@link #init(ProcessorContext, StateStore) init(...)}. + * <p> + * Using nested store directories within the state directory isolates different state stores. + * If a state store would write into the state directory directly, it might conflict with others state stores and thus, + * data might get corrupted and/or Streams might fail with an error. + * Furthermore, Kafka Streams relies on using the store name as store directory name to perform internal cleanup tasks. * <p> * This interface does not specify any query capabilities, which, of course, * would be query engine specific. Instead it just specifies the minimum * functionality required to reload a storage engine from its changelog as well * as basic lifecycle management. - * </p> */ public interface StateStore {
