Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.18.0
Description
Background
Flink serializes and deserializes protobuf format data by calling the decode or encode method in GeneratedProtoToRow_XXX.java generated by codegen to parse byte[] data into Protobuf Java objects. FLINK-32650 has introduced the ability to split the generated code to improve the performance for large Protobuf schemas. However, this is still not sufficient to support some larger protobuf schemas as the generated code exceeds the java constant pool size limit and we can see errors like "Too many constants" when trying to compile the generated code.
Solution
Since we already have the split code functionality already introduced, the main proposal here is to now reuse the variable names across different split method scopes. This will greatly reduce the constant pool size. One more optimization is to only split the last code segment also only when the size exceeds split threshold limit. Currently, the last segment of the generated code is always being split which can lead to too many split methods and thus exceed the constant pool size limit
Attachments
Issue Links
- causes
-
FLINK-34408 VeryBigPbProtoToRowTest#testSimple fails with OOM
- Closed
- is related to
-
FLINK-34403 VeryBigPbProtoToRowTest#testSimple cannot pass due to OOM
- Resolved
- links to