derrickaw commented on code in PR #36073:
URL: https://github.com/apache/beam/pull/36073#discussion_r2337113264


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java:
##########
@@ -34,43 +35,41 @@
 @Internal
 public class RowJsonUtils {
 
-  //
-  private static int defaultBufferLimit;
+  // The maximum string length for the JSON parser, set to 100 MB.
+  public static final int MAX_STRING_LENGTH = 100 * 1024 * 1024;
 
   /**
-   * Increase the default jackson-databind stream read constraint.
+   * Creates a thread-safe JsonFactory with custom stream read constraints.
    *
-   * <p>StreamReadConstraints was introduced in jackson 2.15 causing string > 
20MB (5MB in 2.15.0)
-   * parsing failure. This has caused regressions in its dependencies include 
Beam. Here we
-   * overwrite the default buffer size limit to 100 MB, and exposes this 
interface for higher limit.
-   * If needed, call this method during pipeline run time, e.g. in DoFn.setup.
+   * <p>This method encapsulates the logic to increase the default 
jackson-databind stream read
+   * constraint to 100MB. This functionality was introduced in Jackson 2.15 
causing string > 20MB
+   * (5MB in <2.15.0) parsing failure. This has caused regressions in its 
dependencies including
+   * Beam. Here we create a streamReadConstraints minimum size limit set to 
100MB and exposing the
+   * factory to higher limits. If needed, call this method during pipeline run 
time, e.g. in
+   * DoFn.setup. This avoids a data race caused by modifying the global 
default settings.
    */
-  public static void increaseDefaultStreamReadConstraints(int newLimit) {

Review Comment:
   I changed all of the instances inside beam, but for outside that not sure.  
Just noticed Templates does use it.  
   
   Will keep the old method, but take all known users off of it.  Sound 
reasonable?  Thanks.



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to