Skip to content

Conversation

mbohm-atl
Copy link

Description

The BulkRequest's size calculation currently doesn't account for the size of script parameters in update operations. This can lead to underestimating the actual request size when script parameters are used, potentially causing memory-related issues in bulk operations.

Changes

  • Added script parameters size calculation in BulkRequest.internalAdd(UpdateRequest)
  • Size is calculated using script.getParams().toString().length()

Example Use Case

When using bulk updates with scripted updates that contain parameters:

BulkRequest bulk = new BulkRequest();
UpdateRequest update = new UpdateRequest("index", "id")
    .script(new Script(ScriptType.INLINE, "painless", 
        "ctx._source.field += params.value", 
        Collections.singletonMap("value", "large_parameter_value")));
bulk.add(update);

@mbohm-atl mbohm-atl requested a review from a team as a code owner August 22, 2025 09:25
Copy link
Contributor

❌ Gradle check result for 266e445: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for ef5cc17: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

The BulkRequest's size calculation in internalAdd(UpdateRequest) method
currently doesn't account for the size of script parameters. This can lead
to underestimating the actual request size when script parameters are used.

Added script parameters size calculation using script.getParams().toString().length()

Signed-off-by: Marcin Böhm <[email protected]>
@mbohm-atl mbohm-atl force-pushed the fix/bulk/request-size-script-params branch from ef5cc17 to 367bcfa Compare August 22, 2025 10:48
Copy link
Contributor

❌ Gradle check result for 367bcfa: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stalled Issues that have stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant