SEPURI-SAI-KRISHNA commented on code in PR #29345:
URL: https://github.com/apache/flink/pull/29345#discussion_r4284216001
##########
flink-table/flink-table-test-utils/src/main/java/org/apache/flink/table/runtime/functions/TestHarnessStateManager.java:
##########
@@ -198,6 +198,43 @@ <T> Map<Row, T> getStateForAllKeys(String stateName) {
return result;
}
+ /**
+ * Returns a deep copy of all state, keyed by partition key. Later
mutations of the live state
+ * are not visible through the returned map.
+ */
+ Map<Row, Map<String, Object>> snapshotState() {
+ return copyStateByKey(stateByKey);
+ }
+
+ /** Replaces all state with a deep copy of the given snapshot. */
+ void restoreState(Map<Row, Map<String, Object>> snapshot) {
+ stateByKey.clear();
+ stateByKey.putAll(copyStateByKey(snapshot));
+ }
Review Comment:
Gone, and the timer manager had the identical pattern, which I had missed.
Both now assert they are populated once instead of clearing first.
`testRestoreReplacesLiveTimers` asserted replace semantics the new construction
cannot reach, so it is now `testRestoreRequiresAFreshManager`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]