Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-36242

Ensure spill file closed before set success to true in ExternalSorter.spillMemoryIteratorToDisk method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.3, 3.1.2, 3.2.0, 3.3.0
    • 3.2.0, 3.1.3, 3.0.4, 3.3.0
    • Spark Core
    • None

    Description

      The processes of ExternalSorter.spillMemoryIteratorToDisk and ExternalAppendOnlyMap.spillMemoryIteratorToDisk are similar, but there are some differences in setting `success = true`

       

      Code of ExternalSorter.spillMemoryIteratorToDisk as follows:

       

            if (objectsWritten > 0) {
              flush()
            } else {
              writer.revertPartialWritesAndClose()
            }
            success = true
          } finally {
            if (success) {
              writer.close()
            } else {
              ...
            }
          }

      Code of ExternalSorter.spillMemoryIteratorToDisk as follows:

        if (objectsWritten > 0) {
          flush()
          writer.close()
        } else {
          writer.revertPartialWritesAndClose()
        }
        success = true
      } finally {
        if (!success) {
          ...
        }
      }

      It seems that the processing of `ExternalSorter.spillMemoryIteratorToDisk` mehod is more reasonable, We should make sure setting `success = true` after the spill file is closed

       

      Attachments

        Activity

          People

            LuciferYang Yang Jie
            LuciferYang Yang Jie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: