Skip to content

Conversation

cpjulia
Copy link
Contributor

@cpjulia cpjulia commented Sep 5, 2025

Scope & Purpose

This PR introduces memory supervision to the MERGE instruction in the Aql query runtime.
MERGE previously constructed its result with an unsupervised velocypack::Buffer, mean
ing temporary allocations were invisible to the query’s ResourceMonitor.

In intermediate steps of the query processing, if a VPackBuilder is used as auxiliary storage structure and a resource monitor for the query is available, instead of creating a builder wrapping a regular Buffer, we use a supervised buffer, from lib/Basics/SupervisedBuffer.h. This buffer internally increases/decreases memory which the resource monitor accounts, because, temporarily, it can expand the memory consumption up to a value that could make the query surpass its memory limit. Also, Aql values can build up the memory usage, so they are also supervised and increase/decrease the memory monitor, so memory is properly accounted. With this, when the memory limit is surpassed, instead of crashing the system, the query crashes, allowing for the system to keep running.

Obs.: this is a companion to #21936, which implements supervision for the COLLECT instruction.

  • 💩 Bugfix
  • 🍕 New feature
  • 🔥 Performance improvement
  • 🔨 Refactoring/simplification

Checklist

  • Tests
    • Regression tests
    • C++ Unit tests
    • integration tests
    • resilience tests
  • 📖 CHANGELOG entry made -> to be made when find out if both this PR and Feature/collect memory monitoring #21936 should have the same entry
  • 📚 documentation written (release notes, API changes, ...)
  • Backports
    • Backport for 3.12.0: (Please link PR)
    • Backport for 3.11: (Please link PR)
    • Backport for 3.10: (Please link PR)

Related Information

(Please reference tickets / specification / other PRs etc)

  • Docs PR: -> might need to be done
  • Enterprise PR:
  • GitHub issue / Jira ticket:
  • Design document:

@cla-bot cla-bot bot added the cla-signed label Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant