Github user Ben-Zvi commented on a diff in the pull request: https://github.com/apache/drill/pull/761#discussion_r103068095 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/managed/ExternalSortBatch.java --- @@ -765,12 +838,12 @@ private void processBatch() { spillFromMemory(); } - // Sanity check. We should now be above the spill point. + // Sanity check. We should now be below the buffer memory maximum. long startMem = allocator.getAllocatedMemory(); - if (memoryLimit - startMem < spillPoint) { - logger.error( "ERROR: Failed to spill below the spill point. Spill point = {}, free memory = {}", - spillPoint, memoryLimit - startMem); + if (startMem > bufferMemoryPool) { + logger.error( "ERROR: Failed to spill above buffer limit. Buffer pool = {}, memory = {}", + bufferMemoryPool, startMem); --- End diff -- Do we need to return or throw an exception here ?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---