Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-16139

Update BPServiceActor Scheduler's nextBlockReportTime atomically

    XMLWordPrintableJSON

Details

    Description

      BPServiceActor#Scheduler's nextBlockReportTime is declared volatile and it can be assigned/read by testing threads (through BPServiceActor#triggerXXX) as well as by actor threads. Hence it is declared volatile but it is still assigned non-atomically

      e.g

      if (factor != 0) {
        nextBlockReportTime += factor * blockReportIntervalMs;
      } else {
        // If the difference between the present time and the scheduled
        // time is very less, the factor can be 0, so in that case, we can
        // ignore that negligible time, spent while sending the BRss and
        // schedule the next BR after the blockReportInterval.
        nextBlockReportTime += blockReportIntervalMs;
      }
      

      We should convert it to AtomicLong to take care of concurrent assignments while making sure that it is assigned atomically.

      Attachments

        Issue Links

          Activity

            People

              vjasani Viraj Jasani
              vjasani Viraj Jasani
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h