yunfengzhou-hub commented on code in PR #1138:
URL: https://github.com/apache/flink-agents/pull/1138#discussion_r4228162239
##########
runtime/src/main/java/org/apache/flink/agents/runtime/memory/MemoryObjectImpl.java:
##########
@@ -259,6 +259,17 @@ public static final class MemoryItem implements
Serializable {
this.subKeys = new HashSet<>();
}
+ /**
+ * Copy constructor producing an item with an independent {@code
subKeys} set. Used at the
+ * child-memory isolation boundary so the field-list updates that
{@link #set} and {@link
+ * #fillParents} apply in place stay confined to the copy's own scope.
+ */
+ MemoryItem(MemoryItem other) {
+ this.type = other.type;
+ this.value = other.value;
Review Comment:
After discussion with @pltbkd , `MemoryItem` is now immutable and child
scopes isolate by copy-on-write, so a mutable payload (list/map) read from the
parent is copied into the child cache before any write and can no longer mutate
the parent in place. This supersedes the earlier subKeys-only copy. Covered by
`MemoryObjectTest` and `IsolatedCachedMemoryStoreTest`.
--
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]