Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5080 Create a memory-managed version of the External Sort operator
  3. DRILL-5023

ExternalSortBatch does not spill fully, throws off spill calculations

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.8.0
    • 1.11.0
    • None
    • None

    Description

      The ExternalSortBatch (ESB) operator sorts records, spilling to disk as needed to operate within a defined memory budget.

      When needed, ESB spills accumulated record batches to disk. However, when doing so, the ESB carves off the first spillable batch and holds it in memory:

          // 1 output container is kept in memory, so we want to hold on to it and transferClone
          // allows keeping ownership
          VectorContainer c1 = VectorContainer.getTransferClone(outputContainer, oContext);
          c1.buildSchema(BatchSchema.SelectionVectorMode.NONE);
          c1.setRecordCount(count);
      ...
          BatchGroup newGroup = new BatchGroup(c1, fs, outputFile, oContext);
      

      When the spill batch size gets larger (to fix DRILL-5022), the result is that nothing is spilled as the first spillable batch is simply stored back into memory on the (supposedly) spilled batches list.

      The desired behavior is for all spillable batches to be written to disk. If the first batch is held back to work around some issue (to keep a schema, say?), then fine a different solution that allows the actual data to spill.

      Attachments

        Activity

          People

            paul-rogers Paul Rogers
            paul-rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: