dosubot[bot] commented on issue #3046: URL: https://github.com/apache/hugegraph/issues/3046#issuecomment-4598801818
<!-- Answer --> This is a valid feature request. Here's the analysis: **Current Behavior:** `MAX_BUFFER_CAPACITY` is hardcoded as `128 * 1024 * 1024` (128 MB) in [`BytesBuffer.java`](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java#L79). It acts as a hard ceiling in two places: 1. Buffer creation — throws `IllegalArgumentException` if the requested capacity exceeds 128 MB [[1]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java#L93-L101) 2. Dynamic resizing via `require()` — fails when the expanded capacity would exceed 128 MB [[2]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java#L166-L187) This means any single serialization/deserialization operation that produces data larger than 128 MB will fail, which can block large data exports. **Developer Intent:** The code already contains `// TODO: support user-defined configuration` comments for related constants (`ID_LEN_MAX`, `BYTES_LEN_MAX`) [[3]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java#L61), indicating the team recognized the need but hasn't implemented it yet. **Feasibility:** HugeGraph's `CoreOptions` class already defines several similar configurable memory limits [[4]](https://github.com/apache/hugegraph/blob/9126c80e414c073b60fc074361b211cfb409e0eb/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java#L651-L674) — e.g., `MAX_MEMORY_CAPACITY` (1 GB default), `TASK_INPUT_SIZE_LIMIT` (16 MB), and `TASK_RESULT_SIZE_LIMIT` (16 MB). Adding a new option for `MAX_BUFFER_CAPACITY` would follow the same pattern: ```java public static final ConfigOption<Integer> SERIALIZER_BUFFER_MAX_CAPACITY = new ConfigOption<>( "serializer.buffer_max_capacity", "Maximum capacity of the serialization buffer in bytes.", rangeInt(64 * 1024 * 1024, 512 * 1024 * 1024), // example: 64MB–512MB 128 * 1024 * 1024 // default 128MB ); ``` **Implementation steps would include:** 1. Add a `ConfigOption` in `CoreOptions` 2. Modify `BytesBuffer` to read the configured value (likely cached at initialization for performance in hot paths like `require()`) 3. Update references in LZ4 compression utilities that also use this constant This seems like a reasonable enhancement given the existing pattern and the TODO comments already in the code. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fhugegraph).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fhugegraph). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fhugegraph&message_id=9c16ddd0-d0b8-4781-8db6-a5f54516190e) [](https://github.dosu.com/apache/hugegraph?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fhugegraph) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fhugegraph) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
