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

All fields in TaskMetrics should be private and use getters/setters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.3.0
    • Spark Core

    Description

      This is particularly bad because we expose this as a developer API. Technically a library could create a TaskMetrics object and then change the values inside of it and pass it onto someone else. It can be written pretty compactly like below:

        /**
         * Number of bytes written for the shuffle by this task
         */
        @volatile private var _shuffleBytesWritten: Long = _
        def incrementShuffleBytesWritten(value: Long) = _shuffleBytesWritten += value
        def decrementShuffleBytesWritten(value: Long) = _shuffleBytesWritten -= value
        def shuffleBytesWritten = _shuffleBytesWritten
      

      Attachments

        Activity

          People

            ilganeli Ilya Ganelin
            pwendell Patrick Wendell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: