Bladeren bron
HPCC-22736 Allow KJ to dynamically spill in transit groups
Because KJ is highly parallel, there can be a lot of pending
(and completed) lhs+rhs match groups in flight. They can be:
1) Complete but not read
2) Complete but due to ordering, blocked by a earlier but yet
incomplete matching group
3) Incomplete, still waiting for matches from in progress lookups
If the RHS groups are big and the RHS joins fields are sizeable,
this can use significant memory.
This PR tackles this scenario by dynamically spilling groups,
preferring completed groups for ease (due to ordering issues),
and scaling back on the amount of concurrent groups queueud being
matched, so over time less memory will be used.
There also changes to free rows as soon as possible, e.g.
as each row is read or deserialized, rather than when the join
group is finished with.
There was also a bug that caused the queue of done groups (those
match groups waiting to be read) to exceed the configured limit.
Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>