Skip to content

Spill error (oom) with sort merge join #19013

Description

@xxhZs

Describe the bug

I run some data(300g) in small mem(64g) with sort merge join spill.
Then i get error
Failed to allocate additional {} for {} with {} already allocated for this reservation - {} remain available for the total pool

And i try to fix it. I fix two code
remove this code:

self.reservation.try_resize(self.converter.size())?;

and

match self.reservation.try_grow(size) {

to

loop {
match self.reservation.try_grow(size) {
Ok(_) => Ok(()),
Err(e) => {
if self.in_mem_batches.is_empty() {
return Err(Self::err_with_oom_context(e));
}

            // Spill and try again.
            self.sort_and_spill_in_mem_batches().await?;
    }

}

I think the issues are as follows:

  1. The memory was immediately occupied as soon as the sort operator spilled data to disk.
  2. The row operator failed to spill data to disk, which caused this problem.
    So could we fix it in this way, or are there any better solutions?

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions