Description
Currently, IntermediateMemoryToMemoryMerger invokes unconditionalReserve() to get the memory needed for intermediate mem-to-mem merging. It could potentially cause issue in the following scenario
1. tez.runtime.io.sort.factor set to 100 and assume shuffled data (e.g 60% memory occupied) haven't reached TEZ_RUNTIME_SHUFFLE_MERGE_PERCENT_DEFAULT
2. Assume that it reaches the sort.factor threshold before reaching merge threshold. This would kick in IntermediateMemoryToMemoryMerger.
In IntermediateMemoryToMemoryMerger, it would try to allocate additional 60% without any boundary checks. This could lead to OOM depending on the tez.runtime.io.sort.mb setting.