Skip to content

Add recursion guard to prevent infinite splitting in batch processing#163

Open
Copilot wants to merge 4 commits intofeature/batch-too-large-retriesfrom
copilot/sub-pr-122
Open

Add recursion guard to prevent infinite splitting in batch processing#163
Copilot wants to merge 4 commits intofeature/batch-too-large-retriesfrom
copilot/sub-pr-122

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

The recursive batch splitting logic lacked a termination condition when batch size reaches 1, risking infinite recursion if a single event triggers BatchTooLargeException.

Changes

  • cassandra2/PersistentActorUpdateEventProcessor: Added size check in executeBatchV1, executeBatchV1Optimized, and executeBatchV2AndUp
  • cassandra4/PersistentActorUpdateEventProcessor: Added size check in executeBatchV3AndUp

When events.size() <= 1 and BatchTooLargeException is caught, throw IllegalStateException with clear diagnostic instead of attempting further splits:

catch(BatchTooLargeException e) {
    if(events.size() <= 1) {
        logger.error("Single event of byteSize {} is too large to execute", e.getBatchSize());
        throw new IllegalStateException("Single event is too large to process", e);
    }
    int half = events.size() / 2;
    // split and recurse...
}

This prevents stack overflow while providing actionable error messages when individual events exceed Cassandra size limits.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 26, 2025 16:58
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 26, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • testng.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/elasticactors/.codeql-scratch/dbs/java/working/files-to-index5721431052133658087.list --sourceArchiveDir=/home/REDACTED/work/elasticactors/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/elasticactors/.codeql-scratch/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on supporting retries with smaller batch sizes Add recursion guard to prevent infinite splitting in batch processing Dec 26, 2025
Copilot AI requested a review from jwijgerd December 26, 2025 17:05
@jwijgerd jwijgerd marked this pull request as ready for review December 31, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants