danny0405 commented on code in PR #18988:
URL: https://github.com/apache/hudi/pull/18988#discussion_r3670392198


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/callback/common/HoodieWriteCommitCallbackMessage.java:
##########
@@ -69,10 +72,106 @@ public class HoodieWriteCommitCallbackMessage implements 
Serializable {
    */
   private final Option<Map<String, String>> extraMetadata;
 
+  /**
+   * Previous base file paths keyed by fileId, resolved lazily. Populated by 
the write
+   * client from the cached FileSystemView so that callback implementations 
don't have to
+   * rebuild a view. Empty for inserts and for callers that don't pre-resolve.
+   *
+   * <p>Resolution is deferred to the {@code prevFilePathsSupplier} and only 
triggered on the
+   * first {@link #getPrevFilePaths()} call: a callback that never reads the 
previous paths
+   * pays nothing (no FileSystemView access). The resolved value is memoized 
here and is the
+   * form that gets serialized (see {@link #writeObject}).
+   */
+  private Map<String, PrevFilePaths> prevFilePaths;
+
+  /**
+   * Lazily resolves {@link #prevFilePaths}. Transient because it may capture a
+   * FileSystemView (not serializable); excluded from the generated getters so 
it never
+   * leaks into JSON/Java serialization. The resolved map is memoized into
+   * {@link #prevFilePaths}.
+   */
+  @Getter(AccessLevel.NONE)
+  private final transient Supplier<Map<String, PrevFilePaths>> 
prevFilePathsSupplier;

Review Comment:
   do you think we can wrap the supplier with 
`org.apache.hudi.common.util.Lazy` so that we can get rid of the redundant 
`prevFilePaths`.



-- 
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]

Reply via email to