Github user kl0u commented on a diff in the pull request: https://github.com/apache/flink/pull/5230#discussion_r166344317 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedStateBackend.java --- @@ -38,6 +38,37 @@ */ void setCurrentKey(K newKey); + /** + * Returns a safe version of the current key (see {@link #setCurrentKey(Object)}). + * + * <p>"Safe" means that the user can interact with it without jeopardizing correctness. + * This implies that: + * <ol> + * <li>for the {@code MemoryStateBackend} and the {@code FsStateBackend} we + * return a <b>copy</b> of the actual key, while + * <li>for the {@code RocksDBStateBackend} we return the key itself, as returned + * by the backend. + * </ol> + * + * <p>The copy is created using the {@link TypeSerializer#copy(Object) copy()} method + * of the key {@link TypeSerializer}. Consequently, the correctness of the method assumes + * a correct {@code copy()} method. + * + */ + K getCurrentKeySafe(); --- End diff -- Ok I will remove this.
---